changed global animation sounds to stop before post delay
authorHolger Schemel <info@artsoft.org>
Wed, 13 Apr 2016 19:10:51 +0000 (21:10 +0200)
committerHolger Schemel <info@artsoft.org>
Wed, 13 Apr 2016 19:10:51 +0000 (21:10 +0200)
src/cartoons.c

index 97e2ee43126ffbed0f9f91e3a66e6b68a9d21e7f..2e0743646589c34105146d28404cc9c217b415c8 100644 (file)
@@ -865,14 +865,15 @@ int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state)
     if (part->anim_delay_counter == 0 &&
        part->post_delay_counter == 0)
     {
+      StopGlobalAnimSound(part);
+
       part->post_delay_counter =
        (c->post_delay_fixed + GetSimpleRandom(c->post_delay_random));
 
       if (part->post_delay_counter > 0)
        return ANIM_STATE_RUNNING;
 
-      StopGlobalAnimSound(part);
-
+      // drawing last frame not needed here -- animation not visible anymore
       return ANIM_STATE_RESTART;
     }
   }
@@ -883,14 +884,14 @@ int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state)
 
     if (part->anim_delay_counter == 0)
     {
+      StopGlobalAnimSound(part);
+
       part->post_delay_counter =
        (c->post_delay_fixed + GetSimpleRandom(c->post_delay_random));
 
       if (part->post_delay_counter > 0)
        return ANIM_STATE_RUNNING;
 
-      StopGlobalAnimSound(part);
-
       // additional state "RUNNING" required to not skip drawing last frame
       return ANIM_STATE_RESTART | ANIM_STATE_RUNNING;
     }
@@ -900,9 +901,6 @@ int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, int state)
   {
     part->post_delay_counter--;
 
-    if (part->post_delay_counter == 0)
-      StopGlobalAnimSound(part);
-
     if (part->post_delay_counter == 0)
       return ANIM_STATE_RESTART;