diff options
author | sfan5 <sfan5@live.de> | 2022-09-11 21:16:17 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2022-09-30 14:02:14 +0200 |
commit | 525fc3833c40dcca478719533a87bc7b5e285e4e (patch) | |
tree | e052ace4266381dbb3f7d8b8591a9d7d66ea6915 /src/client/game.cpp | |
parent | bbdb1929c61a7cf851b498f34154ac0f9528fbb4 (diff) | |
download | minetest-525fc3833c40dcca478719533a87bc7b5e285e4e.tar.xz |
Implement tool use sounds
Diffstat (limited to 'src/client/game.cpp')
-rw-r--r-- | src/client/game.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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")) |