PlayTestLevelHandler class
Plays a level being edited.
An ordinary level handler, so the level plays exactly as in the game, but loaded from the level being edited and with the editor session as its root controller — leaving the level returns to the editor. The player can start somewhere else than at the start of the level, and its path is recorded.
Base classes
- class Jazz2::LevelHandler
- Level handler of a local game session.
- class IPlayTest
- A level being played from the editor, see PlayTestLevelHandler.
Constructors, destructors, conversion operators
- PlayTestLevelHandler(IRootController* root) explicit
- Creates a new instance, the root controller is the editor session.
- ~PlayTestLevelHandler() override
Public functions
- auto Initialize(const LevelDocument& document, StringView levelName, StringView fullPath, const PlayTestOptions& options) -> bool
- Loads the level from a document and spawns the player.
- auto GetLevelHandler() -> LevelHandler& override
- Returns the level handler that plays it.
-
auto GetViewport() const -> Rendering::
PlayerViewport* override - Returns the viewport of the first player, or
nullptr. -
auto GetPlayer() const -> Actors::
Player* override - Returns the first player, or
nullptr. - auto GetFrameTexture() const -> Texture* override
- Returns the texture the last frame was drawn into before it was scaled to the screen.
- void Suspend() override
- Stops the level for a while, it's kept as it is, its music and sound effects are paused.
- void Resume() override
- Continues the level after Suspend(), with the sound effects it paused.
-
auto IsLedgeClimbEnabled(const Actors::
Player* player) const -> bool override - Returns
trueif a player may climb ledges, see PreferencesCache::EnableLedgeClimb. - auto IsEditorPlayTest() const -> bool override
- Returns
trueif the level is played from the level editor, it returns there when it's left. - void ExitEditor() override
- Leaves the level editor the level is played from.
- auto SerializeResumableToStream(Stream& dest) -> bool override
- Serializes object state to a stream.
- void OnEndFrame() override
- Called at the end of each frame.
-
void HandlePlayerWarped(Actors::
Player* player, Vector2f prevPos, WarpFlags flags) override - Called when a player warps.
-
auto HandlePlayerDied(Actors::
Player* player) -> bool override - Called when a player dies.
Protected functions
- auto LoadLevel(LevelDescriptor& descriptor) -> bool override
- Loads the level of the handler into a level descriptor.
- void LoadLevelScripts(StringView fullPath) override
- Loads the scripts of the level, the weapons of the script as the editor has them, see PlayTestOptions::
ScriptText. - auto GetLevelLoadOptions() const -> LevelLoadOptions override
- Returns the options the level is loaded with, which decide what events are present.
- void SpawnPlayers(const LevelInitialization& levelInit) override
- Spawns all players.
Function documentation
bool Jazz2:: Editor:: PlayTestLevelHandler:: LoadLevel(LevelDescriptor& descriptor) override protected
Loads the level of the handler into a level descriptor.
The level is looked up by its name, and in the unknown episode if it isn't found there.