From: Holger Schemel Date: Tue, 10 Oct 2017 21:25:18 +0000 (+0200) Subject: fixed problem with global animations being restarted if screen changes to same game... X-Git-Tag: 4.0.1.1~35 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2722043bbea282f3e74e6617cbc75e4df928fb3c;p=rocksndiamonds.git fixed problem with global animations being restarted if screen changes to same game mode (like navigation inside setup or levelset menu) --- diff --git a/src/anim.c b/src/anim.c index 37c7193c..83be4309 100644 --- a/src/anim.c +++ b/src/anim.c @@ -206,6 +206,7 @@ static unsigned int anim_sync_frame = 0; static int game_mode_anim_classes[NUM_GAME_MODES]; static int anim_class_game_modes[NUM_ANIM_CLASSES]; +static int anim_status_last_before_fading = GAME_MODE_DEFAULT; static int anim_status_last = GAME_MODE_DEFAULT; static int anim_classes_last = ANIM_CLASS_NONE; @@ -560,6 +561,7 @@ void InitGlobalAnimControls() anim_class_game_modes[anim_class_game_modes_list[i].class_bit] = anim_class_game_modes_list[i].game_mode; + anim_status_last_before_fading = GAME_MODE_LOADING; anim_status_last = GAME_MODE_LOADING; anim_classes_last = ANIM_CLASS_NONE; } @@ -602,11 +604,14 @@ void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) // start or stop global animations by change of game mode // (special handling of animations for "current screen" and "all screens") - // stop animations for last screen - game_mode_anim_action[anim_status_last] = ANIM_STOP; + if (global.anim_status_next != anim_status_last_before_fading) + { + // stop animations for last screen before fading to new screen + game_mode_anim_action[anim_status_last] = ANIM_STOP; - // start animations for current screen - game_mode_anim_action[global.anim_status] = ANIM_START; + // start animations for current screen after fading to new screen + game_mode_anim_action[global.anim_status] = ANIM_START; + } // start animations for all screens after loading new artwork set if (anim_status_last == GAME_MODE_LOADING) @@ -635,7 +640,10 @@ void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage) if (drawing_target == DRAW_TO_SCREEN) { if (after_fading) + { anim_classes_last = anim_classes_next; + anim_status_last_before_fading = global.anim_status; + } anim_status_last = global.anim_status;