Mask improvements (#3431)

* Add gKeepMasks

* Add gSaveMasksToFile

* Add gKeepMasksOnDeath & gKeepBunnyHoodThroughTime

* Fix mask bleedthrough

* Update cvar names

* Change bunny hood enhancements to all mask ones

* Consolidate multiple enhancements into PersistentMasks

* Move keeping masks thru loading zones to PersistentMasks

* I forgot

* Update z_player.c

* Update z64save.h

Merge commit excluded this removal for some reason.

---------

Co-authored-by: Malkierian <malkierian@gmail.com>
Co-authored-by: Malkierian <malkierian@live.com>
This commit is contained in:
Pepe20129 2024-10-11 01:16:41 +02:00 committed by GitHub
commit 70a2141351
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 72 additions and 61 deletions

View file

@ -539,14 +539,19 @@ 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(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && CVarGetInteger(CVAR_ENHANCEMENT("AdultBunnyHood"), 0)) || CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0)) {
gItemAgeReqs[ITEM_MASK_BUNNY] = AGE_REQ_NONE;
if(INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY)
// 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 {
gItemAgeReqs[ITEM_MASK_BUNNY] = gSlotAgeReqs[SLOT_TRADE_CHILD] = AGE_REQ_CHILD;
}
} 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;
}
func_800304DC(play, &play->actorCtx, play->linkActorEntry);

View file

@ -140,6 +140,10 @@ void Sram_OpenSave() {
break;
}
if (!CVarGetInteger(CVAR_ENHANCEMENT("PersistentMasks"), 0)) {
gSaveContext.maskMemory = PLAYER_MASK_NONE;
}
osSyncPrintf("scene_no = %d\n", gSaveContext.entranceIndex);
osSyncPrintf(VT_RST);