MM Bunny Hood enhancements: no age restrictions & wear across entrances (#560)

* Remove age restriction on MM Bunny Hood

* Handle mask slot changing; init Link wearing mask

* Reset mask state after selling
This commit is contained in:
vaguerant 2022-07-06 09:29:43 +10:00 committed by GitHub
parent a5df9dddf0
commit f865db5444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -910,6 +910,8 @@ static s8 sItemActionParams[] = {
PLAYER_AP_BOOTS_HOVER, PLAYER_AP_BOOTS_HOVER,
}; };
static u8 sMaskMemory;
static s32(*D_80853EDC[])(Player* this, GlobalContext* globalCtx) = { 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_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, func_8083485C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C, func_8083501C,
@ -1909,7 +1911,7 @@ void func_80833DF8(Player* this, GlobalContext* globalCtx) {
if (gSaveContext.equips.buttonItems[0] != maskItem && gSaveContext.equips.buttonItems[1] != maskItem && if (gSaveContext.equips.buttonItems[0] != maskItem && gSaveContext.equips.buttonItems[1] != maskItem &&
gSaveContext.equips.buttonItems[2] != maskItem && gSaveContext.equips.buttonItems[3] != maskItem && gSaveContext.equips.buttonItems[2] != maskItem && gSaveContext.equips.buttonItems[3] != maskItem &&
!hasOnDpad) { !hasOnDpad) {
this->currentMask = PLAYER_MASK_NONE; this->currentMask = sMaskMemory = PLAYER_MASK_NONE;
func_808328EC(this, NA_SE_PL_CHANGE_ARMS); func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
} }
} else { } else {
@ -2886,6 +2888,7 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) {
else { else {
this->currentMask = actionParam - PLAYER_AP_MASK_KEATON + 1; this->currentMask = actionParam - PLAYER_AP_MASK_KEATON + 1;
} }
sMaskMemory = this->currentMask;
func_808328EC(this, NA_SE_PL_CHANGE_ARMS); func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
return; return;
} }
@ -4574,6 +4577,7 @@ void func_8083A0F4(GlobalContext* globalCtx, Player* this) {
this->interactRangeActor->parent = &this->actor; this->interactRangeActor->parent = &this->actor;
func_80835C58(globalCtx, this, func_8084F608, 0); func_80835C58(globalCtx, this, func_8084F608, 0);
this->stateFlags1 |= PLAYER_STATE1_29; this->stateFlags1 |= PLAYER_STATE1_29;
sMaskMemory = PLAYER_MASK_NONE;
} }
else { else {
LinkAnimationHeader* anim; LinkAnimationHeader* anim;
@ -8255,6 +8259,7 @@ void func_80843AE8(GlobalContext* globalCtx, Player* this) {
} }
else if (globalCtx->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { else if (globalCtx->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) {
globalCtx->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU; globalCtx->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU;
sMaskMemory = PLAYER_MASK_NONE;
} }
} }
@ -9523,6 +9528,18 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) {
func_80835F44(globalCtx, this, ITEM_NONE); func_80835F44(globalCtx, this, ITEM_NONE);
Player_SetEquipmentData(globalCtx, this); Player_SetEquipmentData(globalCtx, this);
this->prevBoots = this->currentBoots; 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)]); Player_InitCommon(this, globalCtx, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]);
this->giObjectSegment = (void*)(((uintptr_t)ZELDA_ARENA_MALLOC_DEBUG(0x3008) + 8) & ~0xF); this->giObjectSegment = (void*)(((uintptr_t)ZELDA_ARENA_MALLOC_DEBUG(0x3008) + 8) & ~0xF);

View File

@ -338,6 +338,9 @@ void KaleidoScope_DrawItemSelect(GlobalContext* globalCtx) {
pauseCtx->cursorItem[PAUSE_ITEM] = cursorItem; pauseCtx->cursorItem[PAUSE_ITEM] = cursorItem;
pauseCtx->cursorSlot[PAUSE_ITEM] = cursorSlot; 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)))) { if (!((gSlotAgeReqs[cursorSlot] == 9) || (gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.linkAge)))) {
pauseCtx->nameColorSet = 1; pauseCtx->nameColorSet = 1;
} }