diff options
| author | robojumper <robojumper@gmail.com> | 2025-05-30 22:21:49 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-05-31 21:21:12 +0200 |
| commit | 83456a9cd8a15b6c27d29f09c72ad1f09bc2ed60 (patch) | |
| tree | 5cf9528a037062eb3b1555c8869d2cf37d80612f /src/d/snd/d_snd_source.cpp | |
| parent | 77e17d4c1fb7439914889076b21176242301e7ef (diff) | |
start matching some d/snd things
Diffstat (limited to 'src/d/snd/d_snd_source.cpp')
| -rw-r--r-- | src/d/snd/d_snd_source.cpp | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/d/snd/d_snd_source.cpp b/src/d/snd/d_snd_source.cpp new file mode 100644 index 00000000..68a312bb --- /dev/null +++ b/src/d/snd/d_snd_source.cpp @@ -0,0 +1,94 @@ +#include "d/snd/d_snd_source.h" + +#include "common.h" +#include "d/snd/d_snd_3d_actor.h" +#include "nw4r/snd/snd_SoundStartable.h" +#include "nw4r/ut/ut_list.h" +#include "sized_string.h" + +extern "C" u8 fn_80382590(u8, UNKWORD); +extern "C" void fn_80386C50(UNKWORD, dSoundSource_c *); +extern "C" void fn_80386C70(dSoundSource_c *); + +struct d_snd_mgr_unk_6_sinit { + d_snd_mgr_unk_6_sinit() : field_0x00(0), field_0x04(0.0f) {} + + u32 field_0x00; + f32 field_0x04; +}; + +d_snd_mgr_unk_6_sinit d_snd_mgr_unk_6_sinit_instance; + +const char *help_i_need_data() { + return "%s_%s_%d"; +} + +dSoundSource_c::dSoundSource_c(u8 a1, dAcBase_c *player, UNKWORD a3, UNKWORD a4) + : dSnd3DActor_c(((char *)a4) + 0x50, a1), + field_0x0F0(a3), + field_0x0F4(0), + mpPlayer(player), + field_0x0FD(a1), + field_0x0FE(0), + field_0x0FF(0), + field_0x100(0), + field_0x101(0), + field_0x102(0), + field_0x104(0), + field_0x108(0), + field_0x10C(0), + field_0x11C(0), + field_0x140(a4), + field_0x154(0), + field_0x158(-1), + field_0x15A(-1) { + field_0x0FC = fn_80382590(a1, a3); + // TODO: Offsetof + nw4r::ut::List_Init(&field_0x110, 0xEC); + nw4r::ut::List_Init(&field_0x120, 0x04); + nw4r::ut::List_Init(&field_0x12C, 0x04); + fn_80386C50(a4, this); +} + +dSoundSource_c::~dSoundSource_c() { + SetUserParam(0); + vt_0x44(); + fn_80386C70(this); +} + +bool dSoundSource_c::hasPlayingSounds() const { + return dSnd3DActor_c::hasPlayingSounds(); +} + +void dSoundSource_c::d_vt_0x38(bool flag, int fadeFrames) { + if (flag == 0) { + PauseAllSound(flag, fadeFrames); + d_s_vt_0x1C4(flag, fadeFrames); + a_field_0x80 = 0; + } else if (a_field_0x7E == 0) { + PauseAllSound(flag, fadeFrames); + d_s_vt_0x1C4(flag, fadeFrames); + a_field_0x80 = 1; + } +} + +nw4r::snd::SoundStartable::StartResult +dSoundSource_c::SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *) { + // TODO + return START_SUCCESS; +} + +void dSoundSource_c::d_vt_0x58() { + // noop +} + +void dSoundSource_c::d_vt_0x5C() { + // noop +} + +u32 dSoundSource_c::getRemoConSoundVariant(u32 soundId) const { + const char *label = soundIdToSoundLabel(soundId); + SizedString<64> str; + str.sprintf("%s_RC", label); + return soundLabelToSoundId(str); +} |
