/* tiles currently on screen */
static int screentiles[MAX_PLAYFIELD_HEIGHT + 2][MAX_PLAYFIELD_WIDTH + 2];
static int crumbled_state[MAX_PLAYFIELD_HEIGHT + 2][MAX_PLAYFIELD_WIDTH + 2];
-static boolean redraw[MAX_PLAYFIELD_WIDTH + 2][MAX_PLAYFIELD_HEIGHT + 2];
/* copy the entire screen to the window at the scroll position */
void BackToFront_EM(void)
{
- int x, y;
-
/* blit all (up to four) parts of the scroll buffer to the backbuffer */
BlitScreenToBitmap_EM(backbuffer);
/* blit the completely updated backbuffer to the window (in one blit) */
BlitBitmap(backbuffer, window, SX, SY, SXSIZE, SYSIZE, SX, SY);
-
- for (x = 0; x < MAX_BUF_XSIZE; x++)
- for (y = 0; y < MAX_BUF_YSIZE; y++)
- redraw[x][y] = FALSE;
- redraw_tiles = 0;
}
void blitscreen(void)
screentiles[sy][sx] = obj;
crumbled_state[sy][sx] = crm;
-
- redraw[sx][sy] = TRUE;
- redraw_tiles++;
}
}
}
/* redraw screen tiles in the next frame (player may have left the tiles) */
screentiles[old_sy][old_sx] = -1;
screentiles[new_sy][new_sx] = -1;
-
- /* mark screen tiles as dirty (force screen refresh with changed content) */
- redraw[old_sx][old_sy] = TRUE;
- redraw[new_sx][new_sy] = TRUE;
- redraw_tiles += 2;
}
}
int mScrollX_last, mScrollY_last;
int ScreenBuffer[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2];
-boolean redraw[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2];
void RestorePlayfield()
TILEX_VAR * (dx == 1),
TILEY_VAR * (dy == 1));
- /* when scrolling the whole playfield, do not redraw single tiles */
- for (x = 0; x < 2 + MAX_PLAYFIELD_WIDTH + 2; x++)
- for (y = 0; y < 2 + MAX_PLAYFIELD_HEIGHT + 2; y++)
- redraw[x][y] = FALSE;
- redraw_tiles = 0;
-
DrawFrameIfNeeded();
for (y = DisplayMinY; y <= DisplayMaxY; y++)
void BackToFront_SP(void)
{
- int x, y;
-
BlitScreenToBitmap_SP(window);
-
- for (x = 0; x < 2 + MAX_PLAYFIELD_WIDTH + 2; x++)
- for (y = 0; y < 2 + MAX_PLAYFIELD_HEIGHT + 2; y++)
- redraw[x][y] = FALSE;
- redraw_tiles = 0;
}
void DDScrollBuffer_ScrollTo(int X, int Y)
extern int mScrollX, mScrollY;
extern int mScrollX_last, mScrollY_last;
-extern boolean redraw[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2];
-
-extern int TEST_flag;
-
extern void InitScrollPlayfield();
extern void UpdatePlayfield(boolean);
int sy2 = scy + (SCR_FIELDY + 1) * TILEY;
int sx = pX - sx1;
int sy = pY - sy1;
- int tile_x = sx / TILESIZE;
- int tile_y = sy / TILESIZE;
- int move_x = (sx + TILESIZE - 1) / TILESIZE;
- int move_y = (sy + TILESIZE - 1) / TILESIZE;
if (NoDisplayFlag)
return;
BlitBitmap(bitmap, bitmap_db_field_sp, SpriteX, SpriteY,
TILEX_VAR, TILEY_VAR, sx, sy);
-
- redraw[tile_x][tile_y] = TRUE;
- redraw_tiles++;
-
- if (move_x != tile_x)
- {
- redraw[move_x][tile_y] = TRUE;
- redraw_tiles++;
- }
- else if (move_y != tile_y)
- {
- redraw[tile_x][move_y] = TRUE;
- redraw_tiles++;
- }
}
void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame)
void InitGfxBackground()
{
- int x, y;
-
fieldbuffer = bitmap_db_field;
SetDrawtoField(DRAW_BACKBUFFER);
ClearRectangle(backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE);
- for (x = 0; x < MAX_BUF_XSIZE; x++)
- for (y = 0; y < MAX_BUF_YSIZE; y++)
- redraw[x][y] = 0;
- redraw_tiles = 0;
redraw_mask = REDRAW_ALL;
}
#endif
int redraw_mask = REDRAW_NONE;
-int redraw_tiles = 0;
int FrameCounter = 0;
#endif
extern int redraw_mask;
-extern int redraw_tiles;
extern int FrameCounter;
int key_joystick_mapping = 0;
-boolean redraw[2 + MAX_LEV_FIELDX + 2][2 + MAX_LEV_FIELDY + 2];
-int redraw_x1 = 0, redraw_y1 = 0;
-
short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern int key_joystick_mapping;
-extern boolean redraw[2 + MAX_LEV_FIELDX + 2][2 + MAX_LEV_FIELDY + 2];
-extern int redraw_x1, redraw_y1;
-
extern short Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
extern short MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
node->class_desc);
/* let BackToFront() redraw only what is needed */
- redraw_mask = last_redraw_mask | REDRAW_TILES;
+ redraw_mask = last_redraw_mask;
for (x = 0; x < SCR_FIELDX; x++)
MarkTileDirty(x, 1);
}
BY1 = -2;
BX2 = SCR_FIELDX + 1;
BY2 = SCR_FIELDY + 1;
- redraw_x1 = 2;
- redraw_y1 = 2;
drawto_field = fieldbuffer;
}
BY1 = 0;
BX2 = SCR_FIELDX - 1;
BY2 = SCR_FIELDY - 1;
- redraw_x1 = 0;
- redraw_y1 = 0;
drawto_field = backbuffer;
}
void BackToFront()
{
- int x, y;
DrawBuffer *buffer = (drawto_field == window ? backbuffer : drawto_field);
- // never redraw single tiles, always redraw the whole field
- if (redraw_mask & REDRAW_TILES)
- redraw_mask |= REDRAW_FIELD;
-
#if 0
/* !!! TEST ONLY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
/* (force full redraw) */
redraw_mask |= REDRAW_FIELD;
#endif
- if (redraw_mask & REDRAW_FIELD)
- redraw_mask &= ~REDRAW_TILES;
-
if (redraw_mask == REDRAW_NONE)
return;
printf("[REDRAW_ALL]");
if (redraw_mask & REDRAW_FIELD)
printf("[REDRAW_FIELD]");
- if (redraw_mask & REDRAW_TILES)
- printf("[REDRAW_TILES]");
if (redraw_mask & REDRAW_DOOR_1)
printf("[REDRAW_DOOR_1]");
if (redraw_mask & REDRAW_DOOR_2)
printf(" [%d]\n", FrameCounter);
#endif
- if (redraw_mask & REDRAW_TILES &&
- game_status == GAME_MODE_PLAYING &&
- border.draw_masked[GAME_MODE_PLAYING])
- redraw_mask |= REDRAW_FIELD;
-
if (global.fps_slowdown && game_status == GAME_MODE_PLAYING)
{
static boolean last_frame_skipped = FALSE;
DrawTextExt(window, SX + SXSIZE + SX, 0, text, FONT_TEXT_2, BLIT_OPAQUE);
}
- for (x = 0; x < MAX_BUF_XSIZE; x++)
- for (y = 0; y < MAX_BUF_YSIZE; y++)
- redraw[x][y] = 0;
- redraw_tiles = 0;
redraw_mask = REDRAW_NONE;
}
void MarkTileDirty(int x, int y)
{
- int xx = redraw_x1 + x;
- int yy = redraw_y1 + y;
-
- if (!redraw[xx][yy])
- redraw_tiles++;
-
- redraw[xx][yy] = TRUE;
- redraw_mask |= REDRAW_TILES;
+ redraw_mask |= REDRAW_FIELD;
}
void SetBorderElement()