From: Holger Schemel Date: Fri, 15 May 2015 14:55:28 +0000 (+0200) Subject: removed obsolete code for single-tile playfield redraw X-Git-Tag: 4.0.0.0-rc1~208 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8e3612567b52232c0f1dff593546cb90b396911c;p=rocksndiamonds.git removed obsolete code for single-tile playfield redraw --- diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 05ac1a02..127d7925 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -36,7 +36,6 @@ int screen_x, screen_y; /* current scroll position */ /* 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 */ @@ -97,18 +96,11 @@ void BlitScreenToBitmap_EM(Bitmap *target_bitmap) 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) @@ -356,9 +348,6 @@ static void animscreen(void) screentiles[sy][sx] = obj; crumbled_state[sy][sx] = crm; - - redraw[sx][sy] = TRUE; - redraw_tiles++; } } } @@ -429,11 +418,6 @@ static void blitplayer(struct PLAYER *ply) /* 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; } } diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index e7664f76..6a53fa30 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -11,7 +11,6 @@ int mScrollX, mScrollY; 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() @@ -53,12 +52,6 @@ static void ScrollPlayfield(int dx, int dy) 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++) @@ -239,14 +232,7 @@ void BlitScreenToBitmap_SP(Bitmap *target_bitmap) 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) diff --git a/src/game_sp/DDScrollBuffer.h b/src/game_sp/DDScrollBuffer.h index e22db88e..20346b37 100644 --- a/src/game_sp/DDScrollBuffer.h +++ b/src/game_sp/DDScrollBuffer.h @@ -11,10 +11,6 @@ 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); diff --git a/src/game_sp/DDSpriteBuffer.c b/src/game_sp/DDSpriteBuffer.c index e2f47eee..261459ad 100644 --- a/src/game_sp/DDSpriteBuffer.c +++ b/src/game_sp/DDSpriteBuffer.c @@ -15,10 +15,6 @@ static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY) 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; @@ -32,20 +28,6 @@ static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY) 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) diff --git a/src/init.c b/src/init.c index 4808f114..c8b468c0 100644 --- a/src/init.c +++ b/src/init.c @@ -5198,17 +5198,11 @@ void RedrawGlobalBorder() 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; } diff --git a/src/libgame/system.c b/src/libgame/system.c index ecfc7fcc..5c2025b6 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -55,7 +55,6 @@ boolean keyrepeat_status = TRUE; #endif int redraw_mask = REDRAW_NONE; -int redraw_tiles = 0; int FrameCounter = 0; diff --git a/src/libgame/system.h b/src/libgame/system.h index 86dc01ac..ae32d93f 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1291,7 +1291,6 @@ extern boolean keyrepeat_status; #endif extern int redraw_mask; -extern int redraw_tiles; extern int FrameCounter; diff --git a/src/main.c b/src/main.c index 683276e9..81a35d87 100644 --- a/src/main.c +++ b/src/main.c @@ -41,9 +41,6 @@ SDL_Thread *server_thread; 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]; diff --git a/src/main.h b/src/main.h index 812f0951..60d53c38 100644 --- a/src/main.h +++ b/src/main.h @@ -2885,9 +2885,6 @@ extern SDL_Thread *server_thread; 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]; diff --git a/src/screens.c b/src/screens.c index 6e661ea5..68d9a680 100644 --- a/src/screens.c +++ b/src/screens.c @@ -3454,7 +3454,7 @@ static void drawChooseTreeInfo(int entry_pos, TreeInfo *ti) 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); } diff --git a/src/tools.c b/src/tools.c index be46e021..3ce90952 100644 --- a/src/tools.c +++ b/src/tools.c @@ -241,8 +241,6 @@ void SetDrawtoField(int mode) BY1 = -2; BX2 = SCR_FIELDX + 1; BY2 = SCR_FIELDY + 1; - redraw_x1 = 2; - redraw_y1 = 2; drawto_field = fieldbuffer; } @@ -254,8 +252,6 @@ void SetDrawtoField(int mode) BY1 = 0; BX2 = SCR_FIELDX - 1; BY2 = SCR_FIELDY - 1; - redraw_x1 = 0; - redraw_y1 = 0; drawto_field = backbuffer; } @@ -445,13 +441,8 @@ void BlitScreenToBitmap(Bitmap *target_bitmap) 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) */ @@ -459,9 +450,6 @@ void BackToFront() redraw_mask |= REDRAW_FIELD; #endif - if (redraw_mask & REDRAW_FIELD) - redraw_mask &= ~REDRAW_TILES; - if (redraw_mask == REDRAW_NONE) return; @@ -471,8 +459,6 @@ void BackToFront() 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) @@ -482,11 +468,6 @@ void BackToFront() 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; @@ -591,10 +572,6 @@ void BackToFront() 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; } @@ -890,14 +867,7 @@ void ClearField() 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()