From: Holger Schemel Date: Tue, 18 Feb 2020 17:05:10 +0000 (+0100) Subject: removed repeated code X-Git-Tag: 4.2.0.0~99 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d91ea9b217ab87437cc7e9fb8956fe82be40ecf8;p=rocksndiamonds.git removed repeated code --- diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index ac219b86..d1567b4a 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 @@ -377,8 +380,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;