#include "DDSpriteBuffer.h"
-static void Blt(int pX, int pY, int SpriteX, int SpriteY);
+static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY);
// --- VERSION 1.0 CLASS
// --- BEGIN
return CreateFromFile;
}
+#if 0
+
boolean DDSpriteBuffer_CreateAtSize(long Width, long Height, long xSprites, long ySprites)
{
boolean CreateAtSize;
return CreateAtSize;
}
+#endif
+
+#if 0
+
void DDSpriteBuffer_Cls(int BackColor)
{
RECT EmptyRect;
Buffer.BltColorFill(EmptyRect, BackColor);
}
-static void Blt(int pX, int pY, int SpriteX, int SpriteY)
+#endif
+
+static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY)
{
- RECT DR, SR;
+ MyRECT DR, SR;
#if 0
long Tmp;
#endif
#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 scx = (mScrollX_last < 0 ? 0 : mScrollX_last);
+ int scy = (mScrollY_last < 0 ? 0 : mScrollY_last);
+ int sx1 = scx - 2 * TILEX;
+ int sy1 = scy - 2 * TILEY;
+ int sx2 = scx + SXSIZE + 1 * TILEX;
+ int sy2 = scy + SYSIZE + 1 * TILEY;
int sx = pX - sx1;
int sy = pY - sy1;
DR.bottom = pY + mSpriteHeight + mDestYOff;
}
{
+#if 1
+ SR.left = SpriteX;
+ SR.top = SpriteY;
+#else
SR.left = mSpriteWidth * (SpriteX - 1);
SR.top = mSpriteHeight * (SpriteY - 1);
+#endif
SR.right = SR.left + mSpriteWidth;
SR.bottom = SR.top + mSpriteHeight;
}
printf("::: DDSpriteBuffer.c: Blt(): %d, %d\n", DR.left, DR.top);
#endif
+#if 0
+ printf("::: DDSpriteBuffer.c: Blt(): %d, %d\n", sx, sy);
+#endif
+
#if 0
if (pX == 0 * StretchWidth && pY == 0 * StretchWidth)
printf("::: TEST: drawing topleft corner ...\n");
#if 1
#if 1
- BlitBitmap(sp_objects, screenBitmap,
+ BlitBitmap(bitmap, screenBitmap,
SR.left, SR.top,
mSpriteWidth, mSpriteHeight,
sx, sy);
#endif
+#if 0
+
void DDSpriteBuffer_BltEx(int pX, int pY, int SpritePos)
{
int XPos, YPos;
if (NoDisplayFlag)
return;
+#if 1
+ XPos = mSpriteWidth * (SpritePos % mXSpriteCount);
+ YPos = mSpriteHeight * (SpritePos / mXSpriteCount);
+#else
XPos = (SpritePos % mXSpriteCount) + 1;
YPos = (SpritePos / mXSpriteCount) + 1;
+#endif
+
+#if 0
+ printf("::: BltEx: %d, %d, %d, %d\n", pX, pY, XPos, YPos);
+#endif
#if 0
if (TEST_flag)
pX, pY, SpritePos);
#endif
- Blt(pX, pY, XPos, YPos);
+ Blt(pX, pY, sp_objects, XPos, YPos);
+}
+
+#endif
+
+void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame)
+{
+ struct GraphicInfo_SP g;
+
+ if (NoDisplayFlag)
+ return;
+
+ getGraphicSource_SP(&g, graphic, sync_frame, -1, -1);
+
+#if 0
+ printf("::: BltImg: %d, %d, %d, %d\n", pX, pY, g.src_x, g.src_y);
+#endif
+
+ Blt(pX, pY, g.bitmap, g.src_x, g.src_y);
}
// Public Function GetStretchCopy(Stretch!) As DDSpriteBuffer