From a32221c36e955642d2da5a8314376dbf4c2e07c6 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 26 Feb 2024 23:30:42 -0800 Subject: [PATCH] Match retail z_en_ds.c, z_en_horse.c, z_en_fhg_fire.c (#1897) * Actually match z_en_ds.c * Match z_en_horse.c * Match z_en_fhg_fire.c --- src/overlays/actors/ovl_En_Ds/z_en_ds.c | 2 ++ .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 14 +++++---- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 30 +++++++++---------- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index 05c4c1a783..3d8e0e57ce 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -215,6 +215,8 @@ void EnDs_Wait(EnDs* this, PlayState* play) { player->actor.textId = 0x500C; this->actionFunc = EnDs_OfferBluePotion; } else { + s16 pad; + if (INV_CONTENT(ITEM_ODD_MUSHROOM) == ITEM_ODD_MUSHROOM) { player->actor.textId = 0x5049; } else { diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index f483481622..e079c8194e 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -283,7 +283,6 @@ void EnFhgFire_LightningTrail(EnFhgFire* this, PlayState* play) { void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f pos; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; @@ -291,7 +290,8 @@ void EnFhgFire_LightningShock(EnFhgFire* this, PlayState* play) { } if (Rand_ZeroOne() < 0.5f) { - pos = this->actor.world.pos; + Vec3f pos = this->actor.world.pos; + pos.y -= 20.0f; EffectSsFhgFlash_SpawnShock(play, &this->actor, &pos, 200, FHGFLASH_SHOCK_NO_ACTOR); } @@ -447,7 +447,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { Actor_SetScale(&this->actor, 5.25f); } this->actor.shape.rot.z += (s16)(Rand_ZeroOne() * 0x4E20) + 0x4000; - { + if (1) { u8 lightBallColor1 = FHGFLASH_LIGHTBALL_GREEN; s16 i1; Vec3f spD4; @@ -527,7 +527,9 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { &gSfxDefaultReverb); Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); } - } else if (sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f) { + break; + } + if (sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f) { killMode = BALL_BURST; Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_HIT_THUNDER); if ((bossGnd->flyMode >= GND_FLY_VOLLEY) && (this->work[FHGFIRE_RETURN_COUNT] >= 2)) { @@ -642,7 +644,6 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play) { EnfHG* horse = (EnfHG*)this->actor.parent; - f32 scrollDirection; this->fwork[FHGFIRE_WARP_TEX_1_X] += 25.0f * this->fwork[FHGFIRE_WARP_TEX_SPEED]; this->fwork[FHGFIRE_WARP_TEX_1_Y] -= 40.0f * this->fwork[FHGFIRE_WARP_TEX_SPEED]; @@ -662,7 +663,8 @@ void EnFhgFire_PhantomWarp(EnFhgFire* this, PlayState* play) { } if (this->work[FHGFIRE_TIMER] > 50) { - scrollDirection = 1.0f; + f32 scrollDirection = 1.0f; + if (this->actor.params > FHGFIRE_WARP_EMERGE) { scrollDirection = -1.0f; } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 351b29267a..20324e670a 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -529,14 +529,13 @@ void EnHorse_RotateToPoint(EnHorse* this, PlayState* play, Vec3f* pos, s16 turnA void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceInfo) { Vec3f curWaypointPos; Vec3f prevWaypointPos; - f32 playerDist; + s32 prevWaypoint; f32 sp50; s16 relPlayerYaw; f32 px; f32 pz; f32 d; f32 distSq; - s32 prevWaypoint; EnHorse_RaceWaypointPos(raceInfo->waypoints, this->curRaceWaypoint, &curWaypointPos); Math3D_RotateXZPlane(&curWaypointPos, raceInfo->waypoints[this->curRaceWaypoint].angle, &px, &pz, &d); @@ -559,14 +558,15 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceIn EnHorse_RotateToPoint(this, play, &curWaypointPos, 400); if (distSq < SQ(300.0f)) { - playerDist = this->actor.xzDistToPlayer; - if (playerDist < 130.0f || this->jntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { + if (this->actor.xzDistToPlayer < 130.0f || this->jntSph.elements[0].base.ocElemFlags & OCELEM_HIT) { + s32 pad; + if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) { this->actor.world.rot.y -= 280; } else { this->actor.world.rot.y += 280; } - } else if (playerDist < 300.0f) { + } else if (this->actor.xzDistToPlayer < 300.0f) { if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) { this->actor.world.rot.y += 280; } else { @@ -1320,8 +1320,7 @@ void EnHorse_MountedTrot(EnHorse* this, PlayState* play) { } void EnHorse_StartGallopingInterruptable(EnHorse* this) { - this->noInputTimerMax = 0; - this->noInputTimer = 0; + this->noInputTimerMax = this->noInputTimer = 0; EnHorse_StartGalloping(this); } @@ -1334,8 +1333,7 @@ void EnHorse_StartGalloping(EnHorse* this) { } void EnHorse_MountedGallopReset(EnHorse* this) { - this->noInputTimerMax = 0; - this->noInputTimer = 0; + this->noInputTimerMax = this->noInputTimer = 0; this->action = ENHORSE_ACT_MOUNTED_GALLOP; this->animationIdx = ENHORSE_ANIM_GALLOP; this->unk_234 = 0; @@ -1498,8 +1496,7 @@ void EnHorse_Stopping(EnHorse* this, PlayState* play) { } void EnHorse_StartReversingInterruptable(EnHorse* this) { - this->noInputTimerMax = 0; - this->noInputTimer = 0; + this->noInputTimerMax = this->noInputTimer = 0; EnHorse_StartReversing(this); } @@ -1906,7 +1903,6 @@ void EnHorse_SetFollowAnimation(EnHorse* this, PlayState* play) { void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { f32 distToPlayer; - f32 angleDiff; R_EPONAS_SONG_PLAYED = false; distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(play)->actor); @@ -1914,6 +1910,8 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { // First rotate if the player is behind if ((this->playerDir == PLAYER_DIR_BACK_R || this->playerDir == PLAYER_DIR_BACK_L) && (distToPlayer > 300.0f && !(this->stateFlags & ENHORSE_TURNING_TO_PLAYER))) { + f32 angleDiff; + this->animationIdx = ENHORSE_ANIM_REARING; this->stateFlags |= ENHORSE_TURNING_TO_PLAYER; this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); @@ -2182,6 +2180,8 @@ void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { f32 temp_f2; + Vec3s* jointTable; + f32 y; if (this->cutsceneFlags & 1) { EnHorse_CsMoveToPoint(this, play, cue); @@ -2210,9 +2210,6 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* cue) { } if (SkelAnime_Update(&this->skin.skelAnime) || (temp_f2 > 19.0f && this->actor.world.pos.y < (this->actor.floorHeight - this->actor.velocity.y) + 80.0f)) { - Vec3s* jointTable; - f32 y; - this->cutsceneFlags |= 1; Audio_PlaySfxGeneral(NA_SE_EV_HORSE_LAND, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -3411,8 +3408,9 @@ void EnHorse_UpdatePlayerDir(EnHorse* this, PlayState* play) { s16 angle; f32 s; f32 c; + Player* player = GET_PLAYER(play); - angle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor) - this->actor.world.rot.y; + angle = Actor_WorldYawTowardActor(&this->actor, &player->actor) - this->actor.world.rot.y; s = Math_SinS(angle); c = Math_CosS(angle); if (s > 0.8660254f) { // sin(60 degrees)