fixed nasty bug that stopped animations when defining 'door_2' off-screen
authorHolger Schemel <info@artsoft.org>
Thu, 12 Jan 2017 23:48:52 +0000 (00:48 +0100)
committerHolger Schemel <info@artsoft.org>
Thu, 12 Jan 2017 23:48:52 +0000 (00:48 +0100)
src/tools.c

index b07e19d37ee75fd9b92f6835d43513a67fa55f74..55a28fc40d0cf13ef90ec1df29c3910bb15e5661 100644 (file)
@@ -759,6 +759,13 @@ void BackToFront()
       y2 = MAX(y2, EY + EYSIZE);
     }
 
       y2 = MAX(y2, EY + EYSIZE);
     }
 
+    // make sure that at least one pixel is blitted, and inside the screen
+    // (else nothing is blitted, causing the animations not to be updated)
+    x1 = MIN(MAX(0, x1), WIN_XSIZE - 1);
+    y1 = MIN(MAX(0, y1), WIN_YSIZE - 1);
+    x2 = MIN(MAX(1, x2), WIN_XSIZE);
+    y2 = MIN(MAX(1, y2), WIN_YSIZE);
+
     BlitBitmap(backbuffer, window, x1, y1, x2 - x1, y2 - y1, x1, y1);
   }
 
     BlitBitmap(backbuffer, window, x1, y1, x2 - x1, y2 - y1, x1, y1);
   }