CAO footstep sounds: Reduce gain to balance volume 5679/head
authorparamat <paramat@users.noreply.github.com>
Tue, 19 Sep 2017 15:39:30 +0000 (16:39 +0100)
committerparamat <mat.gregory@virginmedia.com>
Mon, 2 Oct 2017 16:54:08 +0000 (17:54 +0100)
src/content_cao.cpp

index 9a493daff3409e14ce374a7beda893f8fd3283cc..7178debaa2ab529b44c819f78f03239960504a5d 100644 (file)
@@ -862,16 +862,17 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
 
                float moved = lastpos.getDistanceFrom(pos_translator.vect_show);
                m_step_distance_counter += moved;
-               if(m_step_distance_counter > 1.5*BS)
-               {
-                       m_step_distance_counter = 0;
-                       if(!m_is_local_player && m_prop.makes_footstep_sound)
-                       {
+               if (m_step_distance_counter > 1.5f * BS) {
+                       m_step_distance_counter = 0.0f;
+                       if (!m_is_local_player && m_prop.makes_footstep_sound) {
                                INodeDefManager *ndef = m_client->ndef();
-                               v3s16 p = floatToInt(getPosition() + v3f(0,
-                                               (m_prop.collisionbox.MinEdge.Y-0.5)*BS, 0), BS);
+                               v3s16 p = floatToInt(getPosition() +
+                                       v3f(0.0f, (m_prop.collisionbox.MinEdge.Y - 0.5f) * BS, 0.0f), BS);
                                MapNode n = m_env->getMap().getNodeNoEx(p);
                                SimpleSoundSpec spec = ndef->get(n).sound_footstep;
+                               // Reduce footstep gain, as non-local-player footsteps are
+                               // somehow louder.
+                               spec.gain *= 0.6f;
                                m_client->sound()->playSoundAt(spec, false, getPosition());
                        }
                }