X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=96b3ca1ad6ea9388480a65c67d5152605c233725;hb=91c69482bdfa0096eda9f1788495efe9ffcbf515;hp=de844f4298ca0351fcaceab4ce88082c9c8402c7;hpb=457e98ec0803cd9005a522018e7c255454d1e915;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index de844f42..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; @@ -10977,6 +10981,9 @@ static byte PlayerActions(struct PlayerInfo *player, byte player_action) static void SetMouseActionFromTapeAction(struct MouseActionInfo *mouse_action, byte *tape_action) { + if (!tape.use_mouse) + return; + mouse_action->lx = tape_action[TAPE_ACTION_LX]; mouse_action->ly = tape_action[TAPE_ACTION_LY]; mouse_action->button = tape_action[TAPE_ACTION_BUTTON]; @@ -10985,6 +10992,9 @@ static void SetMouseActionFromTapeAction(struct MouseActionInfo *mouse_action, static void SetTapeActionFromMouseAction(byte *tape_action, struct MouseActionInfo *mouse_action) { + if (!tape.use_mouse) + return; + tape_action[TAPE_ACTION_LX] = mouse_action->lx; tape_action[TAPE_ACTION_LY] = mouse_action->ly; tape_action[TAPE_ACTION_BUTTON] = mouse_action->button; @@ -11317,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" */ @@ -11377,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) @@ -11537,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() @@ -14703,6 +14716,9 @@ void PlayLevelSound_MM(int xx, int yy, int element_mm, int action_mm) int x = xx - offset; int y = yy - offset; + if (!IS_MM_ELEMENT(element)) + element = EL_MM_DEFAULT; + PlayLevelSoundElementAction(x, y, element, action); }