From c9f607a3507174565b5228cc03f9a31169baa8c8 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sun, 20 Aug 2023 16:36:36 +0200 Subject: [PATCH] fixed one-frame delay when global animations leave "init" state This fixes a bug for global animations which either have an initial delay or an initial event defined, causing a delay of one screen frame after the initial waiting state has ended and before the running state (which displays the global animation) is started. This can especially be visible if a changing CE is graphically replaced with a global animation triggered by the CE change. --- src/anim.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/anim.c b/src/anim.c index c1fb1ee6..de94b17f 100644 --- a/src/anim.c +++ b/src/anim.c @@ -1598,7 +1598,7 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, if (part->initial_anim_sync_frame > 0) { if (part->init_delay_counter > 0) - part->initial_anim_sync_frame -= part->init_delay_counter - 1; + part->initial_anim_sync_frame -= part->init_delay_counter; else part->initial_anim_sync_frame = anim_sync_frame; } @@ -1630,9 +1630,13 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, HandleGlobalAnimDelay(part, ANIM_DELAY_INIT, "START [INIT_DELAY]"); HandleGlobalAnimEvent(part, ANIM_EVENT_START, "START [ANIM]"); - } - return ANIM_STATE_WAITING; + // continue with state ANIM_STATE_RUNNING (set below) + } + else + { + return ANIM_STATE_WAITING; + } } if (part->init_event_state) -- 2.34.1