From: Holger Schemel Date: Mon, 14 Sep 2020 15:16:00 +0000 (+0200) Subject: moved code for fixing single-player tapes to separate function X-Git-Tag: 4.2.0.3~44 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=97648ab29c587dee3e5fa5be3cc0cfda96543f22;p=rocksndiamonds.git moved code for fixing single-player tapes to separate function --- diff --git a/src/events.c b/src/events.c index d912e820..2df4eb7b 100644 --- a/src/events.c +++ b/src/events.c @@ -1858,16 +1858,7 @@ static void HandleKeysSpecial(Key key) else if (strSuffix(cheat_input, ":fix-tape") || strSuffix(cheat_input, ":ft")) { - /* fix single-player tapes that contain player input for more than one - player (due to a bug in 3.3.1.2 and earlier versions), which results - in playing levels with more than one player in multi-player mode, - even though the tape was originally recorded in single-player mode */ - - // remove player input actions for all players but the first one - for (i = 1; i < MAX_PLAYERS; i++) - tape.player_participates[i] = FALSE; - - tape.changed = TRUE; + FixTape_ForceSinglePlayer(); } else if (strSuffix(cheat_input, ":save-native-level") || strSuffix(cheat_input, ":snl")) diff --git a/src/tape.c b/src/tape.c index 4894f113..29886a5c 100644 --- a/src/tape.c +++ b/src/tape.c @@ -1145,6 +1145,22 @@ boolean PlaySolutionTape(void) return TRUE; } +void FixTape_ForceSinglePlayer(void) +{ + int i; + + /* fix single-player tapes that contain player input for more than one + player (due to a bug in 3.3.1.2 and earlier versions), which results + in playing levels with more than one player in multi-player mode, + even though the tape was originally recorded in single-player mode */ + + // remove player input actions for all players but the first one + for (i = 1; i < MAX_PLAYERS; i++) + tape.player_participates[i] = FALSE; + + tape.changed = TRUE; +} + // ---------------------------------------------------------------------------- // tape autoplay functions diff --git a/src/tape.h b/src/tape.h index 341dca22..7b9c44f8 100644 --- a/src/tape.h +++ b/src/tape.h @@ -257,6 +257,8 @@ boolean hasSolutionTape(void); boolean InsertSolutionTape(void); boolean PlaySolutionTape(void); +void FixTape_ForceSinglePlayer(void); + void AutoPlayTapes(void); void PatchTapes(void);