}
void UpdatePlayfield()
+{
+ int x, y;
+#if 1
+ int num_redrawn = 0;
+#endif
+
+ for (y = DisplayMinY; y <= DisplayMaxY; y++)
+ {
+ for (x = DisplayMinX; x <= DisplayMaxX; x++)
+ {
+ int element = LowByte(PlayField16[GetSI(x, y)]);
+ int graphic = GfxGraphic[x][y];
+ int sync_frame = GfxFrame[x][y];
+#if 1
+ boolean redraw = FALSE;
+#else
+ boolean redraw = TRUE; // !!! TEST ONLY -- ALWAYS REDRAW !!!
+#endif
+
+ if (graphic < 0)
+ continue;
+
+ if (element != GfxElementLast[x][y] &&
+ graphic == GfxGraphicLast[x][y])
+ {
+ /* element changed, but not graphic => disable updating graphic */
+
+ GfxElementLast[x][y] = element;
+ GfxGraphicLast[x][y] = GfxGraphic[x][y] = -1;
+
+ continue;
+ }
+
+ if (graphic != GfxGraphicLast[x][y]) // new graphic
+ {
+ redraw = TRUE;
+
+ GfxElementLast[x][y] = element;
+ GfxGraphicLast[x][y] = GfxGraphic[x][y];
+ sync_frame = GfxFrame[x][y] = 0;
+ }
+ else if (isNextAnimationFrame_SP(graphic, sync_frame)) // new frame
+ {
+ redraw = TRUE;
+ }
+
+ if (redraw)
+ {
+ int sx = x * StretchWidth;
+ int sy = y * StretchWidth;
+
+#if 0
+ printf("::: REDRAW (%d, %d): %d, %d\n", x, y, graphic, sync_frame);
+#endif
+
+ StretchedSprites.BltImg(sx, sy, graphic, sync_frame);
+
+#if 1
+ num_redrawn++;
+#endif
+ }
+ }
+ }
+
+#if 0
+ printf("::: FRAME %d: %d redrawn\n", FrameCounter, num_redrawn);
+#endif
+}
+
+void UpdatePlayfield_TMP()
{
int x1 = mScrollX_last / TILEX - 2;
int y1 = mScrollY_last / TILEY - 2;
return Height;
}
+#if 0
+
long DDScrollBuffer_CreateAtSize(long Width, long Height, long hWndViewPort)
{
long CreateAtSize;
Buffer.BltColorFill(EmptyRect, BackColor);
}
+#endif
/* copy the entire screen to the window at the scroll position */
void DDScrollBuffer_Blt_Ext(Bitmap *target_bitmap)
{
- RECT DR, SR;
+ MyRECT DR, SR;
+#if 1
+ long tX, tY;
+#else
long tX, tY, L;
+#endif
int sX, sY;
// RECT ERect;
// long Restore;
if (IS_NOTHING(&Buffer, sizeof(Buffer)))
return;
+#if 0
if (IS_NOTHING(&PrimarySurface, sizeof(PrimarySurface)))
return;
+#endif
+
+#if 0
L = PrimarySurface.Blt(DR, &Buffer, SR, DDBLT_WAIT);
if (L != DD_OK)
break;
#endif
+#if 0
case DDERR_SURFACELOST:
DDraw.RestoreAllSurfaces();
if (! PrimarySurface.isLost())
// RestorePrimarySurface
// ClipToWindow 0
break;
+#endif
#if 0
case DDERR_UNSUPPORTED:
}
}
+#endif
+
#if 0
// Buffer.UpdateOverlay SR, PrimarySurface, DR, DDOVER_SHOW
if (EditFlag)
long oldX, oldY, maxD;
static boolean AlreadyRunning = False;
+#if 0
+ printf(":a: %d, %d [%d, %d] [%d, %d] [%d, %d]\n",
+ mScrollX, mScrollY,
+ mScrollX_last, mScrollY_last,
+ ScreenScrollXPos, ScreenScrollYPos,
+ ScrollX, ScrollY);
+#endif
+
if (NoDisplayFlag)
return;
mScrollY = oldY + T * dY;
ScrollX = mScrollX;
ScrollY = mScrollY;
- // Blt();
+
+#if 0
+ Blt();
+#endif
}
+#if 0
+ printf(":x: %d, %d [%d, %d] [%d, %d] [%d, %d]\n",
+ mScrollX, mScrollY,
+ mScrollX_last, mScrollY_last,
+ ScreenScrollXPos, ScreenScrollYPos,
+ ScrollX, ScrollY);
+#endif
+
if (UserDragFlag)
goto SoftScrollEH;
mScrollY = Y;
ScrollX = mScrollX;
ScrollY = mScrollY;
- // Blt();
+
+#if 0
+ Blt();
+#endif
SoftScrollEH:
AlreadyRunning = False;
mScrollX, mScrollY);
#endif
+#if 0
+ printf(":y: %d, %d [%d, %d] [%d, %d] [%d, %d]\n",
+ mScrollX, mScrollY,
+ mScrollX_last, mScrollY_last,
+ ScreenScrollXPos, ScreenScrollYPos,
+ ScrollX, ScrollY);
+#endif
+
#if 1
ScrollPlayfieldIfNeeded();
#endif
+
+#if 0
+ printf(":z: %d, %d [%d, %d] [%d, %d] [%d, %d]\n",
+ mScrollX, mScrollY,
+ mScrollX_last, mScrollY_last,
+ ScreenScrollXPos, ScreenScrollYPos,
+ ScrollX, ScrollY);
+#endif
}