From: Holger Schemel Date: Sun, 14 Feb 2016 22:25:47 +0000 (+0100) Subject: added support for post delay for global animations X-Git-Tag: 4.0.0.0-rc1~69 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f3fcbd4b5178edd13e80258f4c03db65a79ce29a;p=rocksndiamonds.git added support for post delay for global animations --- diff --git a/src/cartoons.c b/src/cartoons.c index efe9ebcd..e588cc80 100644 --- a/src/cartoons.c +++ b/src/cartoons.c @@ -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,