summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2025-06-15 18:16:26 +0200
committerrobojumper <robojumper@gmail.com>2025-09-13 10:51:36 +0200
commit6cb7f3bfdc8b4f69e2443fad99fb7d807cf9ea7c (patch)
tree10871e545d45c2d2afe624d7c0d737bc5b0005c1 /include
parent7d333a8d8e468dd891d380248af03387af672e17 (diff)
More sound effects and splits
Diffstat (limited to 'include')
-rw-r--r--include/d/snd/d_snd_3d_manager.h9
-rw-r--r--include/d/snd/d_snd_small_effect_mgr.h24
-rw-r--r--include/nw4r/snd/snd_SoundHandle.h4
-rw-r--r--include/nw4r/snd/snd_SoundStartable.h17
4 files changed, 41 insertions, 13 deletions
diff --git a/include/d/snd/d_snd_3d_manager.h b/include/d/snd/d_snd_3d_manager.h
index 2ac0b062..af45af62 100644
--- a/include/d/snd/d_snd_3d_manager.h
+++ b/include/d/snd/d_snd_3d_manager.h
@@ -4,7 +4,6 @@
#include "d/snd/d_snd_3d_engine.h"
#include "d/snd/d_snd_util.h"
#include "egg/gfx/eggCamera.h"
-#include "m/m_vec.h"
#include "nw4r/math/math_types.h"
#include "nw4r/snd/snd_Sound3DListener.h"
#include "nw4r/snd/snd_Sound3DManager.h"
@@ -28,11 +27,11 @@ public:
return mManager;
}
- const mVec3_c &getCameraTargetPos() const {
+ const nw4r::math::VEC3 &getCameraTargetPos() const {
return mCameraTargetPosition;
}
- const mVec3_c &getNrmCameraDirection() const {
+ const nw4r::math::VEC3 &getNrmCameraDirection() const {
return mCameraDirectionNormalized;
}
@@ -52,8 +51,8 @@ private:
/* 0x018 */ nw4r::snd::Sound3DManager mManager;
/* 0x044 */ nw4r::snd::Sound3DListener mListener;
/* 0xB0 */ EGG::LookAtCamera mCamera;
- /* 0x138 */ mVec3_c mCameraDirectionNormalized;
- /* 0x144 */ mVec3_c mCameraTargetPosition;
+ /* 0x138 */ nw4r::math::VEC3 mCameraDirectionNormalized;
+ /* 0x144 */ nw4r::math::VEC3 mCameraTargetPosition;
/* 0x150 */ f32 mCameraPosSqVelocity;
/* 0x154 */ f32 mCameraAtSqVelocity;
/* 0x158 */ f32 mCamDistance;
diff --git a/include/d/snd/d_snd_small_effect_mgr.h b/include/d/snd/d_snd_small_effect_mgr.h
index a03c2b0e..b77ec967 100644
--- a/include/d/snd/d_snd_small_effect_mgr.h
+++ b/include/d/snd/d_snd_small_effect_mgr.h
@@ -4,9 +4,9 @@
#include "d/snd/d_snd_source.h"
#include "d/snd/d_snd_util.h"
#include "d/snd/d_snd_wzsound.h" // IWYU pragma: export
+#include "nw4r/math/math_types.h"
#include "nw4r/snd/snd_SoundHandle.h"
-
SND_DISPOSER_FORWARD_DECL(dSndSmallEffectMgr_c);
/**
@@ -35,18 +35,29 @@ public:
// used for clawshots cursor, pan depends on where on the screen
// your cursor is when it activates
bool playSoundWithPan(u32 soundId, f32 pan);
- void holdSoundWithPitch(u32 soundId, f32 pitch);
- bool playSkbSound(u32 soundId);
+ bool holdSound(u32 soundId);
+ bool holdSoundWithPitch(u32 soundId, f32 pitch);
+
+ // These two do the exact same thing
+ bool playSoundAtPosition(u32 soundId, const nw4r::math::VEC3 *position);
+ bool playSoundAtPosition2(u32 soundId, const nw4r::math::VEC3 *position);
+ bool holdBowChargeSound(f32 remainingChargeAmount);
+ bool holdFinisherPromptSound(const nw4r::math::VEC3 *position);
+
+ bool playDowsingPingSound(f32 volume, f32 pitch);
+ bool holdDowsingNearestSound();
+
+ bool playSkbSound(u32 soundId);
bool playButtonPressSoundWhenAdvancingTextBoxes(f32);
void resetButtonPressSound();
void setButtonPressSound(dSoundSource_c *source);
-
- void playSound(u32 soundId, nw4r::snd::SoundHandle *handle);
bool playBattleHitSound(BattleHitSound_e type, dSoundSource_c *source);
private:
+ bool playSoundInternal(u32 soundId, nw4r::snd::SoundHandle *handle);
+ bool playSoundInternalChecked(u32 soundId, nw4r::snd::SoundHandle *handle);
bool playSoundInternal(u32 soundId);
void stopSounds(u32 playerIdx, u32 soundId, s32 fadeFrames);
void stopSounds(u32 soundId, s32 fadeFrames);
@@ -59,11 +70,12 @@ private:
* or stops a lower-priority sound if needed and possible.
*/
nw4r::snd::SoundHandle *getHoldSoundHandle(u32 soundId);
+ bool holdSound(u32 soundId, nw4r::snd::SoundHandle *handle);
/* 0x10 */ s32 field_0x10;
// used for most sounds
/* 0x14 */ nw4r::snd::SoundHandle mNormalSound;
- /* 0x18 */ nw4r::snd::SoundHandle mHandle3;
+ /* 0x18 */ nw4r::snd::SoundHandle mDowsingSoundHandle;
/* 0x1C */ nw4r::snd::SoundHandle mHoldSoundHandles[NUM_HOLD_SOUNDS];
/* 0x28 */ u32 mDelayedSoundIds[NUM_DELAYED_SOUNDS];
diff --git a/include/nw4r/snd/snd_SoundHandle.h b/include/nw4r/snd/snd_SoundHandle.h
index 2be591f3..ab6f5e71 100644
--- a/include/nw4r/snd/snd_SoundHandle.h
+++ b/include/nw4r/snd/snd_SoundHandle.h
@@ -49,9 +49,9 @@ namespace nw4r { namespace snd
mSound->SetVolume(volume, frames);
}
- void SetPitch(f32 volume) {
+ void SetPitch(f32 pitch) {
if (IsAttachedSound())
- mSound->SetPitch(volume);
+ mSound->SetPitch(pitch);
}
void Stop(int fadeFrames) {
diff --git a/include/nw4r/snd/snd_SoundStartable.h b/include/nw4r/snd/snd_SoundStartable.h
index 86d62ec6..8ac1d55b 100644
--- a/include/nw4r/snd/snd_SoundStartable.h
+++ b/include/nw4r/snd/snd_SoundStartable.h
@@ -164,6 +164,23 @@ namespace nw4r { namespace snd
return detail_PrepareSound(pHandle, id, NULL) == START_SUCCESS;
}
+ // The detail_ functions above are probably not meant to be called directly from game code,
+ // so these inlines probably exist, but I haven't found them in Ketteiban or BBA. An inline
+ // fixes a regswap in d/snd so that's more evidence. Names are obviously made up.
+ // TODO: Do these exist in other variants for different ID types too???
+
+ StartResult StartSoundReturnStatus(SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo) {
+ return detail_StartSound(pHandle, id, pStartInfo);
+ }
+
+ StartResult HoldSoundReturnStatus(SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo) {
+ return detail_HoldSound(pHandle, id, pStartInfo);
+ }
+
+ StartResult PrepareSoundReturnStatus(SoundHandle *pHandle, u32 id, const StartInfo *pStartInfo) {
+ return detail_PrepareSound(pHandle, id, pStartInfo);
+ }
+
// members
private:
/* vtable */ // size 0x04, offset 0x00