From: Holger Schemel Date: Sat, 9 Sep 2023 13:55:44 +0000 (+0200) Subject: improved forced restart of global animations when restarting game X-Git-Tag: 4.3.7.0~22 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2845fcd0832f6b527e582c77354e82d433e4459b;p=rocksndiamonds.git improved forced restart of global animations when restarting game When forcing a restart of global animations when restarting the game, a full screen redraw is neither required nor desired. Therefore, this change only restarts global animations according to the game status passed to function "RestartGlobalAnimsByStatus()", but does not redraw the screen (including global animations, so nothing is drawn at all). --- diff --git a/src/anim.c b/src/anim.c index 8b307ea4..710383f3 100644 --- a/src/anim.c +++ b/src/anim.c @@ -857,6 +857,10 @@ static void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) } } + // when restarting global animations, do not redraw them, but stop here + if (drawing_stage == DRAW_GLOBAL_ANIM_STAGE_RESTART) + return; + if (global.anim_status == GAME_MODE_LOADING) return; @@ -2155,7 +2159,7 @@ void RestartGlobalAnimsByStatus(int status) global.anim_status = status; // force restarting global animations by changed global animation status - SDLRedrawWindow(); + DrawGlobalAnimationsExt(DRAW_TO_SCREEN, DRAW_GLOBAL_ANIM_STAGE_RESTART); global.anim_status = anim_status_last; } diff --git a/src/libgame/system.h b/src/libgame/system.h index d74b057b..44745de9 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -289,6 +289,7 @@ #define DRAW_GLOBAL_ANIM_STAGE_1 1 #define DRAW_GLOBAL_ANIM_STAGE_2 2 #define DRAW_GLOBAL_ANIM_STAGE_3 3 +#define DRAW_GLOBAL_ANIM_STAGE_RESTART 4 // values for drawing target (various functions) #define DRAW_TO_BACKBUFFER 0