Decompile overlay 1 (Part 4) (#97)

* UnkStruct_027e095c_001 OK

* UnkStruct_027e095c_001 OK (JP)

* SysNew_001 OK

* SaveManager_001 98%

* UnkStruct_027e09bc_001 OK

* MapObjectManager_001 OK

* ActorManager_001 OK

* remove useless thumb pragmas

* ItemManager_001 OK

* fix regressions

* fix build issues
This commit is contained in:
Yanis
2026-07-02 20:56:08 +02:00
committed by GitHub
parent 66eb66f081
commit f0dfb70749
73 changed files with 1223 additions and 440 deletions
+23 -22
View File
@@ -14,19 +14,19 @@ const u8 gBombBagCapacities[UpgradeCapacity_Max] = {
CAPACITY_BOMB_BAG_TIER_3,
};
void ItemManager::SetFlag(ItemFlag itemFlag) {
void Inventory::SetFlag(ItemFlag itemFlag) {
SET_FLAG(this->mFlags, itemFlag);
}
void ItemManager::ClearFlag(ItemFlag itemFlag) {
void Inventory::ClearFlag(ItemFlag itemFlag) {
UNSET_FLAG(this->mFlags, itemFlag);
}
bool ItemManager::HasRecruitUniform() {
bool Inventory::HasRecruitUniform() {
return GET_FLAG(this->mFlags, ItemFlag_RecruitUniform) && (this->mUnk_12 & 1);
}
unk32 ItemManager::func_ov000_020a86a4() {
unk32 Inventory::func_ov000_020a86a4() {
if (GET_FLAG(this->mFlags, ItemFlag_AncientShield) && (this->mUnk_12 & 2)) {
return 1;
}
@@ -38,7 +38,7 @@ unk32 ItemManager::func_ov000_020a86a4() {
return -1;
}
u32 ItemManager::GetItemAmount(ItemFlag itemFlag) {
u32 Inventory::GetItemAmount(ItemFlag itemFlag) {
bool canUse = GET_FLAG(this->mFlags, itemFlag);
switch (itemFlag) {
@@ -53,7 +53,7 @@ u32 ItemManager::GetItemAmount(ItemFlag itemFlag) {
return canUse;
}
u8 ItemManager::GetQuiverCapacity() {
u8 Inventory::GetQuiverCapacity() {
if (GET_FLAG(this->mFlags, ItemFlag_Bow) == 0) {
return 0;
}
@@ -61,7 +61,7 @@ u8 ItemManager::GetQuiverCapacity() {
return gQuiverCapacities[this->mQuiverCapacity];
}
u8 ItemManager::GetBombBagCapacity() {
u8 Inventory::GetBombBagCapacity() {
if (GET_FLAG(this->mFlags, ItemFlag_Bombs) == 0) {
return 0;
}
@@ -69,12 +69,12 @@ u8 ItemManager::GetBombBagCapacity() {
return gBombBagCapacities[this->mBombBagCapacity];
}
void ItemManager::GiveRupees(s32 amount, bool param2, bool param3) {
void Inventory::GiveRupees(s32 amount, bool param2, bool param3) {
u16 prevNumRupees = this->mNumRupees;
s32 newAmount = this->mNumRupees + amount;
if (newAmount > 9999) {
newAmount = 9999;
if (newAmount > MAX_RUPEES) {
newAmount = MAX_RUPEES;
} else if (newAmount < 0) {
newAmount = 0;
}
@@ -86,7 +86,7 @@ void ItemManager::GiveRupees(s32 amount, bool param2, bool param3) {
}
}
void ItemManager::GiveSmallKeys(s32 amount) {
void Inventory::GiveSmallKeys(s32 amount) {
s32 newAmount = this->mKeyAmount + amount;
if (newAmount > MAX_KEYS) {
@@ -98,7 +98,7 @@ void ItemManager::GiveSmallKeys(s32 amount) {
this->mKeyAmount = newAmount;
}
void ItemManager::GiveArrows(s32 amount) {
void Inventory::GiveArrows(s32 amount) {
s32 maxArrows = this->GetQuiverCapacity();
s32 newAmount = this->mArrowAmount + amount;
@@ -111,7 +111,7 @@ void ItemManager::GiveArrows(s32 amount) {
this->mArrowAmount = newAmount;
}
void ItemManager::GiveBombs(s32 amount) {
void Inventory::GiveBombs(s32 amount) {
s32 maxBombs = this->GetBombBagCapacity();
s32 newAmount = this->mBombAmount + amount;
@@ -124,7 +124,7 @@ void ItemManager::GiveBombs(s32 amount) {
this->mBombAmount = newAmount;
}
bool ItemManager::TryEquipForcedItem() {
bool Inventory::TryEquipForcedItem() {
if (this->mForcedItem != ItemFlag_None) {
this->mEquippedItem = this->mForcedItem;
this->mForcedItem = ItemFlag_None;
@@ -135,7 +135,7 @@ bool ItemManager::TryEquipForcedItem() {
return false;
}
void ItemManager::GivePotion(PotionType type) {
void Inventory::GivePotion(PotionType type) {
switch (type) {
case PotionType_Red:
case PotionType_Purple:
@@ -152,7 +152,7 @@ void ItemManager::GivePotion(PotionType type) {
}
}
bool ItemManager::HasPotion() {
bool Inventory::HasPotion() {
for (u32 i = 0; i < ARRAY_LEN(this->mPotions); i++) {
if (this->mPotions[i] != PotionType_None) {
return true;
@@ -162,7 +162,7 @@ bool ItemManager::HasPotion() {
return false;
}
bool ItemManager::HasPurplePotion() {
bool Inventory::HasPurplePotion() {
for (u32 i = 0; i < ARRAY_LEN(this->mPotions); i++) {
if (this->mPotions[i] == PotionType_Purple) {
return true;
@@ -172,7 +172,7 @@ bool ItemManager::HasPurplePotion() {
return false;
}
void ItemManager::RemovePurplePotion() {
void Inventory::RemovePurplePotion() {
for (s32 i = ARRAY_LEN(this->mPotions) - 1; i >= 0; i--) {
if (this->mPotions[i] == PotionType_Purple) {
this->mPotions[i] = PotionType_None;
@@ -181,7 +181,7 @@ void ItemManager::RemovePurplePotion() {
}
}
bool ItemManager::PotionSlotsFull() {
bool Inventory::PotionSlotsFull() {
for (u32 i = 0; i < ARRAY_LEN(this->mPotions); i++) {
if (this->mPotions[i] == PotionType_None) {
return false;
@@ -228,12 +228,13 @@ bool ItemManager::func_ov000_020a89d4() {
}
bool ItemManager::func_ov000_020a8a0c() {
if (this->mUnk_20 == NULL || this->mEquippedItem == ItemFlag_None ||
IS_ITEM_RESTRICTED(this->mItemRestrictions, this->mEquippedItem) || this->GetItemAmount(this->mEquippedItem) == 0) {
if (this->mUnk_20 == NULL || this->GetCurrentItem() == ItemFlag_None ||
IS_ITEM_RESTRICTED(this->GetRestrictions(), this->GetCurrentItem()) ||
this->mInventory.GetItemAmount(this->GetCurrentItem()) == 0) {
return false;
}
return this->mUnk_20->func_ov031_020db874(this->mEquippedItem);
return this->mUnk_20->func_ov031_020db874(this->GetCurrentItem());
}
void ItemManager::func_ov000_020a8a5c() {
+17 -20
View File
@@ -12,7 +12,6 @@
extern "C" {
void func_ov000_020977e4();
void func_ov001_020ba59c(void *);
void func_ov021_020f8818();
void func_ov031_020ea100();
void func_ov071_0215e8d4();
@@ -31,8 +30,6 @@ const ActorId data_ov001_020c2638[] = {ActorId_FOMC, ActorId_FOMA, ActorId_FOMB,
const u16 data_ov001_020c2624[] = {0x01AE, 0x01AF, 0x01B0, 0x01B1, 0x01B2};
const u16 data_ov001_020c262e[] = {0x01CB, 0x01CC, 0x01CD, 0x01CE, 0x01CF};
THUMB_BEGIN
ActorManager *ActorManager::Create() {
return new(1, 4) ActorManager();
}
@@ -82,7 +79,6 @@ void ActorManager::func_ov001_020bafdc() {
}
}
// https://decomp.me/scratch/UywfM
void ActorManager::func_ov001_020bb018(ZOBHeader *pHeader) {
u16 unk_0A = pHeader->unk_0A;
u16 unk_08 = pHeader->unk_08;
@@ -109,19 +105,17 @@ void ActorManager::func_ov001_020bb018(ZOBHeader *pHeader) {
}
this->mActorTable = (Actor **) ::operator new(allocCount * 4, HeapIndex_1);
this->mActorTableEnd = this->mActorTable + allocCount * 4;
this->mActorTableEnd = (Actor **) ((uintptr_t) this->mActorTable + allocCount * 4);
size_t iVar9 = ((this->mActorTable + allocCount * 4) - this->mActorTable);
MI_CpuFill32(0, this->mActorTable, (iVar9 * 4));
MI_CpuFill32(0, this->mActorTable, (this->mActorTableEnd - this->mActorTable) * 4);
this->mUnk_08 = this->mActorTable;
data_0204999c.func_ov001_020ba588(aligned08 + iVar5, 0x100);
// it's 2 when we are on the title screen and 0 during normal gameplay, is it the game mode ?
if (data_027e09a4->mUnk_60 != 2) {
unk32 iVar5;
if (data_027e09a4->IsLand() != 0) {
iVar5 = data_027e09a4->CurrentSceneIndex();
unk32 iVar5 = data_027e09a4->CurrentSceneIndex();
OverlayManager *pMgr;
if (iVar5 == SceneIndex_f_rabbit) {
this->mUnk_34 = 0xFFFFECCD; // ~0x1332
@@ -135,13 +129,17 @@ void ActorManager::func_ov001_020bb018(ZOBHeader *pHeader) {
auStack_28.func_ov000_02059270(0x08, "zdf_sword02", 0x19150000);
auStack_28.func_ov000_02059270(0x0A, "whip", 0x28000000);
auStack_28.func_ov000_02059270(0x0C, "rupy0", 0x2D200000);
char *str = "rupy0";
auStack_28.func_ov000_02059270(0x0C, str, 0x2D200000);
auStack_28.func_ov000_02059288(0x0D, "rupy1", 0x0C);
auStack_28.func_ov000_02059288(0x0E, "rupy2", 0x0C);
auStack_28.func_ov000_02059288(0x0F, "rupy3", 0x0C);
auStack_28.func_ov000_02059270(0x10, "life0", 0x2D200000);
auStack_28.func_ov000_02059270(0x1D, "arrow", 0x2D200000);
pMgr = &gOverlayManager;
auStack_28.func_ov000_02059270(0x1E, "bomb", 0x2D200000);
auStack_28.func_ov000_02059270(0x1F, "drug", 0x2D200000);
auStack_28.func_ov000_02059270(0x20, "drop0", 0x2D200000);
@@ -160,31 +158,32 @@ void ActorManager::func_ov001_020bb018(ZOBHeader *pHeader) {
auStack_28.func_ov000_02059270(0x3C, "mic_ng", 0x35B00000);
}
if (gOverlayManager.mLoadedOverlays[OverlaySlot_8] == OverlayIndex_BossDeago) {
if (pMgr->IsBossDeago()) {
auStack_28.func_ov000_02059270(0x09, "bdga_chain", 0x28000000);
}
if (gOverlayManager.mLoadedOverlays[OverlaySlot_8] == OverlayIndex_BossLast1) {
if (pMgr->IsBossLast1()) {
auStack_28.func_ov000_02059270(0x0B, "kimrat", 0x28000000);
}
}
if (gOverlayManager.mLoadedOverlays[OverlaySlot_8] == OverlayIndex_Tower) {
if (pMgr->IsTower()) {
UnkStruct_StackTitleScreen auStack_3c("Screen/tex2d.bin", 1);
auStack_3c.func_ov000_02059270(0x34, "baloon", 0x28A00000);
auStack_3c.func_ov000_02059270(0x35, "dot", 0x28000000);
}
if (gOverlayManager.mLoadedOverlays[OverlaySlot_8] == OverlayIndex_BossDeago) {
if (pMgr->IsBossDeago()) {
UnkStruct_StackTitleScreen auStack_50("Screen/tex2d.bin", 1);
auStack_50.func_ov000_02059270(0x30, "deagohit", 0x29200000);
auStack_50.func_ov000_02059270(0x31, "deagotarget", 0x29200000);
}
if (gOverlayManager.mLoadedOverlays[OverlaySlot_8] == OverlayIndex_BossLast2) {
if (pMgr->IsBossLast2()) {
UnkStruct_StackTitleScreen auStack_64("Screen/tex2d.bin", 1);
auStack_64.func_ov000_02059270(0x32, "zeldahit", 0x29200000);
auStack_64.func_ov000_02059270(0x33, "zeldatarget", 0x2D200000);
char *str = "zeldatarget";
auStack_64.func_ov000_02059270(0x33, str, 0x2D200000);
}
} else if (data_027e09a4->IsTrain()) {
UnkStruct_StackTitleScreen auStack_78("Npc/Tex.bin", 1);
@@ -207,7 +206,7 @@ void ActorManager::func_ov001_020bb018(ZOBHeader *pHeader) {
}
void ActorManager::func_ov001_020bb414() {
func_ov001_020ba59c(&data_0204999c);
data_0204999c.func_ov001_020ba59c();
if (data_027e09a4->UnkCheck(data_027e09a4->CurrentSceneIndex())) {
this->func_ov001_020bb844();
@@ -400,5 +399,3 @@ void ActorManager::func_ov001_020bb844() {
}
DECL_INSTANCE(ActorManager, gpActorManager);
THUMB_END
-4
View File
@@ -2,8 +2,6 @@
#include "Unknown/UnkStruct_027e09a4.hpp"
#include "global.h"
THUMB_BEGIN
CargoManager::CargoManager() {
this->mUnk_18 = 0;
this->mUnk_1C = 0;
@@ -21,5 +19,3 @@ void CargoManager::func_ov001_020bf830() {
}
DECL_INSTANCE(CargoManager, gpCargoManager);
THUMB_END
@@ -23,8 +23,6 @@ void *func_ov000_02066294();
extern int data_ov001_020c27a8;
extern int data_ov001_020c276c;
THUMB_BEGIN
AdventureModeManager *AdventureModeManager::Create(unk32 param1) {
return new(HeapIndex_1) AdventureModeManager(param1);
}
@@ -325,5 +323,3 @@ AdventureModeManager_15C::AdventureModeManager_15C() :
AdventureModeManager_15C::~AdventureModeManager_15C() {
delete this->mUnk_20.mUnk_00;
}
THUMB_END
@@ -11,8 +11,6 @@ void func_0201659c();
extern int data_ov001_020c27a8;
extern int data_ov001_020c276c;
THUMB_BEGIN
GameModeAdventure::GameModeAdventure() {
func_0201659c();
gGame.func_02013370(2);
@@ -21,5 +19,3 @@ GameModeAdventure::GameModeAdventure() {
gSaveManager.func_ov001_020ba7a8();
func_ov020_020c4ac0(UnkStruct_027e09a4::Create(0));
}
THUMB_END
+117 -3
View File
@@ -1,12 +1,104 @@
#include "Actor/ActorManager.hpp"
#include "Item/ItemManager.hpp"
#include "Save/SaveManager.hpp"
#include "System/OverlayManager.hpp"
#include "Unknown/UnkStruct_027e09a0.hpp"
#include "Unknown/UnkStruct_027e09a4.hpp"
THUMB_BEGIN
#include <nitro/mi.h>
void ItemManager::func_ov001_020bb9f8() {
extern unk32 data_ov000_020b3000;
Inventory::Inventory() {
this->mEquippedItem = ItemFlag_None;
this->mForcedItem = ItemFlag_None;
MI_CpuFill32(0, this->mFlags, sizeof(this->mFlags));
this->mNumRupees = 0;
this->mUnk_12 = 0;
this->mItemRestrictions = 0;
this->mTearsAmount = 0;
this->mKeyAmount = 0;
this->mQuiverCapacity = 0;
this->mBombBagCapacity = 0;
this->mArrowAmount = 0;
this->mBombAmount = 0;
for (u32 i = 0; i < ARRAY_LEN(this->mPotions); i++) {
this->mPotions[i] = 0;
}
}
Inventory::~Inventory() {}
void Inventory::func_ov001_020bb8bc(const InvImportData *pSrc) {
this->mEquippedItem = pSrc->equippedItem;
MI_CpuCopy32((void *) &pSrc->flags, this->mFlags, sizeof(this->mFlags));
this->mNumRupees = pSrc->numRupees;
vu16 stack_unused = pSrc->unk_0E;
this->mUnk_12 = pSrc->unk_0E;
this->mQuiverCapacity = pSrc->quiverCapacity;
this->mBombBagCapacity = pSrc->bombBagCapacity;
this->mArrowAmount = pSrc->arrowAmount;
this->mBombAmount = pSrc->bombsAmount;
this->mPotions[0] = pSrc->potion1;
this->mPotions[1] = pSrc->potion2;
if ((s32) this->mEquippedItem < ItemFlag_None) {
this->mEquippedItem = ItemFlag_None;
}
if ((s32) this->mEquippedItem > ItemFlag_SandRod) {
this->mEquippedItem = ItemFlag_SandRod;
}
if ((s32) this->mEquippedItem != ItemFlag_None) {
if (!GET_FLAG(this->mFlags, this->mEquippedItem)) {
this->mEquippedItem = ItemFlag_None;
}
}
if (this->mEquippedItem == ItemFlag_None) {
for (u32 i = 0; i < ItemFlag_EQUIP_COUNT; i++) {
if (GET_FLAG(this->mFlags, i)) {
this->mEquippedItem = i;
break;
}
}
}
if (this->mNumRupees > MAX_RUPEES) {
this->mNumRupees = MAX_RUPEES;
}
if ((*(vu16 *) &this->mUnk_12 & 0x01) && !GET_FLAG(this->mFlags, ItemFlag_RecruitUniform)) {
this->mUnk_12 &= ~0x01;
}
if ((*(vu16 *) &this->mUnk_12 & 0x02) && !GET_FLAG(this->mFlags, ItemFlag_AncientShield)) {
this->mUnk_12 &= ~0x02;
}
if (this->mQuiverCapacity > UpgradeCapacity_Tier3) {
this->mQuiverCapacity = UpgradeCapacity_Tier3;
}
if (this->mBombBagCapacity > UpgradeCapacity_Tier3) {
this->mBombBagCapacity = UpgradeCapacity_Tier3;
}
if (this->mArrowAmount > this->GetQuiverCapacity()) {
this->mArrowAmount = this->GetQuiverCapacity();
}
if (this->mBombAmount > this->GetBombBagCapacity()) {
this->mBombAmount = this->GetBombBagCapacity();
}
}
void Inventory::func_ov001_020bb9f8() {
if (data_027e09a4->IsNotCutscene() && gOverlayManager.mLoadedOverlays[OverlaySlot_10] != OverlayIndex_PlayerPhantom) {
this->mTearsAmount = 0;
}
@@ -24,4 +116,26 @@ void ItemManager::func_ov001_020bb9f8() {
}
}
THUMB_END
void Inventory::func_ov001_020bba54() {
this->mItemRestrictions = 0;
if (gOverlayManager.IsPlayerZelda()) {
this->func_ov096_02179b20();
}
}
void Inventory::func_ov001_020bba6c() {
struct {
void *ptr;
unk32 actorId;
} uStack_18;
uStack_18.ptr = &data_ov000_020b3000;
uStack_18.actorId = ActorId_SZKU;
Actor **ppActor = gpActorManager->func_01fff350(&uStack_18, gpActorManager->mActorTable);
while (ppActor != gpActorManager->mUnk_08) {
UNSET_FLAG((*ppActor)->mFlags, ActorFlag_Alive);
(*ppActor)->func_ov000_020984f0();
ppActor = gpActorManager->func_01fff350(&uStack_18, ppActor + 1);
}
}
@@ -0,0 +1,211 @@
#include "Actor/ActorUnkPMST.hpp"
#include "Actor/ActorUnkPMTT.hpp"
#include "MapObject/MapObjectManager.hpp"
#include "System/OverlayManager.hpp"
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_027e09a4.hpp"
#include "Unknown/UnkStruct_ov000_020b5d34.hpp"
#include "versions.h"
#include <nitro/mi.h>
extern "C" bool func_ov026_0210d664(SceneIndex sceneIndex, MapObjectId mapObjId);
MapObjectManager *MapObjectManager::Create() {
return new(HeapIndex_1) MapObjectManager();
}
MapObjectManager::MapObjectManager() {
this->mMapObjTable = NULL;
this->mMapObjTableEnd = NULL;
this->mUnk_0C = NULL;
this->mUnk_10 = NULL;
this->mUnk_14 = NULL;
this->mUnk_6C = &this->mUnk_1C;
}
MapObjectManager::~MapObjectManager() {
if (this->mUnk_0C != NULL) {
delete this->mUnk_0C;
}
if (this->mMapObjTable != NULL) {
delete this->mMapObjTable;
}
}
void MapObjectManager::func_ov001_020bac9c() {
MapObject **ppMapObjTable = this->mMapObjTable;
while (ppMapObjTable != this->mUnk_08) {
MapObject *pMapObj = *ppMapObjTable;
if (pMapObj != NULL) {
// alive and uninitialized?
if (GET_FLAG(pMapObj->mFlags, MapObjFlag_Alive) && !GET_FLAG(pMapObj->mFlags, MapObjFlag_4)) {
pMapObj->vfunc_04();
SET_FLAG(pMapObj->mFlags, MapObjFlag_4);
}
}
ppMapObjTable++;
}
}
void MapObjectManager::func_ov001_020bacd8(ZOBHeader *pHeader) {
u16 unk_0A = pHeader->unk_0A;
u16 unk_08 = pHeader->unk_08;
this->mUnk_18 = 0;
this->mUnk_1A = 0;
int aligned0A = ALIGN_NEXT(unk_0A, 8);
int aligned08 = ALIGN_NEXT(unk_08, 8);
int iVar5 = data_027e09a0->func_ov000_020702a8(data_027e09a4->CurrentSceneIndex())->mUnk_22;
s32 allocCount;
if (data_027e09a4->IsTrain()) {
if (data_027e09a4->GetCurrentCourseEntry()->unk_10 == 4) {
allocCount = aligned0A + 0x80;
} else {
allocCount = aligned0A + 0x40;
}
} else if (gOverlayManager.IsBossDesert()) {
allocCount = aligned0A + 0x40;
} else {
allocCount = aligned0A + 0x18;
}
if (this->mMapObjTable != NULL) {
delete this->mMapObjTable;
}
this->mMapObjTable = (MapObject **) ::operator new(allocCount * 4, HeapIndex_1);
this->mMapObjTableEnd = (MapObject **) ((uintptr_t) this->mMapObjTable + allocCount * 4);
MI_CpuFill32(0, this->mMapObjTable, (this->mMapObjTableEnd - this->mMapObjTable) * 4);
this->mUnk_08 = this->mMapObjTable;
data_0204999c.func_ov001_020ba5ac(aligned08 + iVar5, 0x80);
}
void MapObjectManager::func_ov001_020bad80() {
data_0204999c.func_ov001_020ba5c0();
if (this->mMapObjTable != 0) {
delete this->mMapObjTable;
}
this->mMapObjTable = NULL;
this->mMapObjTableEnd = NULL;
}
void MapObjectManager::func_ov001_020bada0() {
if (gOverlayManager.IsDungeonForest()) {
ActorUnkPMST::func_ov077_02159db4();
}
#if IS_JP
if (gOverlayManager.IsMapB3()) {
ActorUnkPMTT::func_ov042_0212d8a4();
}
#endif
}
void MapObjectManager::func_ov001_020badb4() {
int i = 0;
MapObject **ppMapObjTable = this->mMapObjTable;
while (ppMapObjTable < this->mUnk_08) {
MapObject *pMapObj = *ppMapObjTable;
if (pMapObj != NULL) {
this->func_ov000_0209c444(i);
}
ppMapObjTable++;
i++;
}
this->mUnk_08 = this->mMapObjTable;
}
void MapObjectManager::func_ov001_020bade0() {
MapObjectProfile **ptr1 = data_ov000_020b5d34.func_ov000_0209c6a0();
MapObjectProfile **ptr2 = data_ov000_020b5d34.func_ov000_0209c6ac();
while (ptr1 != ptr2) {
if (*ptr1 != NULL) {
bool iVar4 = false;
if (data_027e09a4->IsTrain()) {
iVar4 = func_ov026_0210d664(data_027e09a4->CurrentSceneIndex(), (*ptr1)->mMapObjId);
}
if ((*ptr1)->mUnk_1C && !iVar4) {
MapObjectProfile::func_ov000_0209c8ec((*ptr1));
}
}
ptr1++;
ptr2 = data_ov000_020b5d34.func_ov000_0209c6ac();
}
}
void MapObjectManager::func_ov001_020bae40(ZeldaObjectList *pObjList) {
for (s32 i = 0; i < pObjList->header.nEntries; i++) {
MapObjectProfile::func_ov000_0209c8ec(data_ov000_020b5d34.GetProfileFromId(pObjList->aIdList[i]));
}
}
void MapObjectManager::func_ov001_020bae6c() {
MapObjectProfile **ptr1 = data_ov000_020b5d34.func_ov000_0209c6a0();
MapObjectProfile **ptr2 = data_ov000_020b5d34.func_ov000_0209c6ac();
while (ptr1 != ptr2) {
if (*ptr1 != NULL) {
(*ptr1)->func_ov000_0209c970();
}
ptr1++;
ptr2 = data_ov000_020b5d34.func_ov000_0209c6ac();
}
}
void MapObjectManager::func_ov001_020baea0(u16 *param1) {
this->mUnk_14 = (s16 *) ::operator new(param1[0] * param1[1] * sizeof(s16), HeapIndex_1);
MI_CpuFill16(0xFFFF, this->mUnk_14, param1[0] * param1[1] * 2);
u16 param1_1 = param1[1];
if (this->mUnk_0C != NULL) {
delete this->mUnk_0C;
}
this->mUnk_0C = (s16 **) ::operator new(param1_1 * 4, HeapIndex_1);
this->mUnk_10 = (s16 **) ((uintptr_t) this->mUnk_0C + param1_1 * 4);
for (u32 i = 0; i < this->mUnk_10 - this->mUnk_0C; i++) {
this->mUnk_0C[i] = &this->mUnk_14[param1[0] * i];
}
this->mUnk_18 = param1[0];
this->mUnk_1A = param1[1];
}
void MapObjectManager::func_ov001_020baf28() {
if (this->mUnk_0C != NULL) {
delete this->mUnk_0C;
}
this->mUnk_0C = NULL;
this->mUnk_10 = NULL;
DELETE(this->mUnk_14);
this->mUnk_18 = 0;
this->mUnk_1A = 0;
}
DECL_INSTANCE(MapObjectManager, gpMapObjManager);
@@ -1,7 +1,5 @@
#include "MainGame/PassengerManager.hpp"
THUMB_BEGIN
inline bool Test(s32 val) {
bool ret = false;
@@ -79,5 +77,3 @@ bool PassengerManager::func_ov001_020bfa1c() {
}
DECL_INSTANCE(PassengerManager, gpPassengerManager);
THUMB_END
+85 -12
View File
@@ -1,28 +1,101 @@
#include "Game/Game.hpp"
#include "Save/SaveManager.hpp"
#include "Unknown/UnkStruct_02049b80.hpp"
#include "Unknown/UnkStruct_ov000_020b50c0.hpp"
THUMB_BEGIN
extern "C" unk32 func_020328c8(void *, void *, size_t);
void SaveManager::func_ov001_020ba670() {
this->mUnk_000 = new(HeapIndex_1) SaveManager_00(0);
SaveSlot *pSaveSlot = gGame.mpSaveSlot;
this->mUnk_000->unk_00 = pSaveSlot->mInfoData[0].unk_000;
MI_CpuCopyFast(&pSaveSlot->mInfoData[0].unk_158, &this->mUnk_000->unk_004, sizeof(SaveFile_00000_0000_Data_158));
GameSaveSlot *pGameSlot = gGame.mpSaveSlot;
this->mUnk_000->unk_00 = pGameSlot->mInfoData.unk_000;
MI_CpuCopyFast(&pGameSlot->mInfoData.unk_158, &this->mUnk_000->unk_004, sizeof(SaveFile_00000_0000_Data_158));
for (int i = 0; i < ARRAY_LEN(this->mUnk_000->unk_030); i++) {
MI_CpuCopy32(&pSaveSlot->mInfoData[0].unk_184[i], &this->mUnk_000->unk_030[i], sizeof(SaveFile_00000_0000_Data_184));
MI_CpuCopy32(&pGameSlot->mInfoData.unk_184[i], &this->mUnk_000->unk_030[i], sizeof(SaveFile_00000_0000_Data_184));
}
for (int i = 0; i < ARRAY_LEN(this->mUnk_000->unk_330); i++) {
MI_CpuCopy32(&pSaveSlot->mInfoData[0].unk_484[i], &this->mUnk_000->unk_330[i], sizeof(SaveFile_00000_0000_Data_484));
MI_CpuCopy32(&pGameSlot->mInfoData.unk_484[i], &this->mUnk_000->unk_330[i], sizeof(SaveFile_00000_0000_Data_484));
}
MI_CpuCopy32(&pSaveSlot->mInfoData[0].unk_C84, &this->mUnk_000->unk_B30, sizeof(SaveFile_00000_0000_Data_C84));
MI_CpuCopyFast(&pSaveSlot->mInfoData[0].unk_D24, &this->mUnk_000->unk_B40, sizeof(SaveFile_00000_0000_Data_D24));
MI_CpuCopy32(&pSaveSlot->mInfoData[0].unk_D8C, &this->mUnk_000->unk_B68, sizeof(SaveFile_00000_0000_Data_D8C));
MI_CpuCopyFast(&pSaveSlot->mInfoData[0].unk_D4C, &this->mUnk_000->unk_B78, sizeof(SaveFile_00000_0000_Data_D4C));
MI_CpuCopyFast(&pSaveSlot->mInfoData[0].unk_D9C, &this->mUnk_21C, sizeof(SaveFile_00000_0000_Data_D9C));
MI_CpuCopy32(&pGameSlot->mInfoData.unk_C84, &this->mUnk_000->unk_B30, sizeof(SaveFile_00000_0000_Data_C84));
MI_CpuCopyFast(&pGameSlot->mInfoData.unk_D24, &this->mUnk_000->unk_B40, sizeof(SaveFile_00000_0000_Data_D24));
MI_CpuCopy32(&pGameSlot->mInfoData.unk_D8C, &this->mUnk_000->unk_B68, sizeof(SaveFile_00000_0000_Data_D8C));
MI_CpuCopyFast(&pGameSlot->mInfoData.unk_D4C, &this->mUnk_000->unk_B78, sizeof(SaveFile_00000_0000_Data_D4C));
MI_CpuCopyFast(&pGameSlot->mInfoData.unk_D9C, &this->mUnk_21C, sizeof(SaveFile_00000_0000_Data_D9C));
}
THUMB_END
void SaveManager::func_ov001_020ba7a8() {
data_ov000_020b50c0.func_ov000_0206a6a4(gGame.mpSaveSlot->mUnk_2600.unk_01);
}
void SaveManager::func_ov001_020ba7c8(u16 saveSlotIndex) {
SaveSlot *pMgrSlot = &this->mpSaveFile->mSlots[saveSlotIndex];
GameSaveSlot *pGameSlot = gGame.mpSaveSlot;
MI_CpuCopyFast(pMgrSlot->mInfoData, &pGameSlot->mInfoData, sizeof(SaveInfoData));
MI_CpuCopyFast(pMgrSlot->mTreasureData, &pGameSlot->mTreasureData, sizeof(SaveTreasureData));
MI_CpuCopyFast(pMgrSlot->mUnk_2600, &pGameSlot->mUnk_2600, sizeof(SaveFile_00000_2600_Data));
MI_CpuCopyFast(pMgrSlot->mUnk_1D00, &pGameSlot->mUnk_1D00, sizeof(SaveFile_00000_1D00_Data));
data_02049b80.func_02013f80(0x00);
DELETE(this->mpSaveFile);
if (this->mUnk_214 == 0) {
this->mUnk_206 = saveSlotIndex;
}
}
// https://decomp.me/scratch/PykmO
void SaveManager::func_ov001_020ba858(void) {
if (this->mUnk_244 != NULL) {
return;
}
this->mUnk_244 = new(HeapIndex_1) SaveManager_244[2];
MI_CpuClearFast(&this->mUnk_244[0], sizeof(this->mUnk_244[0]));
MI_CpuClearFast(&this->mUnk_244[1], sizeof(this->mUnk_244[1]));
if (this->mUnk_206 >= 0 && this->mUnk_214 == 0) {
CARD_LockBackup(this->mCardId);
CARD_ReadFlashAsync(this->mUnk_206 * 0x7A700 + offsetof(SaveSlot, mUnk_2500), this->mUnk_244,
sizeof(SaveManager_244) * 2, NULL, NULL);
this->mResultCode = CARD_GetResultCode();
CARD_UnlockBackup(this->mCardId);
if (this->mResultCode != CARD_RESULT_SUCCESS) {
this->mUnk_214 = 1;
}
unk32 uVar3 = func_020328c8(&this->mUnk_004, &this->mUnk_244[0], sizeof(SaveManager_244) - 2);
unk32 uVar4 = func_020328c8(&this->mUnk_004, &this->mUnk_244[1], sizeof(SaveManager_244) - 2);
bool unk_7E_0 = uVar3 == this->mUnk_244[0].mUnk_7E;
bool unk_7E_1 = uVar4 == this->mUnk_244[1].mUnk_7E;
if (!unk_7E_0 && !unk_7E_1) {
MI_CpuClearFast(&this->mUnk_244[0], sizeof(SaveManager_244));
MI_CpuClearFast(&this->mUnk_244[1], sizeof(SaveManager_244));
return;
}
if (!unk_7E_0) {
MI_CpuCopyFast(&this->mUnk_244[1], &this->mUnk_244[0], sizeof(SaveManager_244));
return;
}
if (!unk_7E_1) {
MI_CpuCopyFast(&this->mUnk_244[0], &this->mUnk_244[1], sizeof(SaveManager_244));
return;
}
if (uVar3 != uVar4) {
MI_CpuCopyFast(&this->mUnk_244[1], &this->mUnk_244[0], sizeof(SaveManager_244));
return;
}
}
}
SaveManager_244::SaveManager_244() {}
@@ -1,7 +1,3 @@
#include "global.h"
THUMB_BEGIN
#include "Actor/ActorManager.hpp"
#include "Cutscene/Cutscene.hpp"
#include "Game/GameModeManager.hpp"
@@ -615,5 +611,3 @@ bool UnkStruct_WarpUnk1::func_ov001_020b7144() {
return iVar9;
}
THUMB_END
+57
View File
@@ -0,0 +1,57 @@
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_027e09a4.hpp"
extern "C" UnkStruct_02011e10_Sub1 *func_02001098(void *, size_t, unk32);
extern "C" UnkStruct_02011e10_Sub1 *func_020012e0(void *, size_t, unk32);
extern "C" void func_020010b8(void *);
extern "C" void func_02001300(void *);
extern "C" unk32 func_020013ac(void *param1);
extern "C" size_t func_020010e0(UnkStruct_02011e10_Sub1 *heapID, void *pFile, unk32 param3);
void UnkStruct_02011e10::func_ov001_020ba588(unk32 param1, unk32 param2) {
this->mUnk_2C.func_020144cc(param1, param2, 0x01);
this->mUnk_00[HeapIndex_2] = this->mUnk_2C.mUnk_00;
}
void UnkStruct_02011e10::func_ov001_020ba59c() {
this->mUnk_2C.func_02014538();
this->mUnk_00[HeapIndex_2] = NULL;
}
void UnkStruct_02011e10::func_ov001_020ba5ac(unk32 param1, unk32 param2) {
this->mUnk_44.func_020144cc(param1, param2, 0x01);
this->mUnk_00[HeapIndex_ITCM] = this->mUnk_44.mUnk_00;
}
void UnkStruct_02011e10::func_ov001_020ba5c0() {
this->mUnk_44.func_02014538();
this->mUnk_00[HeapIndex_ITCM] = NULL;
}
void UnkStruct_02011e10::func_ov001_020ba5d0() {
size_t size = data_027e09a4->mUnk_60 == 2 ? 0xBB800 : 0x6A400;
this->mUnk_64 = ::operator new(size, HeapIndex_1);
this->mUnk_00[HeapIndex_DTCM] = func_02001098(this->mUnk_64, size, 0x02);
}
void UnkStruct_02011e10::func_ov001_020ba608() {
func_020010b8(this->mUnk_00[HeapIndex_DTCM]);
DELETE(this->mUnk_64);
this->mUnk_00[HeapIndex_DTCM] = NULL;
}
void UnkStruct_02011e10::func_ov001_020ba620() {
size_t size = 0x40000;
this->mUnk_68 = ::operator new(size, HeapIndex_1);
this->mUnk_00[HeapIndex_5] = func_020012e0(this->mUnk_68, size, 0x02);
}
void UnkStruct_02011e10::func_ov001_020ba640() {
func_020010e0(this->mUnk_00[HeapIndex_1], this->mUnk_68, func_020013ac(this->mUnk_00[HeapIndex_5]));
}
void UnkStruct_02011e10::func_ov001_020ba658() {
func_02001300(this->mUnk_00[HeapIndex_5]);
this->mUnk_00[HeapIndex_5] = NULL;
DELETE(this->mUnk_68);
}
@@ -0,0 +1,24 @@
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_027e095c.hpp"
extern "C" u32 func_0202447c();
extern "C" u32 func_02024494();
extern "C" void func_02006d8c(u16, unk32);
extern "C" void func_02006aa8(unk32, unk32);
UnkStruct_027e095c *UnkStruct_027e095c::Create() {
return new(HeapIndex_1) UnkStruct_027e095c();
}
UnkStruct_027e095c::UnkStruct_027e095c() {
this->mUnk_8DC = &this->mUnk_2F4;
this->mUnk_940 = &this->mUnk_8E0;
func_02006d8c(func_0202447c() >> 0x11, 0x01);
func_02006aa8(func_02024494(), 0x01);
for (VecFx32 *pIt = this->mUnk_000; pIt != &this->mUnk_000[ARRAY_LEN(this->mUnk_000)]; pIt++) {
VecFx32_Init(0, 0, 0, pIt);
}
}
DECL_INSTANCE_CTOR(UnkStruct_027e095c, data_027e095c);
@@ -0,0 +1,91 @@
#include "System/SysNew.hpp"
#include "Unknown/UnkStruct_027e09a4.hpp"
#include "Unknown/UnkStruct_027e09bc.hpp"
#include "Unknown/UnkStruct_ov020_020e8544.hpp"
UnkStruct_027e09bc *UnkStruct_027e09bc::Create() {
return new(HeapIndex_1) UnkStruct_027e09bc();
}
UnkStruct_027e09bc::UnkStruct_027e09bc() {
this->mUnk_04 = NULL;
this->mUnk_08 = 0;
this->mUnk_0C = NULL;
this->mUnk_10 = NULL;
this->mUnk_14[0] = NULL;
this->mUnk_14[1] = NULL;
this->mUnk_14[2] = NULL;
this->mUnk_14[3] = NULL;
if (data_027e09a4->mUnk_60 == 0) {
this->mUnk_0C = new(HeapIndex_1) UnkStruct_027e09bc_0C(0);
this->mUnk_10 = new(HeapIndex_1) UnkStruct_027e09bc_0C(1);
this->func_ov000_020771b8(0x00);
this->func_ov000_020771b8(0x01);
} else if (data_027e09a4->mUnk_60 == 1) {
this->mUnk_14[0] = new(HeapIndex_1) UnkStruct_027e09bc_0C(0);
this->mUnk_14[1] = new(HeapIndex_1) UnkStruct_027e09bc_0C(1);
this->mUnk_14[2] = new(HeapIndex_1) UnkStruct_027e09bc_0C(2);
this->mUnk_14[3] = new(HeapIndex_1) UnkStruct_027e09bc_0C(3);
this->mUnk_04 = this->mUnk_14[data_ov020_020e8544->vfunc_20()];
}
}
UnkStruct_027e09bc::~UnkStruct_027e09bc() {
delete this->mUnk_0C;
delete this->mUnk_10;
delete this->mUnk_14[0];
delete this->mUnk_14[1];
delete this->mUnk_14[2];
delete this->mUnk_14[3];
this->mUnk_0C = NULL;
this->mUnk_10 = NULL;
this->mUnk_14[0] = NULL;
this->mUnk_14[1] = NULL;
this->mUnk_14[2] = NULL;
this->mUnk_14[3] = NULL;
}
void UnkStruct_027e09bc::func_ov001_020bab5c() {
switch ((s32) data_027e09a4->CurrentSceneIndex()) {
case SceneIndex_b_sand:
case SceneIndex_tekiya09:
data_027e09bc->mUnk_10->mUnk_264 = 0x7B;
break;
case SceneIndex_b_last2:
data_027e09bc->mUnk_10->mUnk_264 = 0x00;
break;
case SceneIndex_b_last22:
data_027e09bc->mUnk_10->mUnk_264 = 0x00;
break;
default:
if (data_027e09a4->mUnk_60 == 0) {
data_027e09bc->mUnk_10->func_ov000_02078cec();
}
break;
}
}
void UnkStruct_027e09bc::func_ov001_020babc8() {
if (data_027e09a4->mUnk_60 == 0) {
this->mUnk_0C->func_ov000_02078ba4();
this->mUnk_10->func_ov000_02078ba4();
}
}
void UnkStruct_027e09bc::func_ov001_020babe8() {
if (data_027e09a4->mUnk_60 == 0) {
this->mUnk_0C->mUnk_280 = 0;
this->mUnk_10->mUnk_280 = 0;
}
}
void UnkStruct_027e09bc::func_ov001_020bac08() {
if (data_027e09a4->mUnk_60 == 0) {
this->mUnk_0C->mUnk_280 = 0;
this->mUnk_10->mUnk_280 = 0;
}
}
DECL_INSTANCE(UnkStruct_027e09bc, data_027e09bc);
@@ -124,7 +124,7 @@ UnkStruct_027e0cd8_0C_Base::UnkStruct_027e0cd8_0C_Base(UnkStruct_027e0cd8 *param
this->mUnk_13C.Init(data_ov001_020c40f4, 0x40);
Vec2s_Copy((Vec2s *) &this->mUnk_09C, &local_30);
gpMapObjManager->func_ov001_020baea0(&local_30);
gpMapObjManager->func_ov001_020baea0((u16 *) &local_30);
data_027e095c->func_ov000_020592a0();
}
@@ -3,8 +3,6 @@
extern s16 data_ov001_020c2750[];
extern s16 data_ov001_020c275e[];
THUMB_BEGIN
UnkStruct_027e0cf8_08_00::UnkStruct_027e0cf8_08_00(u8 bgType) :
AdventureModeManager_1B8_Base(bgType, true, AdventureModeManager_1B8_Base_1C(0x00, 0x00, 0x100, 0xC0), true, true) {
this->func_ov001_020bfb20();
@@ -71,5 +69,3 @@ void UnkStruct_027e0cf8_08_00::func_ov001_020bfb20() {
Vec2s_Copy(&this->mUnk_13C[i], &this->mUnk_094[iVar2]);
}
}
THUMB_END
+6 -6
View File
@@ -127,9 +127,9 @@ SaveManager::SaveManager() {
func_020327c8(&this->mUnk_004, 0x1021);
this->mUnk_204 = OS_GetLockID();
int uVar8 = 1;
CARD_LockBackup(this->mUnk_204);
this->mCardId = OS_GetLockID();
int uVar8 = 1;
CARD_LockBackup(this->mCardId);
if (CARD_IdentifyBackup(CARD_BACKUP_TYPE_FLASH_8MBITS)) {
stack_struct stack[MAX_SAVE_SLOTS];
@@ -163,10 +163,10 @@ SaveManager::SaveManager() {
}
}
this->mUnk_20C = CARD_GetResultCode();
CARD_UnlockBackup(this->mUnk_204);
this->mResultCode = CARD_GetResultCode();
CARD_UnlockBackup(this->mCardId);
if (this->mUnk_20C != 0) {
if (this->mResultCode != CARD_RESULT_SUCCESS) {
this->mUnk_214 = uVar8;
}
}
+10 -10
View File
@@ -26,13 +26,13 @@ const unk32 data_ov019_020d1be8[] = {
};
void SaveManager::func_ov019_020d086c(u16 param1) {
CARD_LockBackup(gSaveManager.mUnk_204);
CARD_LockBackup(gSaveManager.mCardId);
STATIC_PTMFCALLBACK(PTMF<SaveFile>, gSaveManager.mUnk_23C, gSaveManager.mpSaveFile);
gSaveManager.mUnk_20C = CARD_GetResultCode();
CARD_UnlockBackup(gSaveManager.mUnk_204);
gSaveManager.mResultCode = CARD_GetResultCode();
CARD_UnlockBackup(gSaveManager.mCardId);
if (gSaveManager.mUnk_20C != 0) {
if (gSaveManager.mResultCode != CARD_RESULT_SUCCESS) {
gSaveManager.mUnk_214 = gSaveManager.mUnk_210;
}
@@ -79,25 +79,25 @@ void SaveManager::func_ov019_020d0a04(u16 saveSlotIndex) {
void SaveManager::func_ov019_020d0a2c(u16 saveSlotIndex) {
data_02049bd4.mUnk_04++;
gSaveManager.mpSaveFile->mSaveSlotIndex = saveSlotIndex;
CARD_LockBackup(gSaveManager.mUnk_204);
CARD_LockBackup(gSaveManager.mCardId);
gSaveManager.mUnk_210 = 1;
gSaveManager.mpSaveFile->func_ov019_020d1634();
gSaveManager.mUnk_20C = CARD_GetResultCode();
gSaveManager.mResultCode = CARD_GetResultCode();
if (gSaveManager.mUnk_20C != 0) {
if (gSaveManager.mResultCode != CARD_RESULT_SUCCESS) {
gSaveManager.mUnk_214 = gSaveManager.mUnk_210;
return;
}
gSaveManager.mUnk_210 = 2;
gSaveManager.mpSaveFile->func_ov019_020d16d0();
gSaveManager.mUnk_20C = CARD_GetResultCode();
gSaveManager.mResultCode = CARD_GetResultCode();
if (gSaveManager.mUnk_20C != 0) {
if (gSaveManager.mResultCode != CARD_RESULT_SUCCESS) {
gSaveManager.mUnk_214 = gSaveManager.mUnk_210;
}
CARD_UnlockBackup(gSaveManager.mUnk_204);
CARD_UnlockBackup(gSaveManager.mCardId);
gSaveManager.mUnk_210 = 0;
data_02049bd4.mUnk_04--;
}
@@ -424,7 +424,7 @@ void AdventureModeManager::func_ov024_020c5cec() {
gpUICounterManager->func_ov024_020cd420();
if (!data_027e09a4->IsTrain()) {
gpUICounterManager->func_ov024_020cd458(data_027e0ce0->mUnk_2C->mEquippedItem, true);
gpUICounterManager->func_ov024_020cd458(data_027e0ce0->mUnk_2C->GetCurrentItem(), true);
if (gOverlayManager.IsPlayerSub() && data_0204a088->mUnk_00 == OverlayIndex_SceneInit) {
this->mUnk_168->func_ov031_0210df60(1);
@@ -125,9 +125,9 @@ void UnkTrainSystem1::func_ov024_020d562c(const VecFx32 *param1, fx32 param2) {
UnkStruct_027e09bc_0C *temp_r8_2 = data_027e09bc->mUnk_0C;
#endif
temp_r1_3.x = temp_r8_2->mUnk_34.x;
temp_r1_3.z = temp_r8_2->mUnk_34.z;
temp_r1_3.y = temp_r8_2->mUnk_34.y;
temp_r1_3.x = temp_r8_2->mUnk_034.x;
temp_r1_3.z = temp_r8_2->mUnk_034.z;
temp_r1_3.y = temp_r8_2->mUnk_034.y;
fx32 x = temp_r1_3.x - param1->x;
temp_r1_3.x = x;
+5 -5
View File
@@ -78,7 +78,7 @@ UICounterManager::UICounterManager() :
}
}
if (data_027e09a4->IsDungeonTower() && !GET_FLAG(data_027e0ce0->mUnk_2C->mFlags, ItemFlag_LokomoSword)) {
if (data_027e09a4->IsDungeonTower() && !data_027e0ce0->mUnk_2C->HasItem(ItemFlag_LokomoSword)) {
this->mpTears = new(HeapIndex_1) UICounter_TearsOfLight();
}
@@ -144,7 +144,7 @@ void UICounterManager::func_ov024_020cd150() {
if (!data_027e09a4->IsTrain()) {
this->mpKeys->func_ov024_020cf698();
this->mpItems->func_ov031_0210eeb4();
gpUICounterManager->func_ov024_020cd458(data_027e0ce0->mUnk_2C->mEquippedItem, true);
gpUICounterManager->func_ov024_020cd458(data_027e0ce0->mUnk_2C->GetCurrentItem(), true);
}
if (this->mpTears != NULL) {
@@ -793,7 +793,7 @@ UICounter_Rupees::UICounter_Rupees() :
Vec2s_CopySub(&local_30.mPos, &local_60.mPos, &this->mUnk_0FC);
this->mUnk_05C.func_ov000_02065b48(data_027e0ce0->mUnk_2C->mNumRupees, 0);
this->mUnk_05C.func_ov000_02065b48(data_027e0ce0->mUnk_2C->GetNumRupees(), 0);
UnkStruct_ov019_020d24c8_28_258 local_78((volatile s32) sVar2, 4);
s16 temp_r0 = local_78.mPos.x + local_78.mUnk_0E.x;
@@ -826,7 +826,7 @@ UICounter_Rupees::UICounter_Rupees() :
void UICounter_Rupees::func_ov024_020ce518() {
this->mUnk_018.Subprocess2_UnkValueSets();
this->mUnk_018.UnkOperations3();
this->mUnk_05C.func_ov000_02065b48(data_027e0ce0->mUnk_2C->mNumRupees, 0);
this->mUnk_05C.func_ov000_02065b48(data_027e0ce0->mUnk_2C->GetNumRupees(), 0);
this->mUnk_104 = false;
}
@@ -864,7 +864,7 @@ void UICounter_Rupees::func_ov024_020ce5cc() {
}
this->mUnk_018.UpdateLogic();
this->mUnk_05C.func_ov000_02065b48(data_027e0ce0->mUnk_2C->mNumRupees, 1);
this->mUnk_05C.func_ov000_02065b48(data_027e0ce0->mUnk_2C->GetNumRupees(), 1);
if (data_0204a110.mUnk_000 == 1) {
switch (func_02015788(this->mUnk_05C.mUnk_94)) {
+1 -1
View File
@@ -128,7 +128,7 @@ void ActorItemBoomerang::vfunc_20() {
func_01ffe6c4(&sp54, this->mRef, &this->mPos, &this->mPrevPos, 0x1F, NULL, &this->mUnk_11C);
if ((tmp | sp54->func_ov000_0207e294((Cylinder *) &this->mUnk_10C)) == 0 && !var1) {
if (data_027e0ce0->mUnk_2C->mEquippedItem != ItemFlag_Boomerang) {
if (data_027e0ce0->mUnk_2C->GetCurrentItem() != ItemFlag_Boomerang) {
this->SetState(ActorItemBoomerangState_1);
return;
}
+4 -4
View File
@@ -106,7 +106,7 @@ ActorItemDrop::ActorItemDrop() :
switch (this->GetActorId()) {
case ActorId_ArrowDrop:
if (GET_FLAG(data_027e0ce0->mUnk_2C->mFlags, ItemFlag_Bow)) {
if (data_027e0ce0->mUnk_2C->HasItem(ItemFlag_Bow)) {
this->mItemTypeId = ItemDropType_Arrow;
this->mUnk_D8 = FLOAT_TO_FX32(0.5f);
} else {
@@ -114,7 +114,7 @@ ActorItemDrop::ActorItemDrop() :
}
break;
case ActorId_BombDrop:
if (GET_FLAG(data_027e0ce0->mUnk_2C->mFlags, ItemFlag_Bombs)) {
if (data_027e0ce0->mUnk_2C->HasItem(ItemFlag_Bombs)) {
this->mItemTypeId = ItemDropType_Bomb;
this->mUnk_D8 = FLOAT_TO_FX32(0.3f);
} else {
@@ -433,10 +433,10 @@ void ActorItemDrop::func_ov031_020fa72c() {
bool executeFunction = true;
switch (this->mItemTypeId) {
case ItemDropType_Arrow:
data_027e0ce0->mUnk_2C->GiveArrows(5);
data_027e0ce0->mUnk_2C->GetInventory()->GiveArrows(5);
break;
case ItemDropType_Bomb:
data_027e0ce0->mUnk_2C->GiveBombs(3);
data_027e0ce0->mUnk_2C->GetInventory()->GiveBombs(3);
break;
case ItemDropType_RedPotion:
executeFunction = data_027e0d34->TryItemGive(ItemId_RedPotion);
+1 -1
View File
@@ -176,7 +176,7 @@ void ActorRupee::func_ov031_020e9068() {
break;
default: {
ItemManager *pItemManager = data_027e0ce0->mUnk_2C;
pItemManager->GiveRupees(func_02017158(), false, true);
pItemManager->GetInventory()->GiveRupees(func_02017158(), false, true);
var_r4 = true;
break;
}
@@ -222,7 +222,7 @@ ItemId MapObjectChestBase::func_ov031_021037d0() {
this->vfunc_38(7, 0);
if ((u32) this->mItemId - ItemId_RedPotion <= 2 && data_027e0ce0->mUnk_2C->PotionSlotsFull()) {
if ((u32) this->mItemId - ItemId_RedPotion <= 2 && data_027e0ce0->mUnk_2C->GetInventory()->PotionSlotsFull()) {
return ItemId_BigGreenRupee;
}
+3 -3
View File
@@ -98,7 +98,7 @@ void MapObjectDoorKey::vfunc_5C(unk32 param1, unk32 param2) {
switch (this->mUnk_16) {
case 3:
if (param2 == 0) {
data_027e0ce0->mUnk_2C->GiveSmallKeys(-1);
data_027e0ce0->mUnk_2C->GetInventory()->GiveSmallKeys(-1);
}
UNSET_FLAG(this->mFlags, MapObjFlag_9);
@@ -117,7 +117,7 @@ bool MapObjectDoorKey::func_ov031_020fea88(void) {
return false;
}
if (data_027e0ce0->mUnk_2C->mKeyAmount != 0) {
if (data_027e0ce0->mUnk_2C->GetKeyAmount() != 0) {
return true;
}
@@ -129,7 +129,7 @@ unk32 MapObjectDoorKey::vfunc_28(void) {
return -1;
}
if (data_027e0ce0->mUnk_2C->mKeyAmount == 0) {
if (data_027e0ce0->mUnk_2C->GetKeyAmount() == 0) {
return -1;
}
+2 -2
View File
@@ -35,9 +35,9 @@ ItemId ActorUnkGORY::func_ov036_0211bcb0(unk32 param1) {
return ItemId_TenPriceCard;
}
if (data_027e0ce0->mUnk_2C->mQuiverCapacity == UpgradeCapacity_Tier1) {
if (data_027e0ce0->mUnk_2C->GetQuiverCap() == UpgradeCapacity_Tier1) {
return ItemId_QuiverMedium;
} else if (data_027e0ce0->mUnk_2C->mQuiverCapacity == UpgradeCapacity_Tier2) {
} else if (data_027e0ce0->mUnk_2C->GetQuiverCap() == UpgradeCapacity_Tier2) {
return ItemId_QuiverLarge;
} else {
return ItemId_TenPriceCard;
+13 -13
View File
@@ -108,7 +108,7 @@ u16 ActorUnkSHIT::func_ov036_0211ceec(void) {
break;
}
return 9999;
return MAX_RUPEES;
}
unk32 ActorUnkSHIT::func_ov036_0211d0a8(void) {
@@ -177,7 +177,7 @@ bool ActorUnkSHIT::func_ov036_0211d2dc(void) {
switch (this->mItemId) {
case ItemId_NormalShield:
if (GET_FLAG(pIVar4->mFlags, ItemFlag_Shield)) {
if (pIVar4->HasItem(ItemFlag_Shield)) {
return false;
}
@@ -185,7 +185,7 @@ bool ActorUnkSHIT::func_ov036_0211d2dc(void) {
case ItemId_RedPotion:
case ItemId_PurplePotion:
case ItemId_YellowPotion:
if (pIVar4->PotionSlotsFull()) {
if (pIVar4->GetInventory()->PotionSlotsFull()) {
return false;
}
@@ -231,26 +231,26 @@ bool ActorUnkSHIT::func_ov036_0211d2dc(void) {
break;
case ItemId_BombsRefill:
if (!GET_FLAG(pIVar4->mFlags, ItemFlag_Bombs)) {
if (!pIVar4->HasItem(ItemFlag_Bombs)) {
return false;
}
{
u8 amount = pIVar4->mBombAmount;
if (amount >= pIVar4->GetBombBagCapacity()) {
u8 amount = pIVar4->GetBombAmount();
if (amount >= pIVar4->GetInventory()->GetBombBagCapacity()) {
return false;
}
}
break;
case ItemId_ArrowsRefill:
if (!GET_FLAG(pIVar4->mFlags, ItemFlag_Bow)) {
if (!pIVar4->HasItem(ItemFlag_Bow)) {
return false;
}
{
u8 amount = pIVar4->mArrowAmount;
if (amount >= pIVar4->GetQuiverCapacity()) {
u8 amount = pIVar4->GetArrowAmount();
if (amount >= pIVar4->GetInventory()->GetQuiverCapacity()) {
return false;
}
}
@@ -258,7 +258,7 @@ bool ActorUnkSHIT::func_ov036_0211d2dc(void) {
break;
case ItemId_QuiverMedium:
case ItemId_QuiverLarge:
if (!GET_FLAG(pIVar4->mFlags, ItemFlag_Bow)) {
if (!pIVar4->HasItem(ItemFlag_Bow)) {
return false;
}
@@ -324,10 +324,10 @@ void ActorUnkSHIT::func_ov036_0211d570(unk32 param1) {
this->mUnk_2D3 = true;
break;
case ItemId_BombsRefill:
pIVar4->GiveBombs(10);
pIVar4->GetInventory()->GiveBombs(10);
break;
case ItemId_ArrowsRefill:
pIVar4->GiveArrows(10);
pIVar4->GetInventory()->GiveArrows(10);
break;
case ItemId_QuiverMedium:
case ItemId_QuiverLarge:
@@ -345,7 +345,7 @@ void ActorUnkSHIT::func_ov036_0211d570(unk32 param1) {
}
if (param1 == 0) {
pIVar4->GiveRupees(-this->func_ov036_0211cddc(), false, false);
pIVar4->GetInventory()->GiveRupees(-this->func_ov036_0211cddc(), false, false);
}
}
+15 -23
View File
@@ -70,7 +70,7 @@ static inline s16 GetItemFlag(ItemId itemId) {
return ItemFlag_None;
}
bool ItemManager::func_ov110_02184a40(ItemId itemId) {
bool Inventory::func_ov110_02184a40(ItemId itemId) {
switch (itemId) {
case ItemId_NormalKey:
this->GiveSmallKeys(1);
@@ -98,19 +98,11 @@ bool ItemManager::func_ov110_02184a40(ItemId itemId) {
break;
case ItemId_QuiverMedium:
case ItemId_QuiverLarge:
if (this->mQuiverCapacity < UpgradeCapacity_Tier3) {
this->mQuiverCapacity++;
}
this->mArrowAmount = this->GetQuiverCapacity();
this->SetNextQuiverCapacity();
break;
case ItemId_BombBagMedium:
case ItemId_BombBagLarge:
if (this->mBombBagCapacity < UpgradeCapacity_Tier3) {
this->mBombBagCapacity++;
}
this->mBombAmount = this->GetBombBagCapacity();
this->SetNextBombBagCapacity();
break;
case ItemId_RedPotion:
this->GivePotion(PotionType_Red);
@@ -479,12 +471,12 @@ PlayerGet::~PlayerGet() {
bool PlayerGet::func_ov110_02186b8c() {
switch (this->mUnk_54.mItemId) {
case ItemId_NormalShield:
if (this->mUnk_28->pItemManager->mUnk_12 & 2) {
if (this->mUnk_28->pItemManager->HasUnk12(2)) {
return true;
}
break;
case ItemId_AncientShield:
if (!(this->mUnk_28->pItemManager->mUnk_12 & 2)) {
if (!(this->mUnk_28->pItemManager->HasUnk12(2))) {
return true;
}
break;
@@ -520,22 +512,22 @@ void PlayerGet::vfunc_0C(UnkStruct_PlayerGet_vfunc_0C_param1 *param1) {
case ItemId_BombBag:
case ItemId_BombBagMedium:
case ItemId_BombBagLarge:
if (GET_FLAG(pItemManager->mFlags, ItemFlag_Bombs) == 0) {
if (!pItemManager->HasItem(ItemFlag_Bombs)) {
itemId = ItemId_BombBag;
} else if (pItemManager->mBombBagCapacity == UpgradeCapacity_Tier1) {
} else if (pItemManager->GetBombsCap() == UpgradeCapacity_Tier1) {
itemId = ItemId_BombBagMedium;
} else if (pItemManager->mBombBagCapacity == UpgradeCapacity_Tier2) {
} else if (pItemManager->GetBombsCap() == UpgradeCapacity_Tier2) {
itemId = ItemId_BombBagLarge;
}
break;
case ItemId_NormalBow:
case ItemId_QuiverMedium:
case ItemId_QuiverLarge:
if (GET_FLAG(pItemManager->mFlags, ItemFlag_Bow) == 0) {
if (!pItemManager->HasItem(ItemFlag_Bow)) {
itemId = ItemId_NormalBow;
} else if (pItemManager->mQuiverCapacity == UpgradeCapacity_Tier1) {
} else if (pItemManager->GetQuiverCap() == UpgradeCapacity_Tier1) {
itemId = ItemId_QuiverMedium;
} else if (pItemManager->mQuiverCapacity == UpgradeCapacity_Tier2) {
} else if (pItemManager->GetQuiverCap() == UpgradeCapacity_Tier2) {
itemId = ItemId_QuiverLarge;
}
break;
@@ -850,7 +842,7 @@ void PlayerGet::vfunc_10(unk32 param1, unk32 param2) {
}
if (this->mUnk_72 == 0 && var_r1_2) {
temp_r6 = this->mUnk_28->pItemManager->func_ov110_02184a40(this->mUnk_54.mItemId);
temp_r6 = this->mUnk_28->pItemManager->GetInventory()->func_ov110_02184a40(this->mUnk_54.mItemId);
switch (this->mUnk_54.mItemId) {
case ItemId_NormalShield:
@@ -862,7 +854,7 @@ void PlayerGet::vfunc_10(unk32 param1, unk32 param2) {
if ((temp_r0_3 != NULL) && (temp_r0_3->GetActorId() == ActorId_NormalShield)) {
if (this->func_ov110_02186b8c()) {
this->mUnk_28->pItemManager->mUnk_12 ^= 2;
this->mUnk_28->pItemManager->FlipUnk12(2);
}
temp_r0_3->func_ov062_02158ce8();
@@ -870,11 +862,11 @@ void PlayerGet::vfunc_10(unk32 param1, unk32 param2) {
} else {
if (this->mUnk_54.mItemId == ItemId_AncientShield) {
if (this->func_ov110_02186b8c()) {
this->mUnk_28->pItemManager->mUnk_12 ^= 2;
this->mUnk_28->pItemManager->FlipUnk12(2);
}
} else if (this->mUnk_54.mItemId == ItemId_NormalShield) {
if (this->func_ov110_02186b8c()) {
this->mUnk_28->pItemManager->mUnk_12 ^= 2;
this->mUnk_28->pItemManager->FlipUnk12(2);
}
}
}
@@ -322,7 +322,7 @@ void PlayerSceneChange::vfunc_0C(UnkStruct_PlayerGet_vfunc_0C_param1 *param1) {
}
}
if ((this->mUnk_24->mUnk_104 & 0x10) || this->mUnk_28->pItemManager->mTearsAmount == 3) {
if ((this->mUnk_24->mUnk_104 & 0x10) || this->mUnk_28->pItemManager->GetTearsAmount() == MAX_TEARS_OF_LIGHT) {
struct {
unk32 actorId;
void *ptr;
+2 -2
View File
@@ -35,8 +35,8 @@ void Game::Run() {
data_0204999c.func_02013014();
{
UnkDataStruct2 local_28(0x1300);
this->mpSaveSlot = (SaveSlot *) local_28.unk_00;
UnkDataStruct2 local_28(sizeof(GameSaveSlot));
this->mpSaveSlot = (GameSaveSlot *) local_28.unk_00;
if (this->mpCurrentGameMode != NULL) {
delete this->mpCurrentGameMode;