Apply suggestions from code review

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
Co-authored-by: mzxrules <mzxrules@gmail.com>
This commit is contained in:
Leonid Kapitonov 2025-01-11 23:14:04 +01:00 committed by GitHub
parent 015380ca54
commit 787bd8419d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 10 deletions

View File

@ -344,10 +344,10 @@ typedef enum CutsceneDestination {
/* 0x77 */ CS_DEST_ZELDAS_COURTYARD_RECEIVE_LETTER
} CutsceneDestination;
// values `< 0xFFF0` indicate a "manual" cutscene; can be assigned to
// values `< 0xFFF0` indicate no cutscene, or a context in which manual cutscenes can be used; 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
// using them implies an intention to have the Play state set `gSaveContext.sceneLayer` based on age and day time on state init
// see enum values [`SCENE_LAYER_CHILD_DAY` .. `SCENE_LAYER_ADULT_NIGHT`]
#define CS_INDEX_DEFAULT 0x0000
#define CS_INDEX_UNK_8000 0x8000
@ -369,7 +369,7 @@ typedef enum CutsceneDestination {
#define CS_INDEX_9 0xFFF9
#define CS_INDEX_A 0xFFFA
// it's "out of range" even for the largest set of `entrance_table.h`
// This value is "out of range" even for the largest set of entrances in the entrance table
// but `z_demo.c` immediately sets `CS_STATE_STOP` state
#define CS_INDEX_UNK_FFFF 0xFFFF
@ -377,7 +377,7 @@ typedef enum CutsceneDestination {
#define CS_INDEX_EMPTY 0xFFFD
// sentinel value used for `nextCutsceneIndex` to indicate that it is empty
// otherwise its value will be copied to `cutsceneIndex`
// otherwise its value will be copied to `cutsceneIndex` on Play state init
#define CS_INDEX_NEXT_EMPTY 0xFFEF
typedef union CsCmdCam {

View File

@ -353,13 +353,13 @@ void Play_Init(GameState* thisx) {
!IS_CUTSCENE_LAYER) {
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) &&
CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) {
gSaveContext.sceneLayer = SCENE_LAYER_CHILD_NIGHT;
gSaveContext.sceneLayer = 1;
} else {
gSaveContext.sceneLayer = SCENE_LAYER_CHILD_DAY;
gSaveContext.sceneLayer = 0;
}
} else if ((gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_KOKIRI_FOREST) &&
LINK_IS_ADULT && !IS_CUTSCENE_LAYER) {
gSaveContext.sceneLayer = GET_EVENTCHKINF(EVENTCHKINF_48) ? SCENE_LAYER_ADULT_NIGHT : SCENE_LAYER_ADULT_DAY;
gSaveContext.sceneLayer = GET_EVENTCHKINF(EVENTCHKINF_48) ? 3 : 2;
}
Play_SpawnScene(
@ -372,7 +372,7 @@ void Play_Init(GameState* thisx) {
// When entering Gerudo Valley in the credits, trigger the GC emulator to play the ending movie.
// The emulator constantly checks whether PC is 0x81000000, so this works even though it's not a valid address.
if ((gEntranceTable[((void)0, gSaveContext.save.entranceIndex)].sceneId == SCENE_GERUDO_VALLEY) &&
gSaveContext.sceneLayer == GET_CUTSCENE_LAYER(CS_INDEX_2)) {
gSaveContext.sceneLayer == 6) {
PRINTF(T("エンディングはじまるよー\n", "The ending starts\n"));
((void (*)(void))0x81000000)();
PRINTF(T("出戻り?\n", "Return?\n"));

View File

@ -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 != GET_CUTSCENE_LAYER(CS_INDEX_0)) {
if (gSaveContext.sceneLayer != 4) {
spaceSize = 1150 * 1024 - OBJECT_SPACE_ADJUSTMENT;
} else {
spaceSize = 1000 * 1024 - OBJECT_SPACE_ADJUSTMENT;

View File

@ -13,7 +13,7 @@ void TitleSetup_SetupTitleScreen(TitleSetupState* this) {
Sram_InitDebugSave();
gSaveContext.save.cutsceneIndex = CS_INDEX_3;
// assigning scene layer here is redundant, as Play_Init sets it right away
gSaveContext.sceneLayer = GET_CUTSCENE_LAYER(CS_INDEX_3);
gSaveContext.sceneLayer = 7;
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
}