From 48d02823f8ca69be773caa16820adcd6ff9aa675 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 24 Jun 2022 16:48:04 +0200 Subject: [PATCH] added separate game variable to check for time limit setup option --- src/game.c | 11 ++++++----- src/game.h | 1 + src/game_em/logic.c | 2 +- src/game_mm/mm_game.c | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/game.c b/src/game.c index 01bea5ab..e650f4d3 100644 --- a/src/game.c +++ b/src/game.c @@ -3819,6 +3819,7 @@ void InitGame(void) game.panel.active = TRUE; game.no_level_time_limit = (level.time == 0); + game.time_limit = (setup.time_limit); game.yamyam_content_nr = 0; game.robot_wheel_active = FALSE; @@ -10227,7 +10228,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) DisplayGameControlValues(); - if (!TimeLeft && setup.time_limit) + if (!TimeLeft && game.time_limit) for (i = 0; i < MAX_PLAYERS; i++) KillPlayer(&stored_player[i]); } @@ -11637,14 +11638,14 @@ static void CheckLevelTime_StepCounter(void) { TimeLeft--; - if (TimeLeft <= 10 && setup.time_limit && !game.LevelSolved) + if (TimeLeft <= 10 && game.time_limit && !game.LevelSolved) PlaySound(SND_GAME_RUNNING_OUT_OF_TIME); game_panel_controls[GAME_PANEL_TIME].value = TimeLeft; DisplayGameControlValues(); - if (!TimeLeft && setup.time_limit && !game.LevelSolved) + if (!TimeLeft && game.time_limit && !game.LevelSolved) for (i = 0; i < MAX_PLAYERS; i++) KillPlayer(&stored_player[i]); } @@ -11686,7 +11687,7 @@ static void CheckLevelTime(void) { TimeLeft--; - if (TimeLeft <= 10 && setup.time_limit) + if (TimeLeft <= 10 && game.time_limit) PlaySound(SND_GAME_RUNNING_OUT_OF_TIME); /* this does not make sense: game_panel_controls[GAME_PANEL_TIME].value @@ -11694,7 +11695,7 @@ static void CheckLevelTime(void) game_panel_controls[GAME_PANEL_TIME].value = TimeLeft; - if (!TimeLeft && setup.time_limit) + if (!TimeLeft && game.time_limit) { if (level.game_engine_type == GAME_ENGINE_TYPE_EM) game_em.lev->killed_out_of_time = TRUE; diff --git a/src/game.h b/src/game.h index dee0f9cd..e96f7f93 100644 --- a/src/game.h +++ b/src/game.h @@ -204,6 +204,7 @@ struct GameInfo boolean explosions_delayed; boolean envelope_active; boolean no_level_time_limit; // (variable only in very special case) + boolean time_limit; // forced by setup option int time_final; // time (in seconds) or steps left or played int score_time_final; // time (in frames) or steps played diff --git a/src/game_em/logic.c b/src/game_em/logic.c index 1eaefcfc..61f3237c 100644 --- a/src/game_em/logic.c +++ b/src/game_em/logic.c @@ -293,7 +293,7 @@ static boolean player_killed(struct PLAYER *ply) if (!ply->alive) return FALSE; - if (lev.killed_out_of_time && setup.time_limit) + if (lev.killed_out_of_time && game.time_limit) return TRUE; switch (cave[x][y-1]) diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 52f0b01e..c97a7d3b 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -3119,7 +3119,7 @@ static void GameActions_MM_Ext(struct MouseActionInfo action, boolean warp_mode) redraw_mask |= REDRAW_DOOR_1; } - else if (setup.time_limit && !game_mm.game_over) + else if (game.time_limit && !game_mm.game_over) { int i; -- 2.34.1