More source

This commit is contained in:
robojumper
2025-06-16 00:53:01 +02:00
parent f6e5303ea2
commit 9c673ba574
15 changed files with 294 additions and 141 deletions
+9 -10
View File
@@ -18,9 +18,8 @@ public:
return true;
}
virtual void setPosition(const nw4r::math::VEC3 &);
virtual void setPause(bool flag, int fadeFrames) = 0;
virtual void setPosition(const nw4r::math::VEC3 &); // vt 0x34
virtual void setPause(bool flag, int fadeFrames) = 0; // vt 0x38
virtual UNKWORD d_vt_0x3C() {
return 0;
@@ -34,12 +33,12 @@ public:
return 0;
}
virtual const nw4r::math::VEC3 &getPositionRelativeToPlayer();
virtual f32 getDistanceToPlayer(); // vt 0x4C
virtual void updatePositionRelativeToPlayer(); // vt 0x50
virtual void updateDistanceToPlayer(); // vt 0x54
virtual void d_vt_0x58(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) = 0;
virtual void d_vt_0x5C(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD) = 0;
virtual const nw4r::math::VEC3 &getPositionRelativeToPlayer(); // vt 0x48
virtual f32 getDistanceToPlayer(); // vt 0x4C
virtual void updatePositionRelativeToPlayer(); // vt 0x50
virtual void updateDistanceToPlayer(); // vt 0x54
virtual void postStartSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) = 0; // vt 0x58
virtual void postHoldSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD) = 0; // vt 0x5C
void resetCachedRelativePositions();
@@ -104,7 +103,7 @@ protected:
/* 0x7D */ u8 a_field_0x7D;
/* 0x7E */ bool mIsDisabled;
/* 0x7F */ u8 a_field_0x7F;
/* 0x80 */ u8 mIsPaused;
/* 0x80 */ bool mIsPaused;
/* 0x84 */ f32 a_field_0x84;
/* 0x88 */ f32 a_field_0x88;
/* 0x8C */ f32 a_field_0x8C;
+4
View File
@@ -16,6 +16,10 @@ public:
void setCallback(dSoundSource_c *source);
void setCallback(nw4r::snd::AnimSound::Callback cb, void *userData);
void shutdown() {
mSound.Shutdown();
}
private:
static void animCallback(int, s32, const char *, UNKWORD, void *userData);
+2
View File
@@ -27,6 +27,8 @@ public:
dSndBgmMgr_c();
void restoreEffects();
bool playBgm(u32 soundId, s32 fadeFrames, bool paused);
bool prepareBgm(u32 soundId, u32 startOffset);
void stopAllBgm(s32 fadeFrames);
+2 -2
View File
@@ -21,8 +21,8 @@ public:
dSndDistantSoundActor_c();
virtual void setPause(bool flag, int fadeFrames) override;
virtual UNKWORD d_vt_0x3C() override;
virtual void d_vt_0x58(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) override;
virtual void d_vt_0x5C(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD) override;
virtual void postStartSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) override;
virtual void postHoldSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD) override;
void initSource(dSoundSource_c *pSource);
void setSourceDirectly(dSoundSource_c *pSource);
+57 -39
View File
@@ -29,45 +29,49 @@ public:
virtual const char *getName() const {
return mpName;
} // 0x17C
virtual void d_s_vt_0x180();
virtual void d_s_vt_0x184();
virtual void d_s_vt_0x188();
virtual void d_s_vt_0x18C();
virtual void d_s_vt_0x190();
virtual u32 d_s_vt_0x194(u32 soundId);
virtual void d_s_vt_0x180(); // 0x180
virtual void d_s_vt_0x184(); // 0x184
virtual void d_s_vt_0x188(); // 0x188
virtual void d_s_vt_0x18C(); // 0x18C
virtual void d_s_vt_0x190(); // 0x190
virtual u32 d_s_vt_0x194(u32 soundId); // 0x194
virtual void d_vt_0x58(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) override;
virtual void postStartSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) override; // 0x198
virtual void d_s_vt_0x19C();
virtual u32 d_s_vt_0x1A0(u32 soundId, UNKWORD);
virtual void d_s_vt_0x19C(); // 0x19C
virtual u32 d_s_vt_0x1A0(u32 soundId, UNKWORD); // 0x1A0
virtual void d_vt_0x5C(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD) override;
virtual void
postHoldSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD) override; // 0x1A4
virtual StartResult
SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *) override;
SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *) override; // 0x1A8
virtual bool d_s_vt_0x1AC(u32 soundId);
virtual StartResult
setupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *arg, bool holdFlag);
virtual void attachDistantSound(dSndDistantSoundActor_c *);
virtual void detachDistantSound(dSndDistantSoundActor_c *);
virtual void detachAllDistantSounds();
virtual bool d_s_vt_0x1AC(u32 soundId); // 0x1AC
virtual StartResult setupSound(
nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *arg, bool holdFlag
); // 0x1B0
virtual void attachDistantSound(dSndDistantSoundActor_c *); // 0x1B4
virtual void detachDistantSound(dSndDistantSoundActor_c *); // 0x1B8
virtual void detachAllDistantSounds(); // 0x1BC
virtual bool hasDistantSounds() const {
return nw4r::ut::List_GetFirstConst(&mDistantSoundList) != nullptr;
}
virtual void pauseAllDistantSounds(bool flag, int fadeFrames);
virtual void d_s_vt_0x1C8();
virtual void d_s_vt_0x1CC(u32 playingId, u32 requestedId, dSndSeSound_c *seSound);
} // 0x1C0
virtual void pauseAllDistantSounds(bool flag, int fadeFrames); // 0x1C4
virtual void d_s_vt_0x1C8(); // 0x1C8
virtual void postSetupSound(u32 playingId, u32 requestedId, dSndSeSound_c *seSound);
virtual void setPause(bool flag, int fadeFrames) override;
virtual void setPause(bool flag, int fadeFrames) override; // 0x1D0
virtual void d_s_vt_0x1D4();
virtual void d_s_vt_0x1D8();
virtual void d_s_vt_0x1DC();
virtual dSndAnimSound_c *getAnimSound() {
return nullptr;
} // 0x1D4
virtual void d_s_vt_0x1D8(); // 0x1D8
virtual void d_s_vt_0x1DC(); // 0x1DC
virtual void onAnimSoundEvent(UNKWORD arg) {
field_0x154 = arg;
}
virtual void d_s_vt_0x1E4();
virtual u32 d_s_vt_0x1E8(u32 soundId);
} // 0x1E0
virtual void d_s_vt_0x1E4(); // 0x1E4
virtual u32 d_s_vt_0x1E8(u32 soundId); // 0x1E8
bool startRemoConSound(u32 soundId);
nw4r::snd::SoundHandle *startSound(u32 soundId, nw4r::snd::SoundHandle *handle);
@@ -78,6 +82,7 @@ public:
// Overrides of dSoundSourceIf_c - always in the first section of
// the vtable, so the order is not certain. May have to reorder for weak
// function order.
virtual void setup() override; // 0x00C
virtual s32 getCategory() const override {
return mSourceCategory;
} // 0x010
@@ -92,18 +97,31 @@ public:
return mSourceType == type;
} // 0x01C
virtual const nw4r::math::VEC3 &getListenerPosition() const override; // 0x028
void calc(const nw4r::math::VEC3 &) override; // 0x02C
virtual void stopAllSound(s32 fadeFrames) override {
SoundActor::StopAllSound(fadeFrames);
} // 0x040
virtual bool hasPlayingSounds() const override; // 0x048
virtual bool isPlayingSound(u32 soundId) override; // 0x04C
virtual bool isPlayingSound(const char *soundId) override; // 0x050
virtual bool startSound(u32 soundId) override; // 0x060
virtual bool startSound(const char *label) override; // 0x070
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 shutdown() override; // 0x044
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;
} // 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 bool isReadyMaybe() override {
return false;
@@ -170,13 +188,13 @@ private:
/* 0x0FC */ u8 mSourceCategory;
/* 0x0FD */ u8 mSourceType;
/* 0x0FE */ u8 field_0x0FE;
/* 0x0FF */ u8 field_0x0FF;
/* 0x0FF */ bool mIsSetup;
/* 0x100 */ u8 field_0x100;
/* 0x101 */ u8 field_0x101;
/* 0x102 */ u8 field_0x102;
/* 0x104 */ UNKWORD field_0x104;
/* 0x108 */ UNKWORD field_0x108;
/* 0x10C */ UnkSeSoundStruct *mpUnkSe;
/* 0x10C */ const UnkSeSoundStruct *mpUnkSe;
/* 0x110 */ nw4r::ut::List mDistantSoundList; // node offset 0xEC -> dSndDistantSoundActor_c
/* 0x11C */ UNKWORD field_0x11C;
/* 0x120 */ nw4r::ut::List mHandleType1List; // node offset 0x4 -> dSndSeSound_c
+33 -32
View File
@@ -2,6 +2,7 @@
#define D_SOUND_SOURCE_IF_H
#include "common.h"
#include "d/snd/d_snd_se_sound.h"
#include "nw4r/math/math_types.h"
class dAcBase_c;
@@ -12,35 +13,35 @@ public:
virtual ~dSoundSourceIf_c() {}
#define SOUNDSOURCE_VIRTUAL(offset) virtual void vt_##offset() = 0;
SOUNDSOURCE_VIRTUAL(0x0C);
virtual s32 getCategory() const = 0; // 0x10
virtual bool isCategory(s32 category) const = 0; // 0x14
virtual s32 getSourceType() const = 0; // 0x18
virtual bool isSourceType(s32 type) const = 0; // 0x1C
virtual void setup() = 0; // 0x00C
virtual s32 getCategory() const = 0; // 0x010
virtual bool isCategory(s32 category) const = 0; // 0x014
virtual s32 getSourceType() const = 0; // 0x018
virtual bool isSourceType(s32 type) const = 0; // 0x01C
SOUNDSOURCE_VIRTUAL(0x20);
SOUNDSOURCE_VIRTUAL(0x24);
virtual const nw4r::math::VEC3 &getListenerPosition() const = 0; // 0x28
SOUNDSOURCE_VIRTUAL(0x2C);
SOUNDSOURCE_VIRTUAL(0x30);
SOUNDSOURCE_VIRTUAL(0x34);
SOUNDSOURCE_VIRTUAL(0x38);
SOUNDSOURCE_VIRTUAL(0x3C);
virtual void stopAllSound(s32 fadeFrames) = 0; // 0x40
SOUNDSOURCE_VIRTUAL(0x44);
virtual bool hasPlayingSounds() const = 0; // 0x48
virtual bool isPlayingSound(u32 soundId) = 0; // 0x4C
virtual bool isPlayingSound(const char *soundId) = 0; // 0x50
SOUNDSOURCE_VIRTUAL(0x54);
SOUNDSOURCE_VIRTUAL(0x58);
SOUNDSOURCE_VIRTUAL(0x5C);
virtual bool startSound(u32 soundId) = 0; // 0x60
SOUNDSOURCE_VIRTUAL(0x64);
SOUNDSOURCE_VIRTUAL(0x68);
SOUNDSOURCE_VIRTUAL(0x6C);
virtual bool startSound(const char *label) = 0; // 0x70
SOUNDSOURCE_VIRTUAL(0x74);
SOUNDSOURCE_VIRTUAL(0x78);
SOUNDSOURCE_VIRTUAL(0x7C);
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
SOUNDSOURCE_VIRTUAL(0x80);
SOUNDSOURCE_VIRTUAL(0x84);
SOUNDSOURCE_VIRTUAL(0x88);
@@ -51,12 +52,12 @@ public:
SOUNDSOURCE_VIRTUAL(0x9C);
SOUNDSOURCE_VIRTUAL(0xA0);
virtual void stopSounds(u32 soundId, s32 fadeFrames) = 0; // 0x0A4
virtual void stopSounds(const char *label, s32 fadeFrames) = 0; // 0x0A4
virtual bool holdSound(u32 soundId) = 0; // 0xAC
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; // 0xBC
virtual bool holdSound(const char *label) = 0; // 0x0BC
SOUNDSOURCE_VIRTUAL(0xC0);
SOUNDSOURCE_VIRTUAL(0xC4);
SOUNDSOURCE_VIRTUAL(0xC8);
@@ -79,8 +80,8 @@ public:
virtual void setFrame(f32 frame) = 0; // 0x108
virtual void setRate(f32 frame) = 0; // 0x10C
virtual void setPolyAttrs(u8 polyAttr0, u8 polyAttr1) = 0; // 0x110
SOUNDSOURCE_VIRTUAL(0x114);
SOUNDSOURCE_VIRTUAL(0x118);
virtual void setBattleBgmRelated(UNKWORD) = 0; // 0x114
virtual bool checkBattleBgmRelated() = 0; // 0x118
};
#endif
+6
View File
@@ -18,14 +18,20 @@ public:
void registerSource(dSoundSource_c *source);
void unregisterSource(dSoundSource_c *source);
void onShutdownSource(dSoundSource_c *source);
void playFlowSound(u32 id);
static s32 getSourceCategoryForSourceType(s32 sourceType, const char *name);
static bool isSwOrEOc(const char *name);
static dSoundSource_c *getBoomerangSource() {
return GetInstance()->mpBoomerangSource;
}
u8 getField_0x0013() const {
return field_0x0013;
}
void stopAllSound();
void stopAllNonPlayerSound();
+5
View File
@@ -33,9 +33,14 @@ public:
void setup(EGG::Heap *pHeap);
void onStageOrLayerUpdate();
void restoreEffects();
static bool isInStage(const char *stageName);
s32 getStageId_0x040() const {
return mStageId;
}
s32 getStageId_0x044() const {
return field_0x044;
}
+1
View File
@@ -3,6 +3,7 @@
// Forward declarations for d/snd to break circular header dependencies
class dSndAnimSound_c;
class dSoundSource_c;
class dSndSourceGroup_c;
class dSndDistantSoundActor_c;