Skip to content

Commit

Permalink
fix issue #457; always let players respawn after a while, even on bro…
Browse files Browse the repository at this point in the history
…ken maps.

(gated behind upcoming film profile)
  • Loading branch information
treellama committed Jan 8, 2025
1 parent 3f70ff5 commit a93153c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Source_Files/CSeries/FilmProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -88,6 +89,7 @@ static FilmProfile alephone1_4 = {
false, // m1_bce_pickup
false, // network_items
false, // hotkey_fix
false, // finally_respawn
};


Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -269,6 +274,7 @@ static FilmProfile alephone1_0 = {
false, // m1_bce_pickup
false, // network_items
false, // hotkey_fix
false, // finally_respawn
};

static FilmProfile marathon2 = {
Expand Down Expand Up @@ -314,6 +320,7 @@ static FilmProfile marathon2 = {
false, // m1_bce_pickup
false, // network_items
false, // hotkey_fix
false, // finally_respawn
};

static FilmProfile marathon_infinity = {
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions Source_Files/CSeries/FilmProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 13 additions & 1 deletion Source_Files/GameWorld/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions Source_Files/GameWorld/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit a93153c

Please sign in to comment.