mirror of
https://github.com/zeldaret/st
synced 2026-06-02 10:10:19 -04:00
update overlaymanager
This commit is contained in:
@@ -240,6 +240,7 @@ typedef u32 OverlayId;
|
||||
|
||||
typedef u32 OverlayIndex;
|
||||
enum OverlayIndex_ {
|
||||
/* -1 */ OverlayIndex_None = -1,
|
||||
/* 000 */ OverlayIndex_Second,
|
||||
/* 001 */ OverlayIndex_SceneInit,
|
||||
/* 002 */ OverlayIndex_Collect,
|
||||
@@ -382,11 +383,11 @@ enum OverlaySlot_ {
|
||||
|
||||
class OverlayManager {
|
||||
public:
|
||||
OverlayId mLoadedOverlays[OverlaySlot_COUNT];
|
||||
OverlayIndex mLoadedOverlays[OverlaySlot_COUNT];
|
||||
|
||||
void Load(OverlaySlot index, OverlayId id);
|
||||
void LoadIfNotLoaded(OverlaySlot index, OverlayId id);
|
||||
void Unload(OverlaySlot index);
|
||||
void Load(OverlaySlot slot, OverlayIndex index);
|
||||
void LoadIfNotLoaded(OverlaySlot slot, OverlayIndex index);
|
||||
void Unload(OverlaySlot slot);
|
||||
void LoadOverlaySetup(s32 index);
|
||||
void UnloadOverlaySetup();
|
||||
|
||||
|
||||
@@ -28,29 +28,29 @@ extern u32* data_027e0ce0[];
|
||||
extern "C" void func_ov007_02102850(u32**);
|
||||
extern "C" void func_ov007_021028a0(u32**);
|
||||
|
||||
THUMB void OverlayManager::LoadIfNotLoaded(OverlaySlot index, OverlayId id) {
|
||||
OverlayId loadedId = gOverlayManager.mLoadedOverlays[index];
|
||||
THUMB void OverlayManager::LoadIfNotLoaded(OverlaySlot slot, OverlayIndex index) {
|
||||
OverlayIndex loadedIndex = gOverlayManager.mLoadedOverlays[slot];
|
||||
|
||||
if (id != loadedId) {
|
||||
this->Unload(index);
|
||||
this->Load(index, id);
|
||||
if (index != loadedIndex) {
|
||||
this->Unload(slot);
|
||||
this->Load(slot, index);
|
||||
}
|
||||
}
|
||||
|
||||
THUMB void OverlayManager::Load(OverlaySlot index, OverlayId id) {
|
||||
if (id != OverlayId_None) {
|
||||
FS_LoadOverlay(NULL, data_0203e0e8[id]);
|
||||
THUMB void OverlayManager::Load(OverlaySlot slot, OverlayIndex index) {
|
||||
if (index != OverlayIndex_None) {
|
||||
FS_LoadOverlay(NULL, data_0203e0e8[index]);
|
||||
}
|
||||
|
||||
gOverlayManager.mLoadedOverlays[index] = id;
|
||||
gOverlayManager.mLoadedOverlays[slot] = index;
|
||||
}
|
||||
|
||||
THUMB void OverlayManager::Unload(OverlaySlot index) {
|
||||
THUMB void OverlayManager::Unload(OverlaySlot slot) {
|
||||
OverlayManager* pOverlayManager = &gOverlayManager;
|
||||
|
||||
if (pOverlayManager->mLoadedOverlays[index] != OverlayId_None) {
|
||||
FS_UnloadOverlay(NULL, data_0203e0e8[pOverlayManager->mLoadedOverlays[index]]);
|
||||
pOverlayManager->mLoadedOverlays[index] = OverlayId_None;
|
||||
if (pOverlayManager->mLoadedOverlays[slot] != OverlayIndex_None) {
|
||||
FS_UnloadOverlay(NULL, data_0203e0e8[pOverlayManager->mLoadedOverlays[slot]]);
|
||||
pOverlayManager->mLoadedOverlays[slot] = OverlayIndex_None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user