From: Holger Schemel Date: Wed, 5 Apr 2017 22:23:00 +0000 (+0200) Subject: fixed bug with using last mouse actions when tape finished playing X-Git-Tag: 4.1.0.0~138 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=130737058201069bf104d946d48ffd6a05693873;p=rocksndiamonds.git fixed bug with using last mouse actions when tape finished playing --- diff --git a/src/game.c b/src/game.c index 92c54f12..96b3ca1a 100644 --- a/src/game.c +++ b/src/game.c @@ -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() diff --git a/src/game.h b/src/game.h index c6f74f86..1d7f9cf5 100644 --- a/src/game.h +++ b/src/game.h @@ -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;