From: Holger Schemel Date: Sun, 20 Aug 2023 11:53:24 +0000 (+0200) Subject: fixed bug when handling init and anim events for global animations X-Git-Tag: 4.3.7.0~28 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=cabd01b9666aa9a7260282cc313738c89d91ea46;p=rocksndiamonds.git fixed bug when handling init and anim events for global animations Before, defining ".init_event" as "click:anim_X" and ".anim_event" as "click" resulted in the global animation being started by clicking global animation "anim_X" (which is correct), but resulted in stopping it by clicking the animation itself (which is correct), but also by clicking global animation "anim_X" (which is not correct). --- diff --git a/src/anim.c b/src/anim.c index 219c79fd..a20ee4a3 100644 --- a/src/anim.c +++ b/src/anim.c @@ -1210,24 +1210,32 @@ static boolean checkGlobalAnimEvent(int anim_event, int mask) static boolean isClickablePart(struct GlobalAnimPartControlInfo *part, int mask) { struct GraphicInfo *c = &part->control_info; - int num_init_events = GetGlobalAnimEventValueCount(c->init_event); - int num_anim_events = GetGlobalAnimEventValueCount(c->anim_event); int i; - for (i = 0; i < num_init_events; i++) + if (part->init_event_state) { - int init_event = GetGlobalAnimEventValue(c->init_event, i); + int num_init_events = GetGlobalAnimEventValueCount(c->init_event); + + for (i = 0; i < num_init_events; i++) + { + int init_event = GetGlobalAnimEventValue(c->init_event, i); - if (checkGlobalAnimEvent(init_event, mask)) - return TRUE; + if (checkGlobalAnimEvent(init_event, mask)) + return TRUE; + } } - for (i = 0; i < num_anim_events; i++) + if (part->anim_event_state) { - int anim_event = GetGlobalAnimEventValue(c->anim_event, i); + int num_anim_events = GetGlobalAnimEventValueCount(c->anim_event); - if (checkGlobalAnimEvent(anim_event, mask)) - return TRUE; + for (i = 0; i < num_anim_events; i++) + { + int anim_event = GetGlobalAnimEventValue(c->anim_event, i); + + if (checkGlobalAnimEvent(anim_event, mask)) + return TRUE; + } } return FALSE;