More source

This commit is contained in:
robojumper
2025-06-17 00:13:47 +02:00
parent 454a4eb6c7
commit 741935bc61
10 changed files with 268 additions and 132 deletions
+10 -2
View File
@@ -52,10 +52,18 @@ public:
// not sure if this combination makes sense
void resetHandle() {
field_0x0F4 = 0;
mpHoldSoundHandle = nullptr;
mpSoundHandle = &mSoundHandle;
}
dSndSeSound2_c *getHoldSoundHandle() const {
return mpHoldSoundHandle;
}
void setHoldSoundHandle(dSndSeSound2_c *handle) {
mpHoldSoundHandle = handle;
}
bool isActive() const {
return mIsActive;
}
@@ -73,7 +81,7 @@ public:
private:
/* 0x0E4 */ nw4r::ut::Node mPoolLink; // sound actor pool link
/* 0x0EC */ nw4r::ut::Node mSourceLink; // sound source link
/* 0x0F4 */ UNKWORD field_0x0F4;
/* 0x0F4 */ dSndSeSound2_c *mpHoldSoundHandle;
/* 0x0F8 */ dSoundSource_c *mpSoundSource;
/* 0x0FC */ nw4r::snd::SoundHandle mSoundHandle;
/* 0x100 */ nw4r::snd::SoundHandle *mpSoundHandle;
+25 -16
View File
@@ -8,23 +8,32 @@
#include "nw4r/ut/ut_list.h"
/**
* This seems to be a generic way of passing parameters from callers of dSoundSource_c
* startSound/holdSound to the callbacks that sound sources will register
* on those handlers. E.g. at 80397a40 the chandelier swing hold sound will
* occasionally create additional sounds based on historical params (swinging angle) passed
* to holdSound by the chandelier (see dAcOChandelier_c::executeState_Wait / 80ebc814 in Ghidra)
* In yet other cases the callback itself will keep pushing new values and the caller doesn't
* do anything, e.g. caller at 80228814 for SE_L_ROPE_WIND_LV does not push values, but
* handler at 80394fb0 will keep pushing values.
* Examples:
* * Chandelier hold sound. Game code (dAcOChandelier_c::executeState_Wait) will
* push the current swing angle, callback (80397a40) will play additional sounds
* when chandelier swing speed exceeds certain values.
* * SE_L_ROPE_WIND_LV: callback (80228814) will read and write values to create a feedback
* loop for certain parameters.
*/
struct UnkSeSoundStruct {
UnkSeSoundStruct() : field_0x00(0), field_0x04(0.0f) {}
~UnkSeSoundStruct() {}
struct dSndSoundCtxParam {
dSndSoundCtxParam() : intParam(0), floatParam(0.0f) {}
~dSndSoundCtxParam() {}
/* 0x00 */ UNKWORD field_0x00;
/* 0x04 */ f32 field_0x04;
/* 0x00 */ s32 intParam;
/* 0x04 */ f32 floatParam;
};
/**
* A sound effect handle. Typically acquired by sound sources from a pool.
* This allows sound sources to play sounds with no pre-determined limit
* on the number of sounds. It also allows the source to handle the statefulness
* of holdSound without requiring users to manage handles.
*
* Additionally, some sound sources will register callbacks to customize
* sound parameters (pitch, volume, ...). These callbacks can additionally
* write and read context parameters (see above). The game will shift these
* parameters with each call, so a lot of this is obviously frame-rate dependent.
*/
class dSndSeSound_c {
public:
dSndSeSound_c();
@@ -45,8 +54,8 @@ public:
void clear();
// not sure what this does
void shiftPair(const UnkSeSoundStruct *p);
void shiftValue(f32 value);
void shiftParam(const dSndSoundCtxParam *p);
void shiftFloatParam(f32 value);
typedef void Callback(dSndSeSound_c *sound, dSoundSource_c *source, nw4r::snd::SoundHandle &handle);
@@ -106,7 +115,7 @@ protected:
/* 0x10C */ Type_e mHandleType;
/* 0x110 */ u32 mSoundId;
/* 0x114 */ s32 field_0x114;
/* 0x118 */ UnkSeSoundStruct *mpUnk;
/* 0x118 */ dSndSoundCtxParam *mpUnk;
/* 0x11C */ u8 field_0x11C;
/* 0x11D */ u8 field_0x11D;
/* 0x11E */ u8 field_0x11E;
+28 -20
View File
@@ -30,10 +30,10 @@ public:
return mpName;
} // 0x17C
virtual void d_s_vt_0x180(); // 0x180
virtual void d_s_vt_0x184(); // 0x184
virtual void preCalc(); // 0x184
virtual void d_s_vt_0x188(); // 0x188
virtual void d_s_vt_0x18C(); // 0x18C
virtual void d_s_vt_0x190(); // 0x190
virtual void postCalc(); // 0x18C
virtual bool d_s_vt_0x190(); // 0x190
virtual u32 d_s_vt_0x194(u32 soundId); // 0x194
virtual void postStartSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) override; // 0x198
@@ -105,23 +105,31 @@ public:
virtual bool hasPlayingSounds() const override; // 0x048
virtual bool isPlayingSound(u32 soundId) override; // 0x04C
virtual bool isPlayingSound(const char *soundId) override; // 0x050
virtual void setUnkSe(const UnkSeSoundStruct *arg) override {
mpUnkSe = arg;
virtual void setCtxParam(const dSndSoundCtxParam *arg) override {
mpCtxParam = arg;
} // 0x054
virtual void setUnkSeFloat(f32 value) override; // 0x058
virtual void setUnkSeWord(UNKWORD value) override; // 0x05C
virtual bool startSound(u32 soundId) override; // 0x060
virtual bool startSoundWithUnkSeWord(u32 soundId, UNKWORD value) override; // 0x064
virtual bool startSoundWithUnkSeFloat(u32 soundId, f32 value) override; // 0x068
virtual bool startSoundWithUnkSe(u32 soundId, f32 fValue, UNKWORD value) override; // 0x06C
virtual bool startSound(const char *label) override; // 0x070
virtual bool startSoundWithUnkSeWord(const char *label, UNKWORD value) override; // 0x074
virtual bool startSoundWithUnkSeFloat(const char *label, f32 value) override; // 0x078
virtual bool startSoundWithUnkSe(const char *label, f32 fValue, UNKWORD value) override; // 0x07C
virtual void stopSounds(u32 soundId, s32 fadeFrames) override; // 0x0A4
virtual void stopSounds(const char *label, s32 fadeFrames) override; // 0x0A8
virtual bool holdSound(u32 soundId) override; // 0x0AC
virtual bool holdSound(const char *label) override; // 0x0BC
virtual void setCtxFloat(f32 value) override; // 0x058
virtual void setCtxInt(s32 value) override; // 0x05C
virtual bool startSound(u32 soundId) override; // 0x060
virtual bool startSoundWithIntParam(u32 soundId, s32 value) override; // 0x064
virtual bool startSoundWithFloatParam(u32 soundId, f32 value) override; // 0x068
virtual bool startSoundWithParams(u32 soundId, f32 fValue, s32 value) override; // 0x06C
virtual bool startSound(const char *label) override; // 0x070
virtual bool startSoundWithIntParam(const char *label, s32 value) override; // 0x074
virtual bool startSoundWithFloatParam(const char *label, f32 value) override; // 0x078
virtual bool startSoundWithParams(const char *label, f32 fValue, s32 value) override; // 0x07C
virtual void stopSounds(u32 soundId, s32 fadeFrames) override; // 0x0A4
virtual void stopSounds(const char *label, s32 fadeFrames) override; // 0x0A8
virtual bool holdSound(u32 soundId) override; // 0x0AC
virtual bool holdSoundWithIntParam(u32 soundId, s32 value) override; // 0x0B0
virtual bool holdSoundWithFloatParam(u32 soundId, f32 value) override; // 0x0B4
virtual bool holdSoundWithParams(u32 soundId, f32 fValue, s32 value) override; // 0x0B8
virtual bool holdSound(const char *label) override; // 0x0BC
virtual bool holdSoundWithIntParam(const char *label, s32 value) override; // 0x0C0
virtual bool holdSoundWithFloatParam(const char *label, f32 value) override; // 0x0C4
virtual bool holdSoundWithParams(const char *label, f32 fValue, s32 value) override; // 0x0C8
virtual bool holdSoundAtPosition(u32 soundId, const nw4r::math::VEC3 *position) override; // 0x0CC
virtual bool holdSoundAtPosition(const char *label, const nw4r::math::VEC3 *position) override; // 0x0D0
virtual bool isReadyMaybe() override {
return false;
@@ -194,7 +202,7 @@ private:
/* 0x102 */ u8 field_0x102;
/* 0x104 */ UNKWORD field_0x104;
/* 0x108 */ UNKWORD field_0x108;
/* 0x10C */ const UnkSeSoundStruct *mpUnkSe;
/* 0x10C */ const dSndSoundCtxParam *mpCtxParam;
/* 0x110 */ nw4r::ut::List mDistantSoundList; // node offset 0xEC -> dSndDistantSoundActor_c
/* 0x11C */ UNKWORD field_0x11C;
/* 0x120 */ nw4r::ut::List mHandleType1List; // node offset 0x4 -> dSndSeSound_c
+34 -34
View File
@@ -20,28 +20,28 @@ public:
virtual bool isSourceType(s32 type) const = 0; // 0x01C
SOUNDSOURCE_VIRTUAL(0x20);
SOUNDSOURCE_VIRTUAL(0x24);
virtual const nw4r::math::VEC3 &getListenerPosition() const = 0; // 0x028
virtual void calc(const nw4r::math::VEC3 &) = 0; // 0x02C
virtual void onFlag1(u32 mask) = 0; // 0x030
virtual void offFlag1(u32 mask) = 0; // 0x034
virtual bool checkFlag(u32 mask) const = 0; // 0x038
virtual void onFlag2(u32 mask) = 0; // 0x03C
virtual void stopAllSound(s32 fadeFrames) = 0; // 0x040
virtual void shutdown() = 0; // 0x044
virtual bool hasPlayingSounds() const = 0; // 0x048
virtual bool isPlayingSound(u32 soundId) = 0; // 0x04C
virtual bool isPlayingSound(const char *soundId) = 0; // 0x050
virtual void setUnkSe(const UnkSeSoundStruct *) = 0; // 0x054
virtual void setUnkSeFloat(f32 value) = 0; // 0x058
virtual void setUnkSeWord(UNKWORD value) = 0; // 0x05C
virtual bool startSound(u32 soundId) = 0; // 0x060
virtual bool startSoundWithUnkSeWord(u32 soundId, UNKWORD value) = 0; // 0x064
virtual bool startSoundWithUnkSeFloat(u32 soundId, f32 value) = 0; // 0x068
virtual bool startSoundWithUnkSe(u32 soundId, f32 fValue, UNKWORD value) = 0; // 0x06C
virtual bool startSound(const char *label) = 0; // 0x070
virtual bool startSoundWithUnkSeWord(const char *label, UNKWORD value) = 0; // 0x074
virtual bool startSoundWithUnkSeFloat(const char *label, f32 value) = 0; // 0x078
virtual bool startSoundWithUnkSe(const char *label, f32 fValue, UNKWORD value) = 0; // 0x07C
virtual const nw4r::math::VEC3 &getListenerPosition() const = 0; // 0x028
virtual void calc(const nw4r::math::VEC3 &) = 0; // 0x02C
virtual void onFlag1(u32 mask) = 0; // 0x030
virtual void offFlag1(u32 mask) = 0; // 0x034
virtual bool checkFlag(u32 mask) const = 0; // 0x038
virtual void onFlag2(u32 mask) = 0; // 0x03C
virtual void stopAllSound(s32 fadeFrames) = 0; // 0x040
virtual void shutdown() = 0; // 0x044
virtual bool hasPlayingSounds() const = 0; // 0x048
virtual bool isPlayingSound(u32 soundId) = 0; // 0x04C
virtual bool isPlayingSound(const char *soundId) = 0; // 0x050
virtual void setCtxParam(const dSndSoundCtxParam *) = 0; // 0x054
virtual void setCtxFloat(f32 value) = 0; // 0x058
virtual void setCtxInt(s32 value) = 0; // 0x05C
virtual bool startSound(u32 soundId) = 0; // 0x060
virtual bool startSoundWithIntParam(u32 soundId, s32 value) = 0; // 0x064
virtual bool startSoundWithFloatParam(u32 soundId, f32 value) = 0; // 0x068
virtual bool startSoundWithParams(u32 soundId, f32 fValue, s32 value) = 0; // 0x06C
virtual bool startSound(const char *label) = 0; // 0x070
virtual bool startSoundWithIntParam(const char *label, s32 value) = 0; // 0x074
virtual bool startSoundWithFloatParam(const char *label, f32 value) = 0; // 0x078
virtual bool startSoundWithParams(const char *label, f32 fValue, s32 value) = 0; // 0x07C
SOUNDSOURCE_VIRTUAL(0x80);
SOUNDSOURCE_VIRTUAL(0x84);
SOUNDSOURCE_VIRTUAL(0x88);
@@ -51,18 +51,18 @@ public:
SOUNDSOURCE_VIRTUAL(0x98);
SOUNDSOURCE_VIRTUAL(0x9C);
SOUNDSOURCE_VIRTUAL(0xA0);
virtual void stopSounds(u32 soundId, s32 fadeFrames) = 0; // 0x0A4
virtual void stopSounds(const char *label, s32 fadeFrames) = 0; // 0x0A8
virtual bool holdSound(u32 soundId) = 0; // 0x0AC
SOUNDSOURCE_VIRTUAL(0xB0);
SOUNDSOURCE_VIRTUAL(0xB4);
SOUNDSOURCE_VIRTUAL(0xB8);
virtual bool holdSound(const char *label) = 0; // 0x0BC
SOUNDSOURCE_VIRTUAL(0xC0);
SOUNDSOURCE_VIRTUAL(0xC4);
SOUNDSOURCE_VIRTUAL(0xC8);
SOUNDSOURCE_VIRTUAL(0xCC);
SOUNDSOURCE_VIRTUAL(0xD0);
virtual void stopSounds(u32 soundId, s32 fadeFrames) = 0; // 0x0A4
virtual void stopSounds(const char *label, s32 fadeFrames) = 0; // 0x0A8
virtual bool holdSound(u32 soundId) = 0; // 0x0AC
virtual bool holdSoundWithIntParam(u32 soundId, s32 value) = 0; // 0x0B0
virtual bool holdSoundWithFloatParam(u32 soundId, f32 value) = 0; // 0x0B4
virtual bool holdSoundWithParams(u32 soundId, f32 fValue, s32 value) = 0; // 0x0B8
virtual bool holdSound(const char *label) = 0; // 0x0BC
virtual bool holdSoundWithIntParam(const char *label, s32 value) = 0; // 0x0C0
virtual bool holdSoundWithFloatParam(const char *label, f32 value) = 0; // 0x0C4
virtual bool holdSoundWithParams(const char *label, f32 fValue, s32 value) = 0; // 0x0C8
virtual bool holdSoundAtPosition(u32 soundId, const nw4r::math::VEC3 *position) = 0; // 0x0CC
virtual bool holdSoundAtPosition(const char *label, const nw4r::math::VEC3 *position) = 0; // 0x0D0
SOUNDSOURCE_VIRTUAL(0xD4);
SOUNDSOURCE_VIRTUAL(0xD8);
SOUNDSOURCE_VIRTUAL(0xDC);
+4
View File
@@ -28,6 +28,10 @@ public:
return GetInstance()->mpBoomerangSource;
}
u8 getField_0x0012() const {
return field_0x0012;
}
u8 getField_0x0013() const {
return field_0x0013;
}
+1 -1
View File
@@ -10,7 +10,7 @@ class dSndDistantSoundActor_c;
class dSndSound_c;
class UnkSeSoundStruct;
class dSndSoundCtxParam;
class dSndSeSound_c;
class dSndSeSound1_c;