X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=801eb6b5b7f9c6e432d964407afe5c30b7565ecc;hb=e788c9b6a44d9f2dea7aa048b48a11b14761229e;hp=d467fcdab02194e28c0b98fe18be6567f47da3ba;hpb=e40c7f18cc72945f56b8cfcf99f11f5e0986d056;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index d467fcda..801eb6b5 100644 --- a/src/tools.c +++ b/src/tools.c @@ -11,26 +11,15 @@ * tools.c * ***********************************************************/ -#include - -#if defined(PLATFORM_FREEBSD) -#include -#endif - #include "libgame/libgame.h" #include "tools.h" #include "game.h" #include "events.h" -#include "joystick.h" #include "cartoons.h" #include "network.h" #include "tape.h" -#if defined(PLATFORM_MSDOS) -extern boolean wait_for_vsync; -#endif - /* tool button identifiers */ #define TOOL_CTRL_ID_YES 0 #define TOOL_CTRL_ID_NO 1 @@ -82,6 +71,51 @@ void SetDrawtoField(int mode) } } +void RedrawPlayfield(boolean force_redraw, int x, int y, int width, int height) +{ + if (game_status == PLAYING) + { + if (force_redraw) + { + x = gfx.sx - TILEX; + y = gfx.sy - TILEY; + width = gfx.sxsize + 2 * TILEX; + height = gfx.sysize + 2 * TILEY; + } + + if (force_redraw || setup.direct_draw) + { + int xx, yy; + int x1 = (x - SX) / TILEX, y1 = (y - SY) / TILEY; + int x2 = (x - SX + width) / TILEX, y2 = (y - SY + height) / TILEY; + + if (setup.direct_draw) + SetDrawtoField(DRAW_BACKBUFFER); + + for(xx=BX1; xx<=BX2; xx++) + for(yy=BY1; yy<=BY2; yy++) + if (xx >= x1 && xx <= x2 && yy >= y1 && yy <= y2) + DrawScreenField(xx, yy); + DrawAllPlayers(); + + if (setup.direct_draw) + SetDrawtoField(DRAW_DIRECT); + } + + if (setup.soft_scrolling) + { + int fx = FX, fy = FY; + + fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0); + fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0); + + BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY); + } + } + + BlitBitmap(drawto, window, x, y, width, height, x, y); +} + void BackToFront() { int x,y; @@ -96,7 +130,7 @@ void BackToFront() if (redraw_mask & REDRAW_FIELD) redraw_mask &= ~REDRAW_TILES; - if (!redraw_mask) + if (redraw_mask == REDRAW_NONE) return; if (global.fps_slowdown && game_status == PLAYING) @@ -257,7 +291,7 @@ void BackToFront() for(y=0; y