fixed bug with global animation at wrong playfield position for one frame
[rocksndiamonds.git] / src / anim.c
index 3dd9a14394766938b2c762d0303e824c03eb53dc..ee2e1ede3fa881b979cabb5aa548acd5a617ba64 100644 (file)
@@ -1461,16 +1461,17 @@ static void InitGlobalAnim_Triggered_ByCustomElement(int nr, int page,
 
        if (c->position == POS_CE)
        {
-         // may contain negative tile offset that is treated as "off-screen"
-         part2->x = 0;
-         part2->y = 0;
-
          // 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;
 
+         // set resulting animation position relative to CE tile position
+         // (but only for ".init_event", not ".anim_event" type events)
+         if (part2->init_event_state)
+           SetGlobalAnimPartTileXY(part2);
+
          // restart animation (by using current sync frame)
          part2->initial_anim_sync_frame = anim_sync_frame;
        }