[Enhancement] Add First Cycle Skip (#716)

* add option to skip first cycle

* nest cycle skip in intro skip

* set persistant flags from first cycle

* better comments

* missed a flag

* add modern menu option

* clang format

* add entrance cutscene flags
This commit is contained in:
balloondude2
2024-10-09 23:48:21 -05:00
committed by GitHub
parent 0b16bced84
commit 4d3c39224c
3 changed files with 61 additions and 2 deletions
+6
View File
@@ -472,6 +472,12 @@ void DrawEnhancementsMenu() {
{
.tooltip = "When starting a game you will be taken straight to South Clock Town as Deku Link.",
});
if (CVarGetInteger("gEnhancements.Cutscenes.SkipIntroSequence", 0)) {
UIWidgets::CVarCheckbox(
"Skip First Cycle", "gEnhancements.Cutscenes.SkipFirstCycle",
{ .tooltip = "When starting a game you will be taken straight to South Clock Town as Human Link "
"with Deku Mask, Ocarina, Song of Time, and Song of Healing." });
}
UIWidgets::CVarCheckbox(
"Skip Story Cutscenes", "gEnhancements.Cutscenes.SkipStoryCutscenes",
{
+14 -2
View File
@@ -46,7 +46,8 @@ typedef enum {
DISABLE_FOR_MOTION_BLUR_MODE,
DISABLE_FOR_MOTION_BLUR_OFF,
DISABLE_FOR_FRAME_ADVANCE_OFF,
DISABLE_FOR_WARP_POINT_NOT_SET
DISABLE_FOR_WARP_POINT_NOT_SET,
DISABLE_FOR_INTRO_SKIP_OFF,
} DisableOption;
struct widgetInfo;
@@ -341,7 +342,10 @@ static std::map<DisableOption, disabledInfo> disabledMap = {
"Frame Advance is Disabled" } },
{ DISABLE_FOR_WARP_POINT_NOT_SET,
{ [](disabledInfo& info) -> bool { return !CVarGetInteger(WARP_POINT_CVAR "Saved", 0); },
"Warp Point Not Saved" } }
"Warp Point Not Saved" } },
{ DISABLE_FOR_INTRO_SKIP_OFF,
{ [](disabledInfo& info) -> bool { return !CVarGetInteger("gEnhancements.Cutscenes.SkipIntroSequence", 0); },
"Intro Skip Not Selected" } }
};
std::unordered_map<int32_t, const char*> menuThemeOptions = {
@@ -1264,6 +1268,14 @@ void AddEnhancements() {
{ "Skip Intro Sequence", "gEnhancements.Cutscenes.SkipIntroSequence",
"When starting a game you will be taken straight to South Clock Town as Deku Link.",
WIDGET_CVAR_CHECKBOX },
{ "Skip First Cycle",
"gEnhancements.Cutscenes.SkipFirstCycle",
"When starting a game you will be taken straight to South Clock Town as Human Link "
"with Deku Mask, Ocarina, Song of Time, and Song of Healing.",
WIDGET_CVAR_CHECKBOX,
{},
nullptr,
[](widgetInfo& info) { info.isHidden = disabledMap.at(DISABLE_FOR_INTRO_SKIP_OFF).active; } },
{ "Skip Story Cutscenes", "gEnhancements.Cutscenes.SkipStoryCutscenes",
"Disclaimer: This doesn't do much yet, we will be progressively adding more skips over time.",
WIDGET_CVAR_CHECKBOX },
@@ -3,8 +3,10 @@
extern "C" {
#include "z64.h"
#include <variables.h>
extern PlayState* gPlayState;
extern SaveContext gSaveContext;
void Flags_SetWeekEventReg(s32 flag);
}
void RegisterSkipIntroSequence() {
@@ -24,6 +26,45 @@ void RegisterSkipIntroSequence() {
// Mark chest as opened and give the player the Deku Nuts
gSaveContext.cycleSceneFlags[SCENE_OPENINGDAN].chest |= (1 << 0);
Item_Give(gPlayState, ITEM_DEKU_NUTS_10);
if (CVarGetInteger("gEnhancements.Cutscenes.SkipFirstCycle", 0)) {
gSaveContext.save.playerForm = PLAYER_FORM_HUMAN;
gSaveContext.save.saveInfo.playerData.isMagicAcquired = true;
Item_Give(gPlayState, ITEM_OCARINA_OF_TIME);
Item_Give(gPlayState, ITEM_MASK_DEKU);
gSaveContext.save.saveInfo.inventory.questItems = (1 << QUEST_SONG_TIME) | (1 << QUEST_SONG_HEALING);
if (gSaveContext.save.saveInfo.playerData.threeDayResetCount < 1) {
gSaveContext.save.saveInfo.playerData.threeDayResetCount = 1;
}
gSaveContext.save.isFirstCycle = false;
// Lose nuts
AMMO(ITEM_DEKU_NUT) = 0;
// Tatl's text at seeing the broken great fairy
gSaveContext.cycleSceneFlags[SCENE_YOUSEI_IZUMI].switch0 |= (1 << 10);
// Tatl's text when first entering South Clock Town if not already set
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_59_04)) {
SET_WEEKEVENTREG(WEEKEVENTREG_59_04);
}
// Set Tatl second cycle (?) text if not already set
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_31_04)) {
SET_WEEKEVENTREG(WEEKEVENTREG_31_04);
}
// Set Entrance Cutscene flags for Clock Town if not already set
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_ENTERED_EAST_CLOCK_TOWN)) {
SET_WEEKEVENTREG(WEEKEVENTREG_ENTERED_EAST_CLOCK_TOWN);
}
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_ENTERED_WEST_CLOCK_TOWN)) {
SET_WEEKEVENTREG(WEEKEVENTREG_ENTERED_WEST_CLOCK_TOWN);
}
if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_ENTERED_NORTH_CLOCK_TOWN)) {
SET_WEEKEVENTREG(WEEKEVENTREG_ENTERED_NORTH_CLOCK_TOWN);
}
}
}
});
}