PlayTestMpLevelHandler class
Plays a level being edited as multiplayer in local splitscreen.
As PlayTestLevelHandler, but the level runs a game mode of multiplayer for up to 4 players on one screen, as the game does for local splitscreen, so multiplayer starts, laps, bases and the rules of the game mode can be tried. The path of the first player is recorded.
Base classes
- class Jazz2::Multiplayer::MpLevelHandler
- Level handler of a multiplayer game session (online or local splitscreen).
- class IPlayTest
- A level being played from the editor, see PlayTestLevelHandler.
Constructors, destructors, conversion operators
- PlayTestMpLevelHandler(IRootController* root, const PlayTestOptions& options)
- Creates a new instance with its own local session, the root controller is the editor session.
- ~PlayTestMpLevelHandler() override
Public functions
- auto Initialize(const LevelDocument& document, StringView levelName, StringView fullPath) -> bool
- Loads the level from a document and spawns the players.
- 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 HandleLevelChange(LevelInitialization&& levelInit) override
- Called when the level is changed.
-
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.
Function documentation
bool Jazz2:: Editor:: PlayTestMpLevelHandler:: 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.