From 53cd39d38f0af1e483991feb69ce49e8d0856500 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 00:36:28 +0100 Subject: [PATCH 01/26] introduce `enum CutsceneIndex` as a first step --- include/z64cutscene.h | 22 +++ src/code/db_camera.c | 2 +- src/code/z_common_data.c | 2 +- src/code/z_demo.c | 168 +++++++++--------- src/code/z_horse.c | 2 +- src/code/z_kaleido_setup.c | 2 +- src/code/z_kankyo.c | 2 +- src/code/z_message.c | 2 +- src/code/z_parameter.c | 8 +- src/code/z_play.c | 13 +- src/code/z_scene.c | 4 +- src/code/z_sram.c | 4 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 2 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 2 +- .../z_bg_spot00_hanebasi.c | 2 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 38 ++-- src/overlays/actors/ovl_En_Du/z_en_du.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 2 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 2 +- .../z_en_horse_game_check.c | 8 +- .../z_en_horse_link_child.c | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 2 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 2 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 2 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 2 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 4 +- .../actors/ovl_player_actor/z_player.c | 4 +- .../ovl_file_choose/z_file_choose.c | 2 +- .../gamestates/ovl_opening/z_opening.c | 2 +- src/overlays/gamestates/ovl_select/z_select.c | 108 +++++------ 32 files changed, 223 insertions(+), 200 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index d73cb6a47ab..bdf726c8f15 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -344,6 +344,28 @@ typedef enum CutsceneDestination { /* 0x77 */ CS_DEST_ZELDAS_COURTYARD_RECEIVE_LETTER } CutsceneDestination; +typedef enum CutsceneIndex { + CS_INDEX_NONE = 0x0000, + CS_INDEX_FFEF = 0xFFEF, + CS_INDEX_FFF0 = 0xFFF0, + CS_INDEX_FFF1 = 0xFFF1, + CS_INDEX_FFF2 = 0xFFF2, + CS_INDEX_FFF3 = 0xFFF3, + CS_INDEX_FFF4 = 0xFFF4, + CS_INDEX_FFF5 = 0xFFF5, + CS_INDEX_FFF6 = 0xFFF6, + CS_INDEX_FFF7 = 0xFFF7, + CS_INDEX_FFF8 = 0xFFF8, + CS_INDEX_FFF9 = 0xFFF9, + CS_INDEX_FFFA = 0xFFFA, + CS_INDEX_FFFB = 0xFFFB, + CS_INDEX_FFFC = 0xFFFC, + CS_INDEX_FFFD = 0xFFFD, + CS_INDEX_FFFE = 0xFFFE, + CS_INDEX_FFFF = 0xFFFF, + CS_INDEX_8000 = 0x8000, +} CutsceneIndex; + typedef union CsCmdCam { struct { /* 0x00 */ u16 unused0; diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 242609295d5..ad9907c61b2 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -2185,7 +2185,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_FFFD; gSaveContext.cutsceneTrigger = 1; sDebugCamAnim.curFrame = 0.0f; sDebugCamAnim.keyframe = 0; diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 847da16f0b0..c8ad15ff08f 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -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_FFEF; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; gSaveContext.nextDayTime = NEXT_TIME_NONE; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 4b48261cd75..79c8600ab3a 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -177,7 +177,7 @@ void Cutscene_StopManual(PlayState* play, CutsceneContext* csCtx) { } void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutsceneIndex < 0xFFF0) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0) { sManualCutsceneHandlers[csCtx->state](play, csCtx); } } @@ -189,14 +189,14 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) { gUseCutsceneCam = false; - gSaveContext.save.cutsceneIndex = 0xFFFD; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFD; gSaveContext.cutsceneTrigger = 1; } if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER && !gDebugCamEnabled) { gUseCutsceneCam = true; - gSaveContext.save.cutsceneIndex = 0xFFFD; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFD; gSaveContext.cutsceneTrigger = 1; } } @@ -208,11 +208,11 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE)) { PRINTF(T("\nデモ開始要求 発令!", "\nDemo start request issued!")); - gSaveContext.save.cutsceneIndex = 0xFFFD; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFD; gSaveContext.cutsceneTrigger = 1; } - if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { Cutscene_SetupScripted(play, csCtx); sScriptedCutsceneHandlers[csCtx->state](play, csCtx); } @@ -591,54 +591,54 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti gSaveContext.forceRisingButtonAlphas = true; } - gSaveContext.save.cutsceneIndex = 0; + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; switch (cmd->destination) { case CS_DEST_CUTSCENE_MAP_GANON_HORSE: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_CUTSCENE_MAP_THREE_GODDESSES: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_GERUDO_VALLEY_DIN_PART_1: play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_DEATH_MOUNTAIN_TRAIL_NAYRU: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_KOKIRI_FOREST_FARORE: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_CUTSCENE_MAP_TRIFORCE_CREATION: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = 0xFFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_KOKIRI_FOREST_RECEIVE_KOKIRI_EMERALD: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = 0xFFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -651,7 +651,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti SET_EVENTCHKINF(EVENTCHKINF_45); play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; play->transitionType = TRANS_TYPE_INSTANT; } else { if (!IS_CUTSCENE_LAYER) { @@ -671,21 +671,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_GERUDO_VALLEY_DIN_PART_2: play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_BROWN; break; case CS_DEST_LINKS_HOUSE_INTRO: play->nextEntranceIndex = ENTR_LINKS_HOUSE_0; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KOKIRI_FOREST_INTRO: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = 0xFFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -712,21 +712,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -744,13 +744,13 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; - gSaveContext.save.cutsceneIndex = 0x8000; + gSaveContext.save.cutsceneIndex = CS_INDEX_8000; break; case CS_DEST_LAKE_HYLIA_WATER_RESTORED: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -758,14 +758,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti Item_Give(play, ITEM_SONG_REQUIEM); play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_CUTSCENE_MAP_GANONDORF_DEFEATED_CREDITS: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF8; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -779,28 +779,28 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -830,7 +830,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -843,28 +843,28 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_CUTSCENE_MAP_GANONDORF_FROM_MASTER_SWORD: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_HYRULE_FIELD_INTRO_DREAM: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case CS_DEST_CUTSCENE_MAP_SHEIKAH_LEGEND: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case CS_DEST_TEMPLE_OF_TIME_ZELDA_REVEAL: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF9; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF9; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -872,7 +872,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFFA; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFA; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -885,7 +885,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KAKARIKO_VILLAGE_DRAIN_WELL: play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -915,7 +915,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti SET_EVENTCHKINF(EVENTCHKINF_54); play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -940,14 +940,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_HYRULE_FIELD_FROM_ZELDAS_COURTYARD: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = 0xFFF8; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_WHITE, TCS_SLOW); break; case CS_DEST_TEMPLE_OF_TIME_SONG_OF_TIME: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; - gSaveContext.save.cutsceneIndex = 0xFFF7; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -965,56 +965,56 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti #endif play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = 0xFFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_GERUDO_FORTRESS_CREDITS: play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KAKARIKO_VILLAGE_CREDITS: play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; - gSaveContext.save.cutsceneIndex = 0xFFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_1: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.save.cutsceneIndex = 0xFFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_GORON_CITY_CREDITS: play->nextEntranceIndex = ENTR_GORON_CITY_0; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LAKE_HYLIA_CREDITS: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZORAS_FOUNTAIN_CREDITS: play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.save.cutsceneIndex = 0xFFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZORAS_DOMAIN_CREDITS: play->nextEntranceIndex = ENTR_ZORAS_DOMAIN_0; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1022,21 +1022,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KOKIRI_FOREST_CREDITS_PART_1: play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = 0xFFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KOKIRI_FOREST_CREDITS_PART_2: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = 0xFFF7; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_HYRULE_FIELD_CREDITS: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = 0xFFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1044,7 +1044,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_LON_LON_RANCH_CREDITS_PART_1_ALT: play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.save.cutsceneIndex = 0xFFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1064,7 +1064,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_CUTSCENE_MAP_DEKU_SPROUT_PART_2: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1077,7 +1077,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_2: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1090,14 +1090,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZELDAS_COURTYARD_CREDITS: play->nextEntranceIndex = ENTR_CASTLE_COURTYARD_ZELDA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1106,14 +1106,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LON_LON_RANCH_CREDITS_PART_2: play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; break; @@ -1122,7 +1122,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1130,7 +1130,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1138,14 +1138,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LON_LON_RANCH_CREDITS_PART_6: play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF7; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1185,7 +1185,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti GET_EVENTCHKINF(EVENTCHKINF_4A)) { play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; play->transitionType = TRANS_TYPE_FADE_BLACK; } else { switch (gSaveContext.sceneLayer) { @@ -1204,7 +1204,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case 10: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; } @@ -1215,7 +1215,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { SET_EVENTCHKINF(EVENTCHKINF_C8); @@ -1230,7 +1230,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { play->nextEntranceIndex = ENTR_GRAVEYARD_8; @@ -1256,7 +1256,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KOKIRI_FOREST_FROM_CHAMBER_OF_SAGES: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = 0xFFF8; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; @@ -1277,7 +1277,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_HYRULE_FIELD_TITLE_SCREEN: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1286,7 +1286,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_SPIRIT_TEMPLE: play->nextEntranceIndex = ENTR_SPIRIT_TEMPLE_BOSS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination++; break; @@ -1294,7 +1294,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_DEATH_MOUNTAIN_CRATER: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination++; break; @@ -1302,7 +1302,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_GANONDORF_HORSE: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination = TITLE_DEMO_SPIRIT_TEMPLE; break; @@ -1312,7 +1312,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_GRAVEYARD_SUNS_SONG_PART_2: play->nextEntranceIndex = ENTR_GRAVEYARD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = 0xFFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1365,10 +1365,10 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->csCtx.script = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); play->csCtx.curFrame = 0; gSaveContext.cutsceneTrigger = 1; - gSaveContext.save.cutsceneIndex = 0xFFFF; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFF; csCtx->state = CS_STATE_STOP; } else { - gSaveContext.save.cutsceneIndex = 0xFFFF; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFF; csCtx->state = CS_STATE_STOP; } break; @@ -1405,7 +1405,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti Audio_SetSfxBanksMute(0x6F); play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = 0xFFF7; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -2214,7 +2214,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) } void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { #if OOT_DEBUG if (BREG(0) != 0) { Gfx* displayList; @@ -2267,7 +2267,7 @@ void CutsceneHandler_StopScript(PlayState* play, CutsceneContext* csCtx) { PRINTF(T("\n\n\n\n\nやっぱりここかいな", "\n\n\n\n\nThis is it after all")); - gSaveContext.save.cutsceneIndex = 0; + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; gSaveContext.gameMode = GAMEMODE_NORMAL; if (gUseCutsceneCam) { @@ -2293,10 +2293,10 @@ void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx) { u8 i; if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(play)) { - gSaveContext.save.cutsceneIndex = 0xFFFD; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFD; } - if ((gSaveContext.save.cutsceneIndex >= 0xFFF0) && (csCtx->state == CS_STATE_IDLE)) { + if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) && (csCtx->state == CS_STATE_IDLE)) { CutsceneFlags_Unset(play, 0); sCurTextId = 0; @@ -2378,7 +2378,7 @@ void Cutscene_HandleEntranceTriggers(PlayState* play) { if ((gSaveContext.save.entranceIndex == entranceCutscene->entrance) && (!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_EPONA_OBTAINED)) && - (gSaveContext.save.cutsceneIndex < 0xFFF0) && ((u8)gSaveContext.save.linkAge == requiredAge) && + (gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0) && ((u8)gSaveContext.save.linkAge == requiredAge) && (gSaveContext.respawnFlag <= 0)) { Flags_SetEventChkInf(entranceCutscene->flag); Cutscene_SetScript(play, entranceCutscene->script); @@ -2393,32 +2393,32 @@ void Cutscene_HandleConditionalTriggers(PlayState* play) { PRINTF("\ngame_info.mode=[%d] restart_flag", ((void)0, gSaveContext.respawnFlag)); if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (gSaveContext.respawnFlag <= 0) && - (gSaveContext.save.cutsceneIndex < 0xFFF0)) { + (gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0)) { if ((gSaveContext.save.entranceIndex == ENTR_DESERT_COLOSSUS_1) && !Flags_GetEventChkInf(EVENTCHKINF_AC)) { Flags_SetEventChkInf(EVENTCHKINF_AC); gSaveContext.save.entranceIndex = ENTR_DESERT_COLOSSUS_0; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; } else if ((gSaveContext.save.entranceIndex == ENTR_KAKARIKO_VILLAGE_0) && LINK_IS_ADULT && GET_EVENTCHKINF(EVENTCHKINF_48) && GET_EVENTCHKINF(EVENTCHKINF_49) && GET_EVENTCHKINF(EVENTCHKINF_4A) && !Flags_GetEventChkInf(EVENTCHKINF_AA)) { Flags_SetEventChkInf(EVENTCHKINF_AA); - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; } else if ((gSaveContext.save.entranceIndex == ENTR_LOST_WOODS_9) && !Flags_GetEventChkInf(EVENTCHKINF_C1)) { Flags_SetEventChkInf(EVENTCHKINF_C1); Item_Give(play, ITEM_OCARINA_FAIRY); gSaveContext.save.entranceIndex = ENTR_LOST_WOODS_0; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; } else if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && LINK_IS_ADULT && !Flags_GetEventChkInf(EVENTCHKINF_C4) && (gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_TEMPLE_OF_TIME)) { Flags_SetEventChkInf(EVENTCHKINF_C4); gSaveContext.save.entranceIndex = ENTR_TEMPLE_OF_TIME_0; - gSaveContext.save.cutsceneIndex = 0xFFF8; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; } else if (!Flags_GetEventChkInf(EVENTCHKINF_C7) && (gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_GANON_BOSS)) { Flags_SetEventChkInf(EVENTCHKINF_C7); gSaveContext.save.entranceIndex = ENTR_GANON_BOSS_0; - gSaveContext.save.cutsceneIndex = 0xFFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; } } } diff --git a/src/code/z_horse.c b/src/code/z_horse.c index d3d66c3de62..91a806aa5b5 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -192,7 +192,7 @@ void func_8006D684(PlayState* play, Player* player) { (((void)0, gSaveContext.save.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) { if (D_8011F9B8[i].type == 7) { if ((play->sceneId == SCENE_LON_LON_RANCH) && - (((void)0, gSaveContext.save.cutsceneIndex) == 0xFFF1)) { + (((void)0, gSaveContext.save.cutsceneIndex) == CS_INDEX_FFF1)) { D_8011F9B8[i].pos.x = player->actor.world.pos.x; D_8011F9B8[i].pos.y = player->actor.world.pos.y; D_8011F9B8[i].pos.z = player->actor.world.pos.z; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 990b1c0405c..8fdcf9ce03c 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -66,7 +66,7 @@ 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) && + gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0 && gSaveContext.nextCutsceneIndex < CS_INDEX_FFF0 && !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))) { diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 8fbbfd6623f..b1105e2cb24 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -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_NONE; gSaveContext.respawnFlag = -3; play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/code/z_message.c b/src/code/z_message.c index 1bd060944f1..9c81b7d7a05 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -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_FFF0)) { PRINTF("=== day_time=%x ", ((void)0, gSaveContext.save.cutsceneIndex)); if (play->activeCamId == CAM_ID_MAIN) { if (gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NO_CHANGE || diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 16623617710..503269943d7 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -644,8 +644,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_FFF0) || + ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF0))) { gSaveContext.forceRisingButtonAlphas = false; if ((player->stateFlags1 & PLAYER_STATE1_23) || (play->shootingGalleryStatus > 1) || @@ -3523,7 +3523,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_NONE; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.subTimerState = SUBTIMER_STATE_OFF; @@ -3861,7 +3861,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_NONE; Message_StartTextbox(play, 0x71B0, NULL); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); } else { diff --git a/src/code/z_play.c b/src/code/z_play.c index 3cfedca3de8..9ef07c82db6 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -55,7 +55,8 @@ 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_FFF0)) { // 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, @@ -324,12 +325,12 @@ void Play_Init(GameState* thisx) { AnimTaskQueue_Reset(&this->animTaskQueue); Cutscene_InitContext(this, &this->csCtx); - if (gSaveContext.nextCutsceneIndex != 0xFFEF) { + if (gSaveContext.nextCutsceneIndex != CS_INDEX_FFEF) { gSaveContext.save.cutsceneIndex = gSaveContext.nextCutsceneIndex; - gSaveContext.nextCutsceneIndex = 0xFFEF; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFEF; } - if (gSaveContext.save.cutsceneIndex == 0xFFFD) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFFD) { gSaveContext.save.cutsceneIndex = 0; } @@ -346,7 +347,7 @@ 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_FFF0) { gSaveContext.nayrusLoveTimer = 0; Magic_Reset(this); gSaveContext.sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF); @@ -596,7 +597,7 @@ void Play_Update(PlayState* this) { Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); - if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 22d99dda9dd..a2824553422 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -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_FFF0)) || (gSaveContext.save.entranceIndex == ENTR_LAKE_HYLIA_8)) { #if OOT_VERSION >= PAL_1_0 gSaveContext.skyboxTime = ((void)0, gSaveContext.save.dayTime); @@ -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_FFF0) { gSaveContext.save.info.worldMapAreaData |= gBitFlags[((void)0, gSaveContext.worldMapArea)]; PRINTF("000 area_arrival=%x (%d)\n", gSaveContext.save.info.worldMapAreaData, ((void)0, gSaveContext.worldMapArea)); diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 3a5060abffc..4cd1583b358 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -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_FFF1; #if OOT_DEBUG if (fileSelect->buttonIndex == 0) { - gSaveContext.save.cutsceneIndex = 0; + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; } #endif diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index a9dd2adfa5c..1e989ec1a2f 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -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_FFF0))) { Actor_Kill(&this->dyna.actor); return; } diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index 3b1f5594791..aa6c30ebd25 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -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_FFF0)) { CLEAR_EVENTCHKINF(EVENTCHKINF_65); } } 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 501d0f430b7..ebc3a570696 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 @@ -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_FFF1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; } else if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 3000.0f, 0x7530)) { diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 8255e36d0ba..50b38274ce5 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -2104,7 +2104,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_FFF2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; play->linkAgeOnLoad = LINK_AGE_CHILD; 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 b5ff0dbaaf5..d1483306e26 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -489,7 +489,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 0.0f, 0.2f, 6.0f, 0.01f); this->warpTimer++; - if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == 0xFFEF) { + if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == CS_INDEX_FFEF) { PRINTF("\n\n\nじかんがきたからおーしまい fade_direction=[%d]", play->transitionTrigger, TRANS_TRIGGER_START); if (play->sceneId == SCENE_DODONGOS_CAVERN_BOSS) { @@ -497,10 +497,10 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Flags_SetEventChkInf(EVENTCHKINF_25); Item_Give(play, ITEM_GORON_RUBY); play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.nextCutsceneIndex = 0xFFF1; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF1; } else { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_5; - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; } } else if (play->sceneId == SCENE_DEKU_TREE_BOSS) { if (!Flags_GetEventChkInf(EVENTCHKINF_07)) { @@ -508,14 +508,14 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Flags_SetEventChkInf(EVENTCHKINF_09); Item_Give(play, ITEM_KOKIRI_EMERALD); play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.nextCutsceneIndex = 0xFFF1; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF1; } else { play->nextEntranceIndex = ENTR_KOKIRI_FOREST_11; - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; } } else if (play->sceneId == SCENE_JABU_JABU_BOSS) { play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; } PRINTF("\n\n\nおわりおわり"); play->transitionTrigger = TRANS_TRIGGER_START; @@ -600,11 +600,11 @@ void DoorWarp1_RutoWarpOut(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 0.0f, 0.2f, 6.0f, 0.01f); this->warpTimer++; - if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == 0xFFEF) { + if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_FFEF) { SET_EVENTCHKINF(EVENTCHKINF_37); Item_Give(play, ITEM_ZORA_SAPPHIRE); play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.nextCutsceneIndex = 0xFFF0; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE_SLOW; } @@ -700,13 +700,13 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } this->warpTimer++; - if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == 0xFFEF) { + if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_FFEF) { if (play->sceneId == SCENE_FOREST_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_48)) { SET_EVENTCHKINF(EVENTCHKINF_48); Item_Give(play, ITEM_MEDALLION_FOREST); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; } else { if (!LINK_IS_ADULT) { @@ -714,28 +714,28 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_SACRED_FOREST_MEADOW_3; } - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; } } else if (play->sceneId == SCENE_FIRE_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_49)) { SET_EVENTCHKINF(EVENTCHKINF_49); Item_Give(play, ITEM_MEDALLION_FIRE); play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; - gSaveContext.nextCutsceneIndex = 0xFFF3; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF3; } else { if (!LINK_IS_ADULT) { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_4; } else { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_5; } - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; } } else if (play->sceneId == SCENE_WATER_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_4A)) { SET_EVENTCHKINF(EVENTCHKINF_4A); Item_Give(play, ITEM_MEDALLION_WATER); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; gSaveContext.chamberCutsceneNum = CHAMBER_CS_WATER; } else { if (!LINK_IS_ADULT) { @@ -743,13 +743,13 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_LAKE_HYLIA_9; } - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; } } else if (play->sceneId == SCENE_SPIRIT_TEMPLE_BOSS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { Item_Give(play, ITEM_MEDALLION_SPIRIT); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SPIRIT; } else { if (!LINK_IS_ADULT) { @@ -757,13 +757,13 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_8; } - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; } } else if (play->sceneId == SCENE_SHADOW_TEMPLE_BOSS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { Item_Give(play, ITEM_MEDALLION_SHADOW); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SHADOW; } else { if (!LINK_IS_ADULT) { @@ -771,7 +771,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_GRAVEYARD_8; } - gSaveContext.nextCutsceneIndex = 0; + gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; } } play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index 67ddf4a1f70..5959352f340 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -292,7 +292,7 @@ void EnDu_Init(Actor* thisx, PlayState* play) { this->actor.attentionRangeType = ATTENTION_RANGE_1; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGoronCityDarunia01Cs); gSaveContext.cutsceneTrigger = 1; EnDu_SetupAction(this, func_809FE890); diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 6147ab7a256..667ce9fbf83 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -577,7 +577,7 @@ void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { } else { Rupees_ChangeBy(-20); play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; - gSaveContext.nextCutsceneIndex = 0xFFF0; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_08); 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 843427fc8b9..06693637af9 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -2544,7 +2544,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { EnHorse_UpdateHbaRaceInfo(this, play, &sHbaInfo); if ((this->hbaFlags & 1) || (this->hbaTimer >= 46)) { if ((isFanfarePlaying != true) && (gSaveContext.minigameState != 3)) { - gSaveContext.save.cutsceneIndex = 0; + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_16; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST); diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 839b25df2b0..28cc07eecaa 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -110,7 +110,7 @@ s32 EnHorseGameCheck_DestroyIngoRace(EnHorseGameCheckBase* base, PlayState* play } void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, PlayState* play) { - gSaveContext.save.cutsceneIndex = 0; + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; if (this->result == INGORACE_PLAYER_WIN) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_7; if (GET_EVENTINF(EVENTINF_HORSES_06)) { @@ -297,21 +297,21 @@ s32 EnHorseGameCheck_DestroyMalonRace(EnHorseGameCheckBase* base, PlayState* pla void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, PlayState* play) { if ((this->result == MALONRACE_SUCCESS) || (this->result == MALONRACE_TIME_UP)) { - gSaveContext.save.cutsceneIndex = 0; + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; play->nextEntranceIndex = ENTR_LON_LON_RANCH_7; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; } else if (this->result == MALONRACE_FAILURE) { gSaveContext.timerSeconds = 240; gSaveContext.timerState = TIMER_STATE_UP_FREEZE; - gSaveContext.save.cutsceneIndex = 0; + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; play->nextEntranceIndex = ENTR_LON_LON_RANCH_7; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; } else { // "not supported" PRINTF("En_HGC_Spot20_Ta_end():対応せず\n"); - gSaveContext.save.cutsceneIndex = 0; + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; 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 c23c2a68de4..201e7d5f6c5 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 @@ -357,7 +357,7 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { } if ((GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG) && R_EPONAS_SONG_PLAYED) || - ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == 0xFFF1))) { + ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF1))) { func_80A6A4DC(this); } else { this->unk_2A0 = GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG); diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index acb7c46e395..5c27428d173 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -427,7 +427,7 @@ void func_80A79BAC(EnIn* this, PlayState* play, s32 index, u32 transitionType) { play->nextEntranceIndex = entrances[index]; if (index == 2) { - gSaveContext.nextCutsceneIndex = 0xFFF0; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF0; } play->transitionType = transitionType; play->transitionTrigger = TRANS_TRIGGER_START; 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 f8c42427d0d..35eb9b571a0 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -380,7 +380,7 @@ void EnMa1_WaitForPlayback(EnMa1* this, PlayState* play) { GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23; if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.nextCutsceneIndex = 0xFFF1; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF1; play->transitionType = TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; this->actionFunc = EnMa1_DoNothing; diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 6b7297223a2..b830f53905a 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -118,7 +118,7 @@ s16 EnMa3_UpdateTalkState(PlayState* play, Actor* thisx) { case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.nextCutsceneIndex = 0xFFF0; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_0A); diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 72eba29b611..5c1dd37fb24 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -379,7 +379,7 @@ void EnSa_ChangeAnim(EnSa* this, s32 index) { } s32 func_80AF5DFC(EnSa* this, PlayState* play) { - if (gSaveContext.save.cutsceneIndex >= 0xFFF0 && gSaveContext.save.cutsceneIndex != 0xFFFD) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0 && gSaveContext.save.cutsceneIndex != CS_INDEX_FFFD) { if (play->sceneId == SCENE_KOKIRI_FOREST) { return 4; } 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 22f558ea5f0..6cc8f1d31ad 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -779,7 +779,7 @@ s32 EnZl4_CsAskName(EnZl4* this, PlayState* play) { if (this->talkTimer2 == 130) { play->msgCtx.msgMode = MSGMODE_PAUSED; play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.nextCutsceneIndex = 0xFFF7; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; } diff --git a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index 3a0d603aae6..b390b28a217 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -44,7 +44,7 @@ void ObjDekujr_Init(Actor* thisx, PlayState* play) { ObjDekujr* this = (ObjDekujr*)thisx; s32 pad; - if (gSaveContext.save.cutsceneIndex < 0xFFF0) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0) { if (!LINK_IS_ADULT) { Actor_Kill(thisx); return; @@ -140,7 +140,7 @@ void ObjDekujr_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if ((gSaveContext.save.cutsceneIndex >= 0xFFF0) && (this->unk_19B == 0)) { + if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) && (this->unk_19B == 0)) { this->unk_19C = 0; this->unk_19B = 1; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 16fd92e0d8f..9436abc7c3c 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -10751,7 +10751,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { initMode = PARAMS_GET_S(thisx->params, 8, 4); if ((initMode == 5) || (initMode == 6)) { - if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { initMode = 13; } } @@ -13670,7 +13670,7 @@ s32 func_8084DFF4(PlayState* play, Player* this) { if (this->getItemId == GI_SILVER_GAUNTLETS) { play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.nextCutsceneIndex = 0xFFF1; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFF1; play->transitionType = TRANS_TYPE_SANDSTORM_END; this->stateFlags1 &= ~PLAYER_STATE1_29; Player_TryCsAction(play, NULL, PLAYER_CSACTION_8); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index ef4d6cd779f..f911d99aa07 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1890,7 +1890,7 @@ void FileSelect_LoadGame(GameState* thisx) { gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; gSaveContext.skyboxTime = CLOCK_TIME(0, 0); gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; - gSaveContext.nextCutsceneIndex = 0xFFEF; + gSaveContext.nextCutsceneIndex = CS_INDEX_FFEF; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; gSaveContext.nextDayTime = NEXT_TIME_NONE; diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 7b24564cfc2..9c8cb7f721b 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -11,7 +11,7 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { this->state.running = false; gSaveContext.save.linkAge = LINK_AGE_ADULT; Sram_InitDebugSave(); - gSaveContext.save.cutsceneIndex = 0xFFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; gSaveContext.sceneLayer = 7; SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 6ccf547b913..4b0447bafc7 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -335,65 +335,65 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { - if (gSaveContext.save.cutsceneIndex == 0x8000) { - gSaveContext.save.cutsceneIndex = 0; - } else if (gSaveContext.save.cutsceneIndex == 0) { - gSaveContext.save.cutsceneIndex = 0xFFF0; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF0) { - gSaveContext.save.cutsceneIndex = 0xFFF1; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF1) { - gSaveContext.save.cutsceneIndex = 0xFFF2; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF2) { - gSaveContext.save.cutsceneIndex = 0xFFF3; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF3) { - gSaveContext.save.cutsceneIndex = 0xFFF4; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF4) { - gSaveContext.save.cutsceneIndex = 0xFFF5; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF5) { - gSaveContext.save.cutsceneIndex = 0xFFF6; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF6) { - gSaveContext.save.cutsceneIndex = 0xFFF7; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF7) { - gSaveContext.save.cutsceneIndex = 0xFFF8; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF8) { - gSaveContext.save.cutsceneIndex = 0xFFF9; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF9) { - gSaveContext.save.cutsceneIndex = 0xFFFA; - } else if (gSaveContext.save.cutsceneIndex == 0xFFFA) { - gSaveContext.save.cutsceneIndex = 0x8000; + if (gSaveContext.save.cutsceneIndex == CS_INDEX_8000) { + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF0) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF1) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF2) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF3) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF4) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF5) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF6) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF7) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF8) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF9; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF9) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFA; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFFA) { + gSaveContext.save.cutsceneIndex = CS_INDEX_8000; } } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { - if (gSaveContext.save.cutsceneIndex == 0x8000) { - gSaveContext.save.cutsceneIndex = 0xFFFA; - } else if (gSaveContext.save.cutsceneIndex == 0) { - gSaveContext.save.cutsceneIndex = 0x8000; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF0) { - gSaveContext.save.cutsceneIndex = 0; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF1) { - gSaveContext.save.cutsceneIndex = 0xFFF0; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF2) { - gSaveContext.save.cutsceneIndex = 0xFFF1; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF3) { - gSaveContext.save.cutsceneIndex = 0xFFF2; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF4) { - gSaveContext.save.cutsceneIndex = 0xFFF3; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF5) { - gSaveContext.save.cutsceneIndex = 0xFFF4; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF6) { - gSaveContext.save.cutsceneIndex = 0xFFF5; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF7) { - gSaveContext.save.cutsceneIndex = 0xFFF6; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF8) { - gSaveContext.save.cutsceneIndex = 0xFFF7; - } else if (gSaveContext.save.cutsceneIndex == 0xFFF9) { - gSaveContext.save.cutsceneIndex = 0xFFF8; - } else if (gSaveContext.save.cutsceneIndex == 0xFFFA) { - gSaveContext.save.cutsceneIndex = 0xFFF9; + if (gSaveContext.save.cutsceneIndex == CS_INDEX_8000) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFA; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { + gSaveContext.save.cutsceneIndex = CS_INDEX_8000; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF0) { + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF1) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF2) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF3) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF4) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF5) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF6) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF7) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF8) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF9) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFFA) { + gSaveContext.save.cutsceneIndex = CS_INDEX_FFF9; } } gSaveContext.save.nightFlag = 0; - if (gSaveContext.save.cutsceneIndex == 0) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { gSaveContext.save.nightFlag = 1; } @@ -778,6 +778,6 @@ void MapSelect_Init(GameState* thisx) { DMA_REQUEST_SYNC(this->staticSegment, (uintptr_t)_z_select_staticSegmentRomStart, size, "../z_select.c", 1115); } - gSaveContext.save.cutsceneIndex = 0x8000; + gSaveContext.save.cutsceneIndex = CS_INDEX_8000; gSaveContext.save.linkAge = LINK_AGE_CHILD; } From 050c736411a5ef4d048eb96ff9a16939a53ef881 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 03:13:14 +0100 Subject: [PATCH 02/26] crudely rename `enum CutsceneIndex` entries --- include/z64cutscene.h | 50 ++++-- src/code/db_camera.c | 2 +- src/code/z_common_data.c | 2 +- src/code/z_demo.c | 164 +++++++++--------- src/code/z_horse.c | 2 +- src/code/z_kaleido_setup.c | 2 +- src/code/z_message.c | 2 +- src/code/z_parameter.c | 4 +- src/code/z_play.c | 14 +- src/code/z_scene.c | 4 +- src/code/z_sram.c | 2 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 2 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 2 +- .../z_bg_spot00_hanebasi.c | 2 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 14 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 2 +- .../z_en_horse_link_child.c | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 2 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 2 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 2 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 2 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 4 +- .../actors/ovl_player_actor/z_player.c | 4 +- .../ovl_file_choose/z_file_choose.c | 2 +- .../gamestates/ovl_opening/z_opening.c | 6 +- src/overlays/gamestates/ovl_select/z_select.c | 124 ++++++------- 29 files changed, 222 insertions(+), 204 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index bdf726c8f15..ab06420f445 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -344,26 +344,40 @@ typedef enum CutsceneDestination { /* 0x77 */ CS_DEST_ZELDAS_COURTYARD_RECEIVE_LETTER } CutsceneDestination; +/* +correlation with `enum SceneLayer`: + CS_INDEX_MANUAL: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] + CS_INDEX_SCRIPTED_*: SCENE_LAYER_CUTSCENE_FIRST + +correlation with `enum EntranceIndex` + CS_INDEX_MANUAL: base entrance index + scene layer + CS_INDEX_SCRIPTED_*: base entrance index + SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) + +`z_select.c` naming: + CS_INDEX_NONE: "Stage: night" + CS_INDEX_LAST: "Stage: day" + CS_INDEX_SCRIPTED_*: "Stage demo 0*", between [0xFFF0 .. 0xFFFA] +*/ typedef enum CutsceneIndex { CS_INDEX_NONE = 0x0000, - CS_INDEX_FFEF = 0xFFEF, - CS_INDEX_FFF0 = 0xFFF0, - CS_INDEX_FFF1 = 0xFFF1, - CS_INDEX_FFF2 = 0xFFF2, - CS_INDEX_FFF3 = 0xFFF3, - CS_INDEX_FFF4 = 0xFFF4, - CS_INDEX_FFF5 = 0xFFF5, - CS_INDEX_FFF6 = 0xFFF6, - CS_INDEX_FFF7 = 0xFFF7, - CS_INDEX_FFF8 = 0xFFF8, - CS_INDEX_FFF9 = 0xFFF9, - CS_INDEX_FFFA = 0xFFFA, - CS_INDEX_FFFB = 0xFFFB, - CS_INDEX_FFFC = 0xFFFC, - CS_INDEX_FFFD = 0xFFFD, - CS_INDEX_FFFE = 0xFFFE, - CS_INDEX_FFFF = 0xFFFF, - CS_INDEX_8000 = 0x8000, + CS_INDEX_MANUAL = 0xFFEF, + CS_INDEX_SCRIPTED_0 = 0xFFF0, + CS_INDEX_SCRIPTED_1 = 0xFFF1, + CS_INDEX_SCRIPTED_2 = 0xFFF2, + CS_INDEX_SCRIPTED_3 = 0xFFF3, + CS_INDEX_SCRIPTED_4 = 0xFFF4, + CS_INDEX_SCRIPTED_5 = 0xFFF5, + CS_INDEX_SCRIPTED_6 = 0xFFF6, + CS_INDEX_SCRIPTED_7 = 0xFFF7, + CS_INDEX_SCRIPTED_8 = 0xFFF8, + CS_INDEX_SCRIPTED_9 = 0xFFF9, + CS_INDEX_SCRIPTED_A = 0xFFFA, + CS_INDEX_SCRIPTED_B = 0xFFFB, + CS_INDEX_SCRIPTED_C = 0xFFFC, + CS_INDEX_SCRIPTED_D = 0xFFFD, + CS_INDEX_SCRIPTED_E = 0xFFFE, + CS_INDEX_SCRIPTED_F = 0xFFFF, + CS_INDEX_LAST = 0x8000, } CutsceneIndex; typedef union CsCmdCam { diff --git a/src/code/db_camera.c b/src/code/db_camera.c index ad9907c61b2..179ff55e265 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -2185,7 +2185,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 = CS_INDEX_FFFD; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_D; gSaveContext.cutsceneTrigger = 1; sDebugCamAnim.curFrame = 0.0f; sDebugCamAnim.keyframe = 0; diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index c8ad15ff08f..7e5d06e9ad8 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -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 = CS_INDEX_FFEF; + gSaveContext.nextCutsceneIndex = CS_INDEX_MANUAL; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; gSaveContext.nextDayTime = NEXT_TIME_NONE; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 79c8600ab3a..8bdef3a1326 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -177,7 +177,7 @@ void Cutscene_StopManual(PlayState* play, CutsceneContext* csCtx) { } void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0) { sManualCutsceneHandlers[csCtx->state](play, csCtx); } } @@ -189,14 +189,14 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) { gUseCutsceneCam = false; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFD; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_D; gSaveContext.cutsceneTrigger = 1; } if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER && !gDebugCamEnabled) { gUseCutsceneCam = true; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFD; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_D; gSaveContext.cutsceneTrigger = 1; } } @@ -208,11 +208,11 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE)) { PRINTF(T("\nデモ開始要求 発令!", "\nDemo start request issued!")); - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFD; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_D; gSaveContext.cutsceneTrigger = 1; } - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { Cutscene_SetupScripted(play, csCtx); sScriptedCutsceneHandlers[csCtx->state](play, csCtx); } @@ -596,49 +596,49 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti switch (cmd->destination) { case CS_DEST_CUTSCENE_MAP_GANON_HORSE: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_CUTSCENE_MAP_THREE_GODDESSES: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_GERUDO_VALLEY_DIN_PART_1: play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_DEATH_MOUNTAIN_TRAIL_NAYRU: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_KOKIRI_FOREST_FARORE: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_CUTSCENE_MAP_TRIFORCE_CREATION: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_KOKIRI_FOREST_RECEIVE_KOKIRI_EMERALD: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -651,7 +651,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti SET_EVENTCHKINF(EVENTCHKINF_45); play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; play->transitionType = TRANS_TYPE_INSTANT; } else { if (!IS_CUTSCENE_LAYER) { @@ -671,21 +671,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_GERUDO_VALLEY_DIN_PART_2: play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_BROWN; break; case CS_DEST_LINKS_HOUSE_INTRO: play->nextEntranceIndex = ENTR_LINKS_HOUSE_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KOKIRI_FOREST_INTRO: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -712,21 +712,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -744,13 +744,13 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; - gSaveContext.save.cutsceneIndex = CS_INDEX_8000; + gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; break; case CS_DEST_LAKE_HYLIA_WATER_RESTORED: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -758,14 +758,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti Item_Give(play, ITEM_SONG_REQUIEM); play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_CUTSCENE_MAP_GANONDORF_DEFEATED_CREDITS: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -779,28 +779,28 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -830,7 +830,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -843,28 +843,28 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_CUTSCENE_MAP_GANONDORF_FROM_MASTER_SWORD: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_HYRULE_FIELD_INTRO_DREAM: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case CS_DEST_CUTSCENE_MAP_SHEIKAH_LEGEND: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case CS_DEST_TEMPLE_OF_TIME_ZELDA_REVEAL: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF9; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_9; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -872,7 +872,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFA; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_A; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -885,7 +885,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KAKARIKO_VILLAGE_DRAIN_WELL: play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -915,7 +915,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti SET_EVENTCHKINF(EVENTCHKINF_54); play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -940,14 +940,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_HYRULE_FIELD_FROM_ZELDAS_COURTYARD: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_WHITE, TCS_SLOW); break; case CS_DEST_TEMPLE_OF_TIME_SONG_OF_TIME: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -965,56 +965,56 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti #endif play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_GERUDO_FORTRESS_CREDITS: play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KAKARIKO_VILLAGE_CREDITS: play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_1: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_GORON_CITY_CREDITS: play->nextEntranceIndex = ENTR_GORON_CITY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LAKE_HYLIA_CREDITS: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZORAS_FOUNTAIN_CREDITS: play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZORAS_DOMAIN_CREDITS: play->nextEntranceIndex = ENTR_ZORAS_DOMAIN_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1022,21 +1022,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KOKIRI_FOREST_CREDITS_PART_1: play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KOKIRI_FOREST_CREDITS_PART_2: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_HYRULE_FIELD_CREDITS: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1044,7 +1044,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_LON_LON_RANCH_CREDITS_PART_1_ALT: play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1064,7 +1064,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_CUTSCENE_MAP_DEKU_SPROUT_PART_2: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1077,7 +1077,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_2: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1090,14 +1090,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZELDAS_COURTYARD_CREDITS: play->nextEntranceIndex = ENTR_CASTLE_COURTYARD_ZELDA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1106,14 +1106,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LON_LON_RANCH_CREDITS_PART_2: play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; break; @@ -1122,7 +1122,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1130,7 +1130,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1138,14 +1138,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LON_LON_RANCH_CREDITS_PART_6: play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1185,7 +1185,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti GET_EVENTCHKINF(EVENTCHKINF_4A)) { play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; play->transitionType = TRANS_TYPE_FADE_BLACK; } else { switch (gSaveContext.sceneLayer) { @@ -1204,7 +1204,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case 10: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; } @@ -1215,7 +1215,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { SET_EVENTCHKINF(EVENTCHKINF_C8); @@ -1230,7 +1230,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { play->nextEntranceIndex = ENTR_GRAVEYARD_8; @@ -1256,7 +1256,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KOKIRI_FOREST_FROM_CHAMBER_OF_SAGES: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; @@ -1277,7 +1277,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_HYRULE_FIELD_TITLE_SCREEN: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1286,7 +1286,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_SPIRIT_TEMPLE: play->nextEntranceIndex = ENTR_SPIRIT_TEMPLE_BOSS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination++; break; @@ -1294,7 +1294,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_DEATH_MOUNTAIN_CRATER: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination++; break; @@ -1302,7 +1302,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_GANONDORF_HORSE: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination = TITLE_DEMO_SPIRIT_TEMPLE; break; @@ -1312,7 +1312,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_GRAVEYARD_SUNS_SONG_PART_2: play->nextEntranceIndex = ENTR_GRAVEYARD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1365,10 +1365,10 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->csCtx.script = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); play->csCtx.curFrame = 0; gSaveContext.cutsceneTrigger = 1; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFF; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_F; csCtx->state = CS_STATE_STOP; } else { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFF; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_F; csCtx->state = CS_STATE_STOP; } break; @@ -1405,7 +1405,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti Audio_SetSfxBanksMute(0x6F); play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -2214,7 +2214,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) } void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { #if OOT_DEBUG if (BREG(0) != 0) { Gfx* displayList; @@ -2293,10 +2293,10 @@ void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx) { u8 i; if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(play)) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFD; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_D; } - if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) && (csCtx->state == CS_STATE_IDLE)) { + if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) && (csCtx->state == CS_STATE_IDLE)) { CutsceneFlags_Unset(play, 0); sCurTextId = 0; @@ -2378,7 +2378,7 @@ void Cutscene_HandleEntranceTriggers(PlayState* play) { if ((gSaveContext.save.entranceIndex == entranceCutscene->entrance) && (!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_EPONA_OBTAINED)) && - (gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0) && ((u8)gSaveContext.save.linkAge == requiredAge) && + (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0) && ((u8)gSaveContext.save.linkAge == requiredAge) && (gSaveContext.respawnFlag <= 0)) { Flags_SetEventChkInf(entranceCutscene->flag); Cutscene_SetScript(play, entranceCutscene->script); @@ -2393,32 +2393,32 @@ void Cutscene_HandleConditionalTriggers(PlayState* play) { PRINTF("\ngame_info.mode=[%d] restart_flag", ((void)0, gSaveContext.respawnFlag)); if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (gSaveContext.respawnFlag <= 0) && - (gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0)) { + (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0)) { if ((gSaveContext.save.entranceIndex == ENTR_DESERT_COLOSSUS_1) && !Flags_GetEventChkInf(EVENTCHKINF_AC)) { Flags_SetEventChkInf(EVENTCHKINF_AC); gSaveContext.save.entranceIndex = ENTR_DESERT_COLOSSUS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; } else if ((gSaveContext.save.entranceIndex == ENTR_KAKARIKO_VILLAGE_0) && LINK_IS_ADULT && GET_EVENTCHKINF(EVENTCHKINF_48) && GET_EVENTCHKINF(EVENTCHKINF_49) && GET_EVENTCHKINF(EVENTCHKINF_4A) && !Flags_GetEventChkInf(EVENTCHKINF_AA)) { Flags_SetEventChkInf(EVENTCHKINF_AA); - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; } else if ((gSaveContext.save.entranceIndex == ENTR_LOST_WOODS_9) && !Flags_GetEventChkInf(EVENTCHKINF_C1)) { Flags_SetEventChkInf(EVENTCHKINF_C1); Item_Give(play, ITEM_OCARINA_FAIRY); gSaveContext.save.entranceIndex = ENTR_LOST_WOODS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; } else if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && LINK_IS_ADULT && !Flags_GetEventChkInf(EVENTCHKINF_C4) && (gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_TEMPLE_OF_TIME)) { Flags_SetEventChkInf(EVENTCHKINF_C4); gSaveContext.save.entranceIndex = ENTR_TEMPLE_OF_TIME_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; } else if (!Flags_GetEventChkInf(EVENTCHKINF_C7) && (gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_GANON_BOSS)) { Flags_SetEventChkInf(EVENTCHKINF_C7); gSaveContext.save.entranceIndex = ENTR_GANON_BOSS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; } } } diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 91a806aa5b5..8eb8eb50d04 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -192,7 +192,7 @@ void func_8006D684(PlayState* play, Player* player) { (((void)0, gSaveContext.save.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) { if (D_8011F9B8[i].type == 7) { if ((play->sceneId == SCENE_LON_LON_RANCH) && - (((void)0, gSaveContext.save.cutsceneIndex) == CS_INDEX_FFF1)) { + (((void)0, gSaveContext.save.cutsceneIndex) == CS_INDEX_SCRIPTED_1)) { D_8011F9B8[i].pos.x = player->actor.world.pos.x; D_8011F9B8[i].pos.y = player->actor.world.pos.y; D_8011F9B8[i].pos.z = player->actor.world.pos.z; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 8fdcf9ce03c..e1e39fae450 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -66,7 +66,7 @@ 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 < CS_INDEX_FFF0 && gSaveContext.nextCutsceneIndex < CS_INDEX_FFF0 && !Play_InCsMode(play) && + gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0 && gSaveContext.nextCutsceneIndex < CS_INDEX_SCRIPTED_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))) { diff --git a/src/code/z_message.c b/src/code/z_message.c index 9c81b7d7a05..32ec28eeabe 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -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 < CS_INDEX_FFF0)) { + (msgCtx->textId != 0x3055 && gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0)) { PRINTF("=== day_time=%x ", ((void)0, gSaveContext.save.cutsceneIndex)); if (play->activeCamId == CAM_ID_MAIN) { if (gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NO_CHANGE || diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 503269943d7..0147b778f64 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -644,8 +644,8 @@ void func_80083108(PlayState* play) { s16 i; s16 sp28 = false; - if ((gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0) || - ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF0))) { + if ((gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0) || + ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_0))) { gSaveContext.forceRisingButtonAlphas = false; if ((player->stateFlags1 & PLAYER_STATE1_23) || (play->shootingGalleryStatus > 1) || diff --git a/src/code/z_play.c b/src/code/z_play.c index 9ef07c82db6..1cbe2148cd8 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -56,7 +56,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 < CS_INDEX_FFF0)) { + (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_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, @@ -325,13 +325,13 @@ void Play_Init(GameState* thisx) { AnimTaskQueue_Reset(&this->animTaskQueue); Cutscene_InitContext(this, &this->csCtx); - if (gSaveContext.nextCutsceneIndex != CS_INDEX_FFEF) { + if (gSaveContext.nextCutsceneIndex != CS_INDEX_MANUAL) { gSaveContext.save.cutsceneIndex = gSaveContext.nextCutsceneIndex; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFEF; + gSaveContext.nextCutsceneIndex = CS_INDEX_MANUAL; } - if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFFD) { - gSaveContext.save.cutsceneIndex = 0; + if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_D) { + gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; } if (gSaveContext.nextDayTime != NEXT_TIME_NONE) { @@ -347,7 +347,7 @@ void Play_Init(GameState* thisx) { Cutscene_HandleConditionalTriggers(this); - if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { + if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { gSaveContext.nayrusLoveTimer = 0; Magic_Reset(this); gSaveContext.sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF); @@ -597,7 +597,7 @@ void Play_Update(PlayState* this) { Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index a2824553422..227cf8b7efd 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -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 < CS_INDEX_FFF0)) || + if (((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0)) || (gSaveContext.save.entranceIndex == ENTR_LAKE_HYLIA_8)) { #if OOT_VERSION >= PAL_1_0 gSaveContext.skyboxTime = ((void)0, gSaveContext.save.dayTime); @@ -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 < CS_INDEX_FFF0) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_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)); diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 4cd1583b358..c729016a19c 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -793,7 +793,7 @@ 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 = CS_INDEX_FFF1; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; #if OOT_DEBUG if (fileSelect->buttonIndex == 0) { diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 1e989ec1a2f..2841479d9f0 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -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 != CS_INDEX_FFF0))) { + (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (gSaveContext.save.cutsceneIndex != CS_INDEX_SCRIPTED_0))) { Actor_Kill(&this->dyna.actor); return; } diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index aa6c30ebd25..720ada99b2f 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -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 < CS_INDEX_FFF0)) { + if ((this->dyna.actor.params == WINDMILL_ROTATING_GEAR) && (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0)) { CLEAR_EVENTCHKINF(EVENTCHKINF_65); } } 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 ebc3a570696..035010143e8 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 @@ -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 = CS_INDEX_FFF1; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; } else if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 3000.0f, 0x7530)) { diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 50b38274ce5..c9b649e68b4 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -2104,7 +2104,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { FALLTHROUGH; case 20: play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF2; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; play->linkAgeOnLoad = LINK_AGE_CHILD; 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 d1483306e26..8e8303e65d4 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -489,7 +489,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 0.0f, 0.2f, 6.0f, 0.01f); this->warpTimer++; - if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == CS_INDEX_FFEF) { + if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == CS_INDEX_MANUAL) { PRINTF("\n\n\nじかんがきたからおーしまい fade_direction=[%d]", play->transitionTrigger, TRANS_TRIGGER_START); if (play->sceneId == SCENE_DODONGOS_CAVERN_BOSS) { @@ -497,7 +497,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Flags_SetEventChkInf(EVENTCHKINF_25); Item_Give(play, ITEM_GORON_RUBY); play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF1; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_1; } else { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_5; gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; @@ -508,7 +508,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Flags_SetEventChkInf(EVENTCHKINF_09); Item_Give(play, ITEM_KOKIRI_EMERALD); play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF1; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_1; } else { play->nextEntranceIndex = ENTR_KOKIRI_FOREST_11; gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; @@ -600,11 +600,11 @@ void DoorWarp1_RutoWarpOut(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 0.0f, 0.2f, 6.0f, 0.01f); this->warpTimer++; - if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_FFEF) { + if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_MANUAL) { SET_EVENTCHKINF(EVENTCHKINF_37); Item_Give(play, ITEM_ZORA_SAPPHIRE); play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF0; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE_SLOW; } @@ -700,7 +700,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } this->warpTimer++; - if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_FFEF) { + if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_MANUAL) { if (play->sceneId == SCENE_FOREST_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_48)) { SET_EVENTCHKINF(EVENTCHKINF_48); @@ -721,7 +721,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { SET_EVENTCHKINF(EVENTCHKINF_49); Item_Give(play, ITEM_MEDALLION_FIRE); play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF3; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_3; } else { if (!LINK_IS_ADULT) { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_4; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index 5959352f340..64c2e024c1a 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -292,7 +292,7 @@ void EnDu_Init(Actor* thisx, PlayState* play) { this->actor.attentionRangeType = ATTENTION_RANGE_1; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGoronCityDarunia01Cs); gSaveContext.cutsceneTrigger = 1; EnDu_SetupAction(this, func_809FE890); diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 667ce9fbf83..4ea8d8a087b 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -577,7 +577,7 @@ void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { } else { Rupees_ChangeBy(-20); play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF0; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_08); 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 201e7d5f6c5..e430440f03c 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 @@ -357,7 +357,7 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { } if ((GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG) && R_EPONAS_SONG_PLAYED) || - ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF1))) { + ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_1))) { func_80A6A4DC(this); } else { this->unk_2A0 = GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG); diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 5c27428d173..96f014ef87d 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -427,7 +427,7 @@ void func_80A79BAC(EnIn* this, PlayState* play, s32 index, u32 transitionType) { play->nextEntranceIndex = entrances[index]; if (index == 2) { - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF0; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_0; } play->transitionType = transitionType; play->transitionTrigger = TRANS_TRIGGER_START; 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 35eb9b571a0..4fff525fac4 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -380,7 +380,7 @@ void EnMa1_WaitForPlayback(EnMa1* this, PlayState* play) { GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23; if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF1; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionType = TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; this->actionFunc = EnMa1_DoNothing; diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index b830f53905a..3709e1c024c 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -118,7 +118,7 @@ s16 EnMa3_UpdateTalkState(PlayState* play, Actor* thisx) { case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF0; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_0A); diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 5c1dd37fb24..502bfbfaa58 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -379,7 +379,7 @@ void EnSa_ChangeAnim(EnSa* this, s32 index) { } s32 func_80AF5DFC(EnSa* this, PlayState* play) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0 && gSaveContext.save.cutsceneIndex != CS_INDEX_FFFD) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0 && gSaveContext.save.cutsceneIndex != CS_INDEX_SCRIPTED_D) { if (play->sceneId == SCENE_KOKIRI_FOREST) { return 4; } 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 6cc8f1d31ad..f17d8c5aeed 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -779,7 +779,7 @@ s32 EnZl4_CsAskName(EnZl4* this, PlayState* play) { if (this->talkTimer2 == 130) { play->msgCtx.msgMode = MSGMODE_PAUSED; play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF7; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; } diff --git a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index b390b28a217..305a6562e9b 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -44,7 +44,7 @@ void ObjDekujr_Init(Actor* thisx, PlayState* play) { ObjDekujr* this = (ObjDekujr*)thisx; s32 pad; - if (gSaveContext.save.cutsceneIndex < CS_INDEX_FFF0) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0) { if (!LINK_IS_ADULT) { Actor_Kill(thisx); return; @@ -140,7 +140,7 @@ void ObjDekujr_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) && (this->unk_19B == 0)) { + if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) && (this->unk_19B == 0)) { this->unk_19C = 0; this->unk_19B = 1; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 9436abc7c3c..11eaa0f28f4 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -10751,7 +10751,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { initMode = PARAMS_GET_S(thisx->params, 8, 4); if ((initMode == 5) || (initMode == 6)) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_FFF0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { initMode = 13; } } @@ -13670,7 +13670,7 @@ s32 func_8084DFF4(PlayState* play, Player* this) { if (this->getItemId == GI_SILVER_GAUNTLETS) { play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFF1; + gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_1; play->transitionType = TRANS_TYPE_SANDSTORM_END; this->stateFlags1 &= ~PLAYER_STATE1_29; Player_TryCsAction(play, NULL, PLAYER_CSACTION_8); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index f911d99aa07..ab0ff0ebe77 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1890,7 +1890,7 @@ void FileSelect_LoadGame(GameState* thisx) { gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; gSaveContext.skyboxTime = CLOCK_TIME(0, 0); gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; - gSaveContext.nextCutsceneIndex = CS_INDEX_FFEF; + gSaveContext.nextCutsceneIndex = CS_INDEX_MANUAL; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; gSaveContext.nextDayTime = NEXT_TIME_NONE; diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 9c8cb7f721b..faf1d863d87 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -11,8 +11,12 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { this->state.running = false; gSaveContext.save.linkAge = LINK_AGE_ADULT; Sram_InitDebugSave(); - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; gSaveContext.sceneLayer = 7; + // assigning scene layer here is redundant, as Play_Init sets it to + // SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF) + // or one of the other `enum SceneLayer` values; even so, `7` is exactly + // the value this formula equals to for CS_INDEX_SCRIPTED_3 SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 4b0447bafc7..bfbcfa74469 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -335,60 +335,60 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { - if (gSaveContext.save.cutsceneIndex == CS_INDEX_8000) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF0) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF1) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF2) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF3) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF4) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF5) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF6) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF7) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF8) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF9; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF9) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFA; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFFA) { - gSaveContext.save.cutsceneIndex = CS_INDEX_8000; + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_0) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_1) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_2) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_3) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_4) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_5) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_6) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_7) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_8) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_9; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_9) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_A; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_A) { + gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; } } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { - if (gSaveContext.save.cutsceneIndex == CS_INDEX_8000) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFA; + if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_A; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { - gSaveContext.save.cutsceneIndex = CS_INDEX_8000; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF0) { + gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_0) { gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF1) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF0; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF2) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF1; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF3) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF2; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF4) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF3; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF5) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF4; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF6) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF5; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF7) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF6; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF8) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF7; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFF9) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF8; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_FFFA) { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFF9; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_1) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_2) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_3) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_4) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_5) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_6) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_7) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_8) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_9) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_A) { + gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_9; } } @@ -607,48 +607,48 @@ void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 GfxPrint_SetColor(printer, 255, 255, 55, 255); switch (csIndex) { - case 0: + case CS_INDEX_NONE: label = GFXP_HIRAGANA " ヨル " GFXP_KATAKANA "ゴロン"; gSaveContext.save.dayTime = CLOCK_TIME(0, 0); break; - case 0x8000: + case CS_INDEX_LAST: // clang-format off gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = GFXP_HIRAGANA "オヒル " GFXP_KATAKANA "ジャラ"; // clang-format on break; - case 0xFFF0: + case CS_INDEX_SCRIPTED_0: // clang-format off gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = "デモ00"; // clang-format on break; - case 0xFFF1: + case CS_INDEX_SCRIPTED_1: label = "デモ01"; break; - case 0xFFF2: + case CS_INDEX_SCRIPTED_2: label = "デモ02"; break; - case 0xFFF3: + case CS_INDEX_SCRIPTED_3: label = "デモ03"; break; - case 0xFFF4: + case CS_INDEX_SCRIPTED_4: label = "デモ04"; break; - case 0xFFF5: + case CS_INDEX_SCRIPTED_5: label = "デモ05"; break; - case 0xFFF6: + case CS_INDEX_SCRIPTED_6: label = "デモ06"; break; - case 0xFFF7: + case CS_INDEX_SCRIPTED_7: label = "デモ07"; break; - case 0xFFF8: + case CS_INDEX_SCRIPTED_8: label = "デモ08"; break; - case 0xFFF9: + case CS_INDEX_SCRIPTED_9: label = "デモ09"; break; - case 0xFFFA: + case CS_INDEX_SCRIPTED_A: label = "デモ0A"; break; }; @@ -778,6 +778,6 @@ void MapSelect_Init(GameState* thisx) { DMA_REQUEST_SYNC(this->staticSegment, (uintptr_t)_z_select_staticSegmentRomStart, size, "../z_select.c", 1115); } - gSaveContext.save.cutsceneIndex = CS_INDEX_8000; + gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; gSaveContext.save.linkAge = LINK_AGE_CHILD; } From 4049e33ba96339316332a35a7387f4788dc3c354 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 03:44:10 +0100 Subject: [PATCH 03/26] run `check_format.py ...` separetely so that it doesn't clutter previous commit. still, allowing `clangd LSP` to run format-on-save yields inconsistent results for me with the project's tooling, especially for header files --- src/code/z_kaleido_setup.c | 6 +++--- .../actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 3 ++- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 3 ++- src/overlays/actors/ovl_player_actor/z_player.c | 6 +++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index e1e39fae450..ddcec07ee49 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -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 < CS_INDEX_SCRIPTED_0 && gSaveContext.nextCutsceneIndex < CS_INDEX_SCRIPTED_0 && !Play_InCsMode(play) && - play->shootingGalleryStatus <= 1 && gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY && - gSaveContext.magicState != MAGIC_STATE_FILL && + gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0 && gSaveContext.nextCutsceneIndex < CS_INDEX_SCRIPTED_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)) { diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index 720ada99b2f..17c7ca8b5fd 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -108,7 +108,8 @@ 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 < CS_INDEX_SCRIPTED_0)) { + if ((this->dyna.actor.params == WINDMILL_ROTATING_GEAR) && + (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0)) { CLEAR_EVENTCHKINF(EVENTCHKINF_65); } } diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 502bfbfaa58..d3cd67a9d6f 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -379,7 +379,8 @@ void EnSa_ChangeAnim(EnSa* this, s32 index) { } s32 func_80AF5DFC(EnSa* this, PlayState* play) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0 && gSaveContext.save.cutsceneIndex != CS_INDEX_SCRIPTED_D) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0 && + gSaveContext.save.cutsceneIndex != CS_INDEX_SCRIPTED_D) { if (play->sceneId == SCENE_KOKIRI_FOREST) { return 4; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 11eaa0f28f4..f6b91ce21d0 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -81,10 +81,10 @@ typedef enum AnimSfxType { #define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) -#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame)&0x7FF))) +#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame) & 0x7FF))) -#define ANIMSFX_GET_TYPE(data) ((data)&0x7800) -#define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) +#define ANIMSFX_GET_TYPE(data) ((data) & 0x7800) +#define ANIMSFX_GET_FRAME(data) ((data) & 0x7FF) typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; From 2ae3bff3b8c131b4108c1c7b735db94ae72f37f5 Mon Sep 17 00:00:00 2001 From: Leonid Kapitonov Date: Tue, 5 Nov 2024 11:26:18 +0100 Subject: [PATCH 04/26] apply a draft PR suggestion Co-authored-by: mzxrules --- include/z64cutscene.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index ab06420f445..2b908adbe92 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -347,11 +347,11 @@ typedef enum CutsceneDestination { /* correlation with `enum SceneLayer`: CS_INDEX_MANUAL: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] - CS_INDEX_SCRIPTED_*: SCENE_LAYER_CUTSCENE_FIRST + CS_INDEX_SCRIPTED_*: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) correlation with `enum EntranceIndex` CS_INDEX_MANUAL: base entrance index + scene layer - CS_INDEX_SCRIPTED_*: base entrance index + SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) + CS_INDEX_SCRIPTED_*: base entrance index + scene layer `z_select.c` naming: CS_INDEX_NONE: "Stage: night" From 8cbdf80d867116e6d407e17f18a3618ab55e9292 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 12:02:59 +0100 Subject: [PATCH 05/26] rename `CS_INDEX_*` with PR suggestions and some additional observations reverified with > `check_format.py ...` > `make ...` additionally: - current clang-format lacks a rule for trailing commas - compiler says about them `cfe: Warning 624` --- include/z64cutscene.h | 44 +++-- src/code/db_camera.c | 2 +- src/code/z_common_data.c | 2 +- src/code/z_demo.c | 162 +++++++++--------- src/code/z_horse.c | 2 +- src/code/z_kaleido_setup.c | 2 +- src/code/z_message.c | 2 +- src/code/z_parameter.c | 4 +- src/code/z_play.c | 12 +- src/code/z_scene.c | 4 +- src/code/z_sram.c | 2 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 2 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 2 +- .../z_bg_spot00_hanebasi.c | 2 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 14 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 2 +- .../z_en_horse_link_child.c | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 2 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 2 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 3 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 2 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 4 +- .../actors/ovl_player_actor/z_player.c | 4 +- .../ovl_file_choose/z_file_choose.c | 2 +- .../gamestates/ovl_opening/z_opening.c | 4 +- src/overlays/gamestates/ovl_select/z_select.c | 110 ++++++------ 29 files changed, 199 insertions(+), 202 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 2b908adbe92..7713abc7c5d 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -346,38 +346,36 @@ typedef enum CutsceneDestination { /* correlation with `enum SceneLayer`: - CS_INDEX_MANUAL: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] - CS_INDEX_SCRIPTED_*: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) + CS_INDEX_NEXT_USED: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] + CS_INDEX_ENTRANCE_*: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) correlation with `enum EntranceIndex` - CS_INDEX_MANUAL: base entrance index + scene layer - CS_INDEX_SCRIPTED_*: base entrance index + scene layer + CS_INDEX_NEXT_USED: base entrance index + scene layer + CS_INDEX_ENTRANCE_*: base entrance index + scene layer `z_select.c` naming: CS_INDEX_NONE: "Stage: night" CS_INDEX_LAST: "Stage: day" - CS_INDEX_SCRIPTED_*: "Stage demo 0*", between [0xFFF0 .. 0xFFFA] + CS_INDEX_ENTRANCE_*: "Stage demo 0*", between [CS_INDEX_ENTRANCE_4 .. CS_INDEX_ENTRANCE_E] */ typedef enum CutsceneIndex { CS_INDEX_NONE = 0x0000, - CS_INDEX_MANUAL = 0xFFEF, - CS_INDEX_SCRIPTED_0 = 0xFFF0, - CS_INDEX_SCRIPTED_1 = 0xFFF1, - CS_INDEX_SCRIPTED_2 = 0xFFF2, - CS_INDEX_SCRIPTED_3 = 0xFFF3, - CS_INDEX_SCRIPTED_4 = 0xFFF4, - CS_INDEX_SCRIPTED_5 = 0xFFF5, - CS_INDEX_SCRIPTED_6 = 0xFFF6, - CS_INDEX_SCRIPTED_7 = 0xFFF7, - CS_INDEX_SCRIPTED_8 = 0xFFF8, - CS_INDEX_SCRIPTED_9 = 0xFFF9, - CS_INDEX_SCRIPTED_A = 0xFFFA, - CS_INDEX_SCRIPTED_B = 0xFFFB, - CS_INDEX_SCRIPTED_C = 0xFFFC, - CS_INDEX_SCRIPTED_D = 0xFFFD, - CS_INDEX_SCRIPTED_E = 0xFFFE, - CS_INDEX_SCRIPTED_F = 0xFFFF, - CS_INDEX_LAST = 0x8000, + CS_INDEX_NEXT_USED = 0xFFEF, // a guess as per `z_play.c:328` + CS_INDEX_ENTRANCE_4 = 0xFFF0, // e.g. ENTR_TEMPLE_OF_TIME_0_4 + CS_INDEX_ENTRANCE_5 = 0xFFF1, + CS_INDEX_ENTRANCE_6 = 0xFFF2, + CS_INDEX_ENTRANCE_7 = 0xFFF3, + CS_INDEX_ENTRANCE_8 = 0xFFF4, + CS_INDEX_ENTRANCE_9 = 0xFFF5, + CS_INDEX_ENTRANCE_A = 0xFFF6, + CS_INDEX_ENTRANCE_B = 0xFFF7, + CS_INDEX_ENTRANCE_C = 0xFFF8, + CS_INDEX_ENTRANCE_D = 0xFFF9, + CS_INDEX_ENTRANCE_E = 0xFFFA, + CS_INDEX_ENTRANCE_F = 0xFFFB, // e.g. ENTR_TEMPLE_OF_TIME_0_15 + CS_INDEX_RESET = 0xFFFD, // a guess as per `z_play.c:333` + CS_INDEX_STOP = 0xFFFF, // a guess as per `z_demo.c:1369` and `z_demo.c:1372` + CS_INDEX_LAST = 0x8000 // unknown, `z_demo.c:747` for CS_DEST_DEATH_MOUNTAIN_TRAIL } CutsceneIndex; typedef union CsCmdCam { diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 179ff55e265..8027d7c61d0 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -2185,7 +2185,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 = CS_INDEX_SCRIPTED_D; + gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; gSaveContext.cutsceneTrigger = 1; sDebugCamAnim.curFrame = 0.0f; sDebugCamAnim.keyframe = 0; diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 7e5d06e9ad8..9837cf3c14d 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -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 = CS_INDEX_MANUAL; + gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_USED; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; gSaveContext.nextDayTime = NEXT_TIME_NONE; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 8bdef3a1326..d9c6de9361c 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -177,7 +177,7 @@ void Cutscene_StopManual(PlayState* play, CutsceneContext* csCtx) { } void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4) { sManualCutsceneHandlers[csCtx->state](play, csCtx); } } @@ -189,14 +189,14 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) { gUseCutsceneCam = false; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_D; + gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; gSaveContext.cutsceneTrigger = 1; } if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER && !gDebugCamEnabled) { gUseCutsceneCam = true; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_D; + gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; gSaveContext.cutsceneTrigger = 1; } } @@ -208,11 +208,11 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE)) { PRINTF(T("\nデモ開始要求 発令!", "\nDemo start request issued!")); - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_D; + gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; gSaveContext.cutsceneTrigger = 1; } - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { Cutscene_SetupScripted(play, csCtx); sScriptedCutsceneHandlers[csCtx->state](play, csCtx); } @@ -596,49 +596,49 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti switch (cmd->destination) { case CS_DEST_CUTSCENE_MAP_GANON_HORSE: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_CUTSCENE_MAP_THREE_GODDESSES: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_GERUDO_VALLEY_DIN_PART_1: play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_DEATH_MOUNTAIN_TRAIL_NAYRU: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_KOKIRI_FOREST_FARORE: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_CUTSCENE_MAP_TRIFORCE_CREATION: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_KOKIRI_FOREST_RECEIVE_KOKIRI_EMERALD: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -651,7 +651,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti SET_EVENTCHKINF(EVENTCHKINF_45); play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; play->transitionType = TRANS_TYPE_INSTANT; } else { if (!IS_CUTSCENE_LAYER) { @@ -671,21 +671,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_GERUDO_VALLEY_DIN_PART_2: play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_BROWN; break; case CS_DEST_LINKS_HOUSE_INTRO: play->nextEntranceIndex = ENTR_LINKS_HOUSE_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KOKIRI_FOREST_INTRO: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -712,21 +712,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -750,7 +750,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_LAKE_HYLIA_WATER_RESTORED: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -758,14 +758,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti Item_Give(play, ITEM_SONG_REQUIEM); play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_CUTSCENE_MAP_GANONDORF_DEFEATED_CREDITS: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -779,28 +779,28 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -830,7 +830,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -843,28 +843,28 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_CUTSCENE_MAP_GANONDORF_FROM_MASTER_SWORD: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_HYRULE_FIELD_INTRO_DREAM: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case CS_DEST_CUTSCENE_MAP_SHEIKAH_LEGEND: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case CS_DEST_TEMPLE_OF_TIME_ZELDA_REVEAL: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_9; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_D; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -872,7 +872,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_A; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_E; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -885,7 +885,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KAKARIKO_VILLAGE_DRAIN_WELL: play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -915,7 +915,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti SET_EVENTCHKINF(EVENTCHKINF_54); play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -940,14 +940,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_HYRULE_FIELD_FROM_ZELDAS_COURTYARD: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_WHITE, TCS_SLOW); break; case CS_DEST_TEMPLE_OF_TIME_SONG_OF_TIME: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -965,56 +965,56 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti #endif play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_GERUDO_FORTRESS_CREDITS: play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KAKARIKO_VILLAGE_CREDITS: play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_1: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_GORON_CITY_CREDITS: play->nextEntranceIndex = ENTR_GORON_CITY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LAKE_HYLIA_CREDITS: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZORAS_FOUNTAIN_CREDITS: play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZORAS_DOMAIN_CREDITS: play->nextEntranceIndex = ENTR_ZORAS_DOMAIN_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1022,21 +1022,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KOKIRI_FOREST_CREDITS_PART_1: play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KOKIRI_FOREST_CREDITS_PART_2: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_HYRULE_FIELD_CREDITS: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1044,7 +1044,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_LON_LON_RANCH_CREDITS_PART_1_ALT: play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1064,7 +1064,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_CUTSCENE_MAP_DEKU_SPROUT_PART_2: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1077,7 +1077,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_2: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1090,14 +1090,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZELDAS_COURTYARD_CREDITS: play->nextEntranceIndex = ENTR_CASTLE_COURTYARD_ZELDA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1106,14 +1106,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LON_LON_RANCH_CREDITS_PART_2: play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; break; @@ -1122,7 +1122,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1130,7 +1130,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1138,14 +1138,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LON_LON_RANCH_CREDITS_PART_6: play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1185,7 +1185,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti GET_EVENTCHKINF(EVENTCHKINF_4A)) { play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; play->transitionType = TRANS_TYPE_FADE_BLACK; } else { switch (gSaveContext.sceneLayer) { @@ -1204,7 +1204,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case 10: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; } @@ -1215,7 +1215,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { SET_EVENTCHKINF(EVENTCHKINF_C8); @@ -1230,7 +1230,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { play->nextEntranceIndex = ENTR_GRAVEYARD_8; @@ -1256,7 +1256,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KOKIRI_FOREST_FROM_CHAMBER_OF_SAGES: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; @@ -1277,7 +1277,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_HYRULE_FIELD_TITLE_SCREEN: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1286,7 +1286,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_SPIRIT_TEMPLE: play->nextEntranceIndex = ENTR_SPIRIT_TEMPLE_BOSS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination++; break; @@ -1294,7 +1294,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_DEATH_MOUNTAIN_CRATER: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination++; break; @@ -1302,7 +1302,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_GANONDORF_HORSE: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination = TITLE_DEMO_SPIRIT_TEMPLE; break; @@ -1312,7 +1312,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_GRAVEYARD_SUNS_SONG_PART_2: play->nextEntranceIndex = ENTR_GRAVEYARD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1365,10 +1365,10 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->csCtx.script = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); play->csCtx.curFrame = 0; gSaveContext.cutsceneTrigger = 1; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_F; + gSaveContext.save.cutsceneIndex = CS_INDEX_STOP; csCtx->state = CS_STATE_STOP; } else { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_F; + gSaveContext.save.cutsceneIndex = CS_INDEX_STOP; csCtx->state = CS_STATE_STOP; } break; @@ -1405,7 +1405,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti Audio_SetSfxBanksMute(0x6F); play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -2214,7 +2214,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) } void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { #if OOT_DEBUG if (BREG(0) != 0) { Gfx* displayList; @@ -2293,10 +2293,10 @@ void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx) { u8 i; if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(play)) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_D; + gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; } - if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) && (csCtx->state == CS_STATE_IDLE)) { + if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) && (csCtx->state == CS_STATE_IDLE)) { CutsceneFlags_Unset(play, 0); sCurTextId = 0; @@ -2378,7 +2378,7 @@ void Cutscene_HandleEntranceTriggers(PlayState* play) { if ((gSaveContext.save.entranceIndex == entranceCutscene->entrance) && (!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_EPONA_OBTAINED)) && - (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0) && ((u8)gSaveContext.save.linkAge == requiredAge) && + (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4) && ((u8)gSaveContext.save.linkAge == requiredAge) && (gSaveContext.respawnFlag <= 0)) { Flags_SetEventChkInf(entranceCutscene->flag); Cutscene_SetScript(play, entranceCutscene->script); @@ -2393,32 +2393,32 @@ void Cutscene_HandleConditionalTriggers(PlayState* play) { PRINTF("\ngame_info.mode=[%d] restart_flag", ((void)0, gSaveContext.respawnFlag)); if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (gSaveContext.respawnFlag <= 0) && - (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0)) { + (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4)) { if ((gSaveContext.save.entranceIndex == ENTR_DESERT_COLOSSUS_1) && !Flags_GetEventChkInf(EVENTCHKINF_AC)) { Flags_SetEventChkInf(EVENTCHKINF_AC); gSaveContext.save.entranceIndex = ENTR_DESERT_COLOSSUS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; } else if ((gSaveContext.save.entranceIndex == ENTR_KAKARIKO_VILLAGE_0) && LINK_IS_ADULT && GET_EVENTCHKINF(EVENTCHKINF_48) && GET_EVENTCHKINF(EVENTCHKINF_49) && GET_EVENTCHKINF(EVENTCHKINF_4A) && !Flags_GetEventChkInf(EVENTCHKINF_AA)) { Flags_SetEventChkInf(EVENTCHKINF_AA); - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; } else if ((gSaveContext.save.entranceIndex == ENTR_LOST_WOODS_9) && !Flags_GetEventChkInf(EVENTCHKINF_C1)) { Flags_SetEventChkInf(EVENTCHKINF_C1); Item_Give(play, ITEM_OCARINA_FAIRY); gSaveContext.save.entranceIndex = ENTR_LOST_WOODS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; } else if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && LINK_IS_ADULT && !Flags_GetEventChkInf(EVENTCHKINF_C4) && (gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_TEMPLE_OF_TIME)) { Flags_SetEventChkInf(EVENTCHKINF_C4); gSaveContext.save.entranceIndex = ENTR_TEMPLE_OF_TIME_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; } else if (!Flags_GetEventChkInf(EVENTCHKINF_C7) && (gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_GANON_BOSS)) { Flags_SetEventChkInf(EVENTCHKINF_C7); gSaveContext.save.entranceIndex = ENTR_GANON_BOSS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; } } } diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 8eb8eb50d04..69b96e22a48 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -192,7 +192,7 @@ void func_8006D684(PlayState* play, Player* player) { (((void)0, gSaveContext.save.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) { if (D_8011F9B8[i].type == 7) { if ((play->sceneId == SCENE_LON_LON_RANCH) && - (((void)0, gSaveContext.save.cutsceneIndex) == CS_INDEX_SCRIPTED_1)) { + (((void)0, gSaveContext.save.cutsceneIndex) == CS_INDEX_ENTRANCE_5)) { D_8011F9B8[i].pos.x = player->actor.world.pos.x; D_8011F9B8[i].pos.y = player->actor.world.pos.y; D_8011F9B8[i].pos.z = player->actor.world.pos.z; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index ddcec07ee49..9d9a3f79c35 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -66,7 +66,7 @@ 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 < CS_INDEX_SCRIPTED_0 && gSaveContext.nextCutsceneIndex < CS_INDEX_SCRIPTED_0 && + gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4 && gSaveContext.nextCutsceneIndex < CS_INDEX_ENTRANCE_4 && !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))) { diff --git a/src/code/z_message.c b/src/code/z_message.c index 32ec28eeabe..58c2d194a25 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -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 < CS_INDEX_SCRIPTED_0)) { + (msgCtx->textId != 0x3055 && gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4)) { PRINTF("=== day_time=%x ", ((void)0, gSaveContext.save.cutsceneIndex)); if (play->activeCamId == CAM_ID_MAIN) { if (gSaveContext.prevHudVisibilityMode == HUD_VISIBILITY_NO_CHANGE || diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 0147b778f64..739b6debd34 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -644,8 +644,8 @@ void func_80083108(PlayState* play) { s16 i; s16 sp28 = false; - if ((gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0) || - ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_0))) { + if ((gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4) || + ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_4))) { gSaveContext.forceRisingButtonAlphas = false; if ((player->stateFlags1 & PLAYER_STATE1_23) || (play->shootingGalleryStatus > 1) || diff --git a/src/code/z_play.c b/src/code/z_play.c index 1cbe2148cd8..d8216c4890b 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -56,7 +56,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 < CS_INDEX_SCRIPTED_0)) { + (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4)) { // 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, @@ -325,12 +325,12 @@ void Play_Init(GameState* thisx) { AnimTaskQueue_Reset(&this->animTaskQueue); Cutscene_InitContext(this, &this->csCtx); - if (gSaveContext.nextCutsceneIndex != CS_INDEX_MANUAL) { + if (gSaveContext.nextCutsceneIndex != CS_INDEX_NEXT_USED) { gSaveContext.save.cutsceneIndex = gSaveContext.nextCutsceneIndex; - gSaveContext.nextCutsceneIndex = CS_INDEX_MANUAL; + gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_USED; } - if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_D) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_RESET) { gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; } @@ -347,7 +347,7 @@ void Play_Init(GameState* thisx) { Cutscene_HandleConditionalTriggers(this); - if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { + if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { gSaveContext.nayrusLoveTimer = 0; Magic_Reset(this); gSaveContext.sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF); @@ -597,7 +597,7 @@ void Play_Update(PlayState* this) { Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 227cf8b7efd..80260dfc924 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -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 < CS_INDEX_SCRIPTED_0)) || + if (((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4)) || (gSaveContext.save.entranceIndex == ENTR_LAKE_HYLIA_8)) { #if OOT_VERSION >= PAL_1_0 gSaveContext.skyboxTime = ((void)0, gSaveContext.save.dayTime); @@ -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 < CS_INDEX_SCRIPTED_0) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4) { gSaveContext.save.info.worldMapAreaData |= gBitFlags[((void)0, gSaveContext.worldMapArea)]; PRINTF("000 area_arrival=%x (%d)\n", gSaveContext.save.info.worldMapAreaData, ((void)0, gSaveContext.worldMapArea)); diff --git a/src/code/z_sram.c b/src/code/z_sram.c index c729016a19c..854f1f44393 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -793,7 +793,7 @@ 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 = CS_INDEX_SCRIPTED_1; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; #if OOT_DEBUG if (fileSelect->buttonIndex == 0) { diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 2841479d9f0..086667b62a5 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -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 != CS_INDEX_SCRIPTED_0))) { + (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (gSaveContext.save.cutsceneIndex != CS_INDEX_ENTRANCE_4))) { Actor_Kill(&this->dyna.actor); return; } diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index 17c7ca8b5fd..bd4777b46b3 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -109,7 +109,7 @@ void BgRelayObjects_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->dyna.actor.params == WINDMILL_ROTATING_GEAR) && - (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0)) { + (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4)) { CLEAR_EVENTCHKINF(EVENTCHKINF_65); } } 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 035010143e8..49dce983120 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 @@ -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 = CS_INDEX_SCRIPTED_1; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; } else if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 3000.0f, 0x7530)) { diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index c9b649e68b4..26e149b2e27 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -2104,7 +2104,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { FALLTHROUGH; case 20: play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_2; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_6; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; play->linkAgeOnLoad = LINK_AGE_CHILD; 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 8e8303e65d4..29bdbd9b9f1 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -489,7 +489,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 0.0f, 0.2f, 6.0f, 0.01f); this->warpTimer++; - if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == CS_INDEX_MANUAL) { + if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == CS_INDEX_NEXT_USED) { PRINTF("\n\n\nじかんがきたからおーしまい fade_direction=[%d]", play->transitionTrigger, TRANS_TRIGGER_START); if (play->sceneId == SCENE_DODONGOS_CAVERN_BOSS) { @@ -497,7 +497,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Flags_SetEventChkInf(EVENTCHKINF_25); Item_Give(play, ITEM_GORON_RUBY); play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_5; } else { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_5; gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; @@ -508,7 +508,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Flags_SetEventChkInf(EVENTCHKINF_09); Item_Give(play, ITEM_KOKIRI_EMERALD); play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_5; } else { play->nextEntranceIndex = ENTR_KOKIRI_FOREST_11; gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; @@ -600,11 +600,11 @@ void DoorWarp1_RutoWarpOut(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 0.0f, 0.2f, 6.0f, 0.01f); this->warpTimer++; - if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_MANUAL) { + if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_NEXT_USED) { SET_EVENTCHKINF(EVENTCHKINF_37); Item_Give(play, ITEM_ZORA_SAPPHIRE); play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE_SLOW; } @@ -700,7 +700,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } this->warpTimer++; - if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_MANUAL) { + if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_NEXT_USED) { if (play->sceneId == SCENE_FOREST_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_48)) { SET_EVENTCHKINF(EVENTCHKINF_48); @@ -721,7 +721,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { SET_EVENTCHKINF(EVENTCHKINF_49); Item_Give(play, ITEM_MEDALLION_FIRE); play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_3; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_7; } else { if (!LINK_IS_ADULT) { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_4; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index 64c2e024c1a..25d01bb9f32 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -292,7 +292,7 @@ void EnDu_Init(Actor* thisx, PlayState* play) { this->actor.attentionRangeType = ATTENTION_RANGE_1; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGoronCityDarunia01Cs); gSaveContext.cutsceneTrigger = 1; EnDu_SetupAction(this, func_809FE890); diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 4ea8d8a087b..3a81420be25 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -577,7 +577,7 @@ void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { } else { Rupees_ChangeBy(-20); play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_08); 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 e430440f03c..c2ab09eda0d 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 @@ -357,7 +357,7 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { } if ((GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG) && R_EPONAS_SONG_PLAYED) || - ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_1))) { + ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_5))) { func_80A6A4DC(this); } else { this->unk_2A0 = GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG); diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 96f014ef87d..87e0c3c0613 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -427,7 +427,7 @@ void func_80A79BAC(EnIn* this, PlayState* play, s32 index, u32 transitionType) { play->nextEntranceIndex = entrances[index]; if (index == 2) { - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_4; } play->transitionType = transitionType; play->transitionTrigger = TRANS_TRIGGER_START; 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 4fff525fac4..9c33f3b05c1 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -380,7 +380,7 @@ void EnMa1_WaitForPlayback(EnMa1* this, PlayState* play) { GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23; if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionType = TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; this->actionFunc = EnMa1_DoNothing; diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 3709e1c024c..d8a3a2b323a 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -118,7 +118,7 @@ s16 EnMa3_UpdateTalkState(PlayState* play, Actor* thisx) { case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_0; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_4; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_0A); diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index d3cd67a9d6f..fefcf7426b4 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -379,8 +379,7 @@ void EnSa_ChangeAnim(EnSa* this, s32 index) { } s32 func_80AF5DFC(EnSa* this, PlayState* play) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0 && - gSaveContext.save.cutsceneIndex != CS_INDEX_SCRIPTED_D) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4 && gSaveContext.save.cutsceneIndex != CS_INDEX_RESET) { if (play->sceneId == SCENE_KOKIRI_FOREST) { return 4; } 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 f17d8c5aeed..5690b51cc2b 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -779,7 +779,7 @@ s32 EnZl4_CsAskName(EnZl4* this, PlayState* play) { if (this->talkTimer2 == 130) { play->msgCtx.msgMode = MSGMODE_PAUSED; play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_7; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_B; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; } diff --git a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index 305a6562e9b..f7304b9b2e4 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -44,7 +44,7 @@ void ObjDekujr_Init(Actor* thisx, PlayState* play) { ObjDekujr* this = (ObjDekujr*)thisx; s32 pad; - if (gSaveContext.save.cutsceneIndex < CS_INDEX_SCRIPTED_0) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4) { if (!LINK_IS_ADULT) { Actor_Kill(thisx); return; @@ -140,7 +140,7 @@ void ObjDekujr_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) && (this->unk_19B == 0)) { + if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) && (this->unk_19B == 0)) { this->unk_19C = 0; this->unk_19B = 1; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index f6b91ce21d0..c3dc8f58c74 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -10751,7 +10751,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { initMode = PARAMS_GET_S(thisx->params, 8, 4); if ((initMode == 5) || (initMode == 6)) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_SCRIPTED_0) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { initMode = 13; } } @@ -13670,7 +13670,7 @@ s32 func_8084DFF4(PlayState* play, Player* this) { if (this->getItemId == GI_SILVER_GAUNTLETS) { play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.nextCutsceneIndex = CS_INDEX_SCRIPTED_1; + gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_5; play->transitionType = TRANS_TYPE_SANDSTORM_END; this->stateFlags1 &= ~PLAYER_STATE1_29; Player_TryCsAction(play, NULL, PLAYER_CSACTION_8); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index ab0ff0ebe77..c1272ac540e 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1890,7 +1890,7 @@ void FileSelect_LoadGame(GameState* thisx) { gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; gSaveContext.skyboxTime = CLOCK_TIME(0, 0); gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; - gSaveContext.nextCutsceneIndex = CS_INDEX_MANUAL; + gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_USED; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; gSaveContext.nextDayTime = NEXT_TIME_NONE; diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index faf1d863d87..c8edc6ebfb6 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -11,12 +11,12 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { this->state.running = false; gSaveContext.save.linkAge = LINK_AGE_ADULT; Sram_InitDebugSave(); - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; gSaveContext.sceneLayer = 7; // assigning scene layer here is redundant, as Play_Init sets it to // SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF) // or one of the other `enum SceneLayer` values; even so, `7` is exactly - // the value this formula equals to for CS_INDEX_SCRIPTED_3 + // the value this formula equals to for CS_INDEX_ENTRANCE_7 SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index bfbcfa74469..652d2afcda7 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -338,57 +338,57 @@ void MapSelect_UpdateMenu(MapSelectState* this) { if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_0) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_1) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_2) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_3) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_4) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_5) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_6) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_7) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_8) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_9; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_9) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_A; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_A) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_4) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_5) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_6) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_7) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_8) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_9) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_A) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_B) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_C) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_D; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_D) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_E; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_E) { gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; } } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_A; + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_E; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_0) { + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_4) { gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_1) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_0; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_2) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_1; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_3) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_2; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_4) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_3; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_5) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_4; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_6) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_5; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_7) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_6; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_8) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_7; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_9) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_8; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_SCRIPTED_A) { - gSaveContext.save.cutsceneIndex = CS_INDEX_SCRIPTED_9; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_5) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_6) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_7) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_8) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_9) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_A) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_B) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_C) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_D) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_E) { + gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_D; } } @@ -616,39 +616,39 @@ void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = GFXP_HIRAGANA "オヒル " GFXP_KATAKANA "ジャラ"; // clang-format on break; - case CS_INDEX_SCRIPTED_0: + case CS_INDEX_ENTRANCE_4: // clang-format off gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = "デモ00"; // clang-format on break; - case CS_INDEX_SCRIPTED_1: + case CS_INDEX_ENTRANCE_5: label = "デモ01"; break; - case CS_INDEX_SCRIPTED_2: + case CS_INDEX_ENTRANCE_6: label = "デモ02"; break; - case CS_INDEX_SCRIPTED_3: + case CS_INDEX_ENTRANCE_7: label = "デモ03"; break; - case CS_INDEX_SCRIPTED_4: + case CS_INDEX_ENTRANCE_8: label = "デモ04"; break; - case CS_INDEX_SCRIPTED_5: + case CS_INDEX_ENTRANCE_9: label = "デモ05"; break; - case CS_INDEX_SCRIPTED_6: + case CS_INDEX_ENTRANCE_A: label = "デモ06"; break; - case CS_INDEX_SCRIPTED_7: + case CS_INDEX_ENTRANCE_B: label = "デモ07"; break; - case CS_INDEX_SCRIPTED_8: + case CS_INDEX_ENTRANCE_C: label = "デモ08"; break; - case CS_INDEX_SCRIPTED_9: + case CS_INDEX_ENTRANCE_D: label = "デモ09"; break; - case CS_INDEX_SCRIPTED_A: + case CS_INDEX_ENTRANCE_E: label = "デモ0A"; break; }; From 2ec57c90a6ec019d1baaad4d04f36894738dded9 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 12:28:41 +0100 Subject: [PATCH 06/26] improve `CS_INDEX_*` naming, rem `ENTRANCE` suffix https://github.com/zeldaret/oot/pull/2286#discussion_r1829165205 reverified with > `check_format.py ...` > `make ...` --- include/z64cutscene.h | 45 +++--- src/code/z_demo.c | 150 +++++++++--------- src/code/z_horse.c | 2 +- src/code/z_kaleido_setup.c | 2 +- src/code/z_message.c | 2 +- src/code/z_parameter.c | 4 +- src/code/z_play.c | 7 +- src/code/z_scene.c | 4 +- src/code/z_sram.c | 2 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 2 +- .../ovl_Bg_Relay_Objects/z_bg_relay_objects.c | 3 +- .../z_bg_spot00_hanebasi.c | 2 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 8 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 2 +- .../z_en_horse_link_child.c | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 2 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 2 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 2 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 2 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 4 +- .../actors/ovl_player_actor/z_player.c | 4 +- .../gamestates/ovl_opening/z_opening.c | 4 +- src/overlays/gamestates/ovl_select/z_select.c | 110 ++++++------- 26 files changed, 185 insertions(+), 188 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 7713abc7c5d..a9d52c6c555 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -346,36 +346,35 @@ typedef enum CutsceneDestination { /* correlation with `enum SceneLayer`: - CS_INDEX_NEXT_USED: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] - CS_INDEX_ENTRANCE_*: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) + CS_INDEX_NEXT_USED: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] + CS_INDEX_*: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) correlation with `enum EntranceIndex` - CS_INDEX_NEXT_USED: base entrance index + scene layer - CS_INDEX_ENTRANCE_*: base entrance index + scene layer + CS_INDEX_NEXT_USED: base entrance index + scene layer + CS_INDEX_*: base entrance index + scene layer `z_select.c` naming: - CS_INDEX_NONE: "Stage: night" - CS_INDEX_LAST: "Stage: day" - CS_INDEX_ENTRANCE_*: "Stage demo 0*", between [CS_INDEX_ENTRANCE_4 .. CS_INDEX_ENTRANCE_E] + CS_INDEX_NONE: "Stage: night" + CS_INDEX_LAST: "Stage: day" + CS_INDEX_*: "Stage demo 0*" */ typedef enum CutsceneIndex { CS_INDEX_NONE = 0x0000, - CS_INDEX_NEXT_USED = 0xFFEF, // a guess as per `z_play.c:328` - CS_INDEX_ENTRANCE_4 = 0xFFF0, // e.g. ENTR_TEMPLE_OF_TIME_0_4 - CS_INDEX_ENTRANCE_5 = 0xFFF1, - CS_INDEX_ENTRANCE_6 = 0xFFF2, - CS_INDEX_ENTRANCE_7 = 0xFFF3, - CS_INDEX_ENTRANCE_8 = 0xFFF4, - CS_INDEX_ENTRANCE_9 = 0xFFF5, - CS_INDEX_ENTRANCE_A = 0xFFF6, - CS_INDEX_ENTRANCE_B = 0xFFF7, - CS_INDEX_ENTRANCE_C = 0xFFF8, - CS_INDEX_ENTRANCE_D = 0xFFF9, - CS_INDEX_ENTRANCE_E = 0xFFFA, - CS_INDEX_ENTRANCE_F = 0xFFFB, // e.g. ENTR_TEMPLE_OF_TIME_0_15 - CS_INDEX_RESET = 0xFFFD, // a guess as per `z_play.c:333` - CS_INDEX_STOP = 0xFFFF, // a guess as per `z_demo.c:1369` and `z_demo.c:1372` - CS_INDEX_LAST = 0x8000 // unknown, `z_demo.c:747` for CS_DEST_DEATH_MOUNTAIN_TRAIL + CS_INDEX_NEXT_USED = 0xFFEF, // a guess as per `z_play.c:328` + CS_INDEX_0 = 0xFFF0, // e.g. ENTR_TEMPLE_OF_TIME_0_4 + CS_INDEX_1 = 0xFFF1, + CS_INDEX_2 = 0xFFF2, + CS_INDEX_3 = 0xFFF3, + CS_INDEX_4 = 0xFFF4, + CS_INDEX_5 = 0xFFF5, + CS_INDEX_6 = 0xFFF6, + CS_INDEX_7 = 0xFFF7, + CS_INDEX_8 = 0xFFF8, + CS_INDEX_9 = 0xFFF9, + CS_INDEX_A = 0xFFFA, // e.g. ENTR_TEMPLE_OF_TIME_0_14 + CS_INDEX_RESET = 0xFFFD, // a guess as per `z_play.c:333` + CS_INDEX_STOP = 0xFFFF, // a guess as per `z_demo.c:1369` and `z_demo.c:1372` + CS_INDEX_LAST = 0x8000 // unknown, `z_demo.c:747` for CS_DEST_DEATH_MOUNTAIN_TRAIL } CutsceneIndex; typedef union CsCmdCam { diff --git a/src/code/z_demo.c b/src/code/z_demo.c index d9c6de9361c..dde7964102a 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -177,7 +177,7 @@ void Cutscene_StopManual(PlayState* play, CutsceneContext* csCtx) { } void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_0) { sManualCutsceneHandlers[csCtx->state](play, csCtx); } } @@ -212,7 +212,7 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { gSaveContext.cutsceneTrigger = 1; } - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0) { Cutscene_SetupScripted(play, csCtx); sScriptedCutsceneHandlers[csCtx->state](play, csCtx); } @@ -596,49 +596,49 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti switch (cmd->destination) { case CS_DEST_CUTSCENE_MAP_GANON_HORSE: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_CUTSCENE_MAP_THREE_GODDESSES: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_GERUDO_VALLEY_DIN_PART_1: play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_DEATH_MOUNTAIN_TRAIL_NAYRU: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_KOKIRI_FOREST_FARORE: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_CUTSCENE_MAP_TRIFORCE_CREATION: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_WHITE; break; case CS_DEST_KOKIRI_FOREST_RECEIVE_KOKIRI_EMERALD: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -651,7 +651,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti SET_EVENTCHKINF(EVENTCHKINF_45); play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_3; play->transitionType = TRANS_TYPE_INSTANT; } else { if (!IS_CUTSCENE_LAYER) { @@ -671,21 +671,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_GERUDO_VALLEY_DIN_PART_2: play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FILL_BROWN; break; case CS_DEST_LINKS_HOUSE_INTRO: play->nextEntranceIndex = ENTR_LINKS_HOUSE_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KOKIRI_FOREST_INTRO: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_3; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -712,21 +712,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; + gSaveContext.save.cutsceneIndex = CS_INDEX_5; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; + gSaveContext.save.cutsceneIndex = CS_INDEX_6; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -750,7 +750,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_LAKE_HYLIA_WATER_RESTORED: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -758,14 +758,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti Item_Give(play, ITEM_SONG_REQUIEM); play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_CUTSCENE_MAP_GANONDORF_DEFEATED_CREDITS: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; + gSaveContext.save.cutsceneIndex = CS_INDEX_8; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -779,28 +779,28 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_KOKIRI_EMERALD_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_4; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_GORON_RUBY_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; + gSaveContext.save.cutsceneIndex = CS_INDEX_5; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_TEMPLE_OF_TIME_ZORAS_SAPPHIRE_RESTORED_2: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; + gSaveContext.save.cutsceneIndex = CS_INDEX_6; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -830,7 +830,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_2; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -843,28 +843,28 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_CUTSCENE_MAP_GANONDORF_FROM_MASTER_SWORD: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_3; play->transitionType = TRANS_TYPE_FADE_WHITE; break; case CS_DEST_HYRULE_FIELD_INTRO_DREAM: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case CS_DEST_CUTSCENE_MAP_SHEIKAH_LEGEND: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_4; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; case CS_DEST_TEMPLE_OF_TIME_ZELDA_REVEAL: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_D; + gSaveContext.save.cutsceneIndex = CS_INDEX_9; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -872,7 +872,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_E; + gSaveContext.save.cutsceneIndex = CS_INDEX_A; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -885,7 +885,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KAKARIKO_VILLAGE_DRAIN_WELL: play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_2; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -915,7 +915,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti SET_EVENTCHKINF(EVENTCHKINF_54); play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; break; @@ -940,14 +940,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_HYRULE_FIELD_FROM_ZELDAS_COURTYARD: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; + gSaveContext.save.cutsceneIndex = CS_INDEX_8; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_WHITE, TCS_SLOW); break; case CS_DEST_TEMPLE_OF_TIME_SONG_OF_TIME: play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; + gSaveContext.save.cutsceneIndex = CS_INDEX_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_INSTANT; break; @@ -965,56 +965,56 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti #endif play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_GERUDO_FORTRESS_CREDITS: play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KAKARIKO_VILLAGE_CREDITS: play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_4; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_1: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_3; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_GORON_CITY_CREDITS: play->nextEntranceIndex = ENTR_GORON_CITY_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LAKE_HYLIA_CREDITS: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZORAS_FOUNTAIN_CREDITS: play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZORAS_DOMAIN_CREDITS: play->nextEntranceIndex = ENTR_ZORAS_DOMAIN_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1022,21 +1022,21 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KOKIRI_FOREST_CREDITS_PART_1: play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; + gSaveContext.save.cutsceneIndex = CS_INDEX_6; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_KOKIRI_FOREST_CREDITS_PART_2: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; + gSaveContext.save.cutsceneIndex = CS_INDEX_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_HYRULE_FIELD_CREDITS: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; + gSaveContext.save.cutsceneIndex = CS_INDEX_5; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1044,7 +1044,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_LON_LON_RANCH_CREDITS_PART_1_ALT: play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1064,7 +1064,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_CUTSCENE_MAP_DEKU_SPROUT_PART_2: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; + gSaveContext.save.cutsceneIndex = CS_INDEX_5; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1077,7 +1077,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_DEATH_MOUNTAIN_TRAIL_CREDITS_PART_2: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_4; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1090,14 +1090,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_ZELDAS_COURTYARD_CREDITS: play->nextEntranceIndex = ENTR_CASTLE_COURTYARD_ZELDA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionType = TRANS_TYPE_FADE_BLACK; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1106,14 +1106,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_2; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LON_LON_RANCH_CREDITS_PART_2: play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_3; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; break; @@ -1122,7 +1122,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; + gSaveContext.save.cutsceneIndex = CS_INDEX_4; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1130,7 +1130,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; + gSaveContext.save.cutsceneIndex = CS_INDEX_5; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1138,14 +1138,14 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->linkAgeOnLoad = LINK_AGE_CHILD; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; + gSaveContext.save.cutsceneIndex = CS_INDEX_6; play->transitionType = TRANS_TYPE_FADE_BLACK; break; case CS_DEST_LON_LON_RANCH_CREDITS_PART_6: play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; + gSaveContext.save.cutsceneIndex = CS_INDEX_7; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1185,7 +1185,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti GET_EVENTCHKINF(EVENTCHKINF_4A)) { play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_3; play->transitionType = TRANS_TYPE_FADE_BLACK; } else { switch (gSaveContext.sceneLayer) { @@ -1204,7 +1204,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case 10: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; play->transitionType = TRANS_TYPE_FADE_WHITE; break; } @@ -1215,7 +1215,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { SET_EVENTCHKINF(EVENTCHKINF_C8); @@ -1230,7 +1230,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionType = TRANS_TYPE_FADE_WHITE_FAST; } else { play->nextEntranceIndex = ENTR_GRAVEYARD_8; @@ -1256,7 +1256,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_KOKIRI_FOREST_FROM_CHAMBER_OF_SAGES: play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; + gSaveContext.save.cutsceneIndex = CS_INDEX_8; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE; @@ -1277,7 +1277,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_HYRULE_FIELD_TITLE_SCREEN: play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_3; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1286,7 +1286,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_SPIRIT_TEMPLE: play->nextEntranceIndex = ENTR_SPIRIT_TEMPLE_BOSS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.save.cutsceneIndex = CS_INDEX_2; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination++; break; @@ -1294,7 +1294,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_DEATH_MOUNTAIN_CRATER: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination++; break; @@ -1302,7 +1302,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case TITLE_DEMO_GANONDORF_HORSE: play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; + gSaveContext.save.cutsceneIndex = CS_INDEX_6; play->transitionType = TRANS_TYPE_FADE_BLACK; sTitleDemoDestination = TITLE_DEMO_SPIRIT_TEMPLE; break; @@ -1312,7 +1312,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti case CS_DEST_GRAVEYARD_SUNS_SONG_PART_2: play->nextEntranceIndex = ENTR_GRAVEYARD_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1405,7 +1405,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti Audio_SetSfxBanksMute(0x6F); play->linkAgeOnLoad = LINK_AGE_ADULT; play->nextEntranceIndex = ENTR_HYRULE_FIELD_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; + gSaveContext.save.cutsceneIndex = CS_INDEX_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; break; @@ -2214,7 +2214,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) } void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0) { #if OOT_DEBUG if (BREG(0) != 0) { Gfx* displayList; @@ -2296,7 +2296,7 @@ void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx) { gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; } - if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) && (csCtx->state == CS_STATE_IDLE)) { + if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_0) && (csCtx->state == CS_STATE_IDLE)) { CutsceneFlags_Unset(play, 0); sCurTextId = 0; @@ -2378,7 +2378,7 @@ void Cutscene_HandleEntranceTriggers(PlayState* play) { if ((gSaveContext.save.entranceIndex == entranceCutscene->entrance) && (!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_EPONA_OBTAINED)) && - (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4) && ((u8)gSaveContext.save.linkAge == requiredAge) && + (gSaveContext.save.cutsceneIndex < CS_INDEX_0) && ((u8)gSaveContext.save.linkAge == requiredAge) && (gSaveContext.respawnFlag <= 0)) { Flags_SetEventChkInf(entranceCutscene->flag); Cutscene_SetScript(play, entranceCutscene->script); @@ -2393,32 +2393,32 @@ void Cutscene_HandleConditionalTriggers(PlayState* play) { PRINTF("\ngame_info.mode=[%d] restart_flag", ((void)0, gSaveContext.respawnFlag)); if ((gSaveContext.gameMode == GAMEMODE_NORMAL) && (gSaveContext.respawnFlag <= 0) && - (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4)) { + (gSaveContext.save.cutsceneIndex < CS_INDEX_0)) { if ((gSaveContext.save.entranceIndex == ENTR_DESERT_COLOSSUS_1) && !Flags_GetEventChkInf(EVENTCHKINF_AC)) { Flags_SetEventChkInf(EVENTCHKINF_AC); gSaveContext.save.entranceIndex = ENTR_DESERT_COLOSSUS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; } else if ((gSaveContext.save.entranceIndex == ENTR_KAKARIKO_VILLAGE_0) && LINK_IS_ADULT && GET_EVENTCHKINF(EVENTCHKINF_48) && GET_EVENTCHKINF(EVENTCHKINF_49) && GET_EVENTCHKINF(EVENTCHKINF_4A) && !Flags_GetEventChkInf(EVENTCHKINF_AA)) { Flags_SetEventChkInf(EVENTCHKINF_AA); - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; } else if ((gSaveContext.save.entranceIndex == ENTR_LOST_WOODS_9) && !Flags_GetEventChkInf(EVENTCHKINF_C1)) { Flags_SetEventChkInf(EVENTCHKINF_C1); Item_Give(play, ITEM_OCARINA_FAIRY); gSaveContext.save.entranceIndex = ENTR_LOST_WOODS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; } else if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && LINK_IS_ADULT && !Flags_GetEventChkInf(EVENTCHKINF_C4) && (gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_TEMPLE_OF_TIME)) { Flags_SetEventChkInf(EVENTCHKINF_C4); gSaveContext.save.entranceIndex = ENTR_TEMPLE_OF_TIME_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; + gSaveContext.save.cutsceneIndex = CS_INDEX_8; } else if (!Flags_GetEventChkInf(EVENTCHKINF_C7) && (gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_GANON_BOSS)) { Flags_SetEventChkInf(EVENTCHKINF_C7); gSaveContext.save.entranceIndex = ENTR_GANON_BOSS_0; - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.save.cutsceneIndex = CS_INDEX_0; } } } diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 69b96e22a48..6b57f0bc3a1 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -192,7 +192,7 @@ void func_8006D684(PlayState* play, Player* player) { (((void)0, gSaveContext.save.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) { if (D_8011F9B8[i].type == 7) { if ((play->sceneId == SCENE_LON_LON_RANCH) && - (((void)0, gSaveContext.save.cutsceneIndex) == CS_INDEX_ENTRANCE_5)) { + (((void)0, gSaveContext.save.cutsceneIndex) == CS_INDEX_1)) { D_8011F9B8[i].pos.x = player->actor.world.pos.x; D_8011F9B8[i].pos.y = player->actor.world.pos.y; D_8011F9B8[i].pos.z = player->actor.world.pos.z; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 9d9a3f79c35..cdd6b98e56f 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -66,7 +66,7 @@ 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 < CS_INDEX_ENTRANCE_4 && gSaveContext.nextCutsceneIndex < CS_INDEX_ENTRANCE_4 && + 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))) { diff --git a/src/code/z_message.c b/src/code/z_message.c index 58c2d194a25..a8560255bef 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -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 < CS_INDEX_ENTRANCE_4)) { + (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 || diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 739b6debd34..76a7f0fb533 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -644,8 +644,8 @@ void func_80083108(PlayState* play) { s16 i; s16 sp28 = false; - if ((gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4) || - ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_4))) { + 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) || diff --git a/src/code/z_play.c b/src/code/z_play.c index d8216c4890b..353252477da 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -55,8 +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 < CS_INDEX_ENTRANCE_4)) { + 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, @@ -347,7 +346,7 @@ void Play_Init(GameState* thisx) { Cutscene_HandleConditionalTriggers(this); - if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { + 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); @@ -597,7 +596,7 @@ void Play_Update(PlayState* this) { Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING); - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0) { sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF); } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 80260dfc924..78fa0dd6846 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -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 < CS_INDEX_ENTRANCE_4)) || + 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); @@ -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 < CS_INDEX_ENTRANCE_4) { + 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)); diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 854f1f44393..2773e8b371f 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -793,7 +793,7 @@ 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 = CS_INDEX_ENTRANCE_5; + gSaveContext.save.cutsceneIndex = CS_INDEX_1; #if OOT_DEBUG if (fileSelect->buttonIndex == 0) { diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 086667b62a5..f1fcb4801e3 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -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 != CS_INDEX_ENTRANCE_4))) { + (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (gSaveContext.save.cutsceneIndex != CS_INDEX_0))) { Actor_Kill(&this->dyna.actor); return; } diff --git a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c index bd4777b46b3..b7e1b12ef63 100644 --- a/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c +++ b/src/overlays/actors/ovl_Bg_Relay_Objects/z_bg_relay_objects.c @@ -108,8 +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 < CS_INDEX_ENTRANCE_4)) { + if ((this->dyna.actor.params == WINDMILL_ROTATING_GEAR) && (gSaveContext.save.cutsceneIndex < CS_INDEX_0)) { CLEAR_EVENTCHKINF(EVENTCHKINF_65); } } 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 49dce983120..775ad9700f4 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 @@ -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 = CS_INDEX_ENTRANCE_5; + 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)) { diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 26e149b2e27..155b1b96e9d 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -2104,7 +2104,7 @@ void func_8090120C(BossGanon2* this, PlayState* play) { FALLTHROUGH; case 20: play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_6; + gSaveContext.nextCutsceneIndex = CS_INDEX_2; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; play->linkAgeOnLoad = LINK_AGE_CHILD; 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 29bdbd9b9f1..47336a342c1 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -497,7 +497,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Flags_SetEventChkInf(EVENTCHKINF_25); Item_Give(play, ITEM_GORON_RUBY); play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.nextCutsceneIndex = CS_INDEX_1; } else { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_5; gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; @@ -508,7 +508,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Flags_SetEventChkInf(EVENTCHKINF_09); Item_Give(play, ITEM_KOKIRI_EMERALD); play->nextEntranceIndex = ENTR_KOKIRI_FOREST_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.nextCutsceneIndex = CS_INDEX_1; } else { play->nextEntranceIndex = ENTR_KOKIRI_FOREST_11; gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; @@ -604,7 +604,7 @@ void DoorWarp1_RutoWarpOut(DoorWarp1* this, PlayState* play) { SET_EVENTCHKINF(EVENTCHKINF_37); Item_Give(play, ITEM_ZORA_SAPPHIRE); play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.nextCutsceneIndex = CS_INDEX_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE_SLOW; } @@ -721,7 +721,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { SET_EVENTCHKINF(EVENTCHKINF_49); Item_Give(play, ITEM_MEDALLION_FIRE); play->nextEntranceIndex = ENTR_KAKARIKO_VILLAGE_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_7; + gSaveContext.nextCutsceneIndex = CS_INDEX_3; } else { if (!LINK_IS_ADULT) { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_4; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index 25d01bb9f32..9a7b512e319 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -292,7 +292,7 @@ void EnDu_Init(Actor* thisx, PlayState* play) { this->actor.attentionRangeType = ATTENTION_RANGE_1; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0) { play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGoronCityDarunia01Cs); gSaveContext.cutsceneTrigger = 1; EnDu_SetupAction(this, func_809FE890); diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 3a81420be25..7e61fab6cba 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -577,7 +577,7 @@ void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { } else { Rupees_ChangeBy(-20); play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.nextCutsceneIndex = CS_INDEX_0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_08); 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 c2ab09eda0d..d6f9b824f9f 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 @@ -357,7 +357,7 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { } if ((GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG) && R_EPONAS_SONG_PLAYED) || - ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_5))) { + ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.save.cutsceneIndex == CS_INDEX_1))) { func_80A6A4DC(this); } else { this->unk_2A0 = GET_EVENTCHKINF(EVENTCHKINF_CAN_LEARN_EPONAS_SONG); diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 87e0c3c0613..dbb324baddf 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -427,7 +427,7 @@ void func_80A79BAC(EnIn* this, PlayState* play, s32 index, u32 transitionType) { play->nextEntranceIndex = entrances[index]; if (index == 2) { - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.nextCutsceneIndex = CS_INDEX_0; } play->transitionType = transitionType; play->transitionTrigger = TRANS_TRIGGER_START; 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 9c33f3b05c1..ab116e7913a 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -380,7 +380,7 @@ void EnMa1_WaitForPlayback(EnMa1* this, PlayState* play) { GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_23; if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.nextCutsceneIndex = CS_INDEX_1; play->transitionType = TRANS_TYPE_CIRCLE(TCA_WAVE, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; this->actionFunc = EnMa1_DoNothing; diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index d8a3a2b323a..d1e1149aadf 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -118,7 +118,7 @@ s16 EnMa3_UpdateTalkState(PlayState* play, Actor* thisx) { case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_4; + gSaveContext.nextCutsceneIndex = CS_INDEX_0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_0A); diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index fefcf7426b4..11df5e00d96 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -379,7 +379,7 @@ void EnSa_ChangeAnim(EnSa* this, s32 index) { } s32 func_80AF5DFC(EnSa* this, PlayState* play) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4 && gSaveContext.save.cutsceneIndex != CS_INDEX_RESET) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0 && gSaveContext.save.cutsceneIndex != CS_INDEX_RESET) { if (play->sceneId == SCENE_KOKIRI_FOREST) { return 4; } 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 5690b51cc2b..9609bda833a 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -779,7 +779,7 @@ s32 EnZl4_CsAskName(EnZl4* this, PlayState* play) { if (this->talkTimer2 == 130) { play->msgCtx.msgMode = MSGMODE_PAUSED; play->nextEntranceIndex = ENTR_CUTSCENE_MAP_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_B; + gSaveContext.nextCutsceneIndex = CS_INDEX_7; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; } diff --git a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index f7304b9b2e4..c3f1b1d4c3a 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -44,7 +44,7 @@ void ObjDekujr_Init(Actor* thisx, PlayState* play) { ObjDekujr* this = (ObjDekujr*)thisx; s32 pad; - if (gSaveContext.save.cutsceneIndex < CS_INDEX_ENTRANCE_4) { + if (gSaveContext.save.cutsceneIndex < CS_INDEX_0) { if (!LINK_IS_ADULT) { Actor_Kill(thisx); return; @@ -140,7 +140,7 @@ void ObjDekujr_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) && (this->unk_19B == 0)) { + if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_0) && (this->unk_19B == 0)) { this->unk_19C = 0; this->unk_19B = 1; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index c3dc8f58c74..7b7a91c60bb 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -10751,7 +10751,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { initMode = PARAMS_GET_S(thisx->params, 8, 4); if ((initMode == 5) || (initMode == 6)) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_ENTRANCE_4) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0) { initMode = 13; } } @@ -13670,7 +13670,7 @@ s32 func_8084DFF4(PlayState* play, Player* this) { if (this->getItemId == GI_SILVER_GAUNTLETS) { play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_0; play->transitionTrigger = TRANS_TRIGGER_START; - gSaveContext.nextCutsceneIndex = CS_INDEX_ENTRANCE_5; + gSaveContext.nextCutsceneIndex = CS_INDEX_1; play->transitionType = TRANS_TYPE_SANDSTORM_END; this->stateFlags1 &= ~PLAYER_STATE1_29; Player_TryCsAction(play, NULL, PLAYER_CSACTION_8); diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index c8edc6ebfb6..c3262c4b249 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -11,12 +11,12 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { this->state.running = false; gSaveContext.save.linkAge = LINK_AGE_ADULT; Sram_InitDebugSave(); - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; + gSaveContext.save.cutsceneIndex = CS_INDEX_3; gSaveContext.sceneLayer = 7; // assigning scene layer here is redundant, as Play_Init sets it to // SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF) // or one of the other `enum SceneLayer` values; even so, `7` is exactly - // the value this formula equals to for CS_INDEX_ENTRANCE_7 + // the value this formula equals to for CS_INDEX_3 SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 652d2afcda7..a9d55b8c355 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -338,57 +338,57 @@ void MapSelect_UpdateMenu(MapSelectState* this) { if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_4) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_5) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_6) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_7) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_8) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_9) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_A) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_B) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_C) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_D; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_D) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_E; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_E) { + gSaveContext.save.cutsceneIndex = CS_INDEX_0; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_0) { + gSaveContext.save.cutsceneIndex = CS_INDEX_1; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_1) { + gSaveContext.save.cutsceneIndex = CS_INDEX_2; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_2) { + gSaveContext.save.cutsceneIndex = CS_INDEX_3; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_3) { + gSaveContext.save.cutsceneIndex = CS_INDEX_4; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_4) { + gSaveContext.save.cutsceneIndex = CS_INDEX_5; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_5) { + gSaveContext.save.cutsceneIndex = CS_INDEX_6; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_6) { + gSaveContext.save.cutsceneIndex = CS_INDEX_7; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_7) { + gSaveContext.save.cutsceneIndex = CS_INDEX_8; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_8) { + gSaveContext.save.cutsceneIndex = CS_INDEX_9; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_9) { + gSaveContext.save.cutsceneIndex = CS_INDEX_A; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_A) { gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; } } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_E; + gSaveContext.save.cutsceneIndex = CS_INDEX_A; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_4) { + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_0) { gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_5) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_4; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_6) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_5; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_7) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_6; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_8) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_7; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_9) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_8; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_A) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_9; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_B) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_A; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_C) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_B; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_D) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_C; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_ENTRANCE_E) { - gSaveContext.save.cutsceneIndex = CS_INDEX_ENTRANCE_D; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_1) { + gSaveContext.save.cutsceneIndex = CS_INDEX_0; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_2) { + gSaveContext.save.cutsceneIndex = CS_INDEX_1; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_3) { + gSaveContext.save.cutsceneIndex = CS_INDEX_2; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_4) { + gSaveContext.save.cutsceneIndex = CS_INDEX_3; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_5) { + gSaveContext.save.cutsceneIndex = CS_INDEX_4; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_6) { + gSaveContext.save.cutsceneIndex = CS_INDEX_5; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_7) { + gSaveContext.save.cutsceneIndex = CS_INDEX_6; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_8) { + gSaveContext.save.cutsceneIndex = CS_INDEX_7; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_9) { + gSaveContext.save.cutsceneIndex = CS_INDEX_8; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_A) { + gSaveContext.save.cutsceneIndex = CS_INDEX_9; } } @@ -616,39 +616,39 @@ void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = GFXP_HIRAGANA "オヒル " GFXP_KATAKANA "ジャラ"; // clang-format on break; - case CS_INDEX_ENTRANCE_4: + case CS_INDEX_0: // clang-format off gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = "デモ00"; // clang-format on break; - case CS_INDEX_ENTRANCE_5: + case CS_INDEX_1: label = "デモ01"; break; - case CS_INDEX_ENTRANCE_6: + case CS_INDEX_2: label = "デモ02"; break; - case CS_INDEX_ENTRANCE_7: + case CS_INDEX_3: label = "デモ03"; break; - case CS_INDEX_ENTRANCE_8: + case CS_INDEX_4: label = "デモ04"; break; - case CS_INDEX_ENTRANCE_9: + case CS_INDEX_5: label = "デモ05"; break; - case CS_INDEX_ENTRANCE_A: + case CS_INDEX_6: label = "デモ06"; break; - case CS_INDEX_ENTRANCE_B: + case CS_INDEX_7: label = "デモ07"; break; - case CS_INDEX_ENTRANCE_C: + case CS_INDEX_8: label = "デモ08"; break; - case CS_INDEX_ENTRANCE_D: + case CS_INDEX_9: label = "デモ09"; break; - case CS_INDEX_ENTRANCE_E: + case CS_INDEX_A: label = "デモ0A"; break; }; From b8953fd0b901f13af7bc6a2f0a08d1e102c9f858 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 13:08:27 +0100 Subject: [PATCH 07/26] apply Jenkins fixes https://jenkins.deco.mp/job/OOT/job/PR-2286/4/console hmm, i do need this automation locally to --- src/boot/z_std_dma.c | 2 +- src/code/fault_gc.c | 2 +- src/code/fault_n64.c | 4 ++-- src/code/graph.c | 2 +- src/code/main.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_collision_check.c | 2 +- src/code/z_demo.c | 2 +- src/code/z_kankyo.c | 4 ++-- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- src/overlays/actors/ovl_player_actor/z_player.c | 6 +++--- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index d609ce6f103..d473c442933 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -27,7 +27,7 @@ #endif #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:92 pal-1.0:90 pal-1.1:90" + "ntsc-1.2:88 pal-1.0:86 pal-1.1:86" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index e9b7de4b613..68d9368fd02 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -42,7 +42,7 @@ */ #if PLATFORM_GC -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:176 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192" \ +#pragma increment_block_number "gc-eu:176 gc-eu-mq:176 gc-eu-mq-dbg:176 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192" \ "gc-us-mq:192" #include "global.h" diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index 5145173e981..5321e64ce82 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -1,6 +1,6 @@ #if PLATFORM_N64 -#pragma increment_block_number "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #include "global.h" #include "fault.h" @@ -8,7 +8,7 @@ #include "stack.h" #include "terminal.h" -#pragma increment_block_number "ntsc-1.2:96 pal-1.0:96 pal-1.1:96" +#pragma increment_block_number "ntsc-1.2:192 pal-1.0:192 pal-1.1:192" typedef struct FaultMgr { OSThread thread; diff --git a/src/code/graph.c b/src/code/graph.c index 1a98ab1afbe..80561d5ebac 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -8,7 +8,7 @@ #define GFXPOOL_TAIL_MAGIC 0x5678 #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + "ntsc-1.2:160 pal-1.0:160 pal-1.1:160" /** * The time at which the previous `Graph_Update` ended. diff --git a/src/code/main.c b/src/code/main.c index 6c2b35af296..50b69bcf235 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -24,7 +24,7 @@ extern struct IrqMgr gIrqMgr; #endif #pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.2:151 pal-1.0:149 pal-1.1:149" + "ntsc-1.2:148 pal-1.0:146 pal-1.1:146" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 5a6986dc835..3daf0e65da1 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3639,7 +3639,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:93 pal-1.0:91 pal-1.1:91" + "ntsc-1.2:90 pal-1.0:88 pal-1.1:88" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 41555de22ea..05147f30b5d 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -16,7 +16,7 @@ #include "z_lib.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:104 pal-1.0:104 pal-1.1:104" + "ntsc-1.2:96 pal-1.0:96 pal-1.1:96" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index dde7964102a..3bac2ce2a45 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -124,7 +124,7 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:188 gc-eu-mq:176 gc-jp:188 gc-jp-ce:188 gc-jp-mq:176 gc-us:188 gc-us-mq:176" \ +#pragma increment_block_number "gc-eu:186 gc-eu-mq:176 gc-jp:188 gc-jp-ce:188 gc-jp-mq:176 gc-us:188 gc-us-mq:176" \ "ntsc-1.2:80 pal-1.0:80 pal-1.1:80" // Cam ID to return to when a scripted cutscene is finished diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index b1105e2cb24..c73ec2d0a14 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:244 gc-eu-mq:244 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ntsc-1.2:224 pal-1.0:252 pal-1.1:252" +#pragma increment_block_number "gc-eu:240 gc-eu-mq:240 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ + "ntsc-1.2:224 pal-1.0:248 pal-1.1:248" #include "global.h" #include "ultra64.h" diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 255d5fc3364..588ddc77e1c 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -35,7 +35,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:180 gc-eu-mq:180 gc-jp:180 gc-jp-ce:180 gc-jp-mq:180 gc-us:180 gc-us-mq:180" \ +#pragma increment_block_number "gc-eu:177 gc-eu-mq:177 gc-jp:177 gc-jp-ce:177 gc-jp-mq:177 gc-us:177 gc-us-mq:177" \ "ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS ACTOR_FLAG_4 diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 7b7a91c60bb..0f2559ad60a 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -81,10 +81,10 @@ typedef enum AnimSfxType { #define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) -#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame) & 0x7FF))) +#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame)&0x7FF))) -#define ANIMSFX_GET_TYPE(data) ((data) & 0x7800) -#define ANIMSFX_GET_FRAME(data) ((data) & 0x7FF) +#define ANIMSFX_GET_TYPE(data) ((data)&0x7800) +#define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; From 32a2dd0ae2e6574d6795fa3ceed1de2413bcff8a Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 13:10:20 +0100 Subject: [PATCH 08/26] apply a PR suggestion https://github.com/zeldaret/oot/pull/2286#discussion_r1829219841 --- include/z64cutscene.h | 8 ++++---- src/code/db_camera.c | 2 +- src/code/z_demo.c | 8 ++++---- src/code/z_play.c | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index a9d52c6c555..d59c6d798a0 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -371,10 +371,10 @@ typedef enum CutsceneIndex { CS_INDEX_7 = 0xFFF7, CS_INDEX_8 = 0xFFF8, CS_INDEX_9 = 0xFFF9, - CS_INDEX_A = 0xFFFA, // e.g. ENTR_TEMPLE_OF_TIME_0_14 - CS_INDEX_RESET = 0xFFFD, // a guess as per `z_play.c:333` - CS_INDEX_STOP = 0xFFFF, // a guess as per `z_demo.c:1369` and `z_demo.c:1372` - CS_INDEX_LAST = 0x8000 // unknown, `z_demo.c:747` for CS_DEST_DEATH_MOUNTAIN_TRAIL + CS_INDEX_A = 0xFFFA, // e.g. ENTR_TEMPLE_OF_TIME_0_14 + CS_INDEX_TRIGGERED = 0xFFFD, // a guess as per `z_play.c:333` + CS_INDEX_STOP = 0xFFFF, // a guess as per `z_demo.c:1369` and `z_demo.c:1372` + CS_INDEX_LAST = 0x8000 // unknown, `z_demo.c:747` for CS_DEST_DEATH_MOUNTAIN_TRAIL } CutsceneIndex; typedef union CsCmdCam { diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 8027d7c61d0..87c9c85e921 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -2185,7 +2185,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 = CS_INDEX_RESET; + gSaveContext.save.cutsceneIndex = CS_INDEX_TRIGGERED; gSaveContext.cutsceneTrigger = 1; sDebugCamAnim.curFrame = 0.0f; sDebugCamAnim.keyframe = 0; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 3bac2ce2a45..dfac614dc22 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -189,14 +189,14 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) { gUseCutsceneCam = false; - gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; + gSaveContext.save.cutsceneIndex = CS_INDEX_TRIGGERED; gSaveContext.cutsceneTrigger = 1; } if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER && !gDebugCamEnabled) { gUseCutsceneCam = true; - gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; + gSaveContext.save.cutsceneIndex = CS_INDEX_TRIGGERED; gSaveContext.cutsceneTrigger = 1; } } @@ -208,7 +208,7 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE)) { PRINTF(T("\nデモ開始要求 発令!", "\nDemo start request issued!")); - gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; + gSaveContext.save.cutsceneIndex = CS_INDEX_TRIGGERED; gSaveContext.cutsceneTrigger = 1; } @@ -2293,7 +2293,7 @@ void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx) { u8 i; if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(play)) { - gSaveContext.save.cutsceneIndex = CS_INDEX_RESET; + gSaveContext.save.cutsceneIndex = CS_INDEX_TRIGGERED; } if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_0) && (csCtx->state == CS_STATE_IDLE)) { diff --git a/src/code/z_play.c b/src/code/z_play.c index 353252477da..7d18d4223a8 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -329,7 +329,7 @@ void Play_Init(GameState* thisx) { gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_USED; } - if (gSaveContext.save.cutsceneIndex == CS_INDEX_RESET) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_TRIGGERED) { gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; } diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 11df5e00d96..28a72de8673 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -379,7 +379,7 @@ void EnSa_ChangeAnim(EnSa* this, s32 index) { } s32 func_80AF5DFC(EnSa* this, PlayState* play) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0 && gSaveContext.save.cutsceneIndex != CS_INDEX_RESET) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0 && gSaveContext.save.cutsceneIndex != CS_INDEX_TRIGGERED) { if (play->sceneId == SCENE_KOKIRI_FOREST) { return 4; } From 2bd2ca20dd8fb79b839c04bb10bbff529cb47a5b Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 16:27:43 +0100 Subject: [PATCH 09/26] remove redundant comments, fix the header comment and add a comment chunk from https://github.com/zeldaret/oot/pull/2286#discussion_r1829108940 --- include/z64cutscene.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index d59c6d798a0..c930744fd72 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -346,12 +346,12 @@ typedef enum CutsceneDestination { /* correlation with `enum SceneLayer`: - CS_INDEX_NEXT_USED: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] - CS_INDEX_*: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) + CS_INDEX_NONE: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] + CS_INDEX_*: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) correlation with `enum EntranceIndex` - CS_INDEX_NEXT_USED: base entrance index + scene layer - CS_INDEX_*: base entrance index + scene layer + CS_INDEX_NONE: base entrance index + scene layer + CS_INDEX_*: base entrance index + scene layer `z_select.c` naming: CS_INDEX_NONE: "Stage: night" @@ -360,8 +360,8 @@ correlation with `enum EntranceIndex` */ typedef enum CutsceneIndex { CS_INDEX_NONE = 0x0000, - CS_INDEX_NEXT_USED = 0xFFEF, // a guess as per `z_play.c:328` - CS_INDEX_0 = 0xFFF0, // e.g. ENTR_TEMPLE_OF_TIME_0_4 + CS_INDEX_NEXT_USED = 0xFFEF, // assigned cutscene index, can schedule next again + CS_INDEX_0 = 0xFFF0, CS_INDEX_1 = 0xFFF1, CS_INDEX_2 = 0xFFF2, CS_INDEX_3 = 0xFFF3, @@ -371,10 +371,10 @@ typedef enum CutsceneIndex { CS_INDEX_7 = 0xFFF7, CS_INDEX_8 = 0xFFF8, CS_INDEX_9 = 0xFFF9, - CS_INDEX_A = 0xFFFA, // e.g. ENTR_TEMPLE_OF_TIME_0_14 - CS_INDEX_TRIGGERED = 0xFFFD, // a guess as per `z_play.c:333` - CS_INDEX_STOP = 0xFFFF, // a guess as per `z_demo.c:1369` and `z_demo.c:1372` - CS_INDEX_LAST = 0x8000 // unknown, `z_demo.c:747` for CS_DEST_DEATH_MOUNTAIN_TRAIL + CS_INDEX_A = 0xFFFA, + CS_INDEX_TRIGGERED = 0xFFFD, + CS_INDEX_STOP = 0xFFFF, // a guess as per `z_demo.c:1369` and `z_demo.c:1372` + CS_INDEX_LAST = 0x8000 // unknown, `z_demo.c:747` for CS_DEST_DEATH_MOUNTAIN_TRAIL } CutsceneIndex; typedef union CsCmdCam { From 6eaaa8706cf31c13bb88dc026fdb6d8ceeee8d98 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 17:00:42 +0100 Subject: [PATCH 10/26] rename the flag for freeing `nextCutsceneIndex` --- include/z64cutscene.h | 2 +- src/code/z_common_data.c | 2 +- src/code/z_play.c | 4 ++-- src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c | 6 +++--- src/overlays/gamestates/ovl_file_choose/z_file_choose.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index c930744fd72..f5ef708e83a 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -360,7 +360,7 @@ correlation with `enum EntranceIndex` */ typedef enum CutsceneIndex { CS_INDEX_NONE = 0x0000, - CS_INDEX_NEXT_USED = 0xFFEF, // assigned cutscene index, can schedule next again + CS_INDEX_NEXT_EMPTY = 0xFFEF, // is allowed to schedule a cutscene CS_INDEX_0 = 0xFFF0, CS_INDEX_1 = 0xFFF1, CS_INDEX_2 = 0xFFF2, diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 9837cf3c14d..4de25ced8f6 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -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 = CS_INDEX_NEXT_USED; + gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_EMPTY; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; gSaveContext.nextDayTime = NEXT_TIME_NONE; diff --git a/src/code/z_play.c b/src/code/z_play.c index 7d18d4223a8..9fff885c534 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -324,9 +324,9 @@ void Play_Init(GameState* thisx) { AnimTaskQueue_Reset(&this->animTaskQueue); Cutscene_InitContext(this, &this->csCtx); - if (gSaveContext.nextCutsceneIndex != CS_INDEX_NEXT_USED) { + if (gSaveContext.nextCutsceneIndex != CS_INDEX_NEXT_EMPTY) { gSaveContext.save.cutsceneIndex = gSaveContext.nextCutsceneIndex; - gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_USED; + gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_EMPTY; } if (gSaveContext.save.cutsceneIndex == CS_INDEX_TRIGGERED) { 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 47336a342c1..0cfe68c6091 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -489,7 +489,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 0.0f, 0.2f, 6.0f, 0.01f); this->warpTimer++; - if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == CS_INDEX_NEXT_USED) { + if (sWarpTimerTarget < this->warpTimer && gSaveContext.nextCutsceneIndex == CS_INDEX_NEXT_EMPTY) { PRINTF("\n\n\nじかんがきたからおーしまい fade_direction=[%d]", play->transitionTrigger, TRANS_TRIGGER_START); if (play->sceneId == SCENE_DODONGOS_CAVERN_BOSS) { @@ -600,7 +600,7 @@ void DoorWarp1_RutoWarpOut(DoorWarp1* this, PlayState* play) { Math_SmoothStepToF(&this->lightRayAlpha, 0.0f, 0.2f, 6.0f, 0.01f); this->warpTimer++; - if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_NEXT_USED) { + if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_NEXT_EMPTY) { SET_EVENTCHKINF(EVENTCHKINF_37); Item_Give(play, ITEM_ZORA_SAPPHIRE); play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; @@ -700,7 +700,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } this->warpTimer++; - if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_NEXT_USED) { + if (this->warpTimer > sWarpTimerTarget && gSaveContext.nextCutsceneIndex == CS_INDEX_NEXT_EMPTY) { if (play->sceneId == SCENE_FOREST_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_48)) { SET_EVENTCHKINF(EVENTCHKINF_48); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index c1272ac540e..e606215e461 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1890,7 +1890,7 @@ void FileSelect_LoadGame(GameState* thisx) { gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; gSaveContext.skyboxTime = CLOCK_TIME(0, 0); gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT; - gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_USED; + gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_EMPTY; gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; gSaveContext.nextDayTime = NEXT_TIME_NONE; From d9bbd671370766289ae173a63f95985f420f827b Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 17:07:03 +0100 Subject: [PATCH 11/26] rename the flag for automatic `sceneLayer` calc it gets assigned to the `nextCutsceneIndex`, so `CS_INDEX_NONE` name was misleading --- include/z64cutscene.h | 8 +++---- src/code/z_demo.c | 4 ++-- src/code/z_kankyo.c | 2 +- src/code/z_parameter.c | 4 ++-- src/code/z_play.c | 2 +- src/code/z_sram.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 24 +++++++++---------- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 2 +- .../z_en_horse_game_check.c | 8 +++---- src/overlays/gamestates/ovl_select/z_select.c | 12 +++++----- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index f5ef708e83a..390f87e3e6b 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -346,20 +346,20 @@ typedef enum CutsceneDestination { /* correlation with `enum SceneLayer`: - CS_INDEX_NONE: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] + CS_INDEX_AUTO: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] CS_INDEX_*: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) correlation with `enum EntranceIndex` - CS_INDEX_NONE: base entrance index + scene layer + CS_INDEX_AUTO: base entrance index + scene layer CS_INDEX_*: base entrance index + scene layer `z_select.c` naming: - CS_INDEX_NONE: "Stage: night" + CS_INDEX_AUTO: "Stage: night" CS_INDEX_LAST: "Stage: day" CS_INDEX_*: "Stage demo 0*" */ typedef enum CutsceneIndex { - CS_INDEX_NONE = 0x0000, + CS_INDEX_AUTO = 0x0000, CS_INDEX_NEXT_EMPTY = 0xFFEF, // is allowed to schedule a cutscene CS_INDEX_0 = 0xFFF0, CS_INDEX_1 = 0xFFF1, diff --git a/src/code/z_demo.c b/src/code/z_demo.c index dfac614dc22..6661f293862 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -591,7 +591,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti gSaveContext.forceRisingButtonAlphas = true; } - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; switch (cmd->destination) { case CS_DEST_CUTSCENE_MAP_GANON_HORSE: @@ -2267,7 +2267,7 @@ void CutsceneHandler_StopScript(PlayState* play, CutsceneContext* csCtx) { PRINTF(T("\n\n\n\n\nやっぱりここかいな", "\n\n\n\n\nThis is it after all")); - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; gSaveContext.gameMode = GAMEMODE_NORMAL; if (gUseCutsceneCam) { diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index c73ec2d0a14..0cb9615e6d7 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -2618,7 +2618,7 @@ void Environment_StopStormNatureAmbience(PlayState* play) { void Environment_WarpSongLeave(PlayState* play) { gWeatherMode = WEATHER_MODE_CLEAR; - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; gSaveContext.respawnFlag = -3; play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 76a7f0fb533..c03c4bb1fdd 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3523,7 +3523,7 @@ void Interface_Draw(PlayState* play) { (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT)) { // Trade quest timer reached 0 sSubTimerStateTimer = 40; - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.subTimerState = SUBTIMER_STATE_OFF; @@ -3861,7 +3861,7 @@ void Interface_Draw(PlayState* play) { (play->sceneId != SCENE_INSIDE_GANONS_CASTLE_COLLAPSE))) { sSubTimerStateTimer = 40; gSaveContext.subTimerState = SUBTIMER_STATE_RESPAWN; - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; Message_StartTextbox(play, 0x71B0, NULL); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); } else { diff --git a/src/code/z_play.c b/src/code/z_play.c index 9fff885c534..969e141cbbf 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -330,7 +330,7 @@ void Play_Init(GameState* thisx) { } if (gSaveContext.save.cutsceneIndex == CS_INDEX_TRIGGERED) { - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } if (gSaveContext.nextDayTime != NEXT_TIME_NONE) { diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 2773e8b371f..a513fd85b24 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -797,7 +797,7 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) { #if OOT_DEBUG if (fileSelect->buttonIndex == 0) { - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } #endif 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 0cfe68c6091..c6d1aedfe31 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -500,7 +500,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { gSaveContext.nextCutsceneIndex = CS_INDEX_1; } else { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_5; - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; } } else if (play->sceneId == SCENE_DEKU_TREE_BOSS) { if (!Flags_GetEventChkInf(EVENTCHKINF_07)) { @@ -511,11 +511,11 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { gSaveContext.nextCutsceneIndex = CS_INDEX_1; } else { play->nextEntranceIndex = ENTR_KOKIRI_FOREST_11; - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; } } else if (play->sceneId == SCENE_JABU_JABU_BOSS) { play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; } PRINTF("\n\n\nおわりおわり"); play->transitionTrigger = TRANS_TRIGGER_START; @@ -706,7 +706,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { SET_EVENTCHKINF(EVENTCHKINF_48); Item_Give(play, ITEM_MEDALLION_FOREST); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; } else { if (!LINK_IS_ADULT) { @@ -714,7 +714,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_SACRED_FOREST_MEADOW_3; } - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; } } else if (play->sceneId == SCENE_FIRE_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_49)) { @@ -728,14 +728,14 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_5; } - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; } } else if (play->sceneId == SCENE_WATER_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_4A)) { SET_EVENTCHKINF(EVENTCHKINF_4A); Item_Give(play, ITEM_MEDALLION_WATER); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; gSaveContext.chamberCutsceneNum = CHAMBER_CS_WATER; } else { if (!LINK_IS_ADULT) { @@ -743,13 +743,13 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_LAKE_HYLIA_9; } - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; } } else if (play->sceneId == SCENE_SPIRIT_TEMPLE_BOSS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { Item_Give(play, ITEM_MEDALLION_SPIRIT); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SPIRIT; } else { if (!LINK_IS_ADULT) { @@ -757,13 +757,13 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_8; } - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; } } else if (play->sceneId == SCENE_SHADOW_TEMPLE_BOSS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { Item_Give(play, ITEM_MEDALLION_SHADOW); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SHADOW; } else { if (!LINK_IS_ADULT) { @@ -771,7 +771,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_GRAVEYARD_8; } - gSaveContext.nextCutsceneIndex = CS_INDEX_NONE; + gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; } } play->transitionTrigger = TRANS_TRIGGER_START; 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 06693637af9..0912c579911 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -2544,7 +2544,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { EnHorse_UpdateHbaRaceInfo(this, play, &sHbaInfo); if ((this->hbaFlags & 1) || (this->hbaTimer >= 46)) { if ((isFanfarePlaying != true) && (gSaveContext.minigameState != 3)) { - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_16; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST); diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 28cc07eecaa..0e75d3ec068 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -110,7 +110,7 @@ s32 EnHorseGameCheck_DestroyIngoRace(EnHorseGameCheckBase* base, PlayState* play } void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, PlayState* play) { - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; if (this->result == INGORACE_PLAYER_WIN) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_7; if (GET_EVENTINF(EVENTINF_HORSES_06)) { @@ -297,21 +297,21 @@ s32 EnHorseGameCheck_DestroyMalonRace(EnHorseGameCheckBase* base, PlayState* pla void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, PlayState* play) { if ((this->result == MALONRACE_SUCCESS) || (this->result == MALONRACE_TIME_UP)) { - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; play->nextEntranceIndex = ENTR_LON_LON_RANCH_7; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; } else if (this->result == MALONRACE_FAILURE) { gSaveContext.timerSeconds = 240; gSaveContext.timerState = TIMER_STATE_UP_FREEZE; - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; play->nextEntranceIndex = ENTR_LON_LON_RANCH_7; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; } else { // "not supported" PRINTF("En_HGC_Spot20_Ta_end():対応せず\n"); - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index a9d55b8c355..4b8bcc5013a 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -336,8 +336,8 @@ void MapSelect_UpdateMenu(MapSelectState* this) { if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { gSaveContext.save.cutsceneIndex = CS_INDEX_0; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_0) { gSaveContext.save.cutsceneIndex = CS_INDEX_1; @@ -365,10 +365,10 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { gSaveContext.save.cutsceneIndex = CS_INDEX_A; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_0) { - gSaveContext.save.cutsceneIndex = CS_INDEX_NONE; + gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_1) { gSaveContext.save.cutsceneIndex = CS_INDEX_0; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_2) { @@ -393,7 +393,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } gSaveContext.save.nightFlag = 0; - if (gSaveContext.save.cutsceneIndex == CS_INDEX_NONE) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { gSaveContext.save.nightFlag = 1; } @@ -607,7 +607,7 @@ void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 GfxPrint_SetColor(printer, 255, 255, 55, 255); switch (csIndex) { - case CS_INDEX_NONE: + case CS_INDEX_AUTO: label = GFXP_HIRAGANA " ヨル " GFXP_KATAKANA "ゴロン"; gSaveContext.save.dayTime = CLOCK_TIME(0, 0); break; From eb75a6dea4330de80e95575f98a9b0dbec97b15e Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 17:11:28 +0100 Subject: [PATCH 12/26] use explicit scene layer names instead of numbers --- src/code/z_scene.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 78fa0dd6846..521f5445ee1 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -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; } } From 02a977f27da6999d4abdb62d024e7373202c3e6c Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 5 Nov 2024 18:58:03 +0100 Subject: [PATCH 13/26] ok, now the last two `CS_INDEX_*` are less unknown the purpose of `CS_INDEX_BARRIER` is not quite clear still --- include/z64cutscene.h | 10 +++++----- src/code/z_demo.c | 6 +++--- src/overlays/gamestates/ovl_select/z_select.c | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 390f87e3e6b..9fcb8411a7c 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -354,9 +354,9 @@ correlation with `enum EntranceIndex` CS_INDEX_*: base entrance index + scene layer `z_select.c` naming: - CS_INDEX_AUTO: "Stage: night" - CS_INDEX_LAST: "Stage: day" - CS_INDEX_*: "Stage demo 0*" + CS_INDEX_AUTO: "Stage: night" + CS_INDEX_UNUSED: "Stage: day" + CS_INDEX_*: "Stage demo 0*" */ typedef enum CutsceneIndex { CS_INDEX_AUTO = 0x0000, @@ -373,8 +373,8 @@ typedef enum CutsceneIndex { CS_INDEX_9 = 0xFFF9, CS_INDEX_A = 0xFFFA, CS_INDEX_TRIGGERED = 0xFFFD, - CS_INDEX_STOP = 0xFFFF, // a guess as per `z_demo.c:1369` and `z_demo.c:1372` - CS_INDEX_LAST = 0x8000 // unknown, `z_demo.c:747` for CS_DEST_DEATH_MOUNTAIN_TRAIL + CS_INDEX_BARRIER = 0xFFFF, // CS_DEST_GANONS_CASTLE_DISPEL_BARRIER_CONDITONAL + CS_INDEX_UNUSED = 0x8000 // CS_DEST_DEATH_MOUNTAIN_TRAIL } CutsceneIndex; typedef union CsCmdCam { diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 6661f293862..282e9b73cb1 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -744,7 +744,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; - gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNUSED; break; case CS_DEST_LAKE_HYLIA_WATER_RESTORED: @@ -1365,10 +1365,10 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->csCtx.script = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); play->csCtx.curFrame = 0; gSaveContext.cutsceneTrigger = 1; - gSaveContext.save.cutsceneIndex = CS_INDEX_STOP; + gSaveContext.save.cutsceneIndex = CS_INDEX_BARRIER; csCtx->state = CS_STATE_STOP; } else { - gSaveContext.save.cutsceneIndex = CS_INDEX_STOP; + gSaveContext.save.cutsceneIndex = CS_INDEX_BARRIER; csCtx->state = CS_STATE_STOP; } break; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 4b8bcc5013a..1b1684f1aea 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -335,7 +335,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { - if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_UNUSED) { gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { gSaveContext.save.cutsceneIndex = CS_INDEX_0; @@ -360,13 +360,13 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_9) { gSaveContext.save.cutsceneIndex = CS_INDEX_A; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_A) { - gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNUSED; } } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { - if (gSaveContext.save.cutsceneIndex == CS_INDEX_LAST) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_UNUSED) { gSaveContext.save.cutsceneIndex = CS_INDEX_A; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { - gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNUSED; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_0) { gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_1) { @@ -611,7 +611,7 @@ void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 label = GFXP_HIRAGANA " ヨル " GFXP_KATAKANA "ゴロン"; gSaveContext.save.dayTime = CLOCK_TIME(0, 0); break; - case CS_INDEX_LAST: + case CS_INDEX_UNUSED: // clang-format off gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = GFXP_HIRAGANA "オヒル " GFXP_KATAKANA "ジャラ"; // clang-format on @@ -778,6 +778,6 @@ void MapSelect_Init(GameState* thisx) { DMA_REQUEST_SYNC(this->staticSegment, (uintptr_t)_z_select_staticSegmentRomStart, size, "../z_select.c", 1115); } - gSaveContext.save.cutsceneIndex = CS_INDEX_LAST; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNUSED; gSaveContext.save.linkAge = LINK_AGE_CHILD; } From 211bf7400d78fb6cf6c14116ea5a4b13359f4b1e Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 13 Nov 2024 20:40:38 +0100 Subject: [PATCH 14/26] apply Jenkins fixes https://jenkins.deco.mp/job/OOT/job/PR-2286/14/console --- src/code/fault_n64.c | 4 ++-- src/code/graph.c | 2 +- src/code/main.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_collision_check.c | 2 +- src/code/z_demo.c | 2 +- src/code/z_kankyo.c | 4 ++-- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index ab871602cef..ae8e7b8bb6d 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -1,6 +1,6 @@ #if PLATFORM_N64 -#pragma increment_block_number "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #include "global.h" #include "fault.h" @@ -8,7 +8,7 @@ #include "stack.h" #include "terminal.h" -#pragma increment_block_number "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:96 pal-1.0:96 pal-1.1:96" +#pragma increment_block_number "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" typedef struct FaultMgr { OSThread thread; diff --git a/src/code/graph.c b/src/code/graph.c index e7c3a2d8644..08413cd0409 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -8,7 +8,7 @@ #define GFXPOOL_TAIL_MAGIC 0x5678 #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + "ntsc-1.0:160 ntsc-1.1:160 ntsc-1.2:160 pal-1.0:160 pal-1.1:160" /** * The time at which the previous `Graph_Update` ended. diff --git a/src/code/main.c b/src/code/main.c index a0671605dea..c127fffea8e 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -24,7 +24,7 @@ extern struct IrqMgr gIrqMgr; #endif #pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.0:151 ntsc-1.1:151 ntsc-1.2:151 pal-1.0:149 pal-1.1:149" + "ntsc-1.0:148 ntsc-1.1:148 ntsc-1.2:148 pal-1.0:146 pal-1.1:146" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index af1d69b1fe9..2c8328143cb 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3639,7 +3639,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:93 ntsc-1.1:93 ntsc-1.2:93 pal-1.0:91 pal-1.1:91" + "ntsc-1.0:90 ntsc-1.1:90 ntsc-1.2:90 pal-1.0:88 pal-1.1:88" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index f2741865a92..9261f0489fc 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -16,7 +16,7 @@ #include "z_lib.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:104 ntsc-1.1:104 ntsc-1.2:104 pal-1.0:104 pal-1.1:104" + "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 29668abf1a2..e3bc5620d17 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -124,7 +124,7 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:188 gc-eu-mq:176 gc-jp:188 gc-jp-ce:188 gc-jp-mq:176 gc-us:188 gc-us-mq:176" \ +#pragma increment_block_number "gc-eu:186 gc-eu-mq:176 gc-jp:188 gc-jp-ce:188 gc-jp-mq:176 gc-us:188 gc-us-mq:176" \ "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:80 pal-1.1:80" // Cam ID to return to when a scripted cutscene is finished diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index beb80d8a521..1973fdf2db1 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:244 gc-eu-mq:244 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:252 pal-1.1:252" +#pragma increment_block_number "gc-eu:240 gc-eu-mq:240 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ + "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:248 pal-1.1:248" #include "global.h" #include "ultra64.h" diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 64d95171f4b..55f954ac4f2 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -35,7 +35,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:180 gc-eu-mq:180 gc-jp:180 gc-jp-ce:180 gc-jp-mq:180 gc-us:180 gc-us-mq:180" \ +#pragma increment_block_number "gc-eu:177 gc-eu-mq:177 gc-jp:177 gc-jp-ce:177 gc-jp-mq:177 gc-us:177 gc-us-mq:177" \ "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS ACTOR_FLAG_4 From 4b3e0dceb6232a3954a36ee937eb80d7059b21ca Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 19 Nov 2024 18:35:59 +0100 Subject: [PATCH 15/26] run `fix_bss` locally `ntsc-1.2` refused to comply though --- src/boot/z_std_dma.c | 2 +- src/code/fault_gc.c | 4 ++-- src/code/main.c | 2 +- src/code/z_bgcheck.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_demo.c | 4 ++-- src/code/z_kankyo.c | 4 ++-- src/code/z_message.c | 2 +- src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 2 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- src/overlays/actors/ovl_player_actor/z_player.c | 6 +++--- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index f5d5cda9caf..d2217a752eb 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -27,7 +27,7 @@ #endif #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:88 pal-1.0:86 pal-1.1:86" + "ntsc-1.2:86 pal-1.0:84 pal-1.1:84" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 68d9368fd02..39c4bb6be25 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -42,8 +42,8 @@ */ #if PLATFORM_GC -#pragma increment_block_number "gc-eu:176 gc-eu-mq:176 gc-eu-mq-dbg:176 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192" \ - "gc-us-mq:192" +#pragma increment_block_number "gc-eu:176 gc-eu-mq:176 gc-eu-mq-dbg:176 gc-jp:176 gc-jp-ce:176 gc-jp-mq:176 gc-us:176" \ + "gc-us-mq:176" #include "global.h" #include "alloca.h" diff --git a/src/code/main.c b/src/code/main.c index d11630a0a1a..35c35c28976 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -24,7 +24,7 @@ extern struct IrqMgr gIrqMgr; #endif #pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.0:148 ntsc-1.1:148 ntsc-1.2:148 pal-1.0:146 pal-1.1:146" + "ntsc-1.0:145 ntsc-1.1:145 ntsc-1.2:145 pal-1.0:143 pal-1.1:143" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 37d839dff39..7a816ba0477 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,7 +1,7 @@ #include "global.h" #include "terminal.h" -#pragma increment_block_number "ntsc-1.0:136 ntsc-1.1:136 ntsc-1.2:136" +#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:0" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index aca9f448706..d6b07940eb6 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3639,7 +3639,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:90 ntsc-1.1:90 ntsc-1.2:90 pal-1.0:88 pal-1.1:88" + "ntsc-1.0:87 ntsc-1.1:87 ntsc-1.2:87 pal-1.0:85 pal-1.1:85" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index ff47864833e..c4720cdef65 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -124,8 +124,8 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:186 gc-eu-mq:176 gc-jp:188 gc-jp-ce:188 gc-jp-mq:176 gc-us:188 gc-us-mq:176" \ - "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:80 pal-1.1:80" +#pragma increment_block_number "gc-eu:186 gc-eu-mq:176 gc-jp:186 gc-jp-ce:186 gc-jp-mq:176 gc-us:186 gc-us-mq:176" \ + "ntsc-1.0:76 ntsc-1.1:76 ntsc-1.2:80 pal-1.0:76 pal-1.1:76" // Cam ID to return to when a scripted cutscene is finished s16 sReturnToCamId; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 7a4c155c1a4..7fff4a42fc0 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:244 gc-eu-mq:244 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:248 pal-1.1:248" +#pragma increment_block_number "gc-eu:240 gc-eu-mq:240 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ + "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:244 pal-1.1:244" #include "global.h" #include "ultra64.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index 1f86d2fa150..b34f5b147fe 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -8,7 +8,7 @@ #endif #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:112 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:0 pal-1.0:128 pal-1.1:128" #if !PLATFORM_GC #define OCARINA_BUTTON_A_PRIM_1_R 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 caea0b981f0..ad37fb19772 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -7,7 +7,7 @@ #include "assets/objects/object_toki_objects/object_toki_objects.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:128" + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 4c5e2ab731b..b12ca59efe1 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -35,7 +35,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:177 gc-eu-mq:177 gc-jp:177 gc-jp-ce:177 gc-jp-mq:177 gc-us:177 gc-us-mq:177" \ +#pragma increment_block_number "gc-eu:174 gc-eu-mq:174 gc-jp:174 gc-jp-ce:174 gc-jp-mq:174 gc-us:174 gc-us-mq:174" \ "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS ACTOR_FLAG_4 diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index f6b0d92fba3..ba872bc8b66 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -343,21 +343,21 @@ void Player_Action_CsAction(Player* this, PlayState* play); // .bss part 1 #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:64 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:128 pal-1.1:128" static s32 D_80858AA0; // TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving // data around. It would be easier if we had more options for controlling BSS ordering in debug. #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ntsc-1.0:192 ntsc-1.1:128 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" static s32 sSavedCurrentMask; static Vec3f sInteractWallCheckResult; static Input* sControlInput; #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.0:128 ntsc-1.1:192 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" // .data From 1d84bca790bf36e09a6cc3da1cd83656f806aa76 Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 19 Nov 2024 18:50:11 +0100 Subject: [PATCH 16/26] revert all local to the branch bss shifts --- src/boot/z_std_dma.c | 2 +- src/code/fault_gc.c | 4 ++-- src/code/main.c | 2 +- src/code/z_bgcheck.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_collision_check.c | 2 +- src/code/z_demo.c | 4 ++-- src/code/z_kankyo.c | 4 ++-- src/code/z_message.c | 2 +- src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 2 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- src/overlays/actors/ovl_player_actor/z_player.c | 6 +++--- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index d2217a752eb..f5d5cda9caf 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -27,7 +27,7 @@ #endif #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:86 pal-1.0:84 pal-1.1:84" + "ntsc-1.2:88 pal-1.0:86 pal-1.1:86" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 39c4bb6be25..e9b7de4b613 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -42,8 +42,8 @@ */ #if PLATFORM_GC -#pragma increment_block_number "gc-eu:176 gc-eu-mq:176 gc-eu-mq-dbg:176 gc-jp:176 gc-jp-ce:176 gc-jp-mq:176 gc-us:176" \ - "gc-us-mq:176" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:176 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192" \ + "gc-us-mq:192" #include "global.h" #include "alloca.h" diff --git a/src/code/main.c b/src/code/main.c index 35c35c28976..d11630a0a1a 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -24,7 +24,7 @@ extern struct IrqMgr gIrqMgr; #endif #pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.0:145 ntsc-1.1:145 ntsc-1.2:145 pal-1.0:143 pal-1.1:143" + "ntsc-1.0:148 ntsc-1.1:148 ntsc-1.2:148 pal-1.0:146 pal-1.1:146" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 7a816ba0477..37d839dff39 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,7 +1,7 @@ #include "global.h" #include "terminal.h" -#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:0" +#pragma increment_block_number "ntsc-1.0:136 ntsc-1.1:136 ntsc-1.2:136" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index d6b07940eb6..aca9f448706 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3639,7 +3639,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:87 ntsc-1.1:87 ntsc-1.2:87 pal-1.0:85 pal-1.1:85" + "ntsc-1.0:90 ntsc-1.1:90 ntsc-1.2:90 pal-1.0:88 pal-1.1:88" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 0567fd15a11..7904809bf9c 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -16,7 +16,7 @@ #include "z_lib.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96" + "ntsc-1.0:104 ntsc-1.1:104 ntsc-1.2:104 pal-1.0:104 pal-1.1:104" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index c4720cdef65..ff47864833e 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -124,8 +124,8 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:186 gc-eu-mq:176 gc-jp:186 gc-jp-ce:186 gc-jp-mq:176 gc-us:186 gc-us-mq:176" \ - "ntsc-1.0:76 ntsc-1.1:76 ntsc-1.2:80 pal-1.0:76 pal-1.1:76" +#pragma increment_block_number "gc-eu:186 gc-eu-mq:176 gc-jp:188 gc-jp-ce:188 gc-jp-mq:176 gc-us:188 gc-us-mq:176" \ + "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:80 pal-1.1:80" // Cam ID to return to when a scripted cutscene is finished s16 sReturnToCamId; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 7fff4a42fc0..7a4c155c1a4 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:240 gc-eu-mq:240 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:244 pal-1.1:244" +#pragma increment_block_number "gc-eu:244 gc-eu-mq:244 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ + "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:248 pal-1.1:248" #include "global.h" #include "ultra64.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index b34f5b147fe..1f86d2fa150 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -8,7 +8,7 @@ #endif #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:0 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:112 pal-1.0:128 pal-1.1:128" #if !PLATFORM_GC #define OCARINA_BUTTON_A_PRIM_1_R 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 ad37fb19772..caea0b981f0 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -7,7 +7,7 @@ #include "assets/objects/object_toki_objects/object_toki_objects.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128" + "ntsc-1.2:128" #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index b12ca59efe1..4c5e2ab731b 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -35,7 +35,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:174 gc-eu-mq:174 gc-jp:174 gc-jp-ce:174 gc-jp-mq:174 gc-us:174 gc-us-mq:174" \ +#pragma increment_block_number "gc-eu:177 gc-eu-mq:177 gc-jp:177 gc-jp-ce:177 gc-jp-mq:177 gc-us:177 gc-us-mq:177" \ "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS ACTOR_FLAG_4 diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index ba872bc8b66..f6b0d92fba3 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -343,21 +343,21 @@ void Player_Action_CsAction(Player* this, PlayState* play); // .bss part 1 #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:64 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static s32 D_80858AA0; // TODO: There's probably a way to match BSS ordering with less padding by spreading the variables out and moving // data around. It would be easier if we had more options for controlling BSS ordering in debug. #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" + "ntsc-1.0:192 ntsc-1.1:128 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" static s32 sSavedCurrentMask; static Vec3f sInteractWallCheckResult; static Input* sControlInput; #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ntsc-1.0:128 ntsc-1.1:192 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" // .data From 133a74fc78024b23c5f3489a1145a8345e27172c Mon Sep 17 00:00:00 2001 From: feacur Date: Tue, 19 Nov 2024 19:00:29 +0100 Subject: [PATCH 17/26] ugh, use defines instead of an enum probably size of enum entries doesn't match well? originally these were just numbers. besides, not like it's a real enumeration from zero to a value or some bit flags --- include/z64cutscene.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 9fcb8411a7c..fdfab88d51e 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -358,24 +358,24 @@ correlation with `enum EntranceIndex` CS_INDEX_UNUSED: "Stage: day" CS_INDEX_*: "Stage demo 0*" */ -typedef enum CutsceneIndex { - CS_INDEX_AUTO = 0x0000, - CS_INDEX_NEXT_EMPTY = 0xFFEF, // is allowed to schedule a cutscene - CS_INDEX_0 = 0xFFF0, - CS_INDEX_1 = 0xFFF1, - CS_INDEX_2 = 0xFFF2, - CS_INDEX_3 = 0xFFF3, - CS_INDEX_4 = 0xFFF4, - CS_INDEX_5 = 0xFFF5, - CS_INDEX_6 = 0xFFF6, - CS_INDEX_7 = 0xFFF7, - CS_INDEX_8 = 0xFFF8, - CS_INDEX_9 = 0xFFF9, - CS_INDEX_A = 0xFFFA, - CS_INDEX_TRIGGERED = 0xFFFD, - CS_INDEX_BARRIER = 0xFFFF, // CS_DEST_GANONS_CASTLE_DISPEL_BARRIER_CONDITONAL - CS_INDEX_UNUSED = 0x8000 // CS_DEST_DEATH_MOUNTAIN_TRAIL -} CutsceneIndex; +// clang-format off +#define CS_INDEX_AUTO 0x0000 +#define CS_INDEX_NEXT_EMPTY 0xFFEF // is allowed to schedule a cutscene +#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 +#define CS_INDEX_TRIGGERED 0xFFFD +#define CS_INDEX_BARRIER 0xFFFF // CS_DEST_GANONS_CASTLE_DISPEL_BARRIER_CONDITONAL +#define CS_INDEX_UNUSED 0x8000 // CS_DEST_DEATH_MOUNTAIN_TRAIL +// clang-format on typedef union CsCmdCam { struct { From 0cbe8a477fe72fa4c6be026199c1dbf901833ea7 Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 20 Nov 2024 01:09:57 +0100 Subject: [PATCH 18/26] still, add a BSS pragma for `z_demo.c` --- src/code/z_demo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/code/z_demo.c b/src/code/z_demo.c index ff47864833e..beef1ccd0fb 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,3 +1,5 @@ +#pragma increment_block_number "gc-eu:0 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:128 gc-us:0 gc-us-mq:128 ntsc-1.2:0" + #include "global.h" #include "quake.h" #include "z64camera.h" @@ -124,7 +126,7 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:186 gc-eu-mq:176 gc-jp:188 gc-jp-ce:188 gc-jp-mq:176 gc-us:188 gc-us-mq:176" \ +#pragma increment_block_number "gc-eu:186 gc-eu-mq:0 gc-jp:188 gc-jp-ce:188 gc-jp-mq:0 gc-us:188 gc-us-mq:0" \ "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:80 pal-1.1:80" // Cam ID to return to when a scripted cutscene is finished From 5552e92eef56c7a1ae1c3f95ceb4492bb6346f8b Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 28 Nov 2024 12:12:32 +0100 Subject: [PATCH 19/26] apply review changes --- include/z64cutscene.h | 35 ++++++++----------- src/code/db_camera.c | 2 +- src/code/z_demo.c | 14 ++++---- src/code/z_horse.c | 16 ++++----- src/code/z_play.c | 2 +- src/code/z_scene.c | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 2 +- src/overlays/gamestates/ovl_select/z_select.c | 12 +++---- 8 files changed, 39 insertions(+), 46 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index fdfab88d51e..e22cdbb6003 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -344,23 +344,11 @@ typedef enum CutsceneDestination { /* 0x77 */ CS_DEST_ZELDAS_COURTYARD_RECEIVE_LETTER } CutsceneDestination; -/* -correlation with `enum SceneLayer`: - CS_INDEX_AUTO: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] - CS_INDEX_*: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) - -correlation with `enum EntranceIndex` - CS_INDEX_AUTO: base entrance index + scene layer - CS_INDEX_*: base entrance index + scene layer - -`z_select.c` naming: - CS_INDEX_AUTO: "Stage: night" - CS_INDEX_UNUSED: "Stage: day" - CS_INDEX_*: "Stage demo 0*" -*/ -// clang-format off +// the primary purpose of these values is to select `gSaveContext.sceneLayer` +// CS_INDEX_AUTO: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] +// CS_INDEX_[0 .. A]: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) +// `z_demo.c` is the main user #define CS_INDEX_AUTO 0x0000 -#define CS_INDEX_NEXT_EMPTY 0xFFEF // is allowed to schedule a cutscene #define CS_INDEX_0 0xFFF0 #define CS_INDEX_1 0xFFF1 #define CS_INDEX_2 0xFFF2 @@ -372,10 +360,16 @@ correlation with `enum EntranceIndex` #define CS_INDEX_8 0xFFF8 #define CS_INDEX_9 0xFFF9 #define CS_INDEX_A 0xFFFA -#define CS_INDEX_TRIGGERED 0xFFFD -#define CS_INDEX_BARRIER 0xFFFF // CS_DEST_GANONS_CASTLE_DISPEL_BARRIER_CONDITONAL -#define CS_INDEX_UNUSED 0x8000 // CS_DEST_DEATH_MOUNTAIN_TRAIL -// clang-format on + +// then there are two different sentinel values +// `z_play.c` is the main user +#define CS_INDEX_EMPTY 0xFFFD // marks `gSaveContext.save.cutsceneIndex` as free +#define CS_INDEX_NEXT_EMPTY 0xFFEF // marks `gSaveContext.nextCutsceneIndex` as free + +// finally two more, but they're not meaningful for the normal gameplay +// `z_select.c` is the main user +#define CS_INDEX_8000 0x8000 // unused; set in CS_DEST_DEATH_MOUNTAIN_TRAIL +#define CS_INDEX_FFFF 0xFFFF // unused; set in CS_DEST_GANONS_CASTLE_DISPEL_BARRIER_CONDITONAL typedef union CsCmdCam { struct { @@ -386,7 +380,6 @@ typedef union CsCmdCam { s32 _words[2]; } CsCmdCam; // size = 0x8 - typedef union CsCmdMisc { struct { /* 0x00 */ u16 type; diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 87c9c85e921..1045df9ca2c 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -2185,7 +2185,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 = CS_INDEX_TRIGGERED; + gSaveContext.save.cutsceneIndex = CS_INDEX_EMPTY; gSaveContext.cutsceneTrigger = 1; sDebugCamAnim.curFrame = 0.0f; sDebugCamAnim.keyframe = 0; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index beef1ccd0fb..5634e97c8a9 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -191,14 +191,14 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) { gUseCutsceneCam = false; - gSaveContext.save.cutsceneIndex = CS_INDEX_TRIGGERED; + gSaveContext.save.cutsceneIndex = CS_INDEX_EMPTY; gSaveContext.cutsceneTrigger = 1; } if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER && !gDebugCamEnabled) { gUseCutsceneCam = true; - gSaveContext.save.cutsceneIndex = CS_INDEX_TRIGGERED; + gSaveContext.save.cutsceneIndex = CS_INDEX_EMPTY; gSaveContext.cutsceneTrigger = 1; } } @@ -210,7 +210,7 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE)) { PRINTF(T("\nデモ開始要求 発令!", "\nDemo start request issued!")); - gSaveContext.save.cutsceneIndex = CS_INDEX_TRIGGERED; + gSaveContext.save.cutsceneIndex = CS_INDEX_EMPTY; gSaveContext.cutsceneTrigger = 1; } @@ -746,7 +746,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; - gSaveContext.save.cutsceneIndex = CS_INDEX_UNUSED; + gSaveContext.save.cutsceneIndex = CS_INDEX_8000; break; case CS_DEST_LAKE_HYLIA_WATER_RESTORED: @@ -1367,10 +1367,10 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->csCtx.script = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); play->csCtx.curFrame = 0; gSaveContext.cutsceneTrigger = 1; - gSaveContext.save.cutsceneIndex = CS_INDEX_BARRIER; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFF; csCtx->state = CS_STATE_STOP; } else { - gSaveContext.save.cutsceneIndex = CS_INDEX_BARRIER; + gSaveContext.save.cutsceneIndex = CS_INDEX_FFFF; csCtx->state = CS_STATE_STOP; } break; @@ -2295,7 +2295,7 @@ void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx) { u8 i; if ((gSaveContext.cutsceneTrigger != 0) && (csCtx->state == CS_STATE_IDLE) && !Player_InCsMode(play)) { - gSaveContext.save.cutsceneIndex = CS_INDEX_TRIGGERED; + gSaveContext.save.cutsceneIndex = CS_INDEX_EMPTY; } if ((gSaveContext.save.cutsceneIndex >= CS_INDEX_0) && (csCtx->state == CS_STATE_IDLE)) { diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 6b57f0bc3a1..ab33523f1dc 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -131,14 +131,14 @@ typedef struct struct_8011F9B8 { void func_8006D684(PlayState* play, Player* player) { static struct_8011F9B8 D_8011F9B8[] = { - { SCENE_GERUDOS_FORTRESS, 0xFFF0, { 3600, 1413, 360 }, 0x8001, 8 }, - { SCENE_LON_LON_RANCH, 0xFFF0, { -250, 1, -1580 }, 0x4000, 6 }, - { SCENE_LON_LON_RANCH, 0xFFF1, { 0, 0, 0 }, 0x0000, 5 }, - { SCENE_LON_LON_RANCH, 0xFFF5, { 0, 0, 0 }, 0x0000, 7 }, - { SCENE_HYRULE_FIELD, 0xFFF3, { -2961, 313, 7700 }, 0x0000, 7 }, - { SCENE_HYRULE_FIELD, 0xFFF4, { -1900, 313, 7015 }, 0x0000, 7 }, - { SCENE_HYRULE_FIELD, 0xFFF5, { -4043, 313, 6933 }, 0x0000, 7 }, - { SCENE_HYRULE_FIELD, 0xFFF6, { -4043, 313, 6933 }, 0x0000, 7 }, + { SCENE_GERUDOS_FORTRESS, CS_INDEX_0, { 3600, 1413, 360 }, 0x8001, 8 }, + { SCENE_LON_LON_RANCH, CS_INDEX_0, { -250, 1, -1580 }, 0x4000, 6 }, + { SCENE_LON_LON_RANCH, CS_INDEX_1, { 0, 0, 0 }, 0x0000, 5 }, + { SCENE_LON_LON_RANCH, CS_INDEX_5, { 0, 0, 0 }, 0x0000, 7 }, + { SCENE_HYRULE_FIELD, CS_INDEX_3, { -2961, 313, 7700 }, 0x0000, 7 }, + { SCENE_HYRULE_FIELD, CS_INDEX_4, { -1900, 313, 7015 }, 0x0000, 7 }, + { SCENE_HYRULE_FIELD, CS_INDEX_5, { -4043, 313, 6933 }, 0x0000, 7 }, + { SCENE_HYRULE_FIELD, CS_INDEX_6, { -4043, 313, 6933 }, 0x0000, 7 }, }; s32 pad; s32 i; diff --git a/src/code/z_play.c b/src/code/z_play.c index 636cc1bf060..0898df21d97 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -329,7 +329,7 @@ void Play_Init(GameState* thisx) { gSaveContext.nextCutsceneIndex = CS_INDEX_NEXT_EMPTY; } - if (gSaveContext.save.cutsceneIndex == CS_INDEX_TRIGGERED) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_EMPTY) { gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 521f5445ee1..51ceea96ccf 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -507,7 +507,7 @@ void Scene_SetTransitionForNextEntrance(PlayState* play) { } } else { if (!LINK_IS_ADULT) { - entranceIndex = play->nextEntranceIndex; // SCENE_LAYER_CHILD_DAY + entranceIndex = play->nextEntranceIndex + SCENE_LAYER_CHILD_DAY; } else { entranceIndex = play->nextEntranceIndex + SCENE_LAYER_ADULT_DAY; } diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 28a72de8673..e432eb345e5 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -379,7 +379,7 @@ void EnSa_ChangeAnim(EnSa* this, s32 index) { } s32 func_80AF5DFC(EnSa* this, PlayState* play) { - if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0 && gSaveContext.save.cutsceneIndex != CS_INDEX_TRIGGERED) { + if (gSaveContext.save.cutsceneIndex >= CS_INDEX_0 && gSaveContext.save.cutsceneIndex != CS_INDEX_EMPTY) { if (play->sceneId == SCENE_KOKIRI_FOREST) { return 4; } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index a42d8ff8e8c..5144648b0a0 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -295,7 +295,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { - if (gSaveContext.save.cutsceneIndex == CS_INDEX_UNUSED) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_8000) { gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { gSaveContext.save.cutsceneIndex = CS_INDEX_0; @@ -320,13 +320,13 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_9) { gSaveContext.save.cutsceneIndex = CS_INDEX_A; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_A) { - gSaveContext.save.cutsceneIndex = CS_INDEX_UNUSED; + gSaveContext.save.cutsceneIndex = CS_INDEX_8000; } } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { - if (gSaveContext.save.cutsceneIndex == CS_INDEX_UNUSED) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_8000) { gSaveContext.save.cutsceneIndex = CS_INDEX_A; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { - gSaveContext.save.cutsceneIndex = CS_INDEX_UNUSED; + gSaveContext.save.cutsceneIndex = CS_INDEX_8000; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_0) { gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_1) { @@ -560,7 +560,7 @@ void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 label = T(GFXP_HIRAGANA " ヨル " GFXP_KATAKANA "ゴロン", "Night"); gSaveContext.save.dayTime = CLOCK_TIME(0, 0); break; - case CS_INDEX_UNUSED: + case CS_INDEX_8000: // clang-format off gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = T(GFXP_HIRAGANA "オヒル " GFXP_KATAKANA "ジャラ", "Day"); // clang-format on @@ -727,6 +727,6 @@ void MapSelect_Init(GameState* thisx) { DMA_REQUEST_SYNC(this->staticSegment, (uintptr_t)_z_select_staticSegmentRomStart, size, "../z_select.c", 1115); } - gSaveContext.save.cutsceneIndex = CS_INDEX_UNUSED; + gSaveContext.save.cutsceneIndex = CS_INDEX_8000; gSaveContext.save.linkAge = LINK_AGE_CHILD; } From f728d55c3630e69367f0973dced0639cc2943540 Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 28 Nov 2024 18:11:00 +0100 Subject: [PATCH 20/26] factor out a cutscene layer formula --- include/z64cutscene.h | 2 +- include/z64save.h | 1 + src/code/z_play.c | 10 +++++----- src/overlays/gamestates/ovl_opening/z_opening.c | 7 ++----- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index e22cdbb6003..df1d51f0b92 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -346,7 +346,7 @@ typedef enum CutsceneDestination { // the primary purpose of these values is to select `gSaveContext.sceneLayer` // CS_INDEX_AUTO: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] -// CS_INDEX_[0 .. A]: SCENE_LAYER_CUTSCENE_FIRST + (cutscene index & 0xF) +// CS_INDEX_[0 .. A]: GET_CUTSCENE_LAYER(index) // `z_demo.c` is the main user #define CS_INDEX_AUTO 0x0000 #define CS_INDEX_0 0xFFF0 diff --git a/include/z64save.h b/include/z64save.h index 2c10d76bc61..e85a054ccd5 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -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, diff --git a/src/code/z_play.c b/src/code/z_play.c index 0898df21d97..629f700b24a 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -349,7 +349,7 @@ void Play_Init(GameState* thisx) { 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) { @@ -367,13 +367,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( @@ -386,7 +386,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")); diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index c3262c4b249..27dd6c7af6e 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -12,11 +12,8 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) { gSaveContext.save.linkAge = LINK_AGE_ADULT; Sram_InitDebugSave(); gSaveContext.save.cutsceneIndex = CS_INDEX_3; - gSaveContext.sceneLayer = 7; - // assigning scene layer here is redundant, as Play_Init sets it to - // SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.save.cutsceneIndex & 0xF) - // or one of the other `enum SceneLayer` values; even so, `7` is exactly - // the value this formula equals to for CS_INDEX_3 + // assigning scene layer here is redundant, as Play_Init sets it right away + gSaveContext.sceneLayer = GET_CUTSCENE_LAYER(CS_INDEX_3); SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState); } From 106cb1021be88f745ee303838c11c7d7cbf9c79d Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 28 Nov 2024 18:11:34 +0100 Subject: [PATCH 21/26] give scene layers names throughout code --- src/code/z_demo.c | 6 +-- src/code/z_kankyo.c | 5 ++- src/code/z_parameter.c | 2 +- src/code/z_scene.c | 4 +- src/code/z_scene_table.c | 6 +-- .../z_bg_spot00_hanebasi.c | 14 ++++--- .../z_bg_spot01_idohashira.c | 4 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c | 4 +- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.c | 7 ++-- .../actors/ovl_Demo_Effect/z_demo_effect.c | 38 ++++++++++--------- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 3 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 3 +- .../actors/ovl_En_Jsjutan/z_en_jsjutan.c | 3 +- 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_Rl/z_en_rl.c | 2 +- src/overlays/actors/ovl_En_Tr/z_en_tr.c | 2 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 17 +++++---- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 9 +++-- .../ovl_En_Yabusame_Mark/z_en_yabusame_mark.c | 2 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 6 +-- .../actors/ovl_player_actor/z_player.c | 9 ++--- 24 files changed, 83 insertions(+), 71 deletions(-) diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 5634e97c8a9..43d17883cf5 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1191,19 +1191,19 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->transitionType = TRANS_TYPE_FADE_BLACK; } else { switch (gSaveContext.sceneLayer) { - case 8: + case GET_CUTSCENE_LAYER(CS_INDEX_4): play->nextEntranceIndex = ENTR_SACRED_FOREST_MEADOW_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; - case 9: + case GET_CUTSCENE_LAYER(CS_INDEX_5): play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; - case 10: + case GET_CUTSCENE_LAYER(CS_INDEX_6): play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.cutsceneIndex = CS_INDEX_0; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 7a4c155c1a4..a6ddc4c5ee5 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -962,7 +962,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex if ((((void)0, gSaveContext.save.dayTime) > ((void)0, gSaveContext.skyboxTime)) || (((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(1, 0) || gTimeSpeed < 0)) #else - if (((((void)0, gSaveContext.sceneLayer) >= 5 || gTimeSpeed != 0) && + if (((((void)0, gSaveContext.sceneLayer) >= GET_CUTSCENE_LAYER(CS_INDEX_1) || gTimeSpeed != 0) && ((void)0, gSaveContext.save.dayTime) > ((void)0, gSaveContext.skyboxTime)) || (((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(1, 0) || gTimeSpeed < 0)) #endif @@ -1421,7 +1421,8 @@ void Environment_DrawSunAndMoon(PlayState* play) { play->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; } - if (gSaveContext.save.entranceIndex != ENTR_HYRULE_FIELD_0 || ((void)0, gSaveContext.sceneLayer) != 5) { + if (gSaveContext.save.entranceIndex != ENTR_HYRULE_FIELD_0 || + ((void)0, gSaveContext.sceneLayer) != GET_CUTSCENE_LAYER(CS_INDEX_1)) { 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 907f9c15a72..20d0f2195a0 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -4031,7 +4031,7 @@ void Interface_Update(PlayState* play) { if (!IS_PAUSED(&play->pauseCtx)) { if ((gSaveContext.minigameState == 1) || !IS_CUTSCENE_LAYER || - ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.sceneLayer == 4))) { + ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)))) { if ((msgCtx->msgMode == MSGMODE_NONE) || ((msgCtx->msgMode != MSGMODE_NONE) && (play->sceneId == SCENE_BOMBCHU_BOWLING_ALLEY))) { if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 51ceea96ccf..9fd0755b5e7 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -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; @@ -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) { diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 24521f3aa3b..7c1858ebf11 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -350,7 +350,7 @@ void Scene_DrawConfigTempleOfTime(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5145); - if (gSaveContext.sceneLayer == 5) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { gCustomLensFlareOn = true; gCustomLensFlarePos.x = -20.0f; gCustomLensFlarePos.y = 1220.0f; @@ -1186,9 +1186,9 @@ void Scene_DrawConfigKokiriForest(PlayState* play) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - if (gSaveContext.sceneLayer == 4) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { spA3 = 255 - (u8)play->roomCtx.drawParams[0]; - } else if (gSaveContext.sceneLayer == 6) { + } else if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { spA0 = play->roomCtx.drawParams[0] + 500; } else if ( #if OOT_VERSION < PAL_1_0 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 775ad9700f4..a261a9f1b6a 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 @@ -69,14 +69,15 @@ void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play) { return; } - if ((gSaveContext.sceneLayer != 6) && - ((gSaveContext.sceneLayer == 4) || (gSaveContext.sceneLayer == 5) || (!LINK_IS_ADULT && !IS_DAY))) { + if ((gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_2)) && + ((gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) || + (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) || (!LINK_IS_ADULT && !IS_DAY))) { this->dyna.actor.shape.rot.x = -0x4000; } else { this->dyna.actor.shape.rot.x = 0; } - if (gSaveContext.sceneLayer != 6) { + if (gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_2)) { 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; @@ -226,7 +227,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { } } - if (gSaveContext.sceneLayer == 5) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { u16 dayTime; s32 tmp; @@ -242,7 +243,8 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { dayTime = gSaveContext.save.dayTime; - if ((dayTime > CLOCK_TIME(4, 0)) && (dayTime < CLOCK_TIME(4, 30)) && (gSaveContext.sceneLayer == 5)) { + if ((dayTime > CLOCK_TIME(4, 0)) && (dayTime < CLOCK_TIME(4, 30)) && + (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1))) { gTimeSpeed = 0; } } @@ -308,7 +310,7 @@ 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.sceneLayer != 12) { + if (gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_8)) { if (IS_CUTSCENE_LAYER || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) { BgSpot00Hanebasi_DrawTorches(thisx, play); } else { 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 475940dd532..37f146fd92e 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 @@ -307,10 +307,10 @@ void BgSpot01Idohashira_Init(Actor* thisx, PlayState* play) { } else { this->action = 0; } - } else if (gSaveContext.sceneLayer == 4) { + } else if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { this->action = 1; this->dyna.actor.shape.yOffset = -(kREG(10) + 1100.0f); - } else if (gSaveContext.sceneLayer == 6) { + } else if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { this->action = 0; } else { Actor_Kill(&this->dyna.actor); 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 e25280ed0bd..b24a3bc61a8 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.sceneLayer == 5) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { play->roomCtx.drawParams[0] = 0xFF; } @@ -118,7 +118,7 @@ void func_808BAF40(BgTokiSwd* this, PlayState* play) { } } } - if (gSaveContext.sceneLayer == 5) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { if (play->roomCtx.drawParams[0] > 0) { play->roomCtx.drawParams[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 ef0e25f4043..4bd2f0a4756 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -73,7 +73,7 @@ void BgTreemouth_Init(Actor* thisx, PlayState* play) { if (!IS_CUTSCENE_LAYER && !LINK_IS_ADULT) { BgTreemouth_SetupAction(this, func_808BC8B8); - } else if (LINK_IS_ADULT || (gSaveContext.sceneLayer == 7)) { + } else if (LINK_IS_ADULT || (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_3))) { this->unk_168 = 0.0f; BgTreemouth_SetupAction(this, BgTreemouth_DoNothing); } else { @@ -116,7 +116,8 @@ void func_808BC6F8(BgTreemouth* this, PlayState* play) { this->unk_168 = 1.0f; } - if ((gSaveContext.sceneLayer == 6) && (play->csCtx.curFrame > 700) && (play->state.frames % 8 == 0)) { + if ((gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) && (play->csCtx.curFrame > 700) && + (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; @@ -248,7 +249,7 @@ void BgTreemouth_Draw(Actor* thisx, PlayState* play) { } else { // needed to match } - if (gSaveContext.sceneLayer == 6) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { alpha = (play->roomCtx.drawParams[0] + 0x1F4); } 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 2a3e8c45312..cf8baf3a356 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -678,7 +678,8 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { } else { Actor_SetScale(&this->actor, 84 * 0.001f); } - } else if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 4 || + } else if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1) || + gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0) || (gSaveContext.save.entranceIndex == ENTR_TEMPLE_OF_TIME_4 && !GET_EVENTCHKINF(EVENTCHKINF_C9))) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 59.0f, 0.0f); SkelCurve_Update(play, &this->skelCurve); @@ -834,7 +835,8 @@ void DemoEffect_UpdateTriforceSpot(DemoEffect* this, PlayState* play) { } } - if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0 && gSaveContext.sceneLayer == 6 && + if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0 && + gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2) && play->csCtx.curFrame == FRAMERATE_CONST(143, 120)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); } @@ -1060,11 +1062,12 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { break; } - if (play->sceneId == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == 6 && play->csCtx.curFrame == 197) { + if (play->sceneId == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2) && + play->csCtx.curFrame == 197) { Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_OUT); } - if (play->sceneId == SCENE_DEATH_MOUNTAIN_TRAIL && gSaveContext.sceneLayer == 5) { + if (play->sceneId == SCENE_DEATH_MOUNTAIN_TRAIL && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { if (!DemoEffect_CheckForCue(this, play, 1)) { Actor_PlaySfx(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } @@ -1075,7 +1078,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { if (0) {} } - if (play->sceneId == SCENE_ZORAS_FOUNTAIN && gSaveContext.sceneLayer == 4) { + if (play->sceneId == SCENE_ZORAS_FOUNTAIN && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { if (!DemoEffect_CheckForCue(this, play, 1)) { Actor_PlaySfx(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } @@ -1087,7 +1090,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { if (0) {} } - if (play->sceneId == SCENE_TEMPLE_OF_TIME && gSaveContext.sceneLayer == 14) { + if (play->sceneId == SCENE_TEMPLE_OF_TIME && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_A)) { if (1) {} if (play->csCtx.actorCues[this->cueChannel]->id == 2) { @@ -1145,7 +1148,7 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play) { if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) { switch (gSaveContext.sceneLayer) { - case 4: + case GET_CUTSCENE_LAYER(CS_INDEX_0): if (play->csCtx.curFrame == FRAMERATE_CONST(288, 240)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } @@ -1154,13 +1157,13 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play) { } break; - case 6: + case GET_CUTSCENE_LAYER(CS_INDEX_2): if (play->csCtx.curFrame == FRAMERATE_CONST(55, 25)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; - case 11: + case GET_CUTSCENE_LAYER(CS_INDEX_7): if (play->csCtx.curFrame == FRAMERATE_CONST(350, 353)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } @@ -1200,18 +1203,18 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) { if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) { switch (gSaveContext.sceneLayer) { - case 4: + case GET_CUTSCENE_LAYER(CS_INDEX_0): if (play->csCtx.curFrame == FRAMERATE_CONST(298, 248)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; - case 6: + case GET_CUTSCENE_LAYER(CS_INDEX_2): if (play->csCtx.curFrame == FRAMERATE_CONST(105, 88)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; - case 11: + case GET_CUTSCENE_LAYER(CS_INDEX_7): if (play->csCtx.curFrame == FRAMERATE_CONST(360, 362)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } @@ -1219,7 +1222,8 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) { } } - if (gSaveContext.save.entranceIndex == ENTR_DEATH_MOUNTAIN_TRAIL_0 && gSaveContext.sceneLayer == 4) { + if (gSaveContext.save.entranceIndex == ENTR_DEATH_MOUNTAIN_TRAIL_0 && + gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { if (play->csCtx.curFrame == FRAMERATE_CONST(72, 57)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } @@ -1259,19 +1263,19 @@ void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, PlayState* play) { if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) { switch (gSaveContext.sceneLayer) { - case 4: + case GET_CUTSCENE_LAYER(CS_INDEX_0): if (play->csCtx.curFrame == FRAMERATE_CONST(315, 265)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; - case 6: + case GET_CUTSCENE_LAYER(CS_INDEX_2): if (play->csCtx.curFrame == FRAMERATE_CONST(80, 60)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; - case 11: + case GET_CUTSCENE_LAYER(CS_INDEX_7): if (play->csCtx.curFrame == FRAMERATE_CONST(370, 371)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } @@ -1764,7 +1768,7 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) { if (!DemoEffect_CheckForCue(this, play, 2)) { if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) { - if (gSaveContext.sceneLayer == 4) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { if (play->csCtx.curFrame <= 680) { Sfx_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_GOD_FLYING - SFX_FLAG); } 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 ac9afd8d84c..231a100656c 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -936,7 +936,7 @@ void func_80986CFC(DemoIm* this, PlayState* play) { void func_80986D40(DemoIm* this, PlayState* play) { #if DEBUG_FEATURES - if (gSaveContext.sceneLayer == 6) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { this->action = 19; this->drawConfig = 1; return; 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 a83552b9bf1..7a0105a25f9 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -864,7 +864,7 @@ void func_80A03CF8(EnElf* this, PlayState* play) { func_80A02C98(this, &nextPos, 0.2f); } - if ((play->sceneId == SCENE_LINKS_HOUSE) && (gSaveContext.sceneLayer == 4)) { + if ((play->sceneId == SCENE_LINKS_HOUSE) && (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0))) { // play dash sound effect as Navi enters Links house in the intro if (1) {} if (play->csCtx.curFrame == 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 c9af4d3b580..ec619fc2c18 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -109,7 +109,8 @@ void EnHoll_SetupAction(EnHoll* this, EnHollActionFunc func) { } int EnHoll_IsKokiriLayer8(void) { - return gSaveContext.save.entranceIndex == ENTR_KOKIRI_FOREST_0 && gSaveContext.sceneLayer == 8; + return gSaveContext.save.entranceIndex == ENTR_KOKIRI_FOREST_0 && + gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_4); } void EnHoll_ChooseAction(EnHoll* this) { 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 0912c579911..16aad0b67ad 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -3619,7 +3619,8 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { this->cyl1.base.atFlags &= ~AT_ON; } - if (gSaveContext.save.entranceIndex != ENTR_LON_LON_RANCH_0 || gSaveContext.sceneLayer != 9) { + if (gSaveContext.save.entranceIndex != ENTR_LON_LON_RANCH_0 || + gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_5)) { 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_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index 6650e317159..7de638ef72d 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,8 @@ 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.save.entranceIndex == ENTR_LON_LON_RANCH_0) && (gSaveContext.sceneLayer == 8)) { + if ((gSaveContext.save.entranceIndex == ENTR_LON_LON_RANCH_0) && + (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_4))) { Actor* actorProfessor; Actor* actorBeanGuy; 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 ab116e7913a..734408e3b55 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -166,7 +166,7 @@ s16 EnMa1_UpdateTalkState(PlayState* play, Actor* thisx) { } s32 EnMa1_ShouldSpawn(EnMa1* this, PlayState* play) { - if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneLayer == 5)) { + if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1))) { return true; } 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 35796e1eb7a..ee8c0154941 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -169,7 +169,7 @@ void EnMs_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (gSaveContext.save.entranceIndex == ENTR_LON_LON_RANCH_0 && - gSaveContext.sceneLayer == 8) { // ride carpet if in credits + gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_4)) { // ride carpet if in credits Actor_MoveXZGravity(&this->actor); PRINTF("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_Rl/z_en_rl.c b/src/overlays/actors/ovl_En_Rl/z_en_rl.c index 8271dc4a6c0..8cbad3bf80b 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -122,7 +122,7 @@ void func_80AE7590(EnRl* this, PlayState* play) { Vec3f pos; s16 sceneId = play->sceneId; - if ((gSaveContext.sceneLayer == 4) && (sceneId == SCENE_CHAMBER_OF_THE_SAGES) && + if ((gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) && (sceneId == SCENE_CHAMBER_OF_THE_SAGES) && (play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[6] != NULL) && (play->csCtx.actorCues[6]->id == 2) && !this->lightMedallionGiven) { player = GET_PLAYER(play); 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 e2d612d61bf..cc6f842002b 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.sceneLayer == 6)) { + if ((this->actor.params != TR_KOUME) || (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2))) { 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 0b0594ed86b..3c5924531e6 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -199,7 +199,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { s32 animationEnded; if (type == ENVIEWER_TYPE_2_ZELDA) { - if (gSaveContext.sceneLayer == 5) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { csCurFrame = play->csCtx.curFrame; if (csCurFrame == 792) { Actor_PlaySfx(&this->actor, NA_SE_VO_Z0_SURPRISE); @@ -213,7 +213,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.sceneLayer == 4) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { switch (play->csCtx.curFrame) { case 20: case 59: @@ -231,7 +231,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { break; } } - if (gSaveContext.sceneLayer == 5) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { if (play->csCtx.curFrame == 1508) { Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_ST_LAUGH); } @@ -248,7 +248,8 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } else if (type == ENVIEWER_TYPE_6_HORSE_GANONDORF) { - if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 10) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1) || + gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_6)) { Actor_PlaySfx(&this->actor, NA_SE_EV_HORSE_RUN_LEVEL - SFX_FLAG); } } else if (type == ENVIEWER_TYPE_4_HORSE_GANONDORF) { @@ -357,7 +358,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { } } } else if (type == ENVIEWER_TYPE_1_IMPA) { - if (gSaveContext.sceneLayer == 5) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { if (play->csCtx.curFrame == 845) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, 2600.0f, 0, 0, 0, 0); @@ -493,7 +494,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.sceneLayer == 4) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { if (play->csCtx.curFrame >= 400) { if (limbIndex == YOUNG_GANONDORF_LIMB_LEFT_HAND) { *dList = gYoungGanondorfOpenLeftHandDL; @@ -537,7 +538,7 @@ void EnViewer_DrawGanondorf(EnViewer* this, PlayState* play) { if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF) { - if (gSaveContext.sceneLayer != 4) { + if (gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0)) { frames = 149; } @@ -649,7 +650,7 @@ void EnViewer_DrawZelda(EnViewer* this, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeOutTex)); } - if (gSaveContext.sceneLayer == 6) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthSurprisedTex)); } else { if (play->csCtx.curFrame < 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 ccf9bf873fc..bd727888feb 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -427,7 +427,7 @@ void EnXc_SetLandingSFX(EnXc* this, PlayState* play) { u32 sfxId; s16 sceneId = play->sceneId; - if ((gSaveContext.sceneLayer != 4) || (sceneId != SCENE_DESERT_COLOSSUS)) { + if ((gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0)) || (sceneId != SCENE_DESERT_COLOSSUS)) { if (Animation_OnFrame(&this->skelAnime, 11.0f)) { sfxId = NA_SE_PL_WALK_GROUND; sfxId += SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); @@ -439,7 +439,7 @@ void EnXc_SetLandingSFX(EnXc* this, PlayState* play) { void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) { s16 sceneId; - if (gSaveContext.sceneLayer == 4) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { sceneId = play->sceneId; if (sceneId == SCENE_DESERT_COLOSSUS) { CutsceneContext* csCtx = &play->csCtx; @@ -465,13 +465,14 @@ void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) { void func_80B3D118(PlayState* play) { s16 sceneId; - if ((gSaveContext.sceneLayer != 4) || (sceneId = play->sceneId, sceneId != SCENE_DESERT_COLOSSUS)) { + if ((gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0)) || + (sceneId = play->sceneId, sceneId != SCENE_DESERT_COLOSSUS)) { Sfx_PlaySfxCentered2(NA_SE_PL_SKIP); } } void EnXc_SetColossusWindSFX(PlayState* play) { - if (gSaveContext.sceneLayer == 4) { + if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { static s32 D_80B41D90 = 0; static Vec3f sPos = { 0.0f, 0.0f, 0.0f }; static Vec3f D_80B42DB0; 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 a2b2e50fcf4..0fcb77f399f 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.sceneLayer != 4) { + if (gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0)) { Actor_Kill(&this->actor); return; } 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 df08e74937e..a619f7104c7 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->sceneId == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == 7) { + if (play->sceneId == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_3)) { dist = Math3D_Vec3f_DistXYZ(&this->prevEyePos, &play->view.eye); this->prevEyePos.x = play->view.eye.x; @@ -227,8 +227,8 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) { } if (play->envCtx.precipitation[PRECIP_SNOW_MAX] < 64 && - (gSaveContext.save.entranceIndex != ENTR_KOKIRI_FOREST_0 || gSaveContext.sceneLayer != 4 || - play->envCtx.precipitation[PRECIP_SNOW_MAX])) { + (gSaveContext.save.entranceIndex != ENTR_KOKIRI_FOREST_0 || + gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0) || 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 8e534c52d85..4130b93550c 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -41,8 +41,7 @@ typedef struct GetItemEntry { #define CHEST_ANIM_SHORT 0 #define CHEST_ANIM_LONG 1 -#define GET_ITEM_NONE \ - { ITEM_NONE, 0, 0, 0, OBJECT_INVALID } +#define GET_ITEM_NONE { ITEM_NONE, 0, 0, 0, OBJECT_INVALID } typedef struct ExplosiveInfo { /* 0x00 */ u8 itemId; @@ -81,10 +80,10 @@ typedef enum AnimSfxType { #define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) -#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame)&0x7FF))) +#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame) & 0x7FF))) -#define ANIMSFX_GET_TYPE(data) ((data)&0x7800) -#define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) +#define ANIMSFX_GET_TYPE(data) ((data) & 0x7800) +#define ANIMSFX_GET_FRAME(data) ((data) & 0x7FF) typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; From 50acfc24289ba6e893c778d02fed6376bfe0f031 Mon Sep 17 00:00:00 2001 From: feacur Date: Thu, 28 Nov 2024 19:08:52 +0100 Subject: [PATCH 22/26] apply Jenkins fixes https://jenkins.deco.mp/job/OOT/job/PR-2286/32/console --- src/overlays/actors/ovl_player_actor/z_player.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 4130b93550c..8e534c52d85 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -41,7 +41,8 @@ typedef struct GetItemEntry { #define CHEST_ANIM_SHORT 0 #define CHEST_ANIM_LONG 1 -#define GET_ITEM_NONE { ITEM_NONE, 0, 0, 0, OBJECT_INVALID } +#define GET_ITEM_NONE \ + { ITEM_NONE, 0, 0, 0, OBJECT_INVALID } typedef struct ExplosiveInfo { /* 0x00 */ u8 itemId; @@ -80,10 +81,10 @@ typedef enum AnimSfxType { #define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) -#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame) & 0x7FF))) +#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame)&0x7FF))) -#define ANIMSFX_GET_TYPE(data) ((data) & 0x7800) -#define ANIMSFX_GET_FRAME(data) ((data) & 0x7FF) +#define ANIMSFX_GET_TYPE(data) ((data)&0x7800) +#define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; From 6efea0a85fdfb44b44db6a9f456789212147f505 Mon Sep 17 00:00:00 2001 From: feacur Date: Fri, 29 Nov 2024 11:08:20 +0100 Subject: [PATCH 23/26] tweak `CS_INDEX` descriptions --- include/z64cutscene.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index df1d51f0b92..026071d52b8 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -346,8 +346,11 @@ typedef enum CutsceneDestination { // the primary purpose of these values is to select `gSaveContext.sceneLayer` // CS_INDEX_AUTO: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] -// CS_INDEX_[0 .. A]: GET_CUTSCENE_LAYER(index) -// `z_demo.c` is the main user +// CS_INDEX_[0 .. A]: GET_CUTSCENE_LAYER(cutscene_index) +// normally `z_play.c` does this task, while the rest of the code +// schedules that by assigning one of the listed values to either of +// - `gSaveContext.save.cutsceneIndex` +// - `gSaveContext.nextCutsceneIndex` #define CS_INDEX_AUTO 0x0000 #define CS_INDEX_0 0xFFF0 #define CS_INDEX_1 0xFFF1 @@ -362,13 +365,14 @@ typedef enum CutsceneDestination { #define CS_INDEX_A 0xFFFA // then there are two different sentinel values -// `z_play.c` is the main user -#define CS_INDEX_EMPTY 0xFFFD // marks `gSaveContext.save.cutsceneIndex` as free -#define CS_INDEX_NEXT_EMPTY 0xFFEF // marks `gSaveContext.nextCutsceneIndex` as free +// it is not strictly required to wait until a field is empty before setting it +// albeit there are some cases besides `z_play.c` which do check for these values +// either to sequence actions properly or to drive their internal logic +#define CS_INDEX_EMPTY 0xFFFD // marks `cutsceneIndex` as free +#define CS_INDEX_NEXT_EMPTY 0xFFEF // marks `nextCutsceneIndex` as free // finally two more, but they're not meaningful for the normal gameplay -// `z_select.c` is the main user -#define CS_INDEX_8000 0x8000 // unused; set in CS_DEST_DEATH_MOUNTAIN_TRAIL +#define CS_INDEX_8000 0x8000 // unused; set in CS_DEST_DEATH_MOUNTAIN_TRAIL or `z_select.c` #define CS_INDEX_FFFF 0xFFFF // unused; set in CS_DEST_GANONS_CASTLE_DISPEL_BARRIER_CONDITONAL typedef union CsCmdCam { From e9adab6d88fe2abaf812b698589e991621244120 Mon Sep 17 00:00:00 2001 From: feacur Date: Sat, 30 Nov 2024 01:21:59 +0100 Subject: [PATCH 24/26] apply PR review suggestions --- include/z64cutscene.h | 33 +++++++++++-------- src/code/z_demo.c | 6 ++-- src/overlays/gamestates/ovl_select/z_select.c | 12 +++---- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 026071d52b8..9bb55580897 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -344,14 +344,19 @@ typedef enum CutsceneDestination { /* 0x77 */ CS_DEST_ZELDAS_COURTYARD_RECEIVE_LETTER } CutsceneDestination; -// the primary purpose of these values is to select `gSaveContext.sceneLayer` -// CS_INDEX_AUTO: [SCENE_LAYER_CHILD_DAY .. SCENE_LAYER_ADULT_NIGHT] -// CS_INDEX_[0 .. A]: GET_CUTSCENE_LAYER(cutscene_index) -// normally `z_play.c` does this task, while the rest of the code -// schedules that by assigning one of the listed values to either of +// 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_AUTO 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 @@ -364,16 +369,16 @@ typedef enum CutsceneDestination { #define CS_INDEX_9 0xFFF9 #define CS_INDEX_A 0xFFFA -// then there are two different sentinel values -// it is not strictly required to wait until a field is empty before setting it -// albeit there are some cases besides `z_play.c` which do check for these values -// either to sequence actions properly or to drive their internal logic -#define CS_INDEX_EMPTY 0xFFFD // marks `cutsceneIndex` as free -#define CS_INDEX_NEXT_EMPTY 0xFFEF // marks `nextCutsceneIndex` as free +// 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 "auto" +#define CS_INDEX_EMPTY 0xFFFD -// finally two more, but they're not meaningful for the normal gameplay -#define CS_INDEX_8000 0x8000 // unused; set in CS_DEST_DEATH_MOUNTAIN_TRAIL or `z_select.c` -#define CS_INDEX_FFFF 0xFFFF // unused; set in CS_DEST_GANONS_CASTLE_DISPEL_BARRIER_CONDITONAL +// 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 { diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 43d17883cf5..cc78a46f035 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -746,7 +746,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK_FAST; - gSaveContext.save.cutsceneIndex = CS_INDEX_8000; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNK_8000; break; case CS_DEST_LAKE_HYLIA_WATER_RESTORED: @@ -1367,10 +1367,10 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->csCtx.script = SEGMENTED_TO_VIRTUAL(gTowerBarrierCs); play->csCtx.curFrame = 0; gSaveContext.cutsceneTrigger = 1; - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFF; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNK_FFFF; csCtx->state = CS_STATE_STOP; } else { - gSaveContext.save.cutsceneIndex = CS_INDEX_FFFF; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNK_FFFF; csCtx->state = CS_STATE_STOP; } break; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 5144648b0a0..1336d20078e 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -295,7 +295,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { - if (gSaveContext.save.cutsceneIndex == CS_INDEX_8000) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_UNK_8000) { gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { gSaveContext.save.cutsceneIndex = CS_INDEX_0; @@ -320,13 +320,13 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_9) { gSaveContext.save.cutsceneIndex = CS_INDEX_A; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_A) { - gSaveContext.save.cutsceneIndex = CS_INDEX_8000; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNK_8000; } } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { - if (gSaveContext.save.cutsceneIndex == CS_INDEX_8000) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_UNK_8000) { gSaveContext.save.cutsceneIndex = CS_INDEX_A; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { - gSaveContext.save.cutsceneIndex = CS_INDEX_8000; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNK_8000; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_0) { gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_1) { @@ -560,7 +560,7 @@ void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 label = T(GFXP_HIRAGANA " ヨル " GFXP_KATAKANA "ゴロン", "Night"); gSaveContext.save.dayTime = CLOCK_TIME(0, 0); break; - case CS_INDEX_8000: + case CS_INDEX_UNK_8000: // clang-format off gSaveContext.save.dayTime = CLOCK_TIME(12, 0); label = T(GFXP_HIRAGANA "オヒル " GFXP_KATAKANA "ジャラ", "Day"); // clang-format on @@ -727,6 +727,6 @@ void MapSelect_Init(GameState* thisx) { DMA_REQUEST_SYNC(this->staticSegment, (uintptr_t)_z_select_staticSegmentRomStart, size, "../z_select.c", 1115); } - gSaveContext.save.cutsceneIndex = CS_INDEX_8000; + gSaveContext.save.cutsceneIndex = CS_INDEX_UNK_8000; gSaveContext.save.linkAge = LINK_AGE_CHILD; } From 67f0eef7905b695ca17ef7c887ac92590281277c Mon Sep 17 00:00:00 2001 From: feacur Date: Sat, 30 Nov 2024 02:07:31 +0100 Subject: [PATCH 25/26] rename "auto" -> "default" --- include/z64cutscene.h | 4 ++-- src/code/z_demo.c | 4 ++-- src/code/z_kankyo.c | 2 +- src/code/z_parameter.c | 4 ++-- src/code/z_play.c | 3 +-- src/code/z_sram.c | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 24 +++++++++---------- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 2 +- .../z_en_horse_game_check.c | 8 +++---- src/overlays/gamestates/ovl_select/z_select.c | 12 +++++----- 10 files changed, 32 insertions(+), 33 deletions(-) diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 9bb55580897..c85a9f999ed 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -349,7 +349,7 @@ typedef enum CutsceneDestination { // - `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_AUTO 0x0000 +#define CS_INDEX_DEFAULT 0x0000 #define CS_INDEX_UNK_8000 0x8000 // values `>= 0xFFF0` indicate a "scripted" cutscene; can be assigned to @@ -373,7 +373,7 @@ typedef enum CutsceneDestination { // 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 "auto" +// 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 diff --git a/src/code/z_demo.c b/src/code/z_demo.c index cc78a46f035..38b8479f7f2 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -593,7 +593,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti gSaveContext.forceRisingButtonAlphas = true; } - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; switch (cmd->destination) { case CS_DEST_CUTSCENE_MAP_GANON_HORSE: @@ -2269,7 +2269,7 @@ void CutsceneHandler_StopScript(PlayState* play, CutsceneContext* csCtx) { PRINTF(T("\n\n\n\n\nやっぱりここかいな", "\n\n\n\n\nThis is it after all")); - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; gSaveContext.gameMode = GAMEMODE_NORMAL; if (gUseCutsceneCam) { diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index a6ddc4c5ee5..7db954c604a 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -2619,7 +2619,7 @@ void Environment_StopStormNatureAmbience(PlayState* play) { void Environment_WarpSongLeave(PlayState* play) { gWeatherMode = WEATHER_MODE_CLEAR; - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; gSaveContext.respawnFlag = -3; play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_RETURN].entranceIndex; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 20d0f2195a0..e1d1f4fcd4f 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3523,7 +3523,7 @@ void Interface_Draw(PlayState* play) { (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT)) { // Trade quest timer reached 0 sSubTimerStateTimer = 40; - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_WHITE; gSaveContext.subTimerState = SUBTIMER_STATE_OFF; @@ -3861,7 +3861,7 @@ void Interface_Draw(PlayState* play) { (play->sceneId != SCENE_INSIDE_GANONS_CASTLE_COLLAPSE))) { sSubTimerStateTimer = 40; gSaveContext.subTimerState = SUBTIMER_STATE_RESPAWN; - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; Message_StartTextbox(play, 0x71B0, NULL); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); } else { diff --git a/src/code/z_play.c b/src/code/z_play.c index 629f700b24a..eb5d196b83e 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,4 +1,3 @@ - #include "global.h" #include "fault.h" #include "quake.h" @@ -330,7 +329,7 @@ void Play_Init(GameState* thisx) { } if (gSaveContext.save.cutsceneIndex == CS_INDEX_EMPTY) { - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; } if (gSaveContext.nextDayTime != NEXT_TIME_NONE) { diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 928b541f712..114c9f60e10 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -797,7 +797,7 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) { #if DEBUG_FEATURES if (fileSelect->buttonIndex == 0) { - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; } #endif 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 c6d1aedfe31..e2cad372385 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -500,7 +500,7 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { gSaveContext.nextCutsceneIndex = CS_INDEX_1; } else { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_TRAIL_5; - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; } } else if (play->sceneId == SCENE_DEKU_TREE_BOSS) { if (!Flags_GetEventChkInf(EVENTCHKINF_07)) { @@ -511,11 +511,11 @@ void DoorWarp1_ChildWarpOut(DoorWarp1* this, PlayState* play) { gSaveContext.nextCutsceneIndex = CS_INDEX_1; } else { play->nextEntranceIndex = ENTR_KOKIRI_FOREST_11; - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; } } else if (play->sceneId == SCENE_JABU_JABU_BOSS) { play->nextEntranceIndex = ENTR_ZORAS_FOUNTAIN_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; } PRINTF("\n\n\nおわりおわり"); play->transitionTrigger = TRANS_TRIGGER_START; @@ -706,7 +706,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { SET_EVENTCHKINF(EVENTCHKINF_48); Item_Give(play, ITEM_MEDALLION_FOREST); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; gSaveContext.chamberCutsceneNum = CHAMBER_CS_FOREST; } else { if (!LINK_IS_ADULT) { @@ -714,7 +714,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_SACRED_FOREST_MEADOW_3; } - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; } } else if (play->sceneId == SCENE_FIRE_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_49)) { @@ -728,14 +728,14 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_5; } - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; } } else if (play->sceneId == SCENE_WATER_TEMPLE_BOSS) { if (!GET_EVENTCHKINF(EVENTCHKINF_4A)) { SET_EVENTCHKINF(EVENTCHKINF_4A); Item_Give(play, ITEM_MEDALLION_WATER); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; gSaveContext.chamberCutsceneNum = CHAMBER_CS_WATER; } else { if (!LINK_IS_ADULT) { @@ -743,13 +743,13 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_LAKE_HYLIA_9; } - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; } } else if (play->sceneId == SCENE_SPIRIT_TEMPLE_BOSS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { Item_Give(play, ITEM_MEDALLION_SPIRIT); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SPIRIT; } else { if (!LINK_IS_ADULT) { @@ -757,13 +757,13 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_DESERT_COLOSSUS_8; } - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; } } else if (play->sceneId == SCENE_SHADOW_TEMPLE_BOSS) { if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW)) { Item_Give(play, ITEM_MEDALLION_SHADOW); play->nextEntranceIndex = ENTR_CHAMBER_OF_THE_SAGES_0; - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; gSaveContext.chamberCutsceneNum = CHAMBER_CS_SHADOW; } else { if (!LINK_IS_ADULT) { @@ -771,7 +771,7 @@ void DoorWarp1_AdultWarpOut(DoorWarp1* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_GRAVEYARD_8; } - gSaveContext.nextCutsceneIndex = CS_INDEX_AUTO; + gSaveContext.nextCutsceneIndex = CS_INDEX_DEFAULT; } } play->transitionTrigger = TRANS_TRIGGER_START; 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 16aad0b67ad..ae7dd7a7332 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -2544,7 +2544,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { EnHorse_UpdateHbaRaceInfo(this, play, &sHbaInfo); if ((this->hbaFlags & 1) || (this->hbaTimer >= 46)) { if ((isFanfarePlaying != true) && (gSaveContext.minigameState != 3)) { - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_16; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_CIRCLE(TCA_NORMAL, TCC_BLACK, TCS_FAST); diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 0e75d3ec068..8a9397c501b 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -110,7 +110,7 @@ s32 EnHorseGameCheck_DestroyIngoRace(EnHorseGameCheckBase* base, PlayState* play } void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, PlayState* play) { - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; if (this->result == INGORACE_PLAYER_WIN) { play->nextEntranceIndex = ENTR_LON_LON_RANCH_7; if (GET_EVENTINF(EVENTINF_HORSES_06)) { @@ -297,21 +297,21 @@ s32 EnHorseGameCheck_DestroyMalonRace(EnHorseGameCheckBase* base, PlayState* pla void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, PlayState* play) { if ((this->result == MALONRACE_SUCCESS) || (this->result == MALONRACE_TIME_UP)) { - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; play->nextEntranceIndex = ENTR_LON_LON_RANCH_7; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; } else if (this->result == MALONRACE_FAILURE) { gSaveContext.timerSeconds = 240; gSaveContext.timerState = TIMER_STATE_UP_FREEZE; - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; play->nextEntranceIndex = ENTR_LON_LON_RANCH_7; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; } else { // "not supported" PRINTF("En_HGC_Spot20_Ta_end():対応せず\n"); - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; play->nextEntranceIndex = ENTR_LON_LON_RANCH_0; play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 1336d20078e..2777ac889de 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -296,8 +296,8 @@ void MapSelect_UpdateMenu(MapSelectState* this) { if (CHECK_BTN_ALL(input->press.button, BTN_Z)) { if (gSaveContext.save.cutsceneIndex == CS_INDEX_UNK_8000) { - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_DEFAULT) { gSaveContext.save.cutsceneIndex = CS_INDEX_0; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_0) { gSaveContext.save.cutsceneIndex = CS_INDEX_1; @@ -325,10 +325,10 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } else if (CHECK_BTN_ALL(input->press.button, BTN_R)) { if (gSaveContext.save.cutsceneIndex == CS_INDEX_UNK_8000) { gSaveContext.save.cutsceneIndex = CS_INDEX_A; - } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { + } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_DEFAULT) { gSaveContext.save.cutsceneIndex = CS_INDEX_UNK_8000; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_0) { - gSaveContext.save.cutsceneIndex = CS_INDEX_AUTO; + gSaveContext.save.cutsceneIndex = CS_INDEX_DEFAULT; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_1) { gSaveContext.save.cutsceneIndex = CS_INDEX_0; } else if (gSaveContext.save.cutsceneIndex == CS_INDEX_2) { @@ -353,7 +353,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { } gSaveContext.save.nightFlag = 0; - if (gSaveContext.save.cutsceneIndex == CS_INDEX_AUTO) { + if (gSaveContext.save.cutsceneIndex == CS_INDEX_DEFAULT) { gSaveContext.save.nightFlag = 1; } @@ -556,7 +556,7 @@ void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 GfxPrint_SetColor(printer, 255, 255, 55, 255); switch (csIndex) { - case CS_INDEX_AUTO: + case CS_INDEX_DEFAULT: label = T(GFXP_HIRAGANA " ヨル " GFXP_KATAKANA "ゴロン", "Night"); gSaveContext.save.dayTime = CLOCK_TIME(0, 0); break; From cbaad70f2631a71be6c1b55660863332d61f8914 Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 4 Dec 2024 07:50:04 +0100 Subject: [PATCH 26/26] apply PR review suggestions https://github.com/zeldaret/oot/pull/2286#discussion_r1868693980 essentially reverts 106cb1021be88f745ee303838c11c7d7cbf9c79d, except for 2 generic `z_scene.c` lines --- src/code/z_demo.c | 6 +-- src/code/z_kankyo.c | 5 +-- src/code/z_parameter.c | 2 +- src/code/z_scene_table.c | 6 +-- .../z_bg_spot00_hanebasi.c | 14 +++---- .../z_bg_spot01_idohashira.c | 4 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c | 4 +- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.c | 7 ++-- .../actors/ovl_Demo_Effect/z_demo_effect.c | 38 +++++++++---------- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 3 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 3 +- .../actors/ovl_En_Jsjutan/z_en_jsjutan.c | 3 +- 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_Rl/z_en_rl.c | 2 +- src/overlays/actors/ovl_En_Tr/z_en_tr.c | 2 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 17 ++++----- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 9 ++--- .../ovl_En_Yabusame_Mark/z_en_yabusame_mark.c | 2 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 6 +-- 22 files changed, 64 insertions(+), 77 deletions(-) diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 38b8479f7f2..b72207ea681 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1191,19 +1191,19 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti play->transitionType = TRANS_TYPE_FADE_BLACK; } else { switch (gSaveContext.sceneLayer) { - case GET_CUTSCENE_LAYER(CS_INDEX_4): + case 8: play->nextEntranceIndex = ENTR_SACRED_FOREST_MEADOW_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; - case GET_CUTSCENE_LAYER(CS_INDEX_5): + case 9: play->nextEntranceIndex = ENTR_DEATH_MOUNTAIN_CRATER_0; play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; - case GET_CUTSCENE_LAYER(CS_INDEX_6): + case 10: play->nextEntranceIndex = ENTR_LAKE_HYLIA_0; play->transitionTrigger = TRANS_TRIGGER_START; gSaveContext.save.cutsceneIndex = CS_INDEX_0; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 7db954c604a..be00a96249d 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -962,7 +962,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex if ((((void)0, gSaveContext.save.dayTime) > ((void)0, gSaveContext.skyboxTime)) || (((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(1, 0) || gTimeSpeed < 0)) #else - if (((((void)0, gSaveContext.sceneLayer) >= GET_CUTSCENE_LAYER(CS_INDEX_1) || gTimeSpeed != 0) && + if (((((void)0, gSaveContext.sceneLayer) >= 5 || gTimeSpeed != 0) && ((void)0, gSaveContext.save.dayTime) > ((void)0, gSaveContext.skyboxTime)) || (((void)0, gSaveContext.save.dayTime) < CLOCK_TIME(1, 0) || gTimeSpeed < 0)) #endif @@ -1421,8 +1421,7 @@ void Environment_DrawSunAndMoon(PlayState* play) { play->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.save.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; } - if (gSaveContext.save.entranceIndex != ENTR_HYRULE_FIELD_0 || - ((void)0, gSaveContext.sceneLayer) != GET_CUTSCENE_LAYER(CS_INDEX_1)) { + if (gSaveContext.save.entranceIndex != ENTR_HYRULE_FIELD_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 e1d1f4fcd4f..8f5d847129a 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -4031,7 +4031,7 @@ void Interface_Update(PlayState* play) { if (!IS_PAUSED(&play->pauseCtx)) { if ((gSaveContext.minigameState == 1) || !IS_CUTSCENE_LAYER || - ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)))) { + ((play->sceneId == SCENE_LON_LON_RANCH) && (gSaveContext.sceneLayer == 4))) { if ((msgCtx->msgMode == MSGMODE_NONE) || ((msgCtx->msgMode != MSGMODE_NONE) && (play->sceneId == SCENE_BOMBCHU_BOWLING_ALLEY))) { if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 7c1858ebf11..24521f3aa3b 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -350,7 +350,7 @@ void Scene_DrawConfigTempleOfTime(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5145); - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { + if (gSaveContext.sceneLayer == 5) { gCustomLensFlareOn = true; gCustomLensFlarePos.x = -20.0f; gCustomLensFlarePos.y = 1220.0f; @@ -1186,9 +1186,9 @@ void Scene_DrawConfigKokiriForest(PlayState* play) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (gSaveContext.sceneLayer == 4) { spA3 = 255 - (u8)play->roomCtx.drawParams[0]; - } else if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { + } else if (gSaveContext.sceneLayer == 6) { spA0 = play->roomCtx.drawParams[0] + 500; } else if ( #if OOT_VERSION < PAL_1_0 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 a261a9f1b6a..775ad9700f4 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 @@ -69,15 +69,14 @@ void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play) { return; } - if ((gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_2)) && - ((gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) || - (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) || (!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.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_2)) { + 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; @@ -227,7 +226,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { } } - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { + if (gSaveContext.sceneLayer == 5) { u16 dayTime; s32 tmp; @@ -243,8 +242,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) { dayTime = gSaveContext.save.dayTime; - if ((dayTime > CLOCK_TIME(4, 0)) && (dayTime < CLOCK_TIME(4, 30)) && - (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1))) { + if ((dayTime > CLOCK_TIME(4, 0)) && (dayTime < CLOCK_TIME(4, 30)) && (gSaveContext.sceneLayer == 5)) { gTimeSpeed = 0; } } @@ -310,7 +308,7 @@ 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.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_8)) { + if (gSaveContext.sceneLayer != 12) { if (IS_CUTSCENE_LAYER || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) { BgSpot00Hanebasi_DrawTorches(thisx, play); } else { 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 37f146fd92e..475940dd532 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 @@ -307,10 +307,10 @@ void BgSpot01Idohashira_Init(Actor* thisx, PlayState* play) { } else { this->action = 0; } - } else if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { + } else if (gSaveContext.sceneLayer == 4) { this->action = 1; this->dyna.actor.shape.yOffset = -(kREG(10) + 1100.0f); - } else if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { + } else if (gSaveContext.sceneLayer == 6) { this->action = 0; } else { Actor_Kill(&this->dyna.actor); 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 b24a3bc61a8..e25280ed0bd 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.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { + if (gSaveContext.sceneLayer == 5) { play->roomCtx.drawParams[0] = 0xFF; } @@ -118,7 +118,7 @@ void func_808BAF40(BgTokiSwd* this, PlayState* play) { } } } - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { + if (gSaveContext.sceneLayer == 5) { if (play->roomCtx.drawParams[0] > 0) { play->roomCtx.drawParams[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 4bd2f0a4756..ef0e25f4043 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -73,7 +73,7 @@ void BgTreemouth_Init(Actor* thisx, PlayState* play) { if (!IS_CUTSCENE_LAYER && !LINK_IS_ADULT) { BgTreemouth_SetupAction(this, func_808BC8B8); - } else if (LINK_IS_ADULT || (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_3))) { + } else if (LINK_IS_ADULT || (gSaveContext.sceneLayer == 7)) { this->unk_168 = 0.0f; BgTreemouth_SetupAction(this, BgTreemouth_DoNothing); } else { @@ -116,8 +116,7 @@ void func_808BC6F8(BgTreemouth* this, PlayState* play) { this->unk_168 = 1.0f; } - if ((gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) && (play->csCtx.curFrame > 700) && - (play->state.frames % 8 == 0)) { + if ((gSaveContext.sceneLayer == 6) && (play->csCtx.curFrame > 700) && (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; @@ -249,7 +248,7 @@ void BgTreemouth_Draw(Actor* thisx, PlayState* play) { } else { // needed to match } - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { + if (gSaveContext.sceneLayer == 6) { alpha = (play->roomCtx.drawParams[0] + 0x1F4); } 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 cf8baf3a356..2a3e8c45312 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -678,8 +678,7 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { } else { Actor_SetScale(&this->actor, 84 * 0.001f); } - } else if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1) || - gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0) || + } else if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 4 || (gSaveContext.save.entranceIndex == ENTR_TEMPLE_OF_TIME_4 && !GET_EVENTCHKINF(EVENTCHKINF_C9))) { SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 59.0f, 0.0f); SkelCurve_Update(play, &this->skelCurve); @@ -835,8 +834,7 @@ void DemoEffect_UpdateTriforceSpot(DemoEffect* this, PlayState* play) { } } - if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0 && - gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2) && + if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0 && gSaveContext.sceneLayer == 6 && play->csCtx.curFrame == FRAMERATE_CONST(143, 120)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_RING_EXPLOSION); } @@ -1062,12 +1060,11 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { break; } - if (play->sceneId == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2) && - play->csCtx.curFrame == 197) { + if (play->sceneId == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == 6 && play->csCtx.curFrame == 197) { Actor_PlaySfx(&this->actor, NA_SE_EV_WHITE_OUT); } - if (play->sceneId == SCENE_DEATH_MOUNTAIN_TRAIL && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { + if (play->sceneId == SCENE_DEATH_MOUNTAIN_TRAIL && gSaveContext.sceneLayer == 5) { if (!DemoEffect_CheckForCue(this, play, 1)) { Actor_PlaySfx(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } @@ -1078,7 +1075,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { if (0) {} } - if (play->sceneId == SCENE_ZORAS_FOUNTAIN && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (play->sceneId == SCENE_ZORAS_FOUNTAIN && gSaveContext.sceneLayer == 4) { if (!DemoEffect_CheckForCue(this, play, 1)) { Actor_PlaySfx(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG); } @@ -1090,7 +1087,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) { if (0) {} } - if (play->sceneId == SCENE_TEMPLE_OF_TIME && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_A)) { + if (play->sceneId == SCENE_TEMPLE_OF_TIME && gSaveContext.sceneLayer == 14) { if (1) {} if (play->csCtx.actorCues[this->cueChannel]->id == 2) { @@ -1148,7 +1145,7 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play) { if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) { switch (gSaveContext.sceneLayer) { - case GET_CUTSCENE_LAYER(CS_INDEX_0): + case 4: if (play->csCtx.curFrame == FRAMERATE_CONST(288, 240)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } @@ -1157,13 +1154,13 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play) { } break; - case GET_CUTSCENE_LAYER(CS_INDEX_2): + case 6: if (play->csCtx.curFrame == FRAMERATE_CONST(55, 25)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; - case GET_CUTSCENE_LAYER(CS_INDEX_7): + case 11: if (play->csCtx.curFrame == FRAMERATE_CONST(350, 353)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } @@ -1203,18 +1200,18 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) { if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) { switch (gSaveContext.sceneLayer) { - case GET_CUTSCENE_LAYER(CS_INDEX_0): + case 4: if (play->csCtx.curFrame == FRAMERATE_CONST(298, 248)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; - case GET_CUTSCENE_LAYER(CS_INDEX_2): + case 6: if (play->csCtx.curFrame == FRAMERATE_CONST(105, 88)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; - case GET_CUTSCENE_LAYER(CS_INDEX_7): + case 11: if (play->csCtx.curFrame == FRAMERATE_CONST(360, 362)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } @@ -1222,8 +1219,7 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) { } } - if (gSaveContext.save.entranceIndex == ENTR_DEATH_MOUNTAIN_TRAIL_0 && - gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (gSaveContext.save.entranceIndex == ENTR_DEATH_MOUNTAIN_TRAIL_0 && gSaveContext.sceneLayer == 4) { if (play->csCtx.curFrame == FRAMERATE_CONST(72, 57)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } @@ -1263,19 +1259,19 @@ void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, PlayState* play) { if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) { switch (gSaveContext.sceneLayer) { - case GET_CUTSCENE_LAYER(CS_INDEX_0): + case 4: if (play->csCtx.curFrame == FRAMERATE_CONST(315, 265)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS); } break; - case GET_CUTSCENE_LAYER(CS_INDEX_2): + case 6: if (play->csCtx.curFrame == FRAMERATE_CONST(80, 60)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } break; - case GET_CUTSCENE_LAYER(CS_INDEX_7): + case 11: if (play->csCtx.curFrame == FRAMERATE_CONST(370, 371)) { Actor_PlaySfx(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH); } @@ -1768,7 +1764,7 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) { if (!DemoEffect_CheckForCue(this, play, 2)) { if (gSaveContext.save.entranceIndex == ENTR_CUTSCENE_MAP_0) { - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (gSaveContext.sceneLayer == 4) { if (play->csCtx.curFrame <= 680) { Sfx_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_GOD_FLYING - SFX_FLAG); } 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 231a100656c..ac9afd8d84c 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -936,7 +936,7 @@ void func_80986CFC(DemoIm* this, PlayState* play) { void func_80986D40(DemoIm* this, PlayState* play) { #if DEBUG_FEATURES - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { + if (gSaveContext.sceneLayer == 6) { this->action = 19; this->drawConfig = 1; return; 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 7a0105a25f9..a83552b9bf1 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -864,7 +864,7 @@ void func_80A03CF8(EnElf* this, PlayState* play) { func_80A02C98(this, &nextPos, 0.2f); } - if ((play->sceneId == SCENE_LINKS_HOUSE) && (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0))) { + if ((play->sceneId == SCENE_LINKS_HOUSE) && (gSaveContext.sceneLayer == 4)) { // play dash sound effect as Navi enters Links house in the intro if (1) {} if (play->csCtx.curFrame == 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 ec619fc2c18..c9af4d3b580 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -109,8 +109,7 @@ void EnHoll_SetupAction(EnHoll* this, EnHollActionFunc func) { } int EnHoll_IsKokiriLayer8(void) { - return gSaveContext.save.entranceIndex == ENTR_KOKIRI_FOREST_0 && - gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_4); + return gSaveContext.save.entranceIndex == ENTR_KOKIRI_FOREST_0 && gSaveContext.sceneLayer == 8; } void EnHoll_ChooseAction(EnHoll* this) { 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 ae7dd7a7332..dc95d3f6a16 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -3619,8 +3619,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { this->cyl1.base.atFlags &= ~AT_ON; } - if (gSaveContext.save.entranceIndex != ENTR_LON_LON_RANCH_0 || - gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_5)) { + if (gSaveContext.save.entranceIndex != ENTR_LON_LON_RANCH_0 || 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_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index 7de638ef72d..6650e317159 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -147,8 +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.save.entranceIndex == ENTR_LON_LON_RANCH_0) && - (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_4))) { + if ((gSaveContext.save.entranceIndex == ENTR_LON_LON_RANCH_0) && (gSaveContext.sceneLayer == 8)) { Actor* actorProfessor; Actor* actorBeanGuy; 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 734408e3b55..ab116e7913a 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -166,7 +166,7 @@ s16 EnMa1_UpdateTalkState(PlayState* play, Actor* thisx) { } s32 EnMa1_ShouldSpawn(EnMa1* this, PlayState* play) { - if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1))) { + if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneLayer == 5)) { return true; } 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 ee8c0154941..35796e1eb7a 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -169,7 +169,7 @@ void EnMs_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if (gSaveContext.save.entranceIndex == ENTR_LON_LON_RANCH_0 && - gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_4)) { // ride carpet if in credits + gSaveContext.sceneLayer == 8) { // ride carpet if in credits Actor_MoveXZGravity(&this->actor); PRINTF("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_Rl/z_en_rl.c b/src/overlays/actors/ovl_En_Rl/z_en_rl.c index 8cbad3bf80b..8271dc4a6c0 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -122,7 +122,7 @@ void func_80AE7590(EnRl* this, PlayState* play) { Vec3f pos; s16 sceneId = play->sceneId; - if ((gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) && (sceneId == SCENE_CHAMBER_OF_THE_SAGES) && + if ((gSaveContext.sceneLayer == 4) && (sceneId == SCENE_CHAMBER_OF_THE_SAGES) && (play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[6] != NULL) && (play->csCtx.actorCues[6]->id == 2) && !this->lightMedallionGiven) { player = GET_PLAYER(play); 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 cc6f842002b..e2d612d61bf 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.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2))) { + 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 3c5924531e6..0b0594ed86b 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -199,7 +199,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { s32 animationEnded; if (type == ENVIEWER_TYPE_2_ZELDA) { - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { + if (gSaveContext.sceneLayer == 5) { csCurFrame = play->csCtx.curFrame; if (csCurFrame == 792) { Actor_PlaySfx(&this->actor, NA_SE_VO_Z0_SURPRISE); @@ -213,7 +213,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.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (gSaveContext.sceneLayer == 4) { switch (play->csCtx.curFrame) { case 20: case 59: @@ -231,7 +231,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { break; } } - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { + if (gSaveContext.sceneLayer == 5) { if (play->csCtx.curFrame == 1508) { Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_ST_LAUGH); } @@ -248,8 +248,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } } else if (type == ENVIEWER_TYPE_6_HORSE_GANONDORF) { - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1) || - gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_6)) { + if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 10) { Actor_PlaySfx(&this->actor, NA_SE_EV_HORSE_RUN_LEVEL - SFX_FLAG); } } else if (type == ENVIEWER_TYPE_4_HORSE_GANONDORF) { @@ -358,7 +357,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) { } } } else if (type == ENVIEWER_TYPE_1_IMPA) { - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_1)) { + if (gSaveContext.sceneLayer == 5) { if (play->csCtx.curFrame == 845) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, 2600.0f, 0, 0, 0, 0); @@ -494,7 +493,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.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (gSaveContext.sceneLayer == 4) { if (play->csCtx.curFrame >= 400) { if (limbIndex == YOUNG_GANONDORF_LIMB_LEFT_HAND) { *dList = gYoungGanondorfOpenLeftHandDL; @@ -538,7 +537,7 @@ void EnViewer_DrawGanondorf(EnViewer* this, PlayState* play) { if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF) { - if (gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (gSaveContext.sceneLayer != 4) { frames = 149; } @@ -650,7 +649,7 @@ void EnViewer_DrawZelda(EnViewer* this, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeOutTex)); } - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) { + if (gSaveContext.sceneLayer == 6) { gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthSurprisedTex)); } else { if (play->csCtx.curFrame < 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 bd727888feb..ccf9bf873fc 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -427,7 +427,7 @@ void EnXc_SetLandingSFX(EnXc* this, PlayState* play) { u32 sfxId; s16 sceneId = play->sceneId; - if ((gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0)) || (sceneId != SCENE_DESERT_COLOSSUS)) { + if ((gSaveContext.sceneLayer != 4) || (sceneId != SCENE_DESERT_COLOSSUS)) { if (Animation_OnFrame(&this->skelAnime, 11.0f)) { sfxId = NA_SE_PL_WALK_GROUND; sfxId += SurfaceType_GetSfxOffset(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId); @@ -439,7 +439,7 @@ void EnXc_SetLandingSFX(EnXc* this, PlayState* play) { void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) { s16 sceneId; - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (gSaveContext.sceneLayer == 4) { sceneId = play->sceneId; if (sceneId == SCENE_DESERT_COLOSSUS) { CutsceneContext* csCtx = &play->csCtx; @@ -465,14 +465,13 @@ void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) { void func_80B3D118(PlayState* play) { s16 sceneId; - if ((gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0)) || - (sceneId = play->sceneId, sceneId != SCENE_DESERT_COLOSSUS)) { + if ((gSaveContext.sceneLayer != 4) || (sceneId = play->sceneId, sceneId != SCENE_DESERT_COLOSSUS)) { Sfx_PlaySfxCentered2(NA_SE_PL_SKIP); } } void EnXc_SetColossusWindSFX(PlayState* play) { - if (gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (gSaveContext.sceneLayer == 4) { static s32 D_80B41D90 = 0; static Vec3f sPos = { 0.0f, 0.0f, 0.0f }; static Vec3f D_80B42DB0; 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 0fcb77f399f..a2b2e50fcf4 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.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0)) { + if (gSaveContext.sceneLayer != 4) { Actor_Kill(&this->actor); return; } 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 a619f7104c7..df08e74937e 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->sceneId == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_3)) { + if (play->sceneId == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == 7) { dist = Math3D_Vec3f_DistXYZ(&this->prevEyePos, &play->view.eye); this->prevEyePos.x = play->view.eye.x; @@ -227,8 +227,8 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) { } if (play->envCtx.precipitation[PRECIP_SNOW_MAX] < 64 && - (gSaveContext.save.entranceIndex != ENTR_KOKIRI_FOREST_0 || - gSaveContext.sceneLayer != GET_CUTSCENE_LAYER(CS_INDEX_0) || play->envCtx.precipitation[PRECIP_SNOW_MAX])) { + (gSaveContext.save.entranceIndex != ENTR_KOKIRI_FOREST_0 || gSaveContext.sceneLayer != 4 || + play->envCtx.precipitation[PRECIP_SNOW_MAX])) { play->envCtx.precipitation[PRECIP_SNOW_MAX] += 16; }