fixed bug causing crash when trying to draw undefined optional graphics
[rocksndiamonds.git] / src / anim.c
index 6f902d979e1b0a56e97b5f56009b3f1b70da7959..23b26495307563590dbb0136b8ca4765fc0a229b 100644 (file)
@@ -600,6 +600,11 @@ void DrawGlobalAnimationsExt(int drawing_target, int drawing_stage)
     if (drawing_target == DRAW_TO_FADE_TARGET)
       after_fading = TRUE;
 
+    // special case: changing from/to this screen is done without fading
+    if (global.anim_status == GAME_MODE_PSEUDO_TYPENAME ||
+       anim_status_last   == GAME_MODE_PSEUDO_TYPENAME)
+      after_fading = TRUE;
+
     // ---------- part 1 ------------------------------------------------------
     // start or stop global animations by change of game mode
     // (special handling of animations for "current screen" and "all screens")
@@ -1464,7 +1469,8 @@ static boolean InitGlobalAnim_Clicked(int mx, int my, boolean clicked)
   boolean any_part_clicked = FALSE;
   int mode_nr;
 
-  for (mode_nr = 0; mode_nr < NUM_GAME_MODES; mode_nr++)
+  // check game modes in reverse draw order (to stop when clicked)
+  for (mode_nr = NUM_GAME_MODES - 1; mode_nr >= 0; mode_nr--)
   {
     struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[mode_nr];
     int anim_nr;