summaryrefslogtreecommitdiffstats
path: root/game/client/entity/sound_emitter.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-12-11 15:14:26 +0500
committeruntodesu <kirill@untode.su>2025-12-11 15:14:26 +0500
commitf40d09cb8f712e87691af4912f3630d92d692779 (patch)
tree7ac3a4168ff722689372fd489c6f94d0a2546e8f /game/client/entity/sound_emitter.cc
parent8bcbd2729388edc63c82d77d314b583af1447c49 (diff)
downloadvoxelius-f40d09cb8f712e87691af4912f3630d92d692779.tar.bz2
voxelius-f40d09cb8f712e87691af4912f3630d92d692779.zip
Shuffle stuff around
- Use the new and improved hierarchy I figured out when making Prospero chat - Re-add NSIS scripts, again from Prospero - Update most build and utility scripts with their most recent versions
Diffstat (limited to 'game/client/entity/sound_emitter.cc')
-rw-r--r--game/client/entity/sound_emitter.cc63
1 files changed, 0 insertions, 63 deletions
diff --git a/game/client/entity/sound_emitter.cc b/game/client/entity/sound_emitter.cc
deleted file mode 100644
index 84a66c0..0000000
--- a/game/client/entity/sound_emitter.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-#include "client/pch.hh"
-
-#include "client/entity/sound_emitter.hh"
-
-#include "core/config/number.hh"
-
-#include "core/math/constexpr.hh"
-
-#include "shared/entity/transform.hh"
-#include "shared/entity/velocity.hh"
-
-#include "shared/world/dimension.hh"
-
-#include "shared/coord.hh"
-
-#include "client/entity/camera.hh"
-
-#include "client/sound/sound.hh"
-
-#include "client/globals.hh"
-
-entity::SoundEmitter::SoundEmitter(void)
-{
- alGenSources(1, &source);
- sound = nullptr;
-}
-
-entity::SoundEmitter::~SoundEmitter(void)
-{
- alSourceStop(source);
- alDeleteSources(1, &source);
-}
-
-void entity::SoundEmitter::update(void)
-{
- if(globals::dimension) {
- const auto view = globals::dimension->entities.view<entity::SoundEmitter>();
-
- const auto& pivot = entity::camera::position_chunk;
- const auto gain = glm::clamp(sound::volume_effects.get_value() * 0.01f, 0.0f, 1.0f);
-
- for(const auto [entity, emitter] : view.each()) {
- alSourcef(emitter.source, AL_GAIN, gain);
-
- if(const auto transform = globals::dimension->entities.try_get<entity::client::TransformIntr>(entity)) {
- auto position = coord::to_relative(pivot, transform->chunk, transform->local);
- alSource3f(emitter.source, AL_POSITION, position.x, position.y, position.z);
- }
-
- if(const auto velocity = globals::dimension->entities.try_get<entity::Velocity>(entity)) {
- alSource3f(emitter.source, AL_VELOCITY, velocity->value.x, velocity->value.y, velocity->value.z);
- }
-
- ALint source_state;
- alGetSourcei(emitter.source, AL_SOURCE_STATE, &source_state);
-
- if(source_state == AL_STOPPED) {
- alSourceRewind(emitter.source);
- emitter.sound = nullptr;
- }
- }
- }
-}