1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-26 22:56:20 +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

@ -41,7 +41,15 @@
#define ALL_EQUIP_VALUE(equip) ((s32)(gSaveContext.inventory.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
#define CUR_EQUIP_VALUE(equip) ((s32)(gSaveContext.equips.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
#define CHECK_OWNED_EQUIP(equip, value) ((gBitFlags[value] << gEquipShifts[equip]) & gSaveContext.inventory.equipment)
#define OWNED_EQUIP_FLAG(equip, value) (gBitFlags[value] << gEquipShifts[equip])
#define OWNED_EQUIP_FLAG_ALT(equip, value) ((1 << (value)) << gEquipShifts[equip])
#define CHECK_OWNED_EQUIP(equip, value) (OWNED_EQUIP_FLAG(equip, value) & gSaveContext.inventory.equipment)
#define CHECK_OWNED_EQUIP_ALT(equip, value) (gBitFlags[(value) + (equip) * 4] & gSaveContext.inventory.equipment)
#define SWORD_EQUIP_TO_PLAYER(swordEquip) (swordEquip)
#define SHIELD_EQUIP_TO_PLAYER(shieldEquip) (shieldEquip)
#define TUNIC_EQUIP_TO_PLAYER(tunicEquip) ((tunicEquip) - 1)
#define BOOTS_EQUIP_TO_PLAYER(bootsEquip) ((bootsEquip) - 1)
#define CUR_UPG_VALUE(upg) ((s32)(gSaveContext.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg])
#define CAPACITY(upg, value) gUpgradeCapacities[upg][value]

View file

@ -2,12 +2,74 @@
#define Z64ITEM_H
typedef enum {
/* 0x00 */ EQUIP_SWORD,
/* 0x01 */ EQUIP_SHIELD,
/* 0x02 */ EQUIP_TUNIC,
/* 0x03 */ EQUIP_BOOTS
/* 0 */ EQUIP_TYPE_SWORD,
/* 1 */ EQUIP_TYPE_SHIELD,
/* 2 */ EQUIP_TYPE_TUNIC,
/* 3 */ EQUIP_TYPE_BOOTS,
/* 4 */ EQUIP_TYPE_MAX
} EquipmentType;
// `EquipInv*` enums are for Inventory.equipment (for example used in the `CHECK_OWNED_EQUIP` macro)
typedef enum {
/* 0 */ EQUIP_INV_SWORD_KOKIRI,
/* 1 */ EQUIP_INV_SWORD_MASTER,
/* 2 */ EQUIP_INV_SWORD_BGS,
/* 3 */ EQUIP_INV_SWORD_BROKENGIANTKNIFE
} EquipInvSword;
typedef enum {
/* 0 */ EQUIP_INV_SHIELD_DEKU,
/* 1 */ EQUIP_INV_SHIELD_HYLIAN,
/* 2 */ EQUIP_INV_SHIELD_MIRROR
} EquipInvShield;
typedef enum {
/* 0 */ EQUIP_INV_TUNIC_KOKIRI,
/* 1 */ EQUIP_INV_TUNIC_GORON,
/* 2 */ EQUIP_INV_TUNIC_ZORA
} EquipInvTunic;
typedef enum {
/* 0 */ EQUIP_INV_BOOTS_KOKIRI,
/* 1 */ EQUIP_INV_BOOTS_IRON,
/* 2 */ EQUIP_INV_BOOTS_HOVER
} EquipInvBoots;
// `EquipValue*` enums are for ItemEquips.equipment (for example used in the `CUR_EQUIP_VALUE` macro)
typedef enum {
/* 0 */ EQUIP_VALUE_SWORD_NONE,
/* 1 */ EQUIP_VALUE_SWORD_KOKIRI,
/* 2 */ EQUIP_VALUE_SWORD_MASTER,
/* 3 */ EQUIP_VALUE_SWORD_BGS,
/* 4 */ EQUIP_VALUE_SWORD_MAX
} EquipValueSword;
typedef enum {
/* 0 */ EQUIP_VALUE_SHIELD_NONE,
/* 1 */ EQUIP_VALUE_SHIELD_DEKU,
/* 2 */ EQUIP_VALUE_SHIELD_HYLIAN,
/* 3 */ EQUIP_VALUE_SHIELD_MIRROR,
/* 4 */ EQUIP_VALUE_SHIELD_MAX
} EquipValueShield;
typedef enum {
/* 0 */ EQUIP_VALUE_TUNIC_NONE,
/* 1 */ EQUIP_VALUE_TUNIC_KOKIRI,
/* 2 */ EQUIP_VALUE_TUNIC_GORON,
/* 3 */ EQUIP_VALUE_TUNIC_ZORA,
/* 4 */ EQUIP_VALUE_TUNIC_MAX
} EquipValueTunic;
typedef enum {
/* 0 */ EQUIP_VALUE_BOOTS_NONE,
/* 1 */ EQUIP_VALUE_BOOTS_KOKIRI,
/* 2 */ EQUIP_VALUE_BOOTS_IRON,
/* 3 */ EQUIP_VALUE_BOOTS_HOVER,
/* 4 */ EQUIP_VALUE_BOOTS_MAX
} EquipValueBoots;
typedef enum {
/* 0x00 */ UPG_QUIVER,
/* 0x01 */ UPG_BOMB_BAG,

View file

@ -6,6 +6,14 @@
struct Player;
typedef enum {
/* 0 */ PLAYER_SWORD_NONE,
/* 1 */ PLAYER_SWORD_KOKIRI,
/* 2 */ PLAYER_SWORD_MASTER,
/* 3 */ PLAYER_SWORD_BGS,
/* 4 */ PLAYER_SWORD_MAX
} PlayerSword;
typedef enum {
/* 0x00 */ PLAYER_SHIELD_NONE,
/* 0x01 */ PLAYER_SHIELD_DEKU,
@ -22,13 +30,13 @@ typedef enum {
} PlayerTunic;
typedef enum {
/* 0x00 */ PLAYER_BOOTS_NORMAL,
/* 0x00 */ PLAYER_BOOTS_KOKIRI,
/* 0x01 */ PLAYER_BOOTS_IRON,
/* 0x02 */ PLAYER_BOOTS_HOVER,
/* Values below are only relevant when setting regs in Player_SetBootData */
/* 0x03 */ PLAYER_BOOTS_INDOOR,
/* 0x04 */ PLAYER_BOOTS_IRON_UNDERWATER,
/* 0x05 */ PLAYER_BOOTS_NORMAL_CHILD,
/* 0x05 */ PLAYER_BOOTS_KOKIRI_CHILD,
/* 0x06 */ PLAYER_BOOTS_MAX
} PlayerBoots;
@ -457,7 +465,7 @@ typedef void (*PlayerFuncA74)(struct GlobalContext*, struct Player*);
typedef struct Player {
/* 0x0000 */ Actor actor;
/* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic`
/* 0x014D */ s8 currentSword; // current sword Item ID
/* 0x014D */ s8 currentSwordItemId;
/* 0x014E */ s8 currentShield; // current shield from `PlayerShield`
/* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots`
/* 0x0150 */ s8 heldItemButton; // Button index for the item currently used

View file

@ -7,13 +7,13 @@
typedef struct {
/* 0x00 */ u8 buttonItems[4];
/* 0x04 */ u8 cButtonSlots[3];
/* 0x08 */ u16 equipment;
/* 0x08 */ u16 equipment; // a mask where each nibble corresponds to a type of equipment `EquipmentType`, and each nibble is a piece `EquipValue*`
} ItemEquips; // size = 0x0A
typedef struct {
/* 0x00 */ u8 items[24];
/* 0x18 */ s8 ammo[16];
/* 0x28 */ u16 equipment;
/* 0x28 */ u16 equipment; // a mask where each nibble corresponds to a type of equipment `EquipmentType`, and each bit to an owned piece `EquipInv*`
/* 0x2C */ u32 upgrades;
/* 0x30 */ u32 questItems;
/* 0x34 */ u8 dungeonItems[20];

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

View file

@ -931,9 +931,9 @@ void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCt
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
break;
case 71:
gSaveContext.equips.equipment |= 0x0100;
gSaveContext.equips.equipment |= EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4);
Player_SetEquipmentData(globalCtx, player);
gSaveContext.equips.equipment |= 0x1000;
gSaveContext.equips.equipment |= EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4);
Player_SetEquipmentData(globalCtx, player);
globalCtx->linkAgeOnLoad = LINK_AGE_CHILD;
globalCtx->nextEntranceIndex = 0x0053;

View file

@ -45,8 +45,8 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) {
return ((msg->byte0 & 1) == 1) == ((msg->byte1 & 0x0F) == CUR_UPG_VALUE(UPG_STRENGTH));
case (ELF_MSG_CONDITION_BOOTS << 4):
return ((msg->byte0 & 1) == 1) ==
(((gBitFlags[msg->byte3 - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) &
gSaveContext.inventory.equipment) != 0);
(CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS,
msg->byte3 - ITEM_BOOTS_KOKIRI + EQUIP_INV_BOOTS_KOKIRI) != 0);
case (ELF_MSG_CONDITION_SONG << 4):
return ((msg->byte0 & 1) == 1) ==
(CHECK_QUEST_ITEM(msg->byte3 - ITEM_SONG_MINUET + QUEST_SONG_MINUET) != 0);

View file

@ -1611,7 +1611,7 @@ void Message_OpenText(GlobalContext* globalCtx, u16 textId) {
// Increments text id based on piece of heart count, assumes the piece of heart text is all
// in order and that you don't have more than the intended amount of heart pieces.
textId += (gSaveContext.inventory.questItems & 0xF0000000 & 0xF0000000) >> QUEST_HEART_PIECE_COUNT;
} else if (msgCtx->textId == 0xC && CHECK_OWNED_EQUIP(EQUIP_SWORD, 2)) {
} else if (msgCtx->textId == 0xC && CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BGS)) {
textId = 0xB; // Traded Giant's Knife for Biggoron Sword
} else if (msgCtx->textId == 0xB4 && GET_EVENTCHKINF(EVENTCHKINF_96)) {
textId = 0xB5; // Destroyed Gold Skulltula

View file

@ -1153,7 +1153,7 @@ Gfx* Gfx_TextureI8(Gfx* displayListHead, void* texture, s16 textureWidth, s16 te
void Inventory_SwapAgeEquipment(void) {
s16 i;
u16 temp;
u16 shieldEquipValue;
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
for (i = 0; i < 4; i++) {
@ -1184,7 +1184,10 @@ void Inventory_SwapAgeEquipment(void) {
gSaveContext.equips.buttonItems[3] = gSaveContext.inventory.items[SLOT_OCARINA];
gSaveContext.equips.cButtonSlots[1] = SLOT_BOMB;
gSaveContext.equips.cButtonSlots[2] = SLOT_OCARINA;
gSaveContext.equips.equipment = 0x1122;
gSaveContext.equips.equipment = (EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4)) |
(EQUIP_VALUE_SHIELD_HYLIAN << (EQUIP_TYPE_SHIELD * 4)) |
(EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4)) |
(EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4));
} else {
for (i = 0; i < 4; i++) {
gSaveContext.equips.buttonItems[i] = gSaveContext.adultEquips.buttonItems[i];
@ -1235,16 +1238,16 @@ void Inventory_SwapAgeEquipment(void) {
}
gSaveContext.equips.equipment = gSaveContext.childEquips.equipment;
gSaveContext.equips.equipment &= 0xFFF0;
gSaveContext.equips.equipment |= 0x0001;
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4);
}
}
temp = gEquipMasks[EQUIP_SHIELD] & gSaveContext.equips.equipment;
if (temp != 0) {
temp >>= gEquipShifts[EQUIP_SHIELD];
if (!(gBitFlags[temp + 3] & gSaveContext.inventory.equipment)) {
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_SHIELD];
shieldEquipValue = gEquipMasks[EQUIP_TYPE_SHIELD] & gSaveContext.equips.equipment;
if (shieldEquipValue != 0) {
shieldEquipValue >>= gEquipShifts[EQUIP_TYPE_SHIELD];
if (!CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, shieldEquipValue - 1)) {
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_TYPE_SHIELD];
}
}
}
@ -1259,10 +1262,10 @@ void Interface_InitHorsebackArchery(GlobalContext* globalCtx) {
}
void func_800849EC(GlobalContext* globalCtx) {
gSaveContext.inventory.equipment |= gBitFlags[2] << gEquipShifts[EQUIP_SWORD];
gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD];
gSaveContext.inventory.equipment |= OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BGS);
gSaveContext.inventory.equipment ^= OWNED_EQUIP_FLAG_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE);
if (gBitFlags[3] & gSaveContext.inventory.equipment) {
if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE)) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KNIFE;
} else {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
@ -1389,13 +1392,17 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
return ITEM_NONE;
} else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) {
gSaveContext.inventory.equipment |= gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD];
gSaveContext.inventory.equipment |=
OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, item - ITEM_SWORD_KOKIRI + EQUIP_INV_SWORD_KOKIRI);
if (item == ITEM_SWORD_BGS) {
gSaveContext.swordHealth = 8;
if (ALL_EQUIP_VALUE(EQUIP_SWORD) == 0xF) {
gSaveContext.inventory.equipment ^= 8 << gEquipShifts[EQUIP_SWORD];
if (ALL_EQUIP_VALUE(EQUIP_TYPE_SWORD) ==
((1 << EQUIP_INV_SWORD_KOKIRI) | (1 << EQUIP_INV_SWORD_MASTER) | (1 << EQUIP_INV_SWORD_BGS) |
(1 << EQUIP_INV_SWORD_BROKENGIANTKNIFE))) {
gSaveContext.inventory.equipment ^=
OWNED_EQUIP_FLAG_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE);
if (gSaveContext.equips.buttonItems[0] == ITEM_SWORD_KNIFE) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_BGS;
Interface_LoadItemIcon1(globalCtx, 0);
@ -1403,20 +1410,20 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
}
} else if (item == ITEM_SWORD_MASTER) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
gSaveContext.equips.equipment &= 0xFFF0;
gSaveContext.equips.equipment |= 0x0002;
gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4));
gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4);
Interface_LoadItemIcon1(globalCtx, 0);
}
return ITEM_NONE;
} else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) {
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]);
gSaveContext.inventory.equipment |= OWNED_EQUIP_FLAG(EQUIP_TYPE_SHIELD, item - ITEM_SHIELD_DEKU);
return ITEM_NONE;
} else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) {
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]);
gSaveContext.inventory.equipment |= OWNED_EQUIP_FLAG(EQUIP_TYPE_TUNIC, item - ITEM_TUNIC_KOKIRI);
return ITEM_NONE;
} else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) {
gSaveContext.inventory.equipment |= (gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]);
gSaveContext.inventory.equipment |= OWNED_EQUIP_FLAG(EQUIP_TYPE_BOOTS, item - ITEM_BOOTS_KOKIRI);
return ITEM_NONE;
} else if ((item == ITEM_KEY_BOSS) || (item == ITEM_COMPASS) || (item == ITEM_DUNGEON_MAP)) {
gSaveContext.inventory.dungeonItems[gSaveContext.mapIndex] |= gBitFlags[item - ITEM_KEY_BOSS];
@ -1822,26 +1829,25 @@ u8 Item_CheckObtainability(u8 item) {
} else if ((item >= ITEM_SWORD_KOKIRI) && (item <= ITEM_SWORD_BGS)) {
if (item == ITEM_SWORD_BGS) {
return ITEM_NONE;
} else if ((gBitFlags[item - ITEM_SWORD_KOKIRI] << gEquipShifts[EQUIP_SWORD]) &
gSaveContext.inventory.equipment) {
} else if (CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, item - ITEM_SWORD_KOKIRI + EQUIP_INV_SWORD_KOKIRI)) {
return item;
} else {
return ITEM_NONE;
}
} else if ((item >= ITEM_SHIELD_DEKU) && (item <= ITEM_SHIELD_MIRROR)) {
if ((gBitFlags[item - ITEM_SHIELD_DEKU] << gEquipShifts[EQUIP_SHIELD]) & gSaveContext.inventory.equipment) {
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_SHIELD, item - ITEM_SHIELD_DEKU + EQUIP_INV_SHIELD_DEKU)) {
return item;
} else {
return ITEM_NONE;
}
} else if ((item >= ITEM_TUNIC_KOKIRI) && (item <= ITEM_TUNIC_ZORA)) {
if ((gBitFlags[item - ITEM_TUNIC_KOKIRI] << gEquipShifts[EQUIP_TUNIC]) & gSaveContext.inventory.equipment) {
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, item - ITEM_TUNIC_KOKIRI + EQUIP_INV_TUNIC_KOKIRI)) {
return item;
} else {
return ITEM_NONE;
}
} else if ((item >= ITEM_BOOTS_KOKIRI) && (item <= ITEM_BOOTS_HOVER)) {
if ((gBitFlags[item - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) & gSaveContext.inventory.equipment) {
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, item - ITEM_BOOTS_KOKIRI + EQUIP_INV_BOOTS_KOKIRI)) {
return item;
} else {
return ITEM_NONE;
@ -3978,11 +3984,11 @@ void Interface_Update(GlobalContext* globalCtx) {
D_80125A58 = func_8008F2F8(globalCtx);
if (D_80125A58 == 1) {
if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 2) {
if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_GORON) {
D_80125A58 = 0;
}
} else if ((func_8008F2F8(globalCtx) >= 2) && (func_8008F2F8(globalCtx) < 5)) {
if (CUR_EQUIP_VALUE(EQUIP_TUNIC) == 3) {
if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_ZORA) {
D_80125A58 = 0;
}
}

View file

@ -443,9 +443,9 @@ void Player_SetBootData(GlobalContext* globalCtx, Player* this) {
REG(48) = 370;
currentBoots = this->currentBoots;
if (currentBoots == PLAYER_BOOTS_NORMAL) {
if (currentBoots == PLAYER_BOOTS_KOKIRI) {
if (!LINK_IS_ADULT) {
currentBoots = PLAYER_BOOTS_NORMAL_CHILD;
currentBoots = PLAYER_BOOTS_KOKIRI_CHILD;
}
} else if (currentBoots == PLAYER_BOOTS_IRON) {
if (this->stateFlags1 & PLAYER_STATE1_27) {
@ -570,10 +570,10 @@ void func_8008EC70(Player* this) {
void Player_SetEquipmentData(GlobalContext* globalCtx, Player* this) {
if (this->csMode != 0x56) {
this->currentShield = CUR_EQUIP_VALUE(EQUIP_SHIELD);
this->currentTunic = CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1;
this->currentBoots = CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1;
this->currentSword = B_BTN_ITEM;
this->currentShield = SHIELD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD));
this->currentTunic = TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC));
this->currentBoots = BOOTS_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_BOOTS));
this->currentSwordItemId = B_BTN_ITEM;
Player_SetModelGroup(this, Player_ActionToModelGroup(this, this->heldItemActionParam));
Player_SetBootData(globalCtx, this);
}
@ -854,8 +854,8 @@ Color_RGB8 sGauntletColors[] = {
};
Gfx* sBootDListGroups[][2] = {
/* PLAYER_BOOTS_IRON */ { gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL },
/* PLAYER_BOOTS_HOVER */ { gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL },
{ gLinkAdultLeftIronBootDL, gLinkAdultRightIronBootDL }, // PLAYER_BOOTS_IRON
{ gLinkAdultLeftHoverBootDL, gLinkAdultRightHoverBootDL }, // PLAYER_BOOTS_HOVER
};
void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, s32 lod, s32 tunic,
@ -915,8 +915,8 @@ void Player_DrawImpl(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTabl
: gLinkAdultRightGauntletPlate3DL);
}
if (boots != 0) {
Gfx** bootDLists = sBootDListGroups[boots - 1];
if (boots != PLAYER_BOOTS_KOKIRI) {
Gfx** bootDLists = sBootDListGroups[boots - PLAYER_BOOTS_IRON];
gSPDisplayList(POLY_OPA_DISP++, bootDLists[0]);
gSPDisplayList(POLY_OPA_DISP++, bootDLists[1]);
@ -1637,14 +1637,18 @@ u32 func_80091738(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime) {
sizeof(Vec3s[PLAYER_LIMB_BUF_COUNT]);
}
u8 D_801261F8[] = { PLAYER_MODELGROUP_SWORD, PLAYER_MODELGROUP_SWORD, PLAYER_MODELGROUP_BGS };
u8 D_801261F8[] = {
PLAYER_MODELGROUP_SWORD, // PLAYER_SWORD_KOKIRI
PLAYER_MODELGROUP_SWORD, // PLAYER_SWORD_MASTER
PLAYER_MODELGROUP_BGS, // PLAYER_SWORD_BGS
};
s32 Player_OverrideLimbDrawPause(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* arg) {
u8* playerSwordAndShield = arg;
//! @bug `playerSwordAndShield[0]` can be 0 (no sword), which indexes `D_801261F8[-1]`. The result
//! @bug `playerSwordAndShield[0]` can be 0 (`PLAYER_SWORD_NONE`), which indexes `D_801261F8[-1]`. The result
//! happens to be 0 (`PLAYER_MODELGROUP_0`) in vanilla, but weird values are likely to cause a crash
u8 modelGroup = D_801261F8[playerSwordAndShield[0] - 1];
u8 modelGroup = D_801261F8[playerSwordAndShield[0] - PLAYER_SWORD_KOKIRI];
s32 type;
s32 dListOffset = 0;
Gfx** dLists;
@ -1807,7 +1811,7 @@ void Player_DrawPause(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnim
srcTable = gLinkPauseChildJointTable;
}
} else {
if (sword == 3) {
if (sword == PLAYER_SWORD_BGS) {
srcTable = gLinkPauseAdultBgsJointTable;
} else if (shield != PLAYER_SHIELD_NONE) {
srcTable = gLinkPauseAdultShieldJointTable;

View file

@ -139,10 +139,12 @@ static Inventory sNewSaveInventory = {
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, // items
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // ammo
0x1100, // equipment
0, // upgrades
0, // questItems
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonItems
// equipment
(((1 << EQUIP_INV_TUNIC_KOKIRI) << (EQUIP_TYPE_TUNIC * 4)) |
((1 << EQUIP_INV_BOOTS_KOKIRI) << (EQUIP_TYPE_BOOTS * 4))),
0, // upgrades
0, // questItems
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonItems
{
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@ -215,7 +217,9 @@ static SavePlayerData sDebugSavePlayerData = {
static ItemEquips sDebugSaveEquips = {
{ ITEM_SWORD_MASTER, ITEM_BOW, ITEM_BOMB, ITEM_OCARINA_FAIRY }, // buttonItems
{ SLOT_BOW, SLOT_BOMB, SLOT_OCARINA }, // cButtonSlots
0x1122, // equipment
// equipment
(EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4)) | (EQUIP_VALUE_SHIELD_HYLIAN << (EQUIP_TYPE_SHIELD * 4)) |
(EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4)) | (EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4)),
};
static Inventory sDebugSaveInventory = {
@ -224,9 +228,21 @@ static Inventory sDebugSaveInventory = {
ITEM_SLINGSHOT, ITEM_OCARINA_FAIRY, ITEM_BOMBCHU, ITEM_HOOKSHOT, ITEM_ARROW_ICE, ITEM_FARORES_WIND,
ITEM_BOOMERANG, ITEM_LENS, ITEM_BEAN, ITEM_HAMMER, ITEM_ARROW_LIGHT, ITEM_NAYRUS_LOVE,
ITEM_BOTTLE, ITEM_POTION_RED, ITEM_POTION_GREEN, ITEM_POTION_BLUE, ITEM_POCKET_EGG, ITEM_WEIRD_EGG,
}, // items
{ 50, 50, 10, 30, 1, 1, 30, 1, 50, 1, 1, 1, 1, 1, 1, 1 }, // ammo
0x7777, // equipment
}, // items
{ 50, 50, 10, 30, 1, 1, 30, 1, 50, 1, 1, 1, 1, 1, 1, 1 }, // ammo
// equipment
((((1 << EQUIP_INV_SWORD_KOKIRI) << (EQUIP_TYPE_SWORD * 4)) |
((1 << EQUIP_INV_SWORD_MASTER) << (EQUIP_TYPE_SWORD * 4)) |
((1 << EQUIP_INV_SWORD_BGS) << (EQUIP_TYPE_SWORD * 4))) |
(((1 << EQUIP_INV_SHIELD_DEKU) << (EQUIP_TYPE_SHIELD * 4)) |
((1 << EQUIP_INV_SHIELD_HYLIAN) << (EQUIP_TYPE_SHIELD * 4)) |
((1 << EQUIP_INV_SHIELD_MIRROR) << (EQUIP_TYPE_SHIELD * 4))) |
(((1 << EQUIP_INV_TUNIC_KOKIRI) << (EQUIP_TYPE_TUNIC * 4)) |
((1 << EQUIP_INV_TUNIC_GORON) << (EQUIP_TYPE_TUNIC * 4)) |
((1 << EQUIP_INV_TUNIC_ZORA) << (EQUIP_TYPE_TUNIC * 4))) |
(((1 << EQUIP_INV_BOOTS_KOKIRI) << (EQUIP_TYPE_BOOTS * 4)) |
((1 << EQUIP_INV_BOOTS_IRON) << (EQUIP_TYPE_BOOTS * 4)) |
((1 << EQUIP_INV_BOOTS_HOVER) << (EQUIP_TYPE_BOOTS * 4)))),
0x125249, // upgrades
0x1E3FFFF, // questItems
{ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // dungeonItems
@ -270,11 +286,11 @@ void Sram_InitDebugSave(void) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
Inventory_ChangeEquipment(EQUIP_SWORD, 1);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_KOKIRI);
if (gSaveContext.fileNum == 0xFF) {
gSaveContext.equips.buttonItems[1] = ITEM_SLINGSHOT;
gSaveContext.equips.cButtonSlots[0] = SLOT_SLINGSHOT;
Inventory_ChangeEquipment(EQUIP_SHIELD, 1);
Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_DEKU);
}
}
@ -421,12 +437,12 @@ void Sram_OpenSave(SramContext* sramCtx) {
}
}
// check for owning kokiri sword.. to restore master sword? bug or debug feature?
if (LINK_AGE_IN_YEARS == YEARS_ADULT && !CHECK_OWNED_EQUIP(EQUIP_SWORD, 1)) {
gSaveContext.inventory.equipment |= gBitFlags[1] << gEquipShifts[EQUIP_SWORD];
// check for owning master sword.. to restore master sword? bug or debug feature?
if (LINK_AGE_IN_YEARS == YEARS_ADULT && !CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER)) {
gSaveContext.inventory.equipment |= OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER);
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
gSaveContext.equips.equipment &= ~0xF;
gSaveContext.equips.equipment |= 2;
gSaveContext.equips.equipment &= ~(0xF << (EQUIP_TYPE_SWORD * 4));
gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4);
}
for (i = 0; i < ARRAY_COUNT(gSpoilingItems); i++) {

View file

@ -234,7 +234,7 @@ u32 func_809EF73C(EnDns* this) {
}
u32 func_809EF800(EnDns* this) {
if (gBitFlags[4] & gSaveContext.inventory.equipment) {
if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, EQUIP_INV_SHIELD_DEKU)) {
return 1;
}
if (gSaveContext.rupees < this->dnsItemEntry->itemPrice) {

View file

@ -523,7 +523,8 @@ s32 EnGirlA_CanBuy_BluePotion(GlobalContext* globalCtx, EnGirlA* this) {
}
s32 EnGirlA_CanBuy_Longsword(GlobalContext* globalCtx, EnGirlA* this) {
if ((gBitFlags[2] & gSaveContext.inventory.equipment) && !(gBitFlags[3] & gSaveContext.inventory.equipment)) {
if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BGS) &&
!CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE)) {
return CANBUY_RESULT_CANT_GET_NOW;
}
if (gSaveContext.rupees < this->basePrice) {
@ -536,7 +537,7 @@ s32 EnGirlA_CanBuy_Longsword(GlobalContext* globalCtx, EnGirlA* this) {
}
s32 EnGirlA_CanBuy_HylianShield(GlobalContext* globalCtx, EnGirlA* this) {
if (gBitFlags[5] & gSaveContext.inventory.equipment) {
if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, EQUIP_INV_SHIELD_HYLIAN)) {
return CANBUY_RESULT_CANT_GET_NOW;
}
if (gSaveContext.rupees < this->basePrice) {
@ -549,7 +550,7 @@ s32 EnGirlA_CanBuy_HylianShield(GlobalContext* globalCtx, EnGirlA* this) {
}
s32 EnGirlA_CanBuy_DekuShield(GlobalContext* globalCtx, EnGirlA* this) {
if (gBitFlags[4] & gSaveContext.inventory.equipment) {
if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, EQUIP_INV_SHIELD_DEKU)) {
return CANBUY_RESULT_CANT_GET_NOW;
}
if (gSaveContext.rupees < this->basePrice) {
@ -565,7 +566,7 @@ s32 EnGirlA_CanBuy_GoronTunic(GlobalContext* globalCtx, EnGirlA* this) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
return CANBUY_RESULT_CANT_GET_NOW;
}
if (gBitFlags[9] & gSaveContext.inventory.equipment) {
if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) {
return CANBUY_RESULT_CANT_GET_NOW;
}
if (gSaveContext.rupees < this->basePrice) {
@ -581,7 +582,7 @@ s32 EnGirlA_CanBuy_ZoraTunic(GlobalContext* globalCtx, EnGirlA* this) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
return CANBUY_RESULT_CANT_GET_NOW;
}
if (gBitFlags[10] & gSaveContext.inventory.equipment) {
if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_ZORA)) {
return CANBUY_RESULT_CANT_GET_NOW;
}
if (gSaveContext.rupees < this->basePrice) {

View file

@ -92,9 +92,9 @@ void EnGm_Destroy(Actor* thisx, GlobalContext* globalCtx) {
s32 func_80A3D7C8(void) {
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
return 0;
} else if (!(gBitFlags[2] & gSaveContext.inventory.equipment)) {
} else if (!CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BGS)) {
return 1;
} else if (gBitFlags[3] & gSaveContext.inventory.equipment) {
} else if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_BROKENGIANTKNIFE)) {
return 2;
} else {
return 3;

View file

@ -117,7 +117,7 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) {
} else {
return 0x3041;
}
} else if (CHECK_OWNED_EQUIP(EQUIP_TUNIC, 1) || GET_INFTABLE(INFTABLE_10D)) {
} else if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON) || GET_INFTABLE(INFTABLE_10D)) {
if (GET_INFTABLE(INFTABLE_10E)) {
return 0x3038;
} else {
@ -648,7 +648,7 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) {
switch (this->actor.params & 0xF0) {
case 0x00:
Actor_SetScale(&this->actor, 0.008f);
if (CHECK_OWNED_EQUIP(EQUIP_TUNIC, 1)) {
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) {
EnGo_SetMovedPos(this, globalCtx);
EnGo_SetupAction(this, EnGo_CurledUp);
} else {

View file

@ -494,7 +494,7 @@ s16 EnGo2_GetStateGoronCityLowestFloor(GlobalContext* globalCtx, EnGo2* this) {
u16 EnGo2_GetTextIdGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE)) {
return GET_INFTABLE(INFTABLE_10F) ? 0x3042 : 0x3041;
} else if (CHECK_OWNED_EQUIP(EQUIP_TUNIC, 1)) {
} else if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) {
return GET_INFTABLE(INFTABLE_10E) ? 0x3038 : 0x3037;
} else if (GET_INFTABLE(INFTABLE_10C)) {
this->unk_20C = 0;
@ -1158,7 +1158,7 @@ s32 EnGo2_IsCameraModified(EnGo2* this, GlobalContext* globalCtx) {
(this->actor.params & 0x1F) == GORON_CITY_STAIRWELL || (this->actor.params & 0x1F) == GORON_DMT_BIGGORON ||
(this->actor.params & 0x1F) == GORON_MARKET_BAZAAR) {
return true;
} else if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TUNIC, 1)) {
} else if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) {
return true;
} else {
return false;
@ -1215,7 +1215,7 @@ void EnGo2_SelectGoronWakingUp(EnGo2* this) {
EnGo2_BiggoronWakingUp(this);
break;
case GORON_CITY_LINK:
if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TUNIC, 1)) {
if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) {
EnGo2_WakingUp(this);
break;
}
@ -1552,7 +1552,8 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) {
if (GET_INFTABLE(INFTABLE_109)) {
Path_CopyLastPoint(this->path, &this->actor.world.pos);
this->actor.home.pos = this->actor.world.pos;
if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) && CHECK_OWNED_EQUIP(EQUIP_TUNIC, 1)) {
if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FIRE) &&
CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) {
EnGo2_GetItemAnimation(this, globalCtx);
} else {
this->actionFunc = EnGo2_CurledUp;

View file

@ -207,9 +207,9 @@ static AnimationInfo sAnimationInfo[] = {
typedef struct {
/* 0x00 */ u8 headInfoIndex; // EnHyHeadIndex
/* 0x01 */ u8 skelInfoIndex2; // EnHySkeletonIndex, see EnHy#objBankIndexSkel2
/* 0x01 */ u8 skelInfoIndex2; // EnHySkeletonIndex, see EnHy.objBankIndexSkel2
/* 0x02 */ Color_RGBA8 envColorSeg8;
/* 0x06 */ u8 skelInfoIndex1; // EnHySkeletonIndex, see EnHy#objBankIndexSkel1
/* 0x06 */ u8 skelInfoIndex1; // EnHySkeletonIndex, see EnHy.objBankIndexSkel1
/* 0x07 */ Color_RGBA8 envColorSeg9;
/* 0x0B */ u8 animInfoIndex; // EnHyAnimationIndex
} EnHyModelInfo; // size = 0xC

View file

@ -86,7 +86,7 @@ u16 EnKz_GetTextNoMaskAdult(GlobalContext* globalCtx, EnKz* this) {
if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_FROG) {
if (!GET_INFTABLE(INFTABLE_139)) {
if (CHECK_OWNED_EQUIP(EQUIP_TUNIC, 2)) {
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_ZORA)) {
return 0x401F;
} else {
return 0x4012;
@ -262,7 +262,7 @@ void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) {
this->actor.textId = CHECK_QUEST_ITEM(QUEST_SONG_SERENADE) ? 0x4045 : 0x401A;
player->actor.textId = this->actor.textId;
} else {
this->actor.textId = CHECK_OWNED_EQUIP(EQUIP_TUNIC, 2) ? 0x401F : 0x4012;
this->actor.textId = CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_ZORA) ? 0x401F : 0x4012;
player->actor.textId = this->actor.textId;
}
}

View file

@ -379,7 +379,8 @@ u16 EnMd_GetTextKokiriForest(GlobalContext* globalCtx, EnMd* this) {
return 0x1034;
}
if ((CUR_EQUIP_VALUE(EQUIP_SHIELD) == 1) && (CUR_EQUIP_VALUE(EQUIP_SWORD) == 1)) {
if ((CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) == EQUIP_VALUE_SHIELD_DEKU) &&
(CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_KOKIRI)) {
return 0x1033;
}

View file

@ -295,15 +295,15 @@ void EnRr_SetupReleasePlayer(EnRr* this, GlobalContext* globalCtx) {
this->wobbleSizeTarget = 2048.0f;
tunic = 0;
shield = 0;
if (CUR_EQUIP_VALUE(EQUIP_SHIELD) != 3 /* Mirror shield */) {
shield = Inventory_DeleteEquipment(globalCtx, EQUIP_SHIELD);
if (CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) != EQUIP_VALUE_SHIELD_MIRROR) {
shield = Inventory_DeleteEquipment(globalCtx, EQUIP_TYPE_SHIELD);
if (shield != 0) {
this->eatenShield = shield;
this->retreat = true;
}
}
if (CUR_EQUIP_VALUE(EQUIP_TUNIC) != 1 /* Kokiri tunic */) {
tunic = Inventory_DeleteEquipment(globalCtx, EQUIP_TUNIC);
if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) != EQUIP_VALUE_TUNIC_KOKIRI) {
tunic = Inventory_DeleteEquipment(globalCtx, EQUIP_TYPE_TUNIC);
if (tunic != 0) {
this->eatenTunic = tunic;
this->retreat = true;

View file

@ -333,7 +333,8 @@ s32 EnXc_BoleroCS(EnXc* this, GlobalContext* globalCtx) {
void EnXc_SetupSerenadeAction(EnXc* this, GlobalContext* globalCtx) {
// Player is adult and does not have iron boots and has not learned Serenade
if (!CHECK_OWNED_EQUIP(EQUIP_BOOTS, 1) && !GET_EVENTCHKINF(EVENTCHKINF_52) && LINK_IS_ADULT) {
if (!CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) &&
LINK_IS_ADULT) {
this->action = SHEIK_ACTION_SERENADE;
osSyncPrintf("水のセレナーデ シーク誕生!!!!!!!!!!!!!!!!!!\n");
} else {
@ -347,8 +348,8 @@ s32 EnXc_SerenadeCS(EnXc* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
s32 stateFlags = player->stateFlags1;
if (CHECK_OWNED_EQUIP(EQUIP_BOOTS, 1) && !GET_EVENTCHKINF(EVENTCHKINF_52) && !(stateFlags & PLAYER_STATE1_29) &&
!Gameplay_InCsMode(globalCtx)) {
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) &&
!(stateFlags & PLAYER_STATE1_29) && !Gameplay_InCsMode(globalCtx)) {
Cutscene_SetSegment(globalCtx, &gIceCavernSerenadeCs);
gSaveContext.cutsceneTrigger = 1;
SET_EVENTCHKINF(EVENTCHKINF_52); // Learned Serenade of Water Flag

View file

@ -3755,7 +3755,7 @@ void func_8083819C(Player* this, GlobalContext* globalCtx) {
if (this->currentShield == PLAYER_SHIELD_DEKU) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_SHIELD, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1);
Inventory_DeleteEquipment(globalCtx, EQUIP_SHIELD);
Inventory_DeleteEquipment(globalCtx, EQUIP_TYPE_SHIELD);
Message_StartTextbox(globalCtx, 0x305F, NULL);
}
}
@ -14110,9 +14110,9 @@ void func_80852648(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg
this->heldItemId = ITEM_NONE;
this->modelGroup = this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_AP_NONE);
this->leftHandDLists = D_80125E08;
Inventory_ChangeEquipment(EQUIP_SWORD, 2);
Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER);
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER;
Inventory_DeleteEquipment(globalCtx, 0);
Inventory_DeleteEquipment(globalCtx, EQUIP_TYPE_SWORD);
}
}

View file

@ -1437,7 +1437,7 @@ void FileChoose_FadeOut(GameState* thisx) {
*/
void FileChoose_LoadGame(GameState* thisx) {
FileChooseContext* this = (FileChooseContext*)thisx;
u16 swordEquipMask;
u16 swordEquipValue;
s32 pad;
if (this->buttonIndex == FS_BTN_SELECT_FILE_1) {
@ -1508,9 +1508,9 @@ void FileChoose_LoadGame(GameState* thisx) {
(gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KNIFE)) {
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
swordEquipMask = gEquipMasks[EQUIP_SWORD] & gSaveContext.equips.equipment;
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_SWORD];
gSaveContext.inventory.equipment ^= (gBitFlags[swordEquipMask - 1] << gEquipShifts[EQUIP_SWORD]);
swordEquipValue = (gEquipMasks[EQUIP_TYPE_SWORD] & gSaveContext.equips.equipment) >> (EQUIP_TYPE_SWORD * 4);
gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_TYPE_SWORD];
gSaveContext.inventory.equipment ^= OWNED_EQUIP_FLAG(EQUIP_TYPE_SWORD, swordEquipValue - 1);
}
}

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;
}