diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 56333789..1cf38579 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -2705,6 +2705,7 @@ d/snd/d_snd_anim_sound.cpp: d/snd/d_snd_source_mgr.cpp: .text start:0x80382410 end:0x803864C8 align:16 .ctors start:0x804DB91C end:0x804DB920 + .data start:0x805491E0 end:0x8054A680 .sdata start:0x80574310 end:0x805743D0 .sbss start:0x80575DA8 end:0x80575DB0 .sdata2 start:0x8057DB68 end:0x8057DBC0 @@ -2723,16 +2724,41 @@ d/snd/d_snd_source.cpp: .sbss start:0x80575DB0 end:0x80575DC0 .sdata2 start:0x8057DCB0 end:0x8057DCD0 -d/snd/d_snd_mgr_unk_7.cpp: - .text start:0x8038C410 end:0x8038EBF0 align:16 +d/snd/d_snd_source_link_body.cpp: + .text start:0x8038C410 end:0x8038D548 align:16 + .data start:0x8054AAE8 end:0x8054AFC0 + +d/snd/d_snd_source_link_head.cpp: + .text start:0x8038D550 end:0x8038DD08 align:16 + .data start:0x8054AFC0 end:0x8054B1B8 + +d/snd/d_snd_source_enemy.cpp: + .text start:0x8038DD10 end:0x8038E858 align:16 + .data start:0x8054B1B8 end:0x8054B798 + +d/snd/d_snd_source_obj.cpp: + .text start:0x8038E860 end:0x8038EBF0 align:16 .ctors start:0x804DB924 end:0x804DB928 + .data start:0x8054B798 end:0x8054BBC0 + +d/snd/d_snd_source_equipment.cpp: + .text start:0x8038EBF0 end:0x8038F2A8 align:16 + .data start:0x8054BBC0 end:0x8054BFC0 d/snd/d_snd_mgr_unk_8.cpp: - .text start:0x8038EBF0 end:0x8038FF18 align:16 + .text start:0x8038F2B0 end:0x8038FF18 align:16 .ctors start:0x804DB928 end:0x804DB92C d/snd/d_snd_mgr_unk_9.cpp: - .text start:0x8038FF20 end:0x80390A18 align:16 + .text start:0x8038FF20 end:0x80390298 align:16 + +d/snd/d_snd_source_py_bird.cpp: + .text start:0x803902A0 end:0x80390508 align:16 + .data start:0x8054C5A0 end:0x8054C7B8 + .sdata start:0x805747E8 end:0x80574800 + +d/snd/d_snd_mgr_unk_18.cpp: + .text start:0x80390510 end:0x80390A20 align:16 .ctors start:0x804DB92C end:0x804DB930 d/snd/d_snd_mgr_unk_10.cpp: diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 3b0893ca..ba74aa8b 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -20937,7 +20937,7 @@ fn_80382090 = .text:0x80382090; // type:function size:0x3C fn_803820D0 = .text:0x803820D0; // type:function size:0x40 fn_80382110 = .text:0x80382110; // type:function size:0x40 __ct__15dSndAnimSound_cFP14dSoundSource_c = .text:0x80382150; // type:function size:0x78 -setData__15dSndAnimSound_cFPCv = .text:0x803821D0; // type:function size:0x3C +setData__15dSndAnimSound_cFPCvPCc = .text:0x803821D0; // type:function size:0x3C setFrame__15dSndAnimSound_cFf = .text:0x80382210; // type:function size:0xE8 setRate__15dSndAnimSound_cFf = .text:0x80382300; // type:function size:0x28 resetFrame__15dSndAnimSound_cFf = .text:0x80382330; // type:function size:0x7C @@ -20954,10 +20954,10 @@ fn_80383620 = .text:0x80383620; // type:function size:0x94 fn_803836C0 = .text:0x803836C0; // type:function size:0x98 fn_80383760 = .text:0x80383760; // type:function size:0x58 fn_803837C0 = .text:0x803837C0; // type:function size:0x9C -fn_80383860 = .text:0x80383860; // type:function size:0x94 +__dt__21dSndSourceAnimSound_cFv = .text:0x80383860; // type:function size:0x94 fn_80383900 = .text:0x80383900; // type:function size:0x58 fn_80383960 = .text:0x80383960; // type:function size:0x9C -d_s_vt_0x180__14dSoundSource_cFv = .text:0x80383A00; // type:function size:0x8 +d_s_vt_0x180__14dSoundSource_cFUl = .text:0x80383A00; // type:function size:0x8 d_s_vt_0x1DC__14dSoundSource_cFv = .text:0x80383A10; // type:function size:0x8 d_s_vt_0x1D8__14dSoundSource_cFv = .text:0x80383A20; // type:function size:0x4 __dt__33SndMgrDisposer<15dSndSourceMgr_c>Fv = .text:0x80383A30; // type:function size:0x78 @@ -21038,7 +21038,7 @@ stopAllSound__14dSoundSource_cFl = .text:0x80385B40; // type:function size:0x8 offFlag1__14dSoundSource_cFUl = .text:0x80385B50; // type:function size:0x10 onFlag1__14dSoundSource_cFUl = .text:0x80385B60; // type:function size:0x10 setField0x102__14dSoundSource_cFUc = .text:0x80385B70; // type:function size:0x8 -d_s_vt_0x188__14dSoundSource_cFv = .text:0x80385B80; // type:function size:0x4 +postSetup__14dSoundSource_cFv = .text:0x80385B80; // type:function size:0x4 vt_0x020__14dSoundSource_cFv = .text:0x80385B90; // type:function size:0x4 setSubtype__14dSoundSource_cFUc = .text:0x80385BA0; // type:function size:0x8 isSourceType__14dSoundSource_cCFl = .text:0x80385BB0; // type:function size:0x14 @@ -21047,7 +21047,7 @@ fn_80385BF0 = .text:0x80385BF0; // type:function size:0xC fn_80385C00 = .text:0x80385C00; // type:function size:0xC fn_80385C10 = .text:0x80385C10; // type:function size:0xC fn_80385C20 = .text:0x80385C20; // type:function size:0x8 -fn_80385C30 = .text:0x80385C30; // type:function size:0x8 +hasAnimSound__18dSndSourceESpark_cFv = .text:0x80385C30; // type:function size:0x8 fn_80385C40 = .text:0x80385C40; // type:function size:0x90 fn_80385CD0 = .text:0x80385CD0; // type:function size:0x8 fn_80385CE0 = .text:0x80385CE0; // type:function size:0xDC @@ -21069,23 +21069,23 @@ fn_80385F40 = .text:0x80385F40; // type:function size:0x5C fn_80385FA0 = .text:0x80385FA0; // type:function size:0x8 fn_80385FB0 = .text:0x80385FB0; // type:function size:0x8 fn_80385FC0 = .text:0x80385FC0; // type:function size:0x4 -fn_80385FD0 = .text:0x80385FD0; // type:function size:0x8 -fn_80385FE0 = .text:0x80385FE0; // type:function size:0x8 -fn_80385FF0 = .text:0x80385FF0; // type:function size:0x5C -fn_80386050 = .text:0x80386050; // type:function size:0x8 -fn_80386060 = .text:0x80386060; // type:function size:0x8 -fn_80386070 = .text:0x80386070; // type:function size:0x4 -fn_80386080 = .text:0x80386080; // type:function size:0x58 +hasAnimSound__21dSndSourceAnimSound_cFv = .text:0x80385FD0; // type:function size:0x8 +load__21dSndSourceAnimSound_cFPvPCc = .text:0x80385FE0; // type:function size:0x8 +setFrame__21dSndSourceAnimSound_cFf = .text:0x80385FF0; // type:function size:0x5C +setRate__21dSndSourceAnimSound_cFf = .text:0x80386050; // type:function size:0x8 +getAnimSound__21dSndSourceAnimSound_cFv = .text:0x80386060; // type:function size:0x8 +SetupSound__21dSndSourceAnimSound_cFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14SoundStartable9StartInfoPv = .text:0x80386070; // type:function size:0x4 +__dt__18dSndSourceESpark_cFv = .text:0x80386080; // type:function size:0x58 fn_803860E0 = .text:0x803860E0; // type:function size:0xA0 fn_80386180 = .text:0x80386180; // type:function size:0x5C fn_803861E0 = .text:0x803861E0; // type:function size:0xA0 fn_80386280 = .text:0x80386280; // type:function size:0x58 fn_803862E0 = .text:0x803862E0; // type:function size:0x4 -fn_803862F0 = .text:0x803862F0; // type:function size:0x8 -fn_80386300 = .text:0x80386300; // type:function size:0x8 -fn_80386310 = .text:0x80386310; // type:function size:0x8 -fn_80386320 = .text:0x80386320; // type:function size:0x8 -fn_80386330 = .text:0x80386330; // type:function size:0x8 +@88@__dt__18dSndSourceESpark_cFv = .text:0x803862F0; // type:function size:0x8 +@4@__dt__18dSndSourceESpark_cFv = .text:0x80386300; // type:function size:0x8 +@88@__dt__21dSndSourceAnimSound_cFv = .text:0x80386310; // type:function size:0x8 +@4@SetupSound__21dSndSourceAnimSound_cFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14SoundStartable9StartInfoPv = .text:0x80386320; // type:function size:0x8 +@4@__dt__21dSndSourceAnimSound_cFv = .text:0x80386330; // type:function size:0x8 fn_80386340 = .text:0x80386340; // type:function size:0x8 fn_80386350 = .text:0x80386350; // type:function size:0x8 fn_80386360 = .text:0x80386360; // type:function size:0x8 @@ -21359,10 +21359,10 @@ fn_80390210 = .text:0x80390210; // type:function size:0xC fn_80390220 = .text:0x80390220; // type:function size:0x58 fn_80390280 = .text:0x80390280; // type:function size:0x8 fn_80390290 = .text:0x80390290; // type:function size:0x8 -fn_803902A0 = .text:0x803902A0; // type:function size:0x1B0 -fn_80390450 = .text:0x80390450; // type:function size:0x98 -fn_803904F0 = .text:0x803904F0; // type:function size:0x8 -fn_80390500 = .text:0x80390500; // type:function size:0x8 +load__18dSndSourcePyBird_cFPvPCc = .text:0x803902A0; // type:function size:0x1B0 +__dt__18dSndSourcePyBird_cFv = .text:0x80390450; // type:function size:0x98 scope:weak +@88@__dt__18dSndSourcePyBird_cFv = .text:0x803904F0; // type:function size:0x8 scope:weak +@4@__dt__18dSndSourcePyBird_cFv = .text:0x80390500; // type:function size:0x8 scope:weak fn_80390510 = .text:0x80390510; // type:function size:0x7C fn_80390590 = .text:0x80390590; // type:function size:0x1EC fn_80390780 = .text:0x80390780; // type:function size:0x8C @@ -21592,7 +21592,7 @@ fn_80398BB0 = .text:0x80398BB0; // type:function size:0xCC fn_80398C80 = .text:0x80398C80; // type:function size:0x68 fn_80398CF0 = .text:0x80398CF0; // type:function size:0x80 fn_80398D70 = .text:0x80398D70; // type:function size:0x64 -fn_80398DE0 = .text:0x80398DE0; // type:function size:0x18 +postSetupSound__18dSndSourcePyBird_cFUlUlP13dSndSeSound_c = .text:0x80398DE0; // type:function size:0x18 fn_80398E00 = .text:0x80398E00; // type:function size:0x8 fn_80398E10 = .text:0x80398E10; // type:function size:0x8 fn_80398E20 = .text:0x80398E20; // type:function size:0x4C @@ -38053,8 +38053,8 @@ lbl_80549AEC = .data:0x80549AEC; // type:object size:0x1EC lbl_80549CD8 = .data:0x80549CD8; // type:object size:0x1EC lbl_80549EC4 = .data:0x80549EC4; // type:object size:0x1EC lbl_8054A0B0 = .data:0x8054A0B0; // type:object size:0x1EC -lbl_8054A29C = .data:0x8054A29C; // type:object size:0x1EC -lbl_8054A488 = .data:0x8054A488; // type:object size:0x1EC +__vt__21dSndSourceAnimSound_c = .data:0x8054A29C; // type:object size:0x1EC +__vt__18dSndSourceESpark_c = .data:0x8054A488; // type:object size:0x1EC __vt__33SndMgrDisposer<15dSndSourceMgr_c> = .data:0x8054A674; // type:object size:0xC lbl_8054A680 = .data:0x8054A680; // type:object size:0x150 @14987 = .data:0x8054A7D0; // type:object size:0x9 scope:local data:string @@ -38080,8 +38080,11 @@ lbl_8054BFC0 = .data:0x8054BFC0; // type:object size:0x1F0 lbl_8054C1B0 = .data:0x8054C1B0; // type:object size:0x1F0 lbl_8054C3A0 = .data:0x8054C3A0; // type:object size:0x10 lbl_8054C3B0 = .data:0x8054C3B0; // type:object size:0x1F0 -lbl_8054C5A0 = .data:0x8054C5A0; // type:object size:0x2C -lbl_8054C5CC = .data:0x8054C5CC; // type:object size:0x1EC +@6581 = .data:0x8054C5A0; // type:object size:0xA scope:local data:string +...data.0 = .data:0x8054C5A0; // type:label scope:local +@6582 = .data:0x8054C5AC; // type:object size:0xD scope:local data:string +@6584 = .data:0x8054C5BC; // type:object size:0xE scope:local data:string +__vt__18dSndSourcePyBird_c = .data:0x8054C5CC; // type:object size:0x1EC lbl_8054C7B8 = .data:0x8054C7B8; // type:object size:0x10 lbl_8054C7C8 = .data:0x8054C7C8; // type:object size:0x1F8 lbl_8054C9C0 = .data:0x8054C9C0; // type:object size:0x10 @@ -41246,9 +41249,9 @@ lbl_805747D0 = .sdata:0x805747D0; // type:object size:0x8 lbl_805747D8 = .sdata:0x805747D8; // type:object size:0x8 lbl_805747E0 = .sdata:0x805747E0; // type:object size:0x4 lbl_805747E4 = .sdata:0x805747E4; // type:object size:0x4 -lbl_805747E8 = .sdata:0x805747E8; // type:object size:0x8 -lbl_805747F0 = .sdata:0x805747F0; // type:object size:0x8 -lbl_805747F8 = .sdata:0x805747F8; // type:object size:0x8 +@6583 = .sdata:0x805747E8; // type:object size:0x6 scope:local data:string +@6585 = .sdata:0x805747F0; // type:object size:0x7 scope:local data:string +@6586 = .sdata:0x805747F8; // type:object size:0x6 scope:local data:string lbl_80574800 = .sdata:0x80574800; // type:object size:0x8 lbl_80574808 = .sdata:0x80574808; // type:object size:0x8 lbl_80574810 = .sdata:0x80574810; // type:object size:0x8 diff --git a/configure.py b/configure.py index 2920be5b..5cd5bf31 100644 --- a/configure.py +++ b/configure.py @@ -766,9 +766,15 @@ config.libs = [ Object(NonMatching, "d/snd/d_snd_source_group.cpp"), Object(Matching, "d/snd/d_snd_source.cpp"), # sound source subclasses start - Object(NonMatching, "d/snd/d_snd_mgr_unk_7.cpp"), + Object(NonMatching, "d/snd/d_snd_source_link_body.cpp"), + Object(NonMatching, "d/snd/d_snd_source_link_head.cpp"), + Object(NonMatching, "d/snd/d_snd_source_enemy.cpp"), + Object(NonMatching, "d/snd/d_snd_source_obj.cpp"), + Object(NonMatching, "d/snd/d_snd_source_equipment.cpp"), Object(NonMatching, "d/snd/d_snd_mgr_unk_8.cpp"), Object(NonMatching, "d/snd/d_snd_mgr_unk_9.cpp"), + Object(Matching, "d/snd/d_snd_source_py_bird.cpp"), + Object(NonMatching, "d/snd/d_snd_mgr_unk_18.cpp"), Object(NonMatching, "d/snd/d_snd_mgr_unk_10.cpp"), # sound source subclasses end Object(NonMatching, "d/snd/d_snd_source_tg_sound.cpp"), diff --git a/include/d/snd/d_snd_anim_sound.h b/include/d/snd/d_snd_anim_sound.h index 8ca5ef68..a8b67632 100644 --- a/include/d/snd/d_snd_anim_sound.h +++ b/include/d/snd/d_snd_anim_sound.h @@ -8,7 +8,7 @@ class dSndAnimSound_c { public: dSndAnimSound_c(dSoundSource_c *source); - void setData(const void *data); + void setData(const void *data, const char *name); void setFrame(f32 frame); void resetFrame(f32 frame); void setRate(f32 rate); diff --git a/include/d/snd/d_snd_source.h b/include/d/snd/d_snd_source.h index 87810148..3b6c326b 100644 --- a/include/d/snd/d_snd_source.h +++ b/include/d/snd/d_snd_source.h @@ -27,6 +27,14 @@ public: bool isInaudibleInternal(); void stopAllPlaySounds(s32 fadeFrames); f32 timeAreaCheck(); + void handleRemoCon(nw4r::snd::SoundHandle *pHandle, u32 baseId); + bool startRemoConSound(u32 soundId); + nw4r::snd::SoundHandle *startSound(u32 soundId, nw4r::snd::SoundHandle *handle); + dSndDistantSoundActor_c * + startSoundAtPosition(u32 soundId, const nw4r::math::VEC3 *position, nw4r::snd::SoundHandle *handle); + nw4r::snd::SoundHandle *holdSound(u32 soundId, nw4r::snd::SoundHandle *handle); + u32 specializeBgHitSoundId(u32 baseSoundId, u32 polyAttr0, u32 polyAttr1); + // This is where it gets a bit wild and this class starts mixing in overrides between // new virtual functions, which causes the vtable to list these functions in exactly this @@ -34,9 +42,11 @@ public: /* 0x17C */ virtual const char *getName() const { return mpName; } - /* 0x180 */ virtual void d_s_vt_0x180(); + /* 0x180 */ virtual void d_s_vt_0x180(u32 arg) { + field_0x0F4 = arg; + } /* 0x184 */ virtual void preCalc(); - /* 0x188 */ virtual void d_s_vt_0x188(); + /* 0x188 */ virtual void postSetup() {} /* 0x18C */ virtual void postCalc(); /* 0x190 */ virtual bool d_s_vt_0x190() const; /* 0x194 */ virtual u32 d_s_vt_0x194(u32 soundId); @@ -69,23 +79,18 @@ public: /* 0x1D4 */ virtual dSndAnimSound_c *getAnimSound() { return nullptr; } - /* 0x1D8 */ virtual void d_s_vt_0x1D8(); - /* 0x1DC */ virtual void d_s_vt_0x1DC(); + /* 0x1D8 */ virtual void d_s_vt_0x1D8() { + return; + } + /* 0x1DC */ virtual UNKWORD d_s_vt_0x1DC() { + return 0; + } /* 0x1E0 */ virtual void onAnimSoundEvent(UNKWORD arg) { field_0x154 = arg; } /* 0x1E4 */ virtual void d_s_vt_0x1E4_noop(); /* 0x1E8 */ virtual u32 d_s_vt_0x1E8(u32 soundId); - void handleRemoCon(nw4r::snd::SoundHandle *pHandle, u32 baseId); - bool startRemoConSound(u32 soundId); - nw4r::snd::SoundHandle *startSound(u32 soundId, nw4r::snd::SoundHandle *handle); - dSndDistantSoundActor_c * - startSoundAtPosition(u32 soundId, const nw4r::math::VEC3 *position, nw4r::snd::SoundHandle *handle); - nw4r::snd::SoundHandle *holdSound(u32 soundId, nw4r::snd::SoundHandle *handle); - - u32 specializeBgHitSoundId(u32 baseSoundId, u32 polyAttr0, u32 polyAttr1); - // 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. @@ -94,13 +99,13 @@ public: return mSourceCategory; } /* 0x014 */ virtual bool isCategory(s32 category) const override { - return mSourceCategory == category; + return category == mSourceCategory; } /* 0x018 */ virtual s32 getSourceType() const override { return mSourceType; } /* 0x01C */ virtual bool isSourceType(s32 type) const override { - return mSourceType == type; + return type == mSourceType; } /* 0x020 */ virtual void vt_0x020() override {} /* 0x024 */ virtual void setSubtype(u8 subtype) override { @@ -202,6 +207,7 @@ public: protected: StartResult setupSoundCommon(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *arg); + dSndSeSound2_c *getHandleType2ForSoundId(u32 soundId); private: /** @@ -243,7 +249,6 @@ private: dSndSeSound1_c *getHandleType1ForSoundId(u32 soundId); dSndSeSound1_c *getHandleType1ForSoundHandle(nw4r::snd::SoundHandle *handle); - dSndSeSound2_c *getHandleType2ForSoundId(u32 soundId); dSndSeSound1_c *getHandleType1ForSoundHandle_Dupe(nw4r::snd::SoundHandle *pHandle); dSndSeSound2_c *getHandleType2ForSoundHandle_Dupe(nw4r::snd::SoundHandle *pHandle); diff --git a/include/d/snd/d_snd_source_anim_sound.h b/include/d/snd/d_snd_source_anim_sound.h new file mode 100644 index 00000000..20f016e5 --- /dev/null +++ b/include/d/snd/d_snd_source_anim_sound.h @@ -0,0 +1,44 @@ +#ifndef D_SND_SOURCE_ANIM_SOUND_H +#define D_SND_SOURCE_ANIM_SOUND_H + +#include "d/snd/d_snd_anim_sound.h" +#include "d/snd/d_snd_source.h" + +class dSndSourceAnimSound_c : public dSoundSource_c { +public: + dSndSourceAnimSound_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup) + : dSoundSource_c(sourceType, ac, name, pOwnerGroup), mAnimSound(this) {} + + virtual ~dSndSourceAnimSound_c() {} + + /* 0x1A8 */ virtual StartResult + SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *arg) override { + return setupSoundCommon(pHandle, soundId, pStartInfo, arg); + } + + /* 0x1D4 */ virtual dSndAnimSound_c *getAnimSound() override { + return &mAnimSound; + } + + /* 0x100 */ virtual bool hasAnimSound() override { + return true; + } + /* 0x104 */ virtual void load(void *data, const char *name) override { + mAnimSound.setData(data, name); + } + /* 0x108 */ virtual void setFrame(f32 frame) override { + if (isInaudibleInternal()) { + mAnimSound.resetFrame(frame); + } else { + mAnimSound.setFrame(frame); + } + } + /* 0x10C */ virtual void setRate(f32 frame) override { + mAnimSound.setRate(frame); + } + +protected: + /* 0x15C */ dSndAnimSound_c mAnimSound; +}; + +#endif diff --git a/include/d/snd/d_snd_source_e_spark.h b/include/d/snd/d_snd_source_e_spark.h new file mode 100644 index 00000000..f2f5255e --- /dev/null +++ b/include/d/snd/d_snd_source_e_spark.h @@ -0,0 +1,19 @@ +#ifndef D_SND_SOURCE_E_SPARK_H +#define D_SND_SOURCE_E_SPARK_H + +#include "d/snd/d_snd_source.h" + +class dSndSourceESpark_c : public dSoundSource_c { +public: + dSndSourceESpark_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup) + : dSoundSource_c(sourceType, ac, name, pOwnerGroup) {} + + virtual ~dSndSourceESpark_c() {} + + // okay + virtual bool hasAnimSound() override { + return true; + } +}; + +#endif diff --git a/include/d/snd/d_snd_source_enums.h b/include/d/snd/d_snd_source_enums.h index 16acb895..43ee9fd5 100644 --- a/include/d/snd/d_snd_source_enums.h +++ b/include/d/snd/d_snd_source_enums.h @@ -34,6 +34,7 @@ enum SoundSourceType_e { SND_SOURCE_CLEF = 38, SND_SOURCE_SHUTTER = 39, SND_SOURCE_OBJECT_40 = 40, + SND_SOURCE_LIGHT_SHAFT = 41, SND_SOURCE_OBJECT_42 = 42, // 43-52: Npc (4) diff --git a/include/d/snd/d_snd_source_py_bird.h b/include/d/snd/d_snd_source_py_bird.h new file mode 100644 index 00000000..5da1e1c8 --- /dev/null +++ b/include/d/snd/d_snd_source_py_bird.h @@ -0,0 +1,21 @@ +#ifndef D_SND_SOURCE_PY_BIRD_H +#define D_SND_SOURCE_PY_BIRD_H + +#include "d/snd/d_snd_source_anim_sound.h" + +class dSndSourcePyBird_c : public dSndSourceAnimSound_c { +public: + dSndSourcePyBird_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup) + : dSndSourceAnimSound_c(sourceType, ac, name, pOwnerGroup), mSeqVarValue(0) {} + + virtual ~dSndSourcePyBird_c() {} + + /* 0x104 */ virtual void load(void *data, const char *name) override; + + /* 0x1CC */ virtual void postSetupSound(u32 playingId, u32 requestedId, dSndSeSound_c *seSound) override; + +private: + /* 0x200 */ s32 mSeqVarValue; +}; + +#endif diff --git a/src/d/snd/d_snd_anim_sound.cpp b/src/d/snd/d_snd_anim_sound.cpp index 3353a9ee..e5983268 100644 --- a/src/d/snd/d_snd_anim_sound.cpp +++ b/src/d/snd/d_snd_anim_sound.cpp @@ -8,7 +8,7 @@ dSndAnimSound_c::dSndAnimSound_c(dSoundSource_c *source) : mSound(*source), mpData(nullptr), field_0x94(1.0f), field_0x98(INFINITY), mNeedFrameReset(false) {} -void dSndAnimSound_c::setData(const void *data) { +void dSndAnimSound_c::setData(const void *data, const char *name) { mDirection = nw4r::snd::AnimSound::FORWARD; field_0x94 = 1.0f; if (data == mpData) { diff --git a/src/d/snd/d_snd_source.cpp b/src/d/snd/d_snd_source.cpp index 585c5ca9..952387ca 100644 --- a/src/d/snd/d_snd_source.cpp +++ b/src/d/snd/d_snd_source.cpp @@ -100,7 +100,7 @@ void dSoundSource_c::setup() { } } - d_s_vt_0x188(); + postSetup(); dSndSourceMgr_c::GetInstance()->registerSource(this); s32 id = dSndStateMgr_c::GetInstance()->getStageId_0x040(); if (SND_STAGE_F000_L26 <= id && id <= SND_STAGE_F000_L27) { diff --git a/src/d/snd/d_snd_source_mgr.cpp b/src/d/snd/d_snd_source_mgr.cpp index 9b132e52..337c1c5d 100644 --- a/src/d/snd/d_snd_source_mgr.cpp +++ b/src/d/snd/d_snd_source_mgr.cpp @@ -2,7 +2,9 @@ #include "common.h" #include "d/snd/d_snd_source.h" +#include "d/snd/d_snd_source_e_spark.h" #include "d/snd/d_snd_source_enums.h" +#include "d/snd/d_snd_source_py_bird.h" #include "d/snd/d_snd_util.h" #include "nw4r/ut/ut_list.h" @@ -41,15 +43,20 @@ s32 dSndSourceMgr_c::getSourceCategoryForSourceType(s32 sourceType, const char * } switch (sourceType) { - case SND_SOURCE_58: - return SND_SOURCE_CATEGORY_7; - case SND_SOURCE_59: - return SND_SOURCE_CATEGORY_9; - default: - return -1; + case SND_SOURCE_58: return SND_SOURCE_CATEGORY_7; + case SND_SOURCE_59: return SND_SOURCE_CATEGORY_9; + default: return -1; } } +dSoundSource_c *dSndSourceMgr_c::createSource(u32 id, dAcBase_c *actor, const char *name, u8 subtype) { + // TODO + new dSndSourcePyBird_c(0, actor, name, nullptr); + new dSndSourceESpark_c(0, actor, name, nullptr); + + return nullptr; +} + SND_DISPOSER_DEFINE(dSndSourceMgr_c); dSndSourceMgr_c::dSndSourceMgr_c() @@ -165,6 +172,13 @@ void dSndSourceMgr_c::removeSourceFromList(dSoundSource_c *source, nw4r::ut::Lis } } +void dSndSourceMgr_c::onShutdownSource(dSoundSource_c *source) { + if (source == nullptr) { + return; + } + removeSourceFromList(source, &field_0x3848); +} + void dSndSourceMgr_c::clearSourceLists() { clearSourceList(&mAllSources); clearSourceList(&field_0x3848); diff --git a/src/d/snd/d_snd_source_py_bird.cpp b/src/d/snd/d_snd_source_py_bird.cpp new file mode 100644 index 00000000..40efd1ee --- /dev/null +++ b/src/d/snd/d_snd_source_py_bird.cpp @@ -0,0 +1,32 @@ +#include "d/snd/d_snd_source_py_bird.h" +#include "common.h" +#include "d/snd/d_snd_anim_sound.h" +#include "d/snd/d_snd_se_sound_2.h" +#include "d/snd/d_snd_util.h" +#include "d/snd/d_snd_wzsound.h" +#include "nw4r/snd/snd_SeqSoundHandle.h" + +void dSndSourcePyBird_c::load(void *data, const char *name) { + if (streq(name, "GlideDive")) { + mSeqVarValue = 1; + } else if (streq(name, "SwitchToDive") && mSeqVarValue != 1) { + mSeqVarValue = 1; + } else if (streq(name, "Brake")) { + mSeqVarValue = 2; + startSound(SE_PyBird_V_BRAKE, nullptr); + } else if (streq(name, "DamageTornado")) { + startSound(SE_PyBird_V_TORNADE, nullptr); + } else if (mSeqVarValue == 1) { + if (!streq(name, "Attack") && !streq(name, "Accel")) { + mSeqVarValue = 0; + } + } else { + mSeqVarValue = 0; + } + dSndSeSound2_c *glideSound = getHandleType2ForSoundId(SE_PyBird_GLIDE); + if (glideSound != nullptr && glideSound->getHandle() != nullptr) { + nw4r::snd::SeqSoundHandle handle(glideSound->getHandle()); + handle.WriteVariable(10, mSeqVarValue); + } + mAnimSound.setData(data, name); +} diff --git a/src/toBeSorted/actor_info.cpp b/src/toBeSorted/actor_info.cpp index 98e829e2..2ba088e4 100644 --- a/src/toBeSorted/actor_info.cpp +++ b/src/toBeSorted/actor_info.cpp @@ -394,12 +394,12 @@ static const ActorInfo sInfos[] = { {"LeafGut", fProfile::OBJ_FRUIT_GUTS_LEAF, fProfile::OBJ_FRUIT_GUTS_LEAF, 0xFFFF, 0xFF, 0}, {"LeafSwg", fProfile::OBJ_LEAF_SWING, fProfile::OBJ_LEAF_SWING, 0xFFFF, SND_SOURCE_OBJECT, 0}, {"Light00", fProfile::OBJ_BUILDING, fProfile::OBJ_BUILDING, 0xFFFF, 0xFF, 1}, - {"LightLi", fProfile::OBJ_LIGHT_LINE, fProfile::OBJ_LIGHT_LINE, 0xFFFF, 41, 0}, + {"LightLi", fProfile::OBJ_LIGHT_LINE, fProfile::OBJ_LIGHT_LINE, 0xFFFF, SND_SOURCE_LIGHT_SHAFT, 0}, { "Link", fProfile::PLAYER, fProfile::PLAYER, 0xFFFF, SND_SOURCE_PLAYER, 0}, { "Log", fProfile::OBJ_LOG, fProfile::OBJ_LOG, 0xFFFF, SND_SOURCE_OBJECT, 0}, { "LogWtr", fProfile::OBJ_LOG_WATER, fProfile::OBJ_LOG_WATER, 0xFFFF, SND_SOURCE_OBJECT, 0}, { "Lotus", fProfile::OBJ_LOTUS, fProfile::OBJ_LOTUS, 521, SND_SOURCE_OBJECT, 0}, - { "LtSftS", fProfile::OBJ_LIGHT_SHAFT_SMALL, fProfile::OBJ_LIGHT_SHAFT_SMALL, 0xFFFF, 41, 0}, + { "LtSftS", fProfile::OBJ_LIGHT_SHAFT_SMALL, fProfile::OBJ_LIGHT_SHAFT_SMALL, 0xFFFF, SND_SOURCE_LIGHT_SHAFT, 0}, {"LtsFlwr", fProfile::OBJ_LOTUS_FLOWER, fProfile::OBJ_LOTUS_FLOWER, 0xFFFF, SND_SOURCE_OBJECT, 0}, {"LtsSeed", fProfile::OBJ_LOTUS_SEED, fProfile::OBJ_LOTUS_SEED, 0xFFFF, SND_SOURCE_OBJECT, 0}, { "LvD201", fProfile::OBJ_LAVA_D201, fProfile::OBJ_LAVA_D201, 0xFFFF, SND_SOURCE_OBJECT, 0},