aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2022-06-20 21:56:12 +0200
committerGitHub <noreply@github.com>2022-06-20 21:56:12 +0200
commita463620edbe57071a7101297d33226507567ca73 (patch)
tree342d433ca55f4e3d1826508c303f2e6229d503f1 /src/client
parent0b41533763bc9f104a2da2e4191f4654b8d8dab4 (diff)
downloadminetest-a463620edbe57071a7101297d33226507567ca73.tar.gz
minetest-a463620edbe57071a7101297d33226507567ca73.tar.bz2
minetest-a463620edbe57071a7101297d33226507567ca73.zip
Re-order sound-related code (#12382)
Dropped ServerSoundParams -> moved to ServerPlayingSound. This gets rid of the duplicated 'fade' and 'pitch' values on server-side where only one was used anyway. SimpleSoundSpec is the basic sound without positional information, hence 'loop' is included. Recursively added PROTOCOL_VERSION to most functions to reduce the versioning mess in the future. Per-type version numbers are kept for now as a safety rope in a special case.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/content_cao.cpp2
-rw-r--r--src/client/game.cpp14
-rw-r--r--src/client/sound.h8
3 files changed, 12 insertions, 12 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index e603b5a21..c0fc4ccdf 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -1174,7 +1174,7 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
// Reduce footstep gain, as non-local-player footsteps are
// somehow louder.
spec.gain *= 0.6f;
- m_client->sound()->playSoundAt(spec, false, getPosition());
+ m_client->sound()->playSoundAt(spec, getPosition());
}
}
}
diff --git a/src/client/game.cpp b/src/client/game.cpp
index 5db472ee0..fb954d53f 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -282,7 +282,7 @@ public:
if (m_player_step_timer <= 0 && m_player_step_sound.exists()) {
m_player_step_timer = 0.03;
if (makes_footstep_sound)
- m_sound->playSound(m_player_step_sound, false);
+ m_sound->playSound(m_player_step_sound);
}
}
@@ -290,7 +290,7 @@ public:
{
if (m_player_jump_timer <= 0.0f) {
m_player_jump_timer = 0.2f;
- m_sound->playSound(SimpleSoundSpec("player_jump", 0.5f), false);
+ m_sound->playSound(SimpleSoundSpec("player_jump", 0.5f));
}
}
@@ -315,32 +315,32 @@ public:
static void cameraPunchLeft(MtEvent *e, void *data)
{
SoundMaker *sm = (SoundMaker *)data;
- sm->m_sound->playSound(sm->m_player_leftpunch_sound, false);
+ sm->m_sound->playSound(sm->m_player_leftpunch_sound);
}
static void cameraPunchRight(MtEvent *e, void *data)
{
SoundMaker *sm = (SoundMaker *)data;
- sm->m_sound->playSound(sm->m_player_rightpunch_sound, false);
+ sm->m_sound->playSound(sm->m_player_rightpunch_sound);
}
static void nodeDug(MtEvent *e, void *data)
{
SoundMaker *sm = (SoundMaker *)data;
NodeDugEvent *nde = (NodeDugEvent *)e;
- sm->m_sound->playSound(sm->m_ndef->get(nde->n).sound_dug, false);
+ sm->m_sound->playSound(sm->m_ndef->get(nde->n).sound_dug);
}
static void playerDamage(MtEvent *e, void *data)
{
SoundMaker *sm = (SoundMaker *)data;
- sm->m_sound->playSound(SimpleSoundSpec("player_damage", 0.5), false);
+ sm->m_sound->playSound(SimpleSoundSpec("player_damage", 0.5));
}
static void playerFallingDamage(MtEvent *e, void *data)
{
SoundMaker *sm = (SoundMaker *)data;
- sm->m_sound->playSound(SimpleSoundSpec("player_falling_damage", 0.5), false);
+ sm->m_sound->playSound(SimpleSoundSpec("player_falling_damage", 0.5));
}
void registerReceiver(MtEventManager *mgr)
diff --git a/src/client/sound.h b/src/client/sound.h
index c1d3c0cfa..a3bb3ce87 100644
--- a/src/client/sound.h
+++ b/src/client/sound.h
@@ -63,13 +63,13 @@ public:
virtual void step(float dtime) = 0;
virtual void fadeSound(int sound, float step, float gain) = 0;
- int playSound(const SimpleSoundSpec &spec, bool loop)
+ int playSound(const SimpleSoundSpec &spec)
{
- return playSound(spec.name, loop, spec.gain, spec.fade, spec.pitch);
+ return playSound(spec.name, spec.loop, spec.gain, spec.fade, spec.pitch);
}
- int playSoundAt(const SimpleSoundSpec &spec, bool loop, const v3f &pos)
+ int playSoundAt(const SimpleSoundSpec &spec, const v3f &pos)
{
- return playSoundAt(spec.name, loop, spec.gain, pos, spec.pitch);
+ return playSoundAt(spec.name, spec.loop, spec.gain, pos, spec.pitch);
}
};