Decomp, update z_en_holl.c (#6890)

This commit is contained in:
djevangelia
2026-07-09 17:44:29 +02:00
committed by GitHub
parent 3249b96343
commit 50837308b7
58 changed files with 507 additions and 360 deletions
+2 -2
View File
@@ -1238,10 +1238,10 @@ void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 hei
u16 tlutCount, f32 offsetX, f32 offsetY);
void func_80096FD4(PlayState* play, Room* room);
u32 func_80096FE8(PlayState* play, RoomContext* roomCtx);
s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum);
s32 Room_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum);
s32 func_800973FC(PlayState* play, RoomContext* roomCtx);
void Room_Draw(PlayState* play, Room* room, u32 flags);
void func_80097534(PlayState* play, RoomContext* roomCtx);
void Room_FinishRoomChange(PlayState* play, RoomContext* roomCtx);
void Sample_Destroy(GameState* thisx);
void Sample_Init(GameState* thisx);
void Inventory_ChangeEquipment(s16 equipment, u16 value);
+2 -2
View File
@@ -1084,7 +1084,7 @@ typedef struct {
/* 0x00 */ Room curRoom;
/* 0x14 */ Room prevRoom;
/* 0x28 */ void* bufPtrs[2];
/* 0x30 */ u8 unk_30;
/* 0x30 */ u8 activeBufPage;
/* 0x31 */ s8 status;
/* 0x34 */ void* unk_34;
/* 0x38 */ DmaRequest dmaRequest;
@@ -1477,7 +1477,7 @@ typedef struct PlayState {
/* 0x11E14 */ u8 skyboxId;
/* 0x11E15 */ s8 transitionTrigger; // "fade_direction"
/* 0x11E16 */ s16 unk_11E16;
/* 0x11E18 */ s16 unk_11E18;
/* 0x11E18 */ s16 bgCoverAlpha;
/* 0x11E1A */ s16 nextEntranceIndex;
/* 0x11E1C */ char unk_11E1C[0x40];
/* 0x11E5C */ s8 shootingGalleryStatus;
+37
View File
@@ -472,4 +472,41 @@ typedef struct {
/* 0x24 */ char unk_24[0x4];
} NpcInteractInfo; // size = 0x28
// Converts a number of bits to a bitmask, helper for params macros
// e.g. 3 becomes 0b111 (7)
#define NBITS_TO_MASK(n) \
((1 << (n)) - 1)
// Extracts the `n`-bit value at position `s` in `p`, shifts then masks
// Unsigned variant, no possibility of sign extension
#define PARAMS_GET_U(p, s, n) \
(((p) >> (s)) & NBITS_TO_MASK(n))
// Extracts the `n`-bit value at position `s` in `p`, masks then shifts
// Signed variant, possibility of sign extension
#define PARAMS_GET_S(p, s, n) \
(((p) & (NBITS_TO_MASK(n) << (s))) >> (s))
// Extracts all bits past position `s` in `p`
#define PARAMS_GET_NOMASK(p, s) \
((p) >> (s))
// Extracts the `n`-bit value at position `s` in `p` without shifting it from its current position
#define PARAMS_GET_NOSHIFT(p, s, n) \
((p) & (NBITS_TO_MASK(n) << (s)))
// Moves the `n`-bit value `p` to bit position `s` for building actor parameters by OR-ing these together
#define PARAMS_PACK(p, s, n) \
(((p) & NBITS_TO_MASK(n)) << (s))
// Moves the value `p` to bit position `s` for building actor parameters by OR-ing these together.
#define PARAMS_PACK_NOMASK(p, s) \
((p) << (s))
// Generates a bitmask for bit position `s` of length `n`
#define PARAMS_MAKE_MASK(s, n) PARAMS_GET_NOSHIFT(~0, s, n)
#define TRANSITION_ACTOR_PARAMS_INDEX_SHIFT 10
#define GET_TRANSITION_ACTOR_INDEX(actor) PARAMS_GET_NOMASK((u16)(actor)->params, 10)
#endif
+2 -2
View File
@@ -292,7 +292,7 @@ typedef struct {
/* 0x1354 */ s32 fileNum; // "file_no"
/* 0x1358 */ char unk_1358[0x0004];
/* 0x135C */ s32 gameMode;
/* 0x1360 */ s32 sceneSetupIndex; // "counter" // Upstream TODO: sceneLayer
/* 0x1360 */ s32 sceneLayer; // "counter"
/* 0x1364 */ s32 respawnFlag; // "restart_flag"
/* 0x1368 */ RespawnData respawn[RESPAWN_MODE_MAX]; // "restart_data"
/* 0x13BC */ f32 entranceSpeed;
@@ -423,7 +423,7 @@ typedef enum {
/* 4 */ SCENE_LAYER_CUTSCENE_FIRST
} SceneLayer;
#define IS_CUTSCENE_LAYER (gSaveContext.sceneSetupIndex >= SCENE_LAYER_CUTSCENE_FIRST)
#define IS_CUTSCENE_LAYER (gSaveContext.sceneLayer >= SCENE_LAYER_CUTSCENE_FIRST)
typedef enum {
/* 0 */ LINK_AGE_ADULT,
+1 -1
View File
@@ -57,7 +57,7 @@ void Warp(WarpPoint& warpPoint) {
gSaveContext.magicCapacity = 0;
gSaveContext.magicLevel = gSaveContext.magic;
gSaveContext.fileNum = 0xFF;
gSaveContext.sceneSetupIndex = 0;
gSaveContext.sceneLayer = 0;
gSaveContext.cutsceneIndex = 0;
gSaveContext.linkAge = 0;
gSaveContext.nightFlag = 0;
@@ -2184,7 +2184,7 @@ void RandomizerOnSceneInitHandler(int16_t sceneNum) {
// Reset room ctx back to prev room and then load the new room
gPlayState->roomCtx.status = 0;
gPlayState->roomCtx.curRoom = gPlayState->roomCtx.prevRoom;
func_8009728C(gPlayState, &gPlayState->roomCtx, replacedRoom);
Room_RequestNewRoom(gPlayState, &gPlayState->roomCtx, replacedRoom);
}
}
@@ -590,7 +590,7 @@ void Entrance_OverrideWeatherState() {
gPlayState->envCtx.gloomySkyMode = 0;
// Weather only applyies to adult link
if (LINK_IS_CHILD || gSaveContext.sceneSetupIndex >= 4) {
if (LINK_IS_CHILD || gSaveContext.sceneLayer >= 4) {
return;
}
+1 -1
View File
@@ -2564,7 +2564,7 @@ typedef struct {
/* 0x1354 */ s32 fileNum; // "file_no"
/* 0x1358 */ char unk_1358[0x0004];
/* 0x135C */ s32 gameMode;
/* 0x1360 */ s32 sceneSetupIndex;
/* 0x1360 */ s32 sceneLayer;
/* 0x1364 */ s32 respawnFlag; // "restart_flag"
/* 0x1368 */ RespawnData_v0 respawn[3]; // "restart_data"
/* 0x13BC */ f32 entranceSpeed;
+9 -9
View File
@@ -338,11 +338,11 @@ bool Scene_CommandAlternateHeaderList(PlayState* play, SOH::ISceneCommand* cmd)
// osSyncPrintf("\n[ZU]sceneset age =[%X]", gSaveContext.linkAge);
// osSyncPrintf("\n[ZU]sceneset time =[%X]", gSaveContext.cutsceneIndex);
// osSyncPrintf("\n[ZU]sceneset counter=[%X]", gSaveContext.sceneSetupIndex);
// osSyncPrintf("\n[ZU]sceneset counter=[%X]", gSaveContext.sceneLayer);
if (gSaveContext.sceneSetupIndex != 0) {
if (gSaveContext.sceneLayer != 0) {
SOH::Scene* desiredHeader =
std::static_pointer_cast<SOH::Scene>(cmdHeaders->headers[gSaveContext.sceneSetupIndex - 1]).get();
std::static_pointer_cast<SOH::Scene>(cmdHeaders->headers[gSaveContext.sceneLayer - 1]).get();
if (desiredHeader != nullptr) {
OTRScene_ExecuteCommands(play, desiredHeader);
@@ -351,9 +351,9 @@ bool Scene_CommandAlternateHeaderList(PlayState* play, SOH::ISceneCommand* cmd)
// "Coughh! There is no specified dataaaaa!"
osSyncPrintf("\nげぼはっ! 指定されたデータがないでええっす!");
if (gSaveContext.sceneSetupIndex == 3) {
if (gSaveContext.sceneLayer == 3) {
SOH::Scene* desiredHeader =
std::static_pointer_cast<SOH::Scene>(cmdHeaders->headers[gSaveContext.sceneSetupIndex - 2]).get();
std::static_pointer_cast<SOH::Scene>(cmdHeaders->headers[gSaveContext.sceneLayer - 2]).get();
// "Using adult day data there!"
osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!");
@@ -487,7 +487,7 @@ extern "C" s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx) {
return 1;
}
extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
extern "C" s32 OTRRoom_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
u32 size;
if (roomCtx->status == 0) {
@@ -502,8 +502,8 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN
return 0; // UH OH
size = static_cast<u32>(play->roomList[roomNum].vromEnd - play->roomList[roomNum].vromStart);
roomCtx->unk_34 =
(void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
roomCtx->unk_34 = (void*)ALIGN16((uintptr_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,
@@ -514,7 +514,7 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN
roomCtx->status = 1;
roomCtx->roomToLoad = roomData.get();
roomCtx->unk_30 ^= 1;
roomCtx->activeBufPage ^= 1;
SPDLOG_INFO("Room Init - curRoom.num: {0:#x}", roomCtx->curRoom.num);
+4 -4
View File
@@ -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;
+1 -1
View File
@@ -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 ||
+3 -4
View File
@@ -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);
+3 -3
View File
@@ -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) {
+15 -15
View File
@@ -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)) {
+9 -9
View File
@@ -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
+6 -7
View File
@@ -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そこで、大人の昼データを使用するでええっす!!");
+5 -5
View File
@@ -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;
}
+1 -1
View File
@@ -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;
}
@@ -265,7 +265,7 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) {
}
if (givingReward) {
if (gSaveContext.sceneSetupIndex < 4) {
if (gSaveContext.sceneLayer < 4) {
if (play->sceneNum != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) {
switch (this->fountainType) {
case FAIRY_SPELL_FARORES_WIND:
@@ -233,7 +233,7 @@ void BgHidanCurtain_Update(Actor* thisx, PlayState* play2) {
this->collider.dim.height = hcParams->height * riseProgress;
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
if (gSaveContext.sceneSetupIndex <= 3) {
if (gSaveContext.sceneLayer <= 3) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FIRE_PILLAR_S - SFX_FLAG);
}
} else if ((this->type == 1) && Flags_GetTreasure(play, this->treasureFlag)) {
@@ -238,7 +238,7 @@ void BgHidanFwbig_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if ((this->actor.home.pos.y - 200.0f) < this->actor.world.pos.y) {
if (gSaveContext.sceneSetupIndex < 4) {
if (gSaveContext.sceneLayer < 4) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_BURNING - SFX_FLAG);
} else if ((s16)this->actor.world.pos.x == -513) {
Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_FLAME_OF_FIRE - SFX_FLAG);
@@ -66,20 +66,19 @@ void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play) {
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (this->dyna.actor.params == DT_DRAWBRIDGE) {
if (LINK_IS_ADULT && (gSaveContext.sceneSetupIndex < 4)) {
if (LINK_IS_ADULT && (gSaveContext.sceneLayer < 4)) {
Actor_Kill(&this->dyna.actor);
return;
}
if ((gSaveContext.sceneSetupIndex != 6) &&
((gSaveContext.sceneSetupIndex == 4) || (gSaveContext.sceneSetupIndex == 5) ||
(!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.sceneSetupIndex != 6) {
if (gSaveContext.sceneLayer != 6) {
// Don't close the bridge in rando to accomodate hyrule castle exit
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) &&
CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !Flags_GetEventChkInf(EVENTCHKINF_ZELDA_FLED_HYRULE_CASTLE) &&
@@ -142,11 +141,11 @@ void BgSpot00Hanebasi_Destroy(Actor* thisx, PlayState* play) {
void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) {
BgSpot00Hanebasi* child = (BgSpot00Hanebasi*)this->dyna.actor.child;
if ((gSaveContext.sceneSetupIndex >= 4) || !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) ||
if ((gSaveContext.sceneLayer >= 4) || !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) ||
!CHECK_QUEST_ITEM(QUEST_GORON_RUBY) || !CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) ||
(Flags_GetEventChkInf(EVENTCHKINF_ZELDA_FLED_HYRULE_CASTLE))) {
if (this->dyna.actor.shape.rot.x != 0) {
if (Flags_GetEnv(play, 0) || ((gSaveContext.sceneSetupIndex < 4) && IS_DAY)) {
if (Flags_GetEnv(play, 0) || ((gSaveContext.sceneLayer < 4) && IS_DAY)) {
this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall;
this->destAngle = 0;
child->destAngle = 0;
@@ -155,7 +154,7 @@ void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) {
if (this) {} // required to match
}
if ((this->dyna.actor.shape.rot.x == 0) && (gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT && !IS_DAY) {
if ((this->dyna.actor.shape.rot.x == 0) && (gSaveContext.sceneLayer < 4) && !LINK_IS_ADULT && !IS_DAY) {
this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall;
this->destAngle = -0x4000;
child->destAngle = -0xFE0;
@@ -236,7 +235,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) {
}
}
if (gSaveContext.sceneSetupIndex == 5) {
if (gSaveContext.sceneLayer == 5) {
u16 dayTime;
s32 tmp;
@@ -252,7 +251,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play) {
dayTime = gSaveContext.dayTime;
if ((dayTime >= 0x2AAC) && (dayTime < 0x3000) && (gSaveContext.sceneSetupIndex == 5)) {
if ((dayTime >= 0x2AAC) && (dayTime < 0x3000) && (gSaveContext.sceneLayer == 5)) {
gTimeIncrement = 0;
}
}
@@ -268,7 +267,7 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, PlayState* play2) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
if (gSaveContext.sceneSetupIndex >= 4) {
if (gSaveContext.sceneLayer >= 4) {
sTorchFlameScale = 0.008f;
} else {
sTorchFlameScale = ((thisx->shape.rot.x * -1) - 0x2000) * (1.0f / 1024000.0f);
@@ -322,8 +321,8 @@ 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.sceneSetupIndex != 12) {
if ((gSaveContext.sceneSetupIndex >= 4) || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) {
if (gSaveContext.sceneLayer != 12) {
if ((gSaveContext.sceneLayer >= 4) || (!LINK_IS_ADULT && (thisx->shape.rot.x < -0x2000))) {
BgSpot00Hanebasi_DrawTorches(thisx, play);
} else {
sTorchFlameScale = 0.0f;
@@ -47,7 +47,7 @@ void BgSpot01Fusya_Init(Actor* thisx, PlayState* play) {
this->unk_154 = 100.0f;
this->unk_158 = 100.0f;
this->unk_15C = 0.5f;
if (gSaveContext.sceneSetupIndex < 4) {
if (gSaveContext.sceneLayer < 4) {
gSaveContext.eventChkInf[6] &= 0xFFDF;
}
BgSpot01Fusya_SetupAction(this, func_808AAA50);
@@ -301,16 +301,16 @@ void BgSpot01Idohashira_Init(Actor* thisx, PlayState* play) {
CollisionHeader_GetVirtual(&gKakarikoWellArchCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (gSaveContext.sceneSetupIndex < 4) {
if (gSaveContext.sceneLayer < 4) {
if ((Flags_GetEventChkInf(EVENTCHKINF_LEARNED_NOCTURNE_OF_SHADOW)) && LINK_IS_ADULT) {
Actor_Kill(&this->dyna.actor);
} else {
this->action = 0;
}
} else if (gSaveContext.sceneSetupIndex == 4) {
} else if (gSaveContext.sceneLayer == 4) {
this->action = 1;
this->dyna.actor.shape.yOffset = -(kREG(10) + 1100.0f);
} else if (gSaveContext.sceneSetupIndex == 6) {
} else if (gSaveContext.sceneLayer == 6) {
this->action = 0;
} else {
Actor_Kill(&this->dyna.actor);
@@ -155,7 +155,7 @@ void BgSpot06Objects_Init(Actor* thisx, PlayState* play) {
thisx->flags = ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED;
if (LINK_IS_ADULT && !Flags_GetEventChkInf(EVENTCHKINF_RAISED_LAKE_HYLIA_WATER)) {
if (gSaveContext.sceneSetupIndex < 4) {
if (gSaveContext.sceneLayer < 4) {
this->lakeHyliaWaterLevel = -681.0f;
play->colCtx.colHeader->waterBoxes[LHWB_GERUDO_VALLEY_RIVER_LOWER].ySurface =
WATER_LEVEL_RIVER_LOWERED;
@@ -456,7 +456,7 @@ void BgSpot06Objects_DrawLakeHyliaWater(BgSpot06Objects* this, PlayState* play)
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128);
if ((this->lakeHyliaWaterLevel < -680.0f) && (gSaveContext.sceneSetupIndex < 4)) {
if ((this->lakeHyliaWaterLevel < -680.0f) && (gSaveContext.sceneLayer < 4)) {
gSPDisplayList(POLY_XLU_DISP++, gLakeHyliaLowWaterDL);
} else {
gSPDisplayList(POLY_XLU_DISP++, gLakeHyliaHighWaterDL);
@@ -60,7 +60,7 @@ static Gfx* sDLists[] = {
s32 func_808B1AE0(BgSpot09Obj* this, PlayState* play) {
s32 carpentersRescued;
if (gSaveContext.sceneSetupIndex >= 4) {
if (gSaveContext.sceneLayer >= 4) {
return this->dyna.actor.params == 0;
}
@@ -97,7 +97,7 @@ void BgTokiSwd_Init(Actor* thisx, PlayState* play) {
}
}
if (gSaveContext.sceneSetupIndex == 5) {
if (gSaveContext.sceneLayer == 5) {
play->roomCtx.unk_74[0] = 0xFF;
}
@@ -114,7 +114,7 @@ void BgTokiSwd_Destroy(Actor* thisx, PlayState* play) {
}
void func_808BAF40(BgTokiSwd* this, PlayState* play) {
if (((Flags_GetEventChkInf(EVENTCHKINF_ENTERED_MASTER_SWORD_CHAMBER)) == 0) && (gSaveContext.sceneSetupIndex < 4) &&
if (((Flags_GetEventChkInf(EVENTCHKINF_ENTERED_MASTER_SWORD_CHAMBER)) == 0) && (gSaveContext.sceneLayer < 4) &&
Actor_IsFacingAndNearPlayer(&this->actor, 800.0f, 0x7530) && !Play_InCsMode(play)) {
Flags_SetEventChkInf(EVENTCHKINF_ENTERED_MASTER_SWORD_CHAMBER);
if (GameInteractor_Should(VB_PLAY_ENTRANCE_CS, true, EVENTCHKINF_ENTERED_MASTER_SWORD_CHAMBER,
@@ -152,7 +152,7 @@ void func_808BAF40(BgTokiSwd* this, PlayState* play) {
}
}
}
if (gSaveContext.sceneSetupIndex == 5) {
if (gSaveContext.sceneLayer == 5) {
if (play->roomCtx.unk_74[0] > 0) {
play->roomCtx.unk_74[0]--;
} else {
@@ -72,9 +72,9 @@ void BgTreemouth_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f);
Actor_SetFocus(thisx, 50.0f);
if ((gSaveContext.sceneSetupIndex < 4) && !LINK_IS_ADULT) {
if ((gSaveContext.sceneLayer < 4) && !LINK_IS_ADULT) {
BgTreemouth_SetupAction(this, func_808BC8B8);
} else if (LINK_IS_ADULT || (gSaveContext.sceneSetupIndex == 7)) {
} else if (LINK_IS_ADULT || (gSaveContext.sceneLayer == 7)) {
this->unk_168 = 0.0f;
BgTreemouth_SetupAction(this, BgTreemouth_DoNothing);
} else {
@@ -117,7 +117,7 @@ void func_808BC6F8(BgTreemouth* this, PlayState* play) {
this->unk_168 = 1.0f;
}
if ((gSaveContext.sceneSetupIndex == 6) && (play->csCtx.frames >= 0x2BD) && (play->state.frames % 8 == 0)) {
if ((gSaveContext.sceneLayer == 6) && (play->csCtx.frames >= 0x2BD) && (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;
@@ -236,14 +236,14 @@ void BgTreemouth_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
if ((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) {
if ((gSaveContext.sceneLayer < 4) || LINK_IS_ADULT) {
if (Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_KOKIRI_EMERALD_DEKU_TREE_DEAD)) {
alpha = 2150;
}
} else { // neeeded to match
}
if (gSaveContext.sceneSetupIndex == 6) {
if (gSaveContext.sceneLayer == 6) {
alpha = (play->roomCtx.unk_74[0] + 0x1F4);
}
@@ -197,7 +197,7 @@ void func_80969FB4(DemoDu* this, PlayState* play) {
void DemoDu_CsFireMedallion_AdvanceTo01(DemoDu* this, PlayState* play) {
s32 pad[2];
if ((gSaveContext.chamberCutsceneNum == 1) && (gSaveContext.sceneSetupIndex < 4)) {
if ((gSaveContext.chamberCutsceneNum == 1) && (gSaveContext.sceneLayer < 4)) {
Player* player = GET_PLAYER(play);
this->updateIndex = CS_FIREMEDALLION_SUBSCENE(1);
@@ -706,7 +706,7 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) {
} else {
Actor_SetScale(&this->actor, 84 * 0.001f);
}
} else if (gSaveContext.sceneSetupIndex == 5 || gSaveContext.sceneSetupIndex == 4 ||
} else if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 4 ||
(gSaveContext.entranceIndex == ENTR_TEMPLE_OF_TIME_4 &&
!((Flags_GetEventChkInf(EVENTCHKINF_TIME_TRAVELED_TO_ADULT))))) {
SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 59.0f, 0.0f);
@@ -863,7 +863,7 @@ void DemoEffect_UpdateTriforceSpot(DemoEffect* this, PlayState* play) {
}
}
if (gSaveContext.entranceIndex == ENTR_CUTSCENE_MAP_0 && gSaveContext.sceneSetupIndex == 6 &&
if (gSaveContext.entranceIndex == ENTR_CUTSCENE_MAP_0 && gSaveContext.sceneLayer == 6 &&
play->csCtx.frames == 143) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_RING_EXPLOSION);
}
@@ -1079,11 +1079,11 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) {
break;
}
if (play->sceneNum == SCENE_KOKIRI_FOREST && gSaveContext.sceneSetupIndex == 6 && play->csCtx.frames == 197) {
if (play->sceneNum == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == 6 && play->csCtx.frames == 197) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_WHITE_OUT);
}
if (play->sceneNum == SCENE_DEATH_MOUNTAIN_TRAIL && gSaveContext.sceneSetupIndex == 5) {
if (play->sceneNum == SCENE_DEATH_MOUNTAIN_TRAIL && gSaveContext.sceneLayer == 5) {
if (!DemoEffect_CheckCsAction(this, play, 1)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG);
}
@@ -1092,7 +1092,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) {
}
}
if (play->sceneNum == SCENE_ZORAS_FOUNTAIN && gSaveContext.sceneSetupIndex == 4) {
if (play->sceneNum == SCENE_ZORAS_FOUNTAIN && gSaveContext.sceneLayer == 4) {
if (!DemoEffect_CheckCsAction(this, play, 1)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG);
}
@@ -1101,7 +1101,7 @@ void DemoEffect_UpdateLightEffect(DemoEffect* this, PlayState* play) {
}
}
if (play->sceneNum == SCENE_TEMPLE_OF_TIME && gSaveContext.sceneSetupIndex == 14) {
if (play->sceneNum == SCENE_TEMPLE_OF_TIME && gSaveContext.sceneLayer == 14) {
if (play->csCtx.npcActions[this->csActionId]->action == 2) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_LIGHT_GATHER - SFX_FLAG);
@@ -1158,7 +1158,7 @@ void DemoEffect_UpdateGodLgtDin(DemoEffect* this, PlayState* play) {
}
if (gSaveContext.entranceIndex == ENTR_CUTSCENE_MAP_0) {
switch (gSaveContext.sceneSetupIndex) {
switch (gSaveContext.sceneLayer) {
case 4:
if (play->csCtx.frames == 288) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS);
@@ -1213,7 +1213,7 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) {
}
if (gSaveContext.entranceIndex == ENTR_CUTSCENE_MAP_0) {
switch (gSaveContext.sceneSetupIndex) {
switch (gSaveContext.sceneLayer) {
case 4:
if (play->csCtx.frames == 298) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS);
@@ -1234,7 +1234,7 @@ void DemoEffect_UpdateGodLgtNayru(DemoEffect* this, PlayState* play) {
}
}
if (gSaveContext.entranceIndex == ENTR_DEATH_MOUNTAIN_TRAIL_BOTTOM_EXIT && gSaveContext.sceneSetupIndex == 4) {
if (gSaveContext.entranceIndex == ENTR_DEATH_MOUNTAIN_TRAIL_BOTTOM_EXIT && gSaveContext.sceneLayer == 4) {
if (play->csCtx.frames == 72) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_DASH);
}
@@ -1273,7 +1273,7 @@ void DemoEffect_UpdateGodLgtFarore(DemoEffect* this, PlayState* play) {
}
if (gSaveContext.entranceIndex == ENTR_CUTSCENE_MAP_0) {
switch (gSaveContext.sceneSetupIndex) {
switch (gSaveContext.sceneLayer) {
case 4:
if (play->csCtx.frames == 315) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_DM_FLYING_GOD_PASS);
@@ -1859,7 +1859,7 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) {
if (!DemoEffect_CheckCsAction(this, play, 2)) {
if (gSaveContext.entranceIndex == ENTR_CUTSCENE_MAP_0) {
if (gSaveContext.sceneSetupIndex == 4) {
if (gSaveContext.sceneLayer == 4) {
if (play->csCtx.frames <= 680) {
Sfx_PlaySfxAtPos(&this->actor.projectedPos, NA_SE_EV_GOD_FLYING - SFX_FLAG);
}
@@ -2179,8 +2179,7 @@ void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) {
u8 effectType = (this->actor.params & 0x00FF);
if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL ||
Flags_GetEnv(play, 1) || gSaveContext.sceneSetupIndex >= 4 ||
gSaveContext.entranceIndex == ENTR_TEMPLE_OF_TIME_4) {
Flags_GetEnv(play, 1) || gSaveContext.sceneLayer >= 4 || gSaveContext.entranceIndex == ENTR_TEMPLE_OF_TIME_4) {
OPEN_DISPS(gfxCtx);
POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, 25);
Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY);
@@ -206,7 +206,7 @@ void DemoGj_Explode(DemoGj* this, PlayState* play, Vec3f* initialPos, Vec3f* dir
}
s32 DemoGj_IsSceneInvalid(void) {
if (gSaveContext.sceneSetupIndex < 4) {
if (gSaveContext.sceneLayer < 4) {
return false;
}
return true;
@@ -436,7 +436,7 @@ void func_8097ED64(DemoGt* this, PlayState* play, s32 actionIdx) {
u8 DemoGt_IsCutsceneLayer() {
if (kREG(2) != 0) {
return true;
} else if (gSaveContext.sceneSetupIndex < 4) {
} else if (gSaveContext.sceneLayer < 4) {
return false;
} else {
return true;
@@ -331,7 +331,7 @@ void func_80985430(DemoIm* this, PlayState* play) {
void func_8098544C(DemoIm* this, PlayState* play) {
s32 pad[2];
if ((gSaveContext.chamberCutsceneNum == 4) && (gSaveContext.sceneSetupIndex < 4)) {
if ((gSaveContext.chamberCutsceneNum == 4) && (gSaveContext.sceneLayer < 4)) {
Player* player = GET_PLAYER(play);
this->action = 1;
@@ -940,7 +940,7 @@ void func_80986CFC(DemoIm* this, PlayState* play) {
}
void func_80986D40(DemoIm* this, PlayState* play) {
if (gSaveContext.sceneSetupIndex == 6) {
if (gSaveContext.sceneLayer == 6) {
this->action = 19;
this->drawConfig = 1;
} else if ((Flags_GetEventChkInf(EVENTCHKINF_ZELDA_FLED_HYRULE_CASTLE)) &&
@@ -716,7 +716,7 @@ void DemoKankyo_DrawLightPlane(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
if (play->csCtx.state == CS_STATE_IDLE || gSaveContext.sceneSetupIndex >= 4) {
if (play->csCtx.state == CS_STATE_IDLE || gSaveContext.sceneLayer >= 4) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gSPSegment(POLY_XLU_DISP++, 0x08,
@@ -252,7 +252,7 @@ void func_8098E960(DemoSa* this, PlayState* play) {
s32 pad[2];
Player* player;
if ((gSaveContext.chamberCutsceneNum == 0) && (gSaveContext.sceneSetupIndex < 4)) {
if ((gSaveContext.chamberCutsceneNum == 0) && (gSaveContext.sceneLayer < 4)) {
player = GET_PLAYER(play);
this->action = 1;
play->csCtx.segment = D_8099010C;
@@ -566,9 +566,9 @@ void DoorShutter_SetupClosed(DoorShutter* this, PlayState* play) {
play->roomCtx.curRoom = play->roomCtx.prevRoom;
play->roomCtx.prevRoom = tempRoom;
play->roomCtx.unk_30 ^= 1;
play->roomCtx.activeBufPage ^= 1;
}
func_80097534(play, &play->roomCtx);
Room_FinishRoomChange(play, &play->roomCtx);
Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, 0x0EFF);
}
this->unk_164 = 0;
@@ -182,7 +182,7 @@ void DoorWarp1_SetupWarp(DoorWarp1* this, PlayState* play) {
gSaveContext.entranceIndex == ENTR_LAKE_HYLIA_WATER_TEMPLE_BLUE_WARP || // lake hylia
gSaveContext.entranceIndex == ENTR_DESERT_COLOSSUS_SPIRIT_TEMPLE_BLUE_WARP || // desert colossus
gSaveContext.entranceIndex == ENTR_GRAVEYARD_SHADOW_TEMPLE_BLUE_WARP) && // graveyard
gSaveContext.sceneSetupIndex < 4) ||
gSaveContext.sceneLayer < 4) ||
(GET_PLAYER(play)->actor.params & 0xF00) != 0x200) {
Actor_Kill(&this->actor);
}
@@ -869,7 +869,7 @@ void func_80A03CF8(EnElf* this, PlayState* play) {
func_80A02C98(this, &nextPos, 0.2f);
}
if ((play->sceneNum == SCENE_LINKS_HOUSE) && (gSaveContext.sceneSetupIndex == 4)) {
if ((play->sceneNum == SCENE_LINKS_HOUSE) && (gSaveContext.sceneLayer == 4)) {
// play dash sound as Navi enters Links house in the intro
if (play->csCtx.frames == 55) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_FAIRY_DASH);
+287 -201
View File
@@ -2,42 +2,100 @@
#define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED
// Horizontal Plane parameters
/*
* Horizontal holls parameters (`ENHOLL_H_*`)
* All horizontal holls are cuboids which react to how far (depth) and in which direction (side) the player is from the
* actor, in the actor's local z direction.
*/
#define PLANE_Y_MIN -50.0f
#define PLANE_Y_MAX 200.0f
// Defines the height of horizontal holls (all kinds) with a Y range relative to the actor position.
#define ENHOLL_H_Y_MIN -50.0f
#define ENHOLL_H_Y_MAX 200.0f
#define PLANE_HALFWIDTH 100.0f
#define PLANE_HALFWIDTH_2 200.0f
// Defines the width of horizontal holls (all kinds),
// with a half-width extending on both lateral sides (towards local +x and -x).
#define ENHOLL_H_HALFWIDTH_NARROW 100.0f
#define ENHOLL_H_HALFWIDTH 200.0f
// Defines the depth range from horizontal invisible holls (`ENHOLL_H_INVISIBLE`, `ENHOLL_H_INVISIBLE_NARROW`),
// at which rooms get loaded.
// i.e. when the player's distance from the actor (along local z) is within this range, the corresponding room is loaded
// Note: This means there is a depth range in the middle of `2 * ENHOLL_H_INVISIBLE_LOAD_DEPTH_MIN` where nothing
// happens. That range where nothing happens is useful to avoid quickly repeated room swaps.
// Note: This means the player is expected to be inside the depth range at some point.
// i.e. this range needs to be deep enough so that the player cannot move past it in a single frame.
#define ENHOLL_H_INVISIBLE_LOAD_DEPTH_MAX 100.0f
#define ENHOLL_H_INVISIBLE_LOAD_DEPTH_MIN 50.0f
// Defines the depth from horizontal switch flag holls (`ENHOLL_H_BGCOVER_SWITCHFLAG`),
// - at which the background geometry starts fading black;
#define ENHOLL_H_SWITCHFLAG_BGCOVER_DEPTH 100.0f
// - at which the background geometry is fully faded black,
// and rooms are loaded if needed according to the side the player is on (along local z).
#define ENHOLL_H_SWITCHFLAG_LOAD_DEPTH 50.0f
/*
* Vertical holls parameters (`ENHOLL_V_*`)
* All vertical holls are cylinders which react to how far (y dist) and in which direction (side) the player is from the
* actor, along the vertical y axis.
*/
// Vertical down holls parameters (`ENHOLL_V_DOWN_BGCOVER_LARGE`)
#define ENHOLL_V_DOWN_RADIUS 500.0f
// Y dist at which the background geometry starts fading black.
#define ENHOLL_V_DOWN_BGCOVER_YDIST 605.0f
// Y dist at which the background geometry is fully faded black, and the room down is loaded.
#define ENHOLL_V_DOWN_LOAD_YDIST 95.0f
// Radius for other vertical holls (`ENHOLL_V_BGCOVER`, `ENHOLL_V_INVISIBLE`)
#define ENHOLL_V_RADIUS 120.0f
// Vertical bg cover holls parameters (`ENHOLL_V_BGCOVER`)
// Y dist at which the background geometry starts fading black.
#define ENHOLL_V_BGCOVER_BGCOVER_YDIST 200.0f
// Y dist at which the background geometry is fully faded black,
// and rooms are loaded if needed according to the side the player is on (along y).
#define ENHOLL_V_BGCOVER_LOAD_YDIST 50.0f
// Vertical invisible holls parameters (`ENHOLL_V_INVISIBLE`)
// Similar to the range defined by `ENHOLL_H_INVISIBLE_LOAD_DEPTH_MAX` and min above for horizontal planes,
// but vertically (along y).
#define ENHOLL_V_INVISIBLE_LOAD_YDIST_MAX 200.0f
#define ENHOLL_V_INVISIBLE_LOAD_YDIST_MIN 50.0f
void EnHoll_Init(Actor* thisx, PlayState* play);
void EnHoll_Destroy(Actor* thisx, PlayState* play);
void EnHoll_Update(Actor* thisx, PlayState* play);
void EnHoll_Draw(Actor* thisx, PlayState* play);
void EnHoll_NextAction(EnHoll* this, PlayState* play);
void func_80A58DD4(EnHoll* this, PlayState* play);
void func_80A59014(EnHoll* this, PlayState* play);
void func_80A591C0(EnHoll* this, PlayState* play);
void func_80A593A4(EnHoll* this, PlayState* play);
void func_80A59520(EnHoll* this, PlayState* play);
void func_80A59618(EnHoll* this, PlayState* play);
void EnHoll_WaitRoomLoaded(EnHoll* this, PlayState* play);
void EnHoll_HorizontalVisibleNarrow(EnHoll* this, PlayState* play);
void EnHoll_HorizontalInvisible(EnHoll* this, PlayState* play);
void EnHoll_VerticalDownBgCoverLarge(EnHoll* this, PlayState* play);
void EnHoll_VerticalBgCover(EnHoll* this, PlayState* play);
void EnHoll_VerticalInvisible(EnHoll* this, PlayState* play);
void EnHoll_HorizontalBgCoverSwitchFlag(EnHoll* this, PlayState* play);
const ActorInit En_Holl_InitVars = {
ACTOR_EN_HOLL,
ACTORCAT_DOOR,
FLAGS,
OBJECT_GAMEPLAY_KEEP,
sizeof(EnHoll),
(ActorFunc)EnHoll_Init,
(ActorFunc)EnHoll_Destroy,
(ActorFunc)EnHoll_Update,
(ActorFunc)EnHoll_Draw,
NULL,
/**/ ACTOR_EN_HOLL,
/**/ ACTORCAT_DOOR,
/**/ FLAGS,
/**/ OBJECT_GAMEPLAY_KEEP,
/**/ sizeof(EnHoll),
/**/ (ActorFunc)EnHoll_Init,
/**/ (ActorFunc)EnHoll_Destroy,
/**/ (ActorFunc)EnHoll_Update,
/**/ (ActorFunc)EnHoll_Draw,
};
static EnHollActionFunc sActionFuncs[] = {
func_80A58DD4, func_80A591C0, func_80A59520, func_80A59618, func_80A59014, func_80A593A4, func_80A59014,
EnHoll_HorizontalVisibleNarrow, // ENHOLL_H_VISIBLE_NARROW
EnHoll_VerticalDownBgCoverLarge, // ENHOLL_V_DOWN_BGCOVER_LARGE
EnHoll_VerticalInvisible, // ENHOLL_V_INVISIBLE
EnHoll_HorizontalBgCoverSwitchFlag, // ENHOLL_H_BGCOVER_SWITCHFLAG
EnHoll_HorizontalInvisible, // ENHOLL_H_INVISIBLE
EnHoll_VerticalBgCover, // ENHOLL_V_BGCOVER
EnHoll_HorizontalInvisible, // ENHOLL_H_INVISIBLE_NARROW
};
static InitChainEntry sInitChain[] = {
@@ -46,46 +104,19 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP),
};
/**
* These are all absolute distances in the relative z direction. That is, moving
* towards or away from the "face" of the loading plane regardless of orientation.
* Moving within these distances of the load plane have the following effects:
* [0] : Load the room on this side of the loading plane if not already loaded
* [1] : Load the room on the other side of the loading plane
* [2] : Fade Region (opaque -> transparent if approaching, transparent -> opaque if receding)
* [3] : Transparent Region
*
* When traversing a loading plane of this kind, it attempts to:
* Load Current Room (fails as it is already loaded)
* Load Next Room
* Load Previous Room
* Load Next Room
*
* @bug The striped nature of loading planes can cause some actors to unload due to
* conflicting Object Lists between the two rooms
*
* @bug If you can get around to the other side of the loading plane without triggering it,
* you can load the room on the other side multiple times
*/
static f32 sHorizTriggerDists[2][4] = {
{ 200.0f, 150.0f, 100.0f, 50.0f },
{ 100.0f, 75.0f, 50.0f, 25.0f },
};
void EnHoll_SetupAction(EnHoll* this, EnHollActionFunc func) {
this->actionFunc = func;
}
s32 EnHoll_IsKokiriSetup8() {
return gSaveContext.entranceIndex == ENTR_KOKIRI_FOREST_0 && gSaveContext.sceneSetupIndex == 8;
int EnHoll_IsKokiriLayer8(void) {
return gSaveContext.entranceIndex == ENTR_KOKIRI_FOREST_0 && gSaveContext.sceneLayer == 8;
}
void EnHoll_ChooseAction(EnHoll* this) {
s32 action;
s32 type = ENHOLL_GET_TYPE(&this->actor);
action = (this->actor.params >> 6) & 7;
EnHoll_SetupAction(this, sActionFuncs[action]);
if (action != 0) {
EnHoll_SetupAction(this, sActionFuncs[type]);
if (type != ENHOLL_H_VISIBLE_NARROW) {
this->actor.draw = NULL;
} else {
this->planeAlpha = 255;
@@ -97,12 +128,12 @@ void EnHoll_Init(Actor* thisx, PlayState* play) {
Actor_ProcessInitChain(&this->actor, sInitChain);
EnHoll_ChooseAction(this);
this->resetBgCoverAlpha = 0;
this->resetBgCoverAlpha = false;
}
void EnHoll_Destroy(Actor* thisx, PlayState* play) {
s32 transitionActorIdx = (u16)thisx->params >> 0xA;
TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[transitionActorIdx];
s32 transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(thisx);
TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[transitionActorIndex];
transitionEntry->id = -transitionEntry->id;
}
@@ -114,37 +145,72 @@ void EnHoll_SwapRooms(PlayState* play) {
tempRoom = roomCtx->curRoom;
roomCtx->curRoom = roomCtx->prevRoom;
roomCtx->prevRoom = tempRoom;
play->roomCtx.unk_30 ^= 1;
play->roomCtx.activeBufPage ^= 1;
}
// Horizontal Planes
void func_80A58DD4(EnHoll* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s32 phi_t0 = ((play->sceneNum == SCENE_SPIRIT_TEMPLE) ? 1 : 0) & 0xFFFFFFFF;
Vec3f vec;
f32 absZ;
s32 transitionActorIdx;
/**
* These are all absolute distances in the relative z direction. That is, moving
* towards or away from the "face" of the holl regardless of orientation.
* Moving within these distances of the holl have the following effects:
* [0] : Load the room on this side of the holl if not already loaded
* [1] : Load the room on the other side of the holl
* [2] : Start of fade region, where the plane is fully opaque
* [3] : End of fade region region, where the plane is fully transparent
*
* Within the fade region, the plane goes:
* opaque -> transparent if approaching,
* transparent -> opaque if receding
*/
static f32 sHorizontalVisibleNarrowTriggerDists[2][4] = {
{ 200.0f, 150.0f, 100.0f, 50.0f }, // default
{ 100.0f, 75.0f, 50.0f, 25.0f }, // SCENE_SPIRIT_TEMPLE
};
Actor_WorldToActorCoords(&this->actor, &vec, &player->actor.world.pos);
this->side = (vec.z < 0.0f) ? 0 : 1;
absZ = fabsf(vec.z);
if (vec.y > PLANE_Y_MIN && vec.y < PLANE_Y_MAX && fabsf(vec.x) < PLANE_HALFWIDTH &&
absZ < sHorizTriggerDists[phi_t0][0]) {
transitionActorIdx = (u16)this->actor.params >> 0xA;
if (absZ > sHorizTriggerDists[phi_t0][1]) {
/**
* When traversing a holl of this kind, it attempts to:
* Load Current Room (fails as it is already loaded)
* Load Next Room
* Load Previous Room
* Load Next Room
*
* @bug The striped nature of holls can cause some actors to unload due to
* conflicting Object Lists between the two rooms
*
* @bug If you can get around to the other side of the holl without triggering it,
* you can load the room on the other side multiple times
*/
void EnHoll_HorizontalVisibleNarrow(EnHoll* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s32 triggerDistsIndex = (u32)((play->sceneNum == SCENE_SPIRIT_TEMPLE) ? 1 : 0);
Vec3f relPlayerPos;
f32 orthogonalDistToPlayer;
s32 transitionActorIndex;
Actor_WorldToActorCoords(&this->actor, &relPlayerPos, &player->actor.world.pos);
this->side = (relPlayerPos.z < 0.0f) ? 0 : 1;
orthogonalDistToPlayer = fabsf(relPlayerPos.z);
if (relPlayerPos.y > ENHOLL_H_Y_MIN && relPlayerPos.y < ENHOLL_H_Y_MAX &&
fabsf(relPlayerPos.x) < ENHOLL_H_HALFWIDTH_NARROW &&
orthogonalDistToPlayer < sHorizontalVisibleNarrowTriggerDists[triggerDistsIndex][0]) {
transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor);
if (orthogonalDistToPlayer > sHorizontalVisibleNarrowTriggerDists[triggerDistsIndex][1]) {
if (play->roomCtx.prevRoom.num >= 0 && play->roomCtx.status == 0) {
this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[this->side].room;
this->actor.room = play->transiActorCtx.list[transitionActorIndex].sides[this->side].room;
EnHoll_SwapRooms(play);
func_80097534(play, &play->roomCtx);
Room_FinishRoomChange(play, &play->roomCtx);
}
} else {
this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[this->side ^ 1].room;
this->actor.room = play->transiActorCtx.list[transitionActorIndex].sides[this->side ^ 1].room;
if (play->roomCtx.prevRoom.num < 0) {
func_8009728C(play, &play->roomCtx, this->actor.room);
Room_RequestNewRoom(play, &play->roomCtx, this->actor.room);
} else {
this->planeAlpha = (255.0f / (sHorizTriggerDists[phi_t0][2] - sHorizTriggerDists[phi_t0][3])) *
(absZ - sHorizTriggerDists[phi_t0][3]);
this->planeAlpha =
(255.0f / (sHorizontalVisibleNarrowTriggerDists[triggerDistsIndex][2] -
sHorizontalVisibleNarrowTriggerDists[triggerDistsIndex][3])) *
(orthogonalDistToPlayer - sHorizontalVisibleNarrowTriggerDists[triggerDistsIndex][3]);
this->planeAlpha = CLAMP(this->planeAlpha, 0, 255);
if (play->roomCtx.curRoom.num != this->actor.room) {
EnHoll_SwapRooms(play);
}
@@ -153,162 +219,182 @@ void func_80A58DD4(EnHoll* this, PlayState* play) {
}
}
// Horizontal Planes
void func_80A59014(EnHoll* this, PlayState* play) {
void EnHoll_HorizontalInvisible(EnHoll* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s32 useViewEye = gDbgCamEnabled || play->csCtx.state != CS_STATE_IDLE;
Vec3f vec;
s32 temp;
f32 planeHalfWidth;
f32 absZ;
Vec3f relSubjectPos;
s32 isKokiriLayer8;
f32 hollHalfWidth;
f32 orthogonalDistToSubject;
Actor_WorldToActorCoords(&this->actor, &vec, (useViewEye) ? &play->view.eye : &player->actor.world.pos);
planeHalfWidth = (((this->actor.params >> 6) & 7) == 6) ? PLANE_HALFWIDTH : PLANE_HALFWIDTH_2;
Actor_WorldToActorCoords(&this->actor, &relSubjectPos, useViewEye ? &play->view.eye : &player->actor.world.pos);
hollHalfWidth =
(ENHOLL_GET_TYPE(&this->actor) == ENHOLL_H_INVISIBLE_NARROW) ? ENHOLL_H_HALFWIDTH_NARROW : ENHOLL_H_HALFWIDTH;
temp = EnHoll_IsKokiriSetup8();
if (temp || (PLANE_Y_MIN < vec.y && vec.y < PLANE_Y_MAX && fabsf(vec.x) < planeHalfWidth &&
(absZ = fabsf(vec.z), 100.0f > absZ && absZ > 50.0f))) {
s32 transitionActorIdx = (u16)this->actor.params >> 0xA;
s32 side = (vec.z < 0.0f) ? 0 : 1;
TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[transitionActorIdx];
isKokiriLayer8 = EnHoll_IsKokiriLayer8();
if (isKokiriLayer8 || (relSubjectPos.y > ENHOLL_H_Y_MIN && relSubjectPos.y < ENHOLL_H_Y_MAX &&
fabsf(relSubjectPos.x) < hollHalfWidth &&
(orthogonalDistToSubject = fabsf(relSubjectPos.z),
orthogonalDistToSubject < ENHOLL_H_INVISIBLE_LOAD_DEPTH_MAX &&
orthogonalDistToSubject > ENHOLL_H_INVISIBLE_LOAD_DEPTH_MIN))) {
s32 transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor);
s32 side = (relSubjectPos.z < 0.0f) ? 0 : 1;
TransitionActorEntry* transitionEntry = &play->transiActorCtx.list[transitionActorIndex];
s32 room = transitionEntry->sides[side].room;
this->actor.room = room;
if (temp) {}
if (isKokiriLayer8) {}
if (this->actor.room != play->roomCtx.curRoom.num) {
if (room) {}
if (func_8009728C(play, &play->roomCtx, this->actor.room)) {
EnHoll_SetupAction(this, EnHoll_NextAction);
if (Room_RequestNewRoom(play, &play->roomCtx, this->actor.room)) {
EnHoll_SetupAction(this, EnHoll_WaitRoomLoaded);
}
}
}
}
// Vertical Planes
void func_80A591C0(EnHoll* this, PlayState* play) {
void EnHoll_VerticalDownBgCoverLarge(EnHoll* this, PlayState* play) {
Player* player = GET_PLAYER(play);
f32 absY = fabsf(this->actor.yDistToPlayer);
s32 transitionActorIdx;
f32 absYDistToPlayer = fabsf(this->actor.yDistToPlayer);
if (this->actor.xzDistToPlayer < 500.0f && absY < 700.0f) {
transitionActorIdx = (u16)this->actor.params >> 0xA;
if (absY < 95.0f) {
play->unk_11E18 = 0xFF;
} else if (absY > 605.0f) {
play->unk_11E18 = 0;
if (this->actor.xzDistToPlayer < ENHOLL_V_DOWN_RADIUS &&
// Nothing happens if `absYDistToPlayer > ENHOLL_V_DOWN_BGCOVER_YDIST`,
// so this check may as well compare to ENHOLL_V_DOWN_BGCOVER_YDIST
absYDistToPlayer < (ENHOLL_V_DOWN_BGCOVER_YDIST + 95.0f)) {
s32 transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor);
if (absYDistToPlayer < ENHOLL_V_DOWN_LOAD_YDIST) {
play->bgCoverAlpha = 255;
} else if (absYDistToPlayer > ENHOLL_V_DOWN_BGCOVER_YDIST) {
play->bgCoverAlpha = 0;
} else {
play->unk_11E18 = (s16)(605.0f - absY) * 0.5f;
play->bgCoverAlpha = (s16)(ENHOLL_V_DOWN_BGCOVER_YDIST - absYDistToPlayer) *
(255 / (ENHOLL_V_DOWN_BGCOVER_YDIST - ENHOLL_V_DOWN_LOAD_YDIST));
}
if (absY < 95.0f) {
this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[1].room;
if (absYDistToPlayer < ENHOLL_V_DOWN_LOAD_YDIST) {
this->actor.room = play->transiActorCtx.list[transitionActorIndex].sides[1].room;
Math_SmoothStepToF(&player->actor.world.pos.x, this->actor.world.pos.x, 1.0f, 50.0f, 10.0f);
Math_SmoothStepToF(&player->actor.world.pos.z, this->actor.world.pos.z, 1.0f, 50.0f, 10.0f);
if (this->actor.room != play->roomCtx.curRoom.num &&
func_8009728C(play, &play->roomCtx, this->actor.room) != 0) {
EnHoll_SetupAction(this, EnHoll_NextAction);
this->resetBgCoverAlpha = 1;
Room_RequestNewRoom(play, &play->roomCtx, this->actor.room)) {
EnHoll_SetupAction(this, EnHoll_WaitRoomLoaded);
this->resetBgCoverAlpha = true;
player->actor.speedXZ = 0.0f;
}
}
} else if (this->resetBgCoverAlpha != 0) {
play->unk_11E18 = 0;
this->resetBgCoverAlpha = 0;
} else {
if (this->resetBgCoverAlpha) {
play->bgCoverAlpha = 0;
this->resetBgCoverAlpha = false;
}
}
}
// Vertical Planes
void func_80A593A4(EnHoll* this, PlayState* play) {
f32 absY;
s32 side;
s32 transitionActorIdx;
void EnHoll_VerticalBgCover(EnHoll* this, PlayState* play) {
f32 absYDistToPlayer;
if ((this->actor.xzDistToPlayer < 120.0f) && (absY = fabsf(this->actor.yDistToPlayer), absY < 200.0f)) {
if (absY < 50.0f) {
play->unk_11E18 = 0xFF;
if ((this->actor.xzDistToPlayer < ENHOLL_V_RADIUS) &&
(absYDistToPlayer = fabsf(this->actor.yDistToPlayer), absYDistToPlayer < ENHOLL_V_BGCOVER_BGCOVER_YDIST)) {
if (absYDistToPlayer < ENHOLL_V_BGCOVER_LOAD_YDIST) {
play->bgCoverAlpha = 255;
} else {
play->unk_11E18 = (200.0f - absY) * 1.7f;
play->bgCoverAlpha = (ENHOLL_V_BGCOVER_BGCOVER_YDIST - absYDistToPlayer) *
(255 / (ENHOLL_V_BGCOVER_BGCOVER_YDIST - ENHOLL_V_BGCOVER_LOAD_YDIST));
}
if (absY > 50.0f) {
transitionActorIdx = (u16)this->actor.params >> 0xA;
side = (0.0f < this->actor.yDistToPlayer) ? 0 : 1;
this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[side].room;
if (absYDistToPlayer > ENHOLL_V_BGCOVER_LOAD_YDIST) {
s32 transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor);
s32 side = (this->actor.yDistToPlayer > 0.0f) ? 0 : 1;
this->actor.room = play->transiActorCtx.list[transitionActorIndex].sides[side].room;
if (this->actor.room != play->roomCtx.curRoom.num &&
func_8009728C(play, &play->roomCtx, this->actor.room) != 0) {
EnHoll_SetupAction(this, EnHoll_NextAction);
this->resetBgCoverAlpha = 1;
Room_RequestNewRoom(play, &play->roomCtx, this->actor.room)) {
EnHoll_SetupAction(this, EnHoll_WaitRoomLoaded);
this->resetBgCoverAlpha = true;
}
}
} else if (this->resetBgCoverAlpha != 0) {
this->resetBgCoverAlpha = 0;
play->unk_11E18 = 0;
}
}
// Vertical Planes
void func_80A59520(EnHoll* this, PlayState* play) {
f32 absY;
s8 side;
s32 transitionActorIdx;
if (this->actor.xzDistToPlayer < 120.0f) {
absY = fabsf(this->actor.yDistToPlayer);
if (absY < 200.0f && absY > 50.0f) {
transitionActorIdx = (u16)this->actor.params >> 0xA;
side = (0.0f < this->actor.yDistToPlayer) ? 0 : 1;
this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[side].room;
if (this->actor.room != play->roomCtx.curRoom.num &&
func_8009728C(play, &play->roomCtx, this->actor.room) != 0) {
EnHoll_SetupAction(this, EnHoll_NextAction);
}
}
}
}
// Horizontal Planes
void func_80A59618(EnHoll* this, PlayState* play) {
Player* player = GET_PLAYER(play);
Vec3f vec;
f32 absZ;
s32 side;
s32 transitionActorIdx;
if (!Flags_GetSwitch(play, this->actor.params & 0x3F)) {
if (this->resetBgCoverAlpha != 0) {
play->unk_11E18 = 0;
this->resetBgCoverAlpha = 0;
}
} else {
Actor_WorldToActorCoords(&this->actor, &vec, &player->actor.world.pos);
absZ = fabsf(vec.z);
if (PLANE_Y_MIN < vec.y && vec.y < PLANE_Y_MAX && fabsf(vec.x) < PLANE_HALFWIDTH_2 && absZ < 100.0f) {
this->resetBgCoverAlpha = 1;
transitionActorIdx = (u16)this->actor.params >> 0xA;
play->unk_11E18 = 0xFF - (s32)((absZ - 50.0f) * 5.9f);
if (play->unk_11E18 >= 0x100) {
play->unk_11E18 = 0xFF;
} else if (play->unk_11E18 < 0) {
play->unk_11E18 = 0;
}
if (absZ < 50.0f) {
side = (vec.z < 0.0f) ? 0 : 1;
this->actor.room = play->transiActorCtx.list[transitionActorIdx].sides[side].room;
if (this->actor.room != play->roomCtx.curRoom.num &&
func_8009728C(play, &play->roomCtx, this->actor.room) != 0) {
EnHoll_SetupAction(this, EnHoll_NextAction);
}
}
} else if (this->resetBgCoverAlpha != 0) {
play->unk_11E18 = 0;
this->resetBgCoverAlpha = 0;
if (this->resetBgCoverAlpha) {
this->resetBgCoverAlpha = false;
play->bgCoverAlpha = 0;
}
}
}
void EnHoll_NextAction(EnHoll* this, PlayState* play) {
if (!EnHoll_IsKokiriSetup8() && play->roomCtx.status == 0) {
func_80097534(play, &play->roomCtx);
if (play->unk_11E18 == 0) {
this->resetBgCoverAlpha = 0;
void EnHoll_VerticalInvisible(EnHoll* this, PlayState* play) {
f32 absYDistToPlayer;
s8 side;
s32 transitionActorIndex;
if (this->actor.xzDistToPlayer < ENHOLL_V_RADIUS) {
absYDistToPlayer = fabsf(this->actor.yDistToPlayer);
if (absYDistToPlayer < ENHOLL_V_INVISIBLE_LOAD_YDIST_MAX &&
absYDistToPlayer > ENHOLL_V_INVISIBLE_LOAD_YDIST_MIN) {
transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor);
side = (this->actor.yDistToPlayer > 0.0f) ? 0 : 1;
this->actor.room = play->transiActorCtx.list[transitionActorIndex].sides[side].room;
if (this->actor.room != play->roomCtx.curRoom.num &&
Room_RequestNewRoom(play, &play->roomCtx, this->actor.room)) {
EnHoll_SetupAction(this, EnHoll_WaitRoomLoaded);
}
}
}
}
void EnHoll_HorizontalBgCoverSwitchFlag(EnHoll* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (!Flags_GetSwitch(play, ENHOLL_GET_SWITCH_FLAG(&this->actor))) {
if (this->resetBgCoverAlpha) {
play->bgCoverAlpha = 0;
this->resetBgCoverAlpha = false;
}
} else {
Vec3f relPlayerPos;
f32 orthogonalDistToPlayer;
Actor_WorldToActorCoords(&this->actor, &relPlayerPos, &player->actor.world.pos);
orthogonalDistToPlayer = fabsf(relPlayerPos.z);
if (ENHOLL_H_Y_MIN < relPlayerPos.y && relPlayerPos.y < ENHOLL_H_Y_MAX &&
fabsf(relPlayerPos.x) < ENHOLL_H_HALFWIDTH && orthogonalDistToPlayer < ENHOLL_H_SWITCHFLAG_BGCOVER_DEPTH) {
s32 transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor);
this->resetBgCoverAlpha = true;
play->bgCoverAlpha =
255 - (s32)((orthogonalDistToPlayer - ENHOLL_H_SWITCHFLAG_LOAD_DEPTH) *
(255 / (ENHOLL_H_SWITCHFLAG_BGCOVER_DEPTH - ENHOLL_H_SWITCHFLAG_LOAD_DEPTH) + 0.8f));
if (play->bgCoverAlpha > 255) {
play->bgCoverAlpha = 255;
} else if (play->bgCoverAlpha < 0) {
play->bgCoverAlpha = 0;
}
if (orthogonalDistToPlayer < ENHOLL_H_SWITCHFLAG_LOAD_DEPTH) {
s32 side = (relPlayerPos.z < 0.0f) ? 0 : 1;
this->actor.room = play->transiActorCtx.list[transitionActorIndex].sides[side].room;
if (this->actor.room != play->roomCtx.curRoom.num &&
Room_RequestNewRoom(play, &play->roomCtx, this->actor.room)) {
EnHoll_SetupAction(this, EnHoll_WaitRoomLoaded);
}
}
} else {
if (this->resetBgCoverAlpha) {
play->bgCoverAlpha = 0;
this->resetBgCoverAlpha = false;
}
}
}
}
void EnHoll_WaitRoomLoaded(EnHoll* this, PlayState* play) {
if (!EnHoll_IsKokiriLayer8() && play->roomCtx.status == 0) {
Room_FinishRoomChange(play, &play->roomCtx);
if (play->bgCoverAlpha == 0) {
this->resetBgCoverAlpha = false;
}
EnHoll_ChooseAction(this);
}
@@ -325,7 +411,7 @@ void EnHoll_Update(Actor* thisx, PlayState* play) {
void EnHoll_Draw(Actor* thisx, PlayState* play) {
EnHoll* this = (EnHoll*)thisx;
Gfx* gfxP;
u32 setupDlIdx;
u32 setupDLIndex;
// Only draw the plane if not invisible
if (this->planeAlpha != 0) {
@@ -333,12 +419,12 @@ void EnHoll_Draw(Actor* thisx, PlayState* play) {
if (this->planeAlpha == 255) {
gfxP = POLY_OPA_DISP;
setupDlIdx = 37;
setupDLIndex = SETUPDL_37;
} else {
gfxP = POLY_XLU_DISP;
setupDlIdx = 0;
setupDLIndex = SETUPDL_0;
}
gfxP = Gfx_SetupDL(gfxP, setupDlIdx);
gfxP = Gfx_SetupDL(gfxP, setupDLIndex);
if (this->side == 0) {
Matrix_RotateY(M_PI, MTXMODE_APPLY);
}
@@ -4,6 +4,35 @@
#include <libultraship/libultra.h>
#include "global.h"
#define ENHOLL_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 6, 3)
#define ENHOLL_GET_SWITCH_FLAG(thisx) PARAMS_GET_U((thisx)->params, 0, 6)
/**
* Two kinds of holls:
* Horizontal (H):
* For the player to move horizontally between rooms.
* Cuboid-shaped:
* - height: 200 units high plus 50 units into the ground
* - width: 400 units wide or, if narrow, 200 units wide
* Vertical (V):
* For the player to move vertically between rooms.
* Cylinder-shaped, radius of 120 units.
*
* Three kinds of visual effects:
* Visible: A plane is drawn at the holl location, and fades away as the player approaches.
* Bg Cover: The background geometry (e.g. room geometry but not actors) fades black as the player approaches.
* Invisible: Approaching the holl does not cause any particular visual effect.
*/
typedef enum EnHollType {
/* 0 */ ENHOLL_H_VISIBLE_NARROW,
/* 1 */ ENHOLL_V_DOWN_BGCOVER_LARGE, // Only allows downwards transitions. 500 units radius. Used in fire temple drops.
/* 2 */ ENHOLL_V_INVISIBLE,
/* 3 */ ENHOLL_H_BGCOVER_SWITCHFLAG, // Enabled if a switch flag is set. Used in Dampe's race.
/* 4 */ ENHOLL_H_INVISIBLE,
/* 5 */ ENHOLL_V_BGCOVER,
/* 6 */ ENHOLL_H_INVISIBLE_NARROW
} EnHollType;
struct EnHoll;
typedef void (*EnHollActionFunc)(struct EnHoll*, PlayState*);
@@ -831,7 +831,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
this->actor.focus.pos.y += 70.0f;
this->playerControlled = false;
if ((play->sceneNum == SCENE_LON_LON_RANCH) && (gSaveContext.sceneSetupIndex < 4)) {
if ((play->sceneNum == SCENE_LON_LON_RANCH) && (gSaveContext.sceneLayer < 4)) {
if (this->type == HORSE_HNI) {
if (this->actor.world.rot.z == 0 || !IS_DAY) {
Actor_Kill(&this->actor);
@@ -3608,7 +3608,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) {
this->cyl1.base.atFlags &= ~1;
}
if (gSaveContext.entranceIndex != ENTR_LON_LON_RANCH_ENTRANCE || gSaveContext.sceneSetupIndex != 9) {
if (gSaveContext.entranceIndex != ENTR_LON_LON_RANCH_ENTRANCE || gSaveContext.sceneLayer != 9) {
if (this->dustFlags & 1) {
this->dustFlags &= ~1;
func_800287AC(play, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200,
@@ -163,7 +163,7 @@ void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) {
this->unk_1F0 = 0;
this->eyeTexIndex = 0;
if (gSaveContext.sceneSetupIndex > 3) {
if (gSaveContext.sceneLayer > 3) {
func_80A69EC0(this);
} else if (play->sceneNum == SCENE_LON_LON_RANCH) {
if (!Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
@@ -153,7 +153,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.entranceIndex == ENTR_LON_LON_RANCH_ENTRANCE) && (gSaveContext.sceneSetupIndex == 8)) {
if ((gSaveContext.entranceIndex == ENTR_LON_LON_RANCH_ENTRANCE) && (gSaveContext.sceneLayer == 8)) {
isInCreditsScene = true;
actorProfessor = play->actorCtx.actorLists[ACTORCAT_NPC].head;
@@ -192,7 +192,7 @@ s32 EnMa1_ShouldSpawn(EnMa1* this, PlayState* play) {
bool malonReturnedFromCastle = GameInteractor_Should(VB_MALON_RETURN_FROM_CASTLE,
Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE));
if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneSetupIndex == 5)) {
if ((this->actor.shape.rot.z == 3) && (gSaveContext.sceneLayer == 5)) {
return 1;
}
if (!LINK_IS_CHILD) {
+1 -1
View File
@@ -180,7 +180,7 @@ void EnMs_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (gSaveContext.entranceIndex == ENTR_LON_LON_RANCH_ENTRANCE &&
gSaveContext.sceneSetupIndex == 8) { // ride carpet if in credits
gSaveContext.sceneLayer == 8) { // ride carpet if in credits
Actor_MoveXZGravity(&this->actor);
osSyncPrintf("OOOHHHHHH %f\n", this->actor.velocity.y);
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 4);
+1 -1
View File
@@ -339,7 +339,7 @@ void EnNb_SetupChamberCsImpl(EnNb* this, PlayState* play) {
s32 pad[2];
Player* player;
if ((gSaveContext.chamberCutsceneNum == 3) && (gSaveContext.sceneSetupIndex < 4)) {
if ((gSaveContext.chamberCutsceneNum == 3) && (gSaveContext.sceneLayer < 4)) {
player = GET_PLAYER(play);
this->action = NB_CHAMBER_UNDERGROUND;
play->csCtx.segment = &D_80AB431C;
+2 -3
View File
@@ -119,9 +119,8 @@ void func_80AE7590(EnRl* this, PlayState* play) {
Vec3f pos;
s16 sceneNum = play->sceneNum;
if (gSaveContext.sceneSetupIndex == 4 && sceneNum == SCENE_CHAMBER_OF_THE_SAGES &&
play->csCtx.state != CS_STATE_IDLE && play->csCtx.npcActions[6] != NULL &&
play->csCtx.npcActions[6]->action == 2 && !this->lightMedallionGiven) {
if (gSaveContext.sceneLayer == 4 && sceneNum == SCENE_CHAMBER_OF_THE_SAGES && play->csCtx.state != CS_STATE_IDLE &&
play->csCtx.npcActions[6] != NULL && play->csCtx.npcActions[6]->action == 2 && !this->lightMedallionGiven) {
player = GET_PLAYER(play);
pos.x = player->actor.world.pos.x;
pos.y = player->actor.world.pos.y + 80.0f;
@@ -2018,7 +2018,7 @@ void func_80AEF890(EnRu1* this, PlayState* play) {
s32 pad[2];
s8 curRoomNum;
if ((gSaveContext.sceneSetupIndex < 4) && (EnRu1_IsCsStateIdle(play))) {
if ((gSaveContext.sceneLayer < 4) && (EnRu1_IsCsStateIdle(play))) {
curRoomNum = play->roomCtx.curRoom.num;
Flags_SetInfTable(INFTABLE_145);
Flags_SetSwitch(play, func_80AEADE0(this));
@@ -345,7 +345,7 @@ void EnRu2_CheckWaterMedallionCutscene(EnRu2* this, PlayState* play) {
Player* player;
s16 yaw;
if ((gSaveContext.chamberCutsceneNum == 2) && (gSaveContext.sceneSetupIndex < 4)) {
if ((gSaveContext.chamberCutsceneNum == 2) && (gSaveContext.sceneLayer < 4)) {
player = GET_PLAYER(play);
this->action = ENRU2_AWAIT_BLUE_WARP;
play->csCtx.segment = &gWaterMedallionCs;
+1 -1
View File
@@ -130,7 +130,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.sceneSetupIndex == 6)) {
if ((this->actor.params != TR_KOUME) || (gSaveContext.sceneLayer == 6)) {
Audio_PlaySoundGeneral(NA_SE_EN_TWINROBA_SHOOT_VOICE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
@@ -201,7 +201,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) {
s32 animationEnded;
if (type == ENVIEWER_TYPE_2_ZELDA) {
if (gSaveContext.sceneSetupIndex == 5) {
if (gSaveContext.sceneLayer == 5) {
csFrames = play->csCtx.frames;
if (csFrames == 792) {
Audio_PlayActorSound2(&this->actor, NA_SE_VO_Z0_SURPRISE);
@@ -215,7 +215,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.sceneSetupIndex == 4) {
if (gSaveContext.sceneLayer == 4) {
switch (play->csCtx.frames) {
case 20:
case 59:
@@ -233,7 +233,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) {
break;
}
}
if (gSaveContext.sceneSetupIndex == 5) {
if (gSaveContext.sceneLayer == 5) {
if (play->csCtx.frames == 1508) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_ST_LAUGH);
}
@@ -250,7 +250,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
} else if (type == ENVIEWER_TYPE_6_HORSE_GANONDORF) {
if (gSaveContext.sceneSetupIndex == 5 || gSaveContext.sceneSetupIndex == 10) {
if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 10) {
Audio_PlayActorSound2(&this->actor, NA_SE_EV_HORSE_RUN_LEVEL - SFX_FLAG);
}
} else if (type == ENVIEWER_TYPE_4_HORSE_GANONDORF) {
@@ -359,7 +359,7 @@ void EnViewer_UpdateImpl(EnViewer* this, PlayState* play) {
}
}
} else if (type == ENVIEWER_TYPE_1_IMPA) {
if (gSaveContext.sceneSetupIndex == 5) {
if (gSaveContext.sceneLayer == 5) {
if (play->csCtx.frames == 845) {
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_ITEM_OCARINA, 4.0f, 81.0f, 2600.0f, 0, 0,
0, 0);
@@ -495,7 +495,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.sceneSetupIndex == 4) {
if (gSaveContext.sceneLayer == 4) {
if (play->csCtx.frames >= 400) {
if (limbIndex == 5) {
*dList = gYoungGanondorfOpenLeftHandDL;
@@ -537,7 +537,7 @@ void EnViewer_DrawGanondorf(EnViewer* this, PlayState* play) {
type = this->actor.params >> 8;
if (type == ENVIEWER_TYPE_3_GANONDORF || type == ENVIEWER_TYPE_5_GANONDORF || type == ENVIEWER_TYPE_7_GANONDORF ||
type == ENVIEWER_TYPE_8_GANONDORF) {
if (gSaveContext.sceneSetupIndex != 4) {
if (gSaveContext.sceneLayer != 4) {
frames = 149;
}
@@ -646,7 +646,7 @@ void EnViewer_DrawZelda(EnViewer* this, PlayState* play) {
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gChildZeldaEyeOutTex));
}
if (gSaveContext.sceneSetupIndex == 6) {
if (gSaveContext.sceneLayer == 6) {
gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(gChildZeldaMouthSurprisedTex));
} else {
if (play->csCtx.frames < 758) {
+4 -4
View File
@@ -445,7 +445,7 @@ void EnXc_SetLandingSFX(EnXc* this, PlayState* play) {
u32 sfxId;
s16 sceneNum = play->sceneNum;
if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum != SCENE_DESERT_COLOSSUS)) {
if ((gSaveContext.sceneLayer != 4) || (sceneNum != SCENE_DESERT_COLOSSUS)) {
if (Animation_OnFrame(&this->skelAnime, 11.0f)) {
sfxId = SFX_FLAG;
sfxId += SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId);
@@ -458,7 +458,7 @@ void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) {
static Vec3f sXyzDist;
s16 sceneNum;
if (gSaveContext.sceneSetupIndex == 4) {
if (gSaveContext.sceneLayer == 4) {
sceneNum = play->sceneNum;
if (sceneNum == SCENE_DESERT_COLOSSUS) {
CutsceneContext* csCtx = &play->csCtx;
@@ -484,7 +484,7 @@ void EnXc_SetColossusAppearSFX(EnXc* this, PlayState* play) {
void func_80B3D118(PlayState* play) {
s16 sceneNum;
if ((gSaveContext.sceneSetupIndex != 4) || (sceneNum = play->sceneNum, sceneNum != SCENE_DESERT_COLOSSUS)) {
if ((gSaveContext.sceneLayer != 4) || (sceneNum = play->sceneNum, sceneNum != SCENE_DESERT_COLOSSUS)) {
Sfx_PlaySfxCentered2(NA_SE_PL_SKIP);
}
}
@@ -493,7 +493,7 @@ static Vec3f D_80B42DA0;
s32 D_80B41D90 = 0;
void EnXc_SetColossusWindSFX(PlayState* play) {
if (gSaveContext.sceneSetupIndex == 4) {
if (gSaveContext.sceneLayer == 4) {
static Vec3f sPos = { 0.0f, 0.0f, 0.0f };
static f32 sMaxSpeed = 0.0f;
static Vec3f D_80B42DB0;
@@ -107,7 +107,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_UPDATE_CULLING_DISABLED;
if (gSaveContext.sceneSetupIndex != 4) {
if (gSaveContext.sceneLayer != 4) {
Actor_Kill(&this->actor);
return;
}
@@ -88,7 +88,7 @@ void EnZl1_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f);
this->actor.targetMode = 0;
if (gSaveContext.sceneSetupIndex >= 4) {
if (gSaveContext.sceneLayer >= 4) {
frameCount = Animation_GetLastFrame(&gChildZelda1Anim_00438);
Animation_Change(&this->skelAnime, &gChildZelda1Anim_00438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f);
this->unk_1E6 = 0;
@@ -377,7 +377,7 @@ void EnZl4_Init(Actor* thisx, PlayState* play) {
this->actor.textId = -1;
this->eyeExpression = this->mouthExpression = ZL4_MOUTH_NEUTRAL;
if (gSaveContext.sceneSetupIndex >= 4) {
if (gSaveContext.sceneLayer >= 4) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0);
this->actionFunc = EnZl4_TheEnd;
} else if (Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER)) {
@@ -193,7 +193,7 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) {
player = GET_PLAYER(play);
if (play->sceneNum == SCENE_KOKIRI_FOREST && gSaveContext.sceneSetupIndex == 7) {
if (play->sceneNum == SCENE_KOKIRI_FOREST && gSaveContext.sceneLayer == 7) {
dist = Math3D_Vec3f_DistXYZ(&this->prevEyePos, &play->view.eye);
this->prevEyePos.x = play->view.eye.x;
@@ -226,7 +226,7 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) {
}
if (play->envCtx.unk_EE[3] < 64 && (gSaveContext.entranceIndex != ENTR_KOKIRI_FOREST_0 ||
gSaveContext.sceneSetupIndex != 4 || play->envCtx.unk_EE[3])) {
gSaveContext.sceneLayer != 4 || play->envCtx.unk_EE[3])) {
play->envCtx.unk_EE[3] += 16;
}
@@ -5458,7 +5458,7 @@ s32 Player_ActionHandler_1(Player* this, PlayState* play) {
play->transiActorCtx.list[(u16)doorActor->params >> 10].sides[(doorDirection > 0) ? 0 : 1].room;
if ((frontRoom >= 0) && (frontRoom != play->roomCtx.curRoom.num)) {
func_8009728C(play, &play->roomCtx, frontRoom);
Room_RequestNewRoom(play, &play->roomCtx, frontRoom);
}
}
@@ -10357,7 +10357,7 @@ void Player_Action_80845EF8(Player* this, PlayState* play) {
} else {
func_8083C0E8(this, play);
if (play->roomCtx.prevRoom.num >= 0) {
func_80097534(play, &play->roomCtx);
Room_FinishRoomChange(play, &play->roomCtx);
}
func_8005B1A4(Play_GetCamera(play, 0));
Play_SetupRespawnPoint(play, 0, 0xDFF);
@@ -10613,7 +10613,7 @@ void Player_StartMode_Nothing(PlayState* play, Player* this) {
void Player_StartMode_BlueWarp(PlayState* play, Player* this) {
Player_SetupAction(play, this, Player_Action_8084F710, 0);
if ((play->sceneNum == SCENE_LAKE_HYLIA) && (gSaveContext.sceneSetupIndex >= 4)) {
if ((play->sceneNum == SCENE_LAKE_HYLIA) && (gSaveContext.sceneLayer >= 4)) {
this->av1.actionVar1 = 1;
}
this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE;
@@ -10828,8 +10828,8 @@ void Player_Init(Actor* thisx, PlayState* play2) {
if ((respawnFlag == 0) || (respawnFlag < -1)) {
titleFileSize = scene->titleFile.vromEnd - scene->titleFile.vromStart;
if (GameInteractor_Should(VB_SHOW_TITLE_CARD, gSaveContext.showTitleCard)) {
if ((gSaveContext.sceneSetupIndex < 4) &&
(gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneSetupIndex)].field &
if ((gSaveContext.sceneLayer < 4) &&
(gEntranceTable[((void)0, gSaveContext.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].field &
ENTRANCE_INFO_DISPLAY_TITLE_CARD_FLAG) &&
((play->sceneNum != SCENE_DODONGOS_CAVERN) ||
(Flags_GetEventChkInf(EVENTCHKINF_ENTERED_DODONGOS_CAVERN))) &&
@@ -16,7 +16,7 @@ void Opening_SetupTitleScreen(OpeningContext* this) {
gWalkSpeedToggle = 0;
Sram_InitDebugSave();
gSaveContext.cutsceneIndex = 0xFFF3;
gSaveContext.sceneSetupIndex = 7;
gSaveContext.sceneLayer = 7;
SET_NEXT_GAMESTATE(&this->state, Play_Init, PlayState);
}