1 // ----------------------------------------------------------------------------
3 // ----------------------------------------------------------------------------
5 #include "DDSpriteBuffer.h"
8 static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY)
12 int pseudo_sxsize = SXSIZE * TILESIZE / TILESIZE_VAR;
13 int pseudo_sysize = SYSIZE * TILESIZE / TILESIZE_VAR;
16 int scx = (mScrollX_last < 0 ? 0 : mScrollX_last);
17 int scy = (mScrollY_last < 0 ? 0 : mScrollY_last);
18 int sx1 = scx - 2 * TILEX;
19 int sy1 = scy - 2 * TILEY;
22 int sx2 = scx + (SCR_FIELDX + 1) * TILEX;
23 int sy2 = scy + (SCR_FIELDY + 1) * TILEY;
25 int sx2 = scx + pseudo_sxsize + 1 * TILEX;
26 int sy2 = scy + pseudo_sysize + 1 * TILEY;
29 int sx2 = scx + SXSIZE + 1 * TILEX;
30 int sy2 = scy + SYSIZE + 1 * TILEY;
34 int tile_x = sx / TILESIZE;
35 int tile_y = sy / TILESIZE;
36 int move_x = (sx + TILESIZE - 1) / TILESIZE;
37 int move_y = (sy + TILESIZE - 1) / TILESIZE;
42 /* do not draw fields that are outside the visible screen area */
43 if (pX < sx1 || pX > sx2 || pY < sy1 || pY > sy2)
49 SpriteX = SpriteX * TILESIZE_VAR / TILESIZE;
50 SpriteY = SpriteY * TILESIZE_VAR / TILESIZE;
53 sx = sx * TILESIZE_VAR / TILESIZE;
54 sy = sy * TILESIZE_VAR / TILESIZE;
56 BlitBitmap(bitmap, bitmap_db_field_sp, SpriteX, SpriteY,
57 TILEX_VAR, TILEY_VAR, sx, sy);
59 BlitBitmap(bitmap, bitmap_db_field_sp, SpriteX, SpriteY,
60 TILEX, TILEY, sx, sy);
63 redraw[tile_x][tile_y] = TRUE;
68 redraw[move_x][tile_y] = TRUE;
71 else if (move_y != tile_y)
73 redraw[tile_x][move_y] = TRUE;
78 void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame)
80 struct GraphicInfo_SP g;
85 getGraphicSource_SP(&g, graphic, sync_frame, -1, -1);
87 Blt(pX, pY, g.bitmap, g.src_x, g.src_y);