Hookify masks / timeless equipment (#7088)

This commit is contained in:
Philip Dubé
2026-08-17 17:24:03 +00:00
committed by GitHub
parent 172b373fb5
commit bd8a5825f9
23 changed files with 366 additions and 158 deletions
+4 -5
View File
@@ -1,5 +1,5 @@
#include "global.h"
#include "soh/Enhancements/enhancementTypes.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
u16 sReactionTextIds[][PLAYER_MASK_MAX] = {
{ 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 },
@@ -67,10 +67,9 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = {
u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) {
u8 currentMask = Player_GetMask(play);
if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA &&
currentMask == PLAYER_MASK_BUNNY) {
if (!GameInteractor_Should(VB_NPC_REACT_TO_MASK, true, currentMask)) {
return 0;
} else {
return sReactionTextIds[reactionSet][currentMask];
}
return sReactionTextIds[reactionSet][currentMask];
}
+2 -2
View File
@@ -2782,10 +2782,10 @@ void Message_OpenText(PlayState* play, u16 textId) {
// font->msgOffset), font->msgLength, __FILE__, __LINE__);
} else if (CVarGetInteger(CVAR_ENHANCEMENT("AskToEquip"), 0) &&
(((LINK_IS_ADULT || CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0)) &&
((GameInteractor_Should(VB_PLAYER_MEETS_AGE_REQ, LINK_IS_ADULT, LINK_AGE_ADULT) &&
// 0C = Biggoron, 4B = Giant's, 4E = Mirror Shield, 50-51 = Tunics
(textId == 0x0C || textId == 0x4B || textId == 0x4E || textId == 0x50 || textId == 0x51)) ||
((!LINK_IS_ADULT || CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0)) &&
(GameInteractor_Should(VB_PLAYER_MEETS_AGE_REQ, !LINK_IS_ADULT, LINK_AGE_CHILD) &&
// 4C = Deku Shield, A4 = Kokiri Sword
(textId == 0x4C || textId == 0xA4)) ||
// 4D == Hylian Shield
+8 -7
View File
@@ -1143,13 +1143,14 @@ void func_80083108(PlayState* play) {
if (interfaceCtx->restrictions.tradeItems != 0) {
for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if ((CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) !=
BUNNY_HOOD_VANILLA) &&
(gSaveContext.equips.buttonItems[i] >= ITEM_MASK_KEATON) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_MASK_TRUTH)) {
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
} else if ((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK)) {
if ((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) &&
(gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK)) {
if (!GameInteractor_Should(VB_DISABLE_TRADE_ITEM_BUTTON, true,
gSaveContext.equips.buttonItems[i])) {
gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED;
continue;
}
if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) {
sp28 = 1;
}
-20
View File
@@ -559,21 +559,6 @@ void Play_Init(GameState* thisx) {
Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL);
// In order to keep masks equipped on first load, we need to pre-set the age reqs for the item and slot
if (CVarGetInteger(CVAR_ENHANCEMENT("AdultMasks"), 0) || CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0)) {
for (int i = ITEM_MASK_KEATON; i <= ITEM_MASK_TRUTH; i += 1) {
gItemAgeReqs[i] = AGE_REQ_NONE;
}
if (INV_CONTENT(ITEM_TRADE_CHILD) >= ITEM_MASK_KEATON && INV_CONTENT(ITEM_TRADE_CHILD) <= ITEM_MASK_TRUTH) {
gSlotAgeReqs[SLOT_TRADE_CHILD] = AGE_REQ_NONE;
}
} else {
for (int i = ITEM_MASK_KEATON; i <= ITEM_MASK_TRUTH; i += 1) {
gItemAgeReqs[i] = AGE_REQ_CHILD;
}
gSlotAgeReqs[SLOT_TRADE_CHILD] = AGE_REQ_CHILD;
}
// Handle Rocs Feather requirement
gItemAgeReqs[ITEM_ROCS_FEATHER] = AGE_REQ_NONE;
gSlotAgeReqs[SLOT_NAYRUS_LOVE] = AGE_REQ_NONE;
@@ -1150,11 +1135,6 @@ void Play_Update(PlayState* play) {
gSaveContext.ship.stats.playTimer++;
gSaveContext.ship.stats.sceneTimer++;
gSaveContext.ship.stats.roomTimer++;
if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA &&
Player_GetMask(play) == PLAYER_MASK_BUNNY) {
gSaveContext.ship.stats.count[COUNT_TIME_BUNNY_HOOD]++;
}
}
if (play->actorCtx.freezeFlashTimer && (play->actorCtx.freezeFlashTimer-- < 5)) {
+1 -1
View File
@@ -782,7 +782,7 @@ s32 Player_GetStrength(void) {
return PLAYER_STR_NONE;
}
if (CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) || LINK_IS_ADULT) {
if (GameInteractor_Should(VB_PLAYER_MEETS_AGE_REQ, LINK_IS_ADULT, LINK_AGE_ADULT)) {
return strengthUpgrade;
} else if (strengthUpgrade != 0) {
return PLAYER_STR_BRACELET;
-4
View File
@@ -143,10 +143,6 @@ void Sram_OpenSave() {
break;
}
if (!CVarGetInteger(CVAR_ENHANCEMENT("PersistentMasks"), 0)) {
gSaveContext.ship.maskMemory = PLAYER_MASK_NONE;
}
osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex);
osSyncPrintf(VT_RST);
@@ -1,7 +1,7 @@
#include "z_en_heishi4.h"
#include "objects/object_sd/object_sd.h"
#include "vt.h"
#include "soh/OTRGlobals.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY)
@@ -21,7 +21,6 @@ void func_80A56900(EnHeishi4* this, PlayState* play);
void func_80A56994(EnHeishi4* this, PlayState* play);
void func_80A56A50(EnHeishi4* this, PlayState* play);
void func_80A56ACC(EnHeishi4* this, PlayState* play);
void EnHeishi4_MarketSneak(EnHeishi4* this, PlayState* play);
const ActorInit En_Heishi4_InitVars = {
ACTOR_EN_HEISHI4,
@@ -333,14 +332,7 @@ void func_80A56B40(EnHeishi4* this, PlayState* play) {
return;
}
if (this->type == HEISHI4_AT_MARKET_NIGHT) {
Player* player = GET_PLAYER(play);
// Only allow sneaking when not wearing a mask as that triggers different dialogue. MM Bunny hood disables
// these interactions, so bunny hood is fine in that case.
if (CVarGetInteger(CVAR_ENHANCEMENT("MarketSneak"), 0) &&
(player->currentMask == PLAYER_MASK_NONE ||
(player->currentMask == PLAYER_MASK_BUNNY && CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), 0)))) {
this->actionFunc = EnHeishi4_MarketSneak;
} else {
if (GameInteractor_Should(VB_MARKET_NIGHT_GUARD_SET_ACTION_AFTER_TALK, true, this, play)) {
this->actionFunc = func_80A56614;
return;
}
@@ -349,32 +341,6 @@ void func_80A56B40(EnHeishi4* this, PlayState* play) {
Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play);
}
/*Function that allows child Link to exit from Market entrance to Hyrule Field
at night.
*/
void EnHeishi4_MarketSneak(EnHeishi4* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) {
switch (play->msgCtx.choiceIndex) {
case 0: // yes
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_ENTRANCES) != RO_GENERIC_OFF) {
play->nextEntranceIndex =
Entrance_OverrideNextIndex(ENTR_HYRULE_FIELD_ON_BRIDGE_SPAWN); // Market Entrance -> HF
} else {
play->nextEntranceIndex = ENTR_HYRULE_FIELD_PAST_BRIDGE_SPAWN; // HF Near bridge (OoT cutscene
// entrance) to not fall in the water
}
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST);
gSaveContext.nextTransitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST);
this->actionFunc = func_80A56614;
break;
case 1: // no
this->actionFunc = func_80A56614;
break;
}
}
}
void EnHeishi4_Update(Actor* thisx, PlayState* play) {
EnHeishi4* this = (EnHeishi4*)thisx;
s32 pad;
@@ -2497,7 +2497,7 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) {
s32 item;
s32 i;
if (this->currentMask != PLAYER_MASK_NONE && !CVarGetInteger(CVAR_ENHANCEMENT("PersistentMasks"), 0)) {
if (GameInteractor_Should(VB_PLAYER_UNEQUIP_MASK_WITHOUT_BUTTON, this->currentMask != PLAYER_MASK_NONE, this)) {
maskItemAction = this->currentMask - 1 + PLAYER_IA_MASK_KEATON;
bool hasOnDpad = false;
@@ -5557,10 +5557,6 @@ void func_8083A0F4(PlayState* play, Player* this) {
this->interactRangeActor->parent = &this->actor;
Player_SetupAction(play, this, Player_Action_WaitForCutscene, 0);
this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE;
if (!CVarGetInteger(CVAR_ENHANCEMENT("PersistentMasks"), 0) ||
!CVarGetInteger(CVAR_ENHANCEMENT("AdultMasks"), 0)) {
gSaveContext.ship.maskMemory = PLAYER_MASK_NONE;
}
} else {
LinkAnimationHeader* anim;
@@ -9507,9 +9503,6 @@ void func_80843AE8(PlayState* play, Player* this) {
OnePointCutscene_Init(play, 9908, 125, &this->actor, CAM_ID_MAIN);
} else if (play->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) {
play->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU;
if (!CVarGetInteger(CVAR_ENHANCEMENT("PersistentMasks"), 0)) {
gSaveContext.ship.maskMemory = PLAYER_MASK_NONE;
}
}
}
@@ -10820,13 +10813,6 @@ void Player_Init(Actor* thisx, PlayState* play2) {
Player_UseItem(play, this, ITEM_NONE);
Player_SetEquipmentData(play, this);
this->prevBoots = this->currentBoots;
// keep masks thru loading zones
if (CVarGetInteger(CVAR_ENHANCEMENT("PersistentMasks"), 0)) {
if (INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_SOLD_OUT) {
gSaveContext.ship.maskMemory = PLAYER_MASK_NONE;
}
this->currentMask = gSaveContext.ship.maskMemory;
}
Player_InitCommon(this, play, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]);
// `giObjectSegment` is used for both "get item" objects and title cards. The maximum size for
// get item objects is 0x2000 (see the assert in func_8083AE40), and the maximum size for
@@ -12674,10 +12660,7 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) {
if (CVarGetInteger(CVAR_SETTING("MoveInFirstPerson"), 0) &&
CVarGetInteger(CVAR_SETTING("Controls.RightStickAim"), 0)) {
f32 movementSpeed = LINK_IS_ADULT ? 9.0f : 8.25f;
if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA &&
this->currentMask == PLAYER_MASK_BUNNY) {
movementSpeed *= 1.5f;
}
GameInteractor_Should(VB_PLAYER_MODIFY_FIRST_PERSON_SPEED, true, this, &movementSpeed);
f32 relX = (sControlInput->rel.stick_x / 10 * -invertXAxisMulti);
f32 relY = (sControlInput->rel.stick_y / 10);
@@ -773,29 +773,27 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
for (rowStart = 0, j = 0, temp = 0, i = 0; i < 4; i++, rowStart += 4, j += 16) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->equipVtx[j], 16, 0);
bool drawGreyItems = !CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0);
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
point = CUR_UPG_VALUE(sChildUpgrades[i]);
if ((point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) {
int upgradeItem = sChildUpgradeItemBases[i] + point - 1;
// Grey Out the Gauntlets as Child
// Grey Out Strength Upgrades when Disabled and the Toggle Strength Option is on
if ((drawGreyItems &&
((sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1) == ITEM_GAUNTLETS_SILVER ||
(sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1) == ITEM_GAUNTLETS_GOLD)) ||
if (!CHECK_AGE_REQ_ITEM(upgradeItem) ||
(CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0) &&
CVarGetInteger(CVAR_ENHANCEMENT("StrengthDisabled"), 0) && sChildUpgrades[i] == UPG_STRENGTH)) {
gDPSetGrayscaleColor(POLY_OPA_DISP++, 109, 109, 109, 255);
gSPGrayscale(POLY_OPA_DISP++, true);
}
KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx,
gItemIcons[sChildUpgradeItemBases[i] + point - 1], 32, 32, 0);
KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[upgradeItem], 32, 32, 0);
gSPGrayscale(POLY_OPA_DISP++, false);
}
} else {
if ((i == 0) &&
(CUR_UPG_VALUE(sAdultUpgrades[i]) ==
0)) { // If the player doesn't have the bow, load the current slingshot ammo upgrade instead.
if (drawGreyItems) {
// Check the base item, the upgrade level can be 0 here
if (!CHECK_AGE_REQ_ITEM(sChildUpgradeItemBases[i])) {
gDPSetGrayscaleColor(POLY_OPA_DISP++, 109, 109, 109, 255); // Grey Out Slingshot Bullet Bags
gSPGrayscale(POLY_OPA_DISP++, true);
}
@@ -804,19 +802,18 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
32, 32, 0);
gSPGrayscale(POLY_OPA_DISP++, false);
} else if (CUR_UPG_VALUE(sAdultUpgrades[i]) != 0) {
// Grey Out the Goron Bracelet when Not Randomized and Toggle Strength Option is off
int upgradeItem = sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1;
// Grey Out upgrades the wrong age, ie the Goron Bracelet as Adult,
// unless rando or the Toggle Strength Option still has a use for it
// Grey Out Strength Upgrades when Disabled and the Toggle Strength Option is on
if ((drawGreyItems &&
(((sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1) == ITEM_BRACELET &&
!(IS_RANDO) && !CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0)))) ||
if ((!CHECK_AGE_REQ_ITEM(upgradeItem) && !(IS_RANDO) &&
!CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0)) ||
(CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0) &&
CVarGetInteger(CVAR_ENHANCEMENT("StrengthDisabled"), 0) && sAdultUpgrades[i] == UPG_STRENGTH)) {
gDPSetGrayscaleColor(POLY_OPA_DISP++, 109, 109, 109, 255);
gSPGrayscale(POLY_OPA_DISP++, true);
}
KaleidoScope_DrawQuadTextureRGBA32(
play->state.gfxCtx, gItemIcons[sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1],
32, 32, 0);
KaleidoScope_DrawQuadTextureRGBA32(play->state.gfxCtx, gItemIcons[upgradeItem], 32, 32, 0);
gSPGrayscale(POLY_OPA_DISP++, false);
}
}
@@ -355,23 +355,6 @@ void KaleidoScope_HandleItemCycles(PlayState* play) {
: INV_CONTENT(ITEM_TRADE_CHILD) + 1),
true);
// the slot age requirement for the child trade slot has to be updated
// in case it currently holds a mask
// to allow adult link to wear it if the setting is enabled
gSlotAgeReqs[SLOT_TRADE_CHILD] =
(CVarGetInteger(CVAR_ENHANCEMENT("AdultMasks"), 0) || CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0)) &&
INV_CONTENT(ITEM_TRADE_CHILD) >= ITEM_MASK_KEATON && INV_CONTENT(ITEM_TRADE_CHILD) <= ITEM_MASK_TRUTH
? AGE_REQ_NONE
: AGE_REQ_CHILD;
// also update the age requirements for the masks itself
for (int i = ITEM_MASK_KEATON; i <= ITEM_MASK_TRUTH; i += 1) {
gItemAgeReqs[i] =
CVarGetInteger(CVAR_ENHANCEMENT("AdultMasks"), 0) || CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0)
? AGE_REQ_NONE
: AGE_REQ_CHILD;
}
// handle the adult trade select
KaleidoScope_HandleItemCycleExtras(play, SLOT_TRADE_ADULT,
IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE),
@@ -3,6 +3,7 @@
#include <libultraship/libultra.h>
#include "global.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
extern u8 gAmmoItems[];
extern s16 D_8082AAEC[];
@@ -20,9 +21,23 @@ extern u8 gAreaGsFlags[];
#define AGE_REQ_CHILD LINK_AGE_CHILD
#define AGE_REQ_NONE 9
#define CHECK_AGE_REQ_EQUIP(i, j) (CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) || (gEquipAgeReqs[i][j] == AGE_REQ_NONE) || (gEquipAgeReqs[i][j] == ((void)0, gSaveContext.linkAge)))
#define CHECK_AGE_REQ_SLOT(slotIndex) (CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) || (gSlotAgeReqs[slotIndex] == AGE_REQ_NONE) || gSlotAgeReqs[slotIndex] == ((void)0, gSaveContext.linkAge))
#define CHECK_AGE_REQ_ITEM(itemIndex) (CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) || (gItemAgeReqs[itemIndex] == AGE_REQ_NONE) || (gItemAgeReqs[itemIndex] == gSaveContext.linkAge))
#define CHECK_AGE_REQ_EQUIP(i, j) \
GameInteractor_Should(VB_PLAYER_MEETS_AGE_REQ, \
(gEquipAgeReqs[i][j] == AGE_REQ_NONE) || \
(gEquipAgeReqs[i][j] == ((void)0, gSaveContext.linkAge)), \
gEquipAgeReqs[i][j])
#define CHECK_AGE_REQ_SLOT(slotIndex) \
GameInteractor_Should(VB_SLOT_MEETS_AGE_REQ, \
(gSlotAgeReqs[slotIndex] == AGE_REQ_NONE) || \
(gSlotAgeReqs[slotIndex] == ((void)0, gSaveContext.linkAge)), \
slotIndex)
#define CHECK_AGE_REQ_ITEM(itemIndex) \
GameInteractor_Should(VB_ITEM_MEETS_AGE_REQ, \
(gItemAgeReqs[itemIndex] == AGE_REQ_NONE) || \
(gItemAgeReqs[itemIndex] == gSaveContext.linkAge), \
itemIndex)
void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx);
s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point);