moved code for fixing single-player tapes to separate function
authorHolger Schemel <info@artsoft.org>
Mon, 14 Sep 2020 15:16:00 +0000 (17:16 +0200)
committerHolger Schemel <info@artsoft.org>
Mon, 14 Sep 2020 15:16:00 +0000 (17:16 +0200)
src/events.c
src/tape.c
src/tape.h

index d912e8206f80834dda3e85e2cebcff2f6d729e2f..2df4eb7bc3a3a4320f6ed4a36b79419b6e06e093 100644 (file)
@@ -1858,16 +1858,7 @@ static void HandleKeysSpecial(Key key)
     else if (strSuffix(cheat_input, ":fix-tape") ||
             strSuffix(cheat_input, ":ft"))
     {
     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"))
     }
     else if (strSuffix(cheat_input, ":save-native-level") ||
             strSuffix(cheat_input, ":snl"))
index 4894f1137bc9fb54fec3b5e7b81c03bcfae4fc56..29886a5c7346da27c25a3b3b5b538d0f8e982a5d 100644 (file)
@@ -1145,6 +1145,22 @@ boolean PlaySolutionTape(void)
   return TRUE;
 }
 
   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
 
 // ----------------------------------------------------------------------------
 // tape autoplay functions
index 341dca22e2c9aa3d937d4ed526af675c7c44b284..7b9c44f8681d8db6eaa15ff585b8668c4e8ffc0b 100644 (file)
@@ -257,6 +257,8 @@ boolean hasSolutionTape(void);
 boolean InsertSolutionTape(void);
 boolean PlaySolutionTape(void);
 
 boolean InsertSolutionTape(void);
 boolean PlaySolutionTape(void);
 
+void FixTape_ForceSinglePlayer(void);
+
 void AutoPlayTapes(void);
 void PatchTapes(void);
 
 void AutoPlayTapes(void);
 void PatchTapes(void);