RaceMode class
Race game mode.
Players race to complete a number of laps. This mode owns its HUD (lap counter, lap timer, track minimap and standings) through OnDrawHUD. Its round logic — lap counting, overtime and the win condition — is still handled by the host for now, so OwnsRoundLogic returns false and the gameplay hooks below are not yet invoked (they keep the interface satisfied until the logic is ported in a later phase).
Base classes
- class IGameMode
- Rules of a single multiplayer game mode.
Derived classes
- class TeamRaceMode
- Team Race game mode.
Public functions
- auto GetMode() const -> MpGameMode override
- Returns the game mode identifier.
- auto IsTeamBased() const -> bool override
- Returns whether players are split into teams.
- auto SkipsPreGameCountdown() const -> bool override
- Returns whether the pre-game wait and countdown are skipped (Cooperation starts immediately).
- auto HasUnlimitedHealth() const -> bool override
- Returns whether players have unlimited health in this mode.
- auto LowerScoreWins() const -> bool override
- Returns whether a lower round score ranks higher (Race finishes first).
- auto OwnsRoundLogic() const -> bool override
- Returns whether this mode computes its own win condition (CheckGameEnds).
- void OnRoundStarted(IGameModeContext& ctx) override
- Called when the round starts (after the countdown) to reset/initialize mode state.
- void OnUpdate(IGameModeContext& ctx, float timeMult) override
- Called every host tick while the round is running.
-
void OnPlayerSpawned(IGameModeContext& ctx,
Actors::
Player* player) override - Called after a player (re)spawns.
-
void OnPlayerKilled(IGameModeContext& ctx,
Actors::
Player* victim, Actors:: Player* killer) override - Called when a player dies, for mode-specific reactions (e.g. dropping a carried flag); kill/death counts are maintained by the host.
killermay benullptr(environmental death). -
auto DecideRespawn(IGameModeContext& ctx,
Actors::
Player* player) -> RespawnDecision override - Decides whether and where the specified player should respawn.
-
void OnCoinsCollected(IGameModeContext& ctx,
Actors::
Player* player, std:: int32_t prevCount, std:: int32_t newCount) override - Called when a player's coin count changes.
-
void OnGemsCollected(IGameModeContext& ctx,
Actors::
Player* player, std:: uint8_t gemType, std:: int32_t prevCount, std:: int32_t newCount) override - Called when a player's gem count changes.
-
auto OnLevelExitReached(IGameModeContext& ctx,
Actors::
Player* player) -> LevelExitAction override - Decides what happens when the specified player reaches the level exit.
- auto CheckGameEnds(IGameModeContext& ctx) -> GameEndResult override
- Checks whether the round should end now, and who won.
- void AssignTeams(IGameModeContext& ctx) override
- (Re)assigns players to teams (free-for-all modes assign one team per player)
-
auto GetRoundScore(IGameModeContext& ctx,
Actors::
Player* player) -> std:: uint32_t override - Returns the ranking metric of the specified player (kills / laps / treasure / ...).
-
void OnDrawHUD(IGameModeContext& ctx,
IGameModeHUD& hud,
Actors::
Player* player, const Rectf& view) override - Draws the mode-specific part of the HUD for the given player's split-screen view.
Function documentation
bool Jazz2:: Multiplayer:: RaceMode:: OwnsRoundLogic() const override
Returns whether this mode computes its own win condition (CheckGameEnds).
Returns true once the mode owns its win-condition check. While false — used during the staged migration — the host runs its legacy win-condition logic for this mode instead. Level-exit (OnLevelExitReached), respawn (DecideRespawn) and the HUD (OnDrawHUD) are always driven by the mode regardless of this flag.