+ Debug("anim:InitGlobalAnim_Triggered",
+ "%d.%d: 0x%08x, 0x%08x [0x%08x] <--- TRIGGERED BY %d.%d",
+ anim2_nr, part2_nr, c->init_event, c->anim_event, mask,
+ anim_nr, part_nr);
+ else
+ Debug("anim:InitGlobalAnim_Triggered",
+ "%d.%d: 0x%08x, 0x%08x [0x%08x]",
+ anim2_nr, part2_nr, c->init_event, c->anim_event, mask);
+#endif
+ }
+ }
+}
+
+static void InitGlobalAnim_Triggered_ByCustomElement(int nr, int page,
+ int x, int y)
+{
+ struct GlobalAnimControlInfo *ctrl = &global_anim_ctrl[GAME_MODE_PLAYING];
+
+ int event_value = ANIM_EVENT_CE_CHANGE;
+ int event_bits = (nr << ANIM_EVENT_CE_BIT) | (page << ANIM_EVENT_PAGE_BIT);
+ int mask = event_value | event_bits;
+ int anim2_nr;
+
+ for (anim2_nr = 0; anim2_nr < ctrl->num_anims; anim2_nr++)
+ {
+ struct GlobalAnimMainControlInfo *anim2 = &ctrl->anim[anim2_nr];
+ int part2_nr;
+
+ for (part2_nr = 0; part2_nr < anim2->num_parts_all; part2_nr++)
+ {
+ struct GlobalAnimPartControlInfo *part2 = &anim2->part[part2_nr];
+
+ if (!(part2->state & ANIM_STATE_RUNNING))
+ continue;
+
+ if (isClickablePart(part2, mask) && !part2->triggered)
+ {
+ struct GraphicInfo *c = &part2->control_info;
+
+ if (c->position == POS_CE)
+ {
+ // store CE tile and offset position to handle scrolling
+ part2->tile_x = x;
+ part2->tile_y = y;
+ part2->tile_xoffset = c->x;
+ part2->tile_yoffset = c->y;
+
+ // restart animation (by using current sync frame)
+ part2->initial_anim_sync_frame = anim_sync_frame;
+ }
+
+ part2->triggered = TRUE;
+
+ // do not trigger any other animation if CE change event was consumed
+ if (c->style == STYLE_CONSUME_CE_EVENT)
+ return;