1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
5 #include "DDSpriteBuffer.h"
8 static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY)
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;
18 int tile_x = sx / TILESIZE;
19 int tile_y = sy / TILESIZE;
20 int move_x = (sx + TILESIZE - 1) / TILESIZE;
21 int move_y = (sy + TILESIZE - 1) / TILESIZE;
26 /* do not draw fields that are outside the visible screen area */
27 if (pX < sx1 || pX > sx2 || pY < sy1 || pY > sy2)
30 sx = sx * TILESIZE_VAR / TILESIZE;
31 sy = sy * TILESIZE_VAR / TILESIZE;
33 BlitBitmap(bitmap, bitmap_db_field_sp, SpriteX, SpriteY,
34 TILEX_VAR, TILEY_VAR, sx, sy);
36 redraw[tile_x][tile_y] = TRUE;
41 redraw[move_x][tile_y] = TRUE;
44 else if (move_y != tile_y)
46 redraw[tile_x][move_y] = TRUE;
51 void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame)
53 struct GraphicInfo_SP g;
58 getGraphicSource_SP(&g, graphic, sync_frame, -1, -1);
60 Blt(pX, pY, g.bitmap, g.src_x, g.src_y);