From 9c673ba5746fe88ff063abb44a536f04f5775236 Mon Sep 17 00:00:00 2001 From: robojumper Date: Mon, 16 Jun 2025 00:53:01 +0200 Subject: [PATCH] More source --- config/SOUE01/splits.txt | 1 + config/SOUE01/symbols.txt | 46 +++---- include/d/snd/d_snd_3d_actor.h | 19 ++- include/d/snd/d_snd_anim_sound.h | 4 + include/d/snd/d_snd_bgm_mgr.h | 2 + include/d/snd/d_snd_distant_sound_actor.h | 4 +- include/d/snd/d_snd_source.h | 96 ++++++++------ include/d/snd/d_snd_source_if.h | 65 +++++----- include/d/snd/d_snd_source_mgr.h | 6 + include/d/snd/d_snd_state_mgr.h | 5 + include/d/snd/d_snd_types.h | 1 + src/d/snd/d_snd_3d_actor.cpp | 18 ++- src/d/snd/d_snd_distant_sound_actor.cpp | 12 +- src/d/snd/d_snd_mgr.cpp | 5 +- src/d/snd/d_snd_source.cpp | 151 ++++++++++++++++++---- 15 files changed, 294 insertions(+), 141 deletions(-) diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index dd05ec91..867717db 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -2720,6 +2720,7 @@ d/snd/d_snd_source.cpp: .ctors start:0x804DB920 end:0x804DB924 .data start:0x8054A7D0 end:0x8054AAE8 .sdata start:0x80574708 end:0x80574718 + .sbss start:0x80575DB0 end:0x80575DC0 .sdata2 start:0x8057DCB0 end:0x8057DCD0 d/snd/d_snd_mgr_unk_7.cpp: diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 3e7a3786..dee9eb4f 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -20138,7 +20138,7 @@ fn_80365980 = .text:0x80365980; // type:function size:0x54 resetBgmAndStageEffectLpfFreq = .text:0x803659E0; // type:function size:0x4C resetBgmLpfFreq = .text:0x80365A30; // type:function size:0x48 fn_80365A80 = .text:0x80365A80; // type:function size:0x4C -fn_80365AD0 = .text:0x80365AD0; // type:function size:0xA8 +restoreEffects__14dSndStateMgr_cFv = .text:0x80365AD0; // type:function size:0xA8 fn_80365B80 = .text:0x80365B80; // type:function size:0x5C fn_80365BE0 = .text:0x80365BE0; // type:function size:0x70 fn_80365C50 = .text:0x80365C50; // type:function size:0xC8 @@ -20417,7 +20417,7 @@ fn_8036CD10 = .text:0x8036CD10; // type:function size:0x34 fn_8036CD50 = .text:0x8036CD50; // type:function size:0x88 fn_8036CDE0 = .text:0x8036CDE0; // type:function size:0xFC fn_8036CEE0 = .text:0x8036CEE0; // type:function size:0x12C -fn_8036D010 = .text:0x8036D010; // type:function size:0x98 +restoreEffects__12dSndBgmMgr_cFv = .text:0x8036D010; // type:function size:0x98 fn_8036D0B0 = .text:0x8036D0B0; // type:function size:0x11C fn_8036D1D0 = .text:0x8036D1D0; // type:function size:0x208 playBgm__12dSndBgmMgr_cFUllb = .text:0x8036D3E0; // type:function size:0x170 @@ -20947,7 +20947,7 @@ setCallback__15dSndAnimSound_cFP14dSoundSource_c = .text:0x803823E0; // type:fun setCallback__15dSndAnimSound_cFPFilPCciPv_vPv = .text:0x80382400; // type:function size:0xC fn_80382410 = .text:0x80382410; // type:function size:0xC0 fn_803824D0 = .text:0x803824D0; // type:function size:0x24 -fn_80382500 = .text:0x80382500; // type:function size:0x90 +isSwOrEOc__15dSndSourceMgr_cFPCc = .text:0x80382500; // type:function size:0x90 getSourceCategoryForSourceType__15dSndSourceMgr_cFlPCc = .text:0x80382590; // type:function size:0xB0 soundForActorInitRelated_80382640 = .text:0x80382640; // type:function size:0xFD8 fn_80383620 = .text:0x80383620; // type:function size:0x94 @@ -20991,7 +20991,7 @@ isCertainEnemyType__15dSndSourceMgr_cFP14dSoundSource_c = .text:0x80384D10; // t fn_80384D90 = .text:0x80384D90; // type:function size:0x98 unregisterSource__15dSndSourceMgr_cFP14dSoundSource_c = .text:0x80384E30; // type:function size:0xBC removeSourceFromList__15dSndSourceMgr_cFP14dSoundSource_cPQ34nw4r2ut4List = .text:0x80384EF0; // type:function size:0xAC -fn_80384FA0 = .text:0x80384FA0; // type:function size:0x14 +onShutdownSource__15dSndSourceMgr_cFP14dSoundSource_c = .text:0x80384FA0; // type:function size:0x14 clearSourceLists__15dSndSourceMgr_cFv = .text:0x80384FC0; // type:function size:0x50 fn_80385010 = .text:0x80385010; // type:function size:0x60 fn_80385070 = .text:0x80385070; // type:function size:0x18 @@ -21019,13 +21019,13 @@ playFlowSound__15dSndSourceMgr_cFUl = .text:0x803858D0; // type:function size:0x fn_80385970 = .text:0x80385970; // type:function size:0x90 vt_0x118__14dSoundSource_cFv = .text:0x80385A00; // type:function size:0x8 vt_0x114__14dSoundSource_cFv = .text:0x80385A10; // type:function size:0x4 -d_s_vt_0x1D4__14dSoundSource_cFv = .text:0x80385A20; // type:function size:0x8 +getAnimSound__14dSoundSource_cFv = .text:0x80385A20; // type:function size:0x8 setRate__14dSoundSource_cFf = .text:0x80385A30; // type:function size:0x4 setFrame__14dSoundSource_cFf = .text:0x80385A40; // type:function size:0x4 load__14dSoundSource_cFPvPCc = .text:0x80385A50; // type:function size:0x4 isReadyMaybe__14dSoundSource_cFv = .text:0x80385A60; // type:function size:0x8 vt_0xF0__14dSoundSource_cFv = .text:0x80385A70; // type:function size:0x4 -d_s_vt_0x1CC__14dSoundSource_cFv = .text:0x80385A80; // type:function size:0x4 +postSetupSound__14dSoundSource_cFv = .text:0x80385A80; // type:function size:0x4 hasDistantSounds__14dSoundSource_cCFv = .text:0x80385A90; // type:function size:0x34 vt_0xE8__14dSoundSource_cFv = .text:0x80385AD0; // type:function size:0x8 vt_0xEC__14dSoundSource_cFv = .text:0x80385AE0; // type:function size:0x8 @@ -21107,8 +21107,8 @@ fn_80386440 = .text:0x80386440; // type:function size:0x8 fn_80386460 = .text:0x80386460; // type:function size:0x8 fn_80386470 = .text:0x80386470; // type:function size:0x8 @4@SetupSound__14dSoundSource_cFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14SoundStartable9StartInfoPv = .text:0x80386480; // type:function size:0x8 -@4@d_vt_0x5C__14dSoundSource_cFv = .text:0x80386490; // type:function size:0x8 -@4@d_vt_0x58__14dSoundSource_cFv = .text:0x803864A0; // type:function size:0x8 +@4@postHoldSound__14dSoundSource_cFv = .text:0x80386490; // type:function size:0x8 +@4@postStartSound__14dSoundSource_cFv = .text:0x803864A0; // type:function size:0x8 fn_803864B0 = .text:0x803864B0; // type:function size:0x8 fn_803864C0 = .text:0x803864C0; // type:function size:0x8 set__17dSndSourceGroup_cFlPCc = .text:0x803864D0; // type:function size:0x164 @@ -21132,11 +21132,11 @@ setParamFromName__17dSndSourceGroup_cFPCc = .text:0x80386F70; // type:function s soundForActorInitRelated_803889c0 = .text:0x803889C0; // type:function size:0x4 __ct__14dSoundSource_cFUcP9dAcBase_cPCcP17dSndSourceGroup_c = .text:0x803889D0; // type:function size:0x108 __dt__14dSoundSource_cFv = .text:0x80388AE0; // type:function size:0xC4 -vt_0x0C__14dSoundSource_cFv = .text:0x80388BB0; // type:function size:0x118 -vt_0x44__14dSoundSource_cFv = .text:0x80388CD0; // type:function size:0x9C +setup__14dSoundSource_cFv = .text:0x80388BB0; // type:function size:0x118 +shutdown__14dSoundSource_cFv = .text:0x80388CD0; // type:function size:0x9C fn_80388D70 = .text:0x80388D70; // type:function size:0x80 getListenerPosition__14dSoundSource_cCFv = .text:0x80388DF0; // type:function size:0xC -vt_0x2C__14dSoundSource_cFv = .text:0x80388E00; // type:function size:0x88 +calc__14dSoundSource_cFRCQ34nw4r4math4VEC3 = .text:0x80388E00; // type:function size:0x88 d_s_vt_0x184__14dSoundSource_cFv = .text:0x80388E90; // type:function size:0x84 d_s_vt_0x18C__14dSoundSource_cFv = .text:0x80388F20; // type:function size:0x4 hasPlayingSounds__14dSoundSource_cCFv = .text:0x80388F30; // type:function size:0x8 @@ -21145,19 +21145,19 @@ isPlayingSound__14dSoundSource_cFPCc = .text:0x80388F50; // type:function size:0 initVolumeFade__14dSoundSource_cFv = .text:0x80388FA0; // type:function size:0x14 setVolumeFade__14dSoundSource_cFfUl = .text:0x80388FC0; // type:function size:0x84 calcVolumeFade__14dSoundSource_cFv = .text:0x80389050; // type:function size:0x68 -vt_0x5C__14dSoundSource_cFv = .text:0x803890C0; // type:function size:0x18 -vt_0x58__14dSoundSource_cFv = .text:0x803890E0; // type:function size:0x1C +setUnkSeWord__14dSoundSource_cFi = .text:0x803890C0; // type:function size:0x18 +setUnkSeFloat__14dSoundSource_cFf = .text:0x803890E0; // type:function size:0x1C isInaudible__14dSoundSource_cFv = .text:0x80389100; // type:function size:0x60 d_s_vt_0x190__14dSoundSource_cFv = .text:0x80389160; // type:function size:0x40 setPause__14dSoundSource_cFbi = .text:0x803891A0; // type:function size:0xB0 startSound__14dSoundSource_cFUl = .text:0x80389250; // type:function size:0x30 startSound__14dSoundSource_cFPCc = .text:0x80389280; // type:function size:0x48 -vt_0x64__14dSoundSource_cFv = .text:0x803892D0; // type:function size:0x64 -vt_0x74__14dSoundSource_cFv = .text:0x80389340; // type:function size:0x58 -vt_0x68__14dSoundSource_cFv = .text:0x803893A0; // type:function size:0x60 -vt_0x78__14dSoundSource_cFv = .text:0x80389400; // type:function size:0x58 -vt_0x6C__14dSoundSource_cFv = .text:0x80389460; // type:function size:0x88 -vt_0x7C__14dSoundSource_cFv = .text:0x803894F0; // type:function size:0x68 +startSoundWithUnkSeWord__14dSoundSource_cFUli = .text:0x803892D0; // type:function size:0x64 +startSoundWithUnkSeWord__14dSoundSource_cFPCci = .text:0x80389340; // type:function size:0x58 +startSoundWithUnkSeFloat__14dSoundSource_cFUlf = .text:0x803893A0; // type:function size:0x60 +startSoundWithUnkSeFloat__14dSoundSource_cFPCcf = .text:0x80389400; // type:function size:0x58 +startSoundWithUnkSe__14dSoundSource_cFUlfi = .text:0x80389460; // type:function size:0x88 +startSoundWithUnkSe__14dSoundSource_cFPCcfi = .text:0x803894F0; // type:function size:0x68 vt_0xA0__14dSoundSource_cFv = .text:0x80389560; // type:function size:0x94 startRemoConSound__14dSoundSource_cFUl = .text:0x80389600; // type:function size:0x74 startSound__14dSoundSource_cFUlPQ34nw4r3snd11SoundHandle = .text:0x80389680; // type:function size:0x40 @@ -21198,9 +21198,9 @@ startBaseSoundAtPosition__14dSoundSource_cFUlPCQ34nw4r4math4VEC3f = .text:0x8038 d_s_vt_0x1C8__14dSoundSource_cFv = .text:0x8038B320; // type:function size:0x24 onSetupError__14dSoundSource_cFv = .text:0x8038B350; // type:function size:0x30 d_s_vt_0x194__14dSoundSource_cFv = .text:0x8038B380; // type:function size:0x8 -d_vt_0x58__14dSoundSource_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUl = .text:0x8038B390; // type:function size:0x4 +postStartSound__14dSoundSource_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUl = .text:0x8038B390; // type:function size:0x4 d_s_vt_0x1A0__14dSoundSource_cFv = .text:0x8038B3A0; // type:function size:0x8 -d_vt_0x5C__14dSoundSource_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUli = .text:0x8038B3B0; // type:function size:0x4 +postHoldSound__14dSoundSource_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUli = .text:0x8038B3B0; // type:function size:0x4 attachDistantSound__14dSoundSource_cFP23dSndDistantSoundActor_c = .text:0x8038B3C0; // type:function size:0x54 detachDistantSound__14dSoundSource_cFP23dSndDistantSoundActor_c = .text:0x8038B420; // type:function size:0x60 detachAllDistantSounds__14dSoundSource_cFv = .text:0x8038B480; // type:function size:0x74 @@ -21465,8 +21465,8 @@ getSourceParam__27dSndDistantSoundActorPool_cFv = .text:0x80393E80; // type:func initSource__23dSndDistantSoundActor_cFP14dSoundSource_c = .text:0x80393E90; // type:function size:0x54 setSourceDirectly__23dSndDistantSoundActor_cFP14dSoundSource_c = .text:0x80393EF0; // type:function size:0x18 updatePosition__23dSndDistantSoundActor_cFv = .text:0x80393F10; // type:function size:0x28 -d_vt_0x58__23dSndDistantSoundActor_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUl = .text:0x80393F40; // type:function size:0x20 -d_vt_0x5C__23dSndDistantSoundActor_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUli = .text:0x80393F60; // type:function size:0x20 +postStartSound__23dSndDistantSoundActor_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUl = .text:0x80393F40; // type:function size:0x20 +postHoldSound__23dSndDistantSoundActor_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUli = .text:0x80393F60; // type:function size:0x20 startSound__23dSndDistantSoundActor_cFUlRCQ34nw4r4math4VEC3PQ34nw4r3snd11SoundHandle = .text:0x80393F80; // type:function size:0x98 holdSound__23dSndDistantSoundActor_cFUlRCQ34nw4r4math4VEC3PQ34nw4r3snd11SoundHandle = .text:0x80394020; // type:function size:0x90 loadDefaultParam__23dSndDistantSoundActor_cFv = .text:0x803940B0; // type:function size:0x38 diff --git a/include/d/snd/d_snd_3d_actor.h b/include/d/snd/d_snd_3d_actor.h index c744a35d..74277832 100644 --- a/include/d/snd/d_snd_3d_actor.h +++ b/include/d/snd/d_snd_3d_actor.h @@ -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; diff --git a/include/d/snd/d_snd_anim_sound.h b/include/d/snd/d_snd_anim_sound.h index c54a49e9..8ca5ef68 100644 --- a/include/d/snd/d_snd_anim_sound.h +++ b/include/d/snd/d_snd_anim_sound.h @@ -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); diff --git a/include/d/snd/d_snd_bgm_mgr.h b/include/d/snd/d_snd_bgm_mgr.h index ce6d1619..be58bb4a 100644 --- a/include/d/snd/d_snd_bgm_mgr.h +++ b/include/d/snd/d_snd_bgm_mgr.h @@ -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); diff --git a/include/d/snd/d_snd_distant_sound_actor.h b/include/d/snd/d_snd_distant_sound_actor.h index 79070fd8..017e928c 100644 --- a/include/d/snd/d_snd_distant_sound_actor.h +++ b/include/d/snd/d_snd_distant_sound_actor.h @@ -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); diff --git a/include/d/snd/d_snd_source.h b/include/d/snd/d_snd_source.h index 68429f14..baf86487 100644 --- a/include/d/snd/d_snd_source.h +++ b/include/d/snd/d_snd_source.h @@ -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 diff --git a/include/d/snd/d_snd_source_if.h b/include/d/snd/d_snd_source_if.h index 9e6812d8..6bf20d09 100644 --- a/include/d/snd/d_snd_source_if.h +++ b/include/d/snd/d_snd_source_if.h @@ -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 diff --git a/include/d/snd/d_snd_source_mgr.h b/include/d/snd/d_snd_source_mgr.h index fa890401..b11fa616 100644 --- a/include/d/snd/d_snd_source_mgr.h +++ b/include/d/snd/d_snd_source_mgr.h @@ -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(); diff --git a/include/d/snd/d_snd_state_mgr.h b/include/d/snd/d_snd_state_mgr.h index bb068732..e5983e07 100644 --- a/include/d/snd/d_snd_state_mgr.h +++ b/include/d/snd/d_snd_state_mgr.h @@ -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; } diff --git a/include/d/snd/d_snd_types.h b/include/d/snd/d_snd_types.h index c9da0d2b..e09bc7fa 100644 --- a/include/d/snd/d_snd_types.h +++ b/include/d/snd/d_snd_types.h @@ -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; diff --git a/src/d/snd/d_snd_3d_actor.cpp b/src/d/snd/d_snd_3d_actor.cpp index 4c56b746..0e7ad410 100644 --- a/src/d/snd/d_snd_3d_actor.cpp +++ b/src/d/snd/d_snd_3d_actor.cpp @@ -12,12 +12,13 @@ dSnd3DActor_c::dSnd3DActor_c(dSndSourceParam *pSourceParam, u8 sourceType) : nw4r::snd::Sound3DActor( - dSndPlayerMgr_c::GetInstance()->getSoundArchivePlayerForType(sourceType), dSnd3DManager_c::GetInstance()->getManager() + dSndPlayerMgr_c::GetInstance()->getSoundArchivePlayerForType(sourceType), + dSnd3DManager_c::GetInstance()->getManager() ), a_field_0x7D(0), mIsDisabled(false), a_field_0x7F(0), - mIsPaused(0), + mIsPaused(false), a_field_0x84(0.0f), a_field_0x88(0.0f), a_field_0x8C(0.0f), @@ -64,6 +65,10 @@ void dSnd3DActor_c::resetCachedRelativePositions() { mPositionTransformedByListener.z = INFINITY; } +void dSnd3DActor_c::setSourceParam(const dSndSourceParam *param) { + *mpSourceParam = *param; +} + void dSnd3DActor_c::calculatePositionRelativeToListener() { nw4r::math::VEC3Sub( &mPositionRelativeToListener, &GetPosition(), &dSnd3DManager_c::GetInstance()->getSndListenerPos() @@ -173,3 +178,12 @@ bool dSnd3DActor_c::isPlayingSound(u32 id) { return result; } + +const char *dSnd3DActor_c::soundIdToSoundLabel(u32 soundId) const { + // TODO + return nullptr; +} + +u32 dSnd3DActor_c::soundLabelToSoundId(const char *soundLabel) const { + return dSndPlayerMgr_c::GetInstance()->convertLabelStringToSoundId(soundLabel); +} diff --git a/src/d/snd/d_snd_distant_sound_actor.cpp b/src/d/snd/d_snd_distant_sound_actor.cpp index 2a8196a2..49724be7 100644 --- a/src/d/snd/d_snd_distant_sound_actor.cpp +++ b/src/d/snd/d_snd_distant_sound_actor.cpp @@ -39,15 +39,15 @@ void dSndDistantSoundActor_c::updatePosition() { } } -void dSndDistantSoundActor_c::d_vt_0x58(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) { +void dSndDistantSoundActor_c::postStartSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) { if (mpSoundSource != nullptr) { - mpSoundSource->d_vt_0x58(handle, pSound, id); + mpSoundSource->postStartSound(handle, pSound, id); } } -void dSndDistantSoundActor_c::d_vt_0x5C(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD arg) { +void dSndDistantSoundActor_c::postHoldSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD arg) { if (mpSoundSource != nullptr) { - mpSoundSource->d_vt_0x5C(handle, pSound, id, arg); + mpSoundSource->postHoldSound(handle, pSound, id, arg); } } @@ -101,10 +101,10 @@ void dSndDistantSoundActor_c::detachFromSource() { void dSndDistantSoundActor_c::setPause(bool flag, int fadeFrames) { if (mIsPaused && !flag) { PauseAllSound(flag, fadeFrames); - mIsPaused = 0; + mIsPaused = false; } else if (!mIsPaused && flag) { PauseAllSound(flag, fadeFrames); - mIsPaused = 1; + mIsPaused = true; } } diff --git a/src/d/snd/d_snd_mgr.cpp b/src/d/snd/d_snd_mgr.cpp index 4ef341a0..29d7df5c 100644 --- a/src/d/snd/d_snd_mgr.cpp +++ b/src/d/snd/d_snd_mgr.cpp @@ -54,4 +54,7 @@ void dSndMgr_c::calc() { } } -void dSndMgr_c::restoreEffectsCallback() {} +void dSndMgr_c::restoreEffectsCallback() { + dSndStateMgr_c::GetInstance()->restoreEffects(); + dSndBgmMgr_c::GetInstance()->restoreEffects(); +} diff --git a/src/d/snd/d_snd_source.cpp b/src/d/snd/d_snd_source.cpp index 184635e8..731eac06 100644 --- a/src/d/snd/d_snd_source.cpp +++ b/src/d/snd/d_snd_source.cpp @@ -4,14 +4,19 @@ #include "d/a/d_a_base.h" #include "d/snd/d_snd_3d_actor.h" #include "d/snd/d_snd_3d_manager.h" +#include "d/snd/d_snd_anim_sound.h" #include "d/snd/d_snd_checkers.h" #include "d/snd/d_snd_distant_sound_actor.h" #include "d/snd/d_snd_distant_sound_actor_pool.h" #include "d/snd/d_snd_mgr.h" #include "d/snd/d_snd_player_mgr.h" +#include "d/snd/d_snd_se_sound.h" #include "d/snd/d_snd_se_sound_pool.h" +#include "d/snd/d_snd_source_enums.h" #include "d/snd/d_snd_source_group.h" #include "d/snd/d_snd_source_mgr.h" +#include "d/snd/d_snd_stage_data.h" +#include "d/snd/d_snd_state_mgr.h" #include "egg/audio/eggAudioRmtSpeakerMgr.h" #include "nw4r/snd/snd_SoundHandle.h" #include "nw4r/snd/snd_SoundStartable.h" @@ -19,14 +24,8 @@ #include "nw4r/ut/ut_list.h" #include "sized_string.h" -struct d_snd_mgr_unk_6_sinit { - d_snd_mgr_unk_6_sinit() : field_0x00(0), field_0x04(0.0f) {} - - u32 field_0x00; - f32 field_0x04; -}; - -d_snd_mgr_unk_6_sinit d_snd_mgr_unk_6_sinit_instance; +static UnkSeSoundStruct sSeStruct; +bool dSoundSource_c::sIsStartingBaseSound; const char *help_i_need_data() { return "%s_%s_%d"; @@ -39,7 +38,7 @@ dSoundSource_c::dSoundSource_c(u8 sourceType, dAcBase_c *actor, const char *name mpActor(actor), mSourceType(sourceType), field_0x0FE(0), - field_0x0FF(0), + mIsSetup(false), field_0x100(0), field_0x101(0), field_0x102(0), @@ -61,17 +60,76 @@ dSoundSource_c::dSoundSource_c(u8 sourceType, dAcBase_c *actor, const char *name dSoundSource_c::~dSoundSource_c() { SetUserParam(0); - vt_0x44(); + shutdown(); removeAllSeHandles(); detachAllDistantSounds(); dSndSourceMgr_c::GetInstance()->unregisterSource(this); mpOwnerGroup->unregisterSource(this); } +void dSoundSource_c::setup() { + if (mIsSetup) { + return; + } + SetPosition(mpActor->position); + resetCachedRelativePositions(); + initVolumeFade(); + if (mSourceCategory == SND_SOURCE_CATEGORY_PLAYER) { + mPositionRelativeToPlayer.x = 0.0f; + mPositionRelativeToPlayer.y = 0.0f; + mPositionRelativeToPlayer.z = 0.0f; + } + mIsPaused = false; + field_0x102 = 0; + switch (mSourceCategory) { + case SND_SOURCE_CATEGORY_ENEMY: + case SND_SOURCE_CATEGORY_OBJECT: + case SND_SOURCE_CATEGORY_NPC: + case SND_SOURCE_CATEGORY_TG_SOUND: + case SND_SOURCE_CATEGORY_6: + if (dSndSourceMgr_c::GetInstance()->getField_0x0013() != 0 && mSourceType != SND_SOURCE_SHUTTER) { + field_0x101 = 1; + } else { + field_0x101 = 0; + } + } + + d_s_vt_0x188(); + dSndSourceMgr_c::GetInstance()->registerSource(this); + s32 id = dSndStateMgr_c::GetInstance()->getStageId_0x040(); + if (SND_STAGE_F000_L26 <= id && id <= SND_STAGE_F000_L27) { + setVolumeFade(0.0f, 0); + } + field_0x100 = dSndSourceMgr_c::isSwOrEOc(mpName); + mIsSetup = true; +} + +void dSoundSource_c::shutdown() { + if (!mIsDisabled) { + if (getAnimSound() != nullptr) { + getAnimSound()->shutdown(); + } + if (mIsPaused) { + stopAllSound(1); + } + dSndSourceMgr_c::GetInstance()->onShutdownSource(this); + mIsDisabled = true; + } +} + const nw4r::math::VEC3 &dSoundSource_c::getListenerPosition() const { return dSnd3DManager_c::GetInstance()->getSndListenerPos(); } +void dSoundSource_c::calc(const nw4r::math::VEC3 &pos) { + d_s_vt_0x184(); + setPosition(pos); + calcHandles(); + calcVolumeFade(); + d_s_vt_0x18C(); + field_0x108 = 0; +} + bool dSoundSource_c::hasPlayingSounds() const { return dSnd3DActor_c::hasPlayingSounds(); } @@ -134,6 +192,16 @@ void dSoundSource_c::calcVolumeFade() { SoundActor::SetVolume(nextVolume); } +void dSoundSource_c::setUnkSeWord(UNKWORD value) { + sSeStruct.field_0x00 = value; + setUnkSe(&sSeStruct); +} + +void dSoundSource_c::setUnkSeFloat(f32 value) { + sSeStruct.field_0x04 = value; + setUnkSe(&sSeStruct); +} + bool dSoundSource_c::isInaudible() { if (field_0x102 != 0) { return true; @@ -146,11 +214,11 @@ void dSoundSource_c::setPause(bool flag, int fadeFrames) { if (!flag) { PauseAllSound(flag, fadeFrames); pauseAllDistantSounds(flag, fadeFrames); - mIsPaused = 0; + mIsPaused = false; } else if (!mIsDisabled) { PauseAllSound(flag, fadeFrames); pauseAllDistantSounds(flag, fadeFrames); - mIsPaused = 1; + mIsPaused = true; } } @@ -162,6 +230,37 @@ bool dSoundSource_c::startSound(const char *label) { return startSound(soundLabelToSoundId(label)); } +bool dSoundSource_c::startSoundWithUnkSeWord(u32 soundId, UNKWORD value) { + setUnkSeWord(value); + return startSound(soundId, nullptr) != nullptr; +} + +bool dSoundSource_c::startSoundWithUnkSeWord(const char *label, UNKWORD value) { + u32 soundId = soundLabelToSoundId(label); + return startSoundWithUnkSeWord(soundId, value); +} + +bool dSoundSource_c::startSoundWithUnkSeFloat(u32 soundId, f32 value) { + setUnkSeFloat(value); + return startSound(soundId, nullptr) != nullptr; +} + +bool dSoundSource_c::startSoundWithUnkSeFloat(const char *label, f32 value) { + u32 soundId = soundLabelToSoundId(label); + return startSoundWithUnkSeFloat(soundId, value); +} + +bool dSoundSource_c::startSoundWithUnkSe(u32 soundId, f32 fValue, UNKWORD value) { + setUnkSeWord(value); + setUnkSeFloat(fValue); + return startSound(soundId, nullptr) != nullptr; +} + +bool dSoundSource_c::startSoundWithUnkSe(const char *label, f32 fValue, UNKWORD value) { + u32 soundId = soundLabelToSoundId(label); + return startSoundWithUnkSe(soundId, fValue, value); +} + bool dSoundSource_c::startRemoConSound(u32 soundId) { nw4r::snd::SoundHandle *outHandle = nullptr; StartResult result = startSound(soundId, nullptr, &outHandle); @@ -201,8 +300,8 @@ dSoundSource_c::startSound(u32 soundId, nw4r::snd::SoundHandle *handle, nw4r::sn result = StartSoundReturnStatus(handle, soundId, nullptr); if (result == START_SUCCESS) { addSeHandleType1(seHandle); - d_vt_0x58(*handle, seHandle, soundId); - d_s_vt_0x1CC(handle->GetId(), soundId, seHandle); + postStartSound(*handle, seHandle, soundId); + postSetupSound(handle->GetId(), soundId, seHandle); seHandle->onStart(this); seHandle->onCalc(this); } else { @@ -250,8 +349,8 @@ dSoundSource_c::startSoundAtPosition(u32 soundId, const nw4r::math::VEC3 *positi if (ac->startSound(soundId, *position, handle)) { addSeHandleType1(seHandle); seHandle->setInUseMaybe(true); - ac->d_vt_0x58(*handle, seHandle, soundId); - d_s_vt_0x1CC(handle->GetId(), soundId, seHandle); + ac->postStartSound(*handle, seHandle, soundId); + postSetupSound(handle->GetId(), soundId, seHandle); seHandle->onStart(this); seHandle->onCalc(this); } else { @@ -307,8 +406,8 @@ nw4r::snd::SoundHandle *dSoundSource_c::holdSound(u32 soundId, nw4r::snd::SoundH field_0x11C |= 0x80000000; if (HoldSound(handle, soundId)) { addSeHandleType2(seHandle); - d_vt_0x5C(*handle, seHandle, soundId, 0); - d_s_vt_0x1CC(handle->GetId(), soundId, seHandle); + postHoldSound(*handle, seHandle, soundId, 0); + postSetupSound(handle->GetId(), soundId, seHandle); seHandle->onStart(this); seHandle->onCalc(this); } else { @@ -358,7 +457,7 @@ nw4r::snd::SoundHandle *dSoundSource_c::continueHoldingSound( field_0x154 = 0; if (ok) { seHandle->setField0x130(1); - d_vt_0x5C(*handle, seHandle, soundId, 0); + postHoldSound(*handle, seHandle, soundId, 0); } else { handle = nullptr; } @@ -490,11 +589,11 @@ nw4r::snd::SoundStartable::StartResult dSoundSource_c::onSetupError() { return START_ERR_USER; } -void dSoundSource_c::d_vt_0x58(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) { +void dSoundSource_c::postStartSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) { // noop } -void dSoundSource_c::d_vt_0x5C(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD) { +void dSoundSource_c::postHoldSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD) { // noop } @@ -666,11 +765,6 @@ dSndSeSound2_c *dSoundSource_c::getHandleType2ForSoundId(u32 soundId) { return nullptr; } -void dSoundSource_c::setPolyAttrs(u8 polyAttr0, u8 polyAttr1) { - mPolyAttr0 = polyAttr0; - mPolyAttr1 = polyAttr1; -} - void dSoundSource_c::stopSoundHandles(u32 soundId, s32 fadeFrames) { // TODO: Weird declaration order required for regswaps { @@ -700,6 +794,11 @@ void dSoundSource_c::stopSoundHandles(u32 soundId, s32 fadeFrames) { } } +void dSoundSource_c::setPolyAttrs(u8 polyAttr0, u8 polyAttr1) { + mPolyAttr0 = polyAttr0; + mPolyAttr1 = polyAttr1; +} + u32 dSoundSource_c::modifySoundId(u32 baseSoundId) { if (baseSoundId != -1) { SizedString<64> label;