diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index f5067551ee..2af1c67aa2 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -83,16 +83,16 @@ static ColliderCylinderInit sCylinderInit = { { 30, 52, 0, { 0, 0, 0 } }, }; -static s32 sAlreadySpawned = 0; +static s32 sAlreadySpawned = false; static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_DAMPES_GHOST, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 1500, ICHAIN_STOP), }; -static Vec3f sDissapearParticlesVelocity = { 0.0f, 1.5f, 0.0f }; +static Vec3f sDisappearParticlesVelocity = { 0.0f, 1.5f, 0.0f }; -static Vec3f sDissapearParticlesAccel = { 0.0f, 0.0f, 0.0f }; +static Vec3f sDisappearParticlesAccel = { 0.0f, 0.0f, 0.0f }; // the offset (in model space) from the position of the lantern limb and the position of the actual light static Vec3f sLanternLightOffset = { 0.0f, 1200.0f, 0.0f }; @@ -145,7 +145,7 @@ void EnPoRelay_Destroy(Actor* thisx, PlayState* play) { void EnPoRelay_SetupIdle(EnPoRelay* this) { this->bobTimer = 32; - this->pathIndex = 0; + this->pathPoint = 0; // does not despawn upon room transitions this->actor.room = -1; @@ -165,11 +165,11 @@ void EnPoRelay_Vec3sToVec3f(Vec3f* dest, Vec3s* src) { void EnPoRelay_SetupRace(EnPoRelay* this) { Vec3f vec; - EnPoRelay_Vec3sToVec3f(&vec, &sPathPoints[this->pathIndex]); + EnPoRelay_Vec3sToVec3f(&vec, &sPathPoints[this->pathPoint]); this->actionTimer = ((s16)(this->actor.shape.rot.y - this->actor.world.rot.y - 0x8000) >> 0xB) % 32U; Interface_SetTimer(0); this->hookshotSlotFull = INV_CONTENT(ITEM_HOOKSHOT) != ITEM_NONE; - this->yawTowardsNode = Actor_WorldYawTowardPoint(&this->actor, &vec); + this->yawTowardsPathPoint = Actor_WorldYawTowardPoint(&this->actor, &vec); this->actor.flags |= ACTOR_FLAG_LOCK_ON_DISABLED; Actor_PlaySfx(&this->actor, NA_SE_EN_PO_LAUGH); this->actionFunc = EnPoRelay_Race; @@ -185,7 +185,7 @@ void EnPoRelay_SetupEndRace(EnPoRelay* this) { void EnPoRelay_CorrectY(EnPoRelay* this) { Math_StepToF( &this->actor.home.pos.y, - sPathPoints[(this->pathIndex >= ARRAY_COUNT(sPathPoints)) ? ARRAY_COUNT(sPathPoints) - 1 : this->pathIndex].y + + sPathPoints[(this->pathPoint >= ARRAY_COUNT(sPathPoints)) ? ARRAY_COUNT(sPathPoints) - 1 : this->pathPoint].y + 45.0f, 2.0f); this->actor.world.pos.y = Math_SinS(this->bobTimer * 0x800) * 8.0f + this->actor.home.pos.y; @@ -228,7 +228,7 @@ void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { // it checks again the next frame without waiting the 32 frames if (this->actionTimer == 0 && Rand_ZeroOne() < 0.03f) { this->actionTimer = 32; - if (this->pathIndex < 23) { + if (this->pathPoint < 23) { speedXZ = Rand_ZeroOne() * 3.0f; if (speedXZ < 1.0f) { multiplier = 1.0f; @@ -239,17 +239,17 @@ void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { } speedXZ = 30.0f * multiplier; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HONOTRAP, - Math_CosS(this->yawTowardsNode) * speedXZ + this->actor.world.pos.x, this->actor.world.pos.y, - Math_SinS(this->yawTowardsNode) * speedXZ + this->actor.world.pos.z, 0, - (this->yawTowardsNode + 0x8000) - (0x2000 * multiplier), 0, HONOTRAP_TYPE_FLAME_DROP); + Math_CosS(this->yawTowardsPathPoint) * speedXZ + this->actor.world.pos.x, this->actor.world.pos.y, + Math_SinS(this->yawTowardsPathPoint) * speedXZ + this->actor.world.pos.z, 0, + (this->yawTowardsPathPoint + 0x8000) - (0x2000 * multiplier), 0, HONOTRAP_TYPE_FLAME_DROP); } } - Math_SmoothStepToS(&this->actor.world.rot.y, this->yawTowardsNode, 2, 0x1000, 0x100); + Math_SmoothStepToS(&this->actor.world.rot.y, this->yawTowardsPathPoint, 2, 0x1000, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y + (this->actionTimer * 0x800) + 0x8000; - if (this->pathIndex < 23) { - //! @bug Dampé's speed is directly proportional to the player's speed when more than 300 units away from the - //! player and not in the branching paths, so if the player is going backwards; by HESSing, backwalking, etc., - //! Dampé will also move backwards, away from the next node in the path rather than towards it + if (this->pathPoint < 23) { + //! @bug Dampé's speed is directly proportional to the player's speed when less than 300 units away from the + //! player and not in the branching paths, so if the player's speed is negative (by HESSing or similar), + //! Dampé will also move backwards, away from the next path point rather than towards it // If the player travels along a different path to Dampé that converges later if ((Math3D_PointInSquare2D(660.0f, 840.0f, -4480.0f, -3760.0f, player->actor.world.pos.x, @@ -275,27 +275,21 @@ void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { } else { Math_ApproachF(&this->actor.speed, 3.5f, 0.5f, 1.5f); } - EnPoRelay_Vec3sToVec3f(&vec, &sPathPoints[this->pathIndex]); + EnPoRelay_Vec3sToVec3f(&vec, &sPathPoints[this->pathPoint]); if (Actor_WorldDistXZToPoint(&this->actor, &vec) < 40.0f) { - this->pathIndex++; - EnPoRelay_Vec3sToVec3f(&vec, &sPathPoints[this->pathIndex]); - if (this->pathIndex == ARRAY_COUNT(sPathPoints)) { + this->pathPoint++; + EnPoRelay_Vec3sToVec3f(&vec, &sPathPoints[this->pathPoint]); + if (this->pathPoint == ARRAY_COUNT(sPathPoints)) { EnPoRelay_SetupEndRace(this); - - // first door - } else if (this->pathIndex == 9) { + } else if (this->pathPoint == 9) { // first door Flags_SetSwitch(play, 0x35); - - // second door - } else if (this->pathIndex == 17) { + } else if (this->pathPoint == 17) { // second door Flags_SetSwitch(play, 0x36); - - // third door - } else if (this->pathIndex == 25) { + } else if (this->pathPoint == 25) { // third door Flags_SetSwitch(play, 0x37); } } - this->yawTowardsNode = Actor_WorldYawTowardPoint(&this->actor, &vec); + this->yawTowardsPathPoint = Actor_WorldYawTowardPoint(&this->actor, &vec); Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_PO_AWAY - SFX_FLAG); } @@ -352,15 +346,15 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play) { vec.x = (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f) + this->actor.world.pos.x; vec.z = (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4800) * 23.0f) + this->actor.world.pos.z; } - EffectSsDeadDb_Spawn(play, &vec, &sDissapearParticlesVelocity, &sDissapearParticlesAccel, + EffectSsDeadDb_Spawn(play, &vec, &sDisappearParticlesVelocity, &sDisappearParticlesAccel, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); vec.x = (this->actor.world.pos.x + this->actor.world.pos.x) - vec.x; vec.z = (this->actor.world.pos.z + this->actor.world.pos.z) - vec.z; - EffectSsDeadDb_Spawn(play, &vec, &sDissapearParticlesVelocity, &sDissapearParticlesAccel, + EffectSsDeadDb_Spawn(play, &vec, &sDisappearParticlesVelocity, &sDisappearParticlesAccel, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); vec.x = this->actor.world.pos.x; vec.z = this->actor.world.pos.z; - EffectSsDeadDb_Spawn(play, &vec, &sDissapearParticlesVelocity, &sDissapearParticlesAccel, + EffectSsDeadDb_Spawn(play, &vec, &sDisappearParticlesVelocity, &sDisappearParticlesAccel, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); if (this->actionTimer == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_EXTINCT); diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h index bf5d9a5c34..2fa0536885 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h @@ -17,8 +17,8 @@ typedef struct EnPoRelay { /* 0x0194 */ u8 hookshotSlotFull; /* 0x0195 */ u8 bobTimer; // used for the up & down bobbing /* 0x0196 */ s16 actionTimer; - /* 0x0198 */ s16 pathIndex; // current (upcoming) node of the path - /* 0x019A */ s16 yawTowardsNode; // yaw towards the current (upcoming) node of the path + /* 0x0198 */ s16 pathPoint; // current (upcoming) path point + /* 0x019A */ s16 yawTowardsPathPoint; // yaw towards the current (upcoming) path point /* 0x019C */ u16 textId; // mirrors actor.textId /* 0x019E */ u16 eyeTextureIdx; /* 0x01A0 */ Vec3s jointTable[LIMB_OBJECT_TK_00BE40_MAX];