summaryrefslogtreecommitdiff
path: root/include/d/snd
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2025-07-19 14:35:33 +0200
committerrobojumper <robojumper@gmail.com>2025-09-13 11:10:27 +0200
commit90ab45d3dd794ec24ac324c390fdc99ac6422bed (patch)
tree8add6caa141936836cf099c43641af8d99e09414 /include/d/snd
parent55e15b59e914609feff6d989c3cc0a5a1caea643 (diff)
More and cleanup
Diffstat (limited to 'include/d/snd')
-rw-r--r--include/d/snd/d_snd_area_sound_effect_mgr.h2
-rw-r--r--include/d/snd/d_snd_bgm_mgr.h2
-rw-r--r--include/d/snd/d_snd_control_player_mgr.h1
-rw-r--r--include/d/snd/d_snd_player_mgr.h2
-rw-r--r--include/d/snd/d_snd_stage_data.h2
-rw-r--r--include/d/snd/d_snd_state_mgr.h68
6 files changed, 65 insertions, 12 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 69696810..288c40ad 100644
--- a/include/d/snd/d_snd_area_sound_effect_mgr.h
+++ b/include/d/snd/d_snd_area_sound_effect_mgr.h
@@ -21,6 +21,8 @@ class dSndAreaSoundEffectMgr_c {
public:
dSndAreaSoundEffectMgr_c();
+ void loadStageSound(f32 *pOutVolume);
+
bool startSound(u32 soundId, u32 handleIdx);
void calc();
void stopSounds(s32 fadeFrames);
diff --git a/include/d/snd/d_snd_bgm_mgr.h b/include/d/snd/d_snd_bgm_mgr.h
index a6e8b80f..688e7065 100644
--- a/include/d/snd/d_snd_bgm_mgr.h
+++ b/include/d/snd/d_snd_bgm_mgr.h
@@ -39,9 +39,11 @@ public:
void pauseAllBgm();
void stopAllBgm(s32 fadeFrames);
+ void loadStageSound();
void setBgmToPlayOnEventEnd(u32 soundId);
bool onEventEnd();
void onEventStart(const char *eventName, s32 soundEventId, s32 unk);
+ bool onEventFinalize(const char *eventName, u32 soundEventId, bool skipped);
void prepareBgm();
dSndBgmSound_c *getSoundHandleForBgm(u32 soundId, u32 startOffset);
diff --git a/include/d/snd/d_snd_control_player_mgr.h b/include/d/snd/d_snd_control_player_mgr.h
index e5cfed54..cab2cfd3 100644
--- a/include/d/snd/d_snd_control_player_mgr.h
+++ b/include/d/snd/d_snd_control_player_mgr.h
@@ -25,6 +25,7 @@ public:
void setupPlayerControlsGlobal();
void setupPlayerControlsStage();
void setupPlayerControlsStageBgm();
+ void setupPlayerControlsDemo();
void calc();
diff --git a/include/d/snd/d_snd_player_mgr.h b/include/d/snd/d_snd_player_mgr.h
index f7b74a4f..da94dfd1 100644
--- a/include/d/snd/d_snd_player_mgr.h
+++ b/include/d/snd/d_snd_player_mgr.h
@@ -30,7 +30,7 @@ public:
void shutdown(s32 channel);
void setup();
- void shutdown();
+ void shutdownDemo();
void calc();
void calcActive();
diff --git a/include/d/snd/d_snd_stage_data.h b/include/d/snd/d_snd_stage_data.h
index ada97ea3..082a4bb9 100644
--- a/include/d/snd/d_snd_stage_data.h
+++ b/include/d/snd/d_snd_stage_data.h
@@ -9,7 +9,7 @@ struct dSndStageInfo {
/* 0x08 */ u32 unk1;
/* 0x0C */ u32 unk2;
/* 0x10 */ u32 unk3;
- /* 0x14 */ u32 unk4;
+ /* 0x14 */ s32 unk4;
/* 0x18 */ const char *demoName;
static const s32 sNumStageInfos;
diff --git a/include/d/snd/d_snd_state_mgr.h b/include/d/snd/d_snd_state_mgr.h
index 7ad4dbe2..cdb32434 100644
--- a/include/d/snd/d_snd_state_mgr.h
+++ b/include/d/snd/d_snd_state_mgr.h
@@ -81,10 +81,24 @@ public:
return field_0x49C;
}
+
+
void resetEventName() {
mEventName = "EVENT_NONE";
}
+ const char *getCameraFmt() {
+ return "%s_C%d_%d";
+ }
+
+ const char *getMsgWaitFmt() {
+ return "%s_M%d_W%d_%d";
+ }
+
+ const char *getFrameFmt() {
+ return "%s_%d";
+ }
+
bool checkFlag0x18(u32 mask);
bool checkFlag0x258(u32 mask) {
@@ -103,6 +117,10 @@ public:
field_0x258 &= ~mask;
}
+ bool checkStageTypeFlag(u32 mask) {
+ return mStageTypeFlags & mask;
+ }
+
bool checkFlag0x10(u32 mask) {
return field_0x010 & mask;
}
@@ -131,7 +149,8 @@ public:
const char *getCurrentStageMusicDemoName() const;
bool isInDemo() const {
- return getCurrentStageMusicDemoName() != nullptr;
+ // implicit conversion required for regalloc in loadStageSound
+ return getCurrentStageMusicDemoName();
}
void setStbEventName(const char *eventName);
@@ -153,6 +172,9 @@ public:
f32 getUserParamVolume(u32 userParam);
void onStageOrLayerUpdate();
+ void onStageLoad();
+ void loadStageSound();
+ void loadObjectSound();
// TODO better names
static const char *getStageName(s32 id);
@@ -189,37 +211,62 @@ public:
void onCameraCut(s32 cutIdx);
- static void clearExecuteCallback();
+ static void clearEventExecuteCallback();
private:
+ void loadStageSound(bool force);
+
void resetOverrides();
void initializeEventCallbacks(const char *name);
bool handleGlobalEvent(const char *name);
bool handleStageEvent(const char *name);
void handleDemoEvent(const char *name);
+ void calcEvent();
void calcRoomId();
void setRoomId(s32 roomId);
void calcTgSnd();
void calcFilters();
+ u32 getBgmLabelSoundId();
+ void doLabelSuffix(const char *suffix);
+
u32 convertSeLabelToSoundId(const char *label);
u32 convertBgmLabelToSoundId(const char *label);
-
- u32 getBgmLabelSoundId();
- bool playFanOrBgm(u32 soundId);
+ u32 convertCmdLabelToSoundId(const char *label);
void doBgm(const char *label);
void doSe(const char *label);
void doCmd(const char *label);
- void doLabelSuffix(const char *suffix);
u32 getSeCameraId();
+ u32 getSeMsgWaitId();
+ u32 getSeFrameCountId();
+
+ u32 getBgmCameraId();
+ u32 getBgmMsgWaitId();
+ u32 getBgmFrameCountId();
+
+ u32 getCmdCameraId();
+ u32 getCmdMsgWaitId();
+ u32 getCmdFrameCountId();
+
+ void calcSe();
+ bool calcBgm();
+ void calcCmd();
+
+ bool playSe(u32 soundId);
+ bool playFanOrBgm(u32 soundId);
+ bool playCmd(u32 soundId);
void handleFan();
void handleSe();
void handleCmd();
void handleSeLv();
+
+ /** Called when no event is running anymore */
+ void endEvent(bool skipped);
+ /** Called when an event stops */
bool finalizeEvent(bool skipped);
void resetEventVars();
@@ -235,6 +282,7 @@ private:
// Checks if the given stage + layer is the stage you're transported
// to when viewing hint movies.
static bool isSeekerStoneStage(const char *stageName, s32 layer);
+ bool isSomeSkyloftRoom() const;
void setCallbacksForStage();
@@ -247,12 +295,12 @@ private:
/* 0x014 */ UNKWORD field_0x014;
/* 0x018 */ UNKWORD field_0x018;
/* 0x01C */ SizedString<32> mStageName;
- /* 0x03C */ UNKWORD field_0x03C;
+ /* 0x03C */ s32 field_0x03C;
/* 0x040 */ s32 mStageId;
/* 0x044 */ UNKWORD field_0x044;
/* 0x048 */ u8 _0x048[0x050 - 0x048];
/* 0x050 */ s32 mPreviousStageId;
- /* 0x054 */ UNKWORD field_0x054;
+ /* 0x054 */ u32 mStageTypeFlags;
/* 0x058 */ s32 mLayer;
/* 0x05C */ s32 mRoomId;
/* 0x060 */ UNKWORD field_0x060;
@@ -303,9 +351,9 @@ private:
/* 0x498 */ f32 field_0x498;
/* 0x49C */ f32 field_0x49C;
/* 0x4A0 */ f32 field_0x4A0;
- /* 0x4A4 */ UNKWORD field_0x4A4;
+ /* 0x4A4 */ u32 field_0x4A4;
/* 0x4A8 */ u8 field_0x4A8;
- /* 0x4A9 */ bool needsGroupsReload;
+ /* 0x4A9 */ bool mNeedsGroupsReload;
};
#endif