From fea40eb960f7c9e289f6f000306663df070a0855 Mon Sep 17 00:00:00 2001 From: Josh Sanchez Date: Sun, 26 Jan 2025 18:36:37 -0600 Subject: [PATCH 1/3] Feat: Add Moon Crash Cutscene Skip to Misc Interactions time savers --- .../MiscInteractions/SkipMoonCrash.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp diff --git a/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp b/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp new file mode 100644 index 0000000000..41094b474b --- /dev/null +++ b/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp @@ -0,0 +1,43 @@ +#include +#include +#include "2s2h/GameInteractor/GameInteractor.h" +#include "2s2h/ShipInit.hpp" + +extern "C" { +#include "variables.h" +} + +#define CVAR_NAME "gEnhancements.Cutscenes.SkipMiscInteractions" +#define CVAR CVarGetInteger(CVAR_NAME, 0) + +// Didn't end up using these few cutscene values, but they are captured here as documentation in case they +// are relevant in the future +#define TERMINA_FIELD_MOON_CRASH_CS_ENTRANCE 0x54C0 +#define VOID_FIRE_WALL_CS_ENTRANCE 0x1C00 +#define VOID_FIRE_WALL_CS_INDEX 0xFFF8 + +#define MOON_CRASH_NEW_CYCLE_CS_ID 13 +#define MOON_CRASH_NEW_CYCLE_ENTRANCE_ID 0xC030 + +/** + * Skips only the visible cutscenes (Clock Tower destruction and Link's terrible fate with the Fire Wall). + * Note: There is a cutscene command SPECIFICALLY for resetting game state related to the moon crash, + * CS_MISC_RESET_SAVE_FROM_MOON_CRASH, that MUST NOT be skipped, or else + * it would break the vanilla functionality of a Moon Crash reset. + */ +void RegisterSkipMoonCrash() { + // Skips initial cutscene in Termina Field where the moon falls, goes straight to clock tower cutscene + COND_VB_SHOULD(VB_PLAY_TRANSITION_CS, CVAR, { + if (gSaveContext.save.cutsceneIndex == 0x0 && + gSaveContext.save.entrance == TERMINA_FIELD_MOON_CRASH_CS_ENTRANCE) { + // This cutscene command would otherwise be run as part of the Fire Wall cutscene that gets skipped. + // IT MUST BE CALLED HERE IF THAT CUTSCENE IS SKIPPED OR ELSE THE GAME STATE WILL NOT RESET CORRECTLY! + Sram_ResetSaveFromMoonCrash(&gPlayState->sramCtx); + + gSaveContext.save.cutsceneIndex = MOON_CRASH_NEW_CYCLE_CS_ID; + gSaveContext.save.entrance = MOON_CRASH_NEW_CYCLE_ENTRANCE_ID; + } + }); +} + +static RegisterShipInitFunc initFunc(RegisterSkipMoonCrash, { CVAR_NAME }); From d483f0c7b9a80d1f001b9d8d12529d9ce991ecbf Mon Sep 17 00:00:00 2001 From: Joshua Sanchez Date: Tue, 28 Jan 2025 13:20:32 -0600 Subject: [PATCH 2/3] Remove smelly unused defines in Skip Moon Crash impl Co-authored-by: Garrett Cox --- .../Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp b/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp index 41094b474b..f706a4cc30 100644 --- a/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp +++ b/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp @@ -10,11 +10,7 @@ extern "C" { #define CVAR_NAME "gEnhancements.Cutscenes.SkipMiscInteractions" #define CVAR CVarGetInteger(CVAR_NAME, 0) -// Didn't end up using these few cutscene values, but they are captured here as documentation in case they -// are relevant in the future #define TERMINA_FIELD_MOON_CRASH_CS_ENTRANCE 0x54C0 -#define VOID_FIRE_WALL_CS_ENTRANCE 0x1C00 -#define VOID_FIRE_WALL_CS_INDEX 0xFFF8 #define MOON_CRASH_NEW_CYCLE_CS_ID 13 #define MOON_CRASH_NEW_CYCLE_ENTRANCE_ID 0xC030 From fd44259e89828699bd1cd8adb1bc407c5d3972a9 Mon Sep 17 00:00:00 2001 From: Josh Sanchez Date: Thu, 6 Feb 2025 10:18:05 -0600 Subject: [PATCH 3/3] Settings: Switch Moon Crash cutscene skip to check for SkipStoryCutscenes --- .../Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp b/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp index f706a4cc30..5f08c77881 100644 --- a/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp +++ b/mm/2s2h/Enhancements/Cutscenes/MiscInteractions/SkipMoonCrash.cpp @@ -7,7 +7,7 @@ extern "C" { #include "variables.h" } -#define CVAR_NAME "gEnhancements.Cutscenes.SkipMiscInteractions" +#define CVAR_NAME "gEnhancements.Cutscenes.SkipStoryCutscenes" #define CVAR CVarGetInteger(CVAR_NAME, 0) #define TERMINA_FIELD_MOON_CRASH_CS_ENTRANCE 0x54C0