From 5fcac1af0084bcd932441bc00a0cec95a529d922 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 19 May 2015 01:17:01 +0200 Subject: [PATCH] fixed warp-forward to skip redraw of most frames again --- src/tools.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/tools.c b/src/tools.c index 2bfae3c9..f4798540 100644 --- a/src/tools.c +++ b/src/tools.c @@ -560,11 +560,42 @@ void BackToFront() if (redraw_mask == REDRAW_NONE) return; + // redraw playfield if anything inside main playfield area needs redraw + if (redraw_mask & REDRAW_MAIN) + redraw_mask |= REDRAW_FIELD; + // draw masked border to all viewports, if defined DrawMaskedBorder(redraw_mask); - // blit backbuffer to visible screen - BlitBitmap(backbuffer, window, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); + // redraw complete window if both playfield and (some) doors need redraw + if (redraw_mask & REDRAW_FIELD && redraw_mask & REDRAW_DOORS) + redraw_mask = REDRAW_ALL; + + /* although redrawing the whole window would be fine for normal gameplay, + being able to only redraw the playfield is required for deactivating + certain drawing areas (mainly playfield) to work, which is needed for + warp-forward to be fast enough (by skipping redraw of most frames) */ + + if (redraw_mask & REDRAW_ALL) + { + BlitBitmap(backbuffer, window, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); + } + else if (redraw_mask & REDRAW_FIELD) + { + BlitBitmap(backbuffer, window, + REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, REAL_SX, REAL_SY); + } + else if (redraw_mask & REDRAW_DOORS) + { + if (redraw_mask & REDRAW_DOOR_1) + BlitBitmap(backbuffer, window, DX, DY, DXSIZE, DYSIZE, DX, DY); + + if (redraw_mask & REDRAW_DOOR_2) + BlitBitmap(backbuffer, window, VX, VY, VXSIZE, VYSIZE, VX, VY); + + if (redraw_mask & REDRAW_DOOR_3) + BlitBitmap(backbuffer, window, EX, EY, EXSIZE, EYSIZE, EX, EY); + } redraw_mask = REDRAW_NONE; } -- 2.34.1