From 2a4f48a259cbb8cf1f4cc8d6c9a734b37446d118 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 2 Jan 2021 02:18:30 +0100 Subject: [PATCH] added mode to patch tapes to force visible playfield size of 34 x 34 This adds a new tape patch mode "screen_34x34" that can be used to patch existing tapes to force a visible playfield size of 34 x 34 tiles (as used with setup option "small game graphics" when using a graphics set with classic visible playfield size of 17 x 17 tiles). This patch mode can be applied to team mode tapes only. This patch mode can be used to fix broken tapes caused by recording tapes in team mode and then replaying them with a different visible playfield size, potentially causing different player movement due to players being unable to move when reaching the edge of the visible playfield when another player stays at the opposite screen border, with default player focus that forces all players to be inside the visible playfield. --- src/tape.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/tape.c b/src/tape.c index d6f89455..27e17332 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1517,6 +1517,39 @@ static boolean PatchTape(struct TapeInfo *tape, char *mode) use_property_bit = TRUE; } + else if (strEqual(mode, "screen_34x34") || strPrefix(mode, "screen_34x34:")) + { + // this bug only affects team mode tapes + if (tape->num_participating_players == 1) + { + Print("Only team mode tapes can be patched against screen size bug!\n"); + + return FALSE; + } + + // this bug (that always existed before) was fixed in version 4.2.2.1 + if (tape->engine_version >= VERSION_IDENT(4,2,2,1)) + { + Print("This tape version cannot be patched against screen size bug!\n"); + + return FALSE; + } + + int factor = (unpatch_tape ? 1 : 2); + int scr_fieldx_new = SCR_FIELDX_DEFAULT * factor; + int scr_fieldy_new = SCR_FIELDY_DEFAULT * factor; + + if (scr_fieldx_new == tape->scr_fieldx && + scr_fieldy_new == tape->scr_fieldy) + { + Print("Tape already patched for '%s'!\n", mode); + + return FALSE; + } + + tape->scr_fieldx = scr_fieldx_new; + tape->scr_fieldy = scr_fieldy_new; + } else { Print("Unknown patch mode '%s'!\n", mode); @@ -1563,6 +1596,7 @@ void PatchTapes(void) PrintLine("=", 79); Print("Supported patch modes:\n"); Print("- \"em_random_bug\" - use 64-bit random value bug for EM engine\n"); + Print("- \"screen_34x34\" - force visible playfield size of 34 x 34\n"); PrintLine("-", 79); Print("Supported modifiers:\n"); Print("- add \":0\", \":off\" or \":clear\" to patch mode to un-patch tape file\n"); -- 2.34.1