1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
5 #include "DDSpriteBuffer.h"
8 long mXSpriteCount, mYSpriteCount;
9 long mSpriteWidth, mSpriteHeight;
10 long mDestXOff, mDestYOff;
12 void DDSpriteBuffer_Init()
15 mSpriteHeight = TILEY;
20 static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY)
24 int scx = (mScrollX_last < 0 ? 0 : mScrollX_last);
25 int scy = (mScrollY_last < 0 ? 0 : mScrollY_last);
26 int sx1 = scx - 2 * TILEX;
27 int sy1 = scy - 2 * TILEY;
28 int sx2 = scx + SXSIZE + 1 * TILEX;
29 int sy2 = scy + SYSIZE + 1 * TILEY;
37 /* do not draw fields that are outside the visible screen area */
38 if (pX < sx1 || pX > sx2 || pY < sy1 || pY > sy2)
41 DR.left = pX + mDestXOff;
42 DR.top = pY + mDestYOff;
43 DR.right = pX + mSpriteWidth + mDestXOff;
44 DR.bottom = pY + mSpriteHeight + mDestYOff;
48 SR.right = SR.left + mSpriteWidth;
49 SR.bottom = SR.top + mSpriteHeight;
51 BlitBitmap(bitmap, screenBitmap,
53 mSpriteWidth, mSpriteHeight,
57 void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame)
59 struct GraphicInfo_SP g;
64 getGraphicSource_SP(&g, graphic, sync_frame, -1, -1);
66 Blt(pX, pY, g.bitmap, g.src_x, g.src_y);