added single-step mode (well, sort of) to MM game engine
authorHolger Schemel <info@artsoft.org>
Tue, 19 Dec 2017 20:55:07 +0000 (21:55 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:17 +0000 (23:21 +0100)
src/engines.h
src/events.c
src/game_mm/mm_game.c
src/tools.c

index 03baeb8d5b55caeae3630f3fd489e88543fa3df8..9983d559b1b6a28b4eabf5af9a363e0e987c769a 100644 (file)
@@ -60,6 +60,8 @@ void SetDrawtoField(int);
 
 int el2img_mm(int);
 
+void CheckSingleStepMode_MM(boolean);
+
 void getGraphicSource(int, int, Bitmap **, int *, int *);
 void getMiniGraphicSource(int, Bitmap **, int *, int *);
 void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *);
index 08e571d17427f418b066613bde349cb57c747b6e..ea5312aecb1efbe79e8239e20ab69115c36a74e4 100644 (file)
@@ -401,6 +401,7 @@ void SetPlayerMouseAction(int mx, int my, int button)
 {
   int lx = getLevelFromScreenX(mx);
   int ly = getLevelFromScreenY(my);
+  int new_button = (!local_player->mouse_action.button && button);
 
   ClearPlayerMouseAction();
 
@@ -413,9 +414,9 @@ void SetPlayerMouseAction(int mx, int my, int button)
 
   if (tape.recording && tape.pausing && tape.use_mouse)
   {
-    /* prevent button release or motion events from un-pausing a paused game */
-    if (button && !motion_status)
-      TapeTogglePause(TAPE_TOGGLE_MANUAL);
+    /* un-pause a paused game only if mouse button was newly pressed down */
+    if (new_button)
+      TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
   }
 
   SetTileCursorXY(lx, ly);
index ec206faf8f0452278fffed98d8d9e6c14126992e..d34eec08eed4c2c22c2813f252c48de01edafd10 100644 (file)
@@ -3747,6 +3747,8 @@ void GameActions_MM(struct MouseActionInfo action, boolean warp_mode)
   ClickElement(action.lx, action.ly, action.button);
 
   GameActions_MM_Ext(action, warp_mode);
+
+  CheckSingleStepMode_MM(action.button == MB_RELEASED);
 }
 
 void MovePacMen()
index d11d99d2effc0b5579c2206374facfdfda83a0d8..777a1a08c833bcde707f13a322b04767195a82f3 100644 (file)
@@ -8747,6 +8747,11 @@ void CheckSaveEngineSnapshot_SP(boolean murphy_is_waiting,
   }
 }
 
+void CheckSaveEngineSnapshot_MM(boolean button_released)
+{
+  CheckSaveEngineSnapshotToList();
+}
+
 void CheckSingleStepMode_EM(byte action[MAX_PLAYERS], int frame,
                            boolean any_player_moving,
                            boolean any_player_snapping,
@@ -8777,6 +8782,15 @@ void CheckSingleStepMode_SP(boolean murphy_is_waiting,
   CheckSaveEngineSnapshot_SP(murphy_is_waiting, murphy_is_dropping);
 }
 
+void CheckSingleStepMode_MM(boolean button_released)
+{
+  if (tape.single_step && tape.recording && !tape.pausing)
+    if (button_released)
+      TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+
+  CheckSaveEngineSnapshot_MM(button_released);
+}
+
 void getGraphicSource_SP(struct GraphicInfo_SP *g_sp,
                         int graphic, int sync_frame, int x, int y)
 {