Initialize gSlotAgeReqs[SLOT_TRADE_CHILD] and gItemAgeReqs[ITEM_MASK_BUNNY] on load initialization according to gMMBunnyHood and gTimelessEquipment to prevent bunny hood from being unequipped from adult equips on first load. (#2904)

Move the code to change those values based on the child trade slot item to the selecting mask loop to not be setting them every frame just because you're in the inventory.
This commit is contained in:
Malkierian 2023-05-21 09:13:38 -07:00 committed by GitHub
parent cf42057842
commit cf711d9164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 7 deletions

View File

@ -103,6 +103,7 @@ extern "C"
extern u32 gGsFlagsShifts[4];
extern void* gItemIcons[0x82];
extern u8 gItemAgeReqs[];
extern u8 gSlotAgeReqs[];
extern u8 gItemSlots[56];
extern void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*);
extern s16 gLinkObjectIds[2];

View File

@ -604,6 +604,15 @@ void Play_Init(GameState* thisx) {
(s32)(zAllocAligned + zAllocSize) - (s32)(zAllocAligned - zAlloc));
Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL);
// In order to keep bunny hood equipped on first load, we need to pre-set the age reqs for the item and slot
if (CVarGetInteger("gMMBunnyHood", 0) || CVarGetInteger("gTimelessEquipment", 0)) {
gItemAgeReqs[ITEM_MASK_BUNNY] = 9;
if(INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY)
gSlotAgeReqs[SLOT_TRADE_CHILD] = 9;
}
else {
gItemAgeReqs[ITEM_MASK_BUNNY] = gSlotAgeReqs[SLOT_TRADE_CHILD] = 1;
}
func_800304DC(play, &play->actorCtx, play->linkActorEntry);
while (!func_800973FC(play, &play->roomCtx)) {

View File

@ -344,12 +344,6 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->cursorItem[PAUSE_ITEM] = cursorItem;
pauseCtx->cursorSlot[PAUSE_ITEM] = cursorSlot;
gSlotAgeReqs[SLOT_TRADE_CHILD] = gItemAgeReqs[ITEM_MASK_BUNNY] =
((CVarGetInteger("gMMBunnyHood", 0) || CVarGetInteger("gTimelessEquipment", 0)) &&
INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY)
? 9
: 1;
if (!CHECK_SLOT_AGE(cursorSlot)) {
pauseCtx->nameColorSet = 1;
}
@ -405,6 +399,12 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
}
}
gSelectingMask = cursorSlot == SLOT_TRADE_CHILD;
gSlotAgeReqs[SLOT_TRADE_CHILD] = gItemAgeReqs[ITEM_MASK_BUNNY] =
((CVarGetInteger("gMMBunnyHood", 0) || CVarGetInteger("gTimelessEquipment", 0)) &&
INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY)
? 9
: 1;
}
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE) &&
cursorSlot == SLOT_TRADE_ADULT && CHECK_BTN_ALL(input->press.button, BTN_A)) {

View File

@ -7,7 +7,6 @@
extern u8 gAmmoItems[];
extern s16 D_8082AAEC[];
extern s16 D_8082AB2C[];
extern u8 gSlotAgeReqs[];
extern u8 gEquipAgeReqs[][4];
extern u8 gAreaGsFlags[];
extern bool gSelectingMask;