Skip to content

Commit

Permalink
MM Bunny Hood enhancements: no age restrictions & wear across entranc…
Browse files Browse the repository at this point in the history
…es (#560)

* Remove age restriction on MM Bunny Hood

* Handle mask slot changing; init Link wearing mask

* Reset mask state after selling
  • Loading branch information
vaguerant authored Jul 5, 2022
1 parent a5df9dd commit f865db5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 18 additions & 1 deletion soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,8 @@ static s8 sItemActionParams[] = {
PLAYER_AP_BOOTS_HOVER,
};

static u8 sMaskMemory;

static s32(*D_80853EDC[])(Player* this, GlobalContext* globalCtx) = {
func_8083485C, func_8083485C, func_8083485C, func_808349DC, func_808349DC, func_808349DC, func_8083485C,
func_8083485C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C,
Expand Down Expand Up @@ -1909,7 +1911,7 @@ void func_80833DF8(Player* this, GlobalContext* globalCtx) {
if (gSaveContext.equips.buttonItems[0] != maskItem && gSaveContext.equips.buttonItems[1] != maskItem &&
gSaveContext.equips.buttonItems[2] != maskItem && gSaveContext.equips.buttonItems[3] != maskItem &&
!hasOnDpad) {
this->currentMask = PLAYER_MASK_NONE;
this->currentMask = sMaskMemory = PLAYER_MASK_NONE;
func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
}
} else {
Expand Down Expand Up @@ -2886,6 +2888,7 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) {
else {
this->currentMask = actionParam - PLAYER_AP_MASK_KEATON + 1;
}
sMaskMemory = this->currentMask;
func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
return;
}
Expand Down Expand Up @@ -4574,6 +4577,7 @@ void func_8083A0F4(GlobalContext* globalCtx, Player* this) {
this->interactRangeActor->parent = &this->actor;
func_80835C58(globalCtx, this, func_8084F608, 0);
this->stateFlags1 |= PLAYER_STATE1_29;
sMaskMemory = PLAYER_MASK_NONE;
}
else {
LinkAnimationHeader* anim;
Expand Down Expand Up @@ -8255,6 +8259,7 @@ void func_80843AE8(GlobalContext* globalCtx, Player* this) {
}
else if (globalCtx->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) {
globalCtx->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU;
sMaskMemory = PLAYER_MASK_NONE;
}
}

Expand Down Expand Up @@ -9523,6 +9528,18 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) {
func_80835F44(globalCtx, this, ITEM_NONE);
Player_SetEquipmentData(globalCtx, this);
this->prevBoots = this->currentBoots;
if (CVar_GetS32("gMMBunnyHood", 0)) {
if (INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_SOLD_OUT) { sMaskMemory = PLAYER_MASK_NONE; }
this->currentMask = sMaskMemory;
for (uint16_t cSlotIndex = 0; cSlotIndex < ARRAY_COUNT(gSaveContext.equips.cButtonSlots); cSlotIndex++) {
if (gSaveContext.equips.cButtonSlots[cSlotIndex] == SLOT_TRADE_CHILD &&
(gItemAgeReqs[gSaveContext.equips.buttonItems[cSlotIndex+1]] != 9 &&
LINK_IS_ADULT && !CVar_GetS32("gNoRestrictAge", 0))) {
gSaveContext.equips.cButtonSlots[cSlotIndex] = SLOT_NONE;
gSaveContext.equips.buttonItems[cSlotIndex+1] = ITEM_NONE;
}
}
}
Player_InitCommon(this, globalCtx, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]);
this->giObjectSegment = (void*)(((uintptr_t)ZELDA_ARENA_MALLOC_DEBUG(0x3008) + 8) & ~0xF);

Expand Down
3 changes: 3 additions & 0 deletions soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
pauseCtx->cursorItem[PAUSE_ITEM] = cursorItem;
pauseCtx->cursorSlot[PAUSE_ITEM] = cursorSlot;

gSlotAgeReqs[SLOT_TRADE_CHILD] = gItemAgeReqs[ITEM_MASK_BUNNY] =
(CVar_GetS32("gMMBunnyHood", 0) && INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY) ? 9 : 1;

if (!((gSlotAgeReqs[cursorSlot] == 9) || (gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.linkAge)))) {
pauseCtx->nameColorSet = 1;
}
Expand Down

0 comments on commit f865db5

Please sign in to comment.