X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fanim.c;h=a531ceb84548eeec6059fa5ecea9d00100f01318;hp=2ebf520f79d793a365b5acdedfbdc77a5ea263e5;hb=ab13e068d9c605bc5d6b751e743e26a2cf9ec619;hpb=f50b39e5a25f45c554d42130174da25d90131e57 diff --git a/src/anim.c b/src/anim.c index 2ebf520f..a531ceb8 100644 --- a/src/anim.c +++ b/src/anim.c @@ -1197,6 +1197,8 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part, part->anim_delay_counter = (c->anim_delay_fixed + GetSimpleRandom(c->anim_delay_random)); + part->post_delay_counter = 0; + part->init_event_state = (c->init_event != ANIM_EVENT_UNDEFINED); part->anim_event_state = (c->anim_event != ANIM_EVENT_UNDEFINED); @@ -1633,20 +1635,20 @@ static void DoAnimationExt(void) static boolean DoGlobalAnim_EventAction(struct GlobalAnimPartControlInfo *part) { - int anim_event_action = part->control_info.anim_event_action; + int anim_event_action = (part->init_event_state ? + part->control_info.init_event_action : + part->control_info.anim_event_action); if (anim_event_action == -1) return FALSE; - boolean action_executed = (DoGadgetAction(anim_event_action) || - DoScreenAction(anim_event_action) || - DoKeysymAction(anim_event_action)); + PushUserEvent(USEREVENT_ANIM_EVENT_ACTION, anim_event_action, 0); // check if further actions are allowed to be executed if (part->control_info.style & STYLE_MULTIPLE_ACTIONS) return FALSE; - return action_executed; + return TRUE; } static void InitGlobalAnim_Clickable(void) @@ -1795,7 +1797,7 @@ static void ResetGlobalAnim_Clicked(void) InitGlobalAnim_Clicked(-1, -1, ANIM_CLICKED_RESET); } -boolean HandleGlobalAnimClicks(int mx, int my, int button) +boolean HandleGlobalAnimClicks(int mx, int my, int button, boolean force_click) { static boolean click_consumed = FALSE; static int last_button = 0; @@ -1803,6 +1805,9 @@ boolean HandleGlobalAnimClicks(int mx, int my, int button) boolean release_event; boolean click_consumed_current = click_consumed; + if (button != 0 && force_click) + last_button = 0; + // check if button state has changed since last invocation press_event = (button != 0 && last_button == 0); release_event = (button == 0 && last_button != 0);