From: Holger Schemel Date: Tue, 19 Dec 2017 20:55:07 +0000 (+0100) Subject: added single-step mode (well, sort of) to MM game engine X-Git-Tag: 4.1.0.0~27 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0ac301d6e3c5551a5ff66baaaa8ce867bb1aceb1;p=rocksndiamonds.git added single-step mode (well, sort of) to MM game engine --- diff --git a/src/engines.h b/src/engines.h index 03baeb8d..9983d559 100644 --- a/src/engines.h +++ b/src/engines.h @@ -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 *); diff --git a/src/events.c b/src/events.c index 08e571d1..ea5312ae 100644 --- a/src/events.c +++ b/src/events.c @@ -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); diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index ec206faf..d34eec08 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -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() diff --git a/src/tools.c b/src/tools.c index d11d99d2..777a1a08 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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) {