From: Holger Schemel Date: Wed, 7 Jul 2010 07:33:09 +0000 (+0200) Subject: rnd-20100707-1-src X-Git-Tag: 3.3.1.0^2~13 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8027f83cb6288618be3892b268760f25ca252606;p=rocksndiamonds.git rnd-20100707-1-src --- diff --git a/src/conftime.h b/src/conftime.h index 33348da5..3ac52c50 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2010-07-01 00:52" +#define COMPILE_DATE_STRING "2010-07-07 09:32" diff --git a/src/game.c b/src/game.c index 895c4d32..8236de11 100644 --- a/src/game.c +++ b/src/game.c @@ -4356,7 +4356,8 @@ void InitGame() #if NEW_TILESIZE #if 1 - if (TILESIZE_VAR < TILESIZE && EVEN(SCR_FIELDX)) + // if (TILESIZE_VAR < TILESIZE && EVEN(SCR_FIELDX)) + if (EVEN(SCR_FIELDX)) { SBX_Left--; // SBX_Right++; @@ -4536,9 +4537,13 @@ void InitGame() if (game.timegate_time_left == 0) CloseAllOpenTimegates(); +#if NEW_TILESIZE + BlitScreenToBitmap(backbuffer); +#else /* blit playfield from scroll buffer to normal back buffer for fading in */ if (setup.soft_scrolling) BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); +#endif redraw_mask |= REDRAW_FROM_BACKBUFFER; } diff --git a/src/tools.c b/src/tools.c index 2d59752b..9a712934 100644 --- a/src/tools.c +++ b/src/tools.c @@ -304,6 +304,65 @@ void DrawMaskedBorder(int redraw_mask) } } +void BlitScreenToBitmap(Bitmap *target_bitmap) +{ + DrawBuffer *buffer = (drawto_field == window ? backbuffer : drawto_field); + int fx = FX, fy = FY; + +#if NEW_TILESIZE + int dx = (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0); + int dy = (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0); + + int bx1, bx2, ffx, ffy; + + // fx += dx * TILESIZE_VAR / TILESIZE; + // fy += dy * TILESIZE_VAR / TILESIZE; +#else + fx += (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0); + fy += (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0); +#endif + + /* !!! THIS WORKS !!! */ + + ffx = (scroll_x - SBX_Left) * TILEX_VAR + dx * TILESIZE_VAR / TILESIZE; + + if (EVEN(SCR_FIELDX)) + { + if (ffx < SBX_Right * TILEX_VAR + TILEX_VAR / 2 + 2 * TILEX_VAR / 2) + { + fx = fx + dx * TILESIZE_VAR / TILESIZE - MIN(ffx, TILEX_VAR / 2) + + 1 * TILEX_VAR; + } + else + { + fx = fx - (dx <= 0 ? TILEX_VAR : 0) + 1 * TILEX_VAR; + + printf("::: STOPPED\n"); + } + + printf("::: %d (%d, %d) [%d] [%d] => %d\n", + ffx, SBX_Left * TILEX_VAR, SBX_Right * TILEX_VAR, dx, FX, fx); + } + + if (border.draw_masked[GAME_MODE_PLAYING]) + { + if (buffer != backbuffer) + { + /* copy playfield buffer to backbuffer to add masked border */ + BlitBitmap(buffer, backbuffer, fx, fy, SXSIZE, SYSIZE, SX, SY); + DrawMaskedBorder(REDRAW_FIELD); + } + + BlitBitmap(backbuffer, target_bitmap, + REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, + REAL_SX, REAL_SY); + } + else + { + BlitBitmap(buffer, target_bitmap, fx, fy, SXSIZE, SYSIZE, SX, SY); + } +} + void BackToFront() { int x, y; @@ -494,9 +553,16 @@ void BackToFront() printf("::: STOPPED\n"); } - printf("::: %d (%d, %d) [%d] [%d] => %d\n", - ffx, SBX_Left * TILEX_VAR, SBX_Right * TILEX_VAR, dx, FX, fx); + printf("::: %d (%d, %d) [%d] [%d] [%d, %d] => %d\n", + ffx, SBX_Left * TILEX_VAR, SBX_Right * TILEX_VAR, + dx, FX, ScreenMovDir, ScreenGfxPos, fx); + } + else + { + fx += dx; } + + fy += dy; #endif #endif @@ -592,6 +658,49 @@ void BackToFront() #endif #if NEW_TILESIZE + +#if 1 + InitGfxClipRegion(TRUE, SX, SY, SXSIZE, SYSIZE); + + { + int sx = SX; // - (EVEN(SCR_FIELDX) ? TILEX_VAR / 2 : 0); + int sy = SY; // + (EVEN(SCR_FIELDY) ? TILEY_VAR / 2 : 0); + + int dx = 0, dy = 0; + int ffx, ffy; + int fx = FX, fy = FY; + + ffx = (scroll_x - SBX_Left) * TILEX_VAR + dx * TILESIZE_VAR / TILESIZE; + + if (EVEN(SCR_FIELDX)) + { + if (ffx < SBX_Right * TILEX_VAR + TILEX_VAR / 2 + 2 * TILEX_VAR / 2) + { + fx = fx + dx * TILESIZE_VAR / TILESIZE - MIN(ffx, TILEX_VAR / 2) + + 1 * TILEX_VAR; + + if (fx % TILEX_VAR) + sx -= TILEX_VAR / 2; + else + sx -= TILEX_VAR; + } + else + { + fx = fx - (dx <= 0 ? TILEX_VAR : 0) + 1 * TILEX_VAR; + } + } + + 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); +#else for (x = 0; x < SCR_FIELDX; x++) for (y = 0 ; y < SCR_FIELDY; y++) if (redraw[redraw_x1 + x][redraw_y1 + y]) @@ -599,6 +708,8 @@ void BackToFront() FX + x * TILEX_VAR, FY + y * TILEY_VAR, TILEX_VAR, TILEY_VAR, SX + x * TILEX_VAR, SY + y * TILEY_VAR); +#endif + #else for (x = 0; x < SCR_FIELDX; x++) for (y = 0 ; y < SCR_FIELDY; y++) diff --git a/src/tools.h b/src/tools.h index c4a0252b..fb4ab278 100644 --- a/src/tools.h +++ b/src/tools.h @@ -70,6 +70,7 @@ void DrawMaskedBorder(int); void SetDrawtoField(int); void RedrawPlayfield(boolean, int, int, int, int); +void BlitScreenToBitmap(Bitmap *); void BackToFront(); void FadeIn(int);