From: Holger Schemel Date: Fri, 5 Apr 2024 15:42:08 +0000 (+0200) Subject: fixed bug with game restart request when opening/closing doors X-Git-Tag: 4.4.0.0-test-1~105 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=00e52ef0b245eadf05f9dd416b29ebec5a47c767;p=rocksndiamonds.git fixed bug with game restart request when opening/closing doors --- diff --git a/src/game.c b/src/game.c index 2c16aa62..5c3cc9d3 100644 --- a/src/game.c +++ b/src/game.c @@ -4621,6 +4621,7 @@ void InitGame(void) game.restart_level = FALSE; game.request_active = FALSE; game.envelope_active = FALSE; + game.any_door_active = FALSE; if (level.game_engine_type == GAME_ENGINE_TYPE_MM) InitGameActions_MM(); @@ -16342,7 +16343,7 @@ boolean CheckRestartGame(void) } // do not ask to play again if request dialog is already active - if (game.request_active) + if (checkRequestActive()) return FALSE; // do not ask to play again if request dialog already handled @@ -16411,6 +16412,11 @@ boolean checkGameEnded(void) return (checkGameSolved() || checkGameFailed()); } +boolean checkRequestActive(void) +{ + return (game.request_active || game.envelope_active || game.any_door_active); +} + // ---------------------------------------------------------------------------- // random generator functions diff --git a/src/game.h b/src/game.h index 6f4f760d..c5eba4f1 100644 --- a/src/game.h +++ b/src/game.h @@ -258,6 +258,7 @@ struct GameInfo // values for special request dialog control boolean request_active; boolean envelope_active; + boolean any_door_active; // values for special game control int centered_player_nr; @@ -477,6 +478,7 @@ boolean checkGamePlaying(void); boolean checkGameSolved(void); boolean checkGameFailed(void); boolean checkGameEnded(void); +boolean checkRequestActive(void); unsigned int InitEngineRandom_RND(int); unsigned int RND(int); diff --git a/src/tools.c b/src/tools.c index fe1cbc50..d83cb75a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -5517,6 +5517,8 @@ unsigned int MoveDoor(unsigned int door_state) SetDoorBackgroundImage(IMG_BACKGROUND_DOOR); + game.any_door_active = TRUE; + for (k = start; k < num_move_steps; k++) { int last_frame = num_move_steps - 1; // last frame of this "for" loop @@ -5711,6 +5713,8 @@ unsigned int MoveDoor(unsigned int door_state) BackToFront(); } } + + game.any_door_active = FALSE; } if (door_state & DOOR_ACTION_1)