summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2025-07-10 14:15:45 +0200
committerrobojumper <robojumper@gmail.com>2025-09-13 11:07:49 +0200
commit6cc8ca8ebd3f4ea9bea6f8c1dc227aaa131aadba (patch)
treec5eb78f36a0ae82723bb93d4d56b00c3c4be4d60 /include
parenta617b9f8cf8a6c3688f1034b2db641c9a092900c (diff)
A bit more
Diffstat (limited to 'include')
-rw-r--r--include/d/snd/d_snd_area_sound_effect_mgr.h3
-rw-r--r--include/d/snd/d_snd_bgm_mgr.h11
-rw-r--r--include/d/snd/d_snd_checkers.h17
-rw-r--r--include/d/snd/d_snd_event.h3
-rw-r--r--include/d/snd/d_snd_source_mgr.h2
-rw-r--r--include/d/snd/d_snd_state_mgr.h46
-rw-r--r--include/nw4r/snd/snd_SoundHandle.h5
-rw-r--r--include/toBeSorted/event_manager.h4
-rw-r--r--include/toBeSorted/music_mgrs.h1
9 files changed, 78 insertions, 14 deletions
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 3cda1f9b..2e450743 100644
--- a/include/d/snd/d_snd_area_sound_effect_mgr.h
+++ b/include/d/snd/d_snd_area_sound_effect_mgr.h
@@ -25,6 +25,9 @@ public:
void stopSounds(s32 fadeFrames);
void pauseAllSounds();
+ void onEventStart();
+ void onEventEnd();
+
private:
bool isPlayingAnySound() const;
bool isPlayingSound(u32 soundId) const;
diff --git a/include/d/snd/d_snd_bgm_mgr.h b/include/d/snd/d_snd_bgm_mgr.h
index aa8654fa..3500283c 100644
--- a/include/d/snd/d_snd_bgm_mgr.h
+++ b/include/d/snd/d_snd_bgm_mgr.h
@@ -37,6 +37,11 @@ public:
void pauseAllBgm();
void stopAllBgm(s32 fadeFrames);
+ void setBgmToPlayOnEventEnd(u32 soundId);
+ bool onEventEnd();
+ void onEventStart(const char *eventName, s32 soundEventId, s32 unk);
+ void prepareBgm();
+
dSndBgmSound_c *getSoundHandleForBgm(u32 soundId, u32 startOffset);
bool isPlayingBgmSound() const;
bool isPlayingBgmSoundId(u32 soundId) const;
@@ -93,6 +98,10 @@ public:
return getActiveBgmSound();
}
+ void setField_0x306(u8 val) {
+ field_0x306 = val;
+ }
+
private:
dSndBgmBattleSound_c *getBgmBattleSound();
@@ -144,7 +153,7 @@ private:
/* 0x29C */ UNKWORD field_0x29C;
/* 0x2A0 */ dSndActor_c mSoundActor;
/* 0x2F4 */ f32 field_0x2F4;
- /* 0x2F8 */ s32 field_0x2F8;
+ /* 0x2F8 */ u32 mBgmToPlayOnEventEnd;
/* 0x2FC */ u8 field_0x2FC;
/* 0x300 */ s32 field_0x300;
/* 0x304 */ u8 field_0x304;
diff --git a/include/d/snd/d_snd_checkers.h b/include/d/snd/d_snd_checkers.h
index e6bff0de..880d65e3 100644
--- a/include/d/snd/d_snd_checkers.h
+++ b/include/d/snd/d_snd_checkers.h
@@ -3,6 +3,7 @@
#include "common.h"
#include "d/snd/d_snd_bgm_mgr.h"
+#include "d/snd/d_snd_player_mgr.h"
#include "nw4r/snd/snd_SoundHandle.h"
class SoundPropertiesChecker {
@@ -108,4 +109,20 @@ private:
/* 0x08 */ s32 mFadeFrames;
};
+class SoundStopperIfParamFlag20 {
+public:
+ SoundStopperIfParamFlag20() {}
+
+ virtual void operator()(nw4r::snd::SoundHandle &pHandle) {
+ u32 id = pHandle.GetId();
+ u32 param = dSndPlayerMgr_c::GetInstance()->getDemoArchive()->GetSoundUserParam(id);
+ if ((param & 0x100000) != 0) {
+ u32 fadeFrames = param & 0xFF;
+ pHandle.Stop(fadeFrames);
+ }
+ }
+
+private:
+};
+
#endif
diff --git a/include/d/snd/d_snd_event.h b/include/d/snd/d_snd_event.h
index dafff2d9..2c394869 100644
--- a/include/d/snd/d_snd_event.h
+++ b/include/d/snd/d_snd_event.h
@@ -4,13 +4,14 @@
#include "common.h"
typedef void (*SndEventCallback)(void);
+typedef void (*SndEventFinalizeCallback)(bool skipped);
struct SndEventDef {
/* 0x00 */ const char *eventName;
/* 0x04 */ s32 eventId;
/* 0x08 */ SndEventCallback initializeCb;
/* 0x0C */ SndEventCallback executeCb;
- /* 0x10 */ SndEventCallback finalizeCb;
+ /* 0x10 */ SndEventFinalizeCallback finalizeCb;
/* 0x14 */ u8 _0x14[0x1C - 0x14]; // always zero
};
diff --git a/include/d/snd/d_snd_source_mgr.h b/include/d/snd/d_snd_source_mgr.h
index e1eb6a28..19f22d85 100644
--- a/include/d/snd/d_snd_source_mgr.h
+++ b/include/d/snd/d_snd_source_mgr.h
@@ -63,6 +63,8 @@ public:
}
void setMutedFromFader(bool muteFlag);
+ void onEventStart();
+ void onEventEnd();
private:
void calcEnemyObjVolume();
diff --git a/include/d/snd/d_snd_state_mgr.h b/include/d/snd/d_snd_state_mgr.h
index 13c3b1df..a164d78c 100644
--- a/include/d/snd/d_snd_state_mgr.h
+++ b/include/d/snd/d_snd_state_mgr.h
@@ -5,6 +5,7 @@
#include "d/snd/d_snd_event.h"
#include "d/snd/d_snd_util.h"
#include "nw4r/snd/snd_FxReverbStdDpl2.h"
+#include "nw4r/snd/snd_SoundHandle.h"
#include "sized_string.h"
SND_DISPOSER_FORWARD_DECL(dSndStateMgr_c);
@@ -15,6 +16,8 @@ public:
SND_DISPOSER_MEMBERS(dSndStateMgr_c);
public:
+ typedef void (*OnEventStartCallback)(s32 soundEventId, u32 flags);
+
enum StageFlags_e {
STAGE_FIELD = 0x1,
STAGE_DUNGEON = 0x2,
@@ -33,6 +36,7 @@ public:
enum EventFlags_e {
EVENT_IN_EVENT = 0x1,
EVENT_DEMO = 0x2,
+ EVENT_0x04 = 0x4,
EVENT_MUTE_BGM_PARTIAL = 0x8,
EVENT_MUTE_BGM_FULL = 0x10,
EVENT_MUTE_STAGE_EFFECTS_PARTIAL = 0x20,
@@ -41,6 +45,7 @@ public:
EVENT_MUTE_ENEMY_FULL = 0x100,
EVENT_MUTE_OBJ_PARTIAL = 0x200,
EVENT_MUTE_OBJ_FULL = 0x400,
+ EVENT_0x800 = 0x800,
EVENT_0x400000 = 0x400000,
};
@@ -76,10 +81,12 @@ public:
return field_0x49C;
}
- void resetStageName() {
- field_0x098 = "EVENT_NONE";
+ void resetEventName() {
+ mEventName = "EVENT_NONE";
}
+ bool checkFlag0x18(u32 mask);
+
bool checkFlag0x10(u32 mask) const {
return field_0x010 & mask;
}
@@ -92,7 +99,7 @@ public:
field_0x010 &= ~mask;
}
- bool checkEventFlag(u32 mask) const {
+ bool checkEventFlag(u32 mask) {
return mEventFlags & mask;
}
@@ -111,9 +118,12 @@ public:
return getCurrentStageMusicDemoName() != nullptr;
}
+ void setEvent(const char *eventName);
// not sure, subtype is unused
bool isActiveDemoMaybe(s32 subtype) const;
bool isInEvent(const char *eventName);
+ bool isInEvent() const;
+ bool onSkipEvent() const;
void doMsgStart(s32 idx);
void doMsgEnd();
@@ -151,6 +161,20 @@ private:
bool handleStageEvent(const char *name);
void handleDemoEvent(const char *name);
+ u32 convertSeLabelToSoundId(const char *label);
+ u32 convertBgmLabelToSoundId(const char *label);
+
+ u32 getBgmLabelSoundId();
+ bool playFanOrBgm(u32 soundId);
+
+ void handleFan();
+ void handleSe();
+ void handleCmd();
+ void handleSeLv();
+ bool finalizeEvent(bool skipped);
+
+ void resetEventVars();
+
// Callbacks start
static void cbUnkNoop();
@@ -173,7 +197,7 @@ private:
/* 0x010 */ u32 field_0x010;
/* 0x014 */ UNKWORD field_0x014;
/* 0x018 */ UNKWORD field_0x018;
- /* 0x01C */ SizedString<32> field_0x01C;
+ /* 0x01C */ SizedString<32> mStageName;
/* 0x03C */ UNKWORD field_0x03C;
/* 0x040 */ s32 mStageId;
/* 0x044 */ UNKWORD field_0x044;
@@ -189,9 +213,9 @@ private:
/* 0x067 */ u8 field_0x067;
/* 0x068 */ UNKWORD field_0x068;
/* 0x06C */ UNKWORD field_0x06C;
- /* 0x070 */ UNKWORD field_0x070;
+ /* 0x070 */ void (*mpUnkCallback)();
/* 0x074 */ UNKWORD field_0x074;
- /* 0x078 */ UNKWORD field_0x078;
+ /* 0x078 */ OnEventStartCallback mpOnEventStartCallback;
/* 0x07C */ UNKWORD field_0x07C;
/* 0x080 */ UNKWORD field_0x080;
/* 0x084 */ UNKWORD field_0x084;
@@ -199,21 +223,21 @@ private:
/* 0x08C */ s32 mSoundEventId;
/* 0x090 */ UNKWORD field_0x090;
/* 0x094 */ u32 mEventFlags;
- /* 0x098 */ SizedString<64> field_0x098;
- /* 0x0D8 */ SizedString<64> field_0x0D8;
+ /* 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;
- /* 0x128 */ UNKWORD field_0x128;
+ /* 0x128 */ u32 mSeLvSoundId;
/* 0x12C */ SizedString<64> mSeName;
/* 0x16C */ SizedString<64> mBgmName;
/* 0x1AC */ SizedString<64> mFanName;
/* 0x1EC */ SizedString<64> mCmdName;
/* 0x22C */ UNKWORD field_0x22C;
- /* 0x230 */ UNKWORD field_0x230;
+ /* 0x230 */ nw4r::snd::SoundHandle mSeLvSoundHandle;
/* 0x234 */ const SndEventDef *mpSoundEventDef;
- /* 0x238 */ UNKWORD field_0x238;
+ /* 0x238 */ u32 field_0x238;
/* 0x23C */ u8 field_0x23C;
/* 0x23D */ u8 field_0x23D;
/* 0x240 */ UNKWORD field_0x240;
diff --git a/include/nw4r/snd/snd_SoundHandle.h b/include/nw4r/snd/snd_SoundHandle.h
index a69b7999..4dd83232 100644
--- a/include/nw4r/snd/snd_SoundHandle.h
+++ b/include/nw4r/snd/snd_SoundHandle.h
@@ -69,6 +69,11 @@ namespace nw4r { namespace snd
mSound->SetPan(pan);
}
+ void SetFxSend(AuxBus bus, f32 send) {
+ if (IsAttachedSound())
+ mSound->SetFxSend(bus, send);
+ }
+
void SetLpfFreq(f32 lpfFreq) {
if (IsAttachedSound())
mSound->SetLpfFreq(lpfFreq);
diff --git a/include/toBeSorted/event_manager.h b/include/toBeSorted/event_manager.h
index c248e8b8..561490c8 100644
--- a/include/toBeSorted/event_manager.h
+++ b/include/toBeSorted/event_manager.h
@@ -37,6 +37,10 @@ public:
return isInEvent() ? sInstance->mCurrentEvent.eventName : nullptr;
}
+ static s32 getCurrentEventRoomId() {
+ return isInEvent() ? sInstance->mCurrentEvent.roomid : -1;
+ }
+
static bool isCurrentEvent(const char *name) {
return strequals(getCurrentEventName(), name);
}
diff --git a/include/toBeSorted/music_mgrs.h b/include/toBeSorted/music_mgrs.h
index 17821527..ef62b8b2 100644
--- a/include/toBeSorted/music_mgrs.h
+++ b/include/toBeSorted/music_mgrs.h
@@ -23,7 +23,6 @@ extern "C" void fn_803618F0(dSndStateMgr_c *);
extern "C" void fn_80362730(dSndStateMgr_c *);
extern "C" void fn_80365D20(dSndStateMgr_c *);
extern "C" void fn_803624F0(dSndStateMgr_c *);
-extern "C" bool fn_80364DA0(dSndStateMgr_c *);
extern "C" void fn_80365020(dSndStateMgr_c *);
extern "C" void fn_80364D00(dSndStateMgr_c *, s32);