fixed setting (and maybe inheriting) draw order for global animations
[rocksndiamonds.git] / src / anim.c
index dcd66e330f2862decf9856ccabd6c3ba97860a8b..0cb2023d85b6b21f1eb0f14bcf551f352942ace2 100644 (file)
@@ -535,6 +535,10 @@ static void InitGlobalAnimControls(void)
 
       anim->state = ANIM_STATE_INACTIVE;
 
+      // if draw order is undefined, set to default value "0"
+      if (anim->control_info.draw_order == ARG_UNDEFINED_VALUE)
+       anim->control_info.draw_order = 0;
+
       part_nr = 0;
 
       for (p = 0; p < NUM_GLOBAL_ANIM_PARTS_ALL; p++)
@@ -602,19 +606,14 @@ static void InitGlobalAnimControls(void)
          anim->has_base = TRUE;
        }
 
-       // apply special settings for pointer-style animations
-       if (part->control_info.class == get_hash_from_key("pointer"))
-       {
-         // force animation to be on top (must set anim and part control)
-         if (anim->control_info.draw_order == 0)
-           anim->control_info.draw_order = 1000000;
-         if (part->control_info.draw_order == 0)
-           part->control_info.draw_order = 1000000;
-
-         // force animation to pass-through clicks (must set part control)
-         if (part->control_info.style == STYLE_DEFAULT)
-           part->control_info.style |= STYLE_PASSTHROUGH;
-       }
+       // force pointer-style animations to pass-through clicks
+       if (part->control_info.class == get_hash_from_key("pointer") &&
+           part->control_info.style == STYLE_DEFAULT)
+         part->control_info.style |= STYLE_PASSTHROUGH;
+
+       // if draw order is undefined, inherit it from main animation
+       if (part->control_info.draw_order == ARG_UNDEFINED_VALUE)
+         part->control_info.draw_order = anim->control_info.draw_order;
       }
 
       if (anim->num_parts > 0 || anim->has_base)