From: Holger Schemel Date: Wed, 30 Dec 2020 20:57:47 +0000 (+0100) Subject: fixed bug with playing team mode tapes with changed visible playfield size X-Git-Tag: 4.2.2.1~20 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8012cb56ca562fa7c3001fb6acc7b1c7db3f580e;p=rocksndiamonds.git fixed bug with playing team mode tapes with changed visible playfield size --- diff --git a/src/engines.h b/src/engines.h index 34838d5a..4e09b72a 100644 --- a/src/engines.h +++ b/src/engines.h @@ -31,6 +31,9 @@ boolean swapTiles_EM(boolean); boolean getTeamMode_EM(void); boolean isActivePlayer_EM(int); +int getScreenFieldSizeX(void); +int getScreenFieldSizeY(void); + void PlayLevelSound_EM(int, int, int, int); void InitGraphicInfo_EM(void); boolean CheckSingleStepMode_EM(byte action[], int, boolean, boolean, boolean); diff --git a/src/game.c b/src/game.c index 768ba2e1..d80e8288 100644 --- a/src/game.c +++ b/src/game.c @@ -12452,6 +12452,8 @@ void GameActions_RND(void) static boolean AllPlayersInSight(struct PlayerInfo *player, int x, int y) { int min_x = x, min_y = y, max_x = x, max_y = y; + int scr_fieldx = getScreenFieldSizeX(); + int scr_fieldy = getScreenFieldSizeY(); int i; for (i = 0; i < MAX_PLAYERS; i++) @@ -12467,7 +12469,7 @@ static boolean AllPlayersInSight(struct PlayerInfo *player, int x, int y) max_y = MAX(max_y, jy); } - return (max_x - min_x < SCR_FIELDX && max_y - min_y < SCR_FIELDY); + return (max_x - min_x < scr_fieldx && max_y - min_y < scr_fieldy); } static boolean AllPlayersInVisibleScreen(void) diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index a29d2e0e..398ae6e0 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -553,11 +553,13 @@ static void setMinimalPlayerBoundaries(int *sx1, int *sy1, int *sx2, int *sy2) boolean checkIfAllPlayersFitToScreen(void) { int sx1 = 0, sy1 = 0, sx2 = 0, sy2 = 0; + int scr_fieldx = getScreenFieldSizeX(); + int scr_fieldy = getScreenFieldSizeY(); setMinimalPlayerBoundaries(&sx1, &sy1, &sx2, &sy2); - return (sx2 - sx1 <= SCR_FIELDX * TILEX && - sy2 - sy1 <= SCR_FIELDY * TILEY); + return (sx2 - sx1 <= scr_fieldx * TILEX && + sy2 - sy1 <= scr_fieldy * TILEY); } static void setScreenCenteredToAllPlayers(int *sx, int *sy) diff --git a/src/tools.c b/src/tools.c index f0fcae29..21232c2d 100644 --- a/src/tools.c +++ b/src/tools.c @@ -391,6 +391,16 @@ int getLevelFromScreenY(int y) return getLevelFromScreenY_RND(y); } +int getScreenFieldSizeX(void) +{ + return (tape.playing ? tape.scr_fieldx : SCR_FIELDX); +} + +int getScreenFieldSizeY(void) +{ + return (tape.playing ? tape.scr_fieldy : SCR_FIELDY); +} + void DumpTile(int x, int y) { int sx = SCREENX(x); diff --git a/src/tools.h b/src/tools.h index 6d012667..4dffbbd1 100644 --- a/src/tools.h +++ b/src/tools.h @@ -72,6 +72,9 @@ int getFieldbufferOffsetY_RND(int, int); int getLevelFromScreenX(int); int getLevelFromScreenY(int); +int getScreenFieldSizeX(void); +int getScreenFieldSizeY(void); + void DumpTile(int, int); void DumpTileFromScreen(int, int);