X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Fgraphics.c;h=43c5e4b22cb715e311858766d3d0642c6e90900c;hb=a335ab0bab1ccd58275b03f0bc3cada75a3dc389;hp=ac219b86feca0669c0d5dffbcf0b836b574c655f;hpb=039b30ddb55aebd2d964b135e2454f12053ec833;p=rocksndiamonds.git diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index ac219b86..43c5e4b2 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -25,12 +25,15 @@ #define VALID_SCREEN_Y(y) ((y) < MIN_SCREEN_Y ? MIN_SCREEN_Y : \ (y) > MAX_SCREEN_Y ? MAX_SCREEN_Y : (y)) -#define PLAYER_SCREEN_X(p) (((7 - frame) * ply[p].oldx + \ - (1 + frame) * ply[p].x) * TILEX / 8 \ - - ((SCR_FIELDX - 1) * TILEX) / 2) -#define PLAYER_SCREEN_Y(p) (((7 - frame) * ply[p].oldy + \ - (1 + frame) * ply[p].y) * TILEY / 8 \ - - ((SCR_FIELDY - 1) * TILEY) / 2) +#define PLAYER_POS_X(nr) (((7 - frame) * ply[nr].oldx + \ + (1 + frame) * ply[nr].x) * TILEX / 8) +#define PLAYER_POS_Y(nr) (((7 - frame) * ply[nr].oldy + \ + (1 + frame) * ply[nr].y) * TILEY / 8) + +#define PLAYER_SCREEN_X(nr) (PLAYER_POS_X(nr) - \ + (SCR_FIELDX - 1) * TILEX / 2) +#define PLAYER_SCREEN_Y(nr) (PLAYER_POS_Y(nr) - \ + (SCR_FIELDY - 1) * TILEY / 2) #define USE_EXTENDED_GRAPHICS_ENGINE 1 @@ -43,7 +46,7 @@ static int screen_tiles[MAX_PLAYFIELD_WIDTH + 2][MAX_PLAYFIELD_HEIGHT + 2]; static int crumbled_state[MAX_PLAYFIELD_WIDTH + 2][MAX_PLAYFIELD_HEIGHT + 2]; /* graphic info for game objects/frames and players/actions/frames */ -struct GraphicInfo_EM graphic_info_em_object[TILE_MAX][8]; +struct GraphicInfo_EM graphic_info_em_object[GAME_TILE_MAX][8]; struct GraphicInfo_EM graphic_info_em_player[MAX_PLAYERS][PLY_MAX][8]; int getFieldbufferOffsetX_EM(void) @@ -70,44 +73,40 @@ void BlitScreenToBitmap_EM(Bitmap *target_bitmap) int sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0); int sxsize = (full_xsize < xsize ? full_xsize : xsize); int sysize = (full_ysize < ysize ? full_ysize : ysize); + int xxsize = MAX_BUF_XSIZE * TILEX - x; + int yysize = MAX_BUF_YSIZE * TILEY - y; + int xoffset = 2 * TILEX; + int yoffset = 2 * TILEY; - if (x < 2 * TILEX && y < 2 * TILEY) + if (x < xoffset && y < yoffset) { - BlitBitmap(screenBitmap, target_bitmap, x, y, - sxsize, sysize, sx, sy); + BlitBitmap(screenBitmap, target_bitmap, x, y, sxsize, sysize, + sx, sy); } - else if (x < 2 * TILEX && y >= 2 * TILEY) + else if (x < xoffset && y >= yoffset) { - BlitBitmap(screenBitmap, target_bitmap, x, y, - sxsize, MAX_BUF_YSIZE * TILEY - y, + BlitBitmap(screenBitmap, target_bitmap, x, y, sxsize, yysize, sx, sy); - BlitBitmap(screenBitmap, target_bitmap, x, 0, - sxsize, y - 2 * TILEY, - sx, sy + MAX_BUF_YSIZE * TILEY - y); + BlitBitmap(screenBitmap, target_bitmap, x, 0, sxsize, y - yoffset, + sx, sy + yysize); } - else if (x >= 2 * TILEX && y < 2 * TILEY) + else if (x >= xoffset && y < yoffset) { - BlitBitmap(screenBitmap, target_bitmap, x, y, - MAX_BUF_XSIZE * TILEX - x, sysize, + BlitBitmap(screenBitmap, target_bitmap, x, y, xxsize, sysize, sx, sy); - BlitBitmap(screenBitmap, target_bitmap, 0, y, - x - 2 * TILEX, sysize, - sx + MAX_BUF_XSIZE * TILEX - x, sy); + BlitBitmap(screenBitmap, target_bitmap, 0, y, x - xoffset, sysize, + sx + xxsize, sy); } else { - BlitBitmap(screenBitmap, target_bitmap, x, y, - MAX_BUF_XSIZE * TILEX - x, MAX_BUF_YSIZE * TILEY - y, + BlitBitmap(screenBitmap, target_bitmap, x, y, xxsize, yysize, sx, sy); - BlitBitmap(screenBitmap, target_bitmap, 0, y, - x - 2 * TILEX, MAX_BUF_YSIZE * TILEY - y, - sx + MAX_BUF_XSIZE * TILEX - x, sy); - BlitBitmap(screenBitmap, target_bitmap, x, 0, - MAX_BUF_XSIZE * TILEX - x, y - 2 * TILEY, - sx, sy + MAX_BUF_YSIZE * TILEY - y); - BlitBitmap(screenBitmap, target_bitmap, 0, 0, - x - 2 * TILEX, y - 2 * TILEY, - sx + MAX_BUF_XSIZE * TILEX - x, sy + MAX_BUF_YSIZE * TILEY - y); + BlitBitmap(screenBitmap, target_bitmap, 0, y, x - xoffset, yysize, + sx + xxsize, sy); + BlitBitmap(screenBitmap, target_bitmap, x, 0, xxsize, y - yoffset, + sx, sy + yysize); + BlitBitmap(screenBitmap, target_bitmap, 0, 0, x - xoffset, y - yoffset, + sx + xxsize, sy + yysize); } } @@ -377,8 +376,8 @@ static void blitplayer(int nr) return; /* x1/y1 are left/top and x2/y2 are right/down part of the player movement */ - x1 = ((7 - frame) * ply[nr].oldx + (1 + frame) * ply[nr].x) * TILEX / 8; - y1 = ((7 - frame) * ply[nr].oldy + (1 + frame) * ply[nr].y) * TILEY / 8; + x1 = PLAYER_POS_X(nr); + y1 = PLAYER_POS_Y(nr); x2 = x1 + TILEX - 1; y2 = y1 + TILEY - 1;