Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Save.cutsceneIndex and adjacent data / code #2286

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
53cd39d
introduce `enum CutsceneIndex` as a first step
Feacur Nov 4, 2024
050c736
crudely rename `enum CutsceneIndex` entries
Feacur Nov 5, 2024
4049e33
run `check_format.py ...` separetely
Feacur Nov 5, 2024
2ae3bff
apply a draft PR suggestion
Feacur Nov 5, 2024
8cbdf80
rename `CS_INDEX_*` with PR suggestions
Feacur Nov 5, 2024
2ec57c9
improve `CS_INDEX_*` naming, rem `ENTRANCE` suffix
Feacur Nov 5, 2024
b8953fd
apply Jenkins fixes
Feacur Nov 5, 2024
32a2dd0
apply a PR suggestion
Feacur Nov 5, 2024
2bd2ca2
remove redundant comments, fix the header comment
Feacur Nov 5, 2024
6eaaa87
rename the flag for freeing `nextCutsceneIndex`
Feacur Nov 5, 2024
d9bbd67
rename the flag for automatic `sceneLayer` calc
Feacur Nov 5, 2024
eb75a6d
use explicit scene layer names instead of numbers
Feacur Nov 5, 2024
02a977f
ok, now the last two `CS_INDEX_*` are less unknown
Feacur Nov 5, 2024
bee188d
Merge branch 'main' into doc/cutscene_index
Feacur Nov 13, 2024
211bf74
apply Jenkins fixes
Feacur Nov 13, 2024
450e24e
Merge branch 'main' into doc/cutscene_index
Feacur Nov 17, 2024
3530507
Merge branch 'main' into doc/cutscene_index
Feacur Nov 19, 2024
4b3e0dc
run `fix_bss` locally
Feacur Nov 19, 2024
1d84bca
revert all local to the branch bss shifts
Feacur Nov 19, 2024
133a74f
ugh, use defines instead of an enum
Feacur Nov 19, 2024
0cbe8a4
still, add a BSS pragma for `z_demo.c`
Feacur Nov 20, 2024
279759f
Merge branch 'main' into doc/cutscene_index
Feacur Nov 20, 2024
5552e92
apply review changes
Feacur Nov 28, 2024
f728d55
factor out a cutscene layer formula
Feacur Nov 28, 2024
106cb10
give scene layers names throughout code
Feacur Nov 28, 2024
50acfc2
apply Jenkins fixes
Feacur Nov 28, 2024
6efea0a
tweak `CS_INDEX` descriptions
Feacur Nov 29, 2024
e9adab6
apply PR review suggestions
Feacur Nov 30, 2024
67f0eef
rename "auto" -> "default"
Feacur Nov 30, 2024
cbaad70
apply PR review suggestions
Feacur Dec 4, 2024
0b5bc3d
Merge branch 'main' into doc/cutscene_index
Feacur Dec 16, 2024
2edc035
Merge branch 'main' into doc/cutscene_index
Feacur Dec 18, 2024
015380c
apply Jenkins fixes
Feacur Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion include/z64cutscene.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,42 @@ typedef enum CutsceneDestination {
/* 0x77 */ CS_DEST_ZELDAS_COURTYARD_RECEIVE_LETTER
} CutsceneDestination;

// values `< 0xFFF0` indicate a "manual" cutscene; can be assigned to
// - `gSaveContext.save.cutsceneIndex`
// - `gSaveContext.nextCutsceneIndex`
// using them implies an intention to have `z_play.c` set `gSaveContext.sceneLayer` based on age and day time
// see enum values [`SCENE_LAYER_CHILD_DAY` .. `SCENE_LAYER_ADULT_NIGHT`]
#define CS_INDEX_DEFAULT 0x0000
#define CS_INDEX_UNK_8000 0x8000

// values `>= 0xFFF0` indicate a "scripted" cutscene; can be assigned to
// - `gSaveContext.save.cutsceneIndex`
// - `gSaveContext.nextCutsceneIndex`
// using them implies an intention to have `z_play.c` set `gSaveContext.sceneLayer` directly by index
// see `GET_CUTSCENE_LAYER(index)`
#define CS_INDEX_0 0xFFF0
#define CS_INDEX_1 0xFFF1
#define CS_INDEX_2 0xFFF2
#define CS_INDEX_3 0xFFF3
#define CS_INDEX_4 0xFFF4
#define CS_INDEX_5 0xFFF5
#define CS_INDEX_6 0xFFF6
#define CS_INDEX_7 0xFFF7
#define CS_INDEX_8 0xFFF8
#define CS_INDEX_9 0xFFF9
#define CS_INDEX_A 0xFFFA

// it's "out of range" even for the largest set of `entrance_table.h`
// but `z_demo.c` immediately sets `CS_STATE_STOP` state
#define CS_INDEX_UNK_FFFF 0xFFFF

// sentinel value used for `cutsceneIndex` to indicate that it should be reset to default
#define CS_INDEX_EMPTY 0xFFFD

// sentinel value used for `nextCutsceneIndex` to indicate that it is empty
// otherwise its value will be copied to `cutsceneIndex`
#define CS_INDEX_NEXT_EMPTY 0xFFEF

typedef union CsCmdCam {
struct {
/* 0x00 */ u16 unused0;
Expand All @@ -353,7 +389,6 @@ typedef union CsCmdCam {
s32 _words[2];
} CsCmdCam; // size = 0x8


typedef union CsCmdMisc {
struct {
/* 0x00 */ u16 type;
Expand Down
1 change: 1 addition & 0 deletions include/z64save.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ typedef enum SceneLayer {
} SceneLayer;

#define IS_CUTSCENE_LAYER (gSaveContext.sceneLayer >= SCENE_LAYER_CUTSCENE_FIRST)
#define GET_CUTSCENE_LAYER(index) (SCENE_LAYER_CUTSCENE_FIRST + (index & 0xF))

typedef enum LinkAge {
/* 0 */ LINK_AGE_ADULT,
Expand Down
2 changes: 1 addition & 1 deletion src/code/db_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ s32 DebugCamera_UpdateDemoControl(DebugCam* debugCam, Camera* cam) {

if (CHECK_BTN_ALL(sPlay->state.input[1].press.button, BTN_CRIGHT)) {
gUseCutsceneCam = false;
gSaveContext.save.cutsceneIndex = 0xFFFD;
gSaveContext.save.cutsceneIndex = CS_INDEX_EMPTY;
gSaveContext.cutsceneTrigger = 1;
sDebugCamAnim.curFrame = 0.0f;
sDebugCamAnim.keyframe = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_common_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void SaveContext_Init(void) {
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
gSaveContext.nextCutsceneIndex = 0xFFEF;
gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_EMPTY;
gSaveContext.cutsceneTrigger = 0;
gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST;
gSaveContext.nextDayTime = NEXT_TIME_NONE;
Expand Down
168 changes: 84 additions & 84 deletions src/code/z_demo.c

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions src/code/z_horse.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ typedef struct HorseCutsceneSpawn {

void Horse_SetupInCutscene(PlayState* play, Player* player) {
static HorseCutsceneSpawn horseSpawns[] = {
{ SCENE_GERUDOS_FORTRESS, 0xFFF0, { 3600, 1413, 360 }, 0x8001, HORSE_PTYPE_HORSEBACK_ARCHERY },
{ SCENE_LON_LON_RANCH, 0xFFF0, { -250, 1, -1580 }, 0x4000, HORSE_PTYPE_6 }, // Horse Race
{ SCENE_LON_LON_RANCH, 0xFFF1, { 0, 0, 0 }, 0x0000, HORSE_PTYPE_5 }, // Learned Epona's Song
{ SCENE_LON_LON_RANCH, 0xFFF5, { 0, 0, 0 }, 0x0000, HORSE_PTYPE_7 }, // Credits
{ SCENE_HYRULE_FIELD, 0xFFF3, { -2961, 313, 7700 }, 0x0000, HORSE_PTYPE_7 }, // Title Screen
{ SCENE_HYRULE_FIELD, 0xFFF4, { -1900, 313, 7015 }, 0x0000, HORSE_PTYPE_7 },
{ SCENE_HYRULE_FIELD, 0xFFF5, { -4043, 313, 6933 }, 0x0000, HORSE_PTYPE_7 }, // Credits
{ SCENE_HYRULE_FIELD, 0xFFF6, { -4043, 313, 6933 }, 0x0000, HORSE_PTYPE_7 }, // Unused. Hopping Lon Lon
// Ranch North Gate
{ SCENE_GERUDOS_FORTRESS, CS_INDEX_0, { 3600, 1413, 360 }, 0x8001, HORSE_PTYPE_HORSEBACK_ARCHERY },
{ SCENE_LON_LON_RANCH, CS_INDEX_0, { -250, 1, -1580 }, 0x4000, HORSE_PTYPE_6 }, // Horse Race
{ SCENE_LON_LON_RANCH, CS_INDEX_1, { 0, 0, 0 }, 0x0000, HORSE_PTYPE_5 }, // Learned Epona's Song
{ SCENE_LON_LON_RANCH, CS_INDEX_5, { 0, 0, 0 }, 0x0000, HORSE_PTYPE_7 }, // Credits
{ SCENE_HYRULE_FIELD, CS_INDEX_3, { -2961, 313, 7700 }, 0x0000, HORSE_PTYPE_7 }, // Title Screen
{ SCENE_HYRULE_FIELD, CS_INDEX_4, { -1900, 313, 7015 }, 0x0000, HORSE_PTYPE_7 },
{ SCENE_HYRULE_FIELD, CS_INDEX_5, { -4043, 313, 6933 }, 0x0000, HORSE_PTYPE_7 }, // Credits
{ SCENE_HYRULE_FIELD, CS_INDEX_6, { -4043, 313, 6933 }, 0x0000, HORSE_PTYPE_7 }, // Unused. Hopping Lon Lon
// Ranch North Gate
};
s32 pad;
s32 i;
Expand Down Expand Up @@ -231,7 +231,7 @@ void Horse_SetupInCutscene(PlayState* play, Player* player) {
(((void)0, gSaveContext.save.cutsceneIndex) == horseSpawns[i].cutsceneIndex)) {
if (horseSpawns[i].type == HORSE_PTYPE_7) {
if ((play->sceneId == SCENE_LON_LON_RANCH) &&
(((void)0, gSaveContext.save.cutsceneIndex) == 0xFFF1)) {
(((void)0, gSaveContext.save.cutsceneIndex) == CS_INDEX_1)) {
Feacur marked this conversation as resolved.
Show resolved Hide resolved
horseSpawns[i].pos.x = player->actor.world.pos.x;
horseSpawns[i].pos.y = player->actor.world.pos.y;
horseSpawns[i].pos.z = player->actor.world.pos.z;
Expand Down
6 changes: 3 additions & 3 deletions src/code/z_kaleido_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ void KaleidoSetup_Update(PlayState* play) {

if (!IS_PAUSED(pauseCtx) && play->gameOverCtx.state == GAMEOVER_INACTIVE &&
play->transitionTrigger == TRANS_TRIGGER_OFF && play->transitionMode == TRANS_MODE_OFF &&
gSaveContext.save.cutsceneIndex < 0xFFF0 && gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) &&
play->shootingGalleryStatus <= 1 && gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY &&
gSaveContext.magicState != MAGIC_STATE_FILL &&
gSaveContext.save.cutsceneIndex < CS_INDEX_0 && gSaveContext.nextCutsceneIndex < CS_INDEX_0 &&
!Play_InCsMode(play) && play->shootingGalleryStatus <= 1 &&
gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY && gSaveContext.magicState != MAGIC_STATE_FILL &&
(play->sceneId != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) {

if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_kankyo.c
Original file line number Diff line number Diff line change
Expand Up @@ -2618,7 +2618,7 @@ void Environment_StopStormNatureAmbience(PlayState* play) {

void Environment_WarpSongLeave(PlayState* play) {
gWeatherMode = WEATHER_MODE_CLEAR;
gSaveContext.save.cutsceneIndex = 0;
gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT;
gSaveContext.respawnFlag = -3;
play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex;
play->transitionTrigger = TRANS_TRIGGER_START;
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -4294,7 +4294,7 @@ void Message_Update(PlayState* play) {

if (msgCtx->textId != 0x2061 && msgCtx->textId != 0x2025 && msgCtx->textId != 0x208C &&
((msgCtx->textId < 0x88D || msgCtx->textId >= 0x893) || msgCtx->choiceIndex != 0) &&
(msgCtx->textId != 0x3055 && gSaveContext.save.cutsceneIndex < 0xFFF0)) {
(msgCtx->textId != 0x3055 && gSaveContext.save.cutsceneIndex < CS_INDEX_0)) {
PRINTF("=== day_time=%x ", ((void)0, gSaveContext.save.cutsceneIndex));
if (play->activeCamId == CAM_ID_MAIN) {
if (gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NO_CHANGE ||
Expand Down
8 changes: 4 additions & 4 deletions src/code/z_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ void func_80083108(PlayState* play) {
s16 i;
s16 sp28 = false;

if ((gSaveContext.save.cutsceneIndex < 0xFFF0) ||
((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == 0xFFF0))) {
if ((gSaveContext.save.cutsceneIndex < CS_INDEX_0) ||
((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_0))) {
gSaveContext.forceRisingButtonAlphas = false;

if ((player->stateFlags1 & PLAYER_STATE1_23) || (play->shootingGalleryStatus > 1) ||
Expand Down Expand Up @@ -3525,7 +3525,7 @@ void Interface_Draw(PlayState* play) {
(Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT)) {
// Trade quest timer reached 0
sSubTimerStateTimer = 40;
gSaveContext.save.cutsceneIndex = 0;
gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_WHITE;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
Expand Down Expand Up @@ -3864,7 +3864,7 @@ void Interface_Draw(PlayState* play) {
(play->sceneId != SCENE_INSIDE_GANONS_CASTLE_COLLAPSE))) {
sSubTimerStateTimer = 40;
gSaveContext.subTimerState = SUBTIMER_STATE_RESPAWN;
gSaveContext.save.cutsceneIndex = 0;
gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT;
Message_StartTextbox(play, 0x71B0, NULL);
Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8);
} else {
Expand Down
25 changes: 12 additions & 13 deletions src/code/z_play.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#include "global.h"
#include "fault.h"
#include "quake.h"
Expand Down Expand Up @@ -56,7 +55,7 @@ void Play_SetViewpoint(PlayState* this, s16 viewpoint) {

this->viewpoint = viewpoint;

if ((R_SCENE_CAM_TYPE != SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT) && (gSaveContext.save.cutsceneIndex < 0xFFF0)) {
if ((R_SCENE_CAM_TYPE != SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT) && (gSaveContext.save.cutsceneIndex < CS_INDEX_0)) {
// Play a sfx when the player toggles the camera
Audio_PlaySfxGeneral((viewpoint == VIEWPOINT_LOCKED) ? NA_SE_SY_CAMERA_ZOOM_DOWN : NA_SE_SY_CAMERA_ZOOM_UP,
&gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
Expand Down Expand Up @@ -311,13 +310,13 @@ void Play_Init(GameState* thisx) {
AnimTaskQueue_Reset(&this->animTaskQueue);
Cutscene_InitContext(this, &this->csCtx);

if (gSaveContext.nextCutsceneIndex != 0xFFEF) {
if (gSaveContext.nextCutsceneIndex != CS_INDEX_NEXT_EMPTY) {
gSaveContext.save.cutsceneIndex = gSaveContext.nextCutsceneIndex;
gSaveContext.nextCutsceneIndex = 0xFFEF;
gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_EMPTY;
}

if (gSaveContext.save.cutsceneIndex == 0xFFFD) {
gSaveContext.save.cutsceneIndex = 0;
if (gSaveContext.save.cutsceneIndex == CS_INDEX_EMPTY) {
gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT;
}

if (gSaveContext.nextDayTime != NEXT_TIME_NONE) {
Expand All @@ -333,10 +332,10 @@ void Play_Init(GameState* thisx) {

Cutscene_HandleConditionalTriggers(this);

if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.save.cutsceneIndex >= 0xFFF0) {
if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.save.cutsceneIndex >= CS_INDEX_0) {
gSaveContext.nayrusLoveTimer = 0;
Magic_Reset(this);
gSaveContext.sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF);
gSaveContext.sceneLayer = GET_CUTSCENE_LAYER(gSaveContext.save.cutsceneIndex);
} else if (!LINK_IS_ADULT && IS_DAY) {
gSaveContext.sceneLayer = SCENE_LAYER_CHILD_DAY;
} else if (!LINK_IS_ADULT && !IS_DAY) {
Expand All @@ -354,13 +353,13 @@ void Play_Init(GameState* thisx) {
!IS_CUTSCENE_LAYER) {
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) &&
CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) {
gSaveContext.sceneLayer = 1;
gSaveContext.sceneLayer = SCENE_LAYER_CHILD_NIGHT;
} else {
gSaveContext.sceneLayer = 0;
gSaveContext.sceneLayer = SCENE_LAYER_CHILD_DAY;
}
} else if ((gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_KOKIRI_FOREST) &&
LINK_IS_ADULT && !IS_CUTSCENE_LAYER) {
gSaveContext.sceneLayer = GET_EVENTCHKINF(EVENTCHKINF_48) ? 3 : 2;
gSaveContext.sceneLayer = GET_EVENTCHKINF(EVENTCHKINF_48) ? SCENE_LAYER_ADULT_NIGHT : SCENE_LAYER_ADULT_DAY;
}

Play_SpawnScene(
Expand All @@ -373,7 +372,7 @@ void Play_Init(GameState* thisx) {
// When entering Gerudo Valley in the credits, trigger the GC emulator to play the ending movie.
// The emulator constantly checks whether PC is 0x81000000, so this works even though it's not a valid address.
if ((gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_GERUDO_VALLEY) &&
gSaveContext.sceneLayer == 6) {
gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) {
PRINTF(T("エンディングはじまるよー\n", "The ending starts\n"));
((void (*)(void))0x81000000)();
PRINTF(T("出戻り?\n", "Return?\n"));
Expand Down Expand Up @@ -586,7 +585,7 @@ void Play_Update(PlayState* this) {

Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);

if (gSaveContext.save.cutsceneIndex >= 0xFFF0) {
if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0) {
sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF);
}

Expand Down
16 changes: 8 additions & 8 deletions src/code/z_scene.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void Object_InitContext(PlayState* play, ObjectContext* objectCtx) {
if (play2->sceneId == SCENE_HYRULE_FIELD) {
spaceSize = 1000 * 1024 - OBJECT_SPACE_ADJUSTMENT;
} else if (play2->sceneId == SCENE_GANON_BOSS) {
if (gSaveContext.sceneLayer != 4) {
if (gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0)) {
spaceSize = 1150 * 1024 - OBJECT_SPACE_ADJUSTMENT;
} else {
spaceSize = 1000 * 1024 - OBJECT_SPACE_ADJUSTMENT;
Expand Down Expand Up @@ -382,7 +382,7 @@ BAD_RETURN(s32) Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) {
play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f;
play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f;

if (((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutsceneIndex < 0xFFF0)) ||
if (((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutsceneIndex < CS_INDEX_0)) ||
(gSaveContext.save.entranceIndex == ENTR_LAKE_HYLIA_8)) {
#if OOT_VERSION >= PAL_1_0
gSaveContext.skyboxTime = ((void)0, gSaveContext.save.dayTime);
Expand Down Expand Up @@ -445,7 +445,7 @@ BAD_RETURN(s32) Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd)
PRINTF("\n[ZU]sceneset time =[%X]", ((void)0, gSaveContext.save.cutsceneIndex));
PRINTF("\n[ZU]sceneset counter=[%X]", ((void)0, gSaveContext.sceneLayer));

if (gSaveContext.sceneLayer != 0) {
if (gSaveContext.sceneLayer != SCENE_LAYER_CHILD_DAY) {
SceneCmd* altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.data))[gSaveContext.sceneLayer - 1];

if (altHeader != NULL) {
Expand Down Expand Up @@ -488,7 +488,7 @@ BAD_RETURN(s32) Scene_CommandMiscSettings(PlayState* play, SceneCmd* cmd) {

if (((play->sceneId >= SCENE_HYRULE_FIELD) && (play->sceneId <= SCENE_OUTSIDE_GANONS_CASTLE)) ||
((play->sceneId >= SCENE_MARKET_ENTRANCE_DAY) && (play->sceneId <= SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS))) {
if (gSaveContext.save.cutsceneIndex < 0xFFF0) {
if (gSaveContext.save.cutsceneIndex < CS_INDEX_0) {
gSaveContext.save.info.worldMapAreaData |= gBitFlags[((void)0, gSaveContext.worldMapArea)];
PRINTF("000 area_arrival=%x (%d)\n", gSaveContext.save.info.worldMapAreaData,
((void)0, gSaveContext.worldMapArea));
Expand All @@ -501,15 +501,15 @@ void Scene_SetTransitionForNextEntrance(PlayState* play) {

if (!IS_DAY) {
if (!LINK_IS_ADULT) {
entranceIndex = play->nextEntranceIndex + 1;
entranceIndex = play->nextEntranceIndex + SCENE_LAYER_CHILD_NIGHT;
} else {
entranceIndex = play->nextEntranceIndex + 3;
entranceIndex = play->nextEntranceIndex + SCENE_LAYER_ADULT_NIGHT;
}
} else {
if (!LINK_IS_ADULT) {
entranceIndex = play->nextEntranceIndex;
entranceIndex = play->nextEntranceIndex + SCENE_LAYER_CHILD_DAY;
} else {
entranceIndex = play->nextEntranceIndex + 2;
entranceIndex = play->nextEntranceIndex + SCENE_LAYER_ADULT_DAY;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/code/z_sram.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,11 +793,11 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) {
gSaveContext.save.entranceIndex = ENTR_LINKS_HOUSE_0;
gSaveContext.save.linkAge = LINK_AGE_CHILD;
gSaveContext.save.dayTime = CLOCK_TIME(10, 0);
gSaveContext.save.cutsceneIndex = 0xFFF1;
gSaveContext.save.cutsceneIndex = CS_INDEX_1;

#if DEBUG_FEATURES
if (fileSelect->buttonIndex == 0) {
gSaveContext.save.cutsceneIndex = 0;
gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void BgInGate_Init(Actor* thisx, PlayState* play) {
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);

if ((play->sceneId != SCENE_LON_LON_RANCH || !LINK_IS_ADULT) ||
(GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (gSaveContext.save.cutsceneIndex != 0xFFF0))) {
(GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (gSaveContext.save.cutsceneIndex != CS_INDEX_0))) {
Actor_Kill(&this->dyna.actor);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void BgRelayObjects_Destroy(Actor* thisx, PlayState* play) {
BgRelayObjects* this = (BgRelayObjects*)thisx;

DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
if ((this->dyna.actor.params == WINDMILL_ROTATING_GEAR) && (gSaveContext.save.cutsceneIndex < 0xFFF0)) {
if ((this->dyna.actor.params == WINDMILL_ROTATING_GEAR) && (gSaveContext.save.cutsceneIndex < CS_INDEX_0)) {
CLEAR_EVENTCHKINF(EVENTCHKINF_65);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) {
this->actionFunc = BgSpot00Hanebasi_DoNothing;
Player_SetCsActionWithHaltedActors(play, &player->actor, PLAYER_CSACTION_8);
play->nextEntranceIndex = ENTR_HYRULE_FIELD_0;
gSaveContext.nextCutsceneIndex = 0xFFF1;
gSaveContext.nextCutsceneIndex = CS_INDEX_1;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_BLACK_FAST;
} else if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 3000.0f, 0x7530)) {
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) {
FALLTHROUGH;
case 20:
play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0;
gSaveContext.nextCutsceneIndex = 0xFFF2;
gSaveContext.nextCutsceneIndex = CS_INDEX_2;
play->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_FADE_WHITE;
play->linkAgeOnLoad = LINK_AGE_CHILD;
Expand Down
Loading