-#define COMPILE_DATE_STRING "2010-04-17 23:20"
+#define COMPILE_DATE_STRING "2010-04-18 20:47"
int py = 2 * TILEY + (mScrollY - mScrollY_last) % TILEY;
int sx, sy, sxsize, sysize;
-#if 1
+#if 0
printf("::: %d, %d / %d, %d / %ld, %ld (%ld, %ld) / %d, %d\n",
MurphyScreenXPos, MurphyScreenYPos,
ScreenScrollXPos, ScreenScrollYPos,
sx = SX + (full_xsize < xsize ? (xsize - full_xsize) / 2 : 0);
sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0);
-#if 1
-#if 1
- {
- px += game_sp.scroll_xoffset;
- py += game_sp.scroll_yoffset;
- }
-#else
- if (1)
- {
- px += TILEX / 2;
- py += TILEY / 2;
- }
-#endif
-#else
-#if 1
- if (0 && !menBorder)
- {
- if (mScrollX < ScrollMinX + TILEX / 2)
- px += ScrollMinX + TILEX / 2 - mScrollX;
- else if (mScrollX > ScrollMaxX - TILEX / 2)
- px -= mScrollX - (ScrollMaxX - TILEX / 2);
- if (mScrollY < ScrollMinY + TILEY / 2)
- py += ScrollMinY + TILEY / 2 - mScrollY;
- else if (mScrollY > ScrollMaxY - TILEY / 2)
- py -= mScrollY - (ScrollMaxY - TILEY / 2);
- }
-#else
- if (!menBorder)
- {
- px += TILEX / 2;
- py += TILEY / 2;
- }
-#endif
-#endif
+ /* scroll correction for even number of visible tiles (half tile shifted) */
+ px += game_sp.scroll_xoffset;
+ py += game_sp.scroll_yoffset;
BlitBitmap(bitmap_db_field_sp, target_bitmap, px, py, sxsize, sysize, sx, sy);
}
#define ScrollDelta ((long)1)
#define ZoomFactor (2)
-#define BaseWidth (ZoomFactor * 16)
+
#define StretchWidth (ZoomFactor * 16)
-#define TileSize (ZoomFactor * 16)
#define TwoPixels (ZoomFactor * 2)
void SetScrollEdges()
{
-#if 1
- int border_offset = (menBorder ? 1 : 2);
+ int border1_offset = (menBorder ? 1 : 2);
+ int border2_offset = (menBorder ? 0 : TILESIZE / 2);
+ /* scroll correction for border frame (1 tile) or border element (2 tiles) */
ScrollMinX = 0;
ScrollMinY = 0;
- ScrollMaxX = (DisplayMaxX + border_offset) * BaseWidth - SXSIZE;
- ScrollMaxY = (DisplayMaxY + border_offset) * BaseWidth - SYSIZE;
-
-#if 1
- if (!menBorder)
- {
- ScrollMinX += TILEX / 2;
- ScrollMinY += TILEY / 2;
- ScrollMaxX -= TILEX / 2;
- ScrollMaxY -= TILEY / 2;
- }
-#if 1
- {
- ScrollMinX -= game_sp.scroll_xoffset;
- ScrollMaxX -= game_sp.scroll_xoffset;
- ScrollMinY -= game_sp.scroll_yoffset;
- ScrollMaxY -= game_sp.scroll_yoffset;
- }
-#else
- if (1)
- {
- ScrollMinX -= TILEX / 2;
- ScrollMaxX -= TILEX / 2;
- ScrollMinY -= TILEY / 2;
- ScrollMaxY -= TILEY / 2;
- }
-#endif
-#else
- if (!menBorder)
- {
- ScrollMinX += TILEX / 2;
- ScrollMinY += TILEY / 2;
- ScrollMaxX -= TILEX / 2;
- ScrollMaxY -= TILEY / 2;
- }
-#endif
-
-#else
- ScrollMinX = (int)(DisplayMinX - 0.5) * BaseWidth;
- ScrollMinY = (int)(DisplayMinY - 0.5) * BaseWidth;
- ScrollMaxX = (int)(DisplayMaxX + 1.5) * BaseWidth - SXSIZE;
- ScrollMaxY = (int)(DisplayMaxY + 1.5) * BaseWidth - SYSIZE;
-#endif
-
-#if 1
+ ScrollMaxX = (DisplayMaxX + border1_offset) * TILEX - SXSIZE;
+ ScrollMaxY = (DisplayMaxY + border1_offset) * TILEY - SYSIZE;
+
+ /* scroll correction for border element (half tile on left and right side) */
+ ScrollMinX += border2_offset;
+ ScrollMinY += border2_offset;
+ ScrollMaxX -= border2_offset;
+ ScrollMaxY -= border2_offset;
+
+ /* scroll correction for even number of visible tiles (half tile shifted) */
+ ScrollMinX -= game_sp.scroll_xoffset;
+ ScrollMaxX -= game_sp.scroll_xoffset;
+ ScrollMinY -= game_sp.scroll_yoffset;
+ ScrollMaxY -= game_sp.scroll_yoffset;
+
+#if 0
printf("::: (%ld, %ld), (%ld, %ld) -> (%d, %d), (%d, %d)\n",
DisplayMinX, DisplayMinY, DisplayMaxX, DisplayMaxY,
ScrollMinX, ScrollMinY, ScrollMaxX, ScrollMaxY);
void subCalculateScreenScrollPos()
{
- int ax, ay;
-
#if 1
int jump_pos = TILEX / 2;
+ /* handle wrap-around */
if (MurphyScreenXPos < -jump_pos)
{
MurphyScreenXPos = FieldWidth * TILEX + MurphyScreenXPos;
// printf("::: ExplosionShake [%d]\n", FrameCounter);
}
-#if 1
- ax = (SCR_FIELDX / 2) * TILESIZE;
- ay = (SCR_FIELDY / 2) * TILESIZE;
-
- ScreenScrollXPos = MurphyScreenXPos - ax;
- ScreenScrollYPos = MurphyScreenYPos - ay;
-#else
- ax = SXSIZE / 2;
- ay = SYSIZE / 2;
-
- ScreenScrollXPos = (MurphyScreenXPos + TILEX / 2) - ax;
- ScreenScrollYPos = (MurphyScreenYPos + TILEY / 2) - ay;
-#endif
+ ScreenScrollXPos = MurphyScreenXPos - (SCR_FIELDX / 2) * TILESIZE;
+ ScreenScrollYPos = MurphyScreenYPos - (SCR_FIELDY / 2) * TILESIZE;
}
void sp_open_all()
{
Form_Load();
-
-#if 0
- printf("::: open 1: %d, %d [%08x]\n", FXSIZE, FYSIZE, bitmap_db_field_sp);
-
- /*
- bitmap_db_field_sp = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
- bitmap_db_field_sp = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
- DEFAULT_DEPTH);
- */
-
- ReCreateBitmap(&bitmap_db_field_sp, FXSIZE, FYSIZE, DEFAULT_DEPTH);
-
- printf("::: open 2: %d, %d [%08x]\n", FXSIZE, FYSIZE, bitmap_db_field_sp);
-#endif
}
void sp_close_all()
void InitGfxBuffers_SP()
{
-#if 1
- printf("::: init 1: %d, %d [%08x]\n", FXSIZE, FYSIZE, bitmap_db_field_sp);
-
- /*
- ReCreateBitmap(&bitmap_db_field_sp, MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
- DEFAULT_DEPTH);
- */
-
ReCreateBitmap(&bitmap_db_field_sp, FXSIZE, FYSIZE, DEFAULT_DEPTH);
-
- printf("::: init 2: %d, %d [%08x]\n", FXSIZE, FYSIZE, bitmap_db_field_sp);
-#endif
}
unsigned int InitEngineRandom_SP(long seed)