X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fgame.c;h=de844f4298ca0351fcaceab4ce88082c9c8402c7;hp=1bfe0100d1084c4214ad9cbaff4026f1456bf450;hb=457e98ec0803cd9005a522018e7c255454d1e915;hpb=7e68d10c8f4c814e532cc30f6fc721c269a99cb6 diff --git a/src/game.c b/src/game.c index 1bfe0100..de844f42 100644 --- a/src/game.c +++ b/src/game.c @@ -10974,6 +10974,22 @@ static byte PlayerActions(struct PlayerInfo *player, byte player_action) } } +static void SetMouseActionFromTapeAction(struct MouseActionInfo *mouse_action, + byte *tape_action) +{ + mouse_action->lx = tape_action[TAPE_ACTION_LX]; + mouse_action->ly = tape_action[TAPE_ACTION_LY]; + mouse_action->button = tape_action[TAPE_ACTION_BUTTON]; +} + +static void SetTapeActionFromMouseAction(byte *tape_action, + struct MouseActionInfo *mouse_action) +{ + tape_action[TAPE_ACTION_LX] = mouse_action->lx; + tape_action[TAPE_ACTION_LY] = mouse_action->ly; + tape_action[TAPE_ACTION_BUTTON] = mouse_action->button; +} + static void CheckLevelTime() { int i; @@ -11301,6 +11317,10 @@ void GameActionsExt() /* when playing tape, read previously recorded player input from tape data */ recorded_player_action = (tape.playing ? TapePlayAction() : NULL); + if (recorded_player_action != NULL) + SetMouseActionFromTapeAction(&local_player->mouse_action, + recorded_player_action); + /* TapePlayAction() may return NULL when toggling to "pause before death" */ if (tape.pausing) return; @@ -11357,6 +11377,8 @@ void GameActionsExt() tape.player_participates[i] = TRUE; } + SetTapeActionFromMouseAction(tape_action, &local_player->mouse_action); + /* only record actions from input devices, but not programmed actions */ if (tape.recording) TapeRecordAction(tape_action); @@ -14673,6 +14695,47 @@ void PlayLevelSound_SP(int xx, int yy, int element_sp, int action_sp) PlayLevelSoundElementAction(x, y, element, action); } +void PlayLevelSound_MM(int xx, int yy, int element_mm, int action_mm) +{ + int element = map_element_MM_to_RND(element_mm); + int action = map_action_MM_to_RND(action_mm); + int offset = 0; + int x = xx - offset; + int y = yy - offset; + + PlayLevelSoundElementAction(x, y, element, action); +} + +void PlaySound_MM(int sound_mm) +{ + int sound = map_sound_MM_to_RND(sound_mm); + + if (sound == SND_UNDEFINED) + return; + + PlaySound(sound); +} + +void PlaySoundLoop_MM(int sound_mm) +{ + int sound = map_sound_MM_to_RND(sound_mm); + + if (sound == SND_UNDEFINED) + return; + + PlaySoundLoop(sound); +} + +void StopSound_MM(int sound_mm) +{ + int sound = map_sound_MM_to_RND(sound_mm); + + if (sound == SND_UNDEFINED) + return; + + StopSound(sound); +} + void RaiseScore(int value) { local_player->score += value;