From 4e495c44fbd3ef41aef80a6104aac8a12a086426 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 11 Jun 2025 23:07:20 +0200 Subject: [PATCH] fix comment about 0xFFFF usage --- include/save.h | 7 +------ src/code/z_demo.c | 6 ++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/include/save.h b/include/save.h index d63217cdaa..8431f29035 100644 --- a/include/save.h +++ b/include/save.h @@ -425,12 +425,7 @@ typedef enum LinkAge { // (except for the value 0xFFFD, which is special-cased to do nothing in `Play_Init`). // It loads layer 4 for 0xFFF0, layer 5 for 0xFFF1, and so on. // -// The cutsceneIndex could also be set to one of these values to start a -// scripted cutscene immediately. In the vanilla game, this is used to play -// the cutscene where the barrier in Ganon's Castle is dispelled (using index 0xFFFF) -// and to preview cutscenes in debug mode (using index 0xFFFD). -// -// 0xFFFD also is used by the cutscene system to indicate a scripted cutscene has been triggered. +// 0xFFFD is used by the cutscene system to indicate a scripted cutscene has been triggered. // This is why `Play_Init` ignores that value, so that if the cutscene is interrupted // by a new play state load (e.g. if the player falls out of bounds), it does not then // try to wrongly load a cutscene layer. diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 90a5a57d03..59f79eb70d 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1391,9 +1391,15 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->csCtx.script = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); play->csCtx.curFrame = 0; gSaveContext.cutsceneTrigger = 1; + // Force cutsceneIndex to CS_INDEX_F so that CS_STATE_STOP is handled by the "scripted" system's + // CutsceneHandler_StopScript. + // Otherwise, because cutsceneIndex is set to 0 above, CS_STATE_STOP would be handled by the + // "manual" cutscene system's CutsceneHandler_StopManual, which does not terminate the cutscene + // camera, resulting in a softlock. gSaveContext.save.cutsceneIndex = CS_INDEX_F; csCtx->state = CS_STATE_STOP; } else { + // Same as above gSaveContext.save.cutsceneIndex = CS_INDEX_F; csCtx->state = CS_STATE_STOP; }