From a93153c12d13e8d4d14f42a2f399613bdf4e0dab Mon Sep 17 00:00:00 2001 From: Gregory Smith Date: Tue, 7 Jan 2025 20:35:53 -0500 Subject: [PATCH] fix issue #457; always let players respawn after a while, even on broken maps. (gated behind upcoming film profile) --- Source_Files/CSeries/FilmProfile.cpp | 8 ++++++++ Source_Files/CSeries/FilmProfile.h | 1 + Source_Files/GameWorld/player.cpp | 14 +++++++++++++- Source_Files/GameWorld/player.h | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Source_Files/CSeries/FilmProfile.cpp b/Source_Files/CSeries/FilmProfile.cpp index 417792e8d..0f4efe471 100644 --- a/Source_Files/CSeries/FilmProfile.cpp +++ b/Source_Files/CSeries/FilmProfile.cpp @@ -43,6 +43,7 @@ static FilmProfile alephone1_7 = { true, // m1_bce_pickup false, // network_items false, // hotkey_fix + false, // finally_respawn }; static FilmProfile alephone1_4 = { @@ -88,6 +89,7 @@ static FilmProfile alephone1_4 = { false, // m1_bce_pickup false, // network_items false, // hotkey_fix + false, // finally_respawn }; @@ -134,6 +136,7 @@ static FilmProfile alephone1_3 = { false, // m1_bce_pickup false, // network_items false, // hotkey_fix + false, // finally respawn }; static FilmProfile alephone1_2 = { @@ -179,6 +182,7 @@ static FilmProfile alephone1_2 = { false, // m1_bce_pickup false, // network_items false, // hotkey_fix + false, // finally respawn }; static FilmProfile alephone1_1 = { @@ -224,6 +228,7 @@ static FilmProfile alephone1_1 = { false, // m1_bce_pickup false, // network_items false, // hotkey_fix + false, // finally_respawn }; static FilmProfile alephone1_0 = { @@ -269,6 +274,7 @@ static FilmProfile alephone1_0 = { false, // m1_bce_pickup false, // network_items false, // hotkey_fix + false, // finally_respawn }; static FilmProfile marathon2 = { @@ -314,6 +320,7 @@ static FilmProfile marathon2 = { false, // m1_bce_pickup false, // network_items false, // hotkey_fix + false, // finally_respawn }; static FilmProfile marathon_infinity = { @@ -359,6 +366,7 @@ static FilmProfile marathon_infinity = { false, // m1_bce_pickup false, // network_items false, // hotkey_fix + false, // finally_respawn }; FilmProfile film_profile = alephone1_7; diff --git a/Source_Files/CSeries/FilmProfile.h b/Source_Files/CSeries/FilmProfile.h index 96ee7f769..2770edbe2 100644 --- a/Source_Files/CSeries/FilmProfile.h +++ b/Source_Files/CSeries/FilmProfile.h @@ -115,6 +115,7 @@ struct FilmProfile bool network_items; // early creation of players on new games to fix network items spawn bool hotkey_fix; // hotkeys no longer work when player is dead or carrying the ball + bool finally_respawn; // the player can respawn after 15 seconds regardless of being stationary }; extern FilmProfile film_profile; diff --git a/Source_Files/GameWorld/player.cpp b/Source_Files/GameWorld/player.cpp index f46b34c1d..4df488cf5 100644 --- a/Source_Files/GameWorld/player.cpp +++ b/Source_Files/GameWorld/player.cpp @@ -757,7 +757,17 @@ void update_players(ActionQueues* inActionQueuesToUse, bool inPredictive) /* do things dead players do (sit around and check for self-reincarnation) */ if (PLAYER_HAS_MAP_OPEN(player)) SET_PLAYER_MAP_STATUS(player, false); - if (PLAYER_IS_TOTALLY_DEAD(player) && (action_flags&_action_trigger_state) && (player->variables.action==_player_stationary||dynamic_world->player_count==1)) + + auto player_is_stationary = + (player->variables.action == _player_stationary) || + (dynamic_world->player_count == 1) || + (film_profile.finally_respawn && + dynamic_world->tick_count > + player->ticks_at_death + 15 * TICKS_PER_SECOND); + + if (PLAYER_IS_TOTALLY_DEAD(player) && + (action_flags&_action_trigger_state) && + player_is_stationary) { // ZZZ: let the player know why he's not respawning if(player->reincarnation_delay) @@ -1817,6 +1827,8 @@ static void kill_player( if (aggressor_player_index==player_index && (GET_GAME_OPTIONS()&_suicide_is_penalized)) player->reincarnation_delay+= SUICIDE_REINCARNATION_DELAY; kill_player_physics_variables(player_index); + + player->ticks_at_death = dynamic_world->tick_count; } static void give_player_initial_items( diff --git a/Source_Files/GameWorld/player.h b/Source_Files/GameWorld/player.h index c1cc45bd9..73507b2c4 100644 --- a/Source_Files/GameWorld/player.h +++ b/Source_Files/GameWorld/player.h @@ -421,6 +421,8 @@ struct player_data bool run_key; // not serialized, used by HUD + int32_t ticks_at_death; // not serialized + // ZZZ: since we don't put this structure directly into files or network communications, // there ought? to be no reason for the padding // int16 unused[256];