From afbc312024100187fa1169ca32723acd338ea85a Mon Sep 17 00:00:00 2001 From: fig02 Date: Sat, 30 Jul 2022 17:28:50 -0400 Subject: [PATCH] Rename "Scene Setup Index" to "Scene Layer" (#1300) * setup -> layer * IS_CUTSCENE_LAYER * review * backtick * remove some more mentions of setup * alt header block * clarifying comment --- include/functions.h | 6 +-- include/tables/entrance_table.h | 11 +++-- include/z64save.h | 12 ++++- include/z64scene.h | 2 +- src/code/z_demo.c | 11 ++--- src/code/z_horse.c | 2 +- src/code/z_kankyo.c | 6 +-- src/code/z_parameter.c | 6 +-- src/code/z_play.c | 47 ++++++++++--------- src/code/z_scene.c | 15 +++--- src/code/z_scene_table.c | 10 ++-- src/code/z_vr_box.c | 4 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 2 +- .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c | 2 +- .../ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c | 2 +- .../z_bg_spot00_hanebasi.c | 28 +++++------ .../ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c | 2 +- .../z_bg_spot01_idohashira.c | 6 +-- .../z_bg_spot06_objects.c | 4 +- .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 2 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c | 6 +-- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.c | 10 ++-- src/overlays/actors/ovl_Demo_Du/z_demo_du.c | 2 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 24 +++++----- src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c | 6 +-- src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c | 7 ++- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 4 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 2 +- src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 2 +- src/overlays/actors/ovl_En_Door/z_en_door.c | 6 +-- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 8 ++-- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 4 +- .../z_en_horse_link_child.c | 2 +- .../actors/ovl_En_Jsjutan/z_en_jsjutan.c | 2 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 2 +- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 2 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 2 +- src/overlays/actors/ovl_En_Rl/z_en_rl.c | 2 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 2 +- src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 2 +- src/overlays/actors/ovl_En_Tr/z_en_tr.c | 2 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 16 +++---- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 8 ++-- .../ovl_En_Yabusame_Mark/z_en_yabusame_mark.c | 2 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 2 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 2 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 4 +- .../actors/ovl_player_actor/z_player.c | 6 +-- .../gamestates/ovl_opening/z_opening.c | 2 +- 51 files changed, 169 insertions(+), 156 deletions(-) diff --git a/include/functions.h b/include/functions.h index 86462b887f..e7c5bb585b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2144,7 +2144,7 @@ void __osSiCreateAccessQueue(void); void __osSiGetAccess(void); void __osSiRelAccess(void); s32 osContInit(OSMesgQueue* mq, u8* ctlBitfield, OSContStatus* status); -void __osContGetInitData(u8* ctlBitfield, OSContStatus* status); +void __osContGetInitData(u8* ctlBitfield, OSContStatus* data); void __osPackRequestData(u8 poll); s32 osContStartReadData(OSMesgQueue* mq); void osContGetReadData(OSContPad* contData); @@ -2157,7 +2157,7 @@ void osSpTaskYield(void); s32 __osPfsGetNextPage(OSPfs* pfs, u8* bank, __OSInode* inode, __OSInodeUnit* page); s32 osPfsReadWriteFile(OSPfs* pfs, s32 fileNo, u8 flag, s32 offset, s32 size, u8* data); s32 __osPfsGetStatus(OSMesgQueue* queue, s32 channel); -void __osPfsRequestOneChannel(s32 channel, u8 poll); +void __osPfsRequestOneChannel(s32 channel, u8 cmd); void __osPfsGetOneChannelData(s32 channel, OSContStatus* contData); void guMtxIdentF(f32 mf[4][4]); void guLookAtF(f32 mf[4][4], f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp); @@ -2204,7 +2204,7 @@ f32 cosf(f32); s16 coss(u16); void osViSetEvent(OSMesgQueue* mq, OSMesg msg, u32 retraceCount); s32 osPfsIsPlug(OSMesgQueue* mq, u8* pattern); -void __osPfsRequestData(u8 poll); +void __osPfsRequestData(u8 cmd); void __osPfsGetInitData(u8* pattern, OSContStatus* contData); void guS2DInitBg(uObjBg* bg); s32 __osPfsSelectBank(OSPfs* pfs, u8 bank); diff --git a/include/tables/entrance_table.h b/include/tables/entrance_table.h index 09c1c8835b..17abdad340 100644 --- a/include/tables/entrance_table.h +++ b/include/tables/entrance_table.h @@ -6,15 +6,18 @@ * - Argument 2: Scene this entrance belongs to * - Argument 3: Spawn number for this entrance * - Argument 4: Toggle if bgm should continue during the transition using this entrance (true or false) + * NOTE: For non-cutscene layers, this field is only read from the `SCENE_LAYER_CHILD_DAY` layer. + * Meaning, the setting only matters for the first entry within a group of layers and that + * setting will apply to the other 3 non-cutscene layers. * - Argument 5: Toggle if a title card should display when using this entrance (true or false) * - Argument 6: Transition type when entering using this entrance (second half of a scene transition) * - Argument 7: Transition type when exiting using this entrance (first half of a scene transition) * - * WARNING: Due to how the entrance system is implemented, entries within the same group of scene setups are NOT shiftable. - * Groups of scene setups are indicated by line breaks. + * WARNING: Due to how the entrance system is implemented, entries within the same group of scene layers are NOT shiftable. + * Groups of scene layers are indicated by line breaks. * - * Only the first entrance within a group of setups is expected to be referenced in code. - * The entrance system will apply the offset on its own to access the correct entrance for a given setup. + * Only the first entrance within a group of layers is expected to be referenced in code. + * The entrance system will apply the offset on its own to access the correct entrance for a given layer. */ /* 0x000 */ DEFINE_ENTRANCE(ENTR_YDAN_0, SCENE_YDAN, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) /* 0x001 */ DEFINE_ENTRANCE(ENTR_YDAN_0_1, SCENE_YDAN, 0, false, true, TRANS_TYPE_FADE_BLACK, TRANS_TYPE_FADE_BLACK) diff --git a/include/z64save.h b/include/z64save.h index 3ebda2ece2..c79378221e 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -154,7 +154,7 @@ typedef struct { /* 0x1354 */ s32 fileNum; // "file_no" /* 0x1358 */ char unk_1358[0x0004]; /* 0x135C */ s32 gameMode; - /* 0x1360 */ s32 sceneSetupIndex; + /* 0x1360 */ s32 sceneLayer; // "counter" /* 0x1364 */ s32 respawnFlag; // "restart_flag" /* 0x1368 */ RespawnData respawn[RESPAWN_MODE_MAX]; // "restart_data" /* 0x13BC */ f32 entranceSpeed; @@ -252,6 +252,16 @@ typedef enum { /* 3 */ GAMEMODE_END_CREDITS } GameMode; +typedef enum { + /* 0 */ SCENE_LAYER_CHILD_DAY, + /* 1 */ SCENE_LAYER_CHILD_NIGHT, + /* 2 */ SCENE_LAYER_ADULT_DAY, + /* 3 */ SCENE_LAYER_ADULT_NIGHT, + /* 4 */ SCENE_LAYER_CUTSCENE_FIRST +} SceneLayer; + +#define IS_CUTSCENE_LAYER (gSaveContext.sceneLayer >= SCENE_LAYER_CUTSCENE_FIRST) + typedef enum { /* 0 */ LINK_AGE_ADULT, /* 1 */ LINK_AGE_CHILD diff --git a/include/z64scene.h b/include/z64scene.h index 688d16a82b..3c5afdf875 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -459,7 +459,7 @@ typedef enum { #define SCENE_CAM_TYPE_FIXED_TOGGLE_VIEWPOINT 0x20 // Camera exhibits fixed behaviors and viewpoint can be toggled with c-up #define SCENE_CAM_TYPE_FIXED 0x30 // Camera exhibits fixed behaviors (see `Play_CamIsNotFixed` usages for examples) #define SCENE_CAM_TYPE_FIXED_MARKET 0x40 // Camera exhibits fixed behaviors and delays textboxes by a small amount before they start to appear -#define SCENE_CAM_TYPE_SHOOTING_GALLERY 0x50 // Unreferenced in code, and set only by the main setup of the shooting gallery scene +#define SCENE_CAM_TYPE_SHOOTING_GALLERY 0x50 // Unreferenced in code, and used only by the main layer of the shooting gallery scene // Scene commands diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 794cade65b..9f4b21ddee 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -150,15 +150,14 @@ void func_80064558(PlayState* play, CutsceneContext* csCtx) { void func_800645A0(PlayState* play, CutsceneContext* csCtx) { Input* input = &play->state.input[0]; - if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && - (gSaveContext.sceneSetupIndex >= 4)) { + if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) { D_8015FCC8 = 0; gSaveContext.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; } - if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && - (gSaveContext.sceneSetupIndex >= 4) && !gDbgCamEnabled) { + if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER && + !gDbgCamEnabled) { D_8015FCC8 = 1; gSaveContext.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; @@ -568,7 +567,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB gSaveContext.cutsceneIndex = 0xFFF3; play->transitionType = TRANS_TYPE_INSTANT; } else { - if (gSaveContext.sceneSetupIndex < 4) { + if (!IS_CUTSCENE_LAYER) { if (!LINK_IS_ADULT) { play->linkAgeOnLoad = LINK_AGE_ADULT; } else { @@ -1021,7 +1020,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB gSaveContext.cutsceneIndex = 0xFFF3; play->transitionType = TRANS_TYPE_FADE_BLACK; } else { - switch (gSaveContext.sceneSetupIndex) { + switch (gSaveContext.sceneLayer) { case 8: play->nextEntranceIndex = ENTR_SPOT05_0; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 0a0186a561..49a021cdec 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -247,7 +247,7 @@ void func_8006DC68(PlayState* play, Player* player) { } if (func_8006CFC0(play->sceneNum)) { - if ((gSaveContext.sceneSetupIndex > 3) || + if (IS_CUTSCENE_LAYER || ((gSaveContext.entranceIndex == ENTR_SPOT00_11 || gSaveContext.entranceIndex == ENTR_SPOT00_12 || gSaveContext.entranceIndex == ENTR_SPOT00_13 || gSaveContext.entranceIndex == ENTR_SPOT00_15) && (gSaveContext.respawnFlag == 0)) || diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index e5ba7904eb..9457cf7d61 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -347,7 +347,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) play->envCtx.precipitation[PRECIP_SOS_MAX] = 0; if (gSaveContext.retainWeatherMode) { - if (((void)0, gSaveContext.sceneSetupIndex) < 4) { + if (!IS_CUTSCENE_LAYER) { switch (gWeatherMode) { case WEATHER_MODE_CLOUDY_CONFIG3: envCtx->skyboxConfig = 1; @@ -934,7 +934,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex } //! @bug `gTimeSpeed` is unsigned, it can't be negative - if (((((void)0, gSaveContext.sceneSetupIndex) >= 5 || gTimeSpeed != 0) && + if (((((void)0, gSaveContext.sceneLayer) >= 5 || gTimeSpeed != 0) && ((void)0, gSaveContext.dayTime) > gSaveContext.skyboxTime) || (((void)0, gSaveContext.dayTime) < CLOCK_TIME(1, 0) || gTimeSpeed < 0)) { @@ -1387,7 +1387,7 @@ void Environment_DrawSunAndMoon(PlayState* play) { play->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; } - if (gSaveContext.entranceIndex != ENTR_SPOT00_0 || ((void)0, gSaveContext.sceneSetupIndex) != 5) { + if (gSaveContext.entranceIndex != ENTR_SPOT00_0 || ((void)0, gSaveContext.sceneLayer) != 5) { Matrix_Translate(play->view.eye.x + play->envCtx.sunPos.x, play->view.eye.y + play->envCtx.sunPos.y, play->view.eye.z + play->envCtx.sunPos.z, MTXMODE_NEW); diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 30d3348d46..5eb16c94d0 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2439,7 +2439,7 @@ void Magic_Update(PlayState* play) { // Add magic until magicFillTarget is reached gSaveContext.magic += 4; - if (gSaveContext.gameMode == GAMEMODE_NORMAL && gSaveContext.sceneSetupIndex < 4) { + if (gSaveContext.gameMode == GAMEMODE_NORMAL && !IS_CUTSCENE_LAYER) { Audio_PlaySfxGeneral(NA_SE_SY_GAUGE_UP - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } @@ -3889,8 +3889,8 @@ void Interface_Update(PlayState* play) { } if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { - if ((gSaveContext.minigameState == 1) || (gSaveContext.sceneSetupIndex < 4) || - ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex == 4))) { + if ((gSaveContext.minigameState == 1) || !IS_CUTSCENE_LAYER || + ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneLayer == 4))) { if ((msgCtx->msgMode == MSGMODE_NONE) || ((msgCtx->msgMode != MSGMODE_NONE) && (play->sceneNum == SCENE_BOWLING))) { if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { diff --git a/src/code/z_play.c b/src/code/z_play.c index 7a2bd4e52f..a9e82de442 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -222,7 +222,7 @@ void Play_Init(GameState* thisx) { Player* player; s32 playerStartBgCamIndex; s32 i; - u8 tempSetupIndex; + u8 baseSceneLayer; s32 pad[2]; if (gSaveContext.entranceIndex == ENTR_LOAD_OPENING) { @@ -291,41 +291,42 @@ void Play_Init(GameState* thisx) { if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.cutsceneIndex >= 0xFFF0) { gSaveContext.nayrusLoveTimer = 0; Magic_Reset(this); - gSaveContext.sceneSetupIndex = (gSaveContext.cutsceneIndex & 0xF) + 4; + gSaveContext.sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF); } else if (!LINK_IS_ADULT && IS_DAY) { - gSaveContext.sceneSetupIndex = 0; + gSaveContext.sceneLayer = SCENE_LAYER_CHILD_DAY; } else if (!LINK_IS_ADULT && !IS_DAY) { - gSaveContext.sceneSetupIndex = 1; + gSaveContext.sceneLayer = SCENE_LAYER_CHILD_NIGHT; } else if (LINK_IS_ADULT && IS_DAY) { - gSaveContext.sceneSetupIndex = 2; + gSaveContext.sceneLayer = SCENE_LAYER_ADULT_DAY; } else { - gSaveContext.sceneSetupIndex = 3; + gSaveContext.sceneLayer = SCENE_LAYER_ADULT_NIGHT; } - tempSetupIndex = gSaveContext.sceneSetupIndex; + // save the base scene layer (before accounting for the special cases below) to use later for the transition type + baseSceneLayer = gSaveContext.sceneLayer; + if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT00) && !LINK_IS_ADULT && - gSaveContext.sceneSetupIndex < 4) { + !IS_CUTSCENE_LAYER) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) { - gSaveContext.sceneSetupIndex = 1; + gSaveContext.sceneLayer = 1; } else { - gSaveContext.sceneSetupIndex = 0; + gSaveContext.sceneLayer = 0; } } else if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT04) && LINK_IS_ADULT && - gSaveContext.sceneSetupIndex < 4) { - gSaveContext.sceneSetupIndex = GET_EVENTCHKINF(EVENTCHKINF_48) ? 3 : 2; + !IS_CUTSCENE_LAYER) { + gSaveContext.sceneLayer = GET_EVENTCHKINF(EVENTCHKINF_48) ? 3 : 2; } - Play_SpawnScene( - this, gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].scene, - gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].spawn); + Play_SpawnScene(this, + gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].scene, + gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].spawn); - osSyncPrintf("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.entranceIndex), gSaveContext.sceneSetupIndex); + osSyncPrintf("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.entranceIndex), gSaveContext.sceneLayer); - // When entering Gerudo Valley in the right setup, trigger the GC emulator to play the ending movie. + // 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.entranceIndex)].scene == SCENE_SPOT09) && - gSaveContext.sceneSetupIndex == 6) { + if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT09) && gSaveContext.sceneLayer == 6) { osSyncPrintf("エンディングはじまるよー\n"); // "The ending starts" ((void (*)(void))0x81000000)(); osSyncPrintf("出戻り?\n"); // "Return?" @@ -372,7 +373,7 @@ void Play_Init(GameState* thisx) { if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) { if (gSaveContext.nextTransitionType == TRANS_NEXT_TYPE_DEFAULT) { this->transitionType = ENTRANCE_INFO_END_TRANS_TYPE( - gEntranceTable[((void)0, gSaveContext.entranceIndex) + tempSetupIndex].field); + gEntranceTable[((void)0, gSaveContext.entranceIndex) + baseSceneLayer].field); } else { this->transitionType = gSaveContext.nextTransitionType; gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; @@ -504,16 +505,16 @@ void Play_Update(PlayState* this) { switch (this->transitionMode) { case TRANS_MODE_SETUP: if (this->transitionTrigger != TRANS_TRIGGER_END) { - s16 sceneSetupIndex = 0; + s16 sceneLayer = SCENE_LAYER_CHILD_DAY; Interface_ChangeAlpha(1); if (gSaveContext.cutsceneIndex >= 0xFFF0) { - sceneSetupIndex = (gSaveContext.cutsceneIndex & 0xF) + 4; + sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF); } // fade out bgm if "continue bgm" flag is not set - if (!(gEntranceTable[this->nextEntranceIndex + sceneSetupIndex].field & + if (!(gEntranceTable[this->nextEntranceIndex + sceneLayer].field & ENTRANCE_INFO_CONTINUE_BGM_FLAG)) { // "Sound initalized. 111" osSyncPrintf("\n\n\nサウンドイニシャル来ました。111"); diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 1e82f2d5d7..1b360385c2 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -41,7 +41,7 @@ void Object_InitBank(PlayState* play, ObjectContext* objectCtx) { if (play2->sceneNum == SCENE_SPOT00) { spaceSize = 1024000; } else if (play2->sceneNum == SCENE_GANON_DEMO) { - if (gSaveContext.sceneSetupIndex != 4) { + if (gSaveContext.sceneLayer != 4) { spaceSize = 1177600; } else { spaceSize = 1024000; @@ -411,10 +411,10 @@ void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) { osSyncPrintf("\n[ZU]sceneset age =[%X]", ((void)0, gSaveContext.linkAge)); osSyncPrintf("\n[ZU]sceneset time =[%X]", ((void)0, gSaveContext.cutsceneIndex)); - osSyncPrintf("\n[ZU]sceneset counter=[%X]", ((void)0, gSaveContext.sceneSetupIndex)); + osSyncPrintf("\n[ZU]sceneset counter=[%X]", ((void)0, gSaveContext.sceneLayer)); - if (gSaveContext.sceneSetupIndex != 0) { - altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.data))[gSaveContext.sceneSetupIndex - 1]; + if (gSaveContext.sceneLayer != 0) { + altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.data))[gSaveContext.sceneLayer - 1]; if (1) {} @@ -425,8 +425,11 @@ void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) { // "Coughh! There is no specified dataaaaa!" osSyncPrintf("\nげぼはっ! 指定されたデータがないでええっす!"); - if (gSaveContext.sceneSetupIndex == 3) { - altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.data))[gSaveContext.sceneSetupIndex - 2]; + if (gSaveContext.sceneLayer == SCENE_LAYER_ADULT_NIGHT) { + // Due to the condition above, this is equivalent to accessing altHeaders[SCENE_LAYER_ADULT_DAY - 1] + altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL( + cmd->altHeaders + .data))[(gSaveContext.sceneLayer - SCENE_LAYER_ADULT_NIGHT) + SCENE_LAYER_ADULT_DAY - 1]; // "Using adult day data there!" osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!"); diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 91fc9d360c..6580f81728 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -238,7 +238,7 @@ void Scene_DrawConfigTokinoma(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5145); - if (gSaveContext.sceneSetupIndex == 5) { + if (gSaveContext.sceneLayer == 5) { gCustomLensFlareOn = true; gCustomLensFlarePos.x = -20.0f; gCustomLensFlarePos.y = 1220.0f; @@ -1056,11 +1056,11 @@ void Scene_DrawConfigSpot04(PlayState* play) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - if (gSaveContext.sceneSetupIndex == 4) { + if (gSaveContext.sceneLayer == 4) { spA3 = 255 - (u8)play->roomCtx.unk_74[0]; - } else if (gSaveContext.sceneSetupIndex == 6) { + } else if (gSaveContext.sceneLayer == 6) { spA0 = play->roomCtx.unk_74[0] + 500; - } else if (((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) && GET_EVENTCHKINF(EVENTCHKINF_07)) { + } else if ((!IS_CUTSCENE_LAYER || LINK_IS_ADULT) && GET_EVENTCHKINF(EVENTCHKINF_07)) { spA0 = 2150; } @@ -1087,7 +1087,7 @@ void Scene_DrawConfigSpot06(PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7058); - if ((gSaveContext.sceneSetupIndex > 3) || (LINK_IS_ADULT && !GET_EVENTCHKINF(EVENTCHKINF_69))) { + if (IS_CUTSCENE_LAYER || (LINK_IS_ADULT && !GET_EVENTCHKINF(EVENTCHKINF_69))) { play->roomCtx.unk_74[0] = 87; } diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index ff88ed5049..707acea2b3 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -381,8 +381,8 @@ void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) { switch (skyboxId) { case SKYBOX_NORMAL_SKY: skyboxConfig = 0; - if (gSaveContext.retainWeatherMode && gSaveContext.sceneSetupIndex < 4 && - gWeatherMode > WEATHER_MODE_CLEAR && gWeatherMode <= WEATHER_MODE_HEAVY_RAIN) { + if (gSaveContext.retainWeatherMode && !IS_CUTSCENE_LAYER && gWeatherMode > WEATHER_MODE_CLEAR && + gWeatherMode <= WEATHER_MODE_HEAVY_RAIN) { skyboxConfig = 1; } diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 02668fa0a5..d679375ebc 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -252,7 +252,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { } if (givingReward) { - if (gSaveContext.sceneSetupIndex < 4) { + if (!IS_CUTSCENE_LAYER) { if (play->sceneNum != SCENE_DAIYOUSEI_IZUMI) { switch (this->fountainType) { case FAIRY_SPELL_FARORES_WIND: diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index 6815631d60..a90c1b49db 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -228,7 +228,7 @@ void BgHidanCurtain_Update(Actor* thisx, PlayState* play2) { this->collider.dim.height = hcParams->height * riseProgress; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if (gSaveContext.sceneSetupIndex <= 3) { + if (!IS_CUTSCENE_LAYER) { func_8002F974(&this->actor, NA_SE_EV_FIRE_PILLAR_S - SFX_FLAG); } } else if ((this->type == 1) && Flags_GetTreasure(play, this->treasureFlag)) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index 7e5c9cb5d9..f44f1d2308 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -235,7 +235,7 @@ void BgHidanFwbig_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((this->actor.home.pos.y - 200.0f) < this->actor.world.pos.y) { - if (gSaveContext.sceneSetupIndex < 4) { + if (!IS_CUTSCENE_LAYER) { func_8002F974(&this->actor, NA_SE_EV_BURNING - SFX_FLAG); } else if ((s16)this->actor.world.pos.x == -513) { func_8002F974(&this->actor, NA_SE_EV_FLAME_OF_FIRE - SFX_FLAG); diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 2175d76b5f..62c119924a 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -64,20 +64,19 @@ void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.actor.params == DT_DRAWBRIDGE) { - if (LINK_IS_ADULT && (gSaveContext.sceneSetupIndex < 4)) { + if (LINK_IS_ADULT && !IS_CUTSCENE_LAYER) { Actor_Kill(&this->dyna.actor); return; } - if ((gSaveContext.sceneSetupIndex != 6) && - ((gSaveContext.sceneSetupIndex == 4) || (gSaveContext.sceneSetupIndex == 5) || - (!LINK_IS_ADULT && !IS_DAY))) { + if ((gSaveContext.sceneLayer != 6) && + ((gSaveContext.sceneLayer == 4) || (gSaveContext.sceneLayer == 5) || (!LINK_IS_ADULT && !IS_DAY))) { this->dyna.actor.shape.rot.x = -0x4000; } else { this->dyna.actor.shape.rot.x = 0; } - if (gSaveContext.sceneSetupIndex != 6) { + if (gSaveContext.sceneLayer != 6) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !GET_EVENTCHKINF(EVENTCHKINF_80)) { this->dyna.actor.shape.rot.x = -0x4000; @@ -138,11 +137,10 @@ void BgSpot00Hanebasi_Destroy(Actor* thisx, PlayState* play) { void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) { BgSpot00Hanebasi* child = (BgSpot00Hanebasi*)this->dyna.actor.child; - if ((gSaveContext.sceneSetupIndex >= 4) || !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) || - !CHECK_QUEST_ITEM(QUEST_GORON_RUBY) || !CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) || - GET_EVENTCHKINF(EVENTCHKINF_80)) { + if (IS_CUTSCENE_LAYER || !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) || !CHECK_QUEST_ITEM(QUEST_GORON_RUBY) || + !CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) || GET_EVENTCHKINF(EVENTCHKINF_80)) { if (this->dyna.actor.shape.rot.x != 0) { - if (Flags_GetEnv(play, 0) || ((gSaveContext.sceneSetupIndex < 4) && IS_DAY)) { + if (Flags_GetEnv(play, 0) || (!IS_CUTSCENE_LAYER && IS_DAY)) { this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; this->destAngle = 0; child->destAngle = 0; @@ -151,7 +149,7 @@ void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) { if (this) {} // required to match } - if ((this->dyna.actor.shape.rot.x == 0) && (gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT && !IS_DAY) { + if ((this->dyna.actor.shape.rot.x == 0) && !IS_CUTSCENE_LAYER && !LINK_IS_ADULT && !IS_DAY) { this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; this->destAngle = -0x4000; child->destAngle = -0xFE0; @@ -231,7 +229,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { } } - if (gSaveContext.sceneSetupIndex == 5) { + if (gSaveContext.sceneLayer == 5) { u16 dayTime; s32 tmp; @@ -247,7 +245,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { dayTime = gSaveContext.dayTime; - if ((dayTime > CLOCK_TIME(4, 0)) && (dayTime < CLOCK_TIME(4, 30)) && (gSaveContext.sceneSetupIndex == 5)) { + if ((dayTime > CLOCK_TIME(4, 0)) && (dayTime < CLOCK_TIME(4, 30)) && (gSaveContext.sceneLayer == 5)) { gTimeSpeed = 0; } } @@ -263,7 +261,7 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, PlayState* play2) { Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (gSaveContext.sceneSetupIndex >= 4) { + if (IS_CUTSCENE_LAYER) { sTorchFlameScale = 0.008f; } else { sTorchFlameScale = ((thisx->shape.rot.x * -1) - 0x2000) * (1.0f / 1024000.0f); @@ -315,8 +313,8 @@ void BgSpot00Hanebasi_Draw(Actor* thisx, PlayState* play) { thisx->child->child->world.pos.y = newPos.y; thisx->child->child->world.pos.z = newPos.z; - if (gSaveContext.sceneSetupIndex != 12) { - if ((gSaveContext.sceneSetupIndex >= 4) || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) { + if (gSaveContext.sceneLayer != 12) { + if (IS_CUTSCENE_LAYER || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) { BgSpot00Hanebasi_DrawTorches(thisx, play); } else { sTorchFlameScale = 0.0f; diff --git a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c index aa93672c9b..6a8933a59e 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c @@ -46,7 +46,7 @@ void BgSpot01Fusya_Init(Actor* thisx, PlayState* play) { this->unk_154 = 100.0f; this->unk_158 = 100.0f; this->unk_15C = 0.5f; - if (gSaveContext.sceneSetupIndex < 4) { + if (!IS_CUTSCENE_LAYER) { CLEAR_EVENTCHKINF(EVENTCHKINF_65); } BgSpot01Fusya_SetupAction(this, func_808AAA50); diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c index 05f85bccf0..2f76005a76 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c @@ -300,16 +300,16 @@ void BgSpot01Idohashira_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&gKakarikoWellArchCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (gSaveContext.sceneSetupIndex < 4) { + if (!IS_CUTSCENE_LAYER) { if (GET_EVENTCHKINF(EVENTCHKINF_54) && LINK_IS_ADULT) { Actor_Kill(&this->dyna.actor); } else { this->action = 0; } - } else if (gSaveContext.sceneSetupIndex == 4) { + } else if (gSaveContext.sceneLayer == 4) { this->action = 1; this->dyna.actor.shape.yOffset = -(kREG(10) + 1100.0f); - } else if (gSaveContext.sceneSetupIndex == 6) { + } else if (gSaveContext.sceneLayer == 6) { this->action = 0; } else { Actor_Kill(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index 6622193c9c..8ea8fd1a73 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -150,7 +150,7 @@ void BgSpot06Objects_Init(Actor* thisx, PlayState* play) { thisx->flags = ACTOR_FLAG_4 | ACTOR_FLAG_5; if (LINK_IS_ADULT && !GET_EVENTCHKINF(EVENTCHKINF_69)) { - if (gSaveContext.sceneSetupIndex < 4) { + if (!IS_CUTSCENE_LAYER) { this->lakeHyliaWaterLevel = -681.0f; play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface = WATER_LEVEL_RIVER_LOWERED; @@ -445,7 +445,7 @@ void BgSpot06Objects_DrawLakeHyliaWater(BgSpot06Objects* this, PlayState* play) gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128); - if ((this->lakeHyliaWaterLevel < -680.0f) && (gSaveContext.sceneSetupIndex < 4)) { + if ((this->lakeHyliaWaterLevel < -680.0f) && !IS_CUTSCENE_LAYER) { gSPDisplayList(POLY_XLU_DISP++, gLakeHyliaLowWaterDL); } else { gSPDisplayList(POLY_XLU_DISP++, gLakeHyliaHighWaterDL); diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index 19de02b588..3b9dcf8f40 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -59,7 +59,7 @@ static Gfx* sDLists[] = { s32 func_808B1AE0(BgSpot09Obj* this, PlayState* play) { s32 carpentersRescued; - if (gSaveContext.sceneSetupIndex >= 4) { + if (IS_CUTSCENE_LAYER) { return this->dyna.actor.params == 0; } diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index 62418a6287..96d8cc302d 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -76,7 +76,7 @@ void BgTokiSwd_Init(Actor* thisx, PlayState* play) { this->actor.draw = NULL; } - if (gSaveContext.sceneSetupIndex == 5) { + if (gSaveContext.sceneLayer == 5) { play->roomCtx.unk_74[0] = 0xFF; } @@ -93,7 +93,7 @@ void BgTokiSwd_Destroy(Actor* thisx, PlayState* play) { } void func_808BAF40(BgTokiSwd* this, PlayState* play) { - if (!GET_EVENTCHKINF(EVENTCHKINF_4F) && (gSaveContext.sceneSetupIndex < 4) && + if (!GET_EVENTCHKINF(EVENTCHKINF_4F) && !IS_CUTSCENE_LAYER && Actor_IsFacingAndNearPlayer(&this->actor, 800.0f, 0x7530) && !Play_InCsMode(play)) { SET_EVENTCHKINF(EVENTCHKINF_4F); play->csCtx.segment = D_808BBD90; @@ -118,7 +118,7 @@ void func_808BAF40(BgTokiSwd* this, PlayState* play) { } } } - if (gSaveContext.sceneSetupIndex == 5) { + if (gSaveContext.sceneLayer == 5) { if (play->roomCtx.unk_74[0] > 0) { play->roomCtx.unk_74[0]--; } else { diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index dd1e249a58..63d3fe9f2a 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -70,9 +70,9 @@ void BgTreemouth_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); Actor_SetFocus(thisx, 50.0f); - if ((gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT) { + if (!IS_CUTSCENE_LAYER && !LINK_IS_ADULT) { BgTreemouth_SetupAction(this, func_808BC8B8); - } else if (LINK_IS_ADULT || (gSaveContext.sceneSetupIndex == 7)) { + } else if (LINK_IS_ADULT || (gSaveContext.sceneLayer == 7)) { this->unk_168 = 0.0f; BgTreemouth_SetupAction(this, BgTreemouth_DoNothing); } else { @@ -115,7 +115,7 @@ void func_808BC6F8(BgTreemouth* this, PlayState* play) { this->unk_168 = 1.0f; } - if ((gSaveContext.sceneSetupIndex == 6) && (play->csCtx.frames >= 0x2BD) && (play->state.frames % 8 == 0)) { + if ((gSaveContext.sceneLayer == 6) && (play->csCtx.frames >= 0x2BD) && (play->state.frames % 8 == 0)) { sp34.x = (Rand_ZeroOne() * 1158.0f) + 3407.0f; sp34.y = 970.0f; sp34.z = (Rand_ZeroOne() * 2026.0f) + -2163.0f; @@ -232,14 +232,14 @@ void BgTreemouth_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - if ((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) { + if (!IS_CUTSCENE_LAYER || LINK_IS_ADULT) { if (GET_EVENTCHKINF(EVENTCHKINF_07)) { alpha = 2150; } } else { // neeeded to match } - if (gSaveContext.sceneSetupIndex == 6) { + if (gSaveContext.sceneLayer == 6) { alpha = (play->roomCtx.unk_74[0] + 0x1F4); } diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index f9e253ea51..925c62b133 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -194,7 +194,7 @@ void func_80969FB4(DemoDu* this, PlayState* play) { void DemoDu_CsFireMedallion_AdvanceTo01(DemoDu* this, PlayState* play) { s32 pad[2]; - if ((gSaveContext.chamberCutsceneNum == 1) && (gSaveContext.sceneSetupIndex < 4)) { + if ((gSaveContext.chamberCutsceneNum == 1) && !IS_CUTSCENE_LAYER) { Player* player = GET_PLAYER(play); this->updateIndex = CS_FIREMEDALLION_SUBSCENE(1); diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 5168c3a293..b14f228626 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -696,7 +696,7 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { } else { Actor_SetScale(&this->actor, 84 * 0.001f); } - } else if (gSaveContext.sceneSetupIndex == 5 || gSaveContext.sceneSetupIndex == 4 || + } else if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 4 || (gSaveContext.entranceIndex == ENTR_TOKINOMA_4 && !GET_EVENTCHKINF(EVENTCHKINF_C9))) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 59.0f, 0.0f); SkelCurve_Update(play, &this->skelCurve); @@ -852,7 +852,7 @@ void DemoEffect_UpdateTriforceSpot(DemoEffect* this, PlayState* play) { } } - if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0 && gSaveContext.sceneSetupIndex == 6 && + if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0 && gSaveContext.sceneLayer == 6 && play->csCtx.frames == 143) { Audio_PlayActorSfx2(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); } @@ -1068,11 +1068,11 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { break; } - if (play->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 6 && play->csCtx.frames == 197) { + if (play->sceneNum == SCENE_SPOT04 && gSaveContext.sceneLayer == 6 && play->csCtx.frames == 197) { Audio_PlayActorSfx2(&this->actor, NA_SE_EV_WHITE_OUT); } - if (play->sceneNum == SCENE_SPOT16 && gSaveContext.sceneSetupIndex == 5) { + if (play->sceneNum == SCENE_SPOT16 && gSaveContext.sceneLayer == 5) { if (!DemoEffect_CheckCsAction(this, play, 1)) { Audio_PlayActorSfx2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } @@ -1083,7 +1083,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { if (0) {} } - if (play->sceneNum == SCENE_SPOT08 && gSaveContext.sceneSetupIndex == 4) { + if (play->sceneNum == SCENE_SPOT08 && gSaveContext.sceneLayer == 4) { if (!DemoEffect_CheckCsAction(this, play, 1)) { Audio_PlayActorSfx2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } @@ -1095,7 +1095,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { if (0) {} } - if (play->sceneNum == SCENE_TOKINOMA && gSaveContext.sceneSetupIndex == 14) { + if (play->sceneNum == SCENE_TOKINOMA && gSaveContext.sceneLayer == 14) { if (1) {} if (play->csCtx.npcActions[this->csActionId]->action == 2) { @@ -1152,7 +1152,7 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play) { } if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { - switch (gSaveContext.sceneSetupIndex) { + switch (gSaveContext.sceneLayer) { case 4: if (play->csCtx.frames == 288) { Audio_PlayActorSfx2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); @@ -1207,7 +1207,7 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) { } if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { - switch (gSaveContext.sceneSetupIndex) { + switch (gSaveContext.sceneLayer) { case 4: if (play->csCtx.frames == 298) { Audio_PlayActorSfx2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); @@ -1228,7 +1228,7 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) { } } - if (gSaveContext.entranceIndex == ENTR_SPOT16_0 && gSaveContext.sceneSetupIndex == 4) { + if (gSaveContext.entranceIndex == ENTR_SPOT16_0 && gSaveContext.sceneLayer == 4) { if (play->csCtx.frames == 72) { Audio_PlayActorSfx2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } @@ -1267,7 +1267,7 @@ void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, PlayState* play) { } if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { - switch (gSaveContext.sceneSetupIndex) { + switch (gSaveContext.sceneLayer) { case 4: if (play->csCtx.frames == 315) { Audio_PlayActorSfx2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); @@ -1802,7 +1802,7 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) { if (!DemoEffect_CheckCsAction(this, play, 2)) { if (gSaveContext.entranceIndex == ENTR_HIRAL_DEMO_0) { - if (gSaveContext.sceneSetupIndex == 4) { + if (gSaveContext.sceneLayer == 4) { if (play->csCtx.frames <= 680) { func_80078914(&this->actor.projectedPos, NA_SE_EV_GOD_FLYING - SFX_FLAG); } @@ -2071,7 +2071,7 @@ void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) { u8 effectType = (this->actor.params & 0x00FF); if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL || - Flags_GetEnv(play, 1) || gSaveContext.sceneSetupIndex >= 4 || gSaveContext.entranceIndex == ENTR_TOKINOMA_4) { + Flags_GetEnv(play, 1) || IS_CUTSCENE_LAYER || gSaveContext.entranceIndex == ENTR_TOKINOMA_4) { OPEN_DISPS(gfxCtx, "../z_demo_effect.c", 3201); POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_25); diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index d8e7b8eee5..66b6f45de2 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -202,8 +202,8 @@ void DemoGj_Explode(DemoGj* this, PlayState* play, Vec3f* initialPos, Vec3f* dir DemoGj_PlayExplosionSfx(this, play); } -s32 DemoGj_IsSceneInvalid(void) { - if (gSaveContext.sceneSetupIndex < 4) { +s32 DemoGj_IsCutsceneLayer(void) { + if (!IS_CUTSCENE_LAYER) { return false; } return true; @@ -252,7 +252,7 @@ void DemoGj_InitCommon(DemoGj* this, PlayState* play, CollisionHeader* header) { // TODO: find a better name s32 DemoGj_InitSetIndices(DemoGj* this, PlayState* play, s32 updateMode, s32 drawConfig, CollisionHeader* header) { - if (!DemoGj_IsSceneInvalid()) { + if (!DemoGj_IsCutsceneLayer()) { this->updateMode = updateMode; this->drawConfig = drawConfig; DemoGj_InitCommon(this, play, header); diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index 071b8821eb..a1c1dd14db 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -435,10 +435,10 @@ void func_8097ED64(DemoGt* this, PlayState* play, s32 actionIdx) { func_8097E824(this, actionIdx); } -u8 func_8097ED94(void) { +u8 DemoGt_IsCutsceneLayer(void) { if (kREG(2) != 0) { return true; - } else if (gSaveContext.sceneSetupIndex < 4) { + } else if (!IS_CUTSCENE_LAYER) { return false; } else { return true; @@ -463,8 +463,7 @@ void func_8097EDD8(DemoGt* this, PlayState* play, CollisionHeader* collision) { } u8 func_8097EE44(DemoGt* this, PlayState* play, s32 updateMode, s32 drawConfig, CollisionHeader* colHeader) { - - if (func_8097ED94()) { + if (DemoGt_IsCutsceneLayer()) { this->updateMode = updateMode; this->drawConfig = drawConfig; func_8097EDD8(this, play, colHeader); diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 7423fe5b9a..59dfea7ab9 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -325,7 +325,7 @@ void func_80985430(DemoIm* this, PlayState* play) { void func_8098544C(DemoIm* this, PlayState* play) { s32 pad[2]; - if ((gSaveContext.chamberCutsceneNum == 4) && (gSaveContext.sceneSetupIndex < 4)) { + if ((gSaveContext.chamberCutsceneNum == 4) && !IS_CUTSCENE_LAYER) { Player* player = GET_PLAYER(play); this->action = 1; @@ -923,7 +923,7 @@ void func_80986CFC(DemoIm* this, PlayState* play) { } void func_80986D40(DemoIm* this, PlayState* play) { - if (gSaveContext.sceneSetupIndex == 6) { + if (gSaveContext.sceneLayer == 6) { this->action = 19; this->drawConfig = 1; } else if (GET_EVENTCHKINF(EVENTCHKINF_80)) { diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 9fed45d6db..a8dfabfa2b 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -712,7 +712,7 @@ void DemoKankyo_DrawLightPlane(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_demo_kankyo.c", 1514); - if (play->csCtx.state == CS_STATE_IDLE || gSaveContext.sceneSetupIndex >= 4) { + if (play->csCtx.state == CS_STATE_IDLE || IS_CUTSCENE_LAYER) { Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TexScroll(play->state.gfxCtx, 0, play->state.frames & 0x7F, 64, 32)); diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index 73e7ccd61e..67f28d8a92 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -249,7 +249,7 @@ void func_8098E960(DemoSa* this, PlayState* play) { s32 pad[2]; Player* player; - if ((gSaveContext.chamberCutsceneNum == 0) && (gSaveContext.sceneSetupIndex < 4)) { + if ((gSaveContext.chamberCutsceneNum == 0) && !IS_CUTSCENE_LAYER) { player = GET_PLAYER(play); this->action = 1; play->csCtx.segment = D_8099010C; diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index d4b0d6d11a..adc36a539e 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -164,7 +164,7 @@ void DoorWarp1_SetupWarp(DoorWarp1* this, PlayState* play) { if ((!(gSaveContext.entranceIndex == ENTR_SPOT05_3 || gSaveContext.entranceIndex == ENTR_SPOT17_5 || gSaveContext.entranceIndex == ENTR_SPOT06_9 || gSaveContext.entranceIndex == ENTR_SPOT11_8 || gSaveContext.entranceIndex == ENTR_SPOT02_8) && - gSaveContext.sceneSetupIndex < 4) || + !IS_CUTSCENE_LAYER) || (GET_PLAYER(play)->actor.params & 0xF00) != 0x200) { Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 7bdce6ec95..161f3ffbf5 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -168,9 +168,9 @@ void EnDoor_SetupType(EnDoor* this, PlayState* play) { this->actor.textId = (this->actor.params & 0x3F) + 0x0200; if (this->actor.textId == 0x0229 && !GET_EVENTCHKINF(EVENTCHKINF_14)) { // Talon's house door. If Talon has not been woken up at Hyrule Castle - // this door should be openable at any time of day. Note that there is no - // check for time of day as the scene setup for Lon Lon merely initializes - // the door with a different text id between day and night setups + // this door should be openable at any time of day. + // Note that there is no check for time of day, as the night layers for Lon Lon + // have a door with a different text ID. doorType = DOOR_SCENEEXIT; } else { this->actionFunc = EnDoor_WaitForCheck; diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 8358e19b50..8c292bc73b 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -862,7 +862,7 @@ void func_80A03CF8(EnElf* this, PlayState* play) { func_80A02C98(this, &nextPos, 0.2f); } - if ((play->sceneNum == SCENE_LINK_HOME) && (gSaveContext.sceneSetupIndex == 4)) { + if ((play->sceneNum == SCENE_LINK_HOME) && (gSaveContext.sceneLayer == 4)) { // play dash sound effect as Navi enters Links house in the intro if (1) {} if (play->csCtx.frames == 55) { diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 45d4dc3ba5..8eac637164 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -75,8 +75,8 @@ void EnHoll_SetupAction(EnHoll* this, EnHollActionFunc func) { this->actionFunc = func; } -s32 EnHoll_IsKokiriSetup8(void) { - return gSaveContext.entranceIndex == ENTR_SPOT04_0 && gSaveContext.sceneSetupIndex == 8; +s32 EnHoll_IsKokiriLayer8(void) { + return gSaveContext.entranceIndex == ENTR_SPOT04_0 && gSaveContext.sceneLayer == 8; } void EnHoll_ChooseAction(EnHoll* this) { @@ -164,7 +164,7 @@ void func_80A59014(EnHoll* this, PlayState* play) { func_8002DBD0(&this->actor, &vec, (useViewEye) ? &play->view.eye : &player->actor.world.pos); planeHalfWidth = (((this->actor.params >> 6) & 7) == 6) ? PLANE_HALFWIDTH : PLANE_HALFWIDTH_2; - temp = EnHoll_IsKokiriSetup8(); + temp = EnHoll_IsKokiriLayer8(); if (temp || (PLANE_Y_MIN < vec.y && vec.y < PLANE_Y_MAX && fabsf(vec.x) < planeHalfWidth && (absZ = fabsf(vec.z), 100.0f > absZ && absZ > 50.0f))) { s32 transitionActorIdx = (u16)this->actor.params >> 0xA; @@ -304,7 +304,7 @@ void func_80A59618(EnHoll* this, PlayState* play) { } void EnHoll_NextAction(EnHoll* this, PlayState* play) { - if (!EnHoll_IsKokiriSetup8() && play->roomCtx.status == 0) { + if (!EnHoll_IsKokiriLayer8() && play->roomCtx.status == 0) { func_80097534(play, &play->roomCtx); if (play->unk_11E18 == 0) { this->unk_14F = 0; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 9b9a62efed..384fde934d 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -828,7 +828,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->actor.focus.pos.y += 70.0f; this->playerControlled = false; - if ((play->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex < 4)) { + if ((play->sceneNum == SCENE_SPOT20) && !IS_CUTSCENE_LAYER) { if (this->type == HORSE_HNI) { if (this->actor.world.rot.z == 0 || !IS_DAY) { Actor_Kill(&this->actor); @@ -3598,7 +3598,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { this->cyl1.base.atFlags &= ~AT_ON; } - if (gSaveContext.entranceIndex != 343 || gSaveContext.sceneSetupIndex != 9) { + if (gSaveContext.entranceIndex != 343 || gSaveContext.sceneLayer != 9) { if (this->dustFlags & 1) { this->dustFlags &= ~1; func_800287AC(play, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200, diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 37163b39e7..dcda3067df 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -162,7 +162,7 @@ void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) { this->unk_1F0 = 0; this->eyeTexIndex = 0; - if (gSaveContext.sceneSetupIndex > 3) { + if (IS_CUTSCENE_LAYER) { func_80A69EC0(this); } else if (play->sceneNum == SCENE_SPOT20) { if (!Flags_GetEventChkInf(EVENTCHKINF_14)) { diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index 44f0cdafbe..cea16ed844 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -147,7 +147,7 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { i = 1; // Credits scene. The magic carpet man is friends with the bean guy and the lakeside professor. - if ((gSaveContext.entranceIndex == ENTR_SPOT20_0) && (gSaveContext.sceneSetupIndex == 8)) { + if ((gSaveContext.entranceIndex == ENTR_SPOT20_0) && (gSaveContext.sceneLayer == 8)) { isInCreditsScene = true; actorProfessor = play->actorCtx.actorLists[ACTORCAT_NPC].head; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index c02d28eb95..b36359584d 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -181,7 +181,7 @@ s16 func_80AA0778(PlayState* play, Actor* thisx) { } s32 func_80AA08C4(EnMa1* this, PlayState* play) { - if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneSetupIndex == 5)) { + if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneLayer == 5)) { return 1; } if (!LINK_IS_CHILD) { diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index 97f584e59b..a782f27172 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -168,7 +168,7 @@ void EnMs_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actionFunc(this, play); - if (gSaveContext.entranceIndex == ENTR_SPOT20_0 && gSaveContext.sceneSetupIndex == 8) { // ride carpet if in credits + if (gSaveContext.entranceIndex == ENTR_SPOT20_0 && gSaveContext.sceneLayer == 8) { // ride carpet if in credits Actor_MoveForward(&this->actor); osSyncPrintf("OOOHHHHHH %f\n", this->actor.velocity.y); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index fee73f00eb..d8cc4a9018 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -333,7 +333,7 @@ void EnNb_SetupChamberCsImpl(EnNb* this, PlayState* play) { s32 pad[2]; Player* player; - if ((gSaveContext.chamberCutsceneNum == 3) && (gSaveContext.sceneSetupIndex < 4)) { + if ((gSaveContext.chamberCutsceneNum == 3) && !IS_CUTSCENE_LAYER) { player = GET_PLAYER(play); this->action = NB_CHAMBER_UNDERGROUND; play->csCtx.segment = &D_80AB431C; diff --git a/src/overlays/actors/ovl_En_Rl/z_en_rl.c b/src/overlays/actors/ovl_En_Rl/z_en_rl.c index a5e4cca852..988371865e 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -118,7 +118,7 @@ void func_80AE7590(EnRl* this, PlayState* play) { Vec3f pos; s16 sceneNum = play->sceneNum; - if (gSaveContext.sceneSetupIndex == 4 && sceneNum == SCENE_KENJYANOMA && play->csCtx.state != CS_STATE_IDLE && + if (gSaveContext.sceneLayer == 4 && sceneNum == SCENE_KENJYANOMA && play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[6] != NULL && play->csCtx.npcActions[6]->action == 2 && !this->lightMedallionGiven) { player = GET_PLAYER(play); pos.x = player->actor.world.pos.x; diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index ea2119ba38..6e71b7e891 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -2003,7 +2003,7 @@ void func_80AEF890(EnRu1* this, PlayState* play) { s32 pad[2]; s8 curRoomNum; - if ((gSaveContext.sceneSetupIndex < 4) && (EnRu1_IsCsStateIdle(play))) { + if (!IS_CUTSCENE_LAYER && (EnRu1_IsCsStateIdle(play))) { curRoomNum = play->roomCtx.curRoom.num; SET_INFTABLE(INFTABLE_145); Flags_SetSwitch(play, func_80AEADE0(this)); diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index cce4a612fb..2836619c5a 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -265,7 +265,7 @@ void func_80AF2AB4(EnRu2* this, PlayState* play) { Player* player; s16 temp; - if ((gSaveContext.chamberCutsceneNum == 2) && (gSaveContext.sceneSetupIndex < 4)) { + if ((gSaveContext.chamberCutsceneNum == 2) && !IS_CUTSCENE_LAYER) { player = GET_PLAYER(play); this->action = 1; play->csCtx.segment = &D_80AF411C; diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/src/overlays/actors/ovl_En_Tr/z_en_tr.c index be5986c0d3..730e23973e 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -124,7 +124,7 @@ void EnTr_Destroy(Actor* thisx, PlayState* play) { void EnTr_CrySpellcast(EnTr* this, PlayState* play) { if (this->timer == 11) { // Both cry in the title screen cutscene, but only Kotake in the in-game cutscene - if ((this->actor.params != TR_KOUME) || (gSaveContext.sceneSetupIndex == 6)) { + if ((this->actor.params != TR_KOUME) || (gSaveContext.sceneLayer == 6)) { Audio_PlaySfxGeneral(NA_SE_EN_TWINROBA_SHOOT_VOICE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } diff --git a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c index 59dffc87a1..c5dddfa324 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -198,7 +198,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { s32 animationEnded; if (type == ENVIEWER_TYPE_2_ZELDA) { - if (gSaveContext.sceneSetupIndex == 5) { + if (gSaveContext.sceneLayer == 5) { csFrames = play->csCtx.frames; if (csFrames == 792) { Audio_PlayActorSfx2(&this->actor, NA_SE_VO_Z0_SURPRISE); @@ -212,7 +212,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { this->actor.uncullZoneScale = 10000.0f; this->actor.uncullZoneDownward = 10000.0f; } else if (type == ENVIEWER_TYPE_3_GANONDORF) { - if (gSaveContext.sceneSetupIndex == 4) { + if (gSaveContext.sceneLayer == 4) { switch (play->csCtx.frames) { case 20: case 59: @@ -230,7 +230,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { break; } } - if (gSaveContext.sceneSetupIndex == 5) { + if (gSaveContext.sceneLayer == 5) { if (play->csCtx.frames == 1508) { Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FANTOM_ST_LAUGH); } @@ -247,7 +247,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } else if (type == ENVIEWER_TYPE_6_HORSE_GANONDORF) { - if (gSaveContext.sceneSetupIndex == 5 || gSaveContext.sceneSetupIndex == 10) { + if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 10) { Audio_PlayActorSfx2(&this->actor, NA_SE_EV_HORSE_RUN_LEVEL - SFX_FLAG); } } else if (type == ENVIEWER_TYPE_4_HORSE_GANONDORF) { @@ -351,7 +351,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { } } } else if (type == ENVIEWER_TYPE_1_IMPA) { - if (gSaveContext.sceneSetupIndex == 5) { + if (gSaveContext.sceneLayer == 5) { if (play->csCtx.frames == 845) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, 2600.0f, 0, 0, 0, 0); @@ -487,7 +487,7 @@ void EnViewer_Update(Actor* thisx, PlayState* play) { s32 EnViewer_Ganondorf3OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - if (gSaveContext.sceneSetupIndex == 4) { + if (gSaveContext.sceneLayer == 4) { if (play->csCtx.frames >= 400) { if (limbIndex == 5) { *dList = object_gndd_DL_00E1A8; @@ -530,7 +530,7 @@ void EnViewer_DrawGanondorf(EnViewer* this, PlayState* play) { type = this->actor.params >> 8; if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF) { - if (gSaveContext.sceneSetupIndex != 4) { + if (gSaveContext.sceneLayer != 4) { frames = 149; } @@ -642,7 +642,7 @@ void EnViewer_DrawZelda(EnViewer* this, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeOutTex)); } - if (gSaveContext.sceneSetupIndex == 6) { + if (gSaveContext.sceneLayer == 6) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthSurprisedTex)); } else { if (play->csCtx.frames < 758) { diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 98d28f46a1..3d45721f24 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -399,7 +399,7 @@ void EnXc_SetLandingSFX(EnXc* this, PlayState* play) { u32 sfxId; s16 sceneNum = play->sceneNum; - if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum != SCENE_SPOT11)) { + if ((gSaveContext.sceneLayer != 4) || (sceneNum != SCENE_SPOT11)) { if (Animation_OnFrame(&this->skelAnime, 11.0f)) { sfxId = SFX_FLAG; sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); @@ -412,7 +412,7 @@ void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) { static Vec3f sXyzDist; s16 sceneNum; - if (gSaveContext.sceneSetupIndex == 4) { + if (gSaveContext.sceneLayer == 4) { sceneNum = play->sceneNum; if (sceneNum == SCENE_SPOT11) { CutsceneContext* csCtx = &play->csCtx; @@ -438,7 +438,7 @@ void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) { void func_80B3D118(PlayState* play) { s16 sceneNum; - if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum = play->sceneNum, sceneNum != SCENE_SPOT11)) { + if ((gSaveContext.sceneLayer != 4) || (sceneNum = play->sceneNum, sceneNum != SCENE_SPOT11)) { func_800788CC(NA_SE_PL_SKIP); } } @@ -446,7 +446,7 @@ void func_80B3D118(PlayState* play) { static Vec3f D_80B42DA0; void EnXc_SetColossusWindSFX(PlayState* play) { - if (gSaveContext.sceneSetupIndex == 4) { + if (gSaveContext.sceneLayer == 4) { static s32 D_80B41D90 = 0; static Vec3f sPos = { 0.0f, 0.0f, 0.0f }; static f32 sMaxSpeed = 0.0f; diff --git a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c index cbe955756c..a90f342a5e 100644 --- a/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c +++ b/src/overlays/actors/ovl_En_Yabusame_Mark/z_en_yabusame_mark.c @@ -105,7 +105,7 @@ void EnYabusameMark_Init(Actor* thisx, PlayState* play) { Collider_SetQuad(play, &this->collider, &this->actor, &sQuadInit); this->worldPos = this->actor.world.pos; this->actor.flags |= ACTOR_FLAG_4; - if (gSaveContext.sceneSetupIndex != 4) { + if (gSaveContext.sceneLayer != 4) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 37e4305a81..f29133b312 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -87,7 +87,7 @@ void EnZl1_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); this->actor.targetMode = 0; - if (gSaveContext.sceneSetupIndex >= 4) { + if (IS_CUTSCENE_LAYER) { frameCount = Animation_GetLastFrame(&gChildZelda1Anim_00438); Animation_Change(&this->skelAnime, &gChildZelda1Anim_00438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->unk_1E6 = 0; diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 779263e0bd..886e5c242e 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -371,7 +371,7 @@ void EnZl4_Init(Actor* thisx, PlayState* play) { this->actor.textId = -1; this->eyeExpression = this->mouthExpression = ZL4_MOUTH_NEUTRAL; - if (gSaveContext.sceneSetupIndex >= 4) { + if (IS_CUTSCENE_LAYER) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->actionFunc = EnZl4_TheEnd; } else if (GET_EVENTCHKINF(EVENTCHKINF_40)) { diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index f4679d8143..2b2ecfeedd 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -191,7 +191,7 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) { player = GET_PLAYER(play); - if (play->sceneNum == SCENE_SPOT04 && gSaveContext.sceneSetupIndex == 7) { + if (play->sceneNum == SCENE_SPOT04 && gSaveContext.sceneLayer == 7) { dist = Math3D_Vec3f_DistXYZ(&this->prevEyePos, &play->view.eye); this->prevEyePos.x = play->view.eye.x; @@ -227,7 +227,7 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) { } if (play->envCtx.precipitation[PRECIP_SNOW_MAX] < 64 && - (gSaveContext.entranceIndex != ENTR_SPOT04_0 || gSaveContext.sceneSetupIndex != 4 || + (gSaveContext.entranceIndex != ENTR_SPOT04_0 || gSaveContext.sceneLayer != 4 || play->envCtx.precipitation[PRECIP_SNOW_MAX])) { play->envCtx.precipitation[PRECIP_SNOW_MAX] += 16; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 44bec15fa9..5990fdaef4 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -9154,7 +9154,7 @@ void func_80846648(PlayState* play, Player* this) { void func_80846660(PlayState* play, Player* this) { func_80835C58(play, this, func_8084F710, 0); - if ((play->sceneNum == SCENE_SPOT06) && (gSaveContext.sceneSetupIndex >= 4)) { + if ((play->sceneNum == SCENE_SPOT06) && IS_CUTSCENE_LAYER) { this->unk_84F = 1; } this->stateFlags1 |= PLAYER_STATE1_29; @@ -9343,8 +9343,8 @@ void Player_Init(Actor* thisx, PlayState* play2) { if ((respawnFlag == 0) || (respawnFlag < -1)) { titleFileSize = scene->titleFile.vromEnd - scene->titleFile.vromStart; if ((titleFileSize != 0) && gSaveContext.showTitleCard) { - if ((gSaveContext.sceneSetupIndex < 4) && - (gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].field & + if (!IS_CUTSCENE_LAYER && + (gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].field & ENTRANCE_INFO_DISPLAY_TITLE_CARD_FLAG) && ((play->sceneNum != SCENE_DDAN) || GET_EVENTCHKINF(EVENTCHKINF_B0)) && ((play->sceneNum != SCENE_NIGHT_SHOP) || GET_EVENTCHKINF(EVENTCHKINF_25))) { diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index c7f7ff17aa..93bd1fe4ed 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -12,7 +12,7 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { gSaveContext.linkAge = LINK_AGE_ADULT; Sram_InitDebugSave(); gSaveContext.cutsceneIndex = 0xFFF3; - gSaveContext.sceneSetupIndex = 7; + gSaveContext.sceneLayer = 7; SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); }