summaryrefslogtreecommitdiff
path: root/src/code/code_80097A00.c
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2022-04-30 18:18:56 +0200
committerGitHub <noreply@github.com>2022-04-30 18:18:56 +0200
commitb9fded7b4ed6ded28360ceb69737f9b4c10e4946 (patch)
treebe7ba41b51c57b8a0eee03e3db934233fa8a1f7e /src/code/code_80097A00.c
parent72847660eb4b9eef8a392ddb2edc64060dd40500 (diff)
Doc equips usage (inventory, current and player-specific constants) (#1142)
* Doc equips usage (inventory, current and player-specific constants) * Improve some comments * `currentSword`(`Item`) -> `currentSwordItemId` * Comments on the right in `D_801261F8` * Improve `sDebugSaveInventory.equipment` formatting with extra parentheses * Use constants for `sNewSaveInventory.equipment` * Run formatter * Make comments in z64save.h header a single line even if very long * `CHECK_OWNED_EQUIP_ALT` * One more use of `CHECK_OWNED_EQUIP` * `OWNED_EQUIP_FLAG` * `OWNED_EQUIP_FLAG_ALT` * Improve (?) giving sword by item id * "half-byte" -> "nibble" * Improve equips for setting kokiri sword * Improve (?) checking boots by item id * Improve (?) checking equips by item id * Fixup one spot assuming `EQUIP_TYPE_SWORD == 0` * Comments on the right in `sBootDListGroups`
Diffstat (limited to 'src/code/code_80097A00.c')
-rw-r--r--src/code/code_80097A00.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/code/code_80097A00.c b/src/code/code_80097A00.c
index f60924fbb..6e624ed17 100644
--- a/src/code/code_80097A00.c
+++ b/src/code/code_80097A00.c
@@ -191,22 +191,22 @@ void Inventory_ChangeEquipment(s16 equipment, u16 value) {
u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
Player* player = GET_PLAYER(globalCtx);
s32 pad;
- u16 sp26 = gSaveContext.equips.equipment & gEquipMasks[equipment];
+ u16 equipValue = gSaveContext.equips.equipment & gEquipMasks[equipment];
// "Erasing equipment item = %d zzz=%d"
- osSyncPrintf("装備アイテム抹消 = %d zzz=%d\n", equipment, sp26);
+ osSyncPrintf("装備アイテム抹消 = %d zzz=%d\n", equipment, equipValue);
- if (sp26) {
- sp26 >>= gEquipShifts[equipment];
+ if (equipValue) {
+ equipValue >>= gEquipShifts[equipment];
gSaveContext.equips.equipment &= gEquipNegMasks[equipment];
- gSaveContext.inventory.equipment ^= gBitFlags[sp26 - 1] << gEquipShifts[equipment];
+ gSaveContext.inventory.equipment ^= OWNED_EQUIP_FLAG(equipment, equipValue - 1);
- if (equipment == EQUIP_TUNIC) {
- gSaveContext.equips.equipment |= 0x0100;
+ if (equipment == EQUIP_TYPE_TUNIC) {
+ gSaveContext.equips.equipment |= EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4);
}
- if (equipment == EQUIP_SWORD) {
+ if (equipment == EQUIP_TYPE_SWORD) {
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
gSaveContext.infTable[INFTABLE_1DX_INDEX] = 1;
}
@@ -215,7 +215,7 @@ u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) {
globalCtx->pauseCtx.cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT;
}
- return sp26;
+ return equipValue;
}
void Inventory_ChangeUpgrade(s16 upgrade, s16 value) {