From: Holger Schemel Date: Mon, 5 Nov 2018 20:35:53 +0000 (+0100) Subject: moved flag for "game over" from player to game structure X-Git-Tag: 4.1.2.0~108 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d18eaeed7b265b71d147e9dfcd0a4ba3348e22f8;p=rocksndiamonds.git moved flag for "game over" from player to game structure This also removes asymmetric behaviour depending on players being the "local player" or any other player in team mode (which happened if one player dies and the other enters the exit, for example -- in one case, the game will be treated as "game over", in the other case the game will continue running without asking to play again). --- diff --git a/src/game.c b/src/game.c index acba22e9..2308c32b 100644 --- a/src/game.c +++ b/src/game.c @@ -3396,6 +3396,7 @@ void InitGame(void) player->killed = FALSE; player->reanimated = FALSE; + player->buried = FALSE; player->action = 0; player->effective_action = 0; @@ -3539,8 +3540,6 @@ void InitGame(void) DigField(player, 0, 0, 0, 0, 0, 0, DF_NO_PUSH); SnapField(player, 0, 0); - player->GameOver = FALSE; - map_player_action[i] = i; } @@ -3568,6 +3567,7 @@ void InitGame(void) AllPlayersGone = FALSE; game.LevelSolved = FALSE; + game.GameOver = FALSE; game.LevelSolved_GameWon = FALSE; game.LevelSolved_GameEnd = FALSE; @@ -4464,8 +4464,7 @@ static void LevelSolved(void) return; game.LevelSolved = TRUE; - - local_player->GameOver = TRUE; + game.GameOver = TRUE; local_player->score_final = (level.game_engine_type == GAME_ENGINE_TYPE_EM ? level.native_em_level->lev->score : @@ -5304,7 +5303,7 @@ static void RelocatePlayer(int jx, int jy, int el_player_raw) int enter_side = enter_side_horiz | enter_side_vert; int leave_side = leave_side_horiz | leave_side_vert; - if (player->GameOver) // do not reanimate dead player + if (player->buried) // do not reanimate dead player return; if (!player_relocated) // no need to relocate the player @@ -7951,7 +7950,7 @@ static void StartMoving(int x, int y) game.friends_still_needed--; if (!game.friends_still_needed && - !local_player->GameOver && AllPlayersGone) + !game.GameOver && AllPlayersGone) LevelSolved(); return; @@ -13404,8 +13403,10 @@ void BuryPlayer(struct PlayerInfo *player) PlayLevelSoundElementAction(jx, jy, player->artwork_element, ACTION_DYING); PlayLevelSound(jx, jy, SND_GAME_LOSING); - player->GameOver = TRUE; RemovePlayer(player); + + player->buried = TRUE; + game.GameOver = TRUE; } void RemovePlayer(struct PlayerInfo *player) @@ -15045,7 +15046,7 @@ boolean checkGameFailed(void) else if (level.game_engine_type == GAME_ENGINE_TYPE_MM) return (game_mm.game_over && !game_mm.level_solved); else // GAME_ENGINE_TYPE_RND - return (local_player->GameOver && !game.LevelSolved); + return (game.GameOver && !game.LevelSolved); } boolean checkGameEnded(void) diff --git a/src/game.h b/src/game.h index a0ffe85a..fffbefa2 100644 --- a/src/game.h +++ b/src/game.h @@ -186,6 +186,7 @@ struct GameInfo int belt_dir_nr[4]; int switchgate_pos; int wind_direction; + boolean explosions_delayed; boolean envelope_active; boolean no_time_limit; // (variable only in very special case) @@ -229,8 +230,9 @@ struct GameInfo // values for game engine snapshot control struct GameSnapshotInfo snapshot; - // values for handling states for solved level + // values for handling states for solved level and game over boolean LevelSolved; + boolean GameOver; boolean LevelSolved_GameWon; boolean LevelSolved_GameEnd; @@ -253,6 +255,7 @@ struct PlayerInfo boolean killed; // player maybe present/active, but killed boolean reanimated; // player maybe killed, but reanimated + boolean buried; // player finally killed and removed int index_nr; // player number (0 to 3) int index_bit; // player number bit (1 << 0 to 1 << 3) @@ -287,8 +290,6 @@ struct PlayerInfo boolean gravity; - boolean GameOver; - int last_move_dir; boolean is_active;