fixed broken tapes caused by a bugfix (with TAS snap keys) in EM engine
authorHolger Schemel <info@artsoft.org>
Sun, 4 Feb 2018 22:33:22 +0000 (23:33 +0100)
committerHolger Schemel <info@artsoft.org>
Sun, 4 Feb 2018 22:33:22 +0000 (23:33 +0100)
- to prevent breaking old tapes, a version-specific engine value was added
- the corresponding snap key bug was initially fixed with commit c138430
- tapes created before 4.0.1.0 and broken due to this fix should work again

src/game.c
src/game_em/convert.c
src/game_em/export.h
src/game_em/input.c

index a3ad6f14842b48d363b52286776b2ffa97ffd748..b8d863fe232597b2b32f3c43132b2d10c6255980 100644 (file)
@@ -2702,6 +2702,9 @@ static void InitGameEngine()
   game_em.use_single_button =
     (game.engine_version > VERSION_IDENT(4,0,0,2));
 
+  game_em.use_snap_key_bug =
+    (game.engine_version < VERSION_IDENT(4,0,1,0));
+
   /* ---------------------------------------------------------------------- */
 
   /* set maximal allowed number of custom element changes per game frame */
index 3cad1078befb04c5784c2c9c130b4bbfa944cb45..cbc7187925b9e5933d9a6b54da378ee7fa2f59a1 100644 (file)
@@ -1111,6 +1111,7 @@ void prepare_em_level(void)
   // in function InitGameEngine() (src/game.c):
   //
   // - game_em.use_single_button (default: TRUE)
+  // - game_em.use_snap_key_bug (default: FALSE)
 
   game_em.any_player_moving = FALSE;
   game_em.any_player_snapping = FALSE;
index 365cafe863a6b2bcc29b0166838a25d429a65bb7..69c92d8efc418e6cd75c8f9f21d82f935e1a1c81 100644 (file)
@@ -668,6 +668,7 @@ struct GameInfo_EM
   boolean any_player_snapping;
 
   boolean use_single_button;
+  boolean use_snap_key_bug;
 
   int last_moving_player;
   int last_player_direction[MAX_PLAYERS];
index b8e2e663b1f5f96df79356adc6dea8b8220ba33e..4a2be29ec6809e7aeeea376dc1dd689bc8c79e48 100644 (file)
@@ -161,6 +161,10 @@ void readjoy(byte action, struct PLAYER *ply)
       !ply->joy_s &&
       !ply->joy_w)
     ply->joy_snap = snap;
+
+  /* use bug with snap key (mainly TAS keys) sometimes moving the player */
+  if (game_em.use_snap_key_bug)
+    ply->joy_snap = snap;
 }
 
 void SaveEngineSnapshotValues_EM()