summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2025-06-24 22:15:25 +0200
committerrobojumper <robojumper@gmail.com>2025-09-13 10:53:29 +0200
commitb522045f0e80f5537e6ffc3d38de0ba86677ce08 (patch)
treed62e6ab3b8064953041088277488aed285e19315 /src
parent21eef4331b3e39f8e602679723fb2d05ff925377 (diff)
Another two obj source files
Diffstat (limited to 'src')
-rw-r--r--src/d/snd/d_snd_source_obj.cpp38
-rw-r--r--src/d/snd/d_snd_source_obj_clef.cpp132
2 files changed, 170 insertions, 0 deletions
diff --git a/src/d/snd/d_snd_source_obj.cpp b/src/d/snd/d_snd_source_obj.cpp
new file mode 100644
index 00000000..67792119
--- /dev/null
+++ b/src/d/snd/d_snd_source_obj.cpp
@@ -0,0 +1,38 @@
+#include "d/snd/d_snd_source_obj.h"
+
+#include "common.h"
+#include "d/snd/d_snd_source.h"
+#include "d/snd/d_snd_source_mgr.h"
+#include "d/snd/d_snd_state_mgr.h"
+#include "d/snd/d_snd_wzsound.h"
+#include "nw4r/math/math_types.h"
+
+void dSndSourceObj_c::postSetup() {
+ if (isName("Fire")) {
+ if (dSndStateMgr_c::isInStage("F008r")) {
+ // Inside Goddess Statue
+ setVolumeFade(0.7f, 0);
+ }
+ return;
+ }
+
+ if ((isName("TDoor") || isName("Wind") || isName("Flag")) &&
+ dSndStateMgr_c::GetInstance()->getField_0x058() >= 13) {
+ setVolumeFade(0.0f, 0);
+ }
+}
+
+void dSndSourceObjLightShaft_c::setPosition(const nw4r::math::VEC3 &position) {
+ if (dSndSourceMgr_c::getPlayerSource() != nullptr) {
+ f32 y = dSndSourceMgr_c::getPlayerSource()->GetPosition().y;
+ nw4r::math::VEC3 v = position;
+ if (y > 0.0f) {
+ v.y = y;
+ } else {
+ v.y = 0.0f;
+ }
+ SetPosition(v);
+ mFlags = 0;
+ holdSound(SE_LightLi_LV);
+ }
+}
diff --git a/src/d/snd/d_snd_source_obj_clef.cpp b/src/d/snd/d_snd_source_obj_clef.cpp
new file mode 100644
index 00000000..be1be9b5
--- /dev/null
+++ b/src/d/snd/d_snd_source_obj_clef.cpp
@@ -0,0 +1,132 @@
+#include "d/snd/d_snd_source_obj_clef.h"
+
+#include "common.h"
+#include "d/snd/d_snd_wzsound.h"
+#include "nw4r/snd/snd_SeqSoundHandle.h"
+#include "nw4r/snd/snd_SoundHandle.h"
+
+struct SndTadtoneGroup {
+ u8 count;
+ u8 pitchVariables[];
+};
+
+static const SndTadtoneGroup grp1 = {
+ 1,
+ {0x41},
+};
+
+static const SndTadtoneGroup grp2 = {
+ 4,
+ {0x3C, 0x40, 0x41, 0x43},
+};
+
+static const SndTadtoneGroup grp3 = {
+ 2,
+ {0x43, 0x37},
+};
+
+static const SndTadtoneGroup grp4 = {
+ 8,
+ {0x34, 0x43, 0x41, 0x43, 0x45, 0x35, 0x39, 0x3C},
+};
+
+static const SndTadtoneGroup grp5 = {
+ 1,
+ {0x41},
+};
+
+static const SndTadtoneGroup grp6 = {
+ 8,
+ {0x48, 0x34, 0x37, 0x3C, 0x43, 0x4A, 0x4C, 0x48},
+};
+
+static const SndTadtoneGroup grp7 = {
+ 1,
+ {0x41},
+};
+
+static const SndTadtoneGroup grp8 = {
+ 4,
+ {0x3C, 0x40, 0x41, 0x43},
+};
+
+static const SndTadtoneGroup grp9 = {
+ 8,
+ {0x43, 0x3C, 0x37, 0x3C, 0x34, 0x43, 0x41, 0x43},
+};
+
+static const SndTadtoneGroup grp10 = {
+ 1,
+ {0x45},
+};
+
+static const SndTadtoneGroup grp11 = {
+ 4,
+ {0x41, 0x35, 0x39, 0x3C},
+};
+
+static const SndTadtoneGroup grp12 = {
+ 8,
+ {0x48, 0x34, 0x37, 0x3C, 0x43, 0x4A, 0x4C, 0x48},
+};
+
+static const SndTadtoneGroup grp13 = {
+ 1,
+ {0x41},
+};
+
+static const SndTadtoneGroup grp14 = {
+ 4,
+ {0x3C, 0x40, 0x41, 0x43},
+};
+
+static const SndTadtoneGroup grp15 = {
+ 2,
+ {0x43, 0x37},
+};
+
+static const SndTadtoneGroup grp16 = {
+ 4,
+ {0x37, 0x43, 0x41, 0x43},
+};
+
+static const SndTadtoneGroup grp17 = {
+ 16,
+ {0x45, 0x39, 0x3E, 0x41, 0x35, 0x39, 0x3E, 0x41, 0x48, 0x34, 0x37, 0x3C, 0x43, 0x4A, 0x4C, 0x48},
+};
+
+static const SndTadtoneGroup *sGroups[] = {
+ &grp1, &grp2, &grp3, &grp4, &grp5, &grp6, &grp7, &grp8, &grp9,
+ &grp10, &grp11, &grp12, &grp13, &grp14, &grp15, &grp16, &grp17,
+};
+
+static nw4r::snd::SoundHandle clefSoundHandle;
+
+bool dSndSourceObjClef_c::startTadtoneSound(u32 groupIdx, u32 noteIdx) {
+ if (groupIdx > ARRAY_LENGTH(sGroups)) {
+ return false;
+ }
+
+ if (groupIdx < 1) {
+ return false;
+ }
+
+ const SndTadtoneGroup *grp = sGroups[groupIdx - 1];
+
+ if (noteIdx >= grp->count) {
+ return false;
+ }
+
+ s16 var = grp->pitchVariables[noteIdx];
+
+ clefSoundHandle.Stop(10);
+
+ nw4r::snd::SoundHandle *pHandle = startSound(SE_Clef_VOICE, &clefSoundHandle);
+ if (pHandle != nullptr) {
+ nw4r::snd::SeqSoundHandle seqHandle(pHandle);
+ seqHandle.WriteVariable(0, var);
+ return true;
+ }
+
+ return false;
+}