This commit is contained in:
Pepe20129 2024-04-12 10:26:16 +02:00 committed by GitHub
commit e01ca75af7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 28 additions and 8 deletions

View File

@ -290,6 +290,7 @@ typedef struct {
/* */ SohStats sohStats;
/* */ FaroresWindData backupFW;
/* */ RandomizerCheckTrackerData checkTrackerData[RC_MAX];
/* */ u8 maskMemory;
// #endregion
// #region SOH [Randomizer]
// Upstream TODO: Move these to their own struct or name to more obviously specific to Randomizer

View File

@ -616,6 +616,7 @@ void SaveManager::InitFileNormal() {
gSaveContext.pendingSaleMod = MOD_NONE;
gSaveContext.isBossRushPaused = 0;
gSaveContext.pendingIceTrapCount = 0;
gSaveContext.maskMemory = PLAYER_MASK_NONE;
// Init with normal quest unless only an MQ rom is provided
gSaveContext.questId = OTRGlobals::Instance->HasOriginal() ? QUEST_NORMAL : QUEST_MASTER;
@ -1932,6 +1933,7 @@ void SaveManager::LoadBaseVersion4() {
SaveManager::Instance->LoadData("tempCollectFlags", gSaveContext.backupFW.tempCollectFlags);
});
SaveManager::Instance->LoadData("dogParams", gSaveContext.dogParams);
SaveManager::Instance->LoadData("maskMemory", gSaveContext.maskMemory);
}
void SaveManager::SaveBase(SaveContext* saveContext, int sectionID, bool fullSave) {
@ -2101,6 +2103,7 @@ void SaveManager::SaveBase(SaveContext* saveContext, int sectionID, bool fullSav
SaveManager::Instance->SaveData("tempCollectFlags", saveContext->backupFW.tempCollectFlags);
});
SaveManager::Instance->SaveData("dogParams", saveContext->dogParams);
SaveManager::Instance->SaveData("maskMemory", saveContext->maskMemory);
}
// Load a string into a char array based on size and ensuring it is null terminated when overflowed

View File

@ -690,6 +690,14 @@ void DrawEnhancementsMenu() {
);
UIWidgets::PaddedEnhancementCheckbox("Bunny Hood Equippable as Adult", "gAdultBunnyHood", true, false, (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) == BUNNY_HOOD_VANILLA), "Only available with increased bunny hood speed", UIWidgets::CheckboxGraphics::Cross, false);
UIWidgets::Tooltip("Allows the bunny hood to be equipped normally from the pause menu as adult.");
UIWidgets::PaddedEnhancementCheckbox("Keep Bunny Hood through time", "gEnhancements.KeepBunnyHoodThroughTime", true, false, !CVarGetInteger("gAdultBunnyHood", 0), "Only available with \"Bunny Hood Equippable as Adult\"", UIWidgets::CheckboxGraphics::Cross, false);
UIWidgets::Tooltip("Stops the bunny hood from automatically unequipping when travelling through time.");
UIWidgets::PaddedEnhancementCheckbox("Stop automatic mask unequipping", "gEnhancements.KeepMasks", true, false);
UIWidgets::Tooltip("Stops masks from automatically unequipping when not in any C button or the dpad.");
UIWidgets::PaddedEnhancementCheckbox("Save equipped mask to file", "gEnhancements.SaveMasksToFile", true, false);
UIWidgets::Tooltip("If you save and quit with a mask on, it'll still be on when you load back in.");
UIWidgets::PaddedEnhancementCheckbox("Keep mask on death", "gEnhancements.KeepMasksOnDeath", true, false);
UIWidgets::Tooltip("Stops masks from automatically unequipping when dying.");
UIWidgets::PaddedEnhancementCheckbox("Mask Select in Inventory", "gMaskSelect", true, false);
UIWidgets::Tooltip("After completing the mask trading sub-quest, press A and any direction on the mask slot to change masks");
UIWidgets::PaddedEnhancementCheckbox("Nuts explode bombs", "gNutsExplodeBombs", true, false);

View File

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

View File

@ -1088,7 +1088,6 @@ static s8 sItemActions[] = {
PLAYER_IA_SWORD_BIGGORON, // ITEM_SWORD_BIGGORON
};
static u8 sMaskMemory;
u8 gWalkSpeedToggle1;
u8 gWalkSpeedToggle2;
@ -2262,8 +2261,8 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) {
if (gSaveContext.equips.buttonItems[0] != maskItem && gSaveContext.equips.buttonItems[1] != maskItem &&
gSaveContext.equips.buttonItems[2] != maskItem && gSaveContext.equips.buttonItems[3] != maskItem &&
!hasOnDpad) {
this->currentMask = sMaskMemory = PLAYER_MASK_NONE;
!hasOnDpad && !CVarGetInteger("gEnhancements.KeepMasks", 0)) {
this->currentMask = gSaveContext.maskMemory = PLAYER_MASK_NONE;
func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
}
} else {
@ -3220,7 +3219,8 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) {
this->currentMask = itemAction - PLAYER_IA_MASK_KEATON + 1;
}
sMaskMemory = this->currentMask;
gSaveContext.maskMemory = this->currentMask;
func_808328EC(this, NA_SE_PL_CHANGE_ARMS);
} else if (((itemAction >= PLAYER_IA_OCARINA_FAIRY) && (itemAction <= PLAYER_IA_OCARINA_OF_TIME)) ||
(itemAction >= PLAYER_IA_BOTTLE_FISH)) {
@ -5069,7 +5069,9 @@ void func_8083A0F4(PlayState* play, Player* this) {
this->interactRangeActor->parent = &this->actor;
Player_SetupAction(play, this, Player_Action_8084F608, 0);
this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE;
sMaskMemory = PLAYER_MASK_NONE;
if (!CVarGetInteger("gEnhancements.KeepBunnyHoodThroughTime", 0) || !CVarGetInteger("gAdultBunnyHood", 0) || gSaveContext.maskMemory != PLAYER_MASK_BUNNY) {
gSaveContext.maskMemory = PLAYER_MASK_NONE;
}
} else {
LinkAnimationHeader* anim;
@ -8937,7 +8939,9 @@ void func_80843AE8(PlayState* play, Player* this) {
OnePointCutscene_Init(play, 9908, 125, &this->actor, MAIN_CAM);
} else if (play->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) {
play->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU;
sMaskMemory = PLAYER_MASK_NONE;
if (!CVarGetInteger("gEnhancements.KeepMasksOnDeath", 0)) {
gSaveContext.maskMemory = PLAYER_MASK_NONE;
}
}
}
@ -10192,9 +10196,9 @@ void Player_Init(Actor* thisx, PlayState* play2) {
this->prevBoots = this->currentBoots;
if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) {
if (INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_SOLD_OUT) {
sMaskMemory = PLAYER_MASK_NONE;
gSaveContext.maskMemory = PLAYER_MASK_NONE;
}
this->currentMask = sMaskMemory;
this->currentMask = gSaveContext.maskMemory;
}
Player_InitCommon(this, play, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]);
this->giObjectSegment = (void*)(((uintptr_t)ZELDA_ARENA_MALLOC_DEBUG(0x3008) + 8) & ~0xF);