added showing game actions after game end when request envelope opens/closes
[rocksndiamonds.git] / src / tools.c
index 78adf94b51b76f898abd8b68bc609c8739e7bca0..8a8924e3c58646f4f34309a3eafad5e496dc6d1d 100644 (file)
@@ -3063,7 +3063,7 @@ static void PrepareEnvelopeRequestToScreen(Bitmap *bitmap, int sx, int sy,
 void DrawEnvelopeRequestToScreen(int drawing_target)
 {
   if (global.use_envelope_request &&
-      game.request_active_or_moving &&
+      game.request_active &&
       drawing_target == DRAW_TO_SCREEN)
   {
     if (graphic_info[IMG_BACKGROUND_REQUEST].draw_masked)
@@ -3255,6 +3255,8 @@ static void DrawEnvelopeRequest(char *text, unsigned int req_state)
 
 static void AnimateEnvelopeRequest(int anim_mode, int action)
 {
+  boolean game_just_ended = (game_status == GAME_MODE_PLAYING &&
+                            checkGameEnded());
   int delay_value_normal = request.step_delay;
   int delay_value_fast = delay_value_normal / 2;
   boolean ffwd_delay = (tape.playing && tape.fast_forward);
@@ -3303,6 +3305,9 @@ static void AnimateEnvelopeRequest(int anim_mode, int action)
     int dst_x, dst_y;
     int xx, yy;
 
+    if (game_just_ended)
+      HandleGameActions();
+
     setRequestPosition(&src_x, &src_y, FALSE);
     setRequestPositionExt(&dst_x, &dst_y, width, height, FALSE);
 
@@ -4504,12 +4509,6 @@ static int RequestHandleEvents(unsigned int req_state, int draw_buffer_game)
   int sx, sy;
   int result;
 
-  // when showing request dialog after game ended, deactivate game panel
-  if (game_just_ended)
-    game.panel.active = FALSE;
-
-  game.request_active = TRUE;
-
   setRequestPosition(&sx, &sy, FALSE);
 
   button_status = MB_RELEASED;
@@ -4810,8 +4809,6 @@ static int RequestHandleEvents(unsigned int req_state, int draw_buffer_game)
 
   SetDrawtoField(draw_buffer_last);
 
-  game.request_active = FALSE;
-
   return result;
 }
 
@@ -5086,10 +5083,16 @@ static boolean RequestEnvelope(char *text, unsigned int req_state)
 
 boolean Request(char *text, unsigned int req_state)
 {
+  boolean game_just_ended = (game_status == GAME_MODE_PLAYING &&
+                            checkGameEnded());
   boolean overlay_enabled = GetOverlayEnabled();
   boolean result;
 
-  game.request_active_or_moving = TRUE;
+  // when showing request dialog after game ended, deactivate game panel
+  if (game_just_ended)
+    game.panel.active = FALSE;
+
+  game.request_active = TRUE;
 
   SetOverlayEnabled(FALSE);
 
@@ -5100,7 +5103,7 @@ boolean Request(char *text, unsigned int req_state)
 
   SetOverlayEnabled(overlay_enabled);
 
-  game.request_active_or_moving = FALSE;
+  game.request_active = FALSE;
 
   return result;
 }