projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed unneeded tape recorder display update
[rocksndiamonds.git]
/
src
/
tools.c
diff --git
a/src/tools.c
b/src/tools.c
index ec059e12146082ca1613378e6e11ce18e1491d92..7ec68260c039aa73114f50eda882f07dd1884c1b 100644
(file)
--- a/
src/tools.c
+++ b/
src/tools.c
@@
-528,6
+528,22
@@
static void PrintFrameTimeDebugging()
}
#endif
}
#endif
+static int unifiedRedrawMask(int mask)
+{
+ if (mask & REDRAW_ALL)
+ return REDRAW_ALL;
+
+ if (mask & REDRAW_FIELD && mask & REDRAW_DOORS)
+ return REDRAW_ALL;
+
+ return mask;
+}
+
+static boolean equalRedrawMasks(int mask_1, int mask_2)
+{
+ return unifiedRedrawMask(mask_1) == unifiedRedrawMask(mask_2);
+}
+
void BackToFront()
{
static int last_redraw_mask = REDRAW_NONE;
void BackToFront()
{
static int last_redraw_mask = REDRAW_NONE;
@@
-550,6
+566,10
@@
void BackToFront()
if (redraw_mask & REDRAW_FPS)
DrawFramesPerSecond();
if (redraw_mask & REDRAW_FPS)
DrawFramesPerSecond();
+ // remove playfield redraw before potentially merging with doors redraw
+ if (DrawingDeactivated(REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE))
+ redraw_mask &= ~REDRAW_FIELD;
+
// redraw complete window if both playfield and (some) doors need redraw
if (redraw_mask & REDRAW_FIELD && redraw_mask & REDRAW_DOORS)
redraw_mask = REDRAW_ALL;
// redraw complete window if both playfield and (some) doors need redraw
if (redraw_mask & REDRAW_FIELD && redraw_mask & REDRAW_DOORS)
redraw_mask = REDRAW_ALL;
@@
-570,14
+590,37
@@
void BackToFront()
}
else if (redraw_mask & REDRAW_DOORS)
{
}
else if (redraw_mask & REDRAW_DOORS)
{
+ // merge door areas to prevent calling screen redraw more than once
+ int x1 = WIN_XSIZE;
+ int y1 = WIN_YSIZE;
+ int x2 = 0;
+ int y2 = 0;
+
if (redraw_mask & REDRAW_DOOR_1)
if (redraw_mask & REDRAW_DOOR_1)
- BlitBitmap(backbuffer, window, DX, DY, DXSIZE, DYSIZE, DX, DY);
+ {
+ x1 = MIN(x1, DX);
+ y1 = MIN(y1, DY);
+ x2 = MAX(x2, DX + DXSIZE);
+ y2 = MAX(y2, DY + DYSIZE);
+ }
if (redraw_mask & REDRAW_DOOR_2)
if (redraw_mask & REDRAW_DOOR_2)
- BlitBitmap(backbuffer, window, VX, VY, VXSIZE, VYSIZE, VX, VY);
+ {
+ x1 = MIN(x1, VX);
+ y1 = MIN(y1, VY);
+ x2 = MAX(x2, VX + VXSIZE);
+ y2 = MAX(y2, VY + VYSIZE);
+ }
if (redraw_mask & REDRAW_DOOR_3)
if (redraw_mask & REDRAW_DOOR_3)
- BlitBitmap(backbuffer, window, EX, EY, EXSIZE, EYSIZE, EX, EY);
+ {
+ x1 = MIN(x1, EX);
+ y1 = MIN(y1, EY);
+ x2 = MAX(x2, EX + EXSIZE);
+ y2 = MAX(y2, EY + EYSIZE);
+ }
+
+ BlitBitmap(backbuffer, window, x1, y1, x2 - x1, y2 - y1, x1, y1);
}
redraw_mask = REDRAW_NONE;
}
redraw_mask = REDRAW_NONE;
@@
-704,10
+747,6
@@
static void SetScreenStates_AfterFadingIn()
gfx.fade_border_source_status = global.border_status;
global.anim_status = global.anim_status_next;
gfx.fade_border_source_status = global.border_status;
global.anim_status = global.anim_status_next;
-
- // force update of global animation status in case of rapid screen changes
- redraw_mask = REDRAW_ALL;
- BackToFront();
}
static void SetScreenStates_BeforeFadingOut()
}
static void SetScreenStates_BeforeFadingOut()
@@
-746,10
+785,18
@@
void FadeIn(int fade_mask)
FADE_SYSIZE = FULL_SYSIZE;
SetScreenStates_AfterFadingIn();
FADE_SYSIZE = FULL_SYSIZE;
SetScreenStates_AfterFadingIn();
+
+ // force update of global animation status in case of rapid screen changes
+ redraw_mask = REDRAW_ALL;
+ BackToFront();
}
void FadeOut(int fade_mask)
{
}
void FadeOut(int fade_mask)
{
+ // update screen if areas covered by "fade_mask" and "redraw_mask" differ
+ if (!equalRedrawMasks(fade_mask, redraw_mask))
+ BackToFront();
+
SetScreenStates_BeforeFadingOut();
#if 0
SetScreenStates_BeforeFadingOut();
#if 0
@@
-1024,7
+1071,7
@@
static void RedrawGlobalBorderIfNeeded()
// copy current draw buffer to later copy back areas that have not changed
if (game_status_last != GAME_MODE_TITLE)
// copy current draw buffer to later copy back areas that have not changed
if (game_status_last != GAME_MODE_TITLE)
- BlitBitmap(backbuffer, bitmap_db_store, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+ BlitBitmap(backbuffer, bitmap_db_store
_1
, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
if (CheckIfGlobalBorderRedrawIsNeeded())
{
if (CheckIfGlobalBorderRedrawIsNeeded())
{
@@
-1037,20
+1084,20
@@
static void RedrawGlobalBorderIfNeeded()
if (real_sx_last != -1 && real_sy_last != -1 &&
REAL_SX != -1 && REAL_SY != -1 &&
full_sxsize_last == FULL_SXSIZE && full_sysize_last == FULL_SYSIZE)
if (real_sx_last != -1 && real_sy_last != -1 &&
REAL_SX != -1 && REAL_SY != -1 &&
full_sxsize_last == FULL_SXSIZE && full_sysize_last == FULL_SYSIZE)
- BlitBitmap(bitmap_db_store, backbuffer,
+ BlitBitmap(bitmap_db_store
_1
, backbuffer,
real_sx_last, real_sy_last, FULL_SXSIZE, FULL_SYSIZE,
REAL_SX, REAL_SY);
if (dx_last != -1 && dy_last != -1 &&
DX != -1 && DY != -1 &&
dxsize_last == DXSIZE && dysize_last == DYSIZE)
real_sx_last, real_sy_last, FULL_SXSIZE, FULL_SYSIZE,
REAL_SX, REAL_SY);
if (dx_last != -1 && dy_last != -1 &&
DX != -1 && DY != -1 &&
dxsize_last == DXSIZE && dysize_last == DYSIZE)
- BlitBitmap(bitmap_db_store, backbuffer,
+ BlitBitmap(bitmap_db_store
_1
, backbuffer,
dx_last, dy_last, DXSIZE, DYSIZE, DX, DY);
if (vx_last != -1 && vy_last != -1 &&
VX != -1 && VY != -1 &&
vxsize_last == VXSIZE && vysize_last == VYSIZE)
dx_last, dy_last, DXSIZE, DYSIZE, DX, DY);
if (vx_last != -1 && vy_last != -1 &&
VX != -1 && VY != -1 &&
vxsize_last == VXSIZE && vysize_last == VYSIZE)
- BlitBitmap(bitmap_db_store, backbuffer,
+ BlitBitmap(bitmap_db_store
_1
, backbuffer,
vx_last, vy_last, VXSIZE, VYSIZE, VX, VY);
redraw_mask = REDRAW_ALL;
vx_last, vy_last, VXSIZE, VYSIZE, VX, VY);
redraw_mask = REDRAW_ALL;
@@
-2498,7
+2545,7
@@
void DrawEnvelopeRequest(char *text)
RedrawGadget(tool_gadget[i]);
// store readily prepared envelope request for later use when animating
RedrawGadget(tool_gadget[i]);
// store readily prepared envelope request for later use when animating
- BlitBitmap(backbuffer, bitmap_db_
cross
, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+ BlitBitmap(backbuffer, bitmap_db_
store_2
, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
if (text_door_style)
free(text_door_style);
if (text_door_style)
free(text_door_style);
@@
-2559,7
+2606,7
@@
void AnimateEnvelopeRequest(int anim_mode, int action)
setRequestPosition(&src_x, &src_y, FALSE);
setRequestPositionExt(&dst_x, &dst_y, width, height, FALSE);
setRequestPosition(&src_x, &src_y, FALSE);
setRequestPositionExt(&dst_x, &dst_y, width, height, FALSE);
- BlitBitmap(bitmap_db_store, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+ BlitBitmap(bitmap_db_store
_1
, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
for (yy = 0; yy < 2; yy++)
{
for (yy = 0; yy < 2; yy++)
{
@@
-2573,10
+2620,10
@@
void AnimateEnvelopeRequest(int anim_mode, int action)
int yy_size = (yy ? tile_size : ysize_size_top);
if (draw_masked)
int yy_size = (yy ? tile_size : ysize_size_top);
if (draw_masked)
- BlitBitmapMasked(bitmap_db_
cross
, backbuffer,
+ BlitBitmapMasked(bitmap_db_
store_2
, backbuffer,
src_xx, src_yy, xx_size, yy_size, dst_xx, dst_yy);
else
src_xx, src_yy, xx_size, yy_size, dst_xx, dst_yy);
else
- BlitBitmap(bitmap_db_
cross
, backbuffer,
+ BlitBitmap(bitmap_db_
store_2
, backbuffer,
src_xx, src_yy, xx_size, yy_size, dst_xx, dst_yy);
}
}
src_xx, src_yy, xx_size, yy_size, dst_xx, dst_yy);
}
}
@@
-2609,7
+2656,7
@@
void ShowEnvelopeRequest(char *text, unsigned int req_state, int action)
if (action == ACTION_OPENING)
{
if (action == ACTION_OPENING)
{
- BlitBitmap(backbuffer, bitmap_db_store, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+ BlitBitmap(backbuffer, bitmap_db_store
_1
, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
if (req_state & REQ_ASK)
{
if (req_state & REQ_ASK)
{
@@
-2656,7
+2703,7
@@
void ShowEnvelopeRequest(char *text, unsigned int req_state, int action)
game.envelope_active = FALSE;
if (action == ACTION_CLOSING)
game.envelope_active = FALSE;
if (action == ACTION_CLOSING)
- BlitBitmap(bitmap_db_store, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+ BlitBitmap(bitmap_db_store
_1
, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
// SetDrawBackgroundMask(last_draw_background_mask);
// SetDrawBackgroundMask(last_draw_background_mask);
@@
-3561,7
+3608,7
@@
static int RequestHandleEvents(unsigned int req_state)
if (global.use_envelope_request)
{
/* copy current state of request area to middle of playfield area */
if (global.use_envelope_request)
{
/* copy current state of request area to middle of playfield area */
- BlitBitmap(bitmap_db_
cross
, drawto, sx, sy, width, height, sx, sy);
+ BlitBitmap(bitmap_db_
store_2
, drawto, sx, sy, width, height, sx, sy);
}
}
}
}
@@
-3689,7
+3736,7
@@
static int RequestHandleEvents(unsigned int req_state)
if (global.use_envelope_request)
{
/* copy back current state of pressed buttons inside request area */
if (global.use_envelope_request)
{
/* copy back current state of pressed buttons inside request area */
- BlitBitmap(drawto, bitmap_db_
cross
, sx, sy, width, height, sx, sy);
+ BlitBitmap(drawto, bitmap_db_
store_2
, sx, sy, width, height, sx, sy);
}
}
}
}