+ if (global.anim_status != anim_status_last)
+ {
+ boolean before_fading = (global.anim_status == GAME_MODE_PSEUDO_FADING);
+ boolean after_fading = (anim_status_last == GAME_MODE_PSEUDO_FADING);
+ int anim_classes_next = game_mode_anim_classes[global.anim_status_next];
+ int i;
+
+ // ---------- part 1 ------------------------------------------------------
+ // 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
+ HandleGlobalAnim(ANIM_STOP, anim_status_last);
+
+ // start animations for current screen
+ HandleGlobalAnim(ANIM_START, global.anim_status);
+
+ // start animations for all screens after loading new artwork set
+ if (anim_status_last == GAME_MODE_LOADING)
+ HandleGlobalAnim(ANIM_START, GAME_MODE_DEFAULT);
+
+ // ---------- part 2 ------------------------------------------------------
+ // start or stop global animations by change of animation class
+ // (generic handling of animations for "class of screens")
+
+ for (i = 0; i < NUM_ANIM_CLASSES; i++)
+ {
+ int anim_class_check = (1 << i);
+ int anim_class_game_mode = anim_class_game_modes[i];
+ int anim_class_last = anim_classes_last & anim_class_check;
+ int anim_class_next = anim_classes_next & anim_class_check;
+
+ // stop animations for changed screen class before fading to new screen
+ if (before_fading && anim_class_last && !anim_class_next)
+ HandleGlobalAnim(ANIM_STOP, anim_class_game_mode);
+
+ // start animations for changed screen class after fading to new screen
+ if (after_fading && !anim_class_last && anim_class_next)
+ HandleGlobalAnim(ANIM_START, anim_class_game_mode);
+ }