- if (x < 2 * TILEX && y < 2 * TILEY)
- {
- BlitBitmap(screenBitmap, target_bitmap, x, y,
- SCR_FIELDX * TILEX, SCR_FIELDY * TILEY, SX, SY);
- }
- else if (x < 2 * TILEX && y >= 2 * TILEY)
- {
- BlitBitmap(screenBitmap, target_bitmap, x, y,
- SCR_FIELDX * TILEX, MAX_BUF_YSIZE * TILEY - y,
- SX, SY);
- BlitBitmap(screenBitmap, target_bitmap, x, 0,
- SCR_FIELDX * TILEX, y - 2 * TILEY,
- SX, SY + MAX_BUF_YSIZE * TILEY - y);
- }
- else if (x >= 2 * TILEX && y < 2 * TILEY)
- {
- BlitBitmap(screenBitmap, target_bitmap, x, y,
- MAX_BUF_XSIZE * TILEX - x, SCR_FIELDY * TILEY,
- SX, SY);
- BlitBitmap(screenBitmap, target_bitmap, 0, y,
- x - 2 * TILEX, SCR_FIELDY * TILEY,
- SX + MAX_BUF_XSIZE * TILEX - x, SY);
- }
- else
- {
- BlitBitmap(screenBitmap, target_bitmap, x, y,
- MAX_BUF_XSIZE * TILEX - x, MAX_BUF_YSIZE * TILEY - y,
- SX, SY);
- BlitBitmap(screenBitmap, target_bitmap, 0, y,
- x - 2 * TILEX, MAX_BUF_YSIZE * TILEY - y,
- SX + MAX_BUF_XSIZE * TILEX - x, SY);
- BlitBitmap(screenBitmap, target_bitmap, x, 0,
- MAX_BUF_XSIZE * TILEX - x, y - 2 * TILEY,
- SX, SY + MAX_BUF_YSIZE * TILEY - y);
- BlitBitmap(screenBitmap, target_bitmap, 0, 0,
- x - 2 * TILEX, y - 2 * TILEY,
- SX + MAX_BUF_XSIZE * TILEX - x, SY + MAX_BUF_YSIZE * TILEY - y);
- }
-}
-
-void BackToFront_SP(void)
-{
- static boolean scrolling_last = FALSE;
- int left = mScrollX / TILEX;
- int top = mScrollY / TILEY;
- boolean scrolling = (mScrollX % TILEX != 0 || mScrollY % TILEY != 0);
- int x, y;
-
- SyncDisplay();
-
- 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);
-#endif
- }
- else
- {
- for (x = 0; x < SCR_FIELDX; x++)
- {
- for (y = 0; y < SCR_FIELDY; y++)