1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-11 17:30:25 +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

@ -575,18 +575,18 @@ void KaleidoScope_DrawDebugEditor(GlobalContext* globalCtx) {
}
}
} else {
i = curSection - 0x34;
i = curSection - 0x34; // 0 <= i < 4
if (CHECK_BTN_ALL(input->press.button, BTN_CLEFT)) {
gSaveContext.inventory.equipment ^= (1 << gEquipShifts[i]);
gSaveContext.inventory.equipment ^= OWNED_EQUIP_FLAG_ALT(i, 0);
}
if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
gSaveContext.inventory.equipment ^= (2 << gEquipShifts[i]);
gSaveContext.inventory.equipment ^= OWNED_EQUIP_FLAG_ALT(i, 1);
}
if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) {
gSaveContext.inventory.equipment ^= (4 << gEquipShifts[i]);
gSaveContext.inventory.equipment ^= OWNED_EQUIP_FLAG_ALT(i, 2);
}
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
gSaveContext.inventory.equipment ^= (8 << gEquipShifts[i]);
gSaveContext.inventory.equipment ^= OWNED_EQUIP_FLAG_ALT(i, 3);
}
}
} else if (curSection < 0x44) {

View file

@ -92,7 +92,7 @@ void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) {
pos.y = -130.0f;
pos.z = -150.0f;
scale = 0.046f;
} else if (CUR_EQUIP_VALUE(EQUIP_SWORD) != 2) {
} else if (CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) != EQUIP_VALUE_SWORD_MASTER) {
pos.x = 25.0f;
pos.y = -228.0f;
pos.z = 60.0f;
@ -107,8 +107,10 @@ void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) {
rot.y = 32300;
rot.x = rot.z = 0;
Player_DrawPause(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &rot, scale,
CUR_EQUIP_VALUE(EQUIP_SWORD), CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1, CUR_EQUIP_VALUE(EQUIP_SHIELD),
CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1);
SWORD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD)),
TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)),
SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD)),
BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS)));
}
void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
@ -420,7 +422,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
if ((pauseCtx->cursorY[PAUSE_EQUIP] == 0) && (pauseCtx->cursorX[PAUSE_EQUIP] == 3)) {
if (gSaveContext.bgsFlag != 0) {
cursorItem = ITEM_HEART_PIECE_2;
} else if (gBitFlags[3] & gSaveContext.inventory.equipment) {
} else if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE)) {
cursorItem = ITEM_SWORD_KNIFE;
}
}
@ -481,7 +483,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
}
if ((gSaveContext.equips.buttonItems[0] == ITEM_SWORD_BGS) && (gSaveContext.bgsFlag == 0) &&
(gBitFlags[3] & gSaveContext.inventory.equipment)) {
CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE)) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE;
}
}

View file

@ -8,7 +8,7 @@ extern u8 gAmmoItems[];
extern s16 D_8082AAEC[];
extern s16 D_8082AB2C[];
extern u8 gSlotAgeReqs[];
extern u8 gEquipAgeReqs[][4];
extern u8 gEquipAgeReqs[EQUIP_TYPE_MAX][4];
extern u8 gAreaGsFlags[];
void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx);

View file

@ -171,7 +171,7 @@ u8 gSlotAgeReqs[] = {
1, 9, 9, 0, 0, 9, 1, 9, 9, 0, 0, 9, 1, 9, 1, 0, 0, 9, 9, 9, 9, 9, 0, 1,
};
u8 gEquipAgeReqs[][4] = {
u8 gEquipAgeReqs[EQUIP_TYPE_MAX][4] = {
{ 0, 1, 0, 0 },
{ 9, 1, 9, 0 },
{ 0, 9, 0, 0 },
@ -2680,7 +2680,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) {
pauseCtx->worldMapPoints[3] = 1;
}
if (CHECK_OWNED_EQUIP(EQUIP_BOOTS, 1)) {
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON)) {
pauseCtx->worldMapPoints[3] = 2;
}
@ -2834,7 +2834,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) {
pauseCtx->worldMapPoints[11] = 2;
}
if (CHECK_OWNED_EQUIP(EQUIP_BOOTS, 1)) {
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON)) {
pauseCtx->worldMapPoints[11] = 1;
}