moved code to draw envelope request over global animations
[rocksndiamonds.git] / src / anim.c
index bd1847a9a72cb3cef58bb53bba49d8ba44129004..5e3a896ecc9ff2d1b9f909f388d7842338e8aefa 100644 (file)
@@ -974,8 +974,6 @@ void DrawGlobalAnimations(int drawing_target, int drawing_stage)
     ResetGlobalAnim_Clicked();
   }
 
-  DrawEnvelopeRequestToScreen(drawing_target, drawing_stage);
-
   if (gfx.cursor_mode_override != last_cursor_mode_override)
     SetMouseCursor(gfx.cursor_mode);
 }
@@ -1732,12 +1730,17 @@ static int HandleGlobalAnim_Part(struct GlobalAnimPartControlInfo *part,
   if (c->position == POS_CE)
   {
     // calculate playfield position (with scrolling) for related CE tile
+    // (do not use FX/FY, which are incorrect during envelope requests)
+    int FX0 = 2 * TILEX_VAR;   // same as FX during DRAW_TO_FIELDBUFFER
+    int FY0 = 2 * TILEY_VAR;   // same as FY during DRAW_TO_FIELDBUFFER
     int fx = getFieldbufferOffsetX_RND(ScreenMovDir, ScreenGfxPos);
     int fy = getFieldbufferOffsetY_RND(ScreenMovDir, ScreenGfxPos);
-    int sx = FX + SCREENX(part->tile_x) * TILEX_VAR;
-    int sy = FY + SCREENY(part->tile_y) * TILEY_VAR;
-    int x = sx - fx;
-    int y = sy - fy;
+    int sx = FX0 + SCREENX(part->tile_x) * TILEX_VAR;
+    int sy = FY0 + SCREENY(part->tile_y) * TILEY_VAR;
+    int cx = SX - REAL_SX;
+    int cy = SY - REAL_SY;
+    int x = sx - fx + cx;
+    int y = sy - fy + cy;
 
     part->tile_xoffset += part->step_xoffset;
     part->tile_yoffset += part->step_yoffset;