mirror of
https://github.com/zeldaret/st
synced 2026-07-07 14:03:29 -04:00
OverlayIndex -> OverlaySlot and document overlay indices
This commit is contained in:
@@ -240,34 +240,153 @@ typedef u32 OverlayId;
|
||||
|
||||
typedef u32 OverlayIndex;
|
||||
enum OverlayIndex_ {
|
||||
OverlayIndex_Core,
|
||||
OverlayIndex_1,
|
||||
OverlayIndex_2,
|
||||
OverlayIndex_3,
|
||||
OverlayIndex_4,
|
||||
OverlayIndex_5,
|
||||
OverlayIndex_6,
|
||||
OverlayIndex_7,
|
||||
OverlayIndex_8,
|
||||
OverlayIndex_9,
|
||||
OverlayIndex_10,
|
||||
OverlayIndex_11,
|
||||
OverlayIndex_12,
|
||||
OverlayIndex_13,
|
||||
OverlayIndex_14,
|
||||
OverlayIndex_15,
|
||||
OverlayIndex_16,
|
||||
OverlayIndex_17,
|
||||
OverlayIndex_COUNT,
|
||||
/* 000 */ OverlayIndex_Second,
|
||||
/* 001 */ OverlayIndex_SceneInit,
|
||||
/* 002 */ OverlayIndex_Collect,
|
||||
/* 003 */ OverlayIndex_SoftKeyboard,
|
||||
/* 004 */ OverlayIndex_NormalScreen,
|
||||
/* 005 */ OverlayIndex_Paint,
|
||||
/* 006 */ OverlayIndex_RailEdit,
|
||||
/* 007 */ OverlayIndex_GameOver,
|
||||
/* 008 */ OverlayIndex_TabMenu,
|
||||
/* 009 */ OverlayIndex_CloseUp,
|
||||
/* 010 */ OverlayIndex_WorldMap,
|
||||
/* 011 */ OverlayIndex_PanFlute,
|
||||
/* 012 */ OverlayIndex_TetsuoMap,
|
||||
/* 013 */ OverlayIndex_Stamp,
|
||||
/* 014 */ OverlayIndex_Factory,
|
||||
/* 015 */ OverlayIndex_Shop,
|
||||
/* 016 */ OverlayIndex_RabbitCapture,
|
||||
/* 017 */ OverlayIndex_CourseExec,
|
||||
/* 018 */ OverlayIndex_SceneInitLand,
|
||||
/* 019 */ OverlayIndex_CourseExecLand,
|
||||
/* 020 */ OverlayIndex_CollectMsg,
|
||||
/* 021 */ OverlayIndex_StartUp,
|
||||
/* 022 */ OverlayIndex_MainGame,
|
||||
/* 023 */ OverlayIndex_Title,
|
||||
/* 024 */ OverlayIndex_MainSelect,
|
||||
/* 025 */ OverlayIndex_WirelessCommon,
|
||||
/* 026 */ OverlayIndex_BattleGame,
|
||||
/* 027 */ OverlayIndex_Download,
|
||||
/* 028 */ OverlayIndex_Wxc,
|
||||
/* 029 */ OverlayIndex_Land,
|
||||
/* 030 */ OverlayIndex_Train,
|
||||
/* 031 */ OverlayIndex_Dungeon,
|
||||
/* 032 */ OverlayIndex_Field,
|
||||
/* 033 */ OverlayIndex_Tower,
|
||||
/* 034 */ OverlayIndex_TowerLobby,
|
||||
/* 035 */ OverlayIndex_BossForest,
|
||||
/* 036 */ OverlayIndex_BossSnow,
|
||||
/* 037 */ OverlayIndex_BossWater,
|
||||
/* 038 */ OverlayIndex_BossFlame,
|
||||
/* 039 */ OverlayIndex_BossDesert,
|
||||
/* 040 */ OverlayIndex_BossDeago,
|
||||
/* 041 */ OverlayIndex_BossLast1,
|
||||
/* 042 */ OverlayIndex_BossLast2,
|
||||
/* 043 */ OverlayIndex_DgnForest,
|
||||
/* 044 */ OverlayIndex_DgnSnow,
|
||||
/* 045 */ OverlayIndex_DgnWater,
|
||||
/* 046 */ OverlayIndex_DgnDesert,
|
||||
/* 047 */ OverlayIndex_InTrain,
|
||||
/* 048 */ OverlayIndex_Castle,
|
||||
/* 049 */ OverlayIndex_CastleTown,
|
||||
/* 050 */ OverlayIndex_Village,
|
||||
/* 051 */ OverlayIndex_Shrine,
|
||||
/* 052 */ OverlayIndex_FldForest,
|
||||
/* 053 */ OverlayIndex_FldSnow,
|
||||
/* 054 */ OverlayIndex_FldWater,
|
||||
/* 055 */ OverlayIndex_FldFlame,
|
||||
/* 056 */ OverlayIndex_FldAjito,
|
||||
/* 057 */ OverlayIndex_FldRabbit,
|
||||
/* 058 */ OverlayIndex_TrainForest,
|
||||
/* 059 */ OverlayIndex_TrainSnow,
|
||||
/* 060 */ OverlayIndex_TrainWater,
|
||||
/* 061 */ OverlayIndex_TrainFlame,
|
||||
/* 062 */ OverlayIndex_Stb,
|
||||
/* 063 */ OverlayIndex_ASR,
|
||||
/* 064 */ OverlayIndex_PlayerSub,
|
||||
/* 065 */ OverlayIndex_Land2,
|
||||
/* 066 */ OverlayIndex_TrainNormal,
|
||||
/* 067 */ OverlayIndex_TrainExtra,
|
||||
/* 068 */ OverlayIndex_TrainDark,
|
||||
/* 069 */ OverlayIndex_PlayerPhantom,
|
||||
/* 070 */ OverlayIndex_PlayerZelda,
|
||||
/* 071 */ OverlayIndex_DgnLv1,
|
||||
/* 072 */ OverlayIndex_DgnLv3,
|
||||
/* 073 */ OverlayIndex_DgnLv5,
|
||||
/* 074 */ OverlayIndex_MapWater,
|
||||
/* 075 */ OverlayIndex_MapLava,
|
||||
/* 076 */ OverlayIndex_TrainMsg,
|
||||
/* 077 */ OverlayIndex_MapA1,
|
||||
/* 078 */ OverlayIndex_MapA2,
|
||||
/* 079 */ OverlayIndex_MapA3,
|
||||
/* 080 */ OverlayIndex_MapA4,
|
||||
/* 081 */ OverlayIndex_MapA5,
|
||||
/* 082 */ OverlayIndex_MapA6,
|
||||
/* 083 */ OverlayIndex_MapA7,
|
||||
/* 084 */ OverlayIndex_MapA8,
|
||||
/* 085 */ OverlayIndex_MapB1,
|
||||
/* 086 */ OverlayIndex_MapB2,
|
||||
/* 087 */ OverlayIndex_MapB3,
|
||||
/* 088 */ OverlayIndex_MapB4,
|
||||
/* 089 */ OverlayIndex_MapB5,
|
||||
/* 090 */ OverlayIndex_MapB6,
|
||||
/* 091 */ OverlayIndex_MapB7,
|
||||
/* 092 */ OverlayIndex_MapC1,
|
||||
/* 093 */ OverlayIndex_MapC2,
|
||||
/* 094 */ OverlayIndex_MapC3,
|
||||
/* 095 */ OverlayIndex_MapC4,
|
||||
/* 096 */ OverlayIndex_MapC5,
|
||||
/* 097 */ OverlayIndex_MapC6,
|
||||
/* 098 */ OverlayIndex_MapD1,
|
||||
/* 099 */ OverlayIndex_MapD2,
|
||||
/* 100 */ OverlayIndex_MapD3,
|
||||
/* 101 */ OverlayIndex_MapD4,
|
||||
/* 102 */ OverlayIndex_MapD5,
|
||||
/* 103 */ OverlayIndex_PlayerTornado,
|
||||
/* 104 */ OverlayIndex_PlayerBoomerang,
|
||||
/* 105 */ OverlayIndex_PlayerWhip,
|
||||
/* 106 */ OverlayIndex_PlayerBow,
|
||||
/* 107 */ OverlayIndex_PlayerSandrock,
|
||||
/* 108 */ OverlayIndex_PlayerBomb,
|
||||
/* 109 */ OverlayIndex_PlayerPanFlute,
|
||||
/* 110 */ OverlayIndex_PlayerGet,
|
||||
/* 111 */ OverlayIndex_PlayerDown,
|
||||
/* 112 */ OverlayIndex_PlayerSceneChange,
|
||||
/* 113 */ OverlayIndex_PlayerDemo,
|
||||
/* 114 */ OverlayIndex_COUNT,
|
||||
};
|
||||
|
||||
typedef u32 OverlaySlot;
|
||||
enum OverlaySlot_ {
|
||||
/* 00 */ OverlaySlot_Second,
|
||||
/* 01 */ OverlaySlot_1,
|
||||
/* 02 */ OverlaySlot_2,
|
||||
/* 03 */ OverlaySlot_3,
|
||||
/* 04 */ OverlaySlot_4,
|
||||
/* 05 */ OverlaySlot_5,
|
||||
/* 06 */ OverlaySlot_6,
|
||||
/* 07 */ OverlaySlot_7,
|
||||
/* 08 */ OverlaySlot_8,
|
||||
/* 09 */ OverlaySlot_9,
|
||||
/* 10 */ OverlaySlot_10,
|
||||
/* 11 */ OverlaySlot_11,
|
||||
/* 12 */ OverlaySlot_12,
|
||||
/* 13 */ OverlaySlot_13,
|
||||
/* 14 */ OverlaySlot_14,
|
||||
/* 15 */ OverlaySlot_15,
|
||||
/* 16 */ OverlaySlot_16,
|
||||
/* 17 */ OverlaySlot_17,
|
||||
/* 18 */ OverlaySlot_COUNT,
|
||||
};
|
||||
|
||||
class OverlayManager {
|
||||
public:
|
||||
OverlayId mLoadedOverlays[OverlayIndex_COUNT];
|
||||
OverlayId mLoadedOverlays[OverlaySlot_COUNT];
|
||||
|
||||
void Load(OverlayIndex index, OverlayId id);
|
||||
void LoadIfNotLoaded(OverlayIndex index, OverlayId id);
|
||||
void Unload(OverlayIndex index);
|
||||
void Load(OverlaySlot index, OverlayId id);
|
||||
void LoadIfNotLoaded(OverlaySlot index, OverlayId id);
|
||||
void Unload(OverlaySlot index);
|
||||
void LoadOverlaySetup(s32 index);
|
||||
void UnloadOverlaySetup();
|
||||
|
||||
@@ -275,3 +394,5 @@ class OverlayManager {
|
||||
};
|
||||
|
||||
extern OverlayManager gOverlayManager;
|
||||
extern u32 data_0203e0e8[OverlayIndex_COUNT];
|
||||
extern char* data_02043c88[OverlayIndex_COUNT];
|
||||
|
||||
@@ -25,11 +25,10 @@ struct OverlaySetup {
|
||||
extern OverlaySetup gOverlaySetups[];
|
||||
|
||||
extern u32* data_027e0ce0[];
|
||||
extern u32 data_0203e0e8[]; // seems to contain overlay IDs
|
||||
extern "C" void func_ov007_02102850(u32**);
|
||||
extern "C" void func_ov007_021028a0(u32**);
|
||||
|
||||
THUMB void OverlayManager::LoadIfNotLoaded(OverlayIndex index, OverlayId id) {
|
||||
THUMB void OverlayManager::LoadIfNotLoaded(OverlaySlot index, OverlayId id) {
|
||||
OverlayId loadedId = gOverlayManager.mLoadedOverlays[index];
|
||||
|
||||
if (id != loadedId) {
|
||||
@@ -38,7 +37,7 @@ THUMB void OverlayManager::LoadIfNotLoaded(OverlayIndex index, OverlayId id) {
|
||||
}
|
||||
}
|
||||
|
||||
THUMB void OverlayManager::Load(OverlayIndex index, OverlayId id) {
|
||||
THUMB void OverlayManager::Load(OverlaySlot index, OverlayId id) {
|
||||
if (id != OverlayId_None) {
|
||||
FS_LoadOverlay(NULL, data_0203e0e8[id]);
|
||||
}
|
||||
@@ -46,7 +45,7 @@ THUMB void OverlayManager::Load(OverlayIndex index, OverlayId id) {
|
||||
gOverlayManager.mLoadedOverlays[index] = id;
|
||||
}
|
||||
|
||||
THUMB void OverlayManager::Unload(OverlayIndex index) {
|
||||
THUMB void OverlayManager::Unload(OverlaySlot index) {
|
||||
OverlayId loadedId = gOverlayManager.mLoadedOverlays[index];
|
||||
|
||||
if (loadedId != OverlayId_None) {
|
||||
@@ -55,16 +54,14 @@ THUMB void OverlayManager::Unload(OverlayIndex index) {
|
||||
}
|
||||
}
|
||||
|
||||
//! TODO: solve the .word issue with the overlay IDs
|
||||
//! both functions should match otherwise
|
||||
THUMB void OverlayManager::LoadOverlaySetup(s32 index) {
|
||||
OverlayId overlayId;
|
||||
OverlaySetup* pSetup;
|
||||
|
||||
pSetup = &gOverlaySetups[index];
|
||||
|
||||
this->LoadIfNotLoaded(OverlayIndex_1, pSetup->slot1Overlay);
|
||||
this->LoadIfNotLoaded(OverlayIndex_2, pSetup->slot2Overlay);
|
||||
this->LoadIfNotLoaded(OverlaySlot_1, pSetup->slot1Overlay);
|
||||
this->LoadIfNotLoaded(OverlaySlot_2, pSetup->slot2Overlay);
|
||||
|
||||
if (index == 5) {
|
||||
func_ov007_02102850(data_027e0ce0);
|
||||
@@ -75,17 +72,17 @@ THUMB void OverlayManager::LoadOverlaySetup(s32 index) {
|
||||
overlayId = OverlayId_CastleTown;
|
||||
}
|
||||
|
||||
this->Load(OverlayIndex_3, pSetup->slot3Overlay);
|
||||
this->Load(OverlayIndex_12, overlayId);
|
||||
this->Load(OverlaySlot_3, pSetup->slot3Overlay);
|
||||
this->Load(OverlaySlot_12, overlayId);
|
||||
}
|
||||
}
|
||||
|
||||
THUMB void OverlayManager::UnloadOverlaySetup() {
|
||||
this->Unload(OverlayIndex_12);
|
||||
this->Unload(OverlayIndex_3);
|
||||
this->Unload(OverlaySlot_12);
|
||||
this->Unload(OverlaySlot_3);
|
||||
|
||||
if (this->mLoadedOverlays[2] == OverlayId_RailEdit) {
|
||||
func_ov007_021028a0(data_027e0ce0);
|
||||
this->Unload(OverlayIndex_2);
|
||||
this->Unload(OverlaySlot_2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user