diff --git a/include/z64actor.h b/include/z64actor.h index ec6de9d72f..13f13026ac 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -172,12 +172,12 @@ typedef struct Actor { /* 0x085 */ u8 floorBgId; // Bg ID of the floor polygon directly below the actor /* 0x086 */ s16 wallYaw; // Y rotation of the wall polygon the actor is touching /* 0x088 */ f32 floorHeight; // Y position of the floor polygon directly below the actor - /* 0x08C */ f32 yDistToWater; // Distance to the surface of active waterbox. Negative value means above water + /* 0x08C */ f32 depthInWater; // Directed distance to the surface of active waterbox. Negative value means water is below. /* 0x090 */ u16 bgCheckFlags; // See comments below actor struct for wip docs. TODO: macros for these flags /* 0x092 */ s16 yawTowardsPlayer; // Y rotation difference between the actor and the player /* 0x094 */ f32 xyzDistToPlayerSq; // Squared distance between the actor and the player in the x,y,z axis /* 0x098 */ f32 xzDistToPlayer; // Distance between the actor and the player in the XZ plane - /* 0x09C */ f32 yDistToPlayer; // Dist is negative if the actor is above the player + /* 0x09C */ f32 playerHeightRel; // Directed distance is negative if the player is below. /* 0x0A0 */ CollisionCheckInfo colChkInfo; // Variables related to the Collision Check system /* 0x0BC */ ActorShape shape; // Variables related to the physical shape of the actor /* 0x0EC */ Vec3f projectedPos; // Position of the actor in projected space diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index acae2e0ced..7d4c050d48 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -480,10 +480,10 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - if (!((sp38 != 0) && (this->actor.xzDistToPlayer <= 60.0f) && (this->actor.yDistToPlayer >= -100.0f) && - (this->actor.yDistToPlayer <= 100.0f)) && - !((sp38 == 0) && (this->actor.xzDistToPlayer <= 30.0f) && (this->actor.yDistToPlayer >= -50.0f) && - (this->actor.yDistToPlayer <= 50.0f))) { + if (!((sp38 != 0) && (this->actor.xzDistToPlayer <= 60.0f) && (this->actor.playerHeightRel >= -100.0f) && + (this->actor.playerHeightRel <= 100.0f)) && + !((sp38 == 0) && (this->actor.xzDistToPlayer <= 30.0f) && (this->actor.playerHeightRel >= -50.0f) && + (this->actor.playerHeightRel <= 50.0f))) { if (!Actor_HasParent(&this->actor, globalCtx)) { return; } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 2b5a76a49a..ed485a1104 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -128,7 +128,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { s32 dooranaType = GET_DOORANA_TYPE(this); s8 pad[4]; s32 entranceIndex; - f32 yDist; + f32 playerHeightRel; if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f) != 0) { if ((this->actor.targetMode != 0) && (globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_18B4A == 0) && @@ -166,8 +166,9 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { } else { if ((func_801690CC(globalCtx) == 0) && ((player->stateFlags1 & 0x08800000) == 0) && - (this->actor.xzDistToPlayer <= 20.0f) && (yDist = this->actor.yDistToPlayer, (yDist >= -50.0f)) && - (yDist <= 15.0f)) { + (this->actor.xzDistToPlayer <= 20.0f) && + (playerHeightRel = this->actor.playerHeightRel, (playerHeightRel >= -50.0f)) && + (playerHeightRel <= 15.0f)) { player->stateFlags1 |= 0x80000000; this->actor.targetMode = 1; @@ -192,7 +193,7 @@ void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) { } } - if ((this->actor.yDistToPlayer <= 0.0f) && (this->actor.xzDistToPlayer > 20.0f)) { + if ((this->actor.playerHeightRel <= 0.0f) && (this->actor.xzDistToPlayer > 20.0f)) { player = GET_PLAYER(globalCtx); player->actor.world.pos.x = (Math_SinS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.x; player->actor.world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 45370609be..ee51c74444 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -99,7 +99,7 @@ void func_809CCE98(EnBji01* this, GlobalContext* globalCtx) { void func_809CCEE8(EnBji01* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.home.rot.y, 0x444); if (this->actor.params == ENBJI01_PARAMS_DEFAULT) { - if ((this->actor.xzDistToPlayer <= 60.0f) && (this->actor.yDistToPlayer <= 10.0f)) { + if ((this->actor.xzDistToPlayer <= 60.0f) && (this->actor.playerHeightRel <= 10.0f)) { this->actor.flags |= 0x10000; } else { this->actor.flags &= ~0x10000; @@ -172,7 +172,7 @@ void func_809CD028(EnBji01* this, GlobalContext* globalCtx) { } else { this->textId = 0x5F1; } - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.yDistToPlayer, 0); + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); break; case PLAYER_FORM_HUMAN: this->textId = 0x5F7; diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 39acd872d5..dcf32235c2 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -224,8 +224,8 @@ void func_808BD49C(EnDekunuts* this, GlobalContext* globalCtx) { } if (phi_v1 && ((this->actor.xzDistToPlayer > 160.0f) || (this->actor.params != ENDEKUNUTS_GET_FF00_0)) && - (((this->actor.params == ENDEKUNUTS_GET_FF00_0) && (fabsf(this->actor.yDistToPlayer) < 120.0f)) || - ((this->actor.params == ENDEKUNUTS_GET_FF00_2) && (this->actor.yDistToPlayer > -60.0f)) || + (((this->actor.params == ENDEKUNUTS_GET_FF00_0) && (fabsf(this->actor.playerHeightRel) < 120.0f)) || + ((this->actor.params == ENDEKUNUTS_GET_FF00_2) && (this->actor.playerHeightRel > -60.0f)) || (this->actor.params == ENDEKUNUTS_GET_FF00_1)) && ((this->unk_190 == 0) || (this->actor.xzDistToPlayer < 480.0f))) { this->skelAnime.playSpeed = 1.0f; diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index c0c17367d4..7e0127bcfc 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -928,11 +928,11 @@ void func_8098B464(EnDg* this, GlobalContext* globalCtx) { Vec3f sp2C; sp2C.x = this->actor.world.pos.x; - sp2C.y = this->actor.world.pos.y + this->actor.yDistToWater; + sp2C.y = this->actor.world.pos.y + this->actor.depthInWater; sp2C.z = this->actor.world.pos.z + 20.0f; EffectSsGSplash_Spawn(globalCtx, &sp2C, NULL, NULL, 0, 800); EffectSsGRipple_Spawn(globalCtx, &sp2C, 100, 500, 30); - if (this->actor.yDistToWater > 0.0f) { + if (this->actor.depthInWater > 0.0f) { this->actor.gravity = 0.0f; this->actor.velocity.y = -3.0f; this->unk_284 = 10; @@ -954,7 +954,7 @@ void func_8098B560(EnDg* this, GlobalContext* globalCtx) { f32 sp34; sp54.x = this->actor.world.pos.x; - sp54.y = this->actor.world.pos.y + this->actor.yDistToWater; + sp54.y = this->actor.world.pos.y + this->actor.depthInWater; sp54.z = this->actor.world.pos.z + 20.0f; sp48.x = (Math_SinS(this->actor.world.rot.y) * 50.0f) + this->actor.world.pos.x; sp48.y = this->actor.home.pos.y + 100.0f; @@ -969,9 +969,9 @@ void func_8098B560(EnDg* this, GlobalContext* globalCtx) { EffectSsGRipple_Spawn(globalCtx, &sp54, 100, 500, 30); } - if (this->actor.yDistToWater > 15.0f) { + if (this->actor.depthInWater > 15.0f) { this->actor.velocity.y = 0.5f; - } else if (this->actor.yDistToWater < 10.0f) { + } else if (this->actor.depthInWater < 10.0f) { this->actor.velocity.y = -0.5f; } @@ -1015,7 +1015,7 @@ void func_8098B88C(EnDg* this, GlobalContext* globalCtx) { Vec3f sp34; sp34.x = this->actor.world.pos.x; - sp34.y = this->actor.world.pos.y + this->actor.yDistToWater; + sp34.y = this->actor.world.pos.y + this->actor.depthInWater; sp34.z = this->actor.world.pos.z + 20.0f; if (DECR(this->unk_284) == 0) { @@ -1023,9 +1023,9 @@ void func_8098B88C(EnDg* this, GlobalContext* globalCtx) { EffectSsGRipple_Spawn(globalCtx, &sp34, 100, 500, 30); } - if (this->actor.yDistToWater > 15.0f) { + if (this->actor.depthInWater > 15.0f) { this->actor.velocity.y = 1.0f; - } else if (this->actor.yDistToWater < 10.0f) { + } else if (this->actor.depthInWater < 10.0f) { this->actor.velocity.y = -1.0f; } diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 8670600fef..a73f5423ff 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -1372,10 +1372,10 @@ void EnDinofos_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 30.0f, 60.0f, 0x5D); if (this->actionFunc != func_8089C7B8) { - if ((this->actor.yDistToWater > 0.0f) && (this->actor.yDistToWater < 10.0f)) { + if ((this->actor.depthInWater > 0.0f) && (this->actor.depthInWater < 10.0f)) { if (!((globalCtx->gameplayFrames % 4) & 1)) { Math_Vec3f_Copy(&sp30, &this->unk_2D4[1 + (globalCtx->gameplayFrames % 4)]); - sp30.y = this->actor.world.pos.y + this->actor.yDistToWater; + sp30.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(globalCtx, &sp30, 100, 320, 0); } } diff --git a/src/overlays/actors/ovl_En_Dno/z_en_dno.c b/src/overlays/actors/ovl_En_Dno/z_en_dno.c index ff7e3de3b3..33706267b7 100644 --- a/src/overlays/actors/ovl_En_Dno/z_en_dno.c +++ b/src/overlays/actors/ovl_En_Dno/z_en_dno.c @@ -536,7 +536,7 @@ void func_80A724B8(EnDno* this, GlobalContext* globalCtx) { } void func_80A7256C(EnDno* this, GlobalContext* globalCtx) { - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.yDistToPlayer, -1); + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, -1); } void func_80A72598(EnDno* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index e392e6d607..a52d7fa110 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -458,7 +458,7 @@ void EnDnq_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4); this->unk_394 = this->actor.xzDistToPlayer; func_80A52C6C(this, globalCtx); - func_8013C964(&this->actor, globalCtx, this->unk_390, fabsf(this->actor.yDistToPlayer) + 1.0f, 0, + func_8013C964(&this->actor, globalCtx, this->unk_390, fabsf(this->actor.playerHeightRel) + 1.0f, 0, this->unk_37C & 7); this->actor.xzDistToPlayer = this->unk_394; Actor_SetHeight(&this->actor, 46.0f); diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index 62cfddd0f2..97a2e389dd 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -595,7 +595,7 @@ void func_80877500(EnDodongo* this, GlobalContext* globalCtx) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x1F4); if (this->actor.xzDistToPlayer < (100.0f * this->unk_334)) { - if ((ABS_ALT(temp_v1) < 0x1388) && (this->actor.yDistToPlayer < 60.0f) && + if ((ABS_ALT(temp_v1) < 0x1388) && (this->actor.playerHeightRel < 60.0f) && !(player->stateFlags1 & 0x800000)) { func_808777A8(this); } diff --git a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c index 3bbe3ba8e2..a2df9772be 100644 --- a/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c +++ b/src/overlays/actors/ovl_En_Elforg/z_en_elforg.c @@ -434,7 +434,7 @@ void EnElforg_FreeFloating(EnElforg* this, GlobalContext* globalCtx) { EnElforg_MoveToTarget(this, &this->actor.home.pos); } - scaledYDistance = this->actor.yDistToPlayer - (this->actor.shape.yOffset * this->actor.scale.y); + scaledYDistance = this->actor.playerHeightRel - (this->actor.shape.yOffset * this->actor.scale.y); if (!func_801233E4(globalCtx)) { if ((this->actor.xzDistToPlayer < 30.0f) && (scaledYDistance < 12.0f) && (scaledYDistance > -68.0f)) { EnElforg_SetupFairyCollected(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 716c460a82..120aa4d29d 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -412,7 +412,7 @@ void EnFirefly_Die(EnFirefly* this, GlobalContext* globalCtx) { void EnFirefly_SetupDiveAttack(EnFirefly* this) { this->timer = Rand_S16Offset(70, 100); this->skelAnime.playSpeed = 1.0f; - this->targetPitch = ((this->actor.yDistToPlayer > 0.0f) ? -0xC00 : 0xC00) + 0x1554; + this->targetPitch = ((this->actor.playerHeightRel > 0.0f) ? -0xC00 : 0xC00) + 0x1554; this->actionFunc = EnFirefly_DiveAttack; } diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index ca2891c546..e5a4448d04 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -161,7 +161,7 @@ void func_80BCF354(EnHg* this) { void func_80BCF398(EnHg* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.health == 1) { - if ((this->actor.xzDistToPlayer < 200.0f && this->actor.yDistToPlayer < 40.0f) && + if ((this->actor.xzDistToPlayer < 200.0f && this->actor.playerHeightRel < 40.0f) && !func_800EE29C(globalCtx, 0x1E3)) { func_80BCF468(this); } @@ -353,7 +353,7 @@ void func_80BCF95C(EnHg* this, GlobalContext* globalCtx) { void func_80BCFC0C(EnHg* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - if (this->actor.colChkInfo.health == 1 && !(fabsf(this->actor.yDistToPlayer) >= 80.0f)) { + if (this->actor.colChkInfo.health == 1 && !(fabsf(this->actor.playerHeightRel) >= 80.0f)) { if (player->stateFlags2 & 0x08000000) { if (!D_80BD00C8) { play_sound(NA_SE_SY_TRE_BOX_APPEAR); @@ -372,7 +372,7 @@ void func_80BCFC0C(EnHg* this, GlobalContext* globalCtx) { func_80BCF88C(this); } } else { - if (this->actor.xzDistToPlayer < 60.0f && fabsf(this->actor.yDistToPlayer) < 40.0f) { + if (this->actor.xzDistToPlayer < 60.0f && fabsf(this->actor.playerHeightRel) < 40.0f) { if ((this->actionFunc != func_80BCF8A0) && (this->actionFunc != func_80BCF95C)) { if (!(gSaveContext.weekEventReg[0x3D] & 2)) { gSaveContext.weekEventReg[0x3D] |= 2; 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 b2e0a09d9a..65f5e4d555 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -251,7 +251,7 @@ void EnHoll_VerticalBgCoverIdle(EnHoll* this, GlobalContext* globalCtx) { f32 playerDistFromCentralPlane; if ((this->actor.xzDistToPlayer < EN_HOLL_RADIUS) && - (playerDistFromCentralPlane = fabsf(this->actor.yDistToPlayer), + (playerDistFromCentralPlane = fabsf(this->actor.playerHeightRel), playerDistFromCentralPlane < EN_HOLL_ACTIVATION_PLANE_DISTANCE_VERTICAL)) { if (playerDistFromCentralPlane < EN_HOLL_LOADING_PLANE_DISTANCE_VERTICAL) { globalCtx->bgCoverAlpha = 255; @@ -260,7 +260,7 @@ void EnHoll_VerticalBgCoverIdle(EnHoll* this, GlobalContext* globalCtx) { } if (playerDistFromCentralPlane > EN_HOLL_LOADING_PLANE_DISTANCE_VERTICAL) { s32 enHollId = EN_HOLL_GET_ID_CAST(this); - s32 playerSide = (this->actor.yDistToPlayer > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; + s32 playerSide = (this->actor.playerHeightRel > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; this->actor.room = globalCtx->doorCtx.transitionActorList[enHollId].sides[playerSide].room; @@ -279,12 +279,12 @@ void EnHoll_VerticalBgCoverIdle(EnHoll* this, GlobalContext* globalCtx) { void EnHoll_VerticalIdle(EnHoll* this, GlobalContext* globalCtx) { if (this->actor.xzDistToPlayer < EN_HOLL_RADIUS) { - f32 playerDistFromCentralPlane = fabsf(this->actor.yDistToPlayer); + f32 playerDistFromCentralPlane = fabsf(this->actor.playerHeightRel); if (playerDistFromCentralPlane < EN_HOLL_ACTIVATION_PLANE_DISTANCE_VERTICAL && playerDistFromCentralPlane > EN_HOLL_LOADING_PLANE_DISTANCE_VERTICAL) { s32 enHollId = EN_HOLL_GET_ID_CAST(this); - s32 playerSide = (this->actor.yDistToPlayer > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; + s32 playerSide = (this->actor.playerHeightRel > 0.0f) ? EN_HOLL_ABOVE : EN_HOLL_BELOW; this->actor.room = globalCtx->doorCtx.transitionActorList[enHollId].sides[playerSide].room; if ((this->actor.room != globalCtx->roomCtx.currRoom.num) && diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 18be1dc958..831e6a4b91 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -765,7 +765,7 @@ void EnMinislime_Update(Actor* thisx, GlobalContext* globalCtx) { player = GET_PLAYER(globalCtx); vec1.x = this->actor.world.pos.x; vec1.z = this->actor.world.pos.z; - vec1.y = player->actor.world.pos.y + player->actor.yDistToWater; + vec1.y = player->actor.world.pos.y + player->actor.depthInWater; EffectSsGRipple_Spawn(globalCtx, &vec1, 500, 720, 0); } } diff --git a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c index 191939426c..d3e7f1cd0d 100644 --- a/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c +++ b/src/overlays/actors/ovl_En_Mushi2/z_en_mushi2.c @@ -261,8 +261,8 @@ s32 func_80A68DD4(EnMushi2* this, GlobalContext* globalCtx) { s32 pad2; f32 sp24; - if ((this->actor.xzDistToPlayer < 32.0f) && (this->actor.yDistToPlayer > -10.0f) && - (this->actor.yDistToPlayer < 31.0f)) { + if ((this->actor.xzDistToPlayer < 32.0f) && (this->actor.playerHeightRel > -10.0f) && + (this->actor.playerHeightRel < 31.0f)) { player = GET_PLAYER(globalCtx); sp2E = BINANG_ROT180(this->actor.yawTowardsPlayer); sp24 = Math_SinS(sp2E); @@ -533,14 +533,14 @@ void func_80A697C4(EnMushi2* this, GlobalContext* globalCtx) { if (func_800CA1E8(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp2C, &sp30)) { - this->actor.yDistToWater = sp2C - this->actor.world.pos.y; - if (this->actor.yDistToWater >= 1.0f) { + this->actor.depthInWater = sp2C - this->actor.world.pos.y; + if (this->actor.depthInWater >= 1.0f) { this->unk_30C |= 0x20; } else { this->unk_30C &= ~0x20; } } else { - this->actor.yDistToWater = BGCHECK_Y_MIN; + this->actor.depthInWater = BGCHECK_Y_MIN; this->unk_30C &= ~0x20; } } @@ -966,7 +966,7 @@ void func_80A6AB08(EnMushi2* this, GlobalContext* globalCtx) { Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); func_80A69424(this, globalCtx); - Math_StepToF(&this->actor.world.pos.y, this->actor.world.pos.y + this->actor.yDistToWater, 2.8f); + Math_StepToF(&this->actor.world.pos.y, this->actor.world.pos.y + this->actor.depthInWater, 2.8f); this->skelAnime.playSpeed = this->unk_368 * 0.018f; this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, 0.1f, 1.9f); @@ -992,7 +992,7 @@ void func_80A6AB08(EnMushi2* this, GlobalContext* globalCtx) { Vec3f sp3C; sp3C.x = this->actor.world.pos.x; - sp3C.y = this->actor.world.pos.y + this->actor.yDistToWater; + sp3C.y = this->actor.world.pos.y + this->actor.depthInWater; sp3C.z = this->actor.world.pos.z; EffectSsGRipple_Spawn(globalCtx, &sp3C, 40, 200, 4); } @@ -1030,7 +1030,7 @@ void func_80A6AE7C(EnMushi2* this, GlobalContext* globalCtx) { func_80A69424(this, globalCtx); temp_f2 = this->actor.scale.x - (1.0f / 20000.0f); Actor_SetScale(&this->actor, CLAMP_MIN(temp_f2, 0.001f)); - if ((this->actor.flags & 0x40) && (this->actor.yDistToWater > 5.0f) && (this->actor.yDistToWater < 30.0f) && + if ((this->actor.flags & 0x40) && (this->actor.depthInWater > 5.0f) && (this->actor.depthInWater < 30.0f) && ((Rand_Next() & 0x1FF) < this->unk_368)) { EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, -5.0f, 5.0f, 5.0f, ((Rand_ZeroOne() * 4.0f) + 2.0f) * this->actor.scale.x); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 4bad3b031e..f72add584b 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -523,13 +523,13 @@ void EnNiw_Swimming(EnNiw* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 0x20) { // still touching water this->actor.gravity = 0.0f; - if (this->actor.yDistToWater > 15.0f) { + if (this->actor.depthInWater > 15.0f) { this->actor.world.pos.y += 2.0f; } if (this->unkTimer250 == 0) { this->unkTimer250 = 30; Math_Vec3f_Copy(&ripplePos, &this->actor.world.pos); - ripplePos.y += this->actor.yDistToWater; + ripplePos.y += this->actor.depthInWater; EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 30); } @@ -858,12 +858,12 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = EnNiw_LandBeforeIdle; return; - } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f) && + } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 15.0f) && (this->unknownState28E != 6)) { this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; Math_Vec3f_Copy(&pos, &this->actor.world.pos); - pos.y += this->actor.yDistToWater; + pos.y += this->actor.depthInWater; this->unkTimer250 = 30; EffectSsGSplash_Spawn(globalCtx, &pos, 0, 0, 0, 400); this->unkTimer252 = 0; diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index 0f987a390d..1bbdae1f94 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -387,7 +387,7 @@ void func_80B5C154(EnOt* this, GlobalContext* globalCtx) { this->unk_38C = 12; gSaveContext.weekEventReg[32] |= 1; } - func_800B8A1C(&this->actor, globalCtx, this->unk_38C, this->actor.xzDistToPlayer, this->actor.yDistToPlayer); + func_800B8A1C(&this->actor, globalCtx, this->unk_38C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); this->actionFunc = func_80B5C1CC; } @@ -397,7 +397,7 @@ void func_80B5C1CC(EnOt* this, GlobalContext* globalCtx) { func_80B5C244(this, globalCtx); func_80B5C244(this->unk_360, globalCtx); } else { - func_800B8A1C(&this->actor, globalCtx, this->unk_38C, this->actor.xzDistToPlayer, this->actor.yDistToPlayer); + func_800B8A1C(&this->actor, globalCtx, this->unk_38C, this->actor.xzDistToPlayer, this->actor.playerHeightRel); } } @@ -611,7 +611,7 @@ void func_80B5CB0C(EnOt* this, GlobalContext* globalCtx) { void func_80B5CBA0(EnOt* this, GlobalContext* globalCtx) { this->actor.flags |= 0x10000; - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.yDistToPlayer, 0); + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); this->actionFunc = func_80B5CBEC; } @@ -622,7 +622,7 @@ void func_80B5CBEC(EnOt* this, GlobalContext* globalCtx) { } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); this->actor.world.rot.y = this->actor.shape.rot.y; - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.yDistToPlayer, 0); + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); } } @@ -698,7 +698,7 @@ void func_80B5CEC8(EnOt* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0xE38, 0x38E); if (this->unk_32C & 0x800) { this->actor.flags |= 0x10000; - func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.yDistToPlayer, 0); + func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0); } else { this->actor.flags &= ~0x10000; if ((player->actor.bgCheckFlags & 1) && !func_801242B4(player) && (this->actor.xzDistToPlayer < 130.0f)) { @@ -707,7 +707,7 @@ void func_80B5CEC8(EnOt* this, GlobalContext* globalCtx) { } if (!(gSaveContext.weekEventReg[84] & 0x10) && (ENOT_GET_C000(&this->actor) == 1)) { - if ((fabsf(this->actor.xzDistToPlayer) <= 130.0f) && (fabsf(this->actor.yDistToPlayer) <= 130.0f)) { + if ((fabsf(this->actor.xzDistToPlayer) <= 130.0f) && (fabsf(this->actor.playerHeightRel) <= 130.0f)) { player->unk_B2B = 29; } diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index fd87fdc598..12e234991a 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -273,10 +273,10 @@ void EnPametfrog_ChangeColliderThaw(EnPametfrog* this, GlobalContext* globalCtx) void EnPametfrog_JumpWaterEffects(EnPametfrog* this, GlobalContext* globalCtx) { Vec3f pos; - if (this->actor.yDistToWater > 0.0f) { + if (this->actor.depthInWater > 0.0f) { pos.x = this->actor.world.pos.x; pos.z = this->actor.world.pos.z; - pos.y = this->actor.world.pos.y + this->actor.yDistToWater; + pos.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(globalCtx, &pos, 150, 550, 0); pos.y += 8.0f; EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 550); @@ -286,10 +286,10 @@ void EnPametfrog_JumpWaterEffects(EnPametfrog* this, GlobalContext* globalCtx) { void EnPametfrog_IdleWaterEffects(EnPametfrog* this, GlobalContext* globalCtx) { Vec3f pos; - if ((this->actor.yDistToWater > 0.0f) && ((globalCtx->gameplayFrames % 14) == 0)) { + if ((this->actor.depthInWater > 0.0f) && ((globalCtx->gameplayFrames % 14) == 0)) { pos.x = this->actor.world.pos.x; pos.z = this->actor.world.pos.z; - pos.y = this->actor.world.pos.y + this->actor.yDistToWater; + pos.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(globalCtx, &pos, 150, 550, 0); } } diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 4ec78d0339..57fca7fd7b 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -344,7 +344,7 @@ void func_80B1ACB8(EnPoSisters* this, GlobalContext* globalCtx) { } } - if ((this->actor.xzDistToPlayer < 600.0f) && (fabsf(this->actor.yDistToPlayer + 5.0f) < 30.0f)) { + if ((this->actor.xzDistToPlayer < 600.0f) && (fabsf(this->actor.playerHeightRel + 5.0f) < 30.0f)) { func_80B1AE28(this); } else if ((this->unk_192 == 0) && Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f)) { func_80B1AB5C(this); @@ -377,7 +377,7 @@ void func_80B1AE3C(EnPoSisters* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x71C); } - if ((this->actor.xzDistToPlayer < 320.0f) && (fabsf(this->actor.yDistToPlayer + 5.0f) < 30.0f)) { + if ((this->actor.xzDistToPlayer < 320.0f) && (fabsf(this->actor.playerHeightRel + 5.0f) < 30.0f)) { func_80B1AF8C(this); } else if (this->actor.xzDistToPlayer > 720.0f) { func_80B1AC40(this); diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index a860e49fbd..c355f99344 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -141,7 +141,7 @@ void EnSb_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnSb_SpawnBubbles(GlobalContext* globalCtx, EnSb* this) { s32 bubbleCount; - if (this->actor.yDistToWater > 0.0f) { + if (this->actor.depthInWater > 0.0f) { for (bubbleCount = 0; bubbleCount < 10; bubbleCount++) { EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 10.0f, 10.0f, 30.0f, 0.25f); } @@ -169,7 +169,7 @@ void EnSb_SetupWaitOpen(EnSb* this) { void EnSb_SetupLunge(EnSb* this) { f32 frameCount = Animation_GetLastFrame(&D_06000124); - f32 playbackSpeed = this->actor.yDistToWater > 0.0f ? 1.0f : 0.0f; + f32 playbackSpeed = this->actor.depthInWater > 0.0f ? 1.0f : 0.0f; Animation_Change(&this->skelAnime, &D_06000124, playbackSpeed, 0.0f, frameCount, 2, 0); this->state = SHELLBLADE_LUNGE; @@ -191,7 +191,7 @@ void EnSb_SetupIdle(EnSb* this, s32 changeSpeed) { } this->state = SHELLBLADE_WAIT_CLOSED; if (changeSpeed) { - if (this->actor.yDistToWater > 0.0f) { + if (this->actor.depthInWater > 0.0f) { this->actor.speedXZ = -5.0f; if (this->actor.velocity.y < 0.0f) { this->actor.velocity.y = 2.1f; @@ -252,7 +252,7 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, invertedYaw, 1, 0x1F40, 0xA); if (this->actor.shape.rot.y == invertedYaw) { this->actor.world.rot.y = this->yawAngle; - if (this->actor.yDistToWater > 0.0f) { + if (this->actor.depthInWater > 0.0f) { this->actor.velocity.y = 3.0f; this->actor.speedXZ = 5.0f; this->actor.gravity = -0.35f; @@ -270,7 +270,7 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); if (this->actor.velocity.y <= -0.1f || this->actor.bgCheckFlags & 2) { - if (!(this->actor.yDistToWater > 0.0f)) { + if (!(this->actor.depthInWater > 0.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_EYEGOLE_ATTACK); } this->actor.bgCheckFlags &= ~2; @@ -288,7 +288,7 @@ void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { if (this->bounceCounter != 0) { this->bounceCounter--; this->attackTimer = 1; - if (this->actor.yDistToWater > 0.0f) { + if (this->actor.depthInWater > 0.0f) { this->actor.velocity.y = 3.0f; this->actor.speedXZ = 5.0f; this->actor.gravity = -0.35f; @@ -363,7 +363,7 @@ void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (this->isDead) { - if (this->actor.yDistToWater > 0.0f) { + if (this->actor.depthInWater > 0.0f) { this->actor.params = 4; } else { this->actor.params = 1; @@ -393,7 +393,7 @@ void EnSb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec if (this->isDrawn != false) { if (limbIndex < 7) { - phi_a2 = (this->actor.yDistToWater > 0) ? 4 : 1; + phi_a2 = (this->actor.depthInWater > 0) ? 4 : 1; func_800BBCEC(thisx, globalCtx, phi_a2, dList); } if (limbIndex == 6) { diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index badcc5501c..c939d4c11c 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -302,7 +302,7 @@ void func_80ADB254(EnSellnuts* this, GlobalContext* globalCtx) { s16 frameCount = Animation_GetLastFrame(D_80ADD990[this->unk_34C].animationSeg); Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); - if (((this->actor.yDistToPlayer < 50.0f) && (this->actor.yDistToPlayer > -50.0f) ? true : false) && + if (((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f) ? true : false) && ((this->actor.xzDistToPlayer < 200.0f) ? true : false)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actionFunc = func_80ADB4F4; @@ -390,7 +390,7 @@ void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { } } } else if (((this->actor.xzDistToPlayer < 80.0f) && - (((this->actor.yDistToPlayer < 50.0f) && (this->actor.yDistToPlayer > -50.0f)) ? true : false)) || + (((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false)) || this->actor.isTargeted) { func_800B85E0(&this->actor, globalCtx, 80.0f, 0x2A); if (player->transformation == PLAYER_FORM_DEKU) { @@ -416,7 +416,7 @@ void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { } } - if (!(((this->actor.yDistToPlayer < 50.0f) && (this->actor.yDistToPlayer > -50.0f)) ? true : false) || + if (!(((this->actor.playerHeightRel < 50.0f) && (this->actor.playerHeightRel > -50.0f)) ? true : false) || !((this->actor.xzDistToPlayer < 200.0f) ? true : false)) { this->unk_34C = 4; func_8013BC6C(&this->skelAnime, D_80ADD990, 4); @@ -674,7 +674,7 @@ void func_80ADC37C(EnSellnuts* this, GlobalContext* globalCtx) { this->unk_334++; } } - } else if (this->actor.yDistToPlayer > 500.0f) { + } else if (this->actor.playerHeightRel > 500.0f) { ActorCutscene_Stop(this->cutscene); this->actionFunc = func_80ADC580; } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 3fd19ef91f..13669d2849 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -872,7 +872,7 @@ void func_8099672C(EnSkb* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if ((this->unk_3DE != 6) && (this->unk_3DE != 7)) { - if ((this->actor.bgCheckFlags & 0x60) && (this->actor.yDistToWater >= 40.0f)) { + if ((this->actor.bgCheckFlags & 0x60) && (this->actor.depthInWater >= 40.0f)) { this->actor.colChkInfo.health = 0; this->unk_3E4 = 0; func_809961E4(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 7449b0f5d6..d24f0ec0b4 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -396,7 +396,7 @@ void func_80BAAF1C(EnSuttari* this) { } void func_80BAAFDC(EnSuttari* this, GlobalContext* globalCtx) { - if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.yDistToPlayer < 100.0f)) { + if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.playerHeightRel < 100.0f)) { Vec3f effectVelOffset = { 0.0f, 0.0f, 0.0f }; Vec3f effectPos; Vec3f effectVel; @@ -428,7 +428,7 @@ void func_80BAAFDC(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BAB1A0(EnSuttari* this, GlobalContext* globalCtx) { - if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.yDistToPlayer < 100.0f)) { + if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.playerHeightRel < 100.0f)) { Vec3f effectVelOffset = { 0.0f, 0.0f, 0.0f }; Vec3f effectPos; Vec3f effectVel; @@ -988,7 +988,7 @@ void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) { func_80BABA90(this, 0, 0); func_80BAB434(this); if (player->transformation == PLAYER_FORM_GORON || player->transformation == PLAYER_FORM_ZORA) { - if (this->actor.yDistToPlayer < 60.0f && this->actor.xzDistToPlayer < 500.0f) { + if (this->actor.playerHeightRel < 60.0f && this->actor.xzDistToPlayer < 500.0f) { this->unk3F2 = this->unk2DE; this->actionFunc = func_80BACBB0; } @@ -1013,7 +1013,7 @@ void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) { if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) { this->actionFunc = func_80BACA14; } - if ((this->actor.yDistToPlayer < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { + if ((this->actor.playerHeightRel < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { if (this->actor.bgCheckFlags & 8) { target = this->actor.wallYaw; } else if (func_80BAA904(this, globalCtx)) { @@ -1043,7 +1043,7 @@ void func_80BACD2C(EnSuttari* this, GlobalContext* globalCtx) { if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) { this->actionFunc = func_80BACA14; } - if ((this->actor.yDistToPlayer < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { + if ((this->actor.playerHeightRel < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { this->actionFunc = func_80BACBB0; Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 0.1f); } else { diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index b303ed877d..139a2f43b9 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -505,7 +505,7 @@ void func_80C11590(EnThiefbird* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_THIEFBIRD_VOICE); } - if ((this->actor.yDistToWater > -40.0f) || (this->actor.bgCheckFlags & 1)) { + if ((this->actor.depthInWater > -40.0f) || (this->actor.bgCheckFlags & 1)) { this->unk_190 = -4096; } else if (this->actor.world.pos.y < (this->actor.home.pos.y - 75.0f)) { this->unk_190 = -Rand_S16Offset(2048, 2048); @@ -529,7 +529,7 @@ void func_80C11590(EnThiefbird* this, GlobalContext* globalCtx) { } if ((this->unk_18E == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & 0x800000) && - (Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK) && (this->actor.yDistToWater < -40.0f)) { + (Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK) && (this->actor.depthInWater < -40.0f)) { func_80C118E4(this); } } @@ -574,7 +574,7 @@ void func_80C1193C(EnThiefbird* this, GlobalContext* globalCtx) { if ((this->unk_18E == 0) || (player->stateFlags1 & 0x800000) || (Player_GetMask(globalCtx) == PLAYER_MASK_STONE_MASK) || (this->collider.base.atFlags & AT_HIT) || - (this->actor.bgCheckFlags & 1) || (this->actor.yDistToWater > -40.0f)) { + (this->actor.bgCheckFlags & 1) || (this->actor.depthInWater > -40.0f)) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; Audio_PlayActorSound2(&this->actor, NA_SE_EN_THIEFBIRD_VOICE); @@ -841,7 +841,7 @@ void func_80C126A8(EnThiefbird* this) { void func_80C126D8(EnThiefbird* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); Math_ApproachS(&this->actor.shape.rot.x, 0x3000, 6, 0x1000); - if (this->actor.yDistToPlayer > 100.0f) { + if (this->actor.playerHeightRel > 100.0f) { Actor_MarkForDeath(&this->actor); } } diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index 7a17a27b42..1afbd5ce5a 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -231,7 +231,7 @@ s32 func_80893ADC(EnTite* this) { s32 func_80893B10(EnTite* this) { Math_StepToF(&this->actor.velocity.y, 0.0f, 2.0f); - return Math_StepToF(&this->actor.world.pos.y, (this->actor.world.pos.y + this->actor.yDistToWater) - 1.0f, 2.0f); + return Math_StepToF(&this->actor.world.pos.y, (this->actor.world.pos.y + this->actor.depthInWater) - 1.0f, 2.0f); } void func_80893B70(EnTite* this) { @@ -309,7 +309,7 @@ void func_80893F30(EnTite* this, GlobalContext* globalCtx) { if (this->unk_2BC > 0) { this->unk_2BC--; } else if ((Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK) && (this->actor.xzDistToPlayer < 300.0f) && - (this->actor.yDistToPlayer < 80.0f)) { + (this->actor.playerHeightRel < 80.0f)) { func_808945EC(this); } } @@ -337,7 +337,7 @@ void func_8089408C(EnTite* this, GlobalContext* globalCtx) { if (!func_80893ADC(this)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_JUMP); } else { - this->actor.world.pos.y += this->actor.yDistToWater; + this->actor.world.pos.y += this->actor.depthInWater; Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); } @@ -376,7 +376,7 @@ void func_8089408C(EnTite* this, GlobalContext* globalCtx) { void func_808942B4(EnTite* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); - if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.yDistToWater > 0.0f))) && + if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.depthInWater > 0.0f))) && (this->actor.velocity.y <= 0.0f)) { this->actor.speedXZ = 0.0f; this->collider.base.atFlags &= ~AT_HIT; @@ -410,7 +410,7 @@ void func_80894414(EnTite* this) { void func_80894454(EnTite* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE_MASK) || (this->actor.xzDistToPlayer > 450.0f) || - (this->actor.yDistToPlayer > 80.0f)) { + (this->actor.playerHeightRel > 80.0f)) { func_80893ED4(this); } else if (!Actor_IsActorFacingLink(&this->actor, 0x2328)) { func_808945EC(this); @@ -427,7 +427,7 @@ void func_8089452C(EnTite* this, GlobalContext* globalCtx) { Vec3f sp2C; Math_Vec3f_Copy(&sp2C, &this->actor.world.pos); - sp2C.y += this->actor.yDistToWater; + sp2C.y += this->actor.depthInWater; this->actor.velocity.y *= 0.75f; EffectSsGRipple_Spawn(globalCtx, &sp2C, 0, 500, 0); Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_LAND_WATER); @@ -473,11 +473,11 @@ void func_80894638(EnTite* this, GlobalContext* globalCtx) { } if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE_MASK) || (this->actor.xzDistToPlayer > 450.0f) || - (this->actor.yDistToPlayer > 80.0f)) { + (this->actor.playerHeightRel > 80.0f)) { func_80893ED4(this); - } else if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.yDistToWater < 10.0f))) && + } else if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.depthInWater < 10.0f))) && Actor_IsActorFacingLink(&this->actor, 0xE38)) { - if ((this->actor.xzDistToPlayer <= 180.0f) && (this->actor.yDistToPlayer <= 80.0f)) { + if ((this->actor.xzDistToPlayer <= 180.0f) && (this->actor.playerHeightRel <= 80.0f)) { func_80893A9C(this, globalCtx); } else { func_8089484C(this); @@ -494,7 +494,7 @@ void func_8089484C(EnTite* this) { this->actor.gravity = -1.0f; this->actor.speedXZ = 4.0f; if (func_80893ADC(this)) { - this->actor.world.pos.y += this->actor.yDistToWater; + this->actor.world.pos.y += this->actor.depthInWater; Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_JUMP); @@ -512,7 +512,7 @@ void func_80894910(EnTite* this, GlobalContext* globalCtx) { if (func_80893ADC(this)) { Math_Vec3f_Copy(&sp34, &this->actor.world.pos); - sp34.y += this->actor.yDistToWater; + sp34.y += this->actor.depthInWater; this->actor.velocity.y *= 0.75f; EffectSsGRipple_Spawn(globalCtx, &sp34, 0, 500, 0); } @@ -520,7 +520,7 @@ void func_80894910(EnTite* this, GlobalContext* globalCtx) { func_80893BCC(this, globalCtx); } - if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.yDistToWater > 0.0f))) && + if (((this->actor.bgCheckFlags & 1) || (func_80893ADC(this) && (this->actor.depthInWater > 0.0f))) && (this->actor.velocity.y <= 0.0f)) { this->actor.speedXZ = 0.0f; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4000); @@ -534,9 +534,9 @@ void func_80894910(EnTite* this, GlobalContext* globalCtx) { } if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE_MASK) || (this->actor.xzDistToPlayer > 450.0f) || - (this->actor.yDistToPlayer > 80.0f)) { + (this->actor.playerHeightRel > 80.0f)) { func_80893ED4(this); - } else if ((this->actor.xzDistToPlayer <= 180.0f) && (this->actor.yDistToPlayer <= 80.0f)) { + } else if ((this->actor.xzDistToPlayer <= 180.0f) && (this->actor.playerHeightRel <= 80.0f)) { func_808945EC(this); } else { func_8089484C(this); @@ -565,7 +565,7 @@ void func_80894BC8(EnTite* this, GlobalContext* globalCtx) { if (func_80893ADC(this) && (this->actor.velocity.y <= 0.0f)) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; - this->actor.world.pos.y += this->actor.yDistToWater - 1.0f; + this->actor.world.pos.y += this->actor.depthInWater - 1.0f; } if (this->actor.bgCheckFlags & 0x40) { @@ -578,10 +578,10 @@ void func_80894BC8(EnTite* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; this->collider.base.acFlags |= AC_ON; if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE_MASK) || - (((this->actor.xzDistToPlayer > 450.0f) || (this->actor.yDistToPlayer > 80.0f)) && + (((this->actor.xzDistToPlayer > 450.0f) || (this->actor.playerHeightRel > 80.0f)) && (ABS_ALT(this->actor.shape.rot.x) < 4000) && (ABS_ALT(this->actor.shape.rot.z) < 4000))) { func_80893ED4(this); - } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.yDistToPlayer <= 80.0f) && + } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.playerHeightRel <= 80.0f) && Actor_IsActorFacingLink(&this->actor, 0x1770)) { func_80893A9C(this, globalCtx); } else { @@ -607,7 +607,7 @@ void func_80894E0C(EnTite* this, GlobalContext* globalCtx) { if ((func_80893ADC(this) != 0) && (this->actor.velocity.y <= 0.0f)) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; - this->actor.world.pos.y += this->actor.yDistToWater; + this->actor.world.pos.y += this->actor.depthInWater; } if (this->actor.bgCheckFlags & 0x40) { @@ -623,10 +623,10 @@ void func_80894E0C(EnTite* this, GlobalContext* globalCtx) { } else if (this->unk_2B9 != 0) { func_808955E4(this); } else if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE_MASK) || - (((this->actor.xzDistToPlayer > 450.0f) || (this->actor.yDistToPlayer > 80.0f)) && + (((this->actor.xzDistToPlayer > 450.0f) || (this->actor.playerHeightRel > 80.0f)) && (ABS_ALT(this->actor.shape.rot.x) < 4000) && (ABS_ALT(this->actor.shape.rot.z) < 4000))) { func_80893ED4(this); - } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.yDistToPlayer <= 80.0f) && + } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.playerHeightRel <= 80.0f) && Actor_IsActorFacingLink(&this->actor, 0x1770)) { func_80893A9C(this, globalCtx); } else { @@ -799,7 +799,7 @@ void func_80895738(EnTite* this, GlobalContext* globalCtx) { this->actor.world.rot.y = this->actor.shape.rot.y; func_80893A18(this); if ((Player_GetMask(globalCtx) == PLAYER_MASK_STONE_MASK) || (this->actor.xzDistToPlayer > 450.0f) || - (this->actor.yDistToPlayer > 80.0f)) { + (this->actor.playerHeightRel > 80.0f)) { func_80893ED4(this); } else if (!Actor_IsActorFacingLink(&this->actor, 0x2328)) { func_808945EC(this); @@ -1045,15 +1045,15 @@ void func_808963B4(EnTite* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 0x40) { for (i = 5; i < ARRAY_COUNT(this->unk_2D0); i++) { Math_Vec3f_Copy(&sp48, &this->unk_2D0[i]); - sp48.y = this->actor.world.pos.y + this->actor.yDistToWater; + sp48.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(globalCtx, &sp48, 0, 220, 0); } } else if (this->actor.bgCheckFlags & 0x20) { s32 temp = globalCtx->gameplayFrames & 7; - if (!(temp & 1) && (this->actor.yDistToWater < 10.0f)) { + if (!(temp & 1) && (this->actor.depthInWater < 10.0f)) { Math_Vec3f_Copy(&sp48, &this->unk_2D0[5 + (temp >> 1)]); - sp48.y = this->actor.world.pos.y + this->actor.yDistToWater; + sp48.y = this->actor.world.pos.y + this->actor.depthInWater; EffectSsGRipple_Spawn(globalCtx, &sp48, 0, 220, 0); } } diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index d02573039d..ba6945b841 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -108,7 +108,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx) { targetAlpha = 0; } else if (this->state == TORCH2_STATE_FADING_IN) { // Stay semitransparent until the player moves away - if ((this->actor.xzDistToPlayer > 32.0f) || (fabsf(this->actor.yDistToPlayer) > 70.0f)) { + if ((this->actor.xzDistToPlayer > 32.0f) || (fabsf(this->actor.playerHeightRel) > 70.0f)) { this->state = TORCH2_STATE_SOLID; } targetAlpha = 60; diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index d808de961f..8eafd140ef 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -137,7 +137,7 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) Vec3f* actorPos = &this->actor.world.pos; pos = *actorPos; - pos.y += this->actor.yDistToWater; + pos.y += this->actor.depthInWater; EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 0x190); @@ -172,7 +172,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); Player* player2 = GET_PLAYER(globalCtx); - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) { + if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 15.0f)) { EnTuboTrap_SpawnEffectsInWater(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); EnTuboTrap_DropCollectible(this, globalCtx); @@ -232,7 +232,7 @@ void EnTuboTrap_Idle(EnTuboTrap* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.world.pos.y <= player->actor.world.pos.y)) { startingRotation = this->actor.home.rot.z; - if ((startingRotation == 0) || (this->actor.yDistToPlayer <= (startingRotation * 10.0f))) { + if ((startingRotation == 0) || (this->actor.playerHeightRel <= (startingRotation * 10.0f))) { func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY); currentHeight = this->actor.world.pos.y; this->actor.flags |= 0x11; // always update and can target diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index f462077772..0ff4d527b4 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -1086,7 +1086,7 @@ void func_809928CC(EnWf* this, GlobalContext* globalCtx) { func_8099223C(this); } } else if (Actor_IsActorFacingLink(&this->actor, 0x4000) && (this->actor.xzDistToPlayer < 60.0f) && - (fabsf(this->actor.yDistToPlayer) < 50.0f)) { + (fabsf(this->actor.playerHeightRel) < 50.0f)) { sp2A = player->actor.shape.rot.y - this->actor.shape.rot.y; if (!func_800BC5EC(globalCtx, &this->actor) && (((globalCtx->gameplayFrames % 2) != 0) || (ABS_ALT(sp2A) < 0x38E0))) { diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 2111f1d0f2..2b4b762f7b 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -74,7 +74,7 @@ void func_80ACB6A0(ObjAqua* this, GlobalContext* globalCtx) { s32 angleOffset = 0; s32 i; - sp58.y = this->actor.world.pos.y + this->actor.yDistToWater; + sp58.y = this->actor.world.pos.y + this->actor.depthInWater; for (i = 0; i < 4; i++) { sp58.x = this->actor.world.pos.x + Math_SinS((s32)(Rand_ZeroOne() * 7200.0f) + angleOffset) * 8.0f; sp58.z = this->actor.world.pos.z + Math_CosS((s32)(Rand_ZeroOne() * 7200.0f) + angleOffset) * 8.0f; diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c index f252efbd53..e4d9707be2 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c @@ -140,9 +140,9 @@ void ObjEtcetera_Idle(ObjEtcetera* this, GlobalContext* globalCtx) { this->oscillationTimer = 30; this->burrowFlag &= ~1; } else if ((player->stateFlags3 & 0x2000) && (this->dyna.actor.xzDistToPlayer < 30.0f) && - (this->dyna.actor.yDistToPlayer > 0.0f)) { + (this->dyna.actor.playerHeightRel > 0.0f)) { // Player is hovering above the Deku Flower - minOscillationTimer = 10 - (s32)(this->dyna.actor.yDistToPlayer * 0.05f); + minOscillationTimer = 10 - (s32)(this->dyna.actor.playerHeightRel * 0.05f); if (this->oscillationTimer < minOscillationTimer) { this->oscillationTimer = minOscillationTimer; } diff --git a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c index c6870edf15..9632088b77 100644 --- a/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c +++ b/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.c @@ -103,7 +103,7 @@ void ObjHgdoor_SetupCheckShouldOpen(ObjHgdoor* this) { void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, GlobalContext* globalCtx) { if (!(gSaveContext.weekEventReg[75] & 0x20) && !(gSaveContext.weekEventReg[52] & 0x20) && - (this->dyna.actor.xzDistToPlayer < 100.0f) && (this->dyna.actor.yDistToPlayer < 40.0f) && + (this->dyna.actor.xzDistToPlayer < 100.0f) && (this->dyna.actor.playerHeightRel < 40.0f) && OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) { ObjHgdoor_SetChild(this, globalCtx); ObjHgdoor_SetParent(this, globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 3fc376dc46..7879bd1d9b 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -213,7 +213,7 @@ void ObjKibako_WaterBreak(ObjKibako* this, GlobalContext* globalCtx) { Vec3f pos; Vec3f velocity; - pos.y = worldPos->y + this->actor.yDistToWater; + pos.y = worldPos->y + this->actor.depthInWater; for (angle = 0, i = 0; i < 5; i++, angle += 0x3333) { pos.x = (Math_SinS(((s32)(Rand_ZeroOne() * 6000.0f)) + angle) * 15.0f) + worldPos->x; pos.z = (Math_CosS(((s32)(Rand_ZeroOne() * 6000.0f)) + angle) * 15.0f) + worldPos->z; @@ -277,7 +277,7 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { ObjKibako_SpawnCollectible(this, globalCtx); } func_800B8E58(&this->actor, NA_SE_PL_PULL_UP_WOODBOX); - } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 19.0f)) { + } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 19.0f)) { ObjKibako_WaterBreak(this, globalCtx); ObjKibako_SpawnCollectible(this, globalCtx); Audio_PlaySoundAtPosition(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); diff --git a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c index 2756b12003..d1a6afb3e2 100644 --- a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c +++ b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c @@ -40,7 +40,7 @@ void TGSw_ActionDecider(TGSw* this, GlobalContext* globalCtx) { scaledAbsoluteRotY = ABS_ALT(this->actor.world.rot.y) * 4.0f; scaledAbsoluteRotZ = ABS_ALT(this->actor.world.rot.z) * 4.0f; - if ((scaledAbsoluteRotZ < this->actor.xzDistToPlayer) || (scaledAbsoluteRotY < this->actor.yDistToPlayer)) { + if ((scaledAbsoluteRotZ < this->actor.xzDistToPlayer) || (scaledAbsoluteRotY < this->actor.playerHeightRel)) { return; } unk1F4 = globalCtx->actorCtx.unk1F4; diff --git a/tools/actorfixer.py b/tools/actorfixer.py index 24e0d0ad5a..e1815e2241 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -187,6 +187,8 @@ animdict = { "skelAnime.prevFrameRot": "skelAnime.prevRot", "skelAnime.prevFramePos": "skelAnime.prevTransl", "skelAnime.unk3E": "skelAnime.baseTransl", + "actor.yDistToWater" : "actor.depthInWater", + "actor.yDistToPlayer" : "actor.playerHeightRel", } def replace_anim(file):