diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 9637be78c4..4926bdc7b8 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -896,9 +896,7 @@ void DoorShutter_PhantomGanonBarsRaise(DoorShutter* this, PlayState* play) { f32 targetOffsetY; PRINTF("FHG SAKU START !!\n"); - if (this->isActive != 0) { - this->isActive--; - } + DECR(this->isActive); targetOffsetY = (this->isActive % 2 != 0) ? -3.0f : 0.0f; Math_SmoothStepToF(&this->dyna.actor.world.pos.y, -34.0f + targetOffsetY, 1.0f, 20.0f, 0.0f); PRINTF("FHG SAKU END !!\n"); @@ -975,6 +973,9 @@ s32 DoorShutter_ShouldDraw(DoorShutter* this, PlayState* play) { void DoorShutter_Draw(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; + if (1) {} + if (1) {} + //! @bug This actor is not fully initialized until the required object dependency is loaded. //! In most cases, the check for objectSlot to equal requiredObjectSlot prevents the actor //! from drawing until initialization is complete. However if the required object is the same as the diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 711ecafe2b..f8b93bc48d 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -488,14 +488,15 @@ void EnDaiku_UpdateSubCamera(EnDaiku* this, PlayState* play) { void EnDaiku_EscapeSuccess(EnDaiku* this, PlayState* play) { static Vec3f D_809E4148 = { 0.0f, 0.0f, 120.0f }; - Actor* gerudoGuard; - Vec3f vec; Play_ClearCamera(play, this->subCamId); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); this->subCamActive = false; if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { + Actor* gerudoGuard; + Vec3f vec; + Matrix_RotateY(BINANG_TO_RAD(this->initRot.y), MTXMODE_NEW); Matrix_MultVec3f(&D_809E4148, &vec); gerudoGuard = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_GE3, this->initPos.x + vec.x, this->initPos.y + vec.y, @@ -504,9 +505,10 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, PlayState* play) { if (gerudoGuard == NULL) { Actor_Kill(&this->actor); } - } else { - Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7); + return; } + + Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7); } /** @@ -605,6 +607,8 @@ void EnDaiku_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDaiku_OverrideLimbDraw, EnDaiku_PostLimbDraw, this); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1255); } diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index 66a136fccf..9b5564cfc5 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -562,5 +562,7 @@ void EnDaikuKakariko_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnDaikuKakariko_OverrideLimbDraw, EnDaikuKakariko_PostLimbDraw, thisx); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku_kakariko.c", 1151); } diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index 5f04f6159f..7a087c0b91 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -173,10 +173,9 @@ void EnDoor_Destroy(Actor* thisx, PlayState* play) { } void EnDoor_SetupType(EnDoor* this, PlayState* play) { - s32 doorType; - if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { - doorType = ENDOOR_GET_TYPE(&this->actor); + s32 doorType = ENDOOR_GET_TYPE(&this->actor); + this->actor.flags &= ~ACTOR_FLAG_4; this->actor.objectSlot = this->requiredObjectSlot; this->actionFunc = EnDoor_Idle; @@ -191,7 +190,9 @@ void EnDoor_SetupType(EnDoor* this, PlayState* play) { this->lockTimer = 10; } } else if (doorType == DOOR_AJAR) { - if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor) > DOOR_AJAR_SLAM_RANGE) { + Player* player = GET_PLAYER(play); + + if (Actor_WorldDistXZToActor(&this->actor, &player->actor) > DOOR_AJAR_SLAM_RANGE) { this->actionFunc = EnDoor_AjarWait; this->actor.world.rot.y = -0x1800; } @@ -217,7 +218,6 @@ void EnDoor_Idle(EnDoor* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 doorType; Vec3f playerPosRelToDoor; - s16 yawDiff; doorType = ENDOOR_GET_TYPE(&this->actor); func_8002DBD0(&this->actor, &playerPosRelToDoor, &player->actor.world.pos); @@ -233,7 +233,8 @@ void EnDoor_Idle(EnDoor* this, PlayState* play) { } else if (!Player_InCsMode(play)) { if (fabsf(playerPosRelToDoor.y) < 20.0f && fabsf(playerPosRelToDoor.x) < 20.0f && fabsf(playerPosRelToDoor.z) < 50.0f) { - yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; + s16 yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (playerPosRelToDoor.z > 0.0f) { yawDiff = 0x8000 - yawDiff; } @@ -293,9 +294,6 @@ void EnDoor_AjarClose(EnDoor* this, PlayState* play) { } void EnDoor_Open(EnDoor* this, PlayState* play) { - s32 i; - s32 numEffects; - if (DECR(this->lockTimer) == 0) { if (SkelAnime_Update(&this->skelAnime)) { this->actionFunc = EnDoor_Idle; @@ -307,7 +305,9 @@ void EnDoor_Open(EnDoor* this, PlayState* play) { ? NA_SE_EV_IRON_DOOR_OPEN : NA_SE_OC_DOOR_OPEN); if (this->skelAnime.playSpeed < 1.5f) { - numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50; + s32 numEffects = (s32)(Rand_ZeroOne() * 30.0f) + 50; + s32 i; + for (i = 0; i < numEffects; i++) { EffectSsBubble_Spawn(play, &this->actor.world.pos, 60.0f, 100.0f, 50.0f, 0.15f); } @@ -329,25 +329,22 @@ void EnDoor_Update(Actor* thisx, PlayState* play) { } s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - s32 pad; - TransitionActorEntry* transitionEntry; - Gfx** doorDLists; - s32 pad2; - s16 rotDiff; - s32 doorDListIndex; - EnDoor* this = (EnDoor*)thisx; - if (limbIndex == 4) { - doorDLists = sDoorDLists[this->dListIndex]; + EnDoor* this = (EnDoor*)thisx; + TransitionActorEntry* transitionEntry; + Gfx** doorDLists = sDoorDLists[this->dListIndex]; + transitionEntry = &play->transiActorCtx.list[GET_TRANSITION_ACTOR_INDEX(&this->actor)]; rot->z += this->actor.world.rot.y; if ((play->roomCtx.prevRoom.num >= 0) || (transitionEntry->sides[0].room == transitionEntry->sides[1].room)) { // Draw the side of the door that is visible to the camera - rotDiff = this->actor.shape.rot.y + this->skelAnime.jointTable[3].z + rot->z - - Math_Vec3f_Yaw(&play->view.eye, &this->actor.world.pos); + s16 rotDiff = this->actor.shape.rot.y + this->skelAnime.jointTable[3].z + rot->z - + Math_Vec3f_Yaw(&play->view.eye, &this->actor.world.pos); + *dList = (ABS(rotDiff) < 0x4000) ? doorDLists[0] : doorDLists[1]; } else { - doorDListIndex = this->unk_192; + s32 doorDListIndex = this->unk_192; + if (transitionEntry->sides[0].room != this->actor.room) { doorDListIndex ^= 1; } diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index e55c65d345..921156ee51 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -256,14 +256,12 @@ void EnHoll_HorizontalInvisible(EnHoll* this, PlayState* play) { void EnHoll_VerticalDownBgCoverLarge(EnHoll* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 absYDistToPlayer = fabsf(this->actor.yDistToPlayer); - s32 transitionActorIndex; 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)) { - - transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); + s32 transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); if (absYDistToPlayer < ENHOLL_V_DOWN_LOAD_YDIST) { play->bgCoverAlpha = 255; @@ -295,8 +293,6 @@ void EnHoll_VerticalDownBgCoverLarge(EnHoll* this, PlayState* play) { void EnHoll_VerticalBgCover(EnHoll* this, PlayState* play) { f32 absYDistToPlayer; - s32 side; - s32 transitionActorIndex; if ((this->actor.xzDistToPlayer < ENHOLL_V_RADIUS) && (absYDistToPlayer = fabsf(this->actor.yDistToPlayer), absYDistToPlayer < ENHOLL_V_BGCOVER_BGCOVER_YDIST)) { @@ -309,8 +305,9 @@ void EnHoll_VerticalBgCover(EnHoll* this, PlayState* play) { } if (absYDistToPlayer > ENHOLL_V_BGCOVER_LOAD_YDIST) { - transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); - side = (this->actor.yDistToPlayer > 0.0f) ? 0 : 1; + 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)) { @@ -348,10 +345,6 @@ void EnHoll_VerticalInvisible(EnHoll* this, PlayState* play) { void EnHoll_HorizontalBgCoverSwitchFlag(EnHoll* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f relPlayerPos; - f32 orthogonalDistToPlayer; - s32 side; - s32 transitionActorIndex; if (!Flags_GetSwitch(play, ENHOLL_GET_SWITCH_FLAG(&this->actor))) { if (this->resetBgCoverAlpha) { @@ -359,15 +352,17 @@ void EnHoll_HorizontalBgCoverSwitchFlag(EnHoll* this, PlayState* play) { this->resetBgCoverAlpha = false; } } else { + Vec3f relPlayerPos; + f32 orthogonalDistToPlayer; + func_8002DBD0(&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; - transitionActorIndex = GET_TRANSITION_ACTOR_INDEX(&this->actor); - play->bgCoverAlpha = 255 - (s32)((orthogonalDistToPlayer - ENHOLL_H_SWITCHFLAG_LOAD_DEPTH) * (255 / (ENHOLL_H_SWITCHFLAG_BGCOVER_DEPTH - ENHOLL_H_SWITCHFLAG_LOAD_DEPTH) + 0.8f)); @@ -378,7 +373,8 @@ void EnHoll_HorizontalBgCoverSwitchFlag(EnHoll* this, PlayState* play) { } if (orthogonalDistToPlayer < ENHOLL_H_SWITCHFLAG_LOAD_DEPTH) { - side = (relPlayerPos.z < 0.0f) ? 0 : 1; + 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 && func_8009728C(play, &play->roomCtx, this->actor.room)) {