1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-10 19:13:42 +00:00

apply review changes

This commit is contained in:
feacur 2024-11-28 12:12:32 +01:00
parent 279759f481
commit 5552e92eef
8 changed files with 39 additions and 46 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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)) {

View file

@ -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;

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}