1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-08 00:44:42 +00:00

Rename "Scene Setup Index" to "Scene Layer" (#1300)

* setup -> layer

* IS_CUTSCENE_LAYER

* review

* backtick

* remove some more mentions of setup

* alt header block

* clarifying comment
This commit is contained in:
fig02 2022-07-30 17:28:50 -04:00 committed by GitHub
parent d7ea63c75d
commit afbc312024
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 169 additions and 156 deletions

View file

@ -150,15 +150,14 @@ void func_80064558(PlayState* play, CutsceneContext* csCtx) {
void func_800645A0(PlayState* play, CutsceneContext* csCtx) {
Input* input = &play->state.input[0];
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) &&
(gSaveContext.sceneSetupIndex >= 4)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) {
D_8015FCC8 = 0;
gSaveContext.cutsceneIndex = 0xFFFD;
gSaveContext.cutsceneTrigger = 1;
}
if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) &&
(gSaveContext.sceneSetupIndex >= 4) && !gDbgCamEnabled) {
if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER &&
!gDbgCamEnabled) {
D_8015FCC8 = 1;
gSaveContext.cutsceneIndex = 0xFFFD;
gSaveContext.cutsceneTrigger = 1;
@ -568,7 +567,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
gSaveContext.cutsceneIndex = 0xFFF3;
play->transitionType = TRANS_TYPE_INSTANT;
} else {
if (gSaveContext.sceneSetupIndex < 4) {
if (!IS_CUTSCENE_LAYER) {
if (!LINK_IS_ADULT) {
play->linkAgeOnLoad = LINK_AGE_ADULT;
} else {
@ -1021,7 +1020,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
gSaveContext.cutsceneIndex = 0xFFF3;
play->transitionType = TRANS_TYPE_FADE_BLACK;
} else {
switch (gSaveContext.sceneSetupIndex) {
switch (gSaveContext.sceneLayer) {
case 8:
play->nextEntranceIndex = ENTR_SPOT05_0;
play->transitionTrigger = TRANS_TRIGGER_START;

View file

@ -247,7 +247,7 @@ void func_8006DC68(PlayState* play, Player* player) {
}
if (func_8006CFC0(play->sceneNum)) {
if ((gSaveContext.sceneSetupIndex > 3) ||
if (IS_CUTSCENE_LAYER ||
((gSaveContext.entranceIndex == ENTR_SPOT00_11 || gSaveContext.entranceIndex == ENTR_SPOT00_12 ||
gSaveContext.entranceIndex == ENTR_SPOT00_13 || gSaveContext.entranceIndex == ENTR_SPOT00_15) &&
(gSaveContext.respawnFlag == 0)) ||

View file

@ -347,7 +347,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
play->envCtx.precipitation[PRECIP_SOS_MAX] = 0;
if (gSaveContext.retainWeatherMode) {
if (((void)0, gSaveContext.sceneSetupIndex) < 4) {
if (!IS_CUTSCENE_LAYER) {
switch (gWeatherMode) {
case WEATHER_MODE_CLOUDY_CONFIG3:
envCtx->skyboxConfig = 1;
@ -934,7 +934,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
}
//! @bug `gTimeSpeed` is unsigned, it can't be negative
if (((((void)0, gSaveContext.sceneSetupIndex) >= 5 || gTimeSpeed != 0) &&
if (((((void)0, gSaveContext.sceneLayer) >= 5 || gTimeSpeed != 0) &&
((void)0, gSaveContext.dayTime) > gSaveContext.skyboxTime) ||
(((void)0, gSaveContext.dayTime) < CLOCK_TIME(1, 0) || gTimeSpeed < 0)) {
@ -1387,7 +1387,7 @@ void Environment_DrawSunAndMoon(PlayState* play) {
play->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.dayTime) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f;
}
if (gSaveContext.entranceIndex != ENTR_SPOT00_0 || ((void)0, gSaveContext.sceneSetupIndex) != 5) {
if (gSaveContext.entranceIndex != ENTR_SPOT00_0 || ((void)0, gSaveContext.sceneLayer) != 5) {
Matrix_Translate(play->view.eye.x + play->envCtx.sunPos.x, play->view.eye.y + play->envCtx.sunPos.y,
play->view.eye.z + play->envCtx.sunPos.z, MTXMODE_NEW);

View file

@ -2439,7 +2439,7 @@ void Magic_Update(PlayState* play) {
// Add magic until magicFillTarget is reached
gSaveContext.magic += 4;
if (gSaveContext.gameMode == GAMEMODE_NORMAL && gSaveContext.sceneSetupIndex < 4) {
if (gSaveContext.gameMode == GAMEMODE_NORMAL && !IS_CUTSCENE_LAYER) {
Audio_PlaySfxGeneral(NA_SE_SY_GAUGE_UP - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
@ -3889,8 +3889,8 @@ void Interface_Update(PlayState* play) {
}
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) {
if ((gSaveContext.minigameState == 1) || (gSaveContext.sceneSetupIndex < 4) ||
((play->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneSetupIndex == 4))) {
if ((gSaveContext.minigameState == 1) || !IS_CUTSCENE_LAYER ||
((play->sceneNum == SCENE_SPOT20) && (gSaveContext.sceneLayer == 4))) {
if ((msgCtx->msgMode == MSGMODE_NONE) ||
((msgCtx->msgMode != MSGMODE_NONE) && (play->sceneNum == SCENE_BOWLING))) {
if (play->gameOverCtx.state == GAMEOVER_INACTIVE) {

View file

@ -222,7 +222,7 @@ void Play_Init(GameState* thisx) {
Player* player;
s32 playerStartBgCamIndex;
s32 i;
u8 tempSetupIndex;
u8 baseSceneLayer;
s32 pad[2];
if (gSaveContext.entranceIndex == ENTR_LOAD_OPENING) {
@ -291,41 +291,42 @@ void Play_Init(GameState* thisx) {
if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.cutsceneIndex >= 0xFFF0) {
gSaveContext.nayrusLoveTimer = 0;
Magic_Reset(this);
gSaveContext.sceneSetupIndex = (gSaveContext.cutsceneIndex & 0xF) + 4;
gSaveContext.sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF);
} else if (!LINK_IS_ADULT && IS_DAY) {
gSaveContext.sceneSetupIndex = 0;
gSaveContext.sceneLayer = SCENE_LAYER_CHILD_DAY;
} else if (!LINK_IS_ADULT && !IS_DAY) {
gSaveContext.sceneSetupIndex = 1;
gSaveContext.sceneLayer = SCENE_LAYER_CHILD_NIGHT;
} else if (LINK_IS_ADULT && IS_DAY) {
gSaveContext.sceneSetupIndex = 2;
gSaveContext.sceneLayer = SCENE_LAYER_ADULT_DAY;
} else {
gSaveContext.sceneSetupIndex = 3;
gSaveContext.sceneLayer = SCENE_LAYER_ADULT_NIGHT;
}
tempSetupIndex = gSaveContext.sceneSetupIndex;
// save the base scene layer (before accounting for the special cases below) to use later for the transition type
baseSceneLayer = gSaveContext.sceneLayer;
if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT00) && !LINK_IS_ADULT &&
gSaveContext.sceneSetupIndex < 4) {
!IS_CUTSCENE_LAYER) {
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) &&
CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) {
gSaveContext.sceneSetupIndex = 1;
gSaveContext.sceneLayer = 1;
} else {
gSaveContext.sceneSetupIndex = 0;
gSaveContext.sceneLayer = 0;
}
} else if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT04) && LINK_IS_ADULT &&
gSaveContext.sceneSetupIndex < 4) {
gSaveContext.sceneSetupIndex = GET_EVENTCHKINF(EVENTCHKINF_48) ? 3 : 2;
!IS_CUTSCENE_LAYER) {
gSaveContext.sceneLayer = GET_EVENTCHKINF(EVENTCHKINF_48) ? 3 : 2;
}
Play_SpawnScene(
this, gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].scene,
gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].spawn);
Play_SpawnScene(this,
gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].scene,
gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].spawn);
osSyncPrintf("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.entranceIndex), gSaveContext.sceneSetupIndex);
osSyncPrintf("\nSCENE_NO=%d COUNTER=%d\n", ((void)0, gSaveContext.entranceIndex), gSaveContext.sceneLayer);
// When entering Gerudo Valley in the right setup, trigger the GC emulator to play the ending movie.
// When entering Gerudo Valley in the credits, trigger the GC emulator to play the ending movie.
// The emulator constantly checks whether PC is 0x81000000, so this works even though it's not a valid address.
if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT09) &&
gSaveContext.sceneSetupIndex == 6) {
if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_SPOT09) && gSaveContext.sceneLayer == 6) {
osSyncPrintf("エンディングはじまるよー\n"); // "The ending starts"
((void (*)(void))0x81000000)();
osSyncPrintf("出戻り?\n"); // "Return?"
@ -372,7 +373,7 @@ void Play_Init(GameState* thisx) {
if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) {
if (gSaveContext.nextTransitionType == TRANS_NEXT_TYPE_DEFAULT) {
this->transitionType = ENTRANCE_INFO_END_TRANS_TYPE(
gEntranceTable[((void)0, gSaveContext.entranceIndex) + tempSetupIndex].field);
gEntranceTable[((void)0, gSaveContext.entranceIndex) + baseSceneLayer].field);
} else {
this->transitionType = gSaveContext.nextTransitionType;
gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT;
@ -504,16 +505,16 @@ void Play_Update(PlayState* this) {
switch (this->transitionMode) {
case TRANS_MODE_SETUP:
if (this->transitionTrigger != TRANS_TRIGGER_END) {
s16 sceneSetupIndex = 0;
s16 sceneLayer = SCENE_LAYER_CHILD_DAY;
Interface_ChangeAlpha(1);
if (gSaveContext.cutsceneIndex >= 0xFFF0) {
sceneSetupIndex = (gSaveContext.cutsceneIndex & 0xF) + 4;
sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF);
}
// fade out bgm if "continue bgm" flag is not set
if (!(gEntranceTable[this->nextEntranceIndex + sceneSetupIndex].field &
if (!(gEntranceTable[this->nextEntranceIndex + sceneLayer].field &
ENTRANCE_INFO_CONTINUE_BGM_FLAG)) {
// "Sound initalized. 111"
osSyncPrintf("\n\n\nサウンドイニシャル来ました。111");

View file

@ -41,7 +41,7 @@ void Object_InitBank(PlayState* play, ObjectContext* objectCtx) {
if (play2->sceneNum == SCENE_SPOT00) {
spaceSize = 1024000;
} else if (play2->sceneNum == SCENE_GANON_DEMO) {
if (gSaveContext.sceneSetupIndex != 4) {
if (gSaveContext.sceneLayer != 4) {
spaceSize = 1177600;
} else {
spaceSize = 1024000;
@ -411,10 +411,10 @@ void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) {
osSyncPrintf("\n[ZU]sceneset age =[%X]", ((void)0, gSaveContext.linkAge));
osSyncPrintf("\n[ZU]sceneset time =[%X]", ((void)0, gSaveContext.cutsceneIndex));
osSyncPrintf("\n[ZU]sceneset counter=[%X]", ((void)0, gSaveContext.sceneSetupIndex));
osSyncPrintf("\n[ZU]sceneset counter=[%X]", ((void)0, gSaveContext.sceneLayer));
if (gSaveContext.sceneSetupIndex != 0) {
altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.data))[gSaveContext.sceneSetupIndex - 1];
if (gSaveContext.sceneLayer != 0) {
altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.data))[gSaveContext.sceneLayer - 1];
if (1) {}
@ -425,8 +425,11 @@ void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) {
// "Coughh! There is no specified dataaaaa!"
osSyncPrintf("\nげぼはっ! 指定されたデータがないでええっす!");
if (gSaveContext.sceneSetupIndex == 3) {
altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.data))[gSaveContext.sceneSetupIndex - 2];
if (gSaveContext.sceneLayer == SCENE_LAYER_ADULT_NIGHT) {
// Due to the condition above, this is equivalent to accessing altHeaders[SCENE_LAYER_ADULT_DAY - 1]
altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(
cmd->altHeaders
.data))[(gSaveContext.sceneLayer - SCENE_LAYER_ADULT_NIGHT) + SCENE_LAYER_ADULT_DAY - 1];
// "Using adult day data there!"
osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!");

View file

@ -238,7 +238,7 @@ void Scene_DrawConfigTokinoma(PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5145);
if (gSaveContext.sceneSetupIndex == 5) {
if (gSaveContext.sceneLayer == 5) {
gCustomLensFlareOn = true;
gCustomLensFlarePos.x = -20.0f;
gCustomLensFlarePos.y = 1220.0f;
@ -1056,11 +1056,11 @@ void Scene_DrawConfigSpot04(PlayState* play) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128);
if (gSaveContext.sceneSetupIndex == 4) {
if (gSaveContext.sceneLayer == 4) {
spA3 = 255 - (u8)play->roomCtx.unk_74[0];
} else if (gSaveContext.sceneSetupIndex == 6) {
} else if (gSaveContext.sceneLayer == 6) {
spA0 = play->roomCtx.unk_74[0] + 500;
} else if (((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) && GET_EVENTCHKINF(EVENTCHKINF_07)) {
} else if ((!IS_CUTSCENE_LAYER || LINK_IS_ADULT) && GET_EVENTCHKINF(EVENTCHKINF_07)) {
spA0 = 2150;
}
@ -1087,7 +1087,7 @@ void Scene_DrawConfigSpot06(PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7058);
if ((gSaveContext.sceneSetupIndex > 3) || (LINK_IS_ADULT && !GET_EVENTCHKINF(EVENTCHKINF_69))) {
if (IS_CUTSCENE_LAYER || (LINK_IS_ADULT && !GET_EVENTCHKINF(EVENTCHKINF_69))) {
play->roomCtx.unk_74[0] = 87;
}

View file

@ -381,8 +381,8 @@ void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
switch (skyboxId) {
case SKYBOX_NORMAL_SKY:
skyboxConfig = 0;
if (gSaveContext.retainWeatherMode && gSaveContext.sceneSetupIndex < 4 &&
gWeatherMode > WEATHER_MODE_CLEAR && gWeatherMode <= WEATHER_MODE_HEAVY_RAIN) {
if (gSaveContext.retainWeatherMode && !IS_CUTSCENE_LAYER && gWeatherMode > WEATHER_MODE_CLEAR &&
gWeatherMode <= WEATHER_MODE_HEAVY_RAIN) {
skyboxConfig = 1;
}