summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorJoshua Sanchez <joshuaesanch@gmail.com>2025-10-18 18:54:53 -0500
committerGitHub <noreply@github.com>2025-10-18 19:54:53 -0400
commit16bc8ea0dd4a28d3206af3bb1e00a5ce2902fa56 (patch)
tree2ba09a6d09de161a3980d799f605190ab6de491a /mm
parent5ccd9a0798fb90dee2098bc24028cd4640b05f5b (diff)
[Enhancement] Add Moon Crash Cutscene Skip to Story Cutscenes time savers (#970)
* Feat: Add Moon Crash Cutscene Skip to Misc Interactions time savers * Remove smelly unused defines in Skip Moon Crash impl Co-authored-by: Garrett Cox <garrettjcox@gmail.com> * Settings: Switch Moon Crash cutscene skip to check for SkipStoryCutscenes * Use entrance macro in Moon Crash Cutscene Skip logic * Refactor: Clean up redundant cutscene index set in Moon Crash cutscene skip * Refactor: Use latest libultraship bridge * Refactor: Move SkipMoonCrash to Story Cutscene skips folder --------- Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipMoonCrash.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipMoonCrash.cpp b/mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipMoonCrash.cpp
new file mode 100644
index 000000000..89e2e214f
--- /dev/null
+++ b/mm/2s2h/Enhancements/Cutscenes/StoryCutscenes/SkipMoonCrash.cpp
@@ -0,0 +1,31 @@
+#include "public/bridge/consolevariablebridge.h"
+#include "2s2h/GameInteractor/GameInteractor.h"
+#include "2s2h/ShipInit.hpp"
+
+extern "C" {
+#include "variables.h"
+}
+
+#define CVAR_NAME "gEnhancements.Cutscenes.SkipStoryCutscenes"
+#define CVAR CVarGetInteger(CVAR_NAME, 0)
+
+/**
+ * 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 == ENTRANCE(TERMINA_FIELD, 12)) {
+ // 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.entrance = ENTRANCE(CLOCK_TOWER_INTERIOR, 3);
+ }
+ });
+}
+
+static RegisterShipInitFunc initFunc(RegisterSkipMoonCrash, { CVAR_NAME });