X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_sp%2FDDSpriteBuffer.c;h=36d271f1818d4f0ca0c023b8dd0fd9dbc7e1dc3f;hb=18863a5655e9e07d548e2d673e7f82336703c8fb;hp=00e49d7ac02f62aaaac59c05e3445c853382f57a;hpb=ed873d89bc59f4e641134f9019ce216234b9f38f;p=rocksndiamonds.git diff --git a/src/game_sp/DDSpriteBuffer.c b/src/game_sp/DDSpriteBuffer.c index 00e49d7a..36d271f1 100644 --- a/src/game_sp/DDSpriteBuffer.c +++ b/src/game_sp/DDSpriteBuffer.c @@ -4,7 +4,7 @@ #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 @@ -132,6 +132,8 @@ boolean DDSpriteBuffer_CreateFromFile(char *Path, long xSprites, long ySprites) return CreateFromFile; } +#if 0 + boolean DDSpriteBuffer_CreateAtSize(long Width, long Height, long xSprites, long ySprites) { boolean CreateAtSize; @@ -163,6 +165,10 @@ boolean DDSpriteBuffer_CreateAtSize(long Width, long Height, long xSprites, long return CreateAtSize; } +#endif + +#if 0 + void DDSpriteBuffer_Cls(int BackColor) { RECT EmptyRect; @@ -170,19 +176,23 @@ void DDSpriteBuffer_Cls(int BackColor) 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; @@ -242,8 +252,13 @@ static void Blt(int pX, int pY, int SpriteX, int SpriteY) 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; } @@ -252,6 +267,10 @@ static void Blt(int pX, int pY, int SpriteX, int SpriteY) 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"); @@ -262,7 +281,7 @@ static void Blt(int pX, int pY, int SpriteX, int SpriteY) #if 1 #if 1 - BlitBitmap(sp_objects, screenBitmap, + BlitBitmap(bitmap, screenBitmap, SR.left, SR.top, mSpriteWidth, mSpriteHeight, sx, sy); @@ -356,6 +375,8 @@ static void OLD_Blt(int pX, int pY, int SpriteX, int SpriteY) #endif +#if 0 + void DDSpriteBuffer_BltEx(int pX, int pY, int SpritePos) { int XPos, YPos; @@ -363,8 +384,17 @@ void DDSpriteBuffer_BltEx(int pX, int pY, int SpritePos) 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) @@ -372,7 +402,25 @@ void DDSpriteBuffer_BltEx(int pX, int pY, int SpritePos) 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