From 525fc3833c40dcca478719533a87bc7b5e285e4e Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 11 Sep 2022 21:16:17 +0200 Subject: Implement tool use sounds --- src/client/game.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/client') diff --git a/src/client/game.cpp b/src/client/game.cpp index 6807c7eca..91c93ef7f 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -264,6 +264,8 @@ public: SimpleSoundSpec m_player_step_sound; SimpleSoundSpec m_player_leftpunch_sound; + // Second sound made on left punch, currently used for item 'use' sound + SimpleSoundSpec m_player_leftpunch_sound2; SimpleSoundSpec m_player_rightpunch_sound; SoundMaker(ISoundManager *sound, const NodeDefManager *ndef): @@ -314,6 +316,7 @@ public: { SoundMaker *sm = (SoundMaker *)data; sm->m_sound->playSound(sm->m_player_leftpunch_sound); + sm->m_sound->playSound(sm->m_player_leftpunch_sound2); } static void cameraPunchRight(MtEvent *e, void *data) @@ -3236,7 +3239,9 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud) runData.punching = false; - soundmaker->m_player_leftpunch_sound.name.clear(); + soundmaker->m_player_leftpunch_sound = SimpleSoundSpec(); + soundmaker->m_player_leftpunch_sound2 = pointed.type != POINTEDTHING_NOTHING ? + selected_def.sound_use : selected_def.sound_use_air; // Prepare for repeating, unless we're not supposed to if (isKeyDown(KeyType::PLACE) && !g_settings->getBool("safe_dig_and_place")) -- cgit v1.2.3