From 50837308b77ed5ddb0dfe86b2b9fbcb0ce71db80 Mon Sep 17 00:00:00 2001 From: djevangelia <263709373+djevangelia@users.noreply.github.com> Date: Thu, 9 Jul 2026 17:44:29 +0200 Subject: Decomp, update `z_en_holl.c` (#6890) --- soh/src/code/z_demo.c | 8 ++++---- soh/src/code/z_horse.c | 2 +- soh/src/code/z_kankyo.c | 7 +++---- soh/src/code/z_parameter.c | 6 +++--- soh/src/code/z_play.c | 30 +++++++++++++++--------------- soh/src/code/z_room.c | 18 +++++++++--------- soh/src/code/z_scene.c | 13 ++++++------- soh/src/code/z_scene_table.c | 10 +++++----- soh/src/code/z_vr_box.c | 2 +- 9 files changed, 47 insertions(+), 49 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_demo.c b/soh/src/code/z_demo.c index 39599a5a8..c5c0d9a48 100644 --- a/soh/src/code/z_demo.c +++ b/soh/src/code/z_demo.c @@ -158,14 +158,14 @@ void func_800645A0(PlayState* play, CutsceneContext* csCtx) { Input* input = &play->state.input[0]; if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && - (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4)) { + (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneLayer >= 4)) { D_8015FCC8 = 0; gSaveContext.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; } if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && CHECK_BTN_ALL(input->press.button, BTN_DUP) && - (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4) && !gDbgCamEnabled) { + (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneLayer >= 4) && !gDbgCamEnabled) { D_8015FCC8 = 1; gSaveContext.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; @@ -643,7 +643,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB gSaveContext.cutsceneIndex = 0xFFF3; play->transitionType = TRANS_TYPE_INSTANT; } else { - if (gSaveContext.sceneSetupIndex < 4) { + if (gSaveContext.sceneLayer < 4) { if (!LINK_IS_ADULT) { play->linkAgeOnLoad = 0; } else { @@ -1107,7 +1107,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_SACRED_FOREST_MEADOW_SOUTH_EXIT; play->transitionTrigger = TRANS_TRIGGER_START; diff --git a/soh/src/code/z_horse.c b/soh/src/code/z_horse.c index a8f9f3969..9c1521f6c 100644 --- a/soh/src/code/z_horse.c +++ b/soh/src/code/z_horse.c @@ -258,7 +258,7 @@ void Horse_InitPlayerHorse(PlayState* play, Player* player) { } if (Horse_CanSpawn(play->sceneNum)) { - if ((gSaveContext.sceneSetupIndex > 3) || + if ((gSaveContext.sceneLayer > 3) || ((gSaveContext.entranceIndex == ENTR_HYRULE_FIELD_11 || gSaveContext.entranceIndex == ENTR_HYRULE_FIELD_12 || gSaveContext.entranceIndex == ENTR_HYRULE_FIELD_13 || diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index f978c8355..704857e89 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -336,7 +336,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused) play->envCtx.unk_F2[0] = 0; if (gSaveContext.retainWeatherMode != 0) { - if (((void)0, gSaveContext.sceneSetupIndex) < 4) { + if (((void)0, gSaveContext.sceneLayer) < 4) { switch (gWeatherMode) { case 1: envCtx->unk_17 = 1; @@ -936,7 +936,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex } //! @bug `gTimeIncrement` is unsigned, it can't be negative - if (((((void)0, gSaveContext.sceneSetupIndex) >= 5 || gTimeIncrement != 0) && + if (((((void)0, gSaveContext.sceneLayer) >= 5 || gTimeIncrement != 0) && ((void)0, gSaveContext.dayTime) > gSaveContext.skyboxTime) || (((void)0, gSaveContext.dayTime) < 0xAAB || gTimeIncrement < 0)) { gSaveContext.skyboxTime = ((void)0, gSaveContext.dayTime); @@ -1321,8 +1321,7 @@ void Environment_DrawSunAndMoon(PlayState* play) { play->envCtx.sunPos.z = +(Math_CosS(((void)0, gSaveContext.dayTime) - 0x8000) * 20.0f) * 25.0f; } - if (gSaveContext.entranceIndex != ENTR_HYRULE_FIELD_PAST_BRIDGE_SPAWN || - ((void)0, gSaveContext.sceneSetupIndex) != 5) { + if (gSaveContext.entranceIndex != ENTR_HYRULE_FIELD_PAST_BRIDGE_SPAWN || ((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/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index cae9cbec1..244c08bb2 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -3205,7 +3205,7 @@ void Interface_UpdateMagicBar(PlayState* play) { case MAGIC_STATE_FILL: gSaveContext.magic += 4; - if (gSaveContext.gameMode == GAMEMODE_NORMAL && gSaveContext.sceneSetupIndex < 4) { + if (gSaveContext.gameMode == GAMEMODE_NORMAL && gSaveContext.sceneLayer < 4) { Audio_PlaySoundGeneral(NA_SE_SY_GAUGE_UP - SFX_FLAG, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } @@ -6509,8 +6509,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_LON_LON_RANCH) && (gSaveContext.sceneSetupIndex == 4))) { + if ((gSaveContext.minigameState == 1) || (gSaveContext.sceneLayer < 4) || + ((play->sceneNum == SCENE_LON_LON_RANCH) && (gSaveContext.sceneLayer == 4))) { if ((msgCtx->msgMode == MSGMODE_NONE) || ((msgCtx->msgMode != MSGMODE_NONE) && (play->sceneNum == SCENE_BOMBCHU_BOWLING_ALLEY))) { if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 801c01a59..e9e9965da 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -446,38 +446,38 @@ void Play_Init(GameState* thisx) { if (gSaveContext.gameMode != GAMEMODE_NORMAL || gSaveContext.cutsceneIndex >= 0xFFF0) { gSaveContext.nayrusLoveTimer = 0; Magic_Reset(play); - gSaveContext.sceneSetupIndex = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF); + gSaveContext.sceneLayer = SCENE_LAYER_CUTSCENE_FIRST + (gSaveContext.cutsceneIndex & 0xF); } else if (!LINK_IS_ADULT && IS_DAY) { - gSaveContext.sceneSetupIndex = SCENE_LAYER_CHILD_DAY; + gSaveContext.sceneLayer = SCENE_LAYER_CHILD_DAY; } else if (!LINK_IS_ADULT && !IS_DAY) { - gSaveContext.sceneSetupIndex = SCENE_LAYER_CHILD_NIGHT; + gSaveContext.sceneLayer = SCENE_LAYER_CHILD_NIGHT; } else if (LINK_IS_ADULT && IS_DAY) { - gSaveContext.sceneSetupIndex = SCENE_LAYER_ADULT_DAY; + gSaveContext.sceneLayer = SCENE_LAYER_ADULT_DAY; } else { - gSaveContext.sceneSetupIndex = SCENE_LAYER_ADULT_NIGHT; + gSaveContext.sceneLayer = SCENE_LAYER_ADULT_NIGHT; } // save the base scene layer (before accounting for the special cases below) to use later for the transition type - baseSceneLayer = gSaveContext.sceneSetupIndex; + baseSceneLayer = gSaveContext.sceneLayer; if ((gEntranceTable[((void)0, gSaveContext.entranceIndex)].scene == SCENE_HYRULE_FIELD) && !LINK_IS_ADULT && !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_KOKIRI_FOREST) && LINK_IS_ADULT && !IS_CUTSCENE_LAYER) { - gSaveContext.sceneSetupIndex = (Flags_GetEventChkInf(EVENTCHKINF_USED_FOREST_TEMPLE_BLUE_WARP)) ? 3 : 2; + gSaveContext.sceneLayer = (Flags_GetEventChkInf(EVENTCHKINF_USED_FOREST_TEMPLE_BLUE_WARP)) ? 3 : 2; } - Play_SpawnScene( - play, gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].scene, - gEntranceTable[((void)0, gSaveContext.sceneSetupIndex) + ((void)0, gSaveContext.entranceIndex)].spawn); + Play_SpawnScene(play, + gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].scene, + gEntranceTable[((void)0, gSaveContext.sceneLayer) + ((void)0, gSaveContext.entranceIndex)].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); #if 0 // When entering Gerudo Valley in the credits, trigger the GC emulator to play the ending movie. @@ -525,7 +525,7 @@ void Play_Init(GameState* thisx) { play->state.destroy = Play_Destroy; play->transitionTrigger = TRANS_TRIGGER_END; play->unk_11E16 = 0xFF; - play->unk_11E18 = 0; + play->bgCoverAlpha = 0; play->unk_11DE9 = false; if (gSaveContext.gameMode != GAMEMODE_TITLE_SCREEN) { @@ -1542,7 +1542,7 @@ void Play_Draw(PlayState* play) { } if ((HREG(80) != 10) || (HREG(84) != 0)) { - Environment_FillScreen(gfxCtx, 0, 0, 0, play->unk_11E18, FILL_SCREEN_OPA); + Environment_FillScreen(gfxCtx, 0, 0, 0, play->bgCoverAlpha, FILL_SCREEN_OPA); } if ((HREG(80) != 10) || (HREG(85) != 0)) { diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index 342bc734a..68bb0e5b1 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -34,7 +34,7 @@ Gfx D_801270B0[] = { gsSPEndDisplayList(), }; -s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum); +s32 OTRRoom_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum); s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx); void (*sRoomDrawHandlers[])(PlayState* play, Room* room, u32 flags) = { @@ -570,20 +570,20 @@ u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) { // "Room buffer end pointer=%08x" osSyncPrintf("部屋バッファ終了ポインタ=%08x\n", roomCtx->bufPtrs[1]); osSyncPrintf(VT_RST); - roomCtx->unk_30 = 0; + roomCtx->activeBufPage = 0; roomCtx->status = 0; frontRoom = gSaveContext.respawnFlag > 0 ? ((void)0, gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex) : play->setupEntranceList[play->curSpawn].room; - func_8009728C(play, roomCtx, frontRoom); + Room_RequestNewRoom(play, roomCtx, frontRoom); return maxRoomSize; } -s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) { +s32 Room_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum) { size_t size; - return OTRfunc_8009728C(play, roomCtx, roomNum); + return OTRRoom_RequestNewRoom(play, roomCtx, roomNum); if (roomCtx->status == 0) { roomCtx->prevRoom = roomCtx->curRoom; @@ -594,13 +594,13 @@ s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) { assert(roomNum < play->numRooms); size = play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart; - roomCtx->unk_34 = - (void*)ALIGN16((intptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); + roomCtx->unk_34 = (void*)ALIGN16((intptr_t)roomCtx->bufPtrs[roomCtx->activeBufPage] - + ((size + 8) * roomCtx->activeBufPage + 7)); osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1); DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0, &roomCtx->loadQueue, OS_MESG_PTR(NULL), __FILE__, __LINE__); - roomCtx->unk_30 ^= 1; + roomCtx->activeBufPage ^= 1; return 1; } @@ -638,7 +638,7 @@ void Room_Draw(PlayState* play, Room* room, u32 flags) { } } -void func_80097534(PlayState* play, RoomContext* roomCtx) { +void Room_FinishRoomChange(PlayState* play, RoomContext* roomCtx) { roomCtx->prevRoom.num = -1; roomCtx->prevRoom.segment = NULL; func_80031B14(play, &play->actorCtx); // kills all actors without room num set to -1 diff --git a/soh/src/code/z_scene.c b/soh/src/code/z_scene.c index f488abe5a..d9ee959c0 100644 --- a/soh/src/code/z_scene.c +++ b/soh/src/code/z_scene.c @@ -44,7 +44,7 @@ void Object_InitBank(PlayState* play, ObjectContext* objectCtx) { if (play2->sceneNum == SCENE_HYRULE_FIELD) { spaceSize = 1024000; } else if (play2->sceneNum == SCENE_GANON_BOSS) { - if (gSaveContext.sceneSetupIndex != 4) { + if (gSaveContext.sceneLayer != 4) { spaceSize = 1177600; } else { spaceSize = 1024000; @@ -424,10 +424,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.segment))[gSaveContext.sceneSetupIndex - 1]; + if (gSaveContext.sceneLayer != 0) { + altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment))[gSaveContext.sceneLayer - 1]; if (altHeader != NULL) { Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader)); @@ -436,9 +436,8 @@ 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.segment))[gSaveContext.sceneSetupIndex - 2]; + if (gSaveContext.sceneLayer == 3) { + altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.segment))[gSaveContext.sceneLayer - 2]; // "Using adult day data there!" osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!"); diff --git a/soh/src/code/z_scene_table.c b/soh/src/code/z_scene_table.c index 090d52fa6..b48e59354 100644 --- a/soh/src/code/z_scene_table.c +++ b/soh/src/code/z_scene_table.c @@ -268,7 +268,7 @@ void func_80099BD8(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); - if (gSaveContext.sceneSetupIndex == 5) { + if (gSaveContext.sceneLayer == 5) { gCustomLensFlareOn = true; gCustomLensFlarePos.x = -20.0f; gCustomLensFlarePos.y = 1220.0f; @@ -1144,11 +1144,11 @@ void func_8009E0B8(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) && + } else if (((gSaveContext.sceneLayer < 4) || LINK_IS_ADULT) && (Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_KOKIRI_EMERALD_DEKU_TREE_DEAD))) { spA0 = 2150; } @@ -1178,7 +1178,7 @@ void func_8009E54C(PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - if ((gSaveContext.sceneSetupIndex > 3) || + if ((gSaveContext.sceneLayer > 3) || (LINK_IS_ADULT && !Flags_GetEventChkInf(EVENTCHKINF_RAISED_LAKE_HYLIA_WATER))) { play->roomCtx.unk_74[0] = 87; } diff --git a/soh/src/code/z_vr_box.c b/soh/src/code/z_vr_box.c index f03f9dc7f..26bbb9835 100644 --- a/soh/src/code/z_vr_box.c +++ b/soh/src/code/z_vr_box.c @@ -556,7 +556,7 @@ void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) { switch (skyboxId) { case SKYBOX_NORMAL_SKY: phi_v1 = 0; - if (gSaveContext.retainWeatherMode != 0 && gSaveContext.sceneSetupIndex < 4 && gWeatherMode > 0 && + if (gSaveContext.retainWeatherMode != 0 && gSaveContext.sceneLayer < 4 && gWeatherMode > 0 && gWeatherMode < 6) { phi_v1 = 1; } -- cgit v1.2.3