fixed stopping music if global anim music differs from current music
[rocksndiamonds.git] / src / anim.c
index 3f0a727cf47f96aa22feb70efab694be8b98122b..39f7e6469280c5a8da51dbc1bf13a0d0aaf92aaf 100644 (file)
@@ -961,7 +961,7 @@ static boolean SetGlobalAnimPart_Viewport(struct GlobalAnimPartControlInfo *part
     viewport_width  = part->graphic_info.width;
     viewport_height = part->graphic_info.height;
 
-    part->drawing_stage = DRAW_GLOBAL_ANIM_STAGE_2;
+    part->drawing_stage = DRAW_GLOBAL_ANIM_STAGE_3;
 
     // do not use global animation mouse pointer when reloading artwork
     if (global.anim_status != GAME_MODE_LOADING)
@@ -1082,6 +1082,13 @@ static void StopGlobalAnimMusic(struct GlobalAnimPartControlInfo *part)
   if (music == MUS_UNDEFINED)
     return;
 
+  char *anim_music = getMusicInfoEntryFilename(music);
+  char *curr_music = getCurrentlyPlayingMusicFilename();
+
+  // do not stop music if global anim music differs from current music
+  if (!strEqual(curr_music, anim_music))
+    return;
+
   StopMusic();
 
 #if 0
@@ -1997,12 +2004,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;