improved forced restart of global animations when restarting game
authorHolger Schemel <info@artsoft.org>
Sat, 18 Feb 2023 15:53:25 +0000 (16:53 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 18 Feb 2023 15:53:25 +0000 (16:53 +0100)
src/anim.c
src/anim.h
src/game.c
src/main.h

index 3f0a727cf47f96aa22feb70efab694be8b98122b..2f0278ef19360c83630208261d9cc28a3b107c30 100644 (file)
@@ -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;
index a1be4b06122679300e62eaff686b233fe3119d54..d16d92370c32bfb9462adddd39394688651ff4d6 100644 (file)
@@ -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);
 
index 197ad64da36c0756b2eee7af7493591c0c7f9e12..edf9686c4158e8f42c0f31cc65bfa38f55cef42b 100644 (file)
@@ -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);
   }
index 188f00b3dea4c07fd95817a094dcd65cd9f8289e..6439fd48b3bb2592e7af1361d3bf69b0ab551f30 100644 (file)
@@ -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