From: Holger Schemel Date: Sat, 18 Feb 2023 15:53:25 +0000 (+0100) Subject: improved forced restart of global animations when restarting game X-Git-Tag: 4.3.5.1~3 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4542dedd9ed31f1eaf2639a903c83d6f47909d93;p=rocksndiamonds.git improved forced restart of global animations when restarting game --- diff --git a/src/anim.c b/src/anim.c index 3f0a727c..2f0278ef 100644 --- a/src/anim.c +++ b/src/anim.c @@ -1997,12 +1997,13 @@ static void ResetGlobalAnim_Clicked(void) InitGlobalAnim_Clicked(-1, -1, ANIM_CLICKED_RESET); } -void RestartGlobalAnims(void) +void RestartGlobalAnimsByStatus(int status) { int anim_status_last = global.anim_status; - global.anim_status = GAME_MODE_LOADING; + global.anim_status = status; + // force restarting global animations by changed global animation status SDLRedrawWindow(); global.anim_status = anim_status_last; diff --git a/src/anim.h b/src/anim.h index a1be4b06..d16d9237 100644 --- a/src/anim.h +++ b/src/anim.h @@ -18,7 +18,7 @@ int getAnimationFrame(int, int, int, int, int); void InitGlobalAnimations(void); void DrawGlobalAnimations(int, int); -void RestartGlobalAnims(void); +void RestartGlobalAnimsByStatus(int); boolean HandleGlobalAnimClicks(int, int, int, boolean); diff --git a/src/game.c b/src/game.c index 197ad64d..edf9686c 100644 --- a/src/game.c +++ b/src/game.c @@ -3588,7 +3588,7 @@ void InitGame(void) if (restarting) { // force fading out global animations displayed during game play - SetGameStatus(GAME_MODE_LOADING); + SetGameStatus(GAME_MODE_PSEUDO_RESTARTING); } else { @@ -3612,7 +3612,7 @@ void InitGame(void) if (restarting) { // force restarting global animations displayed during game play - RestartGlobalAnims(); + RestartGlobalAnimsByStatus(GAME_MODE_PSEUDO_RESTARTING); SetGameStatus(GAME_MODE_PLAYING); } diff --git a/src/main.h b/src/main.h index 188f00b3..6439fd48 100644 --- a/src/main.h +++ b/src/main.h @@ -2340,6 +2340,7 @@ enum GFX_SPECIAL_ARG_SCORESNEW, GFX_SPECIAL_ARG_NO_TITLE, GFX_SPECIAL_ARG_FADING, + GFX_SPECIAL_ARG_RESTARTING, GFX_SPECIAL_ARG_QUIT, NUM_SPECIAL_GFX_ARGS @@ -2599,6 +2600,7 @@ enum #define GAME_MODE_PSEUDO_SCORESNEW GFX_SPECIAL_ARG_SCORESNEW #define GAME_MODE_PSEUDO_NO_TITLE GFX_SPECIAL_ARG_NO_TITLE #define GAME_MODE_PSEUDO_FADING GFX_SPECIAL_ARG_FADING +#define GAME_MODE_PSEUDO_RESTARTING GFX_SPECIAL_ARG_RESTARTING #define GAME_MODE_QUIT GFX_SPECIAL_ARG_QUIT #define NUM_GAME_MODES NUM_SPECIAL_GFX_ARGS