From b86fa4459148d3be5794d0edd7c6047d32b75617 Mon Sep 17 00:00:00 2001 From: feacur Date: Wed, 6 Nov 2024 12:42:12 +0100 Subject: [PATCH] Document `func_80034DD4` @ `z_actor.c` new name: `Actor_SmoothStep_Attention` --- include/z64actor.h | 2 +- src/code/z_actor.c | 16 ++++++++-------- src/overlays/actors/ovl_En_Md/z_en_md.c | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index 228de4bcd6..bc81567d01 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -916,7 +916,7 @@ void func_80034BA0(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDra PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); void func_80034CC4(struct PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s16 alpha); -s16 func_80034DD4(Actor* actor, struct PlayState* play, s16 arg2, f32 arg3); +s16 Actor_SmoothStep_Attention(Actor* actor, struct PlayState* play, s16 alpha, f32 threshold); void func_80034F54(struct PlayState* play, s16* arg1, s16* arg2, s32 arg3); void Actor_Noop(Actor* actor, struct PlayState* play); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index e91ab50d84..7c9eecd4d4 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4396,25 +4396,25 @@ void func_80034CC4(PlayState* play, SkelAnime* skelAnime, OverrideLimbDraw overr CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8904); } -s16 func_80034DD4(Actor* actor, PlayState* play, s16 arg2, f32 arg3) { +s16 Actor_SmoothStep_Attention(Actor* actor, PlayState* play, s16 alpha, f32 threshold) { Player* player = GET_PLAYER(play); - f32 var; + f32 distance; if ((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) { - var = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f; + distance = Math_Vec3f_DistXYZ(&actor->world.pos, &play->view.eye) * 0.25f; } else { - var = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); + distance = Math_Vec3f_DistXYZ(&actor->world.pos, &player->actor.world.pos); } - if (arg3 < var) { + if (threshold < distance) { actor->flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - Math_SmoothStepToS(&arg2, 0, 6, 0x14, 1); + Math_SmoothStepToS(&alpha, 0, 6, 0x14, 1); } else { actor->flags |= ACTOR_FLAG_ATTENTION_ENABLED; - Math_SmoothStepToS(&arg2, 0xFF, 6, 0x14, 1); + Math_SmoothStepToS(&alpha, 0xFF, 6, 0x14, 1); } - return arg2; + return alpha; } void Animation_ChangeByInfo(SkelAnime* skelAnime, AnimationInfo* animationInfo, s32 index) { diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 547adf9e1c..3ad765f8da 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -658,7 +658,7 @@ void func_80AAB5A4(EnMd* this, PlayState* play) { (play->sceneId == SCENE_KOKIRI_FOREST)) ? 100.0f : 400.0f; - this->alpha = func_80034DD4(&this->actor, play, this->alpha, temp); + this->alpha = Actor_SmoothStep_Attention(&this->actor, play, this->alpha, temp); this->actor.shape.shadowAlpha = this->alpha; } else { this->alpha = 255; diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 72eba29b61..2952755558 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -738,7 +738,7 @@ void EnSa_Update(Actor* thisx, PlayState* play) { } if (this->actionFunc != func_80AF68E4) { - this->alpha = func_80034DD4(&this->actor, play, this->alpha, 400.0f); + this->alpha = Actor_SmoothStep_Attention(&this->actor, play, this->alpha, 400.0f); } else { this->alpha = 255; }