From: Holger Schemel Date: Sun, 3 Jan 2021 00:18:36 +0000 (+0100) Subject: fixed single step mode for R'n'D game engine when used in team mode X-Git-Tag: 4.2.2.1~16 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=de5140b18022b8d5db653e1175e7ffd202b2645d;p=rocksndiamonds.git fixed single step mode for R'n'D game engine when used in team mode --- diff --git a/src/game.c b/src/game.c index d80e8288..5968b1de 100644 --- a/src/game.c +++ b/src/game.c @@ -11286,13 +11286,14 @@ static void CheckSingleStepMode(struct PlayerInfo *player) { if (tape.single_step && tape.recording && !tape.pausing) { - /* as it is called "single step mode", just return to pause mode when the - player stopped moving after one tile (or never starts moving at all) */ - if (!player->is_moving && - !player->is_pushing && - !player->is_dropping_pressed && - !player->effective_mouse_action.button) - TapeTogglePause(TAPE_TOGGLE_AUTOMATIC); + // as it is called "single step mode", just return to pause mode when the + // player stopped moving after one tile (or never starts moving at all) + // (reverse logic needed here in case single step mode used in team mode) + if (player->is_moving || + player->is_pushing || + player->is_dropping_pressed || + player->effective_mouse_action.button) + game.enter_single_step_mode = FALSE; } CheckSaveEngineSnapshot(player); @@ -11955,6 +11956,10 @@ void GameActions_RND(void) DrawGameDoorValues(); } + // check single step mode (set flag and clear again if any player is active) + game.enter_single_step_mode = + (tape.single_step && tape.recording && !tape.pausing); + for (i = 0; i < MAX_PLAYERS; i++) { int actual_player_action = stored_player[i].effective_action; @@ -11979,6 +11984,10 @@ void GameActions_RND(void) ScrollPlayer(&stored_player[i], SCROLL_GO_ON); } + // single step pause mode may already have been toggled by "ScrollPlayer()" + if (game.enter_single_step_mode && !tape.pausing) + TapeTogglePause(TAPE_TOGGLE_AUTOMATIC); + ScrollScreen(NULL, SCROLL_GO_ON); /* for backwards compatibility, the following code emulates a fixed bug that diff --git a/src/game.h b/src/game.h index b34d4344..d1323f0e 100644 --- a/src/game.h +++ b/src/game.h @@ -244,6 +244,9 @@ struct GameInfo boolean set_centered_player; boolean set_centered_player_wrap; + // values for single step mode control + boolean enter_single_step_mode; + // values for random number generator initialization after snapshot unsigned int num_random_calls;