Separate enhancement, use engine event system

This commit is contained in:
Eblo
2026-01-18 22:55:21 -06:00
committed by Lywx
parent cbc36dedcd
commit 4db8d468ca
4 changed files with 19 additions and 2 deletions
+3 -1
View File
@@ -1260,7 +1260,7 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
#endif
sWarpDest.type = WARP_TYPE_NOT_WARPING;
sDelayedWarpOp = WARP_OP_NONE;
gNeverEnteredCastle = save_file_exists(gCurrSaveFileNum - 1) == FALSE && CVarGetInteger("gEnhancements.DisablePeachCutscene", 0) == 0;
gNeverEnteredCastle = save_file_exists(gCurrSaveFileNum - 1) == FALSE;
gCurrLevelNum = levelNum;
gCurrCourseNum = COURSE_NONE;
@@ -1274,6 +1274,8 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
select_mario_cam_mode();
set_yoshi_as_not_dead();
CALL_EVENT(LevelInitFromSaveFile);
return levelNum;
}
+3 -1
View File
@@ -24,4 +24,6 @@ DEFINE_EVENT(LevelScriptBeginArea,
DEFINE_EVENT(GeoLayoutCallASM,
GraphNodeFunc* func;
int16_t* parameter;
);
);
DEFINE_EVENT(LevelInitFromSaveFile);
+8
View File
@@ -3,6 +3,7 @@
#define INIT_EVENT_IDS
#include "sm64.h"
#include "game/level_update.h"
#include "menu/title_screen.h"
#include "port/hooks/Events.h"
#include "assets/bin/segment2.h"
@@ -73,11 +74,18 @@ void PortEnhancements_Init() {
RenderPauseCourseOptions* ev = (RenderPauseCourseOptions*)event;
*ev->render = true;
});
REGISTER_LISTENER(LevelInitFromSaveFile, EVENT_PRIORITY_NORMAL, [](IEvent* event) {
if (CVarGetInteger("gEnhancements.DisableLakituCutscene", 0)) {
gNeverEnteredCastle = false;
}
});
}
void PortEnhancements_Register() {
// Register engine events
REGISTER_EVENT(GameFrameUpdate);
REGISTER_EVENT(LevelInitFromSaveFile);
REGISTER_EVENT(GeoLayoutCallASM);
REGISTER_EVENT(LevelScriptCallLoop);
REGISTER_EVENT(LevelScriptBeginArea);
@@ -137,6 +137,11 @@ void GhostshipMenu::AddMenuEnhancements() {
.CVar(CVAR_ENHANCEMENT("DisablePeachCutscene"))
.RaceDisable(false)
.Options(CheckboxOptions().Tooltip("Skips the Peach cutscene when starting a new game."));
AddWidget(path, "Skip Intro Lakitu", WIDGET_CVAR_CHECKBOX)
.CVar(CVAR_ENHANCEMENT("DisableLakituCutscene"))
.RaceDisable(false)
.Options(CheckboxOptions().Tooltip("The Lakitu will not appear when Mario reaches the bridge outside Peach's \n"
"Castle. Also skips Bowser's message when Mario first enters the castle."));
path = { "Enhancements", "Fixes", SECTION_COLUMN_1 };
AddSidebarEntry("Enhancements", path.sidebarName, 1);