mirror of
https://github.com/zeldaret/ss
synced 2026-06-05 03:07:49 -04:00
A few funcs
This commit is contained in:
+23
-23
@@ -19925,16 +19925,16 @@ create__33SndMgrDisposer<15dSndPlayerMgr_c>Fv = .text:0x8035DB20; // type:functi
|
||||
remove__33SndMgrDisposer<15dSndPlayerMgr_c>Fv = .text:0x8035DB70; // type:function size:0x10
|
||||
__ct__15dSndPlayerMgr_cFv = .text:0x8035DB80; // type:function size:0x78
|
||||
fn_8035DC00 = .text:0x8035DC00; // type:function size:0x44
|
||||
fn_8035DC50 = .text:0x8035DC50; // type:function size:0x8C
|
||||
fn_8035DCE0 = .text:0x8035DCE0; // type:function size:0x38
|
||||
initialize__15dSndPlayerMgr_cFv = .text:0x8035DC50; // type:function size:0x8C
|
||||
createFileManager__15dSndPlayerMgr_cFv = .text:0x8035DCE0; // type:function size:0x38
|
||||
fn_8035DD20 = .text:0x8035DD20; // type:function size:0x4
|
||||
fn_8035DD30 = .text:0x8035DD30; // type:function size:0x10
|
||||
fn_8035DD40 = .text:0x8035DD40; // type:function size:0xC0
|
||||
fn_8035DE00 = .text:0x8035DE00; // type:function size:0x54
|
||||
fn_8035DE60 = .text:0x8035DE60; // type:function size:0x38
|
||||
fn_8035DEA0 = .text:0x8035DEA0; // type:function size:0x50
|
||||
fn_8035DEF0 = .text:0x8035DEF0; // type:function size:0x38
|
||||
fn_8035DF30 = .text:0x8035DF30; // type:function size:0x24
|
||||
setupState0__15dSndPlayerMgr_cFv = .text:0x8035DD40; // type:function size:0xC0
|
||||
popToState0__15dSndPlayerMgr_cFv = .text:0x8035DE00; // type:function size:0x54
|
||||
saveState1__15dSndPlayerMgr_cFv = .text:0x8035DE60; // type:function size:0x38
|
||||
popToState1__15dSndPlayerMgr_cFv = .text:0x8035DEA0; // type:function size:0x50
|
||||
saveState2__15dSndPlayerMgr_cFv = .text:0x8035DEF0; // type:function size:0x38
|
||||
popToState2__15dSndPlayerMgr_cFv = .text:0x8035DF30; // type:function size:0x24
|
||||
getFreeSize__15dSndPlayerMgr_cFv = .text:0x8035DF60; // type:function size:0x54
|
||||
fn_8035DFC0 = .text:0x8035DFC0; // type:function size:0x3C
|
||||
fn_8035E000 = .text:0x8035E000; // type:function size:0xD4
|
||||
@@ -20020,9 +20020,9 @@ getAppliedPlayerVolume__22dSndControlPlayerMgr_cCFUl = .text:0x80360530; // type
|
||||
setControlValue__22dSndControlPlayerMgr_cFQ222dSndControlPlayerMgr_c12PlayerCtrl_eUlfl = .text:0x80360570; // type:function size:0xB0
|
||||
resetControls__22dSndControlPlayerMgr_cFv = .text:0x80360620; // type:function size:0xAC
|
||||
getControlTarget__22dSndControlPlayerMgr_cCFQ222dSndControlPlayerMgr_c12PlayerCtrl_eUl = .text:0x803606D0; // type:function size:0x40
|
||||
fn_80360710 = .text:0x80360710; // type:function size:0x78
|
||||
fn_80360790 = .text:0x80360790; // type:function size:0x5C
|
||||
fn_803607F0 = .text:0x803607F0; // type:function size:0x60
|
||||
unmutePlayer__22dSndControlPlayerMgr_cFUll = .text:0x80360710; // type:function size:0x78
|
||||
unmuteScenePlayers__22dSndControlPlayerMgr_cFl = .text:0x80360790; // type:function size:0x5C
|
||||
muteScenePlayers__22dSndControlPlayerMgr_cFl = .text:0x803607F0; // type:function size:0x60
|
||||
setGroupVolumeFlag__22dSndControlPlayerMgr_cFQ222dSndControlPlayerMgr_c18VolumeControlGroupQ222dSndControlPlayerMgr_c9MuteLevel = .text:0x80360850; // type:function size:0x2C
|
||||
setPlayerVolumeInternal__22dSndControlPlayerMgr_cFUlf = .text:0x80360880; // type:function size:0x64
|
||||
fn_803608F0 = .text:0x803608F0; // type:function size:0x50
|
||||
@@ -20143,20 +20143,20 @@ fn_80365B80 = .text:0x80365B80; // type:function size:0x5C
|
||||
fn_80365BE0 = .text:0x80365BE0; // type:function size:0x70
|
||||
fn_80365C50 = .text:0x80365C50; // type:function size:0xC8
|
||||
fn_80365D20 = .text:0x80365D20; // type:function size:0x3C
|
||||
fn_80365D60 = .text:0x80365D60; // type:function size:0x24
|
||||
fn_80365D90 = .text:0x80365D90; // type:function size:0x44
|
||||
fn_80365DE0 = .text:0x80365DE0; // type:function size:0x1C
|
||||
findMusicInMusicStruct = .text:0x80365E00; // type:function size:0xC0
|
||||
fn_80365EC0 = .text:0x80365EC0; // type:function size:0xA8
|
||||
fn_80365F70 = .text:0x80365F70; // type:function size:0xA8
|
||||
getStageUnk2__14dSndStateMgr_cFUl = .text:0x80366020; // type:function size:0x28
|
||||
fn_80366050 = .text:0x80366050; // type:function size:0x28
|
||||
fn_80366080 = .text:0x80366080; // type:function size:0x10
|
||||
getStageName__14dSndStateMgr_cFl = .text:0x80365D60; // type:function size:0x24
|
||||
getStageName4__14dSndStateMgr_cFl = .text:0x80365D90; // type:function size:0x44
|
||||
getCurrentStageName4__14dSndStateMgr_cFv = .text:0x80365DE0; // type:function size:0x1C
|
||||
getSndStageId__14dSndStateMgr_cFPCcl = .text:0x80365E00; // type:function size:0xC0
|
||||
getSndStageId3__14dSndStateMgr_cFPCcl = .text:0x80365EC0; // type:function size:0xA8
|
||||
getSndStageId4__14dSndStateMgr_cFPCcl = .text:0x80365F70; // type:function size:0xA8
|
||||
getSndStageId2__14dSndStateMgr_cFl = .text:0x80366020; // type:function size:0x28
|
||||
getSndStageId4__14dSndStateMgr_cFl = .text:0x80366050; // type:function size:0x28
|
||||
getNextSndStageId__14dSndStateMgr_cFl = .text:0x80366080; // type:function size:0x10
|
||||
fn_80366090 = .text:0x80366090; // type:function size:0x88
|
||||
fn_80366120 = .text:0x80366120; // type:function size:0x7C
|
||||
specialLayerVersionExists__14dSndStateMgr_cFPCcl = .text:0x80366120; // type:function size:0x7C
|
||||
fn_803661A0 = .text:0x803661A0; // type:function size:0x10
|
||||
fn_803661B0 = .text:0x803661B0; // type:function size:0x10
|
||||
actuallyFindSoundIdForStageLayer = .text:0x803661C0; // type:function size:0x224
|
||||
getSoundIdForStageAndLayer__14dSndStateMgr_cFQ214dSndStateMgr_c15SoundIdLookup_ePCcll = .text:0x803661C0; // type:function size:0x224
|
||||
fn_803663F0 = .text:0x803663F0; // type:function size:0x1C
|
||||
fn_80366410 = .text:0x80366410; // type:function size:0x1C
|
||||
fn_80366430 = .text:0x80366430; // type:function size:0x4C
|
||||
@@ -41046,7 +41046,7 @@ lbl_8057414C = .sdata:0x8057414C; // type:object size:0x8
|
||||
lbl_80574154 = .sdata:0x80574154; // type:object size:0x8
|
||||
lbl_8057415C = .sdata:0x8057415C; // type:object size:0x8
|
||||
lbl_80574164 = .sdata:0x80574164; // type:object size:0x8
|
||||
lbl_8057416C = .sdata:0x8057416C; // type:object size:0x8
|
||||
lbl_8057416C = .sdata:0x8057416C; // type:object size:0x5 data:string
|
||||
lbl_80574174 = .sdata:0x80574174; // type:object size:0x8
|
||||
lbl_8057417C = .sdata:0x8057417C; // type:object size:0x8
|
||||
lbl_80574184 = .sdata:0x80574184; // type:object size:0x8
|
||||
|
||||
@@ -45,6 +45,9 @@ public:
|
||||
void muteAllWorldSounds(s32 fadeFrames);
|
||||
void unmuteAllWorldSounds(s32 fadeFrames);
|
||||
|
||||
void muteScenePlayers(s32 frames);
|
||||
void unmuteScenePlayers(s32 frames);
|
||||
|
||||
enum MuteLevel {
|
||||
MUTE_FULL = 0,
|
||||
MUTE_PARTIAL = 1,
|
||||
@@ -75,6 +78,7 @@ public:
|
||||
void setPlayerVolumeInternal(u32 playerIdx, f32 volume);
|
||||
|
||||
private:
|
||||
void unmutePlayer(u32 playerIdx, s32 frames);
|
||||
void resetControls();
|
||||
void calcVolumes();
|
||||
void calcMuteFlags();
|
||||
|
||||
@@ -58,6 +58,13 @@ public:
|
||||
void enterMsgWait();
|
||||
void leaveMsgWait();
|
||||
|
||||
void setupState0();
|
||||
void popToState0();
|
||||
void saveState1();
|
||||
void popToState1();
|
||||
void saveState2();
|
||||
void popToState2();
|
||||
|
||||
u32 getFreeSize();
|
||||
bool loadDemoArchive(const char *demoArchiveName);
|
||||
const char *getSoundArchivePath();
|
||||
@@ -180,15 +187,18 @@ public:
|
||||
private:
|
||||
/* 0x010 */ u8 field_0x010;
|
||||
/* 0x011 */ u8 field_0x011;
|
||||
/* 0x014 */ s32 field_0x014;
|
||||
/* 0x018 */ s32 field_0x018;
|
||||
/* 0x01C */ s32 field_0x01C;
|
||||
/* 0x014 */ s32 mState0;
|
||||
/* 0x018 */ s32 mState1;
|
||||
/* 0x01C */ s32 mState2;
|
||||
/* 0x020 */ u32 mFlags;
|
||||
|
||||
// system menu, inventory, map
|
||||
void enterPauseState();
|
||||
void leavePauseState();
|
||||
|
||||
void initialize();
|
||||
void createFileManager();
|
||||
|
||||
virtual nw4r::snd::SoundStartable::StartResult
|
||||
startSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const nw4r::snd::SoundStartable::StartInfo *pStartInfo);
|
||||
virtual nw4r::snd::SoundStartable::StartResult startSound(
|
||||
|
||||
@@ -110,6 +110,29 @@ public:
|
||||
void doMsgWaitStart();
|
||||
void doMsgWaitEnd();
|
||||
|
||||
// TODO better names
|
||||
static const char *getStageName(s32 id);
|
||||
const char *getStageName4(s32 id);
|
||||
const char *getCurrentStageName4();
|
||||
|
||||
static s32 getSndStageId(const char *stageName, s32 layer);
|
||||
static s32 getSndStageId3(const char *stageName, s32 layer);
|
||||
static s32 getSndStageId4(const char *stageName, s32 layer);
|
||||
|
||||
static s32 getSndStageId2(s32 id);
|
||||
static s32 getSndStageId4(s32 id);
|
||||
|
||||
static s32 getNextSndStageId(s32 id);
|
||||
static bool specialLayerVersionExists(const char *stageName, s32 layer);
|
||||
|
||||
enum SoundIdLookup_e {
|
||||
LOOKUP_BGM,
|
||||
LOOKUP_BGM_MAIN,
|
||||
LOOKUP_SE_A,
|
||||
};
|
||||
|
||||
u32 getSoundIdForStageAndLayer(SoundIdLookup_e lookup, const char *stageName, s32 layer, s32 stageId);
|
||||
|
||||
private:
|
||||
void resetOverrides();
|
||||
void initializeEventCallbacks(const char *name);
|
||||
|
||||
@@ -227,6 +227,11 @@ namespace nw4r { namespace snd
|
||||
detail::BasicSound::AmbientInfo *ambientArgInfo, SoundActor *actor,
|
||||
bool holdFlag, SoundStartable::StartInfo const *startInfo);
|
||||
|
||||
// Made up
|
||||
void detail_SetFileManager(SoundArchivePlayer_FileManager *manager) {
|
||||
mFileManager = manager;
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename Sound>
|
||||
Sound *AllocSound(
|
||||
|
||||
@@ -340,6 +340,30 @@ f32 dSndControlPlayerMgr_c::getControlTarget(PlayerCtrl_e ctrlType, u32 playerId
|
||||
return mpCtrls[ctrlType][playerIdx].getTargetValue();
|
||||
}
|
||||
|
||||
// TODO - not sure what this actually does
|
||||
void dSndControlPlayerMgr_c::unmutePlayer(u32 idx, s32 frames) {
|
||||
if (idx >= sNumPlayers) {
|
||||
return;
|
||||
}
|
||||
|
||||
restoreVolume(idx, 0);
|
||||
overrideVolume(idx, 0.0f, 0);
|
||||
restoreVolume(idx, frames);
|
||||
}
|
||||
|
||||
|
||||
void dSndControlPlayerMgr_c::unmuteScenePlayers(s32 frames) {
|
||||
for (u32 i = dSndPlayerMgr_c::PLAYER_ENEMY; i < dSndPlayerMgr_c::PLAYER_AREA; i++) {
|
||||
unmutePlayer(i, frames);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::muteScenePlayers(s32 frames) {
|
||||
for (u32 i = dSndPlayerMgr_c::PLAYER_ENEMY; i < dSndPlayerMgr_c::PLAYER_AREA; i++) {
|
||||
overrideVolume(i, 0.0f, frames);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setGroupVolumeFlag(VolumeControlGroup group, MuteLevel level) {
|
||||
if (group >= CTRL_GROUP_MAX) {
|
||||
return;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "d/snd/d_snd_area_sound_effect_mgr.h"
|
||||
#include "d/snd/d_snd_bgm_mgr.h"
|
||||
#include "d/snd/d_snd_control_player_mgr.h"
|
||||
#include "d/snd/d_snd_file_mgr.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
@@ -26,8 +27,7 @@ const char *dSndPlayerMgr_c::getSoundArchivePath() {
|
||||
|
||||
SND_DISPOSER_DEFINE(dSndPlayerMgr_c);
|
||||
|
||||
dSndPlayerMgr_c::dSndPlayerMgr_c()
|
||||
: field_0x010(0), field_0x011(0), field_0x014(-1), field_0x018(-1), field_0x01C(-1), mFlags(0) {}
|
||||
dSndPlayerMgr_c::dSndPlayerMgr_c() : field_0x010(0), field_0x011(0), mState0(-1), mState1(-1), mState2(-1), mFlags(0) {}
|
||||
|
||||
void dSndPlayerMgr_c::enterPauseState() {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setVolume(PLAYER_FAN, 0.3f, 5);
|
||||
@@ -37,6 +37,62 @@ void dSndPlayerMgr_c::enterPauseState() {
|
||||
onFlag(MGR_PAUSE);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::createFileManager() {
|
||||
dSndMgr_c::getPlayer().detail_SetFileManager(
|
||||
dSndFileManager::create(dSndMgr_c::GetInstance()->getArchive(), dSndMgr_c::GetInstance()->getSoundHeap())
|
||||
);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::setupState0() {
|
||||
if (mState0 > 0) {
|
||||
return;
|
||||
}
|
||||
initialize();
|
||||
|
||||
// TODO: Ugh, maybe convert the enums to unsigned ints?
|
||||
dSndMgr_c::GetInstance()->loadGroup((unsigned int)GRP_STATIC, nullptr, 0);
|
||||
mState0 = dSndMgr_c::GetInstance()->saveState();
|
||||
|
||||
s32 tmpState = dSndMgr_c::GetInstance()->saveState();
|
||||
dSndMgr_c::GetInstance()->loadGroup((unsigned int)GRP_BGM_PLAY_DATA_STATIC, nullptr, 0);
|
||||
|
||||
// TODO - loading static play data
|
||||
|
||||
dSndMgr_c::GetInstance()->loadState(tmpState);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::popToState0() {
|
||||
if (mState0 < 0) {
|
||||
return;
|
||||
}
|
||||
dSndMgr_c::GetInstance()->loadState(mState0);
|
||||
mState1 = -1;
|
||||
mState2 = -1;
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::saveState1() {
|
||||
mState1 = dSndMgr_c::GetInstance()->saveState();
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::popToState1() {
|
||||
if (mState1 < 0) {
|
||||
return;
|
||||
}
|
||||
dSndMgr_c::GetInstance()->loadState(mState1);
|
||||
mState2 = -1;
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::saveState2() {
|
||||
mState2 = dSndMgr_c::GetInstance()->saveState();
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::popToState2() {
|
||||
if (mState2 < 0) {
|
||||
return;
|
||||
}
|
||||
dSndMgr_c::GetInstance()->loadState(mState2);
|
||||
}
|
||||
|
||||
u32 dSndPlayerMgr_c::getFreeSize() {
|
||||
return dSndMgr_c::GetInstance()->getSoundHeap()->GetFreeSize();
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
#include "d/snd/d_snd_event.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "d/snd/d_snd_stage_data.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "nw4r/snd/snd_FxReverbStdDpl2.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -110,7 +112,7 @@ void dSndStateMgr_c::onStageOrLayerUpdate() {
|
||||
mPreviousStageId = mStageId;
|
||||
field_0x044 = getStageUnk2(newStageId);
|
||||
mStageId = newStageId;
|
||||
|
||||
|
||||
if (unk_0x065) {
|
||||
setCallbacksForStage();
|
||||
}
|
||||
@@ -176,10 +178,8 @@ bool dSndStateMgr_c::isVolcanicDungeon(u32 stageId) {
|
||||
case SND_STAGE_D201:
|
||||
case SND_STAGE_D201_1:
|
||||
case SND_STAGE_D003_0:
|
||||
case SND_STAGE_D003_1:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
case SND_STAGE_D003_1: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,3 +232,164 @@ void dSndStateMgr_c::initializeEventCallbacks(const char *name) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const char *dSndStateMgr_c::getStageName(s32 id) {
|
||||
if (id >= SND_STAGE_MAX) {
|
||||
return "NULL";
|
||||
}
|
||||
return dSndStageInfo::sInfos[id].stageName;
|
||||
}
|
||||
|
||||
const char *dSndStateMgr_c::getStageName4(s32 id) {
|
||||
if (id >= SND_STAGE_MAX) {
|
||||
return "NULL";
|
||||
}
|
||||
return dSndStageInfo::sInfos[getSndStageId4(id)].stageName;
|
||||
}
|
||||
|
||||
const char *dSndStateMgr_c::getCurrentStageName4() {
|
||||
return getStageName(dSndStageInfo::sInfos[mStageId].unk4);
|
||||
}
|
||||
|
||||
s32 dSndStateMgr_c::getSndStageId(const char *stageName, s32 layer) {
|
||||
if (stageName != nullptr) {
|
||||
for (s32 idx = 0; idx < dSndStageInfo::sNumStageInfos; idx++) {
|
||||
if (streq(stageName, dSndStageInfo::sInfos[idx].stageName)) {
|
||||
if (dSndStageInfo::sInfos[idx].layer == -1) {
|
||||
return dSndStageInfo::sInfos[idx].unk1;
|
||||
}
|
||||
if (dSndStageInfo::sInfos[idx].layer == layer) {
|
||||
return dSndStageInfo::sInfos[idx].unk1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SND_STAGE_MAX;
|
||||
}
|
||||
|
||||
s32 dSndStateMgr_c::getSndStageId3(const char *stageName, s32 layer) {
|
||||
if (stageName != nullptr) {
|
||||
for (s32 idx = 0; idx < dSndStageInfo::sNumStageInfos; idx++) {
|
||||
if (streq(stageName, dSndStageInfo::sInfos[idx].stageName)) {
|
||||
if (dSndStageInfo::sInfos[idx].layer == -1 || dSndStageInfo::sInfos[idx].layer == layer) {
|
||||
return dSndStageInfo::sInfos[idx].unk3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SND_STAGE_MAX;
|
||||
}
|
||||
|
||||
s32 dSndStateMgr_c::getSndStageId4(const char *stageName, s32 layer) {
|
||||
if (stageName != nullptr) {
|
||||
for (s32 idx = 0; idx < dSndStageInfo::sNumStageInfos; idx++) {
|
||||
if (streq(stageName, dSndStageInfo::sInfos[idx].stageName)) {
|
||||
if (dSndStageInfo::sInfos[idx].layer == -1 || dSndStageInfo::sInfos[idx].layer == layer) {
|
||||
return dSndStageInfo::sInfos[idx].unk4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SND_STAGE_MAX;
|
||||
}
|
||||
|
||||
s32 dSndStateMgr_c::getSndStageId2(s32 id) {
|
||||
if (id >= SND_STAGE_MAX) {
|
||||
return SND_STAGE_MAX;
|
||||
}
|
||||
return dSndStageInfo::sInfos[id].unk2;
|
||||
}
|
||||
|
||||
s32 dSndStateMgr_c::getSndStageId4(s32 id) {
|
||||
if (id >= SND_STAGE_MAX) {
|
||||
return SND_STAGE_MAX;
|
||||
}
|
||||
return dSndStageInfo::sInfos[id].unk4;
|
||||
}
|
||||
|
||||
s32 dSndStateMgr_c::getNextSndStageId(s32 id) {
|
||||
return getSndStageId(dScGame_c::nextSpawnInfo.getStageName(), dScGame_c::nextSpawnInfo.layer);
|
||||
}
|
||||
|
||||
bool dSndStateMgr_c::specialLayerVersionExists(const char *stageName, s32 layer) {
|
||||
if (stageName != nullptr && layer > 0) {
|
||||
return getSndStageId(stageName, layer) != getSndStageId(stageName, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 dSndStateMgr_c::getSoundIdForStageAndLayer(SoundIdLookup_e lookup, const char *stageName, s32 layer, s32 stageId) {
|
||||
// Ternary causes regswaps...
|
||||
const char *prefix = "BGM_";
|
||||
if (lookup == LOOKUP_SE_A) {
|
||||
prefix = "SE_A_";
|
||||
}
|
||||
SizedString<64> label;
|
||||
|
||||
u32 soundId = -1;
|
||||
s32 round = 3;
|
||||
|
||||
bool hasSpecialLayerVersion = false;
|
||||
if (layer > 0) {
|
||||
hasSpecialLayerVersion = specialLayerVersionExists(stageName, layer);
|
||||
}
|
||||
|
||||
if (hasSpecialLayerVersion) {
|
||||
label.sprintf("%s%s_L%d", prefix, stageName, layer);
|
||||
} else if (layer > 0) {
|
||||
label.sprintf("%s%s_L%d", prefix, stageName, layer);
|
||||
} else {
|
||||
label.sprintf("%s%s", prefix, stageName);
|
||||
// We didn't bother with a _L layer variant, so we're going
|
||||
// in with the base variant
|
||||
round = 2;
|
||||
}
|
||||
|
||||
while (round > 0) {
|
||||
if (lookup == LOOKUP_BGM_MAIN) {
|
||||
label += "_MAIN";
|
||||
}
|
||||
|
||||
soundId = dSndPlayerMgr_c::GetInstance()->convertLabelStringToSoundId(label);
|
||||
if (soundId != -1) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (round == 3) {
|
||||
// If _L layer variant didn't exist, try the one without a layer...
|
||||
label.sprintf("%s%s", prefix, stageName);
|
||||
} else if (round == 2) {
|
||||
if (lookup == LOOKUP_BGM) {
|
||||
// If the one without a layer doesn't exist, continue with the one referenced
|
||||
// in field 3, unless it's the same as the original one
|
||||
s32 otherStageId = getSndStageId3(stageName, layer);
|
||||
if (stageId != otherStageId) {
|
||||
label.sprintf("%s%s", prefix, getStageName(otherStageId));
|
||||
} else {
|
||||
// break to prevent infinite loop
|
||||
round = 0;
|
||||
}
|
||||
} else if (lookup == LOOKUP_SE_A) {
|
||||
// If the one without a layer doesn't exist, continue with the one referenced
|
||||
// in field 4, unless it's the same as the original one
|
||||
s32 otherStageId = getSndStageId4(stageName, layer);
|
||||
if (stageId != otherStageId) {
|
||||
label.sprintf("%s%s", prefix, getStageName(otherStageId));
|
||||
} else {
|
||||
// break to prevent infinite loop
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
round--;
|
||||
}
|
||||
|
||||
return soundId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user