1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-17 21:35:11 +00:00

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`
This commit is contained in:
Dragorn421 2022-04-30 18:18:56 +02:00 committed by GitHub
parent 72847660eb
commit b9fded7b4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 237 additions and 127 deletions

View file

@ -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) {