added support for post delay for global animations
authorHolger Schemel <info@artsoft.org>
Sun, 14 Feb 2016 22:25:47 +0000 (23:25 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 14 Feb 2016 22:25:47 +0000 (23:25 +0100)
src/cartoons.c

index efe9ebcdb7c5b0e59e1e9d6d65440f8b039d24e2..e588cc80747d2366ff22409202b7eb1bf3abebe8 100644 (file)
@@ -528,7 +528,25 @@ int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state)
     part->anim_delay_value--;
 
     if (part->anim_delay_value == 0)
+    {
+      part->post_delay_value =
+       (c->post_delay_fixed + GetSimpleRandom(c->post_delay_random));
+
+      if (part->post_delay_value > 0)
+       return ANIM_STATE_RUNNING;
+
       return ANIM_STATE_RESTART | ANIM_STATE_RUNNING;
+    }
+  }
+
+  if (part->post_delay_value > 0)
+  {
+    part->post_delay_value--;
+
+    if (part->post_delay_value == 0)
+      return ANIM_STATE_RESTART;
+
+    return ANIM_STATE_WAITING;
   }
 
   if (!DelayReachedExt(&part->step_delay, part->step_delay_value,