From 8e45eb7b1f70713925e5b680459e35141426a72f Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Tue, 12 Jul 2022 00:45:55 -0400 Subject: [PATCH] `z_parameter`: Items & Import Data (#799) * Import Data * More functions * cleanup * Add Enum * Many changes, PR and add-ons * Fix bss * Better data * Extra space * DoubleDefense is boolean * Missed a macro * More enums missed * macro -> enum * More item cleanup... * missing/wrong quest items * Next PR Review * Revert Interface_AddMagic to Parameter_AddMagic * Remove QUEST_HEART_CONTAINER * Fix bss * Move Color_RGB16 up + fix incorrect numbers * Add texture pointers * Add comment * EQUIP_SLOT_A * rm redundant comment * Fix merge * PR Suggestions * fix bss --- docs/tutorial/advanced_control_flow.md | 18 +- include/color.h | 6 + include/functions.h | 35 +- include/macros.h | 27 +- include/z64.h | 13 +- include/z64item.h | 30 +- spec | 2 - src/code/code_8012EC80.c | 6 +- src/code/sched.c | 1 + src/code/z_en_item00.c | 4 +- src/code/z_game_over.c | 16 +- src/code/z_kaleido_setup.c | 8 +- src/code/z_lifemeter.c | 14 +- src/code/z_parameter.c | 1244 ++++++++++++++++- src/code/z_player_lib.c | 4 +- src/code/z_sram_NES.c | 71 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 1 - .../ovl_En_Akindonuts/z_en_akindonuts.c | 30 +- .../actors/ovl_En_Aob_01/z_en_aob_01.c | 8 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 4 +- src/overlays/actors/ovl_En_Cow/z_en_cow.c | 4 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 2 +- src/overlays/actors/ovl_En_Dnq/z_en_dnq.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- .../actors/ovl_En_Elforg/z_en_elforg.c | 2 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 4 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 2 +- .../actors/ovl_En_Gamelupy/z_en_gamelupy.c | 4 +- src/overlays/actors/ovl_En_Gb2/z_en_gb2.c | 6 +- .../actors/ovl_En_Ginko_Man/z_en_ginko_man.c | 4 +- src/overlays/actors/ovl_En_GirlA/z_en_girla.c | 46 +- src/overlays/actors/ovl_En_Gk/z_en_gk.c | 4 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 16 +- .../actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c | 2 +- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 8 +- src/overlays/actors/ovl_En_Kgy/z_en_kgy.c | 8 +- .../actors/ovl_En_Kujiya/z_en_kujiya.c | 2 +- src/overlays/actors/ovl_En_Mm3/z_en_mm3.c | 4 +- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 2 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 4 +- .../actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c | 2 +- .../actors/ovl_En_Scopenuts/z_en_scopenuts.c | 2 +- src/overlays/actors/ovl_En_Shn/z_en_shn.c | 4 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 3 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 4 +- src/overlays/actors/ovl_En_Tab/z_en_tab.c | 2 +- .../ovl_En_Talk_Gibud/z_en_talk_gibud.c | 4 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 10 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 2 +- src/overlays/actors/ovl_En_Trt/z_en_trt.c | 10 +- src/overlays/actors/ovl_En_Trt2/z_en_trt2.c | 6 +- src/overlays/actors/ovl_En_Tsn/z_en_tsn.c | 6 +- src/overlays/actors/ovl_En_Zos/z_en_zos.c | 8 +- src/overlays/actors/ovl_En_Zot/z_en_zot.c | 8 +- src/overlays/gamestates/ovl_select/z_select.c | 10 +- tools/disasm/functions.txt | 34 +- tools/disasm/variables.txt | 118 +- tools/namefixer.py | 16 + tools/sizes/code_functions.csv | 34 +- 60 files changed, 1597 insertions(+), 358 deletions(-) diff --git a/docs/tutorial/advanced_control_flow.md b/docs/tutorial/advanced_control_flow.md index 76d673b359..3ad2a9d4fc 100644 --- a/docs/tutorial/advanced_control_flow.md +++ b/docs/tutorial/advanced_control_flow.md @@ -199,7 +199,7 @@ void func_809527F8(EnMs* this, PlayState* play) { } func_8019F208(); Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); - func_801159EC(-0xA); + Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } } @@ -290,7 +290,7 @@ block_13: block_15: func_8019F208(); Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); - func_801159EC(-0xA); + Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; block_16: @@ -391,7 +391,7 @@ block_11: func_8019F208(); Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); - func_801159EC(-0xA); + Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; block_16: @@ -460,7 +460,7 @@ block_11: func_8019F208(); Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); - func_801159EC(-0xA); + Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; block_16: @@ -510,7 +510,7 @@ So let us rewrite the entire second half as a switch: func_8019F208(); Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); - func_801159EC(-0xA); + Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; return; break; @@ -542,7 +542,7 @@ There's a couple of other obvious things here: } else { func_8019F208(); Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); - func_801159EC(-0xA); + Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } break; @@ -607,7 +607,7 @@ block_7: } else { func_8019F208(); Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); - func_801159EC(-0xA); + Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } break; @@ -672,7 +672,7 @@ void func_809527F8(EnMs* this, PlayState* play) { } else { func_8019F208(); Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); - func_801159EC(-0xA); + Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } break; @@ -724,7 +724,7 @@ void func_809527F8(EnMs* this, PlayState* play) { } else { func_8019F208(); Actor_PickUp((Actor *) this, play, 0x35, 90.0f, 10.0f); - func_801159EC(-0xA); + Rupees_ChangeBy(-0xA); this->actionFunc = func_809529AC; } break; diff --git a/include/color.h b/include/color.h index 438d857ad9..b0b4d2cb0d 100644 --- a/include/color.h +++ b/include/color.h @@ -19,6 +19,12 @@ typedef struct { /* 0x3 */ u8 a; } Color_RGBA8; // size = 0x4 +typedef struct { + /* 0x0 */ s16 r; + /* 0x2 */ s16 g; + /* 0x4 */ s16 b; +} Color_RGB16; // size = 0x6 + // only use when necessary for alignment purposes typedef union { struct { diff --git a/include/functions.h b/include/functions.h index c12db921b1..63f9eadd8a 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1881,31 +1881,30 @@ void Interface_ChangeAlpha(u16 param_1); // void func_80111CB4(void); // void func_801129E4(void); void func_80112AFC(PlayState* play); -void func_80112B40(PlayState* play, u8 arg1); -// void func_80112BE4(void); +void Interface_LoadItemIconImpl(PlayState* play, u8 btn); +void Interface_LoadItemIcon(PlayState* play, u8 btn); // void func_80112C0C(void); -u32 Item_Give(PlayState* play, u8 param_2); -// void func_801143CC(void); -UNK_TYPE func_80114978(UNK_TYPE arg0); -void func_801149A0(s32 itemId, s16 slotId); -// void func_80114A9C(void); -// void func_80114B84(void); -// void func_80114CA0(void); -s32 Interface_HasEmptyBottle(void); -s32 Interface_HasItemInBottle(u8 itemId); -void func_80114FD0(PlayState* play, u8 itemId, u8 heldItemButton); -// void func_80115130(void); -// void func_801152B8(void); +u8 Item_Give(PlayState* play, u8 item); +u8 Item_CheckObtainability(u8 item); +void Inventory_DeleteItem(s16 item, s16 slot); +void Inventory_UnequipItem(s16 item); +s32 Inventory_ReplaceItem(PlayState* play, u8 oldItem, u8 newItem); +void Inventory_UpdateDeitySwordEquip(PlayState* play) ; +s32 Inventory_HasEmptyBottle(void); +s32 Inventory_HasItemInBottle(u8 item); +void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 btn); +s32 Inventory_ConsumeFairy(PlayState* play); +void Inventory_UpdateItem(PlayState* play, s16 slot, s16 item); // void func_801153C8(void); // void func_80115428(void); void func_8011552C(PlayState* play, s16 arg1); // void func_801155B4(void); // void func_80115764(void); void func_80115844(PlayState* play, s16 param_2); -s32 func_80115908(PlayState* play, u8 param_2); -void func_801159c0(s16 param_1); -void func_801159EC(s16 arg0); -void func_80115A14(s16 arg0, s16 arg1); +s32 Health_ChangeBy(PlayState* play, s16 healthChange); +void Health_GiveHearts(s16 hearts); +void Rupees_ChangeBy(s16 rupeeChange); +void Inventory_ChangeAmmo(s16 item, s16 ammoChange); void Parameter_AddMagic(PlayState* play, s16 arg1); void func_80115D5C(GameState* gamestate); // void func_80115DB4(void); diff --git a/include/macros.h b/include/macros.h index ec9d214bc6..f4d165b123 100644 --- a/include/macros.h +++ b/include/macros.h @@ -80,21 +80,32 @@ #define C_SLOT_EQUIP(form, button) (gSaveContext.save.equips.cButtonSlots[form][button]) #define CHECK_QUEST_ITEM(item) (GET_SAVE_INVENTORY_QUEST_ITEMS & gBitFlags[item]) +#define SET_QUEST_ITEM(item) (gSaveContext.save.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS | gBitFlags[item])) #define REMOVE_QUEST_ITEM(item) (gSaveContext.save.inventory.questItems = (GET_SAVE_INVENTORY_QUEST_ITEMS & (-1 - gBitFlags[item]))) #define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.inventory.dungeonItems[(void)0, dungeonIndex] & gBitFlags[item]) +#define SET_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.inventory.dungeonItems[(void)0, dungeonIndex] |= (u8)gBitFlags[item]) #define DUNGEON_KEY_COUNT(dungeonIndex) (gSaveContext.save.inventory.dungeonKeys[(void)0, dungeonIndex]) #define GET_CUR_FORM_BTN_ITEM(btn) ((u8)((btn) == EQUIP_SLOT_B ? BUTTON_ITEM_EQUIP(CUR_FORM, btn) : BUTTON_ITEM_EQUIP(0, btn))) +#define GET_CUR_FORM_BTN_SLOT(btn) ((u8)((btn) == EQUIP_SLOT_B ? C_SLOT_EQUIP(CUR_FORM, btn) : C_SLOT_EQUIP(0, btn))) -#define SET_CUR_FORM_BTN_ITEM(btn, item) \ - do { \ - if ((btn) == EQUIP_SLOT_B) { \ - BUTTON_ITEM_EQUIP(CUR_FORM, (btn)) = (item); \ - } else { \ - BUTTON_ITEM_EQUIP(0, (btn)) = (item); \ - } \ - } while (0) + +#define SET_CUR_FORM_BTN_ITEM(btn, item) \ + if ((btn) == EQUIP_SLOT_B) { \ + BUTTON_ITEM_EQUIP(CUR_FORM, (btn)) = (item); \ + } else { \ + BUTTON_ITEM_EQUIP(0, (btn)) = (item); \ + } \ + (void)0 + +#define SET_CUR_FORM_BTN_SLOT(btn, item) \ + if ((btn) == EQUIP_SLOT_B) { \ + C_SLOT_EQUIP(CUR_FORM, (btn)) = (item); \ + } else { \ + C_SLOT_EQUIP(0, (btn)) = (item); \ + } \ + (void)0 #define STOLEN_ITEM_NONE (0) diff --git a/include/z64.h b/include/z64.h index fafd8a40d4..5b35f9d853 100644 --- a/include/z64.h +++ b/include/z64.h @@ -68,10 +68,13 @@ #define Z_PRIORITY_DMAMGR 17 #define Z_PRIORITY_IRQMGR 18 -#define EQUIP_SLOT_B 0 -#define EQUIP_SLOT_C_LEFT 1 -#define EQUIP_SLOT_C_DOWN 2 -#define EQUIP_SLOT_C_RIGHT 3 +typedef enum { + /* 0 */ EQUIP_SLOT_B, + /* 1 */ EQUIP_SLOT_C_LEFT, + /* 2 */ EQUIP_SLOT_C_DOWN, + /* 3 */ EQUIP_SLOT_C_RIGHT, + /* 4 */ EQUIP_SLOT_A +} EquipSlot; typedef struct { /* 0x0 */ s16 priority; // Lower means higher priority. -1 means it ignores priority @@ -500,7 +503,7 @@ typedef struct { /* 0x258 */ s16 unk_258; /* 0x25A */ s16 unk_25A; /* 0x25C */ u16 unk_25C; - /* 0x25E */ u16 unk_25E[5]; // ItemId + /* 0x25E */ u16 cursorItem[5]; /* 0x268 */ u16 unk_268[5]; /* 0x272 */ u16 equipTargetItem; /* 0x274 */ u16 equipTargetSlot; diff --git a/include/z64item.h b/include/z64item.h index 972b729cc8..96ecef2ec9 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -7,10 +7,27 @@ // TODO fill out these enums typedef enum { - /* 0x0 */ EQUIP_SWORD, - /* 0x1 */ EQUIP_SHIELD + /* 0x0 */ EQUIP_TYPE_SWORD, + /* 0x1 */ EQUIP_TYPE_SHIELD, + /* 0x2 */ EQUIP_TYPE_MAX } EquipmentType; +typedef enum { + /* 0 */ EQUIP_VALUE_SWORD_NONE, + /* 1 */ EQUIP_VALUE_SWORD_KOKIRI, + /* 2 */ EQUIP_VALUE_SWORD_RAZOR, + /* 3 */ EQUIP_VALUE_SWORD_GILDED, + /* 4 */ EQUIP_VALUE_SWORD_DIETY, + /* 5 */ EQUIP_VALUE_SWORD_MAX, +} EquipValueSword; + +typedef enum { + /* 0 */ EQUIP_VALUE_SHIELD_NONE, + /* 1 */ EQUIP_VALUE_SHIELD_HERO, + /* 2 */ EQUIP_VALUE_SHIELD_MIRROR, + /* 3 */ EQUIP_VALUE_SHIELD_MAX +} EquipValueShield; + typedef enum { /* 0x00 */ UPG_QUIVER, /* 0x01 */ UPG_BOMB_BAG, @@ -41,9 +58,11 @@ typedef enum { /* 0x0F */ QUEST_SONG_SOARING, /* 0x10 */ QUEST_SONG_STORMS, /* 0x11 */ QUEST_SONG_SUN, - /* 0x12 */ QUEST_BOMBERS_NOTEBOOK, + /* 0x12 */ QUEST_BOMBERS_NOTEBOOK, // Obtained Bombers Notebook + /* 0x13 */ QUEST_SKULL_TOKEN, /* 0x18 */ QUEST_SONG_LULLABY_INTRO = 0x18, - /* 0x19 */ QUEST_UNK_19 // Related to PictoBox + /* 0x19 */ QUEST_PICTOGRAPH, // A photo from the pictograph box is saved + /* 0x1C */ QUEST_HEART_PIECE_COUNT = 0x1C } QuestItem; typedef enum { @@ -268,6 +287,9 @@ typedef enum { /* 0xFF */ ITEM_NONE = 0xFF } ItemID; +#define BOTTLE_FIRST 0 +#define BOTTLE_MAX 6 + typedef enum { /* 0x00 */ GI_NONE, /* 0x01 */ GI_RUPEE_GREEN, diff --git a/spec b/spec index f88340de90..231da54aef 100644 --- a/spec +++ b/spec @@ -500,8 +500,6 @@ beginseg include "build/src/code/z_olib.o" pad_text include "build/src/code/z_parameter.o" - include "build/data/code/z_parameter.data.o" - include "build/data/code/z_parameter.bss.o" include "build/src/code/z_path.o" include "build/src/code/z_pause.o" include "build/src/code/z_player_lib.o" diff --git a/src/code/code_8012EC80.c b/src/code/code_8012EC80.c index e7ff5b7bfa..07cb436cfa 100644 --- a/src/code/code_8012EC80.c +++ b/src/code/code_8012EC80.c @@ -495,7 +495,7 @@ s32 Inventory_GetBtnBItem(PlayState* play) { * Only changes shield */ void Inventory_ChangeEquipment(s16 value) { - SET_EQUIP_VALUE(EQUIP_SHIELD, value); + SET_EQUIP_VALUE(EQUIP_TYPE_SHIELD, value); } /** @@ -504,8 +504,8 @@ void Inventory_ChangeEquipment(s16 value) { u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) { Player* player = GET_PLAYER(play); - if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) { - SET_EQUIP_VALUE(EQUIP_SHIELD, 0); + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != EQUIP_VALUE_SHIELD_NONE) { + SET_EQUIP_VALUE(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_NONE); Player_SetEquipmentData(play, player); return true; } diff --git a/src/code/sched.c b/src/code/sched.c index 927a48f66b..5f9cdf236a 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #define RSP_DONE_MSG 667 diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 0e783e76c9..10c33090cb 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -224,7 +224,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) { break; case ITEM00_FLEXIBLE: case ITEM00_BIG_FAIRY: - func_80115908(play, 0x70); + Health_ChangeBy(play, 0x70); break; case ITEM00_BOMBS_A: case ITEM00_BOMBS_B: @@ -537,7 +537,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { break; case ITEM00_FLEXIBLE: case ITEM00_BIG_FAIRY: - func_80115908(play, 0x70); + Health_ChangeBy(play, 0x70); break; case ITEM00_BOMBS_A: case ITEM00_BOMBS_B: diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 18df07783f..1375d1a4a6 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -36,8 +36,8 @@ void GameOver_Update(PlayState* play) { CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_GILDED && CUR_FORM_EQUIP(EQUIP_SLOT_B) != ITEM_SWORD_DEITY) { - if (gSaveContext.buttonStatus[0] != BTN_ENABLED) { - CUR_FORM_EQUIP(EQUIP_SLOT_B) = gSaveContext.buttonStatus[0]; + if (gSaveContext.buttonStatus[EQUIP_SLOT_B] != BTN_ENABLED) { + CUR_FORM_EQUIP(EQUIP_SLOT_B) = gSaveContext.buttonStatus[EQUIP_SLOT_B]; } else { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE; } @@ -52,11 +52,11 @@ void GameOver_Update(PlayState* play) { gSaveContext.eventInf[1] = 0; gSaveContext.eventInf[2] = 0; gSaveContext.eventInf[3] = 0; - gSaveContext.buttonStatus[0] = BTN_ENABLED; - gSaveContext.buttonStatus[1] = BTN_ENABLED; - gSaveContext.buttonStatus[2] = BTN_ENABLED; - gSaveContext.buttonStatus[3] = BTN_ENABLED; - gSaveContext.buttonStatus[4] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; gSaveContext.unk_3F1E = 0; gSaveContext.unk_3F20 = 0; gSaveContext.unk_3F22 = 0; @@ -73,7 +73,7 @@ void GameOver_Update(PlayState* play) { gSaveContext.respawnFlag = -6; } gSaveContext.nextTransition = 2; - gSaveContext.save.playerData.health = 48; + gSaveContext.save.playerData.health = 0x30; gameOverCtx->state++; if (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU) { gSaveContext.save.playerForm = PLAYER_FORM_HUMAN; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index b5ec93f5a9..3fc3f2e9b6 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -124,10 +124,10 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->unk_258 = 11; pauseCtx->unk_25A = 0; - pauseCtx->unk_25E[PAUSE_0] = 999; - pauseCtx->unk_25E[PAUSE_1] = XREG(94) + 3; - pauseCtx->unk_25E[PAUSE_2] = 999; - pauseCtx->unk_25E[PAUSE_3] = 999; + pauseCtx->cursorItem[PAUSE_0] = 999; + pauseCtx->cursorItem[PAUSE_1] = XREG(94) + 3; + pauseCtx->cursorItem[PAUSE_2] = 999; + pauseCtx->cursorItem[PAUSE_3] = 999; pauseCtx->unk_268[PAUSE_0] = 0; pauseCtx->unk_268[PAUSE_1] = XREG(94) + 3; diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 900f46e8f4..f33a949d86 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -415,16 +415,16 @@ void LifeMeter_UpdateSizeAndBeep(PlayState* play) { u32 LifeMeter_IsCritical(void) { s16 criticalThreshold; - if (gSaveContext.save.playerData.healthCapacity <= 80) { // healthCapacity <= 5 hearts? - criticalThreshold = 16; + if (gSaveContext.save.playerData.healthCapacity <= 0x50) { + criticalThreshold = 0x10; - } else if (gSaveContext.save.playerData.healthCapacity <= 160) { // healthCapacity <= 10 hearts? - criticalThreshold = 24; + } else if (gSaveContext.save.playerData.healthCapacity <= 0xA0) { + criticalThreshold = 0x18; - } else if (gSaveContext.save.playerData.healthCapacity <= 240) { // healthCapacity <= 15 hearts? - criticalThreshold = 32; + } else if (gSaveContext.save.playerData.healthCapacity <= 0xF0) { + criticalThreshold = 0x20; } else { - criticalThreshold = 44; + criticalThreshold = 0x2C; } if ((criticalThreshold >= gSaveContext.save.playerData.health) && (gSaveContext.save.playerData.health > 0)) { diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 44b1de152d..a76cb36e0b 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,4 +1,225 @@ #include "global.h" +#include "interface/parameter_static/parameter_static.h" +#include "interface/do_action_static/do_action_static.h" +#include "misc/story_static/story_static.h" +#include "overlays/gamestates/ovl_file_choose/z_file_choose.h" + +typedef struct { + /* 0x00 */ u8 scene; + /* 0x01 */ u8 flags1; + /* 0x02 */ u8 flags2; + /* 0x03 */ u8 flags3; +} RestrictionFlags; + +Input D_801F5850[4]; + +RestrictionFlags sRestrictionFlags[] = { + { SCENE_20SICHITAI2, 0x00, 0x00, 0x00 }, + { SCENE_UNSET_1, 0x00, 0x00, 0x00 }, + { SCENE_UNSET_2, 0x00, 0x00, 0x00 }, + { SCENE_UNSET_3, 0x00, 0x00, 0x00 }, + { SCENE_UNSET_4, 0x00, 0x00, 0x00 }, + { SCENE_UNSET_5, 0x00, 0x00, 0x00 }, + { SCENE_UNSET_6, 0x00, 0x00, 0x00 }, + { SCENE_KAKUSIANA, 0x00, 0x00, 0x00 }, + { SCENE_SPOT00, 0x00, 0x00, 0x00 }, + { SCENE_UNSET_9, 0x00, 0x00, 0x00 }, + { SCENE_WITCH_SHOP, 0x10, 0x30, 0xC1 }, + { SCENE_LAST_BS, 0x00, 0x3F, 0x00 }, + { SCENE_HAKASHITA, 0x00, 0x00, 0x00 }, + { SCENE_AYASHIISHOP, 0x10, 0x30, 0xC1 }, + { SCENE_UNSET_E, 0x00, 0x00, 0x00 }, + { SCENE_UNSET_F, 0x00, 0x00, 0x00 }, + { SCENE_OMOYA, 0x00, 0x33, 0x00 }, + { SCENE_BOWLING, 0x10, 0x30, 0xC1 }, + { SCENE_SONCHONOIE, 0x10, 0x30, 0xC1 }, + { SCENE_IKANA, 0x00, 0x00, 0x00 }, + { SCENE_KAIZOKU, 0x00, 0x00, 0x00 }, + { SCENE_MILK_BAR, 0x10, 0x30, 0xC1 }, + { SCENE_INISIE_N, 0x00, 0x00, 0x00 }, + { SCENE_TAKARAYA, 0x10, 0x30, 0xC1 }, + { SCENE_INISIE_R, 0x00, 0x00, 0x00 }, + { SCENE_OKUJOU, 0x00, 0x3F, 0xF0 }, + { SCENE_OPENINGDAN, 0x00, 0x00, 0x00 }, + { SCENE_MITURIN, 0x00, 0x00, 0x00 }, + { SCENE_13HUBUKINOMITI, 0x00, 0x00, 0x00 }, + { SCENE_CASTLE, 0x00, 0x00, 0x00 }, + { SCENE_DEKUTES, 0x10, 0x30, 0x01 }, + { SCENE_MITURIN_BS, 0x00, 0x00, 0x00 }, + { SCENE_SYATEKI_MIZU, 0x10, 0x30, 0xC1 }, + { SCENE_HAKUGIN, 0x00, 0x00, 0x00 }, + { SCENE_ROMANYMAE, 0x00, 0x00, 0x00 }, + { SCENE_PIRATE, 0x00, 0x00, 0x00 }, + { SCENE_SYATEKI_MORI, 0x10, 0x30, 0xC1 }, + { SCENE_SINKAI, 0x00, 0x00, 0x00 }, + { SCENE_YOUSEI_IZUMI, 0x00, 0x00, 0x00 }, + { SCENE_KINSTA1, 0x00, 0x30, 0x00 }, + { SCENE_KINDAN2, 0x00, 0x30, 0x00 }, + { SCENE_TENMON_DAI, 0x00, 0x03, 0xC0 }, + { SCENE_LAST_DEKU, 0x00, 0x3F, 0x00 }, + { SCENE_22DEKUCITY, 0x00, 0x00, 0x00 }, + { SCENE_KAJIYA, 0x00, 0x30, 0xC0 }, + { SCENE_00KEIKOKU, 0x00, 0x00, 0x00 }, + { SCENE_POSTHOUSE, 0x00, 0x30, 0xC1 }, + { SCENE_LABO, 0x00, 0x30, 0xC1 }, + { SCENE_DANPEI2TEST, 0x00, 0x30, 0x00 }, + { SCENE_UNSET_31, 0x00, 0x00, 0x00 }, + { SCENE_16GORON_HOUSE, 0x00, 0x00, 0x00 }, + { SCENE_33ZORACITY, 0x00, 0x00, 0xC0 }, + { SCENE_8ITEMSHOP, 0x00, 0x30, 0xC1 }, + { SCENE_F01, 0x00, 0x00, 0x00 }, + { SCENE_INISIE_BS, 0x00, 0x00, 0x00 }, + { SCENE_30GYOSON, 0x00, 0x00, 0x00 }, + { SCENE_31MISAKI, 0x00, 0x00, 0x00 }, + { SCENE_TAKARAKUJI, 0x00, 0x30, 0xC1 }, + { SCENE_UNSET_3A, 0x00, 0x00, 0x00 }, + { SCENE_TORIDE, 0x00, 0x00, 0x00 }, + { SCENE_FISHERMAN, 0x00, 0x30, 0xC1 }, + { SCENE_GORONSHOP, 0x10, 0x30, 0xC1 }, + { SCENE_DEKU_KING, 0x00, 0x30, 0xC0 }, + { SCENE_LAST_GORON, 0x00, 0x3F, 0x00 }, + { SCENE_24KEMONOMITI, 0x00, 0x00, 0x00 }, + { SCENE_F01_B, 0x00, 0x30, 0x00 }, + { SCENE_F01C, 0x00, 0x30, 0x00 }, + { SCENE_BOTI, 0x00, 0x00, 0x00 }, + { SCENE_HAKUGIN_BS, 0x00, 0x00, 0x00 }, + { SCENE_20SICHITAI, 0x00, 0x00, 0x00 }, + { SCENE_21MITURINMAE, 0x00, 0x00, 0x00 }, + { SCENE_LAST_ZORA, 0x00, 0x3F, 0x00 }, + { SCENE_11GORONNOSATO2, 0x00, 0x00, 0x00 }, + { SCENE_SEA, 0x00, 0x00, 0x00 }, + { SCENE_35TAKI, 0x00, 0x00, 0x00 }, + { SCENE_REDEAD, 0x00, 0x00, 0x00 }, + { SCENE_BANDROOM, 0x00, 0x30, 0xC0 }, + { SCENE_11GORONNOSATO, 0x00, 0x00, 0x00 }, + { SCENE_GORON_HAKA, 0x00, 0x00, 0x00 }, + { SCENE_SECOM, 0x00, 0x3C, 0xC0 }, + { SCENE_10YUKIYAMANOMURA, 0x00, 0x00, 0x00 }, + { SCENE_TOUGITES, 0x00, 0x3F, 0xF0 }, + { SCENE_DANPEI, 0x00, 0x30, 0x00 }, + { SCENE_IKANAMAE, 0x00, 0x00, 0x00 }, + { SCENE_DOUJOU, 0x00, 0x30, 0xC1 }, + { SCENE_MUSICHOUSE, 0x00, 0x30, 0xC0 }, + { SCENE_IKNINSIDE, 0x00, 0x3F, 0xC0 }, + { SCENE_MAP_SHOP, 0x10, 0x30, 0xC1 }, + { SCENE_F40, 0x00, 0x00, 0x00 }, + { SCENE_F41, 0x00, 0x00, 0x00 }, + { SCENE_10YUKIYAMANOMURA2, 0x00, 0x00, 0x00 }, + { SCENE_14YUKIDAMANOMITI, 0x00, 0x00, 0x00 }, + { SCENE_12HAKUGINMAE, 0x00, 0x00, 0x00 }, + { SCENE_17SETUGEN, 0x00, 0x00, 0x00 }, + { SCENE_17SETUGEN2, 0x00, 0x00, 0x00 }, + { SCENE_SEA_BS, 0x00, 0x00, 0x00 }, + { SCENE_RANDOM, 0x00, 0x00, 0x00 }, + { SCENE_YADOYA, 0x10, 0x30, 0xC1 }, + { SCENE_KONPEKI_ENT, 0x00, 0x00, 0x00 }, + { SCENE_INSIDETOWER, 0x00, 0xFF, 0xC0 }, + { SCENE_26SARUNOMORI, 0x00, 0x30, 0x00 }, + { SCENE_LOST_WOODS, 0x00, 0x00, 0x00 }, + { SCENE_LAST_LINK, 0x00, 0x3F, 0x00 }, + { SCENE_SOUGEN, 0x00, 0x3F, 0x00 }, + { SCENE_BOMYA, 0x10, 0x30, 0xC1 }, + { SCENE_KYOJINNOMA, 0x00, 0x00, 0x00 }, + { SCENE_KOEPONARACE, 0x00, 0x30, 0x00 }, + { SCENE_GORONRACE, 0x00, 0x00, 0x00 }, + { SCENE_TOWN, 0x00, 0x00, 0x00 }, + { SCENE_ICHIBA, 0x00, 0x00, 0x00 }, + { SCENE_BACKTOWN, 0x00, 0x00, 0x00 }, + { SCENE_CLOCKTOWER, 0x00, 0x00, 0x00 }, + { SCENE_ALLEY, 0x00, 0x00, 0x00 }, +}; + +s16 D_801BF884 = 0; // pictoBox related +s16 D_801BF888 = false; // pictoBox related + +s16 sHBAScoreTier = 0; // Remnant of OoT, non-functional + +u16 sMinigameScoreDigits[] = { 0, 0, 0, 0 }; + +u16 sCUpInvisible = 0; +u16 sCUpTimer = 0; + +s16 sMagicBarOutlinePrimRed = 255; +s16 sMagicBarOutlinePrimGreen = 255; +s16 sMagicBarOutlinePrimBlue = 255; +s16 D_801BF8AC = 2; // sMagicBorderRatio +s16 D_801BF8B0 = 1; + +s16 sExtraItemBases[] = { + ITEM_STICK, // ITEM_STICKS_5 + ITEM_STICK, // ITEM_STICKS_10 + ITEM_NUT, // ITEM_NUTS_5 + ITEM_NUT, // ITEM_NUTS_10 + ITEM_BOMB, // ITEM_BOMBS_5 + ITEM_BOMB, // ITEM_BOMBS_10 + ITEM_BOMB, // ITEM_BOMBS_20 + ITEM_BOMB, // ITEM_BOMBS_30 + ITEM_BOW, // ITEM_ARROWS_10 + ITEM_BOW, // ITEM_ARROWS_30 + ITEM_BOW, // ITEM_ARROWS_40 + ITEM_BOMBCHU, // ITEM_ARROWS_50 !@bug this data is missing an ITEM_BOW, offsetting the rest by 1 + ITEM_BOMBCHU, // ITEM_BOMBCHUS_20 + ITEM_BOMBCHU, // ITEM_BOMBCHUS_10 + ITEM_BOMBCHU, // ITEM_BOMBCHUS_1 + ITEM_STICK, // ITEM_BOMBCHUS_5 + ITEM_STICK, // ITEM_STICK_UPGRADE_20 + ITEM_NUT, // ITEM_STICK_UPGRADE_30 + ITEM_NUT, // ITEM_NUT_UPGRADE_30 +}; + +s16 D_801BF8DC = 0; +s16 D_801BF8E0 = 0; +s16 D_801BF8E4 = 0; + +OSTime D_801BF8E8 = 0; +OSTime D_801BF8F0 = 0; +OSTime D_801BF8F8[] = { + 0, 0, 0, 0, 0, 0, 0, +}; +OSTime D_801BF930[] = { + 0, 0, 0, 0, 0, 0, 0, +}; + +u8 D_801BF968 = false; +u8 D_801BF96C = false; + +s16 D_801BF970 = 99; +s16 D_801BF974 = 0; +s16 D_801BF978 = 10; +s16 D_801BF97C = 255; +f32 D_801BF980 = 1.0f; +s32 D_801BF984 = 0; + +Gfx D_801BF988[] = { + gsDPPipeSync(), + gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | + G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), + gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_1PRIMITIVE, + G_AC_NONE | G_ZS_PIXEL | G_RM_CLD_SURF | G_RM_CLD_SURF2), + gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE), + gsSPEndDisplayList(), +}; + +s16 D_801BF9B0 = 0; +f32 D_801BF9B4[] = { 100.0f, 109.0f }; +s16 D_801BF9BC[] = { 0x226, 0x2A8, 0x2A8, 0x2A8 }; +s16 D_801BF9C4[] = { 0x9E, 0x9B }; +s16 D_801BF9C8[] = { 0x17, 0x16 }; +f32 D_801BF9CC[] = { -380.0f, -350.0f }; +s16 D_801BF9D4[] = { 0xA7, 0xE3 }; +s16 D_801BF9D8[] = { 0xF9, 0x10F }; +s16 D_801BF9DC[] = { 0x11, 0x12 }; +s16 D_801BF9E0[] = { 0x22, 0x12 }; +s16 D_801BF9E4[] = { 0x23F, 0x26C }; +s16 D_801BF9E8[] = { 0x26C, 0x26C }; + +s16 sFinalHoursClockDigitsRed = 0; +s16 sFinalHoursClockFrameEnvRed = 0; +s16 sFinalHoursClockFrameEnvGreen = 0; +s16 sFinalHoursClockFrameEnvBlue = 0; +s16 sFinalHoursClockColorTimer = 15; +s16 sFinalHoursClockColorTargetIndex = 0; #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010CB80.s") @@ -18,8 +239,29 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010DE38.s") +s16 D_801BFA04[] = { + -14, -14, -24, -8, -12, -12, -7, -8, -7, -8, -12, 0, +}; +s16 D_801BFA1C[] = { + 0x1C, 0x1C, 0x30, 0x10, 0x18, 0x18, 0x10, 0x10, 0x10, 0x10, 0x18, 0, +}; +s16 D_801BFA34[] = { + 14, 14, 8, 24, -82, -82, 58, 59, 58, 59, 32, 0, +}; +s16 D_801BFA4C[] = { + 0x1C, 0x1C, 0x10, 0x10, 0x18, 0x18, 0xB, 0xB, 0xB, 0xB, 0x20, 0, +}; +s16 D_801BFA64[] = { + -61, -45, 29, 104, -117, -42, 32, 55, +}; +s16 D_801BFA74[] = { + 1, -70, -99, -70, 71, 101, 72, 1, +}; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010E028.s") +s32 D_801BFA84 = 0; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010E968.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010E9F0.s") @@ -28,6 +270,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EB50.s") +void func_8010EBA0(s16 timer, s16 timerId); #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EBA0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EC54.s") @@ -52,38 +295,755 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80112AFC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80112B40.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_LoadItemIconImpl.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80112BE4.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_LoadItemIcon.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80112C0C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Item_Give.s") +s16 sAmmoRefillCounts[] = { 5, 10, 20, 30 }; // Sticks, nuts, bombs +s16 sArrowRefillCounts[] = { 10, 30, 40, 50 }; +s16 sBombchuRefillCounts[] = { 20, 10, 1, 5 }; +s16 sRupeeRefillCounts[] = { 1, 5, 10, 20, 50, 100, 200 }; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801143CC.s") +u8 Item_Give(PlayState* play, u8 item) { + Player* player = GET_PLAYER(play); + u8 i; + u8 temp; + u8 slot; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80114978.s") + slot = SLOT(item); + if (item >= ITEM_STICKS_5) { + slot = SLOT(sExtraItemBases[item - ITEM_STICKS_5]); + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801149A0.s") + if (item == ITEM_SKULL_TOKEN) { + SET_QUEST_ITEM(item - ITEM_SKULL_TOKEN + QUEST_SKULL_TOKEN); + Inventory_IncrementSkullTokenCount(play->sceneNum); + return ITEM_NONE; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80114A9C.s") + } else if (item == ITEM_TINGLE_MAP) { + return ITEM_NONE; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80114B84.s") + } else if (item == ITEM_BOMBERS_NOTEBOOK) { + SET_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK); + return ITEM_NONE; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80114CA0.s") + } else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) { + gSaveContext.save.inventory.questItems += (1 << QUEST_HEART_PIECE_COUNT); + if ((gSaveContext.save.inventory.questItems & 0xF0000000) == (4 << QUEST_HEART_PIECE_COUNT)) { + gSaveContext.save.inventory.questItems ^= (4 << QUEST_HEART_PIECE_COUNT); + gSaveContext.save.playerData.healthCapacity += 0x10; + gSaveContext.save.playerData.health += 0x10; + } + return ITEM_NONE; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_HasEmptyBottle.s") + } else if (item == ITEM_HEART_CONTAINER) { + gSaveContext.save.playerData.healthCapacity += 0x10; + gSaveContext.save.playerData.health += 0x10; + return ITEM_NONE; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_HasItemInBottle.s") + } else if ((item >= ITEM_SONG_SONATA) && (item <= ITEM_SONG_LULLABY_INTRO)) { + SET_QUEST_ITEM(item - ITEM_SONG_SONATA + QUEST_SONG_SONATA); + return ITEM_NONE; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80114FD0.s") + } else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_GILDED)) { + SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, item - ITEM_SWORD_KOKIRI + EQUIP_VALUE_SWORD_KOKIRI); + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = item; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); + if (item == ITEM_SWORD_RAZOR) { + gSaveContext.save.playerData.swordHealth = 100; + } + return ITEM_NONE; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115130.s") + } else if ((item >= ITEM_SHIELD_HERO) && (item <= ITEM_SHIELD_MIRROR)) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != (u16)(item - ITEM_SHIELD_HERO + EQUIP_VALUE_SHIELD_HERO)) { + SET_EQUIP_VALUE(EQUIP_TYPE_SHIELD, item - ITEM_SHIELD_HERO + EQUIP_VALUE_SHIELD_HERO); + Player_SetEquipmentData(play, player); + return ITEM_NONE; + } + return item; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801152B8.s") + } else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) { + SET_DUNGEON_ITEM(item - ITEM_KEY_BOSS, gSaveContext.mapIndex); + return ITEM_NONE; + + } else if (item == ITEM_KEY_SMALL) { + if (DUNGEON_KEY_COUNT(gSaveContext.mapIndex) < 0) { + DUNGEON_KEY_COUNT(gSaveContext.mapIndex) = 1; + return ITEM_NONE; + } else { + DUNGEON_KEY_COUNT(gSaveContext.mapIndex)++; + return ITEM_NONE; + } + + } else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) { + if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { + Inventory_ChangeUpgrade(UPG_QUIVER, 1); + INV_CONTENT(ITEM_BOW) = ITEM_BOW; + AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 1); + return ITEM_NONE; + } else { + AMMO(ITEM_BOW)++; + if (AMMO(ITEM_BOW) > (s8)CUR_CAPACITY(UPG_QUIVER)) { + AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER); + } + } + + } else if (item == ITEM_QUIVER_40) { + Inventory_ChangeUpgrade(UPG_QUIVER, 2); + INV_CONTENT(ITEM_BOW) = ITEM_BOW; + AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 2); + return ITEM_NONE; + + } else if (item == ITEM_QUIVER_50) { + Inventory_ChangeUpgrade(UPG_QUIVER, 3); + INV_CONTENT(ITEM_BOW) = ITEM_BOW; + AMMO(ITEM_BOW) = CAPACITY(UPG_QUIVER, 3); + return ITEM_NONE; + + } else if (item == ITEM_BOMB_BAG_20) { + if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { + Inventory_ChangeUpgrade(UPG_BOMB_BAG, 1); + INV_CONTENT(ITEM_BOMB) = ITEM_BOMB; + AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 1); + return ITEM_NONE; + + } else { + AMMO(ITEM_BOMB)++; + if (AMMO(ITEM_BOMB) > CUR_CAPACITY(UPG_BOMB_BAG)) { + AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); + } + } + + } else if (item == ITEM_BOMB_BAG_30) { + Inventory_ChangeUpgrade(UPG_BOMB_BAG, 2); + INV_CONTENT(ITEM_BOMB) = ITEM_BOMB; + AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 2); + return ITEM_NONE; + + } else if (item == ITEM_BOMB_BAG_40) { + Inventory_ChangeUpgrade(UPG_BOMB_BAG, 3); + INV_CONTENT(ITEM_BOMB) = ITEM_BOMB; + AMMO(ITEM_BOMB) = CAPACITY(UPG_BOMB_BAG, 3); + return ITEM_NONE; + + } else if (item == ITEM_WALLET_ADULT) { + Inventory_ChangeUpgrade(UPG_WALLET, 1); + return ITEM_NONE; + + } else if (item == ITEM_WALLET_GIANT) { + Inventory_ChangeUpgrade(UPG_WALLET, 2); + return ITEM_NONE; + + } else if (item == ITEM_STICK_UPGRADE_20) { + if (INV_CONTENT(ITEM_STICK) != ITEM_STICK) { + INV_CONTENT(ITEM_STICK) = ITEM_STICK; + } + Inventory_ChangeUpgrade(UPG_STICKS, 2); + AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 2); + return ITEM_NONE; + + } else if (item == ITEM_STICK_UPGRADE_30) { + if (INV_CONTENT(ITEM_STICK) != ITEM_STICK) { + INV_CONTENT(ITEM_STICK) = ITEM_STICK; + } + Inventory_ChangeUpgrade(UPG_STICKS, 3); + AMMO(ITEM_STICK) = CAPACITY(UPG_STICKS, 3); + return ITEM_NONE; + + } else if (item == ITEM_NUT_UPGRADE_30) { + if (INV_CONTENT(ITEM_NUT) != ITEM_NUT) { + INV_CONTENT(ITEM_NUT) = ITEM_NUT; + } + Inventory_ChangeUpgrade(UPG_NUTS, 2); + AMMO(ITEM_NUT) = CAPACITY(UPG_NUTS, 2); + return ITEM_NONE; + + } else if (item == ITEM_NUT_UPGRADE_40) { + if (INV_CONTENT(ITEM_NUT) != ITEM_NUT) { + INV_CONTENT(ITEM_NUT) = ITEM_NUT; + } + Inventory_ChangeUpgrade(UPG_NUTS, 3); + AMMO(ITEM_NUT) = CAPACITY(UPG_NUTS, 3); + return ITEM_NONE; + + } else if (item == ITEM_STICK) { + if (INV_CONTENT(ITEM_STICK) != ITEM_STICK) { + Inventory_ChangeUpgrade(UPG_STICKS, 1); + AMMO(ITEM_STICK) = 1; + } else { + AMMO(ITEM_STICK)++; + if (AMMO(ITEM_STICK) > CUR_CAPACITY(UPG_STICKS)) { + AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); + } + } + + } else if ((item == ITEM_STICKS_5) || (item == ITEM_STICKS_10)) { + if (INV_CONTENT(ITEM_STICK) != ITEM_STICK) { + Inventory_ChangeUpgrade(UPG_STICKS, 1); + AMMO(ITEM_STICK) = sAmmoRefillCounts[item - ITEM_STICKS_5]; + } else { + AMMO(ITEM_STICK) += sAmmoRefillCounts[item - ITEM_STICKS_5]; + if (AMMO(ITEM_STICK) > CUR_CAPACITY(UPG_STICKS)) { + AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); + } + } + + item = ITEM_STICK; + + } else if (item == ITEM_NUT) { + if (INV_CONTENT(ITEM_NUT) != ITEM_NUT) { + Inventory_ChangeUpgrade(UPG_NUTS, 1); + AMMO(ITEM_NUT) = 1; + } else { + AMMO(ITEM_NUT)++; + if (AMMO(ITEM_NUT) > CUR_CAPACITY(UPG_NUTS)) { + AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); + } + } + + } else if ((item == ITEM_NUTS_5) || (item == ITEM_NUTS_10)) { + if (INV_CONTENT(ITEM_NUT) != ITEM_NUT) { + Inventory_ChangeUpgrade(UPG_NUTS, 1); + AMMO(ITEM_NUT) += sAmmoRefillCounts[item - ITEM_NUTS_5]; + } else { + AMMO(ITEM_NUT) += sAmmoRefillCounts[item - ITEM_NUTS_5]; + if (AMMO(ITEM_NUT) > CUR_CAPACITY(UPG_NUTS)) { + AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); + } + } + item = ITEM_NUT; + + } else if (item == ITEM_POWDER_KEG) { + if (INV_CONTENT(ITEM_POWDER_KEG) != ITEM_POWDER_KEG) { + INV_CONTENT(ITEM_POWDER_KEG) = ITEM_POWDER_KEG; + } + + AMMO(ITEM_POWDER_KEG) = 1; + return ITEM_NONE; + + } else if (item == ITEM_BOMB) { + if ((AMMO(ITEM_BOMB) += 1) > CUR_CAPACITY(UPG_BOMB_BAG)) { + AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); + } + return ITEM_NONE; + + } else if ((item >= ITEM_BOMBS_5) && (item <= ITEM_BOMBS_30)) { + if (gSaveContext.save.inventory.items[SLOT_BOMB] != ITEM_BOMB) { + INV_CONTENT(ITEM_BOMB) = ITEM_BOMB; + AMMO(ITEM_BOMB) += sAmmoRefillCounts[item - ITEM_BOMBS_5]; + return ITEM_NONE; + } + + if ((AMMO(ITEM_BOMB) += sAmmoRefillCounts[item - ITEM_BOMBS_5]) > CUR_CAPACITY(UPG_BOMB_BAG)) { + AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); + } + return ITEM_NONE; + + } else if (item == ITEM_BOMBCHU) { + if (INV_CONTENT(ITEM_BOMBCHU) != ITEM_BOMBCHU) { + INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU; + AMMO(ITEM_BOMBCHU) = 10; + return ITEM_NONE; + } + if ((AMMO(ITEM_BOMBCHU) += 10) > CUR_CAPACITY(UPG_BOMB_BAG)) { + AMMO(ITEM_BOMBCHU) = CUR_CAPACITY(UPG_BOMB_BAG); + } + return ITEM_NONE; + + } else if ((item >= ITEM_BOMBCHUS_20) && (item <= ITEM_BOMBCHUS_5)) { + if (gSaveContext.save.inventory.items[SLOT_BOMBCHU] != ITEM_BOMBCHU) { + INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU; + AMMO(ITEM_BOMBCHU) += sBombchuRefillCounts[item - ITEM_BOMBCHUS_20]; + + if (AMMO(ITEM_BOMBCHU) > CUR_CAPACITY(UPG_BOMB_BAG)) { + AMMO(ITEM_BOMBCHU) = CUR_CAPACITY(UPG_BOMB_BAG); + } + return ITEM_NONE; + } + + if ((AMMO(ITEM_BOMBCHU) += sBombchuRefillCounts[item - ITEM_BOMBCHUS_20]) > CUR_CAPACITY(UPG_BOMB_BAG)) { + AMMO(ITEM_BOMBCHU) = CUR_CAPACITY(UPG_BOMB_BAG); + } + return ITEM_NONE; + + } else if ((item >= ITEM_ARROWS_10) && (item <= ITEM_ARROWS_50)) { + AMMO(ITEM_BOW) += sArrowRefillCounts[item - ITEM_ARROWS_10]; + + if ((AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) || (AMMO(ITEM_BOW) < 0)) { + AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER); + } + return ITEM_BOW; + + } else if (item == ITEM_OCARINA) { + INV_CONTENT(ITEM_OCARINA) = ITEM_OCARINA; + return ITEM_NONE; + + } else if (item == ITEM_MAGIC_BEANS) { + if (INV_CONTENT(ITEM_MAGIC_BEANS) == ITEM_NONE) { + INV_CONTENT(item) = item; + AMMO(ITEM_MAGIC_BEANS) = 1; + } else if (AMMO(ITEM_MAGIC_BEANS) < 20) { + AMMO(ITEM_MAGIC_BEANS)++; + } else { + AMMO(ITEM_MAGIC_BEANS) = 20; + } + return ITEM_NONE; + + } else if ((item >= ITEM_REMAINS_ODOLWA) && (item <= ITEM_REMAINS_TWINMOLD)) { + SET_QUEST_ITEM(item - ITEM_REMAINS_ODOLWA + QUEST_REMAINS_ODOWLA); + return ITEM_NONE; + + } else if (item == ITEM_HEART) { + Health_ChangeBy(play, 0x10); + return item; + + } else if (item == ITEM_MAGIC_SMALL) { + Parameter_AddMagic(play, 0x18); + if (!(gSaveContext.save.weekEventReg[12] & 0x80)) { + gSaveContext.save.weekEventReg[12] |= 0x80; + return ITEM_NONE; + } + return item; + + } else if (item == ITEM_MAGIC_LARGE) { + Parameter_AddMagic(play, 0x30); + if (!(gSaveContext.save.weekEventReg[12] & 0x80)) { + gSaveContext.save.weekEventReg[12] |= 0x80; + return ITEM_NONE; + } + return item; + + } else if ((item >= ITEM_RUPEE_GREEN) && (item <= ITEM_RUPEE_HUGE)) { + Rupees_ChangeBy(sRupeeRefillCounts[item - ITEM_RUPEE_GREEN]); + return ITEM_NONE; + + } else if (item == ITEM_LONGSHOT) { + slot = SLOT(item); + + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.inventory.items[slot + i] = ITEM_POTION_RED; + return ITEM_NONE; + } + } + return item; + + } else if ((item == ITEM_MILK_BOTTLE) || (item == ITEM_POE) || (item == ITEM_GOLD_DUST) || (item == ITEM_CHATEAU) || + (item == ITEM_HYLIAN_LOACH)) { + slot = SLOT(item); + + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.inventory.items[slot + i] = item; + return ITEM_NONE; + } + } + return item; + + } else if (item == ITEM_BOTTLE) { + slot = SLOT(item); + + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.inventory.items[slot + i] = item; + return ITEM_NONE; + } + } + return item; + + } else if (((item >= ITEM_POTION_RED) && (item <= ITEM_OBABA_DRINK)) || (item == ITEM_CHATEAU_2) || + (item == ITEM_MILK) || (item == ITEM_GOLD_DUST_2) || (item == ITEM_HYLIAN_LOACH_2) || + (item == ITEM_SEA_HORSE_CAUGHT)) { + slot = SLOT(item); + + if ((item != ITEM_MILK_BOTTLE) && (item != ITEM_MILK_HALF)) { + if (item == ITEM_CHATEAU_2) { + item = ITEM_CHATEAU; + + } else if (item == ITEM_MILK) { + item = ITEM_MILK_BOTTLE; + + } else if (item == ITEM_GOLD_DUST_2) { + item = ITEM_GOLD_DUST; + + } else if (item == ITEM_HYLIAN_LOACH_2) { + item = ITEM_HYLIAN_LOACH; + + } else if (item == ITEM_SEA_HORSE_CAUGHT) { + item = ITEM_SEA_HORSE; + } + slot = SLOT(item); + + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[slot + i] == ITEM_BOTTLE) { + if (item == ITEM_HOT_SPRING_WATER) { + func_8010EBA0(60, i); + } + + if ((slot + i) == C_SLOT_EQUIP(0, EQUIP_SLOT_C_LEFT)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_LEFT) = item; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_LEFT); + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED; + } else if ((slot + i) == C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = item; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_DOWN); + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; + } else if ((slot + i) == C_SLOT_EQUIP(0, EQUIP_SLOT_C_RIGHT)) { + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_RIGHT) = item; + Interface_LoadItemIconImpl(play, EQUIP_SLOT_C_RIGHT); + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; + } + + gSaveContext.save.inventory.items[slot + i] = item; + return ITEM_NONE; + } + } + } else { + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.inventory.items[slot + i] = item; + return ITEM_NONE; + } + } + } + + } else if ((item >= ITEM_MOON_TEAR) && (item <= ITEM_MASK_GIANT)) { + temp = INV_CONTENT(item); + INV_CONTENT(item) = item; + if ((item >= ITEM_MOON_TEAR) && (item <= ITEM_PENDANT_MEMORIES) && (temp != ITEM_NONE)) { + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (temp == GET_CUR_FORM_BTN_ITEM(i)) { + SET_CUR_FORM_BTN_ITEM(i, item); + Interface_LoadItemIconImpl(play, i); + return ITEM_NONE; + } + } + } + return ITEM_NONE; + } + + temp = gSaveContext.save.inventory.items[slot]; + INV_CONTENT(item) = item; + return temp; +} + +u8 Item_CheckObtainabilityImpl(u8 item) { + s16 i; + u8 slot; + u8 bottleSlot; + + slot = SLOT(item); + if (item >= ITEM_STICKS_5) { + slot = SLOT(sExtraItemBases[item - ITEM_STICKS_5]); + } + + if (item == ITEM_SKULL_TOKEN) { + return ITEM_NONE; + + } else if (item == ITEM_TINGLE_MAP) { + return ITEM_NONE; + + } else if (item == ITEM_BOMBERS_NOTEBOOK) { + return ITEM_NONE; + + } else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_GILDED)) { + return ITEM_NONE; + + } else if ((item >= ITEM_SHIELD_HERO) && (item <= ITEM_SHIELD_MIRROR)) { + return ITEM_NONE; + + } else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) { + if (!CHECK_DUNGEON_ITEM(item - ITEM_KEY_BOSS, gSaveContext.mapIndex)) { + return ITEM_NONE; + } + return item; + + } else if (item == ITEM_KEY_SMALL) { + return ITEM_NONE; + + } else if ((item == ITEM_OCARINA) || (item == ITEM_BOMBCHU) || (item == ITEM_HOOKSHOT) || (item == ITEM_LENS) || + (item == ITEM_SWORD_GREAT_FAIRY) || (item == ITEM_PICTO_BOX)) { + if (INV_CONTENT(item) == ITEM_NONE) { + return ITEM_NONE; + } + return INV_CONTENT(item); + + } else if ((item >= ITEM_BOMBS_5) && (item == ITEM_BOMBS_30)) { + //! @bug: Should be a range check: (item <= ITEM_BOMBS_30) + if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { + return ITEM_NONE; + } + return 0; + + } else if ((item >= ITEM_BOMBCHUS_20) && (item <= ITEM_BOMBCHUS_5)) { + if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { + return ITEM_NONE; + } + return 0; + + } else if ((item == ITEM_QUIVER_30) || (item == ITEM_BOW)) { + if (CUR_UPG_VALUE(UPG_QUIVER) == 0) { + return ITEM_NONE; + } + return 0; + + } else if ((item == ITEM_QUIVER_40) || (item == ITEM_QUIVER_50)) { + return ITEM_NONE; + + } else if ((item == ITEM_BOMB_BAG_20) || (item == ITEM_BOMB)) { + if (CUR_UPG_VALUE(UPG_BOMB_BAG) == 0) { + return ITEM_NONE; + } + return 0; + + } else if ((item >= ITEM_STICK_UPGRADE_20) && (item <= ITEM_NUT_UPGRADE_40)) { + return ITEM_NONE; + + } else if ((item >= ITEM_BOMB_BAG_30) && (item <= ITEM_WALLET_GIANT)) { + return ITEM_NONE; + + } else if (item == ITEM_MAGIC_BEANS) { + return ITEM_NONE; + + } else if (item == ITEM_POWDER_KEG) { + return ITEM_NONE; + + } else if ((item == ITEM_HEART_PIECE_2) || (item == ITEM_HEART_PIECE)) { + return ITEM_NONE; + + } else if (item == ITEM_HEART_CONTAINER) { + return ITEM_NONE; + + } else if (item == ITEM_HEART) { + return ITEM_HEART; + + } else if ((item == ITEM_MAGIC_SMALL) || (item == ITEM_MAGIC_LARGE)) { + if (!(gSaveContext.save.weekEventReg[12] & 0x80)) { + return ITEM_NONE; + } + return item; + + } else if ((item >= ITEM_RUPEE_GREEN) && (item <= ITEM_RUPEE_HUGE)) { + return ITEM_NONE; + + } else if ((item >= ITEM_REMAINS_ODOLWA) && (item <= ITEM_REMAINS_TWINMOLD)) { + return ITEM_NONE; + + } else if (item == ITEM_LONGSHOT) { + return ITEM_NONE; + + } else if (item == ITEM_BOTTLE) { + return ITEM_NONE; + + } else if ((item == ITEM_MILK_BOTTLE) || (item == ITEM_POE) || (item == ITEM_GOLD_DUST) || (item == ITEM_CHATEAU) || + (item == ITEM_HYLIAN_LOACH)) { + return ITEM_NONE; + + } else if (((item >= ITEM_POTION_RED) && (item <= ITEM_OBABA_DRINK)) || (item == ITEM_CHATEAU_2) || + (item == ITEM_MILK) || (item == ITEM_GOLD_DUST_2) || (item == ITEM_HYLIAN_LOACH_2) || + (item == ITEM_SEA_HORSE_CAUGHT)) { + bottleSlot = SLOT(item); + + if ((item != ITEM_MILK_BOTTLE) && (item != ITEM_MILK_HALF)) { + if (item == ITEM_CHATEAU_2) { + item = ITEM_CHATEAU; + + } else if (item == ITEM_MILK) { + item = ITEM_MILK_BOTTLE; + + } else if (item == ITEM_GOLD_DUST_2) { + item = ITEM_GOLD_DUST; + + } else if (item == ITEM_HYLIAN_LOACH_2) { + item = ITEM_HYLIAN_LOACH; + + } else if (item == ITEM_SEA_HORSE_CAUGHT) { + item = ITEM_SEA_HORSE; + } + bottleSlot = SLOT(item); + + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[bottleSlot + i] == ITEM_BOTTLE) { + return ITEM_NONE; + } + } + } else { + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[bottleSlot + i] == ITEM_NONE) { + return ITEM_NONE; + } + } + } + } else if ((item >= ITEM_MOON_TEAR) && (item <= ITEM_MASK_GIANT)) { + return ITEM_NONE; + } + + return gSaveContext.save.inventory.items[slot]; +} + +u8 Item_CheckObtainability(u8 item) { + return Item_CheckObtainabilityImpl(item); +} + +void Inventory_DeleteItem(s16 item, s16 slot) { + s16 btn; + + gSaveContext.save.inventory.items[slot] = ITEM_NONE; + + for (btn = EQUIP_SLOT_C_LEFT; btn <= EQUIP_SLOT_C_RIGHT; btn++) { + if (GET_CUR_FORM_BTN_ITEM(btn) == item) { + SET_CUR_FORM_BTN_ITEM(btn, ITEM_NONE); + SET_CUR_FORM_BTN_SLOT(btn, SLOT_NONE); + } + } +} + +void Inventory_UnequipItem(s16 item) { + s16 btn; + + for (btn = EQUIP_SLOT_C_LEFT; btn <= EQUIP_SLOT_C_RIGHT; btn++) { + if (GET_CUR_FORM_BTN_ITEM(btn) == item) { + SET_CUR_FORM_BTN_ITEM(btn, ITEM_NONE); + SET_CUR_FORM_BTN_SLOT(btn, SLOT_NONE); + } + } +} + +s32 Inventory_ReplaceItem(PlayState* play, u8 oldItem, u8 newItem) { + u8 i; + + for (i = 0; i < 24; i++) { + if (gSaveContext.save.inventory.items[i] == oldItem) { + gSaveContext.save.inventory.items[i] = newItem; + + for (i = EQUIP_SLOT_C_LEFT; i <= EQUIP_SLOT_C_RIGHT; i++) { + if (GET_CUR_FORM_BTN_ITEM(i) == oldItem) { + SET_CUR_FORM_BTN_ITEM(i, newItem); + Interface_LoadItemIconImpl(play, i); + break; + } + } + return true; + } + } + return false; +} + +void Inventory_UpdateDeitySwordEquip(PlayState* play) { + InterfaceContext* interfaceCtx = &play->interfaceCtx; + u8 btn; + + if (CUR_FORM == PLAYER_FORM_FIERCE_DEITY) { + interfaceCtx->unk_21C = 0; + interfaceCtx->bButtonDoAction = 0; + + // Is simply checking if (gSaveContext.save.playerForm == PLAYER_FORM_FIERCE_DEITY) + if ((((gSaveContext.save.playerForm > 0) && (gSaveContext.save.playerForm < 4)) + ? 1 + : gSaveContext.save.playerForm >> 1) == 0) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_DEITY; + } else if (BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) == ITEM_SWORD_DEITY) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_NONE; + } else { + BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = + GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) - EQUIP_VALUE_SWORD_KOKIRI + ITEM_SWORD_KOKIRI; + } + } + } + + for (btn = EQUIP_SLOT_B; btn <= EQUIP_SLOT_B; btn++) { + if ((GET_CUR_FORM_BTN_ITEM(btn) != ITEM_NONE) && (GET_CUR_FORM_BTN_ITEM(btn) != ITEM_FD)) { + Interface_LoadItemIconImpl(play, btn); + } + } +} + +s32 Inventory_HasEmptyBottle(void) { + s32 slot; + + for (slot = SLOT_BOTTLE_1; slot <= SLOT_BOTTLE_6; slot++) { + if (gSaveContext.save.inventory.items[slot] == ITEM_BOTTLE) { + return true; + } + } + return false; +} + +s32 Inventory_HasItemInBottle(u8 item) { + s32 slot; + + for (slot = SLOT_BOTTLE_1; slot <= SLOT_BOTTLE_6; slot++) { + if (gSaveContext.save.inventory.items[slot] == item) { + return true; + } + } + return false; +} + +void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 btn) { + gSaveContext.save.inventory.items[GET_CUR_FORM_BTN_SLOT(btn)] = item; + SET_CUR_FORM_BTN_ITEM(btn, item); + + Interface_LoadItemIconImpl(play, btn); + + play->pauseCtx.cursorItem[PAUSE_0] = item; + gSaveContext.buttonStatus[btn] = BTN_ENABLED; + + if (item == ITEM_HOT_SPRING_WATER) { + func_8010EBA0(60, GET_CUR_FORM_BTN_SLOT(btn) - SLOT_BOTTLE_1); + } +} + +s32 Inventory_ConsumeFairy(PlayState* play) { + u8 bottleSlot = SLOT(ITEM_FAIRY); + u8 btn; + u8 i; + + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[bottleSlot + i] == ITEM_FAIRY) { + for (btn = EQUIP_SLOT_C_LEFT; btn <= EQUIP_SLOT_C_RIGHT; btn++) { + if (GET_CUR_FORM_BTN_ITEM(btn) == ITEM_FAIRY) { + SET_CUR_FORM_BTN_ITEM(btn, ITEM_BOTTLE); + Interface_LoadItemIconImpl(play, btn); + bottleSlot = GET_CUR_FORM_BTN_SLOT(btn); + i = 0; + break; + } + } + gSaveContext.save.inventory.items[bottleSlot + i] = ITEM_BOTTLE; + return true; + } + } + + return false; +} + +/** + * Only used to equip Spring Water when Hot Spring Water timer runs out. + */ +void Inventory_UpdateItem(PlayState* play, s16 slot, s16 item) { + s16 btn; + + gSaveContext.save.inventory.items[slot] = item; + + for (btn = EQUIP_SLOT_C_LEFT; btn <= EQUIP_SLOT_C_RIGHT; btn++) { + if (GET_CUR_FORM_BTN_SLOT(btn) == slot) { + SET_CUR_FORM_BTN_ITEM(btn, item); + Interface_LoadItemIconImpl(play, btn); + } + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801153C8.s") +TexturePtr sDoActionTextures[] = { + gDoActionAttackENGTex, + gDoActionCheckENGTex, +}; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115428.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011552C.s") @@ -94,13 +1054,96 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115844.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115908.s") +/** + * @return false if player is out of health + */ +s32 Health_ChangeBy(PlayState* play, s16 healthChange) { + if (healthChange > 0) { + play_sound(NA_SE_SY_HP_RECOVER); + } else if (gSaveContext.save.playerData.doubleDefense && (healthChange < 0)) { + healthChange >>= 1; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801159c0.s") + gSaveContext.save.playerData.health += healthChange; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801159EC.s") + if (((void)0, gSaveContext.save.playerData.health) > ((void)0, gSaveContext.save.playerData.healthCapacity)) { + gSaveContext.save.playerData.health = gSaveContext.save.playerData.healthCapacity; + } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115A14.s") + if (gSaveContext.save.playerData.health <= 0) { + gSaveContext.save.playerData.health = 0; + return false; + } else { + return true; + } +} + +void Health_GiveHearts(s16 hearts) { + gSaveContext.save.playerData.healthCapacity += hearts * 0x10; +} + +void Rupees_ChangeBy(s16 rupeeChange) { + gSaveContext.rupeeAccumulator += rupeeChange; +} + +void Inventory_ChangeAmmo(s16 item, s16 ammoChange) { + if (item == ITEM_STICK) { + AMMO(ITEM_STICK) += ammoChange; + + if (AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS)) { + AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); + } else if (AMMO(ITEM_STICK) < 0) { + AMMO(ITEM_STICK) = 0; + } + + } else if (item == ITEM_NUT) { + AMMO(ITEM_NUT) += ammoChange; + + if (AMMO(ITEM_NUT) >= CUR_CAPACITY(UPG_NUTS)) { + AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); + } else if (AMMO(ITEM_NUT) < 0) { + AMMO(ITEM_NUT) = 0; + } + + } else if (item == ITEM_BOMBCHU) { + AMMO(ITEM_BOMBCHU) += ammoChange; + + if (AMMO(ITEM_BOMBCHU) >= CUR_CAPACITY(UPG_BOMB_BAG)) { + AMMO(ITEM_BOMBCHU) = CUR_CAPACITY(UPG_BOMB_BAG); + } else if (AMMO(ITEM_BOMBCHU) < 0) { + AMMO(ITEM_BOMBCHU) = 0; + } + + } else if (item == ITEM_BOW) { + AMMO(ITEM_BOW) += ammoChange; + + if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) { + AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER); + } else if (AMMO(ITEM_BOW) < 0) { + AMMO(ITEM_BOW) = 0; + } + + } else if (item == ITEM_BOMB) { + AMMO(ITEM_BOMB) += ammoChange; + + if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) { + AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); + } else if (AMMO(ITEM_BOMB) < 0) { + AMMO(ITEM_BOMB) = 0; + } + + } else if (item == ITEM_MAGIC_BEANS) { + AMMO(ITEM_MAGIC_BEANS) += ammoChange; + + } else if (item == ITEM_POWDER_KEG) { + AMMO(ITEM_POWDER_KEG) += ammoChange; + if (AMMO(ITEM_POWDER_KEG) >= 1) { + AMMO(ITEM_POWDER_KEG) = 1; + } else if (AMMO(ITEM_POWDER_KEG) < 0) { + AMMO(ITEM_POWDER_KEG) = 0; + } + } +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Parameter_AddMagic.s") @@ -110,6 +1153,13 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116088.s") +s16 magicBorderColors[][3] = { + { 255, 255, 255 }, + { 150, 150, 150 }, +}; +s16 magicBorderIndices[] = { 0, 1, 1, 0 }; +s16 magicBorderColorTimerIndex[] = { 2, 1, 2, 1 }; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116114.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80116348.s") @@ -120,10 +1170,25 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801170B8.s") +TexturePtr cUpLabelTextures[] = { + gTatlCUpENGTex, gTatlCUpENGTex, gTatlCUpGERTex, gTatlCUpFRATex, gTatlCUpESPTex, +}; +s16 startButtonLeftPos[] = { + // Remnant of OoT + 130, 136, 136, 136, 136, +}; +s16 D_801BFAF4[] = { 0x1D, 0x1B }; +s16 D_801BFAF8[] = { 0x1B, 0x1B }; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117100.s") +s16 D_801BFAFC[] = { 30, 24, 24, 24 }; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117A20.s") +s16 D_801BFB04[] = { 0xA2, 0xE4, 0xFA, 0x110 }; +s16 D_801BFB0C[] = { 0x23, 0x23, 0x33, 0x23 }; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80117BD0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118084.s") @@ -132,36 +1197,179 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80118BA4.s") +extern TexturePtr D_08095AC0; // gMagicArrowEquipEffectTex +s16 D_801BFB14[] = { 255, 100, 255, 0 }; // magicArrowEffectsR +s16 D_801BFB1C[] = { 0, 100, 255, 0 }; // magicArrowEffectsG +s16 D_801BFB24[] = { 0, 255, 100, 0 }; // magicArrowEffectsB + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80119030.s") +s16 D_801BFB2C = 255; +s16 D_801BFB30 = 0; +s16 D_801BFB34 = 0; +u16 D_801BFB38[] = { + CLOCK_TIME(0, 0), CLOCK_TIME(1, 0), CLOCK_TIME(2, 0), CLOCK_TIME(3, 0), CLOCK_TIME(4, 0), + CLOCK_TIME(5, 0), CLOCK_TIME(6, 0), CLOCK_TIME(7, 0), CLOCK_TIME(8, 0), CLOCK_TIME(9, 0), + CLOCK_TIME(10, 0), CLOCK_TIME(11, 0), CLOCK_TIME(12, 0), CLOCK_TIME(13, 0), CLOCK_TIME(14, 0), + CLOCK_TIME(15, 0), CLOCK_TIME(16, 0), CLOCK_TIME(17, 0), CLOCK_TIME(18, 0), CLOCK_TIME(19, 0), + CLOCK_TIME(20, 0), CLOCK_TIME(21, 0), CLOCK_TIME(22, 0), CLOCK_TIME(23, 0), CLOCK_TIME(24, 0) - 1, +}; +TexturePtr D_801BFB6C[] = { + gThreeDayClockHour12Tex, gThreeDayClockHour1Tex, gThreeDayClockHour2Tex, gThreeDayClockHour3Tex, + gThreeDayClockHour4Tex, gThreeDayClockHour5Tex, gThreeDayClockHour6Tex, gThreeDayClockHour7Tex, + gThreeDayClockHour8Tex, gThreeDayClockHour9Tex, gThreeDayClockHour10Tex, gThreeDayClockHour11Tex, + gThreeDayClockHour12Tex, gThreeDayClockHour1Tex, gThreeDayClockHour2Tex, gThreeDayClockHour3Tex, + gThreeDayClockHour4Tex, gThreeDayClockHour5Tex, gThreeDayClockHour6Tex, gThreeDayClockHour7Tex, + gThreeDayClockHour8Tex, gThreeDayClockHour9Tex, gThreeDayClockHour10Tex, gThreeDayClockHour11Tex, +}; +s16 D_801BFBCC = 0; // color R +s16 D_801BFBD0 = 155; // color G +s16 D_801BFBD4 = 255; +s16 D_801BFBD8 = 0; +s16 D_801BFBDC = 0; +s16 D_801BFBE0 = 0; +s16 D_801BFBE4 = 0xF; +u32 D_801BFBE8 = 0; +s16 D_801BFBEC[] = { 100, 0 }; +s16 D_801BFBF0[] = { 205, 155 }; +s16 D_801BFBF4[] = { 255, 255 }; +s16 D_801BFBF8[] = { 30, 0 }; +s16 D_801BFBFC[] = { 30, 0 }; +s16 D_801BFC00[] = { 100, 0 }; +s16 D_801BFC04[] = { 255, 0 }; +s16 D_801BFC08[] = { 100, 0 }; +s16 D_801BFC0C[] = { 30, 0 }; +s16 D_801BFC10[] = { 100, 0 }; +TexturePtr D_801BFC14[] = { + gFinalHoursClockDigit0Tex, gFinalHoursClockDigit1Tex, gFinalHoursClockDigit2Tex, gFinalHoursClockDigit3Tex, + gFinalHoursClockDigit4Tex, gFinalHoursClockDigit5Tex, gFinalHoursClockDigit6Tex, gFinalHoursClockDigit7Tex, + gFinalHoursClockDigit8Tex, gFinalHoursClockDigit9Tex, gFinalHoursClockColonTex, +}; +s16 D_801BFC40[] = { + 127, 136, 144, 151, 160, 168, 175, 184, +}; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80119610.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011B4E0.s") +u16 D_801BFC50[] = { + 0xC000, 0xE000, 0x0000, 0x2000, 0xA000, 0x8000, 0x6000, 0x4000, +}; +s16 D_801BFC60[][3] = { + 255, 255, 255, 255, 165, 55, +}; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011B5C0.s") +s16 D_801BFC6C[] = { + 78, 54, 29, 5, -18, -42, -67, -85, +}; +s16 D_801BFC7C[] = { + 180, 180, 180, 180, -180, -180, -180, -180, +}; +s16 D_801BFC8C[2][3] = { + { 255, 255, 255 }, + { 255, 165, 55 }, +}; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011B9E0.s") +s16 D_801BFC98[] = { + 78, 54, 29, 5, -18, -42, -67, -85, +}; +u16 D_801BFCA8[] = { + 0xC000, 0xE000, 0x0000, 0x2000, 0xA000, 0x8000, 0x6000, 0x4000, +}; +s16 D_801BFCB8[2][3] = { + { 255, 255, 255 }, + { 255, 165, 55 }, +}; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011BF70.s") +TexturePtr D_801BFCC4[] = { + gMinigameLetterPTex, gMinigameLetterETex, gMinigameLetterRTex, gMinigameLetterFTex, + gMinigameLetterETex, gMinigameLetterCTex, gMinigameLetterTTex, gMinigameExclamationTex, +}; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011C4C4.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011C808.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011C898.s") +s16 D_801BFCE4 = 0; +s16 D_801BFCE8[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; +s16 D_801BFCF8 = 99; +s16 D_801BFCFC[] = { + // timer digit width + 16, 25, 34, 42, 51, 60, 68, 77, +}; +s16 D_801BFD0C[] = { + // digit width + 9, 9, 8, 9, 9, 8, 9, 9, +}; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011CA64.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011E3B4.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011E730.s") +// rupeeDigitsFirst +s16 D_801BFD1C[] = { 1, 0, 0, 0 }; +// rupeeDigitsCount +s16 D_801BFD24[] = { 2, 3, 3, 0 }; +// rupeeIconPrimColor +Color_RGB16 D_801BFD2C[] = { + { 200, 255, 100 }, + { 170, 170, 255 }, + { 255, 105, 105 }, +}; +// rupeeIconEnvColor +Color_RGB16 D_801BFD40[] = { + { 0, 80, 0 }, + { 10, 10, 80 }, + { 40, 10, 0 }, +}; +// minigameCountdownTexs +TexturePtr D_801BFD54[] = { + gMinigameCountdown3Tex, + gMinigameCountdown2Tex, + gMinigameCountdown1Tex, + gMinigameCountdownGoTex, +}; +// minigameCountdownTexHeights +s16 D_801BFD64[] = { 24, 24, 24, 40 }; +// minigameCountdownPrimColor +Color_RGB16 D_801BFD6C[] = { + { 100, 255, 100 }, + { 255, 255, 60 }, + { 255, 100, 0 }, + { 120, 170, 255 }, +}; +// grandma's story pictures +TexturePtr D_801BFD84[] = { + gStoryMaskFestivalTex, + gStoryGiantsLeavingTex, +}; +// grandma's story TLUT +TexturePtr D_801BFD8C[] = { + gStoryMaskFestivalTLUT, + gStoryGiantsLeavingTLUT, +}; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8011F0E0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80120F90.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80121064.s") +u8 D_801BFD94 = 0; +s16 D_801BFD98 = 0; +s16 D_801BFD9C = 0; + #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801210E0.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80121F94.s") diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index f373b03379..563560d401 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -653,7 +653,7 @@ void func_80123C58(Player* player) { void Player_SetEquipmentData(PlayState* play, Player* player) { if (player->csMode != 0x86) { - player->currentShield = GET_CUR_EQUIP_VALUE(EQUIP_SHIELD); + player->currentShield = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD); if ((player->transformation != PLAYER_FORM_ZORA) || (((player->currentBoots != PLAYER_BOOTS_ZORA_LAND)) && (player->currentBoots != PLAYER_BOOTS_ZORA_UNDERWATER))) { player->currentBoots = D_801BFF90[player->transformation]; @@ -667,7 +667,7 @@ void Player_SetEquipmentData(PlayState* play, Player* player) { } void func_80123D50(PlayState* play, Player* player, s32 itemId, s32 actionParam) { - func_80114FD0(play, itemId, player->heldItemButton); + Inventory_UpdateBottleItem(play, itemId, player->heldItemButton); if (itemId != ITEM_BOTTLE) { player->heldItemId = itemId; diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 255f7e389f..69a0a4491b 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -230,8 +230,8 @@ void Sram_SaveEndOfCycle(PlayState* play) { s16 sceneNum; s32 j; s32 i; - u8 temp; - u8 temp2; + u8 slot; + u8 item; gSaveContext.save.daySpeed = 0; gSaveContext.save.daysElapsed = 0; @@ -276,7 +276,7 @@ void Sram_SaveEndOfCycle(PlayState* play) { } if (gSaveContext.save.weekEventReg[84] & 0x20) { - func_801149A0(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY)); + Inventory_DeleteItem(ITEM_MASK_FIERCE_DEITY, SLOT(ITEM_MASK_FIERCE_DEITY)); } for (i = 0; i < ARRAY_COUNT(D_801C66D0); i++) { @@ -306,26 +306,26 @@ void Sram_SaveEndOfCycle(PlayState* play) { } if (INV_CONTENT(ITEM_BOMB) == ITEM_BOMB) { - temp2 = INV_CONTENT(ITEM_BOMB); - if (AMMO(temp2) != 0) { + item = INV_CONTENT(ITEM_BOMB); + if (AMMO(item) != 0) { gSaveContext.eventInf[7] |= 2; } } if (INV_CONTENT(ITEM_NUT) == ITEM_NUT) { - temp2 = INV_CONTENT(ITEM_NUT); - if (AMMO(temp2) != 0) { + item = INV_CONTENT(ITEM_NUT); + if (AMMO(item) != 0) { gSaveContext.eventInf[7] |= 4; } } if (INV_CONTENT(ITEM_STICK) == ITEM_STICK) { - temp2 = INV_CONTENT(ITEM_STICK); - if (AMMO(temp2) != 0) { + item = INV_CONTENT(ITEM_STICK); + if (AMMO(item) != 0) { gSaveContext.eventInf[7] |= 8; } } if (INV_CONTENT(ITEM_BOW) == ITEM_BOW) { - temp2 = INV_CONTENT(ITEM_BOW); - if (AMMO(temp2) != 0) { + item = INV_CONTENT(ITEM_BOW); + if (AMMO(item) != 0) { gSaveContext.eventInf[7] |= 0x10; } } @@ -333,8 +333,8 @@ void Sram_SaveEndOfCycle(PlayState* play) { for (i = 0; i < ARRAY_COUNT(D_801C67B0); i++) { if (D_801C67B0[i] != ITEM_NONE) { if ((gSaveContext.save.inventory.items[i] != ITEM_NONE) && (i != SLOT_PICTO_BOX)) { - temp2 = gSaveContext.save.inventory.items[i]; - AMMO(temp2) = 0; + item = gSaveContext.save.inventory.items[i]; + AMMO(item) = 0; } } } @@ -343,10 +343,10 @@ void Sram_SaveEndOfCycle(PlayState* play) { // Check for all bottled items if (gSaveContext.save.inventory.items[i] >= ITEM_POTION_RED) { if (gSaveContext.save.inventory.items[i] <= ITEM_OBABA_DRINK) { - for (j = 1; j < 4; j++) { + for (j = EQUIP_SLOT_C_LEFT; j <= EQUIP_SLOT_C_RIGHT; j++) { if (GET_CUR_FORM_BTN_ITEM(j) == gSaveContext.save.inventory.items[i]) { SET_CUR_FORM_BTN_ITEM(j, ITEM_BOTTLE); - func_80112B40(play, j); + Interface_LoadItemIconImpl(play, j); } } gSaveContext.save.inventory.items[i] = ITEM_BOTTLE; @@ -354,26 +354,26 @@ void Sram_SaveEndOfCycle(PlayState* play) { } } - REMOVE_QUEST_ITEM(QUEST_UNK_19); + REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); if (gSaveContext.save.playerData.health < 0x30) { gSaveContext.save.playerData.health = 0x30; } - if (GET_CUR_EQUIP_VALUE(EQUIP_SWORD) < 3) { - SET_EQUIP_VALUE(EQUIP_SWORD, 1); + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) <= EQUIP_VALUE_SWORD_RAZOR) { + SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_KOKIRI); if (CUR_FORM == 0) { if ((STOLEN_ITEM_1 >= ITEM_SWORD_GILDED) || (STOLEN_ITEM_2 >= ITEM_SWORD_GILDED)) { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_GILDED; - SET_EQUIP_VALUE(EQUIP_SWORD, 3); + SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_GILDED); } else { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; } } else { if ((STOLEN_ITEM_1 >= ITEM_SWORD_GILDED) || (STOLEN_ITEM_2 >= ITEM_SWORD_GILDED)) { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_B) = ITEM_SWORD_GILDED; - SET_EQUIP_VALUE(EQUIP_SWORD, 3); + SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_GILDED); } else { BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_B) = ITEM_SWORD_KOKIRI; } @@ -385,20 +385,20 @@ void Sram_SaveEndOfCycle(PlayState* play) { } if (STOLEN_ITEM_1 == ITEM_BOTTLE) { - temp = SLOT(ITEM_BOTTLE); - for (i = 0; i < 6; i++) { - if (gSaveContext.save.inventory.items[temp + i] == ITEM_NONE) { - gSaveContext.save.inventory.items[temp + i] = ITEM_BOTTLE; + slot = SLOT(ITEM_BOTTLE); + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.inventory.items[slot + i] = ITEM_BOTTLE; break; } } } if (STOLEN_ITEM_2 == ITEM_BOTTLE) { - temp = SLOT(ITEM_BOTTLE); - for (i = 0; i < 6; i++) { - if (gSaveContext.save.inventory.items[temp + i] == ITEM_NONE) { - gSaveContext.save.inventory.items[temp + i] = ITEM_BOTTLE; + slot = SLOT(ITEM_BOTTLE); + for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { + if (gSaveContext.save.inventory.items[slot + i] == ITEM_NONE) { + gSaveContext.save.inventory.items[slot + i] = ITEM_BOTTLE; break; } } @@ -407,15 +407,14 @@ void Sram_SaveEndOfCycle(PlayState* play) { SET_STOLEN_ITEM_1(STOLEN_ITEM_NONE); SET_STOLEN_ITEM_2(STOLEN_ITEM_NONE); - // ?? - func_801149A0(ITEM_OCARINA_FAIRY, SLOT_TRADE_DEED); - func_801149A0(ITEM_SLINGSHOT, SLOT_TRADE_KEY_MAMA); - func_801149A0(ITEM_LONGSHOT, SLOT_TRADE_COUPLE); + Inventory_DeleteItem(ITEM_OCARINA_FAIRY, SLOT_TRADE_DEED); + Inventory_DeleteItem(ITEM_SLINGSHOT, SLOT_TRADE_KEY_MAMA); + Inventory_DeleteItem(ITEM_LONGSHOT, SLOT_TRADE_COUPLE); - for (j = 1; j < 4; j++) { + for (j = EQUIP_SLOT_C_LEFT; j <= EQUIP_SLOT_C_RIGHT; j++) { if (GET_CUR_FORM_BTN_ITEM(j) >= ITEM_MOON_TEAR && GET_CUR_FORM_BTN_ITEM(j) <= ITEM_PENDANT_MEMORIES) { SET_CUR_FORM_BTN_ITEM(j, ITEM_NONE); - func_80112B40(play, j); + Interface_LoadItemIconImpl(play, j); } } @@ -809,8 +808,8 @@ void Sram_InitDebugSave(void) { Lib_MemCpy(&gSaveContext.save.checksum, &sSaveDebugChecksum, sizeof(gSaveContext.save.checksum)); if (gSaveContext.save.playerForm != PLAYER_FORM_HUMAN) { - BUTTON_ITEM_EQUIP(0, 2) = D_801C6A48[((void)0, gSaveContext.save.playerForm & 0xFF)]; - C_SLOT_EQUIP(0, 2) = D_801C6A50[((void)0, gSaveContext.save.playerForm & 0xFF)]; + BUTTON_ITEM_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A48[((void)0, gSaveContext.save.playerForm & 0xFF)]; + C_SLOT_EQUIP(0, EQUIP_SLOT_C_DOWN) = D_801C6A50[((void)0, gSaveContext.save.playerForm & 0xFF)]; } gSaveContext.save.hasTatl = true; diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index c5b1d1208f..b898f996fb 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -4,7 +4,6 @@ * Description: Twinmold */ -#include "prevent_bss_reordering.h" #include "z_boss_02.h" #include "z64rumble.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 1a5ca0bb1a..e02bcbea1a 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -221,36 +221,36 @@ s16 func_80BECF6C(Path* path) { s32 func_80BECFBC(EnAkindonuts* this) { switch (ENAKINDONUTS_GET_3(&this->actor)) { case 0: - return 0x98; + return GI_DEED_SWAMP; case 1: - return 0x99; + return GI_DEED_MOUNTAIN; case 2: - return 0x9A; + return GI_DEED_OCEAN; case 3: - func_801149A0(ITEM_DEED_OCEAN, SLOT(ITEM_DEED_OCEAN)); - return 0x7; + Inventory_DeleteItem(ITEM_DEED_OCEAN, SLOT(ITEM_DEED_OCEAN)); + return GI_RUPEE_HUGE; } - return 0; + return GI_NONE; } s32 func_80BED034(EnAkindonuts* this) { switch (ENAKINDONUTS_GET_3(&this->actor)) { case 0: - return 0x35; + return GI_MAGIC_BEANS; case 1: - return 0x1D; + return GI_BOMB_BAG_40; case 2: - return 0x5C; + return GI_POTION_GREEN; case 3: - return 0x5D; + return GI_POTION_BLUE; } - return 0; + return GI_NONE; } void func_80BED090(PlayState* play) { @@ -296,7 +296,7 @@ s32 func_80BED140(PlayState* play) { } s32 func_80BED208(EnAkindonuts* this) { - if ((u32)INV_CONTENT(ITEM_MAGIC_BEANS) != 10) { + if ((u32)INV_CONTENT(ITEM_MAGIC_BEANS) != ITEM_MAGIC_BEANS) { return 0; } @@ -332,7 +332,7 @@ s32 func_80BED27C(EnAkindonuts* this) { } s32 func_80BED2FC(EnAkindonuts* this) { - if (!Interface_HasEmptyBottle()) { + if (!Inventory_HasEmptyBottle()) { return 2; } @@ -346,7 +346,7 @@ s32 func_80BED2FC(EnAkindonuts* this) { } s32 func_80BED35C(EnAkindonuts* this) { - if (!Interface_HasEmptyBottle()) { + if (!Inventory_HasEmptyBottle()) { return 2; } @@ -1326,7 +1326,7 @@ void func_80BEF360(EnAkindonuts* this, PlayState* play) { if (this->unk_32C & 0x40) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - func_801159EC(this->unk_364); + Rupees_ChangeBy(this->unk_364); this->unk_32C &= ~0x40; this->actionFunc = func_80BEF450; } else { diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 91c543f7ea..797c7116f3 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -391,7 +391,7 @@ void func_809C16DC(EnAob01* this, PlayState* play) { case 0x3529: if (this->unk_2D2 & 2) { this->unk_2D2 &= ~2; - func_801159EC(-this->unk_434); + Rupees_ChangeBy(-this->unk_434); func_800B7298(play, NULL, 7); play->msgCtx.msgMode = 0x43; play->msgCtx.unk12023 = 4; @@ -711,7 +711,7 @@ void func_809C28B8(EnAob01* this, PlayState* play) { this->unk_210 = 0x352A; this->unk_2D2 |= 0x80; this->unk_434 *= 3; - func_801159EC(this->unk_434); + Rupees_ChangeBy(this->unk_434); play->msgCtx.bankRupees = this->unk_434; break; @@ -719,7 +719,7 @@ void func_809C28B8(EnAob01* this, PlayState* play) { this->unk_210 = 0x352B; this->unk_2D2 |= 0x80; this->unk_434 *= 2; - func_801159EC(this->unk_434); + Rupees_ChangeBy(this->unk_434); play->msgCtx.bankRupees = this->unk_434; break; @@ -727,7 +727,7 @@ void func_809C28B8(EnAob01* this, PlayState* play) { case 4: case 5: this->unk_210 = 0x352C; - func_801159EC(this->unk_434); + Rupees_ChangeBy(this->unk_434); break; default: diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 51d077cd90..2f7874c719 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -98,7 +98,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { this->unk_2C8 = 80.0f; if ((gSaveContext.save.entranceIndex == 0xD220) && (gSaveContext.save.weekEventReg[73] & 0x80) && - !CHECK_QUEST_ITEM(ITEM_BOTTLE)) { + !CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { this->unk_2D6 = this->actor.cutscene; if (this->unk_2D6 == 0) { Actor_MarkForDeath(&this->actor); @@ -260,7 +260,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { func_809C493C(this, 3, 1.0f); this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_2C0 = 2; - if ((player->transformation == PLAYER_FORM_HUMAN) && CHECK_QUEST_ITEM(ITEM_BOTTLE)) { + if ((player->transformation == PLAYER_FORM_HUMAN) && CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { this->unk_2C0 = 4; } break; diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 342e613853..c5dfbb63ef 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -234,7 +234,7 @@ void EnCow_GiveMilk(EnCow* this, PlayState* play) { void EnCow_CheckForEmptyBottle(EnCow* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { func_80151938(play, 0x32C9); // Text to give milk. this->actionFunc = EnCow_GiveMilk; } else { @@ -291,7 +291,7 @@ void EnCow_Idle(EnCow* this, PlayState* play) { if (func_801A5100() == 4) { if (!(gSaveContext.save.weekEventReg[87] & 1)) { gSaveContext.save.weekEventReg[87] |= 1; - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { this->actor.textId = 0x32C9; // Text to give milk. } else { this->actor.textId = 0x32CA; // Text if you don't have an empty bottle. diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 37736acbe2..f3b098af66 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -364,7 +364,7 @@ void EnDnp_Init(Actor* thisx, PlayState* play) { this->actor.world.rot.x = this->actor.shape.rot.x; this->actor.cutscene = 0x10; this->actionFunc = func_80B3D47C; - } else if (((ENDNP_GET_7(&this->actor) == ENDNP_GET_7_0) && !Interface_HasItemInBottle(ITEM_DEKU_PRINCESS) && + } else if (((ENDNP_GET_7(&this->actor) == ENDNP_GET_7_0) && !Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !(gSaveContext.save.weekEventReg[23] & 0x20)) || ((ENDNP_GET_7(&this->actor) == ENDNP_GET_7_2) && (gSaveContext.save.weekEventReg[23] & 0x20))) { Actor_SetScale(&this->actor, 0.0085f); diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index f2a6a46dc8..b5ae2ac925 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -342,7 +342,7 @@ void func_80A52DC8(EnDnq* this, PlayState* play) { if (!(gSaveContext.save.weekEventReg[23] & 0x20)) { this->unk_390 = 70.0f; - if (Interface_HasItemInBottle(ITEM_DEKU_PRINCESS) && !Play_InCsMode(play) && + if (Inventory_HasItemInBottle(ITEM_DEKU_PRINCESS) && !Play_InCsMode(play) && (Message_GetState(&play->msgCtx) == 0) && (ActorCutscene_GetCurrentIndex() == -1)) { if ((DECR(this->unk_384) == 0) && (gSaveContext.save.weekEventReg[29] & 0x40)) { Message_StartTextbox(play, 0x969, NULL); diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index adc56431e9..024ee41246 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -673,7 +673,7 @@ void func_8088DD34(EnElf* this, PlayState* play) { if ((this->fairyFlags & 0x1000) && (heightDiff > 0.0f) && (heightDiff < 60.0f) && !func_8088C804(&this->actor.world.pos, &refActor->actor.world.pos, 10.0f)) { - func_80115908(play, 0x80); + Health_ChangeBy(play, 0x80); if (this->fairyFlags & 0x200) { Parameter_AddMagic(play, ((void)0, gSaveContext.unk_3F30) + (gSaveContext.save.playerData.doubleMagic * 0x30) + 0x30); diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 48b3a75eda..915eb1d6c7 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -440,7 +440,7 @@ void EnElforg_FreeFloating(EnElforg* this, PlayState* play) { if (!Player_InCsMode(play)) { if ((this->actor.xzDistToPlayer < 30.0f) && (scaledYDistance < 12.0f) && (scaledYDistance > -68.0f)) { EnElforg_SetupFairyCollected(this, play); - func_80115908(play, 48); + Health_ChangeBy(play, 0x30); switch (STRAY_FAIRY_TYPE(&this->actor)) { case STRAY_FAIRY_TYPE_COLLECTIBLE: Flags_SetCollectible(play, STRAY_FAIRY_FLAG(&this->actor)); diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index ea37f745fe..9bea16e4a4 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -1130,7 +1130,7 @@ void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { if ((effect->unk_2C >= 100) && (Message_GetState(&play->msgCtx) == 5)) { if (Message_ShouldAdvance(play) || Message_GetState(&play->msgCtx) == 0) { func_801477B4(play); - func_801159EC(-50); + Rupees_ChangeBy(-50); effect->unk_2C = -1; } } @@ -4713,7 +4713,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.playerData.rupees >= 20) { - func_801159EC(-20); + Rupees_ChangeBy(-20); if (!Rumble_ControllerOneHasRumblePak()) { this->actor.textId = 0x407C; } else { diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index d9aaf9800e..4b0253209b 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -430,7 +430,7 @@ void func_80962588(EnFu* this, PlayState* play) { if (play->msgCtx.choiceIndex == 0) { if (gSaveContext.save.playerData.rupees >= 10) { func_8019F208(); - func_801159EC(-10); + Rupees_ChangeBy(-10); func_80963DE4(this, play); } else { play_sound(NA_SE_SY_ERROR); diff --git a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c index 81f3be6d0e..c2c42fa592 100644 --- a/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c +++ b/src/overlays/actors/ovl_En_Gamelupy/z_en_gamelupy.c @@ -129,9 +129,9 @@ void func_80AF69A8(EnGamelupy* this, PlayState* play) { if (this->collider.base.ocFlags1 & OC1_HIT) { *this->unk_198 += 0x32; if (this->rupeeIndex == 1) { - func_801159EC(5); + Rupees_ChangeBy(5); } else { - func_801159EC(1); + Rupees_ChangeBy(1); } func_80AF6A38(this); } diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 658ee27f79..e68ac215eb 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -430,7 +430,7 @@ void func_80B0FFA8(EnGb2* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: func_8019F208(); - func_801159EC(-this->unk_288); + Rupees_ChangeBy(-this->unk_288); play->msgCtx.msgMode = 0x43; play->msgCtx.unk12023 = 4; func_800B7298(play, NULL, 7); @@ -582,7 +582,7 @@ void func_80B10634(EnGb2* this, PlayState* play) { Message_StartTextbox(play, this->unk_26E, &this->actor); } else { func_8019F208(); - func_801159EC(-this->unk_288); + Rupees_ChangeBy(-this->unk_288); play->msgCtx.msgMode = 0x43; play->msgCtx.unk12023 = 4; func_800B7298(play, NULL, 7); @@ -628,7 +628,7 @@ void func_80B10924(EnGb2* this, PlayState* play) { if (sp24 == 12) { gSaveContext.save.weekEventReg[54] |= 0x40; } else { - func_801159EC(50); + Rupees_ChangeBy(50); } this->actionFunc = func_80B109DC; } else { diff --git a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c index b07671a184..d139d3fe37 100644 --- a/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c +++ b/src/overlays/actors/ovl_En_Ginko_Man/z_en_ginko_man.c @@ -357,7 +357,7 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { this->isNewAccount = true; } - func_801159EC((s16)-play->msgCtx.bankRupeesSelected); + Rupees_ChangeBy(-play->msgCtx.bankRupeesSelected); this->previousBankValue = gSaveContext.save.bankRupees & 0xFFFF; gSaveContext.save.bankRupees = ((gSaveContext.save.bankRupees & 0xFFFF) + play->msgCtx.bankRupeesSelected) | @@ -425,7 +425,7 @@ void EnGinkoMan_WaitForDialogueInput(EnGinkoMan* this, PlayState* play) { (((gSaveContext.save.bankRupees & 0xFFFF) - play->msgCtx.bankRupeesSelected) - this->serviceFee) | (gSaveContext.save.bankRupees & 0xFFFF0000); - func_801159EC(play->msgCtx.bankRupeesSelected); + Rupees_ChangeBy(play->msgCtx.bankRupeesSelected); } } else { func_8019F230(); diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 62d8fcb42c..bc95efecd0 100644 --- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -185,7 +185,7 @@ void EnGirlA_Destroy(Actor* thisx, PlayState* play) { } s32 EnGirlA_CanBuyPotionRed(PlayState* play, EnGirlA* this) { - if (!Interface_HasEmptyBottle()) { + if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { @@ -195,7 +195,7 @@ s32 EnGirlA_CanBuyPotionRed(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyPotionGreen(PlayState* play, EnGirlA* this) { - if (!Interface_HasEmptyBottle()) { + if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { @@ -208,7 +208,7 @@ s32 EnGirlA_CanBuyPotionBlue(PlayState* play, EnGirlA* this) { if (!(gSaveContext.save.weekEventReg[53] & 8)) { return CANBUY_RESULT_CANNOT_GET_NOW; } - if (!Interface_HasEmptyBottle()) { + if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } if (!(gSaveContext.save.weekEventReg[53] & 0x10)) { @@ -240,14 +240,14 @@ s32 EnGirlA_CanBuyNuts(PlayState* play, EnGirlA* this) { if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } - if (func_80114978(ITEM_NUT) == ITEM_NONE) { + if (Item_CheckObtainability(ITEM_NUT) == ITEM_NONE) { return CANBUY_RESULT_SUCCESS_1; } return CANBUY_RESULT_SUCCESS_2; } s32 EnGirlA_CanBuyShieldHero(PlayState* play, EnGirlA* this) { - if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != EQUIP_VALUE_SHIELD_NONE) { return CANBUY_RESULT_NO_ROOM; } if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { @@ -263,7 +263,7 @@ s32 EnGirlA_CanBuyStick(PlayState* play, EnGirlA* this) { if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } - if (func_80114978(ITEM_STICK) == ITEM_NONE) { + if (Item_CheckObtainability(ITEM_STICK) == ITEM_NONE) { return CANBUY_RESULT_SUCCESS_1; } return CANBUY_RESULT_SUCCESS_2; @@ -322,7 +322,7 @@ s32 EnGirlA_CanBuyBombchus(PlayState* play, EnGirlA* this) { if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { return CANBUY_RESULT_NEED_RUPEES; } - if (func_80114978(ITEM_BOMBCHU) == ITEM_NONE) { + if (Item_CheckObtainability(ITEM_BOMBCHU) == ITEM_NONE) { return CANBUY_RESULT_SUCCESS_1; } return CANBUY_RESULT_SUCCESS_2; @@ -356,7 +356,7 @@ s32 EnGirlA_CanBuySword(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyShieldMirror(PlayState* play, EnGirlA* this) { - if (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) != 0) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != EQUIP_VALUE_SHIELD_NONE) { return CANBUY_RESULT_NO_ROOM; } if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { @@ -366,7 +366,7 @@ s32 EnGirlA_CanBuyShieldMirror(PlayState* play, EnGirlA* this) { } s32 EnGirlA_CanBuyFairy(PlayState* play, EnGirlA* this) { - if (!Interface_HasEmptyBottle()) { + if (!Inventory_HasEmptyBottle()) { return CANBUY_RESULT_NEED_EMPTY_BOTTLE; } if (gSaveContext.save.playerData.rupees < play->msgCtx.unk1206C) { @@ -398,12 +398,12 @@ void EnGirlA_BuyBottleItem(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_FAIRY); break; } - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyArrows(PlayState* play, EnGirlA* this) { - func_80115A14(ITEM_BOW, this->itemParams); - func_801159EC(-play->msgCtx.unk1206C); + Inventory_ChangeAmmo(ITEM_BOW, this->itemParams); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyNuts(PlayState* play, EnGirlA* this) { @@ -415,22 +415,22 @@ void EnGirlA_BuyNuts(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_NUTS_10); break; } - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyShieldHero(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_SHIELD_HERO); - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyStick(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_STICK); - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyMaskAllNight(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_MASK_ALL_NIGHT); - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyBombBag(PlayState* play, EnGirlA* this) { @@ -446,14 +446,14 @@ void EnGirlA_BuyBombBag(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_BOMB_BAG_40); break; } - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyBombchus(PlayState* play, EnGirlA* this) { if (this->itemParams == 10) { Item_Give(play, ITEM_BOMBCHUS_10); } - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyBombs(PlayState* play, EnGirlA* this) { @@ -471,12 +471,12 @@ void EnGirlA_BuyBombs(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_BOMBS_30); break; } - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyBottle(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_BOTTLE); - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuySword(PlayState* play, EnGirlA* this) { @@ -494,17 +494,17 @@ void EnGirlA_BuySword(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_SWORD_GREAT_FAIRY); break; } - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_BuyShieldMirror(PlayState* play, EnGirlA* this) { Item_Give(play, ITEM_SHIELD_MIRROR); - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } // Fanfare is handled by the shopkeeper void EnGirlA_BuyFanfare(PlayState* play, EnGirlA* this) { - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } void EnGirlA_DoNothing(EnGirlA* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index d6b8513493..fbd3a06efd 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -168,7 +168,7 @@ u16 func_80B50410(EnGk* this, PlayState* play) { if (player->transformation == PLAYER_FORM_GORON) { if (!(gSaveContext.save.weekEventReg[41] & 4)) { if (this->unk_31C == 0xE88) { - if (!(gSaveContext.save.weekEventReg[41] & 8) || Interface_HasEmptyBottle()) { + if (!(gSaveContext.save.weekEventReg[41] & 8) || Inventory_HasEmptyBottle()) { return 0xE89; } gSaveContext.save.weekEventReg[41] |= 4; @@ -179,7 +179,7 @@ u16 func_80B50410(EnGk* this, PlayState* play) { } if ((this->unk_31C == 0xE8D) || (this->unk_31C == 0xE98)) { - if (!(gSaveContext.save.weekEventReg[41] & 8) || Interface_HasEmptyBottle()) { + if (!(gSaveContext.save.weekEventReg[41] & 8) || Inventory_HasEmptyBottle()) { return 0xE89; } gSaveContext.save.weekEventReg[41] |= 4; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 9c7979069a..206df23efb 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -741,7 +741,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->stateFlags = ENHORSE_FLAG_19 | ENHORSE_CANT_JUMP | ENHORSE_UNRIDEABLE; } else if (thisx->params == ENHORSE_8) { this->stateFlags = ENHORSE_FLAG_19 | ENHORSE_CANT_JUMP; - if (CHECK_QUEST_ITEM(14)) { + if (CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) { this->stateFlags &= ~ENHORSE_CANT_JUMP; this->stateFlags |= ENHORSE_FLAG_26; } diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index f536032be6..af2cdca124 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -577,7 +577,7 @@ s32 func_808F4150(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx) if (msgCtx->choiceIndex == 0) { func_8019F208(); if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); if (!(gSaveContext.save.weekEventReg[57] & 1)) { func_808F4108(this, play, 0x3474); } else if (this->unk4AC & 8) { @@ -603,7 +603,7 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, if (msgCtx->choiceIndex == 0) { func_8019F208(); if (gSaveContext.save.playerData.rupees >= fee) { - func_801159EC(-fee); + Rupees_ChangeBy(-fee); if (!(gSaveContext.save.weekEventReg[57] & 1)) { if (arg4 != 0) { Actor_ContinueText(play, &this->actor, 0x3474); @@ -748,10 +748,10 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { if (msgCtx->choiceIndex == 0) { func_8019F208(); if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3C40; Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); ret = true; } else { Actor_ContinueText(play, &this->actor, 0x3469); @@ -894,7 +894,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x347E: func_808F35D8(this, play); - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3B40; Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); ret = true; @@ -1000,10 +1000,10 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { if (msgCtx->choiceIndex == 0) { func_8019F208(); if (gSaveContext.save.playerData.rupees >= play->msgCtx.unk1206C) { - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3C40; Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); ret = true; } else { Actor_ContinueText(play, &this->actor, 0x3469); @@ -1098,7 +1098,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x34A1: func_808F35D8(this, play); - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { this->actionFunc = func_808F3B40; Actor_PickUp(&this->actor, play, GI_MILK, 500.0f, 100.0f); ret = true; diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 14ad0136e6..596cde9148 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -410,7 +410,7 @@ void func_80C14684(EnJgameTsn* this, PlayState* play) { if (gSaveContext.save.playerData.rupees >= 20) { Message_StartTextbox(play, 0x109E, &this->actor); this->unk_300 = 0x109E; - func_801159EC(-20); + Rupees_ChangeBy(-20); } else { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); Message_StartTextbox(play, 0x109D, &this->actor); diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index 63e7c05c22..c13c1279fc 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -216,7 +216,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { if (Message_ShouldAdvance(play) && (this->unk_288 == 0x2716)) { switch (play->msgCtx.choiceIndex) { case 0: - if (GET_CUR_EQUIP_VALUE(EQUIP_SWORD) == EQUIP_SWORD) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; @@ -227,14 +227,14 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { this->unk_288 = 0x2718; } else { func_8019F208(); - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); Message_StartTextbox(play, 0x2719, &this->actor); this->unk_288 = 0x2719; } break; case 1: - if (GET_CUR_EQUIP_VALUE(EQUIP_SWORD) == EQUIP_SWORD) { + if (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_NONE) { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x272C, &this->actor); this->unk_288 = 0x272C; @@ -245,7 +245,7 @@ void func_80B26758(EnKendoJs* this, PlayState* play) { this->unk_288 = 0x2718; } else { func_8019F208(); - func_801159EC(-play->msgCtx.unk12070); + Rupees_ChangeBy(-play->msgCtx.unk12070); Message_StartTextbox(play, 0x273A, &this->actor); this->unk_288 = 0x273A; } diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index 3a8d7c065f..4a10df706d 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -627,7 +627,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { } else { func_8019F208(); func_80B40E74(this, play, 0xC42); - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } break; @@ -716,8 +716,8 @@ void func_80B41E18(EnKgy* this, PlayState* play) { func_80B41368(this, play, 0); this->actor.textId = 0xC43; CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE; - SET_EQUIP_VALUE(EQUIP_SWORD, 0); - func_80112B40(play, 0); + SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_NONE); + Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); func_80B40C74(play); break; @@ -750,7 +750,7 @@ void func_80B41E18(EnKgy* this, PlayState* play) { func_80B41368(this, play, 4); if (this->unk_29C & 0x10) { this->actor.textId = 0xC56; - func_801159EC(play->msgCtx.unk1206C); + Rupees_ChangeBy(play->msgCtx.unk1206C); } else { this->actor.textId = 0xC42; } diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c index 6032856b6b..0df5e93fce 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c @@ -117,7 +117,7 @@ void EnKujiya_HandlePlayerChoice(EnKujiya* this, PlayState* play) { this->textId = 0x2B62; // Not enough Rupees } else { func_8019F208(); - func_801159EC(-10); + Rupees_ChangeBy(-10); Message_StartTextbox(play, 0x2B5F, &this->actor); this->textId = 0x2B5F; // Enter number } diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 6ba77aee30..4e182dfb6f 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -148,7 +148,7 @@ void func_80A6F3B4(EnMm3* this, PlayState* play) { func_8019F208(); Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } else { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x279C, &this->actor); @@ -174,7 +174,7 @@ void func_80A6F3B4(EnMm3* this, PlayState* play) { func_8019F208(); Message_StartTextbox(play, 0x2790, &this->actor); this->unk_2B4 = 0x2790; - func_801159EC(-play->msgCtx.unk1206C); + Rupees_ChangeBy(-play->msgCtx.unk1206C); } else { play_sound(NA_SE_SY_ERROR); Message_StartTextbox(play, 0x279C, &this->actor); diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 3425e69231..f6169b3251 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -127,7 +127,7 @@ void EnMs_Talk(EnMs* this, PlayState* play) { } else { func_8019F208(); Actor_PickUp(&this->actor, play, GI_MAGIC_BEANS, 90.0f, 10.0f); - func_801159EC(-10); + Rupees_ChangeBy(-10); this->actionFunc = EnMs_Sell; } break; diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 51ea07366c..db11157463 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -306,9 +306,9 @@ void func_808FA4F4(EnRr* this, PlayState* play) { this->unk_20C = 0x800; if (((this->unk_1E2 == 0) && (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN)) && - (GET_CUR_EQUIP_VALUE(EQUIP_SHIELD) == 1)) { + (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) == EQUIP_VALUE_SHIELD_HERO)) { sp34 = true; - this->unk_1E2 = Inventory_DeleteEquipment(play, 1); + this->unk_1E2 = Inventory_DeleteEquipment(play, EQUIP_VALUE_SHIELD_HERO); } else { sp34 = false; } diff --git a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c index 11b9095c6e..5aa54307ad 100644 --- a/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c +++ b/src/overlays/actors/ovl_En_Sc_Ruppe/z_en_sc_ruppe.c @@ -117,7 +117,7 @@ void func_80BD6A8C(EnScRuppe* this, PlayState* play) { this->ruppeDisplayTime = 0; this->actor.gravity = 0.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_GET_RUPY); - func_801159EC(sRupeeInfo[this->ruppeIndex].amount); + Rupees_ChangeBy(sRupeeInfo[this->ruppeIndex].amount); this->actionFunc = func_80BD6B18; } this->actor.shape.rot.y += 0x1F4; diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index e161325b9b..ad336d13a4 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -343,7 +343,7 @@ void func_80BCB6D0(EnScopenuts* this, PlayState* play) { func_8019F208(); play->msgCtx.msgMode = 0x43; play->msgCtx.unk12023 = 4; - func_801159EC(this->unk_358 * -1); + Rupees_ChangeBy(-this->unk_358); this->actionFunc = func_80BCB90C; } break; diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index 720a94c807..7f3ac37a79 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -235,7 +235,7 @@ s32 func_80AE6704(EnShn* thisx, PlayState* play) { switch (this->unk_2C6) { case 0: - if (!CHECK_QUEST_ITEM(QUEST_UNK_19)) { + if (!CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { this->unk_2C6 = 6; ret = 1; } else { @@ -250,7 +250,7 @@ s32 func_80AE6704(EnShn* thisx, PlayState* play) { if (func_8013A4C4(D_80AE7258[this->unk_2C6])) { this->unk_2C6 = 6; ret = 1; - REMOVE_QUEST_ITEM(QUEST_UNK_19); + REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); } else { this->unk_2C6++; } diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 8d370985d7..3786f78302 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -1020,7 +1020,8 @@ void func_80BACA14(EnSuttari* this, PlayState* play) { this->unk3F2 = this->headRot.y; this->actionFunc = func_80BACBB0; } - } else if ((player->transformation == PLAYER_FORM_HUMAN) && GET_CUR_EQUIP_VALUE(EQUIP_SWORD) != 0) { + } else if ((player->transformation == PLAYER_FORM_HUMAN) && + (GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) != EQUIP_VALUE_SWORD_NONE)) { if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { this->unk3F2 = this->headRot.y; func_80BAAB78(this, play); diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index a615b7b52c..56133cf701 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -267,7 +267,7 @@ void func_809C6A04(EnSyatekiMan* this, PlayState* play) { this->unk_26A = 3; } else { func_8019F208(); - func_801159EC(-20); + Rupees_ChangeBy(-20); gSaveContext.save.weekEventReg[63] |= 1; gSaveContext.save.weekEventReg[63] &= (u8)~2; play->msgCtx.msgMode = 0x43; @@ -546,7 +546,7 @@ void func_809C7380(EnSyatekiMan* this, PlayState* play) { this->unk_26A = 3; } else { func_8019F208(); - func_801159EC(-20); + Rupees_ChangeBy(-20); this->unk_26A = 2; if (!(this->unk_282 & 0x10)) { this->unk_282 |= 0x10; diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index dae4eb3fb4..60f5d472b4 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -314,7 +314,7 @@ s32 func_80BE0C04(EnTab* this, Actor* actor, f32 arg2) { } s32 func_80BE0D38(EnTab* this, PlayState* play) { - return Interface_HasEmptyBottle(); + return Inventory_HasEmptyBottle(); } s32 func_80BE0D60(EnTab* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c index 601a9f936e..b398d30601 100644 --- a/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c +++ b/src/overlays/actors/ovl_En_Talk_Gibud/z_en_talk_gibud.c @@ -714,7 +714,7 @@ s32 EnTalkGibud_PresentedItemMatchesRequest(EnTalkGibud* this, PlayState* play, return EN_TALK_GIBUD_REQUESTED_ITEM_NOT_ENOUGH_AMMO; } } - if (Interface_HasItemInBottle(requestedItem->item)) { + if (Inventory_HasItemInBottle(requestedItem->item)) { return EN_TALK_GIBUD_REQUESTED_ITEM_MET; } } @@ -820,7 +820,7 @@ void EnTalkGibud_Talk(EnTalkGibud* this, PlayState* play) { // Remove the requested item/amount from the player's inventory requestedItem = &sRequestedItemTable[this->requestedItemIndex]; if (!requestedItem->isBottledItem) { - func_80115A14(requestedItem->item, -requestedItem->amount); + Inventory_ChangeAmmo(requestedItem->item, -requestedItem->amount); } else { func_80123D50(play, player, ITEM_BOTTLE, PLAYER_AP_BOTTLE); } diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index bcf27f409e..514c6bb998 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -223,7 +223,7 @@ s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { } if (gSaveContext.save.playerForm == PLAYER_FORM_HUMAN) { - phi_a3 = GET_CUR_EQUIP_VALUE(EQUIP_SWORD); + phi_a3 = GET_CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD); if (INV_CONTENT(ITEM_SWORD_GREAT_FAIRY) == ITEM_SWORD_GREAT_FAIRY) { phi_a3 += 4; } @@ -238,7 +238,7 @@ s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { } if (isItemFound) { - func_801149A0(itemId2, slotId); + Inventory_DeleteItem(itemId2, slotId); this->unk_3E8 = object_thiefbird_DL_0033B0; if (Message_GetState(&play->msgCtx) == 0) { Message_StartTextbox(play, 0xF4, NULL); @@ -255,12 +255,12 @@ s32 func_80C10B0C(EnThiefbird* this, PlayState* play) { itemId1 = phi_a3 + (ITEM_SWORD_KOKIRI - 1); if (phi_a3 == 4) { - func_801149A0(ITEM_SWORD_GREAT_FAIRY, SLOT_SWORD_GREAT_FAIRY); + Inventory_DeleteItem(ITEM_SWORD_GREAT_FAIRY, SLOT_SWORD_GREAT_FAIRY); this->unk_3E8 = object_thiefbird_DL_003D58; itemId1 = ITEM_SWORD_GREAT_FAIRY; } else { CUR_FORM_EQUIP(EQUIP_SLOT_B) = ITEM_NONE; - SET_EQUIP_VALUE(EQUIP_SWORD, 0); + SET_EQUIP_VALUE(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_NONE); this->unk_3E8 = D_80C13680[phi_a3 - 1]; } @@ -404,7 +404,7 @@ s32 func_80C10E98(PlayState* play) { AMMO(ITEM_BOMB) -= spB0 * 5; AMMO(ITEM_BOW) -= spAC * 10; - func_801159EC(-((phi_s0_2 * 50) + (spA0 * 20) + (phi_s2 * 5) + spA8)); + Rupees_ChangeBy(-((phi_s0_2 * 50) + (spA0 * 20) + (phi_s2 * 5) + spA8)); return true; } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 89ed1388d3..253720d1fb 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -593,7 +593,7 @@ void func_80AED610(EnTk* this, PlayState* play) { break; case 0x1413: - func_801159EC(30); + Rupees_ChangeBy(30); gSaveContext.save.weekEventReg[60] |= 2; func_80151938(play, 0x13FF); break; diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index 3fa37859c7..9053dc0afd 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -387,7 +387,7 @@ void EnTrt_Goodbye(EnTrt* this, PlayState* play) { void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { if (this->textId == 0x88F) { - if (Interface_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { + if (Inventory_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; @@ -408,7 +408,7 @@ void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, PlayState* play) { EnTrt_SetupStartShopping(play, this, 0); } else if (gSaveContext.save.weekEventReg[84] & 0x40) { this->textId = 0x83B; - if (Interface_HasItemInBottle(ITEM_POTION_RED)) { + if (Inventory_HasItemInBottle(ITEM_POTION_RED)) { EnTrt_SetupStartShopping(play, this, false); } else { this->actionFunc = EnTrt_TryToGiveRedPotion; @@ -720,7 +720,7 @@ void EnTrt_SelectItem(EnTrt* this, PlayState* play) { } } } else if (talkState == 5 && Message_ShouldAdvance(play)) { - if (!Interface_HasEmptyBottle()) { + if (!Inventory_HasEmptyBottle()) { play_sound(NA_SE_SY_ERROR); EnTrt_SetupCannotBuy(play, this, 0x846); } else { @@ -931,7 +931,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { this->blinkFunc = EnTrt_Blink; if (talkState == 6 && Message_ShouldAdvance(play)) { - if (Interface_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { + if (Inventory_HasEmptyBottle() || !(gSaveContext.save.weekEventReg[12] & 0x10)) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; @@ -950,7 +950,7 @@ void EnTrt_TryToGiveRedPotionAfterSurprised(EnTrt* this, PlayState* play) { void EnTrt_TryToGiveRedPotion(EnTrt* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == 5 && Message_ShouldAdvance(play)) { if (this->textId == 0x83C) { - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); this->cutsceneState = ENTRT_CUTSCENESTATE_STOPPED; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index f108498e8f..cadd76abce 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -348,7 +348,7 @@ void func_80AD3DA4(EnTrt2* this, PlayState* play) { this->unk_3B2 = 11; return; } else if (this->unk_3A8 == 0x88F) { - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { this->unk_3B2 = 11; } else { this->unk_3B2 = 10; @@ -360,7 +360,7 @@ void func_80AD3DA4(EnTrt2* this, PlayState* play) { void func_80AD3E34(EnTrt2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == 5) && Message_ShouldAdvance(play)) { - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { play->msgCtx.msgMode = 0x43; play->msgCtx.unk12023 = 4; this->unk_3B2 = 12; @@ -378,7 +378,7 @@ void func_80AD3EF0(EnTrt2* this, PlayState* play) { if (temp_v0 == 6) { if (Message_ShouldAdvance(play)) { - if ((Interface_HasEmptyBottle() && !(gSaveContext.save.weekEventReg[84] & 0x40)) || + if ((Inventory_HasEmptyBottle() && !(gSaveContext.save.weekEventReg[84] & 0x40)) || !(gSaveContext.save.weekEventReg[12] & 0x10)) { this->unk_3B2 = 12; } else { diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index f0ceee7d91..47a1665517 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -323,7 +323,7 @@ void func_80AE04FC(EnTsn* this, PlayState* play) { func_801477B4(play); this->actionFunc = func_80AE0704; if (sp24 == 19) { - if (CHECK_QUEST_ITEM(QUEST_UNK_19)) { + if (CHECK_QUEST_ITEM(QUEST_PICTOGRAPH)) { if (func_8013A4C4(1 | 8)) { player->actor.textId = 0x107B; return; @@ -424,7 +424,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { break; case 0x107C: - if (Interface_HasEmptyBottle()) { + if (Inventory_HasEmptyBottle()) { gSaveContext.save.weekEventReg[26] |= 8; func_801477B4(play); this->actionFunc = func_80AE0460; @@ -433,7 +433,7 @@ void func_80AE0704(EnTsn* this, PlayState* play) { this->actor.focus.pos = this->actor.world.pos; ActorCutscene_Stop(this->actor.cutscene); this->actor.flags &= ~ACTOR_FLAG_100; - REMOVE_QUEST_ITEM(QUEST_UNK_19); + REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); } else { func_80151938(play, 0x10A8); } diff --git a/src/overlays/actors/ovl_En_Zos/z_en_zos.c b/src/overlays/actors/ovl_En_Zos/z_en_zos.c index 89cc1ee140..7ceea163e1 100644 --- a/src/overlays/actors/ovl_En_Zos/z_en_zos.c +++ b/src/overlays/actors/ovl_En_Zos/z_en_zos.c @@ -232,7 +232,7 @@ void func_80BBB2C4(EnZos* this, PlayState* play) { } void func_80BBB354(EnZos* this, PlayState* play) { - s32 item; + s32 getItemId; if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; @@ -242,11 +242,11 @@ void func_80BBB354(EnZos* this, PlayState* play) { func_800B8500(&this->actor, play, 1000.0f, 1000.0f, -1); } else { if (gSaveContext.save.weekEventReg[39] & 0x20) { - item = GI_RUPEE_PURPLE; + getItemId = GI_RUPEE_PURPLE; } else { - item = GI_HEART_PIECE; + getItemId = GI_HEART_PIECE; } - Actor_PickUp(&this->actor, play, item, 10000.0f, 50.0f); + Actor_PickUp(&this->actor, play, getItemId, 10000.0f, 50.0f); } } diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index 7185457722..5fb0ce7c03 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -461,7 +461,7 @@ void func_80B973BC(EnZot* this, PlayState* play) { break; case 0x126F: - func_801159EC(90); + Rupees_ChangeBy(90); func_80151938(play, 0x1270); break; @@ -470,7 +470,7 @@ void func_80B973BC(EnZot* this, PlayState* play) { func_80151938(play, 0x1277); } else { func_80151938(play, 0x1278); - func_801159EC(-10); + Rupees_ChangeBy(-10); } break; @@ -955,13 +955,13 @@ void func_80B985EC(EnZot* this, PlayState* play) { itemActionParam = func_80123810(play); if (itemActionParam > PLAYER_AP_NONE) { func_801477B4(play); - if ((itemActionParam == PLAYER_AP_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_UNK_19) && func_8013A4C4(4)) { + if ((itemActionParam == PLAYER_AP_PICTO_BOX) && CHECK_QUEST_ITEM(QUEST_PICTOGRAPH) && func_8013A4C4(4)) { if (func_8013A4C4(5) && func_8013A4C4(6)) { player->actor.textId = 0x12AE; } else { player->actor.textId = 0x12AC; } - REMOVE_QUEST_ITEM(QUEST_UNK_19); + REMOVE_QUEST_ITEM(QUEST_PICTOGRAPH); } else { player->actor.textId = 0x12AB; } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 68beedeecb..4a62de6a23 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -22,11 +22,11 @@ void Select_LoadGame(SelectContext* this, u32 entranceIndex, s32 opt) { Sram_InitDebugSave(); } - gSaveContext.buttonStatus[0] = BTN_ENABLED; - gSaveContext.buttonStatus[1] = BTN_ENABLED; - gSaveContext.buttonStatus[2] = BTN_ENABLED; - gSaveContext.buttonStatus[3] = BTN_ENABLED; - gSaveContext.buttonStatus[4] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; gSaveContext.unk_3F1E = 0; gSaveContext.unk_3F20 = 0; gSaveContext.unk_3F22 = 0; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 6ae5315116..608c606a22 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2109,31 +2109,31 @@ 0x801129E4:("func_801129E4",), 0x80112AF4:("func_80112AF4",), 0x80112AFC:("func_80112AFC",), - 0x80112B40:("func_80112B40",), - 0x80112BE4:("func_80112BE4",), + 0x80112B40:("Interface_LoadItemIconImpl",), + 0x80112BE4:("Interface_LoadItemIcon",), 0x80112C0C:("func_80112C0C",), 0x80112E80:("Item_Give",), - 0x801143CC:("func_801143CC",), - 0x80114978:("func_80114978",), - 0x801149A0:("func_801149A0",), - 0x80114A9C:("func_80114A9C",), - 0x80114B84:("func_80114B84",), - 0x80114CA0:("func_80114CA0",), - 0x80114E90:("Interface_HasEmptyBottle",), - 0x80114F2C:("Interface_HasItemInBottle",), - 0x80114FD0:("func_80114FD0",), - 0x80115130:("func_80115130",), - 0x801152B8:("func_801152B8",), + 0x801143CC:("Item_CheckObtainabilityImpl",), + 0x80114978:("Item_CheckObtainability",), + 0x801149A0:("Inventory_DeleteItem",), + 0x80114A9C:("Inventory_UnequipItem",), + 0x80114B84:("Inventory_ReplaceItem",), + 0x80114CA0:("Inventory_UpdateDeitySwordEquip",), + 0x80114E90:("Inventory_HasEmptyBottle",), + 0x80114F2C:("Inventory_HasItemInBottle",), + 0x80114FD0:("Inventory_UpdateBottleItem",), + 0x80115130:("Inventory_ConsumeFairy",), + 0x801152B8:("Inventory_UpdateItem",), 0x801153C8:("func_801153C8",), 0x80115428:("func_80115428",), 0x8011552C:("func_8011552C",), 0x801155B4:("func_801155B4",), 0x80115764:("func_80115764",), 0x80115844:("func_80115844",), - 0x80115908:("func_80115908",), - 0x801159C0:("func_801159c0",), - 0x801159EC:("func_801159EC",), - 0x80115A14:("func_80115A14",), + 0x80115908:("Health_ChangeBy",), + 0x801159C0:("Health_GiveHearts",), + 0x801159EC:("Rupees_ChangeBy",), + 0x80115A14:("Inventory_ChangeAmmo",), 0x80115D14:("Parameter_AddMagic",), 0x80115D5C:("func_80115D5C",), 0x80115DB4:("func_80115DB4",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 45ba75a87d..ff6b7a6b94 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1062,65 +1062,51 @@ 0x801BF5B0:("D_801BF5B0","UNK_TYPE2","",0x2), 0x801BF5C0:("D_801BF5C0","UNK_PTR","",0x4), 0x801BF68C:("D_801BF68C","UNK_TYPE1","",0x1), - 0x801BF6C0:("D_801BF6C0","UNK_TYPE1","",0x1), - 0x801BF79E:("D_801BF79E","UNK_TYPE1","",0x1), + 0x801BF6C0:("sRestrictionFlags","RestrictionFlags","[113]",0x1c4), 0x801BF884:("D_801BF884","UNK_TYPE2","",0x2), 0x801BF888:("D_801BF888","UNK_TYPE2","",0x2), - 0x801BF88C:("D_801BF88C","UNK_TYPE2","",0x2), - 0x801BF890:("D_801BF890","UNK_TYPE2","",0x2), - 0x801BF898:("D_801BF898","UNK_TYPE2","",0x2), - 0x801BF89C:("D_801BF89C","UNK_TYPE2","",0x2), - 0x801BF8A0:("D_801BF8A0","UNK_TYPE2","",0x2), - 0x801BF8A4:("D_801BF8A4","UNK_TYPE2","",0x2), - 0x801BF8A8:("D_801BF8A8","UNK_TYPE2","",0x2), + 0x801BF88C:("sHBAScoreTier","UNK_TYPE2","",0x2), + 0x801BF890:("sMinigameScoreDigits","UNK_TYPE2","",0x2), + 0x801BF898:("sCUpInvisible","UNK_TYPE2","",0x2), + 0x801BF89C:("sCUpTimer","UNK_TYPE2","",0x2), + 0x801BF8A0:("sMagicBarOutlinePrimRed","UNK_TYPE2","",0x2), + 0x801BF8A4:("sMagicBarOutlinePrimGreen","UNK_TYPE2","",0x2), + 0x801BF8A8:("sMagicBarOutlinePrimBlue","UNK_TYPE2","",0x2), 0x801BF8AC:("D_801BF8AC","UNK_TYPE2","",0x2), 0x801BF8B0:("D_801BF8B0","UNK_TYPE2","",0x2), 0x801BF8DC:("D_801BF8DC","UNK_TYPE2","",0x2), 0x801BF8E0:("D_801BF8E0","UNK_TYPE2","",0x2), 0x801BF8E4:("D_801BF8E4","UNK_TYPE2","",0x2), 0x801BF8E8:("D_801BF8E8","UNK_TYPE4","",0x4), - 0x801BF8F0:("D_801BF8F0","UNK_TYPE4","",0x4), - 0x801BF8F4:("D_801BF8F4","UNK_TYPE4","",0x4), - 0x801BF8F8:("D_801BF8F8","UNK_TYPE4","",0x4), - 0x801BF8FC:("D_801BF8FC","UNK_TYPE4","",0x4), - 0x801BF930:("D_801BF930","UNK_TYPE4","",0x4), - 0x801BF934:("D_801BF934","UNK_TYPE4","",0x4), - 0x801BF968:("D_801BF968","UNK_TYPE1","",0x1), - 0x801BF96A:("D_801BF96A","UNK_TYPE1","",0x1), - 0x801BF96C:("D_801BF96C","UNK_TYPE1","",0x1), - 0x801BF96E:("D_801BF96E","UNK_TYPE1","",0x1), - 0x801BF970:("D_801BF970","UNK_TYPE2","",0x2), - 0x801BF972:("D_801BF972","UNK_TYPE1","",0x1), - 0x801BF974:("D_801BF974","UNK_TYPE2","",0x2), - 0x801BF978:("D_801BF978","UNK_TYPE2","",0x2), - 0x801BF97C:("D_801BF97C","UNK_TYPE2","",0x2), + 0x801BF8F0:("D_801BF8F0","u64","",0x8), + 0x801BF8F8:("D_801BF8F8","u64","[7]",0x38), + 0x801BF930:("D_801BF930","u64","[7]",0x38), + 0x801BF968:("D_801BF968","UNK_TYPE4","",0x4), + 0x801BF96C:("D_801BF96C","UNK_TYPE4","",0x4), + 0x801BF970:("D_801BF970","UNK_TYPE4","",0x4), + 0x801BF974:("D_801BF974","UNK_TYPE4","",0x4), + 0x801BF978:("D_801BF978","UNK_TYPE4","",0x4), + 0x801BF97C:("D_801BF97C","UNK_TYPE4","",0x4), 0x801BF980:("D_801BF980","UNK_TYPE4","",0x4), - 0x801BF988:("D_801BF988","UNK_TYPE1","",0x1), - 0x801BF998:("D_801BF998","UNK_TYPE1","",0x1), + 0x801BF988:("D_801BF988","Gfx","[5]",0x28), 0x801BF9B0:("D_801BF9B0","UNK_TYPE2","",0x2), 0x801BF9B4:("D_801BF9B4","UNK_TYPE1","",0x1), 0x801BF9BC:("D_801BF9BC","UNK_TYPE1","",0x1), 0x801BF9C4:("D_801BF9C4","UNK_TYPE1","",0x1), 0x801BF9C8:("D_801BF9C8","UNK_TYPE1","",0x1), 0x801BF9CC:("D_801BF9CC","UNK_TYPE1","",0x1), - 0x801BF9D4:("D_801BF9D4","UNK_TYPE2","",0x2), - 0x801BF9D6:("D_801BF9D6","UNK_TYPE2","",0x2), - 0x801BF9D8:("D_801BF9D8","UNK_TYPE2","",0x2), - 0x801BF9DA:("D_801BF9DA","UNK_TYPE2","",0x2), - 0x801BF9DC:("D_801BF9DC","UNK_TYPE2","",0x2), - 0x801BF9DE:("D_801BF9DE","UNK_TYPE2","",0x2), - 0x801BF9E0:("D_801BF9E0","UNK_TYPE2","",0x2), - 0x801BF9E2:("D_801BF9E2","UNK_TYPE2","",0x2), - 0x801BF9E4:("D_801BF9E4","UNK_TYPE2","",0x2), - 0x801BF9E6:("D_801BF9E6","UNK_TYPE2","",0x2), - 0x801BF9E8:("D_801BF9E8","UNK_TYPE2","",0x2), - 0x801BF9EA:("D_801BF9EA","UNK_TYPE2","",0x2), - 0x801BF9EC:("D_801BF9EC","UNK_TYPE2","",0x2), - 0x801BF9F0:("D_801BF9F0","UNK_TYPE2","",0x2), - 0x801BF9F4:("D_801BF9F4","UNK_TYPE2","",0x2), - 0x801BF9F8:("D_801BF9F8","UNK_TYPE2","",0x2), - 0x801BF9FC:("D_801BF9FC","UNK_TYPE2","",0x2), - 0x801BFA00:("D_801BFA00","UNK_TYPE2","",0x2), + 0x801BF9D4:("D_801BF9D4","UNK_TYPE4","",0x4), + 0x801BF9D8:("D_801BF9D8","UNK_TYPE4","",0x4), + 0x801BF9DC:("D_801BF9DC","UNK_TYPE4","",0x4), + 0x801BF9E0:("D_801BF9E0","UNK_TYPE4","",0x4), + 0x801BF9E4:("D_801BF9E4","UNK_TYPE4","",0x4), + 0x801BF9E8:("D_801BF9E8","UNK_TYPE4","",0x4), + 0x801BF9EC:("sFinalHoursClockDigitsRed","UNK_TYPE4","",0x4), + 0x801BF9F0:("sFinalHoursClockFrameEnvRed","UNK_TYPE2","",0x2), + 0x801BF9F4:("sFinalHoursClockFrameEnvGreen","UNK_TYPE2","",0x2), + 0x801BF9F8:("sFinalHoursClockFrameEnvBlue","UNK_TYPE2","",0x2), + 0x801BF9FC:("sFinalHoursClockColorTimer","UNK_TYPE2","",0x2), + 0x801BFA00:("sFinalHoursClockColorTargetIndex","UNK_TYPE2","",0x2), 0x801BFA04:("D_801BFA04","UNK_TYPE2","",0x2), 0x801BFA1C:("D_801BFA1C","UNK_TYPE2","",0x2), 0x801BFA34:("D_801BFA34","UNK_TYPE2","",0x2), @@ -1128,16 +1114,14 @@ 0x801BFA64:("D_801BFA64","UNK_TYPE2","",0x2), 0x801BFA74:("D_801BFA74","UNK_TYPE2","",0x2), 0x801BFA84:("D_801BFA84","UNK_TYPE4","",0x4), - 0x801BFAB0:("D_801BFAB0","UNK_TYPE1","",0x1), - 0x801BFAB8:("D_801BFAB8","UNK_TYPE1","",0x1), - 0x801BFAC4:("D_801BFAC4","UNK_TYPE1","",0x1), - 0x801BFACC:("D_801BFACC","UNK_TYPE1","",0x1), - 0x801BFAD4:("D_801BFAD4","UNK_TYPE1","",0x1), - 0x801BFAF4:("D_801BFAF4","UNK_TYPE2","",0x2), - 0x801BFAF6:("D_801BFAF6","UNK_TYPE2","",0x2), - 0x801BFAF8:("D_801BFAF8","UNK_TYPE2","",0x2), - 0x801BFAFA:("D_801BFAFA","UNK_TYPE2","",0x2), - 0x801BFAFC:("D_801BFAFC","UNK_TYPE1","",0x1), + 0x801BFAB0:("sDoActionTextures","UNK_TYPE1","",0x1), + 0x801BFAB8:("magicBorderColors","UNK_TYPE1","",0x1), + 0x801BFAC4:("magicBorderIndices","UNK_TYPE1","",0x1), + 0x801BFACC:("magicBorderColorTimerIndex","UNK_TYPE1","",0x1), + 0x801BFAD4:("cUpLabelTextures","UNK_TYPE1","",0x1), + 0x801BFAF4:("D_801BFAF4","UNK_TYPE4","",0x4), + 0x801BFAF8:("D_801BFAF8","UNK_TYPE4","",0x4), + 0x801BFAFC:("D_801BFAFC","UNK_TYPE4","",0x4), 0x801BFB04:("D_801BFB04","UNK_TYPE1","",0x1), 0x801BFB0C:("D_801BFB0C","UNK_TYPE1","",0x1), 0x801BFB14:("D_801BFB14","UNK_TYPE1","",0x1), @@ -1169,27 +1153,19 @@ 0x801BFC14:("D_801BFC14","UNK_TYPE1","",0x1), 0x801BFC40:("D_801BFC40","UNK_TYPE1","",0x1), 0x801BFC50:("D_801BFC50","UNK_TYPE2","",0x2), - 0x801BFC60:("D_801BFC60","UNK_TYPE2","",0x2), - 0x801BFC62:("D_801BFC62","UNK_TYPE2","",0x2), - 0x801BFC64:("D_801BFC64","UNK_TYPE2","",0x2), - 0x801BFC6C:("D_801BFC6C","UNK_TYPE2","",0x2), + 0x801BFC60:("D_801BFC60","s16","[6]",0xC), + 0x801BFC6C:("D_801BFC6C","UNK_TYPE4","",0x4), 0x801BFC7C:("D_801BFC7C","UNK_TYPE2","",0x2), 0x801BFC8C:("D_801BFC8C","UNK_TYPE1","",0x1), 0x801BFC98:("D_801BFC98","UNK_TYPE2","",0x2), 0x801BFCA8:("D_801BFCA8","UNK_TYPE2","",0x2), 0x801BFCB8:("D_801BFCB8","UNK_TYPE1","",0x1), 0x801BFCC4:("D_801BFCC4","UNK_TYPE4","",0x4), - 0x801BFCE4:("D_801BFCE4","UNK_TYPE2","",0x2), - 0x801BFCE8:("D_801BFCE8","UNK_TYPE2","",0x2), - 0x801BFCEA:("D_801BFCEA","UNK_TYPE2","",0x2), - 0x801BFCEC:("D_801BFCEC","UNK_TYPE2","",0x2), - 0x801BFCEE:("D_801BFCEE","UNK_TYPE2","",0x2), - 0x801BFCF0:("D_801BFCF0","UNK_TYPE2","",0x2), - 0x801BFCF2:("D_801BFCF2","UNK_TYPE2","",0x2), - 0x801BFCF4:("D_801BFCF4","UNK_TYPE2","",0x2), - 0x801BFCF8:("D_801BFCF8","UNK_TYPE2","",0x2), - 0x801BFCFC:("D_801BFCFC","UNK_TYPE2","",0x2), - 0x801BFD0C:("D_801BFD0C","UNK_TYPE2","",0x2), + 0x801BFCE4:("D_801BFCE4","UNK_TYPE4","",0x4), + 0x801BFCE8:("D_801BFCE8","u16","[8]",0x10), + 0x801BFCF8:("D_801BFCF8","UNK_TYPE4","",0x4), + 0x801BFCFC:("D_801BFCFC","UNK_TYPE4","",0x4), + 0x801BFD0C:("D_801BFD0C","UNK_TYPE4","",0x4), 0x801BFD1C:("D_801BFD1C","UNK_TYPE1","",0x1), 0x801BFD24:("D_801BFD24","UNK_TYPE1","",0x1), 0x801BFD2C:("D_801BFD2C","UNK_TYPE1","",0x1), @@ -1199,8 +1175,8 @@ 0x801BFD6C:("D_801BFD6C","UNK_TYPE2","",0x2), 0x801BFD84:("D_801BFD84","UNK_TYPE1","",0x1), 0x801BFD8C:("D_801BFD8C","UNK_TYPE1","",0x1), - 0x801BFD94:("D_801BFD94","UNK_TYPE1","",0x1), - 0x801BFD98:("D_801BFD98","UNK_TYPE2","",0x8), + 0x801BFD94:("D_801BFD94","UNK_TYPE4","",0x4), + 0x801BFD98:("D_801BFD98","UNK_TYPE4","[2]",0x8), 0x801BFDA0:("sMaskObjectIds","s16","[24]",0x30), 0x801BFDD0:("D_801BFDD0","UNK_TYPE1","",0x1), 0x801BFDE8:("sMaskItemIds","UNK_TYPE1","",0x1), diff --git a/tools/namefixer.py b/tools/namefixer.py index 6cae549c06..973e78473e 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -468,6 +468,22 @@ wordReplace = { "func_80169E6C": "Play_SetupRespawnPoint", "func_8016A0AC": "Play_IsUnderwater", "func_801690CC": "Play_InCsMode", + "func_80112B40": "Interface_LoadItemIconImpl", + "func_80112BE4": "Interface_LoadItemIcon", + "func_80114978": "Item_CheckObtainability", + "func_801149A0": "Inventory_DeleteItem", + "func_80114A9C": "Inventory_UnequipItem", + "func_80114B84": "Inventory_ReplaceItem", + "func_80114CA0": "Inventory_UpdateDeitySwordEquip", + "Interface_HasEmptyBottle": "Inventory_HasEmptyBottle", + "Interface_HasItemInBottle": "Inventory_HasItemInBottle", + "func_80114FD0": "Inventory_UpdateBottleItem", + "func_80115130": "Inventory_ConsumeFairy", + "func_801152B8": "Inventory_UpdateItem", + "func_80115908": "Health_ChangeBy", + "func_801159c0": "Health_GiveHearts", + "func_801159EC": "Rupees_ChangeBy", + "func_80115A14": "Inventory_ChangeAmmo", "func_8013EC44": "Rumble_Override", "func_8013ECE0": "Rumble_Request", "func_8017D2FC": "Math3D_LineSegVsPlane", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 53cf3ccf3e..e8acc77447 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1623,31 +1623,31 @@ asm/non_matchings/code/z_parameter/func_80111CB4.s,func_80111CB4,0x80111CB4,0x34 asm/non_matchings/code/z_parameter/func_801129E4.s,func_801129E4,0x801129E4,0x44 asm/non_matchings/code/z_parameter/func_80112AF4.s,func_80112AF4,0x80112AF4,0x2 asm/non_matchings/code/z_parameter/func_80112AFC.s,func_80112AFC,0x80112AFC,0x11 -asm/non_matchings/code/z_parameter/func_80112B40.s,func_80112B40,0x80112B40,0x29 -asm/non_matchings/code/z_parameter/func_80112BE4.s,func_80112BE4,0x80112BE4,0xA +asm/non_matchings/code/z_parameter/Interface_LoadItemIconImpl.s,Interface_LoadItemIconImpl,0x80112B40,0x29 +asm/non_matchings/code/z_parameter/Interface_LoadItemIcon.s,Interface_LoadItemIcon,0x80112BE4,0xA asm/non_matchings/code/z_parameter/func_80112C0C.s,func_80112C0C,0x80112C0C,0x9D asm/non_matchings/code/z_parameter/Item_Give.s,Item_Give,0x80112E80,0x553 -asm/non_matchings/code/z_parameter/func_801143CC.s,func_801143CC,0x801143CC,0x16B -asm/non_matchings/code/z_parameter/func_80114978.s,func_80114978,0x80114978,0xA -asm/non_matchings/code/z_parameter/func_801149A0.s,func_801149A0,0x801149A0,0x3F -asm/non_matchings/code/z_parameter/func_80114A9C.s,func_80114A9C,0x80114A9C,0x3A -asm/non_matchings/code/z_parameter/func_80114B84.s,func_80114B84,0x80114B84,0x47 -asm/non_matchings/code/z_parameter/func_80114CA0.s,func_80114CA0,0x80114CA0,0x7C -asm/non_matchings/code/z_parameter/Interface_HasEmptyBottle.s,Interface_HasEmptyBottle,0x80114E90,0x27 -asm/non_matchings/code/z_parameter/Interface_HasItemInBottle.s,Interface_HasItemInBottle,0x80114F2C,0x29 -asm/non_matchings/code/z_parameter/func_80114FD0.s,func_80114FD0,0x80114FD0,0x58 -asm/non_matchings/code/z_parameter/func_80115130.s,func_80115130,0x80115130,0x62 -asm/non_matchings/code/z_parameter/func_801152B8.s,func_801152B8,0x801152B8,0x44 +asm/non_matchings/code/z_parameter/Item_CheckObtainabilityImpl.s,Item_CheckObtainabilityImpl,0x801143CC,0x16B +asm/non_matchings/code/z_parameter/Item_CheckObtainability.s,Item_CheckObtainability,0x80114978,0xA +asm/non_matchings/code/z_parameter/Inventory_DeleteItem.s,Inventory_DeleteItem,0x801149A0,0x3F +asm/non_matchings/code/z_parameter/Inventory_UnequipItem.s,Inventory_UnequipItem,0x80114A9C,0x3A +asm/non_matchings/code/z_parameter/Inventory_ReplaceItem.s,Inventory_ReplaceItem,0x80114B84,0x47 +asm/non_matchings/code/z_parameter/Inventory_UpdateDeitySwordEquip.s,Inventory_UpdateDeitySwordEquip,0x80114CA0,0x7C +asm/non_matchings/code/z_parameter/Inventory_HasEmptyBottle.s,Inventory_HasEmptyBottle,0x80114E90,0x27 +asm/non_matchings/code/z_parameter/Inventory_HasItemInBottle.s,Inventory_HasItemInBottle,0x80114F2C,0x29 +asm/non_matchings/code/z_parameter/Inventory_UpdateBottleItem.s,Inventory_UpdateBottleItem,0x80114FD0,0x58 +asm/non_matchings/code/z_parameter/Inventory_ConsumeFairy.s,Inventory_ConsumeFairy,0x80115130,0x62 +asm/non_matchings/code/z_parameter/Inventory_UpdateItem.s,Inventory_UpdateItem,0x801152B8,0x44 asm/non_matchings/code/z_parameter/func_801153C8.s,func_801153C8,0x801153C8,0x18 asm/non_matchings/code/z_parameter/func_80115428.s,func_80115428,0x80115428,0x41 asm/non_matchings/code/z_parameter/func_8011552C.s,func_8011552C,0x8011552C,0x22 asm/non_matchings/code/z_parameter/func_801155B4.s,func_801155B4,0x801155B4,0x6C asm/non_matchings/code/z_parameter/func_80115764.s,func_80115764,0x80115764,0x38 asm/non_matchings/code/z_parameter/func_80115844.s,func_80115844,0x80115844,0x31 -asm/non_matchings/code/z_parameter/func_80115908.s,func_80115908,0x80115908,0x2E -asm/non_matchings/code/z_parameter/func_801159c0.s,func_801159c0,0x801159C0,0xB -asm/non_matchings/code/z_parameter/func_801159EC.s,func_801159EC,0x801159EC,0xA -asm/non_matchings/code/z_parameter/func_80115A14.s,func_80115A14,0x80115A14,0xC0 +asm/non_matchings/code/z_parameter/Health_ChangeBy.s,Health_ChangeBy,0x80115908,0x2E +asm/non_matchings/code/z_parameter/Health_GiveHearts.s,Health_GiveHearts,0x801159C0,0xB +asm/non_matchings/code/z_parameter/Rupees_ChangeBy.s,Rupees_ChangeBy,0x801159EC,0xA +asm/non_matchings/code/z_parameter/Inventory_ChangeAmmo.s,Inventory_ChangeAmmo,0x80115A14,0xC0 asm/non_matchings/code/z_parameter/Parameter_AddMagic.s,Parameter_AddMagic,0x80115D14,0x12 asm/non_matchings/code/z_parameter/func_80115D5C.s,func_80115D5C,0x80115D5C,0x16 asm/non_matchings/code/z_parameter/func_80115DB4.s,func_80115DB4,0x80115DB4,0xB5