diff options
| author | robojumper <robojumper@gmail.com> | 2025-07-10 18:20:07 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-09-13 11:07:49 +0200 |
| commit | 84538b4ce0719859926a6ac9a25f84d38bb0b117 (patch) | |
| tree | eb47a72395f343fc24571e017da1be5047555d30 /include | |
| parent | 6cc8ca8ebd3f4ea9bea6f8c1dc227aaa131aadba (diff) | |
A few more of the event functions
Diffstat (limited to 'include')
| -rw-r--r-- | include/d/d_camera.h | 2 | ||||
| -rw-r--r-- | include/d/snd/d_snd_area_sound_effect_mgr.h | 9 | ||||
| -rw-r--r-- | include/d/snd/d_snd_checkers.h | 24 | ||||
| -rw-r--r-- | include/d/snd/d_snd_event.h | 4 | ||||
| -rw-r--r-- | include/d/snd/d_snd_state_mgr.h | 53 | ||||
| -rw-r--r-- | include/toBeSorted/music_mgrs.h | 1 |
6 files changed, 74 insertions, 19 deletions
diff --git a/include/d/d_camera.h b/include/d/d_camera.h index f57fb520..6ad2ef47 100644 --- a/include/d/d_camera.h +++ b/include/d/d_camera.h @@ -33,6 +33,8 @@ public: mScreenShakeIntensity = val; } + bool isUnderwater() const; + private: /* 0x068 */ u8 _0x068[0x6C - 0x068]; /* 0x06C */ mVec3_c mPositionMaybe; diff --git a/include/d/snd/d_snd_area_sound_effect_mgr.h b/include/d/snd/d_snd_area_sound_effect_mgr.h index 2e450743..69696810 100644 --- a/include/d/snd/d_snd_area_sound_effect_mgr.h +++ b/include/d/snd/d_snd_area_sound_effect_mgr.h @@ -5,6 +5,7 @@ #include "d/snd/d_snd_actor.h" #include "d/snd/d_snd_area_sound.h" #include "d/snd/d_snd_util.h" +#include "nw4r/snd/snd_SoundHandle.h" SND_DISPOSER_FORWARD_DECL(dSndAreaSoundEffectMgr_c); @@ -25,19 +26,23 @@ public: void stopSounds(s32 fadeFrames); void pauseAllSounds(); + bool holdInWaterLvSound(f32 depth); void onEventStart(); void onEventEnd(); private: + void calcPlayerVolume(); + void calcActorVolume(); bool isPlayingAnySound() const; bool isPlayingSound(u32 soundId) const; + void setTgSoundVolume(f32 volume, s32 fadeFrames); /* 0x010 */ dSndAreaSound_c mSounds[3]; - /* 0x328 */ UNKWORD field_0x328; + /* 0x328 */ nw4r::snd::SoundHandle mInWaterLvHandle; /* 0x32C */ f32 field_0x32C; /* 0x330 */ f32 field_0x330; /* 0x334 */ dSndActor_c mActor; - /* 0x388 */ f32 field_0x388; + /* 0x388 */ f32 mTargetVolume; }; #endif diff --git a/include/d/snd/d_snd_checkers.h b/include/d/snd/d_snd_checkers.h index 880d65e3..22a56097 100644 --- a/include/d/snd/d_snd_checkers.h +++ b/include/d/snd/d_snd_checkers.h @@ -9,7 +9,15 @@ class SoundPropertiesChecker { public: // @bug forgot to initialize mCounter4. see `dSndSourceEquipment_c::cbPcHit` for one consequence - SoundPropertiesChecker(u32 soundId) : mSoundId(soundId), mPlayCounter(0), mPauseCounter(0), mCounter3(0), mpPlayCounter(nullptr), mpPauseCounter(nullptr), mpCounter3(nullptr), mpCounter4(nullptr) {} + SoundPropertiesChecker(u32 soundId) + : mSoundId(soundId), + mPlayCounter(0), + mPauseCounter(0), + mCounter3(0), + mpPlayCounter(nullptr), + mpPauseCounter(nullptr), + mpCounter3(nullptr), + mpCounter4(nullptr) {} virtual void operator()(nw4r::snd::SoundHandle &pHandle) { if (mSoundId != -1 && mSoundId != pHandle.GetId()) { return; @@ -125,4 +133,18 @@ public: private: }; +class SoundVolumeSetter { +public: + SoundVolumeSetter() {} + ~SoundVolumeSetter() {} + + virtual void operator()(nw4r::snd::SoundHandle &pHandle) { + pHandle.SetVolume(mVolume, mFadeFrames); + } + +public: + /* 0x04 */ f32 mVolume; + /* 0x08 */ s32 mFadeFrames; +}; + #endif diff --git a/include/d/snd/d_snd_event.h b/include/d/snd/d_snd_event.h index 2c394869..5f3ad071 100644 --- a/include/d/snd/d_snd_event.h +++ b/include/d/snd/d_snd_event.h @@ -5,6 +5,7 @@ typedef void (*SndEventCallback)(void); typedef void (*SndEventFinalizeCallback)(bool skipped); +typedef void (*SndEventMsgWaitCallback)(u32 msgWaitSelectCounter); struct SndEventDef { /* 0x00 */ const char *eventName; @@ -12,7 +13,8 @@ struct SndEventDef { /* 0x08 */ SndEventCallback initializeCb; /* 0x0C */ SndEventCallback executeCb; /* 0x10 */ SndEventFinalizeCallback finalizeCb; - /* 0x14 */ u8 _0x14[0x1C - 0x14]; // always zero + /* 0x14 */ SndEventMsgWaitCallback msgWaitStartCb; // always null + /* 0x18 */ SndEventMsgWaitCallback msgWaitEndCb; // always null }; enum SndEvent_e { diff --git a/include/d/snd/d_snd_state_mgr.h b/include/d/snd/d_snd_state_mgr.h index a164d78c..75d279ed 100644 --- a/include/d/snd/d_snd_state_mgr.h +++ b/include/d/snd/d_snd_state_mgr.h @@ -73,8 +73,8 @@ public: return field_0x058; } - u32 getField_0x11C() const { - return field_0x11C; + u32 getFrameCounter() const { + return mFrameCounter; } f32 getField_0x49C() const { @@ -87,6 +87,10 @@ public: bool checkFlag0x18(u32 mask); + bool checkFlag0x258(u32 mask) const { + return field_0x258 & mask; + } + bool checkFlag0x10(u32 mask) const { return field_0x010 & mask; } @@ -122,14 +126,16 @@ public: // not sure, subtype is unused bool isActiveDemoMaybe(s32 subtype) const; bool isInEvent(const char *eventName); - bool isInEvent() const; + bool isInEvent(); bool onSkipEvent() const; - void doMsgStart(s32 idx); - void doMsgEnd(); + void onMsgStart(s32 idx); + void onMsgEnd(); - void doMsgWaitStart(); - void doMsgWaitEnd(); + void onMsgWaitStart(); + void onMsgWaitEnd(); + + f32 getUserParamVolume(u32 userParam); // TODO better names static const char *getStageName(s32 id); @@ -154,6 +160,18 @@ public: u32 getSoundIdForStageAndLayer(SoundIdLookup_e lookup, const char *stageName, s32 layer, s32 stageId); + void setFiltersIfUnderwater(); + void setBgmLpfAndFxSendIfUnderwater(); + void resetLpfAndFxSend(); + void resetBgmLpfAndFxSend(); + void setBgmAndStageEffectLpf(); + void setBgmLpf(); + void setBgmLpf(s32 fadeFrames); + void resetBgmAndStageEffectLpf(); + void resetBgmLpf(); + + void onCameraCut(s32 cutIdx); + private: void resetOverrides(); void initializeEventCallbacks(const char *name); @@ -167,6 +185,13 @@ private: u32 getBgmLabelSoundId(); bool playFanOrBgm(u32 soundId); + void doBgm(const char *label); + void doSe(const char *label); + void doCmd(const char *label); + + void doLabelSuffix(const char *suffix); + u32 getSeCameraId(); + void handleFan(); void handleSe(); void handleCmd(); @@ -221,14 +246,14 @@ private: /* 0x084 */ UNKWORD field_0x084; /* 0x088 */ UNKWORD field_0x088; /* 0x08C */ s32 mSoundEventId; - /* 0x090 */ UNKWORD field_0x090; + /* 0x090 */ s32 mCameraCutCounter; /* 0x094 */ u32 mEventFlags; /* 0x098 */ SizedString<64> mEventName; /* 0x0D8 */ SizedString<64> mPrevEventName; /* 0x118 */ const char *field_0x118; - /* 0x11C */ u32 field_0x11C; - /* 0x120 */ UNKWORD field_0x120; - /* 0x124 */ UNKWORD field_0x124; + /* 0x11C */ u32 mFrameCounter; + /* 0x120 */ u32 mCameraCutFrameCounter; + /* 0x124 */ u32 mMsgFrameCounter; /* 0x128 */ u32 mSeLvSoundId; /* 0x12C */ SizedString<64> mSeName; /* 0x16C */ SizedString<64> mBgmName; @@ -243,10 +268,10 @@ private: /* 0x240 */ UNKWORD field_0x240; /* 0x244 */ UNKWORD field_0x244; /* 0x248 */ UNKWORD field_0x248; - /* 0x24C */ UNKWORD field_0x24C; - /* 0x250 */ UNKWORD field_0x250; + /* 0x24C */ s32 mMsgCounter; + /* 0x250 */ s32 mMsgWaitSelectCounter; /* 0x254 */ u8 field_0x254; - /* 0x258 */ UNKWORD field_0x258; + /* 0x258 */ u32 field_0x258; /* 0x25C */ nw4r::snd::FxReverbStdDpl2 mFx; /* 0x48C */ UNKWORD field_0x48C; /* 0x490 */ f32 field_0x490; diff --git a/include/toBeSorted/music_mgrs.h b/include/toBeSorted/music_mgrs.h index ef62b8b2..d0a9ca56 100644 --- a/include/toBeSorted/music_mgrs.h +++ b/include/toBeSorted/music_mgrs.h @@ -24,6 +24,5 @@ extern "C" void fn_80362730(dSndStateMgr_c *); extern "C" void fn_80365D20(dSndStateMgr_c *); extern "C" void fn_803624F0(dSndStateMgr_c *); extern "C" void fn_80365020(dSndStateMgr_c *); -extern "C" void fn_80364D00(dSndStateMgr_c *, s32); #endif |
