X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=1676bc894c6638865dc0457b441edd8fcbdd054a;hb=f47abfa991814f09bfc5e388f284663bd23e2829;hp=edc742da651a1f87cce68b41723cf6fb7b2a4be1;hpb=02527edeeaafdc8c3fafecea772b82fd770abc9b;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index edc742da..1676bc89 100644 --- a/src/tools.c +++ b/src/tools.c @@ -233,7 +233,7 @@ void DumpTile(int x, int y) void SetDrawtoField(int mode) { - if (mode == DRAW_BUFFERED && setup.soft_scrolling) + if (mode == DRAW_FIELDBUFFER) { FX = 2 * TILEX_VAR; FY = 2 * TILEY_VAR; @@ -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,21 +441,8 @@ void BlitScreenToBitmap(Bitmap *target_bitmap) void BackToFront() { - int x, y; DrawBuffer *buffer = (drawto_field == window ? backbuffer : drawto_field); - if (redraw_mask & REDRAW_TILES && redraw_tiles > REDRAWTILES_THRESHOLD) - redraw_mask |= REDRAW_FIELD; - -#if 0 - // never redraw single tiles, always redraw the whole field - // (redrawing single tiles up to a certain threshold was faster on old, - // now legacy graphics, but slows things down on modern graphics now) - // UPDATE: this is now globally defined by value of REDRAWTILES_THRESHOLD - if (redraw_mask & REDRAW_TILES) - redraw_mask |= REDRAW_FIELD; -#endif - #if 0 /* !!! TEST ONLY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ /* (force full redraw) */ @@ -467,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; @@ -479,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) @@ -490,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; @@ -585,70 +558,6 @@ void BackToFront() redraw_mask &= ~REDRAW_MICROLEVEL; } - if (redraw_mask & REDRAW_TILES) - { - int sx = SX; - int sy = SY; - - int dx = 0, dy = 0; - int dx_var = dx * TILESIZE_VAR / TILESIZE; - int dy_var = dy * TILESIZE_VAR / TILESIZE; - int ffx, ffy; - int fx = FX, fy = FY; - - int scr_fieldx = SCR_FIELDX + (EVEN(SCR_FIELDX) ? 2 : 0); - int scr_fieldy = SCR_FIELDY + (EVEN(SCR_FIELDY) ? 2 : 0); - - InitGfxClipRegion(TRUE, SX, SY, SXSIZE, SYSIZE); - - ffx = (scroll_x - SBX_Left) * TILEX_VAR + dx_var; - ffy = (scroll_y - SBY_Upper) * TILEY_VAR + dy_var; - - if (EVEN(SCR_FIELDX)) - { - if (ffx < SBX_Right * TILEX_VAR + TILEX_VAR / 2 + TILEX_VAR) - { - fx += dx_var - MIN(ffx, TILEX_VAR / 2) + TILEX_VAR; - - if (fx % TILEX_VAR) - sx -= TILEX_VAR / 2; - else - sx -= TILEX_VAR; - } - else - { - fx += (dx_var > 0 ? TILEX_VAR : 0); - } - } - - if (EVEN(SCR_FIELDY)) - { - if (ffy < SBY_Lower * TILEY_VAR + TILEY_VAR / 2 + TILEY_VAR) - { - fy += dy_var - MIN(ffy, TILEY_VAR / 2) + TILEY_VAR; - - if (fy % TILEY_VAR) - sy -= TILEY_VAR / 2; - else - sy -= TILEY_VAR; - } - else - { - fy += (dy_var > 0 ? TILEY_VAR : 0); - } - } - - for (x = 0; x < scr_fieldx; x++) - for (y = 0 ; y < scr_fieldy; y++) - if (redraw[redraw_x1 + x][redraw_y1 + y]) - BlitBitmap(buffer, window, - FX + x * TILEX_VAR, FY + y * TILEY_VAR, - TILEX_VAR, TILEY_VAR, - sx + x * TILEX_VAR, sy + y * TILEY_VAR); - - InitGfxClipRegion(FALSE, -1, -1, -1, -1); - } - if (redraw_mask & REDRAW_FPS) /* display frames per second */ { char text[100]; @@ -663,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; } @@ -951,10 +856,10 @@ void ClearField() DrawBackground(REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); /* !!! maybe this should be done before clearing the background !!! */ - if (setup.soft_scrolling && game_status == GAME_MODE_PLAYING) + if (game_status == GAME_MODE_PLAYING) { ClearRectangle(fieldbuffer, 0, 0, FXSIZE, FYSIZE); - SetDrawtoField(DRAW_BUFFERED); + SetDrawtoField(DRAW_FIELDBUFFER); } else SetDrawtoField(DRAW_BACKBUFFER); @@ -962,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() @@ -2154,7 +2052,7 @@ void AnimateEnvelope(int envelope_nr, int anim_mode, int action) int sy = SY + (SYSIZE - ysize * font_height) / 2; int xx, yy; - SetDrawtoField(DRAW_BUFFERED); + SetDrawtoField(DRAW_FIELDBUFFER); BlitScreenToBitmap(backbuffer); @@ -2215,7 +2113,7 @@ void ShowEnvelope(int envelope_nr) game.envelope_active = FALSE; - SetDrawtoField(DRAW_BUFFERED); + SetDrawtoField(DRAW_FIELDBUFFER); redraw_mask |= REDRAW_FIELD; BackToFront(); @@ -2467,7 +2365,6 @@ void ShowEnvelopeRequest(char *text, unsigned int req_state, int action) AnimateEnvelopeRequest(ANIM_DEFAULT, ACTION_OPENING); AnimateEnvelopeRequest(main_anim_mode, ACTION_OPENING); - } else { @@ -2504,7 +2401,7 @@ void ShowEnvelopeRequest(char *text, unsigned int req_state, int action) if (action == ACTION_CLOSING && game_status == GAME_MODE_PLAYING && level.game_engine_type == GAME_ENGINE_TYPE_RND) - SetDrawtoField(DRAW_BUFFERED); + SetDrawtoField(DRAW_FIELDBUFFER); } void DrawPreviewElement(int dst_x, int dst_y, int element, int tilesize) @@ -3149,9 +3046,6 @@ void DrawPlayer(struct PlayerInfo *player) syy = player->GfxPos; } - if (!setup.soft_scrolling && ScreenMovPos) - sxx = syy = 0; - if (player_is_opaque) DrawGraphicShifted(sx, sy, sxx, syy, graphic, frame,NO_CUTTING,NO_MASKING); else @@ -3257,9 +3151,6 @@ void DrawPlayer(struct PlayerInfo *player) syy = player->GfxPos; } - if (!setup.soft_scrolling && ScreenMovPos) - sxx = syy = 0; - if (player_is_opaque) DrawGraphicShifted(sx, sy, sxx, syy, graphic, frame,NO_CUTTING,NO_MASKING); else @@ -3410,9 +3301,6 @@ static int RequestHandleEvents(unsigned int req_state) { if (event.type == EVENT_MOTIONNOTIFY) { - if (!PointerInWindow(window)) - continue; /* window and pointer on different screens */ - if (!button_status) continue;