return;
ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
- ClearRectangle(screenBitmap, 0, 0,
+#if 1
+ ClearRectangle(bitmap_db_field_sp, 0, 0, FXSIZE, FYSIZE);
+#else
+ ClearRectangle(bitmap_db_field_sp, 0, 0,
MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY);
+#endif
#if 1
SetDisplayRegion();
void SetScrollEdges()
{
- 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;
+ 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 + 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);
+#endif
}
void DrawField(int X, int Y)