summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
66815b1)
* changed internal playfield bitmap handling from playfield sized bitmap
to screen sized bitmap (visible scrolling area), therefore speeding up
graphics operations (by eliminating bitmap updates in invisible areas)
and removing playfield size limitations due to increasing bitmap size
for larger playfield sizes (while the new implementation always uses
a fixed playfield bitmap size for arbitrary internal playfield sizes)
+2009-11-24
+ * changed internal playfield bitmap handling from playfield sized bitmap
+ to screen sized bitmap (visible scrolling area), therefore speeding up
+ graphics operations (by eliminating bitmap updates in invisible areas)
+ and removing playfield size limitations due to increasing bitmap size
+ for larger playfield sizes (while the new implementation always uses
+ a fixed playfield bitmap size for arbitrary internal playfield sizes)
+
2009-11-12
* fixed bug with single step mode (there were some cases where the game
did not automatically return to pause mode, e.g. when trying to push
2009-11-12
* fixed bug with single step mode (there were some cases where the game
did not automatically return to pause mode, e.g. when trying to push
-#define COMPILE_DATE_STRING "2009-11-23 21:41"
+#define COMPILE_DATE_STRING "2009-11-24 01:16"
-static void ScrollPlayfield()
+static void ScrollPlayfield(int dx, int dy)
- int sx_last = mScrollX_last / TILEX;
- int sy_last = mScrollY_last / TILEY;
- int sx = mScrollX / TILEX;
- int sy = mScrollY / TILEY;
- int dx = (sx < sx_last ? +1 : sx > sx_last ? -1 : 0);
- int dy = (sy < sy_last ? +1 : sy > sy_last ? -1 : 0);
+ int x1 = mScrollX_last / TILEX - 2;
+ int y1 = mScrollY_last / TILEY - 2;
+ int x2 = mScrollX_last / TILEX + (SCR_FIELDX - 1) + 2;
+ int y2 = mScrollY_last / TILEY + (SCR_FIELDY - 1) + 2;
- int sx1 = mScrollX - TILEX;
- int sy1 = mScrollY - TILEY;
- int sx2 = mScrollX + SXSIZE + TILEX;
- int sy2 = mScrollY + SYSIZE + TILEY;
- int x1 = sx1 / TILEX;
- int y1 = sy1 / TILEY;
- int x2 = sx2 / TILEX;
- int y2 = sy2 / TILEY;
-#if 1
- int buf_xsize = SCR_FIELDX + 2;
- int buf_ysize = SCR_FIELDY + 2;
-#else
- int buf_xsize = MAX_BUF_XSIZE;
- int buf_ysize = MAX_BUF_YSIZE;
-#endif
BlitBitmap(screenBitmap, screenBitmap,
TILEX * (dx == -1),
BlitBitmap(screenBitmap, screenBitmap,
TILEX * (dx == -1),
redraw[x][y] = FALSE;
redraw_tiles = 0;
redraw[x][y] = FALSE;
redraw_tiles = 0;
+#if 1
+ DrawFrameIfNeeded();
+#endif
+
for (y = DisplayMinY; y <= DisplayMaxY; y++)
{
for (x = DisplayMinX; x <= DisplayMaxX; x++)
{
for (y = DisplayMinY; y <= DisplayMaxY; y++)
{
for (x = DisplayMinX; x <= DisplayMaxX; x++)
{
- if (x >= x1 && x < x2 && y >= y1 && y < y2)
+ if (x >= x1 && x <= x2 && y >= y1 && y <= y2)
{
int sx = x - x1;
int sy = y - y1;
{
int sx = x - x1;
int sy = y - y1;
- if ((dx == -1 && sx == buf_xsize - 1) ||
- (dx == +1 && sx == 0) ||
- (dy == -1 && sy == buf_ysize - 1) ||
- (dy == +1 && sy == 0))
+ if ((dx == -1 && x == x2) ||
+ (dx == +1 && x == x1) ||
+ (dy == -1 && y == y2) ||
+ (dy == +1 && y == y1))
printf("::: %d, %d\n", sx, sy);
printf("::: %d, %d\n", sx, sy);
static void ScrollPlayfieldIfNeededExt(boolean reset)
{
static void ScrollPlayfieldIfNeededExt(boolean reset)
{
- int sx_last = mScrollX_last / TILEX;
- int sy_last = mScrollY_last / TILEY;
- int sx = mScrollX / TILEX;
- int sy = mScrollY / TILEY;
- boolean initialized = (mScrollX_last != -1 && mScrollY_last != -1);
-
if (reset)
{
mScrollX_last = -1;
if (reset)
{
mScrollX_last = -1;
if (mScrollX_last == -1 || mScrollY_last == -1)
{
mScrollX_last = mScrollX;
if (mScrollX_last == -1 || mScrollY_last == -1)
{
mScrollX_last = mScrollX;
- if (initialized && (sx != sx_last || sy != sy_last))
- ScrollPlayfield();
+ /* check if scrolling the playfield reached the destination tile position */
+ if ((mScrollX != mScrollX_last || mScrollY != mScrollY_last) &&
+ mScrollX % TILEX == 0 && mScrollY % TILEY == 0)
+ {
+ int dx = (mScrollX < mScrollX_last ? 1 : mScrollX > mScrollX_last ? -1 : 0);
+ int dy = (mScrollY < mScrollY_last ? 1 : mScrollY > mScrollY_last ? -1 : 0);
+
+ mScrollX_last = mScrollX;
+ mScrollY_last = mScrollY;
- mScrollX_last = mScrollX;
- mScrollY_last = mScrollY;
+ ScrollPlayfield(dx, dy);
+ }
}
static void ScrollPlayfieldIfNeeded()
}
static void ScrollPlayfieldIfNeeded()
+ int x1 = mScrollX_last / TILEX - 2;
+ int y1 = mScrollY_last / TILEY - 2;
+ int x2 = mScrollX_last / TILEX + (SCR_FIELDX - 1) + 2;
+ int y2 = mScrollY_last / TILEY + (SCR_FIELDY - 1) + 2;
- int sx1 = mScrollX - TILEX;
- int sy1 = mScrollY - TILEY;
- int sx2 = mScrollX + SXSIZE + TILEX;
- int sy2 = mScrollY + SYSIZE + TILEY;
- int x1 = sx1 / TILEX;
- int y1 = sy1 / TILEY;
- int x2 = sx2 / TILEX;
- int y2 = sy2 / TILEY;
for (y = DisplayMinY; y <= DisplayMaxY; y++)
{
for (x = DisplayMinX; x <= DisplayMaxX; x++)
{
for (y = DisplayMinY; y <= DisplayMaxY; y++)
{
for (x = DisplayMinX; x <= DisplayMaxX; x++)
{
- if (x >= x1 && x < x2 && y >= y1 && y < y2)
+ if (x >= x1 && x <= x2 && y >= y1 && y <= y2)
{
int sx = x - x1;
int sy = y - y1;
{
int sx = x - x1;
int sy = y - y1;
void BlitScreenToBitmap_SP(Bitmap *target_bitmap)
{
void BlitScreenToBitmap_SP(Bitmap *target_bitmap)
{
- int sx = TILEX + mScrollX % TILEX;
- int sy = TILEY + mScrollY % TILEY;
+ int px = 2 * TILEX + (mScrollX - mScrollX_last) % TILEX;
+ int py = 2 * TILEY + (mScrollY - mScrollY_last) % TILEY;
+ int sx, sy, sxsize, sysize;
+
+#if 1
+ int xsize = SXSIZE;
+ int ysize = SYSIZE;
+ int full_xsize = (FieldWidth - (menBorder.Checked ? 0 : 1)) * TILEX;
+ int full_ysize = (FieldHeight - (menBorder.Checked ? 0 : 1)) * TILEY;
+
+ sxsize = (full_xsize < xsize ? full_xsize : xsize);
+ sysize = (full_ysize < ysize ? full_ysize : ysize);
+ sx = SX + (full_xsize < xsize ? (xsize - full_xsize) / 2 : 0);
+ sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0);
+#endif
+
+#if 1
+ if (!menBorder.Checked)
+ {
+ px += TILEX / 2;
+ py += TILEY / 2;
+ }
+#endif
- BlitBitmap(screenBitmap, target_bitmap, sx, sy,
- SCR_FIELDX * TILEX, SCR_FIELDY * TILEY, SX, SY);
+ BlitBitmap(screenBitmap, target_bitmap, px, py, sxsize, sysize, sx, sy);
}
void OLD_BlitScreenToBitmap_SP(Bitmap *target_bitmap)
}
void OLD_BlitScreenToBitmap_SP(Bitmap *target_bitmap)
if (1 ||
redraw_tiles > REDRAWTILES_THRESHOLD || scrolling || scrolling_last)
{
if (1 ||
redraw_tiles > REDRAWTILES_THRESHOLD || scrolling || scrolling_last)
{
+#if 1
+ BlitScreenToBitmap_SP(window);
+#else
/* blit all (up to four) parts of the scroll buffer to the backbuffer */
BlitScreenToBitmap_SP(backbuffer);
/* blit the completely updated backbuffer to the window (in one blit) */
BlitBitmap(backbuffer, window, SX, SY, SXSIZE, SYSIZE, SX, SY);
/* blit all (up to four) parts of the scroll buffer to the backbuffer */
BlitScreenToBitmap_SP(backbuffer);
/* blit the completely updated backbuffer to the window (in one blit) */
BlitBitmap(backbuffer, window, SX, SY, SXSIZE, SYSIZE, SX, SY);
#if 1
if (!menBorder.Checked)
{
#if 1
if (!menBorder.Checked)
{
- SR.left += 16;
- SR.top += 16;
+ SR.left += TILEX / 2;
+ SR.top += TILEY / 2;
#include "global.h"
extern long mScrollX, mScrollY;
#include "global.h"
extern long mScrollX, mScrollY;
+extern long mScrollX_last, mScrollY_last;
extern boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
extern boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
+#if 1
+
+ int sx1 = mScrollX_last - 2 * TILEX;
+ int sy1 = mScrollY_last - 2 * TILEY;
+ int sx2 = mScrollX_last + SXSIZE + 1 * TILEX;
+ int sy2 = mScrollY_last + SYSIZE + 1 * TILEY;
+
+ int sx = pX - sx1;
+ int sy = pY - sy1;
+
+#else
+
int sx1 = mScrollX - TILEX;
int sy1 = mScrollY - TILEY;
int sx2 = mScrollX + SXSIZE + TILEX;
int sy2 = mScrollY + SYSIZE + TILEY;
int x1 = sx1 / TILEX;
int y1 = sy1 / TILEY;
int sx1 = mScrollX - TILEX;
int sy1 = mScrollY - TILEY;
int sx2 = mScrollX + SXSIZE + TILEX;
int sy2 = mScrollY + SYSIZE + TILEY;
int x1 = sx1 / TILEX;
int y1 = sy1 / TILEY;
#if 0
int x2 = sx2 / TILEX;
int y2 = sy2 / TILEY;
#if 0
int x2 = sx2 / TILEX;
int y2 = sy2 / TILEY;
int sx = pX - x1 * TILEX;
int sy = pY - y1 * TILEY;
int sx = pX - x1 * TILEX;
int sy = pY - y1 * TILEY;
#if 0
printf(":1: DDSpriteBuffer.c: Blt(): %d, %d [%ld, %ld]\n",
pX, pY, mScrollX, mScrollY);
#if 0
printf(":1: DDSpriteBuffer.c: Blt(): %d, %d [%ld, %ld]\n",
pX, pY, mScrollX, mScrollY);
if (NoDisplayFlag)
return;
if (NoDisplayFlag)
return;
- if (pX < sx1 || pX >= sx2 || pY < sy1 || pY >= sy2)
- printf("::: DDSpriteBuffer.c: Blt(): %d, %d [%d..%d, %d..%d] (%d, %d) [SKIPPED]\n",
- pX, pY, sx1, sx2, sy1, sy2, mScrollX, mScrollY);
+ if (pX < sx1 || pX > sx2 || pY < sy1 || pY > sy2)
+ printf("::: DDSpriteBuffer.c: Blt(): %d, %d [%d..%d, %d..%d] (%ld, %ld) (%ld, %ld) [SKIPPED]\n",
+ pX, pY, sx1, sx2, sy1, sy2, mScrollX, mScrollY, mScrollX_last, mScrollY_last);
- printf("::: DDSpriteBuffer.c: Blt(): %d, %d [%d..%d, %d..%d] (%d, %d)\n",
- pX, pY, sx1, sx2, sy1, sy2, mScrollX, mScrollY);
+ printf("::: DDSpriteBuffer.c: Blt(): %d, %d [%d..%d, %d..%d] (%ld, %ld) (%ld, %ld)\n",
+ pX, pY, sx1, sx2, sy1, sy2, mScrollX, mScrollY, mScrollX_last, mScrollY_last);
}
#endif
/* do not draw fields that are outside the visible screen area */
}
#endif
/* do not draw fields that are outside the visible screen area */
- if (pX < sx1 || pX >= sx2 || pY < sy1 || pY >= sy2)
+ if (pX < sx1 || pX > sx2 || pY < sy1 || pY > sy2)
+void DrawFrameIfNeeded()
+{
+ DrawFrame(0);
+
+ /* !!! CHECK THIS !!! */
+#if 1
+ if (! menBorder.Checked)
+ DrawFrame(1);
+#endif
+}
+
void DisplayLevel()
{
int X, Y;
void DisplayLevel()
{
int X, Y;
+extern void DrawFrameIfNeeded();
+
extern void DisplayLevel();
extern void DrawField(int X, int Y);
extern void DrawFieldAnimated(int X, int Y);
extern void DisplayLevel();
extern void DrawField(int X, int Y);
extern void DrawFieldAnimated(int X, int Y);