fixed bug with using last mouse actions when tape finished playing
authorHolger Schemel <info@artsoft.org>
Wed, 5 Apr 2017 22:23:00 +0000 (00:23 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:12 +0000 (23:21 +0100)
src/game.c
src/game.h

index 92c54f12e73bafd1ce6e952d5cda1dfdb6ae4fcb..96b3ca1ad6ea9388480a65c67d5152605c233725 100644 (file)
@@ -3334,6 +3334,10 @@ void InitGame()
     player->mouse_action.ly = 0;
     player->mouse_action.button = 0;
 
+    player->effective_mouse_action.lx = 0;
+    player->effective_mouse_action.ly = 0;
+    player->effective_mouse_action.button = 0;
+
     player->score = 0;
     player->score_final = 0;
 
@@ -11323,8 +11327,10 @@ void GameActionsExt()
   /* when playing tape, read previously recorded player input from tape data */
   recorded_player_action = (tape.playing ? TapePlayAction() : NULL);
 
+  local_player->effective_mouse_action = local_player->mouse_action;
+
   if (recorded_player_action != NULL)
-    SetMouseActionFromTapeAction(&local_player->mouse_action,
+    SetMouseActionFromTapeAction(&local_player->effective_mouse_action,
                                 recorded_player_action);
 
   /* TapePlayAction() may return NULL when toggling to "pause before death" */
@@ -11383,7 +11389,8 @@ void GameActionsExt()
       tape.player_participates[i] = TRUE;
   }
 
-  SetTapeActionFromMouseAction(tape_action, &local_player->mouse_action);
+  SetTapeActionFromMouseAction(tape_action,
+                              &local_player->effective_mouse_action);
 
   /* only record actions from input devices, but not programmed actions */
   if (tape.recording)
@@ -11543,7 +11550,7 @@ void GameActions_MM_Main()
 {
   boolean warp_mode = (tape.playing && tape.warp_forward && !tape.pausing);
 
-  GameActions_MM(local_player->mouse_action, warp_mode);
+  GameActions_MM(local_player->effective_mouse_action, warp_mode);
 }
 
 void GameActions_RND_Main()
index c6f74f865d36a0179decb5160e100c08ff99a3d2..1d7f9cf5df9f9ef4f8391a6304d0a0cb4c0b445f 100644 (file)
@@ -232,7 +232,8 @@ struct PlayerInfo
   byte programmed_action;      /* action forced by game itself (like moving
                                   through doors); overrides other actions */
 
-  struct MouseActionInfo mouse_action;         /* (used by MM engine only) */
+  struct MouseActionInfo mouse_action;          /* (used by MM engine only) */
+  struct MouseActionInfo effective_mouse_action; /* (used by MM engine only) */
 
   int jx, jy, last_jx, last_jy;
   int MovDir, MovPos, GfxDir, GfxPos;