1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +00:00

Document en_ba damage bug (#1934)

* comment on en_ba collision bug

* format
This commit is contained in:
fig02 2024-03-29 11:27:34 -04:00 committed by GitHub
parent 4e1b0f6694
commit 86bd6e9232
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -235,6 +235,7 @@ void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) {
s16 phi_fp;
Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 60.0f, 1.0f, 10.0f, 0.0f);
if ((this->actor.xzDistToPlayer <= 175.0f) || (this->unk_31A != 0)) {
if (this->unk_318 == 20) {
Actor_PlaySfx(&this->actor, NA_SE_EN_BALINADE_HAND_UP);
@ -300,16 +301,22 @@ void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) {
}
this->unk_2A8[13].x = this->unk_2A8[12].x;
this->unk_2A8[13].y = this->unk_2A8[12].y;
//! @bug This code being located here gives multiple opportunities for the current action to change
//! before damage handling can be done.
//! By, for example, taking damage on the same frame the collider contacts Player, a different action
//! will run and `AT_HIT` will remain set. Then when returning back to this action, Player
//! will get knocked back instantly, even though there was no apparent collision.
//! Handling `AT_HIT` directly in Update, where it can run every frame, would help catch these edge cases.
if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~AT_HIT;
if (this->collider.base.at == &player->actor) {
func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f);
}
}
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
return;
}
if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & PLAYER_STATE1_26)) {
} else if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & PLAYER_STATE1_26)) {
EnBa_SetupIdle(this);
} else {
EnBa_SetupSwingAtPlayer(this);