| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#include "DDSpriteBuffer.h" |
| 6 |
|
| 7 |
|
| 8 |
static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY) |
| 9 |
{ |
| 10 |
int scx = (mScrollX_last < 0 ? 0 : mScrollX_last); |
| 11 |
int scy = (mScrollY_last < 0 ? 0 : mScrollY_last); |
| 12 |
int sx1 = scx - 2 * TILEX; |
| 13 |
int sy1 = scy - 2 * TILEY; |
| 14 |
int sx2 = scx + (SCR_FIELDX + 1) * TILEX; |
| 15 |
int sy2 = scy + (SCR_FIELDY + 1) * TILEY; |
| 16 |
int sx = pX - sx1; |
| 17 |
int sy = pY - sy1; |
| 18 |
|
| 19 |
if (NoDisplayFlag) |
| 20 |
return; |
| 21 |
|
| 22 |
|
| 23 |
if (pX < sx1 || pX > sx2 || pY < sy1 || pY > sy2) |
| 24 |
return; |
| 25 |
|
| 26 |
sx = sx * TILESIZE_VAR / TILESIZE; |
| 27 |
sy = sy * TILESIZE_VAR / TILESIZE; |
| 28 |
|
| 29 |
BlitBitmap(bitmap, bitmap_db_field_sp, SpriteX, SpriteY, |
| 30 |
TILEX_VAR, TILEY_VAR, sx, sy); |
| 31 |
} |
| 32 |
|
| 33 |
void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame) |
| 34 |
{ |
| 35 |
struct GraphicInfo_SP g; |
| 36 |
|
| 37 |
if (NoDisplayFlag) |
| 38 |
return; |
| 39 |
|
| 40 |
if (graphic < 0) |
| 41 |
return; |
| 42 |
|
| 43 |
getGraphicSource_SP(&g, graphic, sync_frame); |
| 44 |
|
| 45 |
Blt(pX, pY, g.bitmap, g.src_x, g.src_y); |
| 46 |
} |