fixed bug with using wrong draw buffer after request if game has ended
authorHolger Schemel <info@artsoft.org>
Wed, 16 Dec 2020 11:01:50 +0000 (12:01 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 16 Dec 2020 11:19:07 +0000 (12:19 +0100)
src/tools.c
src/tools.h

index de19e464567463177202220a0734e57367be1607..a042e88fe91f7c84bcb914da569720cd63036612 100644 (file)
@@ -462,6 +462,11 @@ void SetDrawtoField(int mode)
   }
 }
 
+int GetDrawtoField(void)
+{
+  return (drawto_field == fieldbuffer ? DRAW_TO_FIELDBUFFER : DRAW_TO_BACKBUFFER);
+}
+
 static void RedrawPlayfield_RND(void)
 {
   if (game.envelope_active)
@@ -4212,6 +4217,7 @@ static int RequestHandleEvents(unsigned int req_state)
 {
   boolean game_just_ended = (game_status == GAME_MODE_PLAYING &&
                             checkGameEnded());
+  int draw_buffer_last = GetDrawtoField();
   int width  = request.width;
   int height = request.height;
   int sx, sy;
@@ -4234,9 +4240,7 @@ static int RequestHandleEvents(unsigned int req_state)
   {
     if (game_just_ended)
     {
-      // the MM game engine does not use a special (scrollable) field buffer
-      if (level.game_engine_type != GAME_ENGINE_TYPE_MM)
-       SetDrawtoField(DRAW_TO_FIELDBUFFER);
+      SetDrawtoField(draw_buffer_last);
 
       HandleGameActions();
 
@@ -4521,6 +4525,8 @@ static int RequestHandleEvents(unsigned int req_state)
     BackToFront();
   }
 
+  SetDrawtoField(draw_buffer_last);
+
   game.request_active = FALSE;
 
   return result;
index a58888bec0fd47176b950854225a56bcb433b868..de7bb467b567934821e134e1f25b8f45d0ecca38 100644 (file)
@@ -85,6 +85,7 @@ void DrawMaskedBorderToTarget(int);
 void DrawTileCursor(int);
 
 void SetDrawtoField(int);
+int GetDrawtoField(void);
 void RedrawPlayfield(void);
 void BlitScreenToBitmapExt_RND(Bitmap *, int, int);
 void BlitScreenToBitmap_RND(Bitmap *);