From: Holger Schemel Date: Thu, 10 Mar 2016 16:19:52 +0000 (+0100) Subject: fixed new animation mode (modifier) 'once' for global animations X-Git-Tag: 4.0.0.0-rc1~50 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=30bda8e769e79e4c9830ec769a38c0f73d274b72;p=rocksndiamonds.git fixed new animation mode (modifier) 'once' for global animations --- diff --git a/src/cartoons.c b/src/cartoons.c index 4423d271..0563e1de 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -780,7 +780,6 @@ void HandleGlobalAnim_Main(struct GlobalAnimMainControlInfo *anim, int action) { struct GlobalAnimPartControlInfo *part; struct GraphicInfo *c = &anim->control_info; - boolean skip = FALSE; #if 0 printf("::: HandleGlobalAnim_Main: %d, %d => %d\n", @@ -806,21 +805,19 @@ void HandleGlobalAnim_Main(struct GlobalAnimMainControlInfo *anim, int action) anim->state = ANIM_STATE_RESTART; anim->part_counter = 0; anim->active_part_nr = 0; - skip = TRUE; break; case ANIM_CONTINUE: if (anim->state == ANIM_STATE_INACTIVE) - skip = TRUE; + return; break; case ANIM_STOP: anim->state = ANIM_STATE_INACTIVE; - skip = TRUE; - break; + return; default: break; @@ -845,38 +842,35 @@ void HandleGlobalAnim_Main(struct GlobalAnimMainControlInfo *anim, int action) case ANIM_START: anim->state = ANIM_STATE_RUNNING; part->state = ANIM_STATE_RESTART; - skip = TRUE; break; case ANIM_CONTINUE: if (part->state == ANIM_STATE_INACTIVE) - skip = TRUE; + continue; break; case ANIM_STOP: part->state = ANIM_STATE_INACTIVE; - skip = TRUE; - break; + continue; default: break; } - if (skip) - continue; - part->state = HandleGlobalAnim_Part(part, part->state); + + // when animation mode is "once", stop after animation was played once + if (c->anim_mode & ANIM_ONCE && + part->state & ANIM_STATE_RESTART) + part->state = ANIM_STATE_INACTIVE; } return; } - if (skip) - return; - if (anim->state & ANIM_STATE_RESTART) // directly after restart anim->active_part_nr = getGlobalAnimationPart(anim); @@ -889,8 +883,9 @@ void HandleGlobalAnim_Main(struct GlobalAnimMainControlInfo *anim, int action) if (anim->state & ANIM_STATE_RESTART) anim->part_counter++; - if (anim->part_counter == anim->num_parts && - c->anim_mode & ANIM_ONCE) + // when animation mode is "once", stop after all animations were played once + if (c->anim_mode & ANIM_ONCE && + anim->part_counter == anim->num_parts) anim->state = ANIM_STATE_INACTIVE; }