1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 14:31:17 +00:00

Match retail En actors V-Z (#1825)

* Entity actors starting with Z

* Use CS_STATE_IDLE

* z -> playerPosZ

* Remove comment
This commit is contained in:
cadmic 2024-02-26 18:29:40 -08:00 committed by GitHub
parent 769986874c
commit cdd24f2ac6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 184 additions and 100 deletions

View file

@ -412,9 +412,12 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, P
s16 curLoopPlatform = PLATFORM_INDEX_DOWNSTAIRS_INNER_MAX; // Will never retreat to the last two
s16 minIndex = PLATFORM_INDEX_DOWNSTAIRS_MIN;
f32 largeMaxRange = 99999.0f;
s16 altNextPlatform = -1;
s16 nextPlatform = -1;
s16 playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, initialPlatform);
s16 nextPlatform;
s16 altNextPlatform;
s16 playerPlatform;
altNextPlatform = nextPlatform = -1;
playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, initialPlatform);
// Set up search constraints
// Upstairs
@ -436,9 +439,12 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, P
if ((curLoopPlatform == initialPlatform) || (curLoopPlatform == playerPlatform)) {
continue;
}
if ((playerPlatform == -1) &&
(Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]) < playerMaxDist)) {
continue;
if (playerPlatform == -1) {
s16 pad;
if (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]) < playerMaxDist) {
continue;
}
}
distToCurLoopPlatform = Math_Vec3f_DistXYZ(pos, &sPlatformPositions[curLoopPlatform]);
@ -490,6 +496,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl
f32 largeMaxRange = 99999.0f;
s16 phi_s2 = curPlatform;
s16 phi_s3 = arg2;
f32 curPlatformDistToPlayer;
// Upstairs
if (pos->y > 200.0f) {
@ -503,7 +510,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl
continue;
}
if (curLoopPlatform != nextPlatform) {
f32 curPlatformDistToPlayer =
curPlatformDistToPlayer =
Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]);
if (curPlatformDistToPlayer < smallMaxRange) {
@ -1783,27 +1790,31 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) {
if (this->unk_3F8) {
this->actor.speed = -this->actor.speed;
}
} else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) ||
!Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
if (this->actor.speed >= 0.0f) {
phi_v0_4 = this->actor.shape.rot.y + 0x3FFF;
} else {
s16 pad;
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) ||
!Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
if (this->actor.speed >= 0.0f) {
phi_v0_4 = this->actor.shape.rot.y + 0x3FFF;
} else {
phi_v0_4 = this->actor.shape.rot.y - 0x3FFF;
}
phi_v0_4 = this->actor.wallYaw - phi_v0_4;
} else {
phi_v0_4 = this->actor.shape.rot.y - 0x3FFF;
this->actor.speed *= -0.8f;
phi_v0_4 = 0;
}
phi_v0_4 = this->actor.wallYaw - phi_v0_4;
} else {
this->actor.speed *= -0.8f;
phi_v0_4 = 0;
}
if (ABS(phi_v0_4) > 0x4000) {
this->actor.speed *= -0.8f;
if (this->actor.speed < 0.0f) {
this->actor.speed -= 0.5f;
} else {
this->actor.speed += 0.5f;
if (ABS(phi_v0_4) > 0x4000) {
this->actor.speed *= -0.8f;
if (this->actor.speed < 0.0f) {
this->actor.speed -= 0.5f;
} else {
this->actor.speed += 0.5f;
}
}
}
}
@ -1873,6 +1884,8 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) {
} else if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) && (D_80B4A1B4 == this->actor.params)) {
EnZf_SetupHopAndTaunt(this);
} else {
s16 pad;
this->actor.world.rot.y = this->actor.shape.rot.y;
if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) &&
@ -1889,10 +1902,8 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) {
this->unk_3F0--;
}
if (prevFrame != (s32)this->skelAnime.curFrame) {
s32 afterPrevFrame = absPlaySpeed + prevFrame;
if (((beforeCurFrame < 14) && (afterPrevFrame >= 16)) ||
((beforeCurFrame < 27) && (afterPrevFrame >= 29))) {
if (((beforeCurFrame < 14) && (absPlaySpeed + prevFrame >= 16)) ||
((beforeCurFrame < 27) && (absPlaySpeed + prevFrame >= 29))) {
Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK);
}
}