More sound effects and splits

This commit is contained in:
robojumper
2025-06-15 18:16:26 +02:00
parent 7d333a8d8e
commit 6cb7f3bfdc
14 changed files with 227 additions and 46 deletions
+4 -5
View File
@@ -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;
+18 -6
View File
@@ -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];
+2 -2
View File
@@ -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) {
+17
View File
@@ -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