From 9305a7145809454ece3a8b049dec9d71363006f8 Mon Sep 17 00:00:00 2001 From: Leonid Kapitonov Date: Mon, 9 Dec 2024 14:06:05 +0100 Subject: [PATCH] Document Mido functions, fields, and animations (#2289) * Document `func_80AAA250` new name: `EnMd_ReverseAnimation` * rename `enum EnMdAnimation` > `enum EnMdAnimIndex` * Document `struct EnMd` fields (and functions) the list: * `func_80AAAC78` -> `EnMd_TrackMessageState` * `func_80AAAA24` -> `EnMd_UpdateAnimState_WithTalking` * `func_80AAA92C` -> `EnMd_SetAnimState` * `func_80AAA93C` -> `EnMd_UpdateAnimState` * `func_80AAA274` -> `EnMd_UpdateAnimState1` * `func_80AAA308` -> `EnMd_UpdateAnimState2` * `func_80AAA39C` -> `EnMd_UpdateAnimState3` * `func_80AAA474` -> `EnMd_UpdateAnimState4` * `func_80AAA508` -> `EnMd_UpdateAnimState5` * `func_80AAA5A4` -> `EnMd_UpdateAnimState6` * `func_80AAA638` -> `EnMd_UpdateAnimState7` * `func_80AAA6D4` -> `EnMd_UpdateAnimState8` * `func_80AAA768` -> `EnMd_UpdateAnimState9` * `func_80AAA7FC` -> `EnMd_UpdateAnimState10` * `func_80AAA890` -> `EnMd_UpdateAnimState11` * Document `func_80AAB158` new name: `EnMd_UpdateTalking` * Document `func_80034DD4` @ `z_actor.c` new name: `Actor_SmoothStep_Attention` * Document `func_80AAB5A4` new name: `EnMd_SmoothStep_Attention` * Document Mido's action functions the list: * `func_80AAB874` -> `EnMd_Idle` * `func_80AAB8F8` -> `EnMd_Watch` * `func_80AAB948` -> `EnMd_BlockPath` * `func_80AABC10` -> `EnMd_ListenToOcarina` * `func_80AABD0C` -> `EnMd_Walk` * rename flag `temp2` -> `canUpdateTalking` * (re)document Mido's animations via blender and fast64 * marginally improve comments * marginally improve comments * actually, yes, let's name action functions as such * Document eye textures as an enum to clarify for `EnMd_UpdateEyes` * rename `eyeIdx` -> `eyeTexIndex` Mido has two eyes and different textures for them * Undocument eye textures as an enum i was wrong: `_Draw` function might not follow the eyes texture order it is its own thing, like `enum EnMdBlinking` or nothing at all, yeah * ugh, and fix a typo with blinking rushing is no good * drop the `Action` suffix https://github.com/zeldaret/oot/pull/2289#discussion_r1837272286 * rename animation states as sequences https://github.com/zeldaret/oot/pull/2289#discussion_r1837274923 * `func_80034DD4` -> `Actor_FadeInOut` https://github.com/zeldaret/oot/pull/2289#discussion_r1837267267 * rename animation states as sequences a continuation of b11a9e9942e1725824e54099f84085ff2165e854 * `func_80034DD4` -> `Actor_UpdateAlphaByDistance` https://github.com/zeldaret/oot/pull/2289#discussion_r1838398475 * clarify a comment * Document `actor.params` bits allocation * apply review suggestions * apply review suggestions * apply review suggestions * apply review suggestions * apply review suggestions --- assets/xml/objects/object_md.xml | 22 +- include/z64actor.h | 2 +- src/code/z_actor.c | 16 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 471 ++++++++++++------------ src/overlays/actors/ovl_En_Md/z_en_md.h | 15 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 2 +- 6 files changed, 275 insertions(+), 253 deletions(-) diff --git a/assets/xml/objects/object_md.xml b/assets/xml/objects/object_md.xml index 717443537a..45527ca1b9 100644 --- a/assets/xml/objects/object_md.xml +++ b/assets/xml/objects/object_md.xml @@ -71,17 +71,17 @@ - - - - - - - - - - + + + + + + + + + + - + diff --git a/include/z64actor.h b/include/z64actor.h index 0f047549ef..344f5e15ce 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -936,7 +936,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_UpdateAlphaByDistance(Actor* actor, struct PlayState* play, s16 alpha, f32 radius); void Actor_UpdateFidgetTables(struct PlayState* play, s16* fidgetTableY, s16* fidgetTableZ, s32 tableLen); void Actor_Noop(Actor* actor, struct PlayState* play); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 4fc55d7a87..9e258450d7 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4407,25 +4407,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_UpdateAlphaByDistance(Actor* actor, PlayState* play, s16 alpha, f32 radius) { 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 (radius < 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 ea9219c8b0..fc0a21642f 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -15,11 +15,11 @@ void EnMd_Destroy(Actor* thisx, PlayState* play); void EnMd_Update(Actor* thisx, PlayState* play); void EnMd_Draw(Actor* thisx, PlayState* play); -void func_80AAB874(EnMd* this, PlayState* play); -void func_80AAB8F8(EnMd* this, PlayState* play); -void func_80AAB948(EnMd* this, PlayState* play); -void func_80AABC10(EnMd* this, PlayState* play); -void func_80AABD0C(EnMd* this, PlayState* play); +void EnMd_Idle(EnMd* this, PlayState* play); +void EnMd_Watch(EnMd* this, PlayState* play); +void EnMd_BlockPath(EnMd* this, PlayState* play); +void EnMd_ListenToOcarina(EnMd* this, PlayState* play); +void EnMd_Walk(EnMd* this, PlayState* play); ActorProfile En_Md_Profile = { /**/ ACTOR_EN_MD, @@ -55,41 +55,56 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -typedef enum EnMdAnimation { - /* 0 */ ENMD_ANIM_0, - /* 1 */ ENMD_ANIM_1, - /* 2 */ ENMD_ANIM_2, - /* 3 */ ENMD_ANIM_3, - /* 4 */ ENMD_ANIM_4, - /* 5 */ ENMD_ANIM_5, - /* 6 */ ENMD_ANIM_6, - /* 7 */ ENMD_ANIM_7, - /* 8 */ ENMD_ANIM_8, - /* 9 */ ENMD_ANIM_9, - /* 10 */ ENMD_ANIM_10, - /* 11 */ ENMD_ANIM_11, - /* 12 */ ENMD_ANIM_12, - /* 13 */ ENMD_ANIM_13 -} EnMdAnimation; +typedef enum EnMdAnimSequence { + /* 0x0 */ ENMD_ANIM_SEQ_NONE, + /* 0x1 */ ENMD_ANIM_SEQ_IDLE_TO_HALT, // hands on hips -> halt gesture + /* 0x2 */ ENMD_ANIM_SEQ_HALT_TO_CURIOUS, // halt gesture -> tilted head + /* 0x3 */ ENMD_ANIM_SEQ_WALK_AWAY, // stop halt gesture -> start walking -> walking + /* 0x4 */ ENMD_ANIM_SEQ_TWITCH_IDLE_UNUSED, // start walking -> hands on hips; never set + /* 0x5 */ ENMD_ANIM_SEQ_HALT_TO_IDLE, // halt gesture -> hands on hips + /* 0x6 */ ENMD_ANIM_SEQ_SURPRISE_TO_ANNOYED, // slightly raise arms from hips -> look away + /* 0x7 */ ENMD_ANIM_SEQ_SURPRISE_TO_IDLE, // lower slightly raised arms to hips -> hands on hips + /* 0x8 */ ENMD_ANIM_SEQ_CURIOUS_TO_ANNOYED, // tilted head and *slam* -> looking away + /* 0x9 */ ENMD_ANIM_SEQ_ANNOYED_TO_HALT, // looking away -> halt gesture + /* 0xA */ ENMD_ANIM_SEQ_IDLE_TO_ANNOYED, // hands on hips -> looking away + /* 0xB */ ENMD_ANIM_SEQ_STOP_WALKING // stop walking -> hands on hips +} EnMdAnimSequence; + +typedef enum EnMdAnimIndex { + /* 0 */ ENMD_ANIM_INDEX_IDLE_DEFAULT, // hands on hips; default idle + /* 1 */ ENMD_ANIM_INDEX_IDLE_UNUSED, // hands on hips; never set + /* 2 */ ENMD_ANIM_INDEX_IDLE_TO_HALT, // hands on hips -> halt gesture + /* 3 */ ENMD_ANIM_INDEX_HALT, // halt gesture + /* 4 */ ENMD_ANIM_INDEX_HALT_TO_CURIOUS, // halt gesture -> tilted head + /* 5 */ ENMD_ANIM_INDEX_CURIOUS, // tilted head + /* 6 */ ENMD_ANIM_INDEX_ANNOYED, // looking away + /* 7 */ ENMD_ANIM_INDEX_IDLE_TO_WALK, // hands on hips -> walking + /* 8 */ ENMD_ANIM_INDEX_WALK, // walking + /* 9 */ ENMD_ANIM_INDEX_IDLE_TO_SURPISE, // hands on hips -> slightly raised arms + /* 10 */ ENMD_ANIM_INDEX_IDLE, // hands on hips + /* 11 */ ENMD_ANIM_INDEX_CURIOUS_TO_ANNOYED, // tilted head -> looking away + /* 12 */ ENMD_ANIM_INDEX_ANNOYED_TO_HALT, // looking away -> halt gesture + /* 13 */ ENMD_ANIM_INDEX_IDLE_TO_ANNOYED // hands on hips -> looking away +} EnMdAnimIndex; static AnimationInfo sAnimationInfo[] = { - { &gMidoHandsOnHipsIdleAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, - { &gMidoHandsOnHipsIdleAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, - { &gMidoRaiseHand1Anim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { &gMidoIdleAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, + { &gMidoIdleAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, + { &gMidoIdleToHaltAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { &gMidoHaltAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, - { &gMidoPutHandDownAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, - { &gMidoAnnoyedPointedHeadIdle1Anim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, - { &gMidoAnnoyedPointedHeadIdle2Anim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, - { &gMidoAnim_92B0, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, - { &gMidoWalkingAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, - { &gMidoHandsOnHipsTransitionAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, - { &gMidoHandsOnHipsIdleAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, - { &gMidoSlamAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, - { &gMidoRaiseHand2Anim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, - { &gMidoAngryHeadTurnAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { &gMidoHaltToCuriousAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { &gMidoCuriousAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { &gMidoAnnoyedAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { &gMidoIdleToWalkAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { &gMidoWalkAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { &gMidoIdleToSurpriseAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { &gMidoIdleAnim, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, + { &gMidoCuriousToAnnoyedAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { &gMidoAnnoyedToHaltAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { &gMidoIdleToAnnoyedAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, }; -void func_80AAA250(EnMd* this) { +void EnMd_ReverseAnimation(EnMd* this) { f32 startFrame; startFrame = this->skelAnime.startFrame; @@ -99,289 +114,290 @@ void func_80AAA250(EnMd* this) { this->skelAnime.playSpeed = -1.0f; } -void func_80AAA274(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_IdleToHalt(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_2); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_3); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT); + this->animSequenceEntry++; } break; } } -void func_80AAA308(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_HaltToCurious(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_4); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT_TO_CURIOUS); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_5); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS); + this->animSequenceEntry++; } break; } } -void func_80AAA39C(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_WalkAway(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_2); - func_80AAA250(this); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); + EnMd_ReverseAnimation(this); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_7); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); + this->animSequenceEntry++; } else { break; } FALLTHROUGH; case 2: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_8); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_WALK); + this->animSequenceEntry++; } break; } } -void func_80AAA474(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_TwitchIdle_Unused(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_7); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + this->animSequenceEntry++; } break; } } -void func_80AAA508(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_HaltToIdle(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_2); - func_80AAA250(this); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); + EnMd_ReverseAnimation(this); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + this->animSequenceEntry++; } break; } } -void func_80AAA5A4(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_SurpriseToAnnoyed(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_9); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_6); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); + this->animSequenceEntry++; } break; } } -void func_80AAA638(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_SurpriseToIdle(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_9); - func_80AAA250(this); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); + EnMd_ReverseAnimation(this); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + this->animSequenceEntry++; } break; } } -void func_80AAA6D4(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_CuriousToAnnoyed(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_11); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS_TO_ANNOYED); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_6); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); + this->animSequenceEntry++; } break; } } -void func_80AAA768(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_AnnoyedToHalt(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_12); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED_TO_HALT); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_3); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT); + this->animSequenceEntry++; } break; } } -void func_80AAA7FC(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_IdleToAnnoyed(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_13); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_ANNOYED); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_6); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); + this->animSequenceEntry++; } break; } } -void func_80AAA890(EnMd* this) { - switch (this->unk_20A) { +void EnMd_UpdateAnimSequence_StopWalking(EnMd* this) { + switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_7); - func_80AAA250(this); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); + EnMd_ReverseAnimation(this); + this->animSequenceEntry++; FALLTHROUGH; case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); - this->unk_20A++; + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + this->animSequenceEntry++; } break; } } -void func_80AAA92C(EnMd* this, u8 arg1) { - this->unk_20B = arg1; - this->unk_20A = 0; +void EnMd_SetAnimSequence(EnMd* this, u8 state) { + this->animSequence = state; + this->animSequenceEntry = 0; } -void func_80AAA93C(EnMd* this) { - switch (this->unk_20B) { - case 1: - func_80AAA274(this); +void EnMd_UpdateAnimSequence(EnMd* this) { + switch (this->animSequence) { + case ENMD_ANIM_SEQ_IDLE_TO_HALT: + EnMd_UpdateAnimSequence_IdleToHalt(this); break; - case 2: - func_80AAA308(this); + case ENMD_ANIM_SEQ_HALT_TO_CURIOUS: + EnMd_UpdateAnimSequence_HaltToCurious(this); break; - case 3: - func_80AAA39C(this); + case ENMD_ANIM_SEQ_WALK_AWAY: + EnMd_UpdateAnimSequence_WalkAway(this); break; - case 4: - func_80AAA474(this); + case ENMD_ANIM_SEQ_TWITCH_IDLE_UNUSED: + // unreachable + EnMd_UpdateAnimSequence_TwitchIdle_Unused(this); break; - case 5: - func_80AAA508(this); + case ENMD_ANIM_SEQ_HALT_TO_IDLE: + EnMd_UpdateAnimSequence_HaltToIdle(this); break; - case 6: - func_80AAA5A4(this); + case ENMD_ANIM_SEQ_SURPRISE_TO_ANNOYED: + EnMd_UpdateAnimSequence_SurpriseToAnnoyed(this); break; - case 7: - func_80AAA638(this); + case ENMD_ANIM_SEQ_SURPRISE_TO_IDLE: + EnMd_UpdateAnimSequence_SurpriseToIdle(this); break; - case 8: - func_80AAA6D4(this); + case ENMD_ANIM_SEQ_CURIOUS_TO_ANNOYED: + EnMd_UpdateAnimSequence_CuriousToAnnoyed(this); break; - case 9: - func_80AAA768(this); + case ENMD_ANIM_SEQ_ANNOYED_TO_HALT: + EnMd_UpdateAnimSequence_AnnoyedToHalt(this); break; - case 10: - func_80AAA7FC(this); + case ENMD_ANIM_SEQ_IDLE_TO_ANNOYED: + EnMd_UpdateAnimSequence_IdleToAnnoyed(this); break; - case 11: - func_80AAA890(this); + case ENMD_ANIM_SEQ_STOP_WALKING: + EnMd_UpdateAnimSequence_StopWalking(this); } } -void func_80AAAA24(EnMd* this) { +void EnMd_UpdateAnimSequence_WithTalking(EnMd* this) { if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { switch (this->actor.textId) { case 0x102F: - if ((this->unk_208 == 0) && (this->unk_20B != 1)) { - func_80AAA92C(this, 1); + if ((this->messageEntry == 0) && (this->animSequence != ENMD_ANIM_SEQ_IDLE_TO_HALT)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_IDLE_TO_HALT); } - if ((this->unk_208 == 2) && (this->unk_20B != 2)) { - func_80AAA92C(this, 2); + if ((this->messageEntry == 2) && (this->animSequence != ENMD_ANIM_SEQ_HALT_TO_CURIOUS)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_HALT_TO_CURIOUS); } - if ((this->unk_208 == 5) && (this->unk_20B != 8)) { - func_80AAA92C(this, 8); + if ((this->messageEntry == 5) && (this->animSequence != ENMD_ANIM_SEQ_CURIOUS_TO_ANNOYED)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_CURIOUS_TO_ANNOYED); } - if ((this->unk_208 == 11) && (this->unk_20B != 9)) { - func_80AAA92C(this, 9); + if ((this->messageEntry == 11) && (this->animSequence != ENMD_ANIM_SEQ_ANNOYED_TO_HALT)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_ANNOYED_TO_HALT); } break; case 0x1033: - if ((this->unk_208 == 0) && (this->unk_20B != 1)) { - func_80AAA92C(this, 1); + if ((this->messageEntry == 0) && (this->animSequence != ENMD_ANIM_SEQ_IDLE_TO_HALT)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_IDLE_TO_HALT); } - if ((this->unk_208 == 1) && (this->unk_20B != 2)) { - func_80AAA92C(this, 2); + if ((this->messageEntry == 1) && (this->animSequence != ENMD_ANIM_SEQ_HALT_TO_CURIOUS)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_HALT_TO_CURIOUS); } - if ((this->unk_208 == 5) && (this->unk_20B != 10)) { - func_80AAA92C(this, 10); + if ((this->messageEntry == 5) && (this->animSequence != ENMD_ANIM_SEQ_IDLE_TO_ANNOYED)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_IDLE_TO_ANNOYED); } - if ((this->unk_208 == 7) && (this->unk_20B != 9)) { - func_80AAA92C(this, 9); + if ((this->messageEntry == 7) && (this->animSequence != ENMD_ANIM_SEQ_ANNOYED_TO_HALT)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_ANNOYED_TO_HALT); } break; case 0x1030: case 0x1034: case 0x1045: - if ((this->unk_208 == 0) && (this->unk_20B != 1)) { - func_80AAA92C(this, 1); + if ((this->messageEntry == 0) && (this->animSequence != ENMD_ANIM_SEQ_IDLE_TO_HALT)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_IDLE_TO_HALT); } break; case 0x1046: - if ((this->unk_208 == 0) && (this->unk_20B != 6)) { - func_80AAA92C(this, 6); + if ((this->messageEntry == 0) && (this->animSequence != ENMD_ANIM_SEQ_SURPRISE_TO_ANNOYED)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_SURPRISE_TO_ANNOYED); } break; } - } else if (this->skelAnime.animation != &gMidoHandsOnHipsIdleAnim) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_10); - func_80AAA92C(this, 0); + } else if (this->skelAnime.animation != &gMidoIdleAnim) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_NONE); } - func_80AAA93C(this); + EnMd_UpdateAnimSequence(this); } -s16 func_80AAAC78(EnMd* this, PlayState* play) { - s16 dialogState = Message_GetState(&play->msgCtx); +s16 EnMd_TrackMessageState(EnMd* this, PlayState* play) { + s16 messageState = Message_GetState(&play->msgCtx); - if ((this->unk_209 == TEXT_STATE_AWAITING_NEXT) || (this->unk_209 == TEXT_STATE_EVENT) || - (this->unk_209 == TEXT_STATE_CLOSING) || (this->unk_209 == TEXT_STATE_DONE_HAS_NEXT)) { - if (this->unk_209 != dialogState) { - this->unk_208++; + if ((this->messageState == TEXT_STATE_AWAITING_NEXT) || (this->messageState == TEXT_STATE_EVENT) || + (this->messageState == TEXT_STATE_CLOSING) || (this->messageState == TEXT_STATE_DONE_HAS_NEXT)) { + if (this->messageState != messageState) { + this->messageEntry++; } } - this->unk_209 = dialogState; - return dialogState; + this->messageState = messageState; + return messageState; } u16 EnMd_GetTextIdKokiriForest(PlayState* play, EnMd* this) { @@ -391,8 +407,8 @@ u16 EnMd_GetTextIdKokiriForest(PlayState* play, EnMd* this) { return textId; } - this->unk_208 = 0; - this->unk_209 = TEXT_STATE_NONE; + this->messageEntry = 0; + this->messageState = TEXT_STATE_NONE; if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) { return 0x1045; @@ -415,8 +431,8 @@ u16 EnMd_GetTextIdKokiriForest(PlayState* play, EnMd* this) { } u16 EnMd_GetTextIdMidosHouse(PlayState* play, EnMd* this) { - this->unk_208 = 0; - this->unk_209 = TEXT_STATE_NONE; + this->messageEntry = 0; + this->messageState = TEXT_STATE_NONE; if (GET_EVENTCHKINF(EVENTCHKINF_40)) { return 0x1028; @@ -426,8 +442,8 @@ u16 EnMd_GetTextIdMidosHouse(PlayState* play, EnMd* this) { } u16 EnMd_GetTextIdLostWoods(PlayState* play, EnMd* this) { - this->unk_208 = 0; - this->unk_209 = TEXT_STATE_NONE; + this->messageEntry = 0; + this->messageState = TEXT_STATE_NONE; if (GET_EVENTCHKINF(EVENTCHKINF_48)) { if (GET_INFTABLE(INFTABLE_19)) { @@ -464,7 +480,7 @@ u16 EnMd_GetTextId(PlayState* play, Actor* thisx) { s16 EnMd_UpdateTalkState(PlayState* play, Actor* thisx) { EnMd* this = (EnMd*)thisx; - switch (func_80AAAC78(this, play)) { + switch (EnMd_TrackMessageState(this, play)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -528,19 +544,19 @@ u8 EnMd_ShouldSpawn(EnMd* this, PlayState* play) { void EnMd_UpdateEyes(EnMd* this) { if (DECR(this->blinkTimer) == 0) { - this->eyeIdx++; - if (this->eyeIdx > 2) { + this->eyeTexIndex++; + if (this->eyeTexIndex > 2) { this->blinkTimer = Rand_S16Offset(30, 30); - this->eyeIdx = 0; + this->eyeTexIndex = 0; } } } -void func_80AAB158(EnMd* this, PlayState* play) { +void EnMd_UpdateTalking(EnMd* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 absYawDiff; s16 trackingMode; - s16 temp2; + s16 canUpdateTalking; s16 yawDiff; if (this->actor.xzDistToPlayer < 170.0f) { @@ -549,23 +565,23 @@ void func_80AAB158(EnMd* this, PlayState* play) { trackingMode = absYawDiff <= Npc_GetTrackingPresetMaxPlayerYaw(2) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; - temp2 = 1; + canUpdateTalking = true; } else { trackingMode = NPC_TRACKING_NONE; - temp2 = 0; + canUpdateTalking = false; } if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { trackingMode = NPC_TRACKING_FULL_BODY; } - if (this->actionFunc == func_80AABD0C) { + if (this->actionFunc == EnMd_Walk) { trackingMode = NPC_TRACKING_NONE; - temp2 = 0; + canUpdateTalking = false; } - if (this->actionFunc == func_80AAB8F8) { + if (this->actionFunc == EnMd_Watch) { trackingMode = NPC_TRACKING_FULL_BODY; - temp2 = 1; + canUpdateTalking = true; } if ((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) { @@ -578,8 +594,8 @@ void func_80AAB158(EnMd* this, PlayState* play) { } Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode); - if (this->actionFunc != func_80AABC10) { - if (temp2) { + if (this->actionFunc != EnMd_ListenToOcarina) { + if (canUpdateTalking) { Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, EnMd_GetTextId, EnMd_UpdateTalkState); } @@ -592,11 +608,11 @@ u8 EnMd_FollowPath(EnMd* this, PlayState* play) { f32 pathDiffX; f32 pathDiffZ; - if (PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) == 0xFF00) { + if (ENMD_GET_PATH_INDEX_NOSHIFT(this) == (ENMD_PATH_NONE << 8)) { return 0; } - path = &play->pathList[PARAMS_GET_S(this->actor.params, 8, 8)]; + path = &play->pathList[ENMD_GET_PATH_INDEX(this)]; pointPos = SEGMENTED_TO_VIRTUAL(path->points); pointPos += this->waypoint; @@ -619,11 +635,11 @@ u8 EnMd_SetMovedPos(EnMd* this, PlayState* play) { Path* path; Vec3s* lastPointPos; - if (PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) == 0xFF00) { + if (ENMD_GET_PATH_INDEX_NOSHIFT(this) == (ENMD_PATH_NONE << 8)) { return 0; } - path = &play->pathList[PARAMS_GET_S(this->actor.params, 8, 8)]; + path = &play->pathList[ENMD_GET_PATH_INDEX(this)]; lastPointPos = SEGMENTED_TO_VIRTUAL(path->points); lastPointPos += path->count - 1; @@ -634,15 +650,15 @@ u8 EnMd_SetMovedPos(EnMd* this, PlayState* play) { return 1; } -void func_80AAB5A4(EnMd* this, PlayState* play) { - f32 temp; +void EnMd_UpdateAlphaByDistance(EnMd* this, PlayState* play) { + f32 radius; if (play->sceneId != SCENE_MIDOS_HOUSE) { - temp = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && - (play->sceneId == SCENE_KOKIRI_FOREST)) - ? 100.0f - : 400.0f; - this->alpha = func_80034DD4(&this->actor, play, this->alpha, temp); + radius = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && + (play->sceneId == SCENE_KOKIRI_FOREST)) + ? 100.0f + : 400.0f; + this->alpha = Actor_UpdateAlphaByDistance(&this->actor, play, this->alpha, radius); this->actor.shape.shadowAlpha = this->alpha; } else { this->alpha = 255; @@ -665,7 +681,7 @@ void EnMd_Init(Actor* thisx, PlayState* play) { return; } - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_0); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_DEFAULT); Actor_SetScale(&this->actor, 0.01f); this->actor.attentionRangeType = ATTENTION_RANGE_6; this->alpha = 255; @@ -677,7 +693,7 @@ void EnMd_Init(Actor* thisx, PlayState* play) { CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) || ((play->sceneId == SCENE_LOST_WOODS) && !GET_EVENTCHKINF(EVENTCHKINF_0A))) { this->actor.home.pos = this->actor.world.pos; - this->actionFunc = func_80AAB948; + this->actionFunc = EnMd_BlockPath; return; } @@ -685,7 +701,7 @@ void EnMd_Init(Actor* thisx, PlayState* play) { EnMd_SetMovedPos(this, play); } - this->actionFunc = func_80AAB874; + this->actionFunc = EnMd_Idle; } void EnMd_Destroy(Actor* thisx, PlayState* play) { @@ -693,30 +709,31 @@ void EnMd_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80AAB874(EnMd* this, PlayState* play) { - if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { +void EnMd_Idle(EnMd* this, PlayState* play) { + if (this->skelAnime.animation == &gMidoIdleAnim) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX); - } else if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (this->unk_20B != 7)) { - func_80AAA92C(this, 7); + } else if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && + (this->animSequence != ENMD_ANIM_SEQ_SURPRISE_TO_IDLE)) { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_SURPRISE_TO_IDLE); } - func_80AAAA24(this); + EnMd_UpdateAnimSequence_WithTalking(this); } -void func_80AAB8F8(EnMd* this, PlayState* play) { - if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { +void EnMd_Watch(EnMd* this, PlayState* play) { + if (this->skelAnime.animation == &gMidoIdleAnim) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX); } - func_80AAA93C(this); + EnMd_UpdateAnimSequence(this); } -void func_80AAB948(EnMd* this, PlayState* play) { +void EnMd_BlockPath(EnMd* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 temp; Actor* actorToBlock = &GET_PLAYER(play)->actor; s16 yaw; - func_80AAAA24(this); + EnMd_UpdateAnimSequence_WithTalking(this); if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -747,16 +764,16 @@ void func_80AAB948(EnMd* this, PlayState* play) { SET_EVENTCHKINF(EVENTCHKINF_0A); } - func_80AAA92C(this, 3); - func_80AAA93C(this); + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_WALK_AWAY); + EnMd_UpdateAnimSequence(this); this->waypoint = 1; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - this->actionFunc = func_80AABD0C; + this->actionFunc = EnMd_Walk; this->actor.speed = 1.5f; return; } - if (this->skelAnime.animation == &gMidoHandsOnHipsIdleAnim) { + if (this->skelAnime.animation == &gMidoIdleAnim) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX); } @@ -765,7 +782,7 @@ void func_80AAB948(EnMd* this, PlayState* play) { player->stateFlags2 |= PLAYER_STATE2_25; player->unk_6A8 = &this->actor; Message_StartOcarina(play, OCARINA_ACTION_CHECK_SARIA); - this->actionFunc = func_80AABC10; + this->actionFunc = EnMd_ListenToOcarina; return; } @@ -775,11 +792,11 @@ void func_80AAB948(EnMd* this, PlayState* play) { } } -void func_80AABC10(EnMd* this, PlayState* play) { +void EnMd_ListenToOcarina(EnMd* this, PlayState* play) { Player* player = GET_PLAYER(play); if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) { - this->actionFunc = func_80AAB948; + this->actionFunc = EnMd_BlockPath; play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { Audio_PlaySfxGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -787,16 +804,16 @@ void func_80AABC10(EnMd* this, PlayState* play) { this->actor.textId = 0x1067; Actor_OfferTalk(&this->actor, play, this->collider.dim.radius + 30.0f); - this->actionFunc = func_80AAB948; + this->actionFunc = EnMd_BlockPath; play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { player->stateFlags2 |= PLAYER_STATE2_23; } } -void func_80AABD0C(EnMd* this, PlayState* play) { +void EnMd_Walk(EnMd* this, PlayState* play) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, ENMD_LIMB_MAX); - func_80AAA93C(this); + EnMd_UpdateAnimSequence(this); if (!(EnMd_FollowPath(this, play)) || (this->waypoint != 0)) { this->actor.shape.rot = this->actor.world.rot; @@ -811,12 +828,12 @@ void func_80AABD0C(EnMd* this, PlayState* play) { return; } - func_80AAA92C(this, 11); + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_STOP_WALKING); this->skelAnime.playSpeed = 0.0f; this->actor.speed = 0.0f; this->actor.home.pos = this->actor.world.pos; - this->actionFunc = func_80AAB8F8; + this->actionFunc = EnMd_Watch; } void EnMd_Update(Actor* thisx, PlayState* play) { @@ -827,9 +844,9 @@ void EnMd_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); EnMd_UpdateEyes(this); - func_80AAB5A4(this, play); + EnMd_UpdateAlphaByDistance(this, play); Actor_MoveXZGravity(&this->actor); - func_80AAB158(this, play); + EnMd_UpdateTalking(this, play); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->actionFunc(this, play); } @@ -880,10 +897,10 @@ void EnMd_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_md.c", 1280); if (this->alpha == 255) { - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIdx])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); func_80034BA0(play, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); } else if (this->alpha != 0) { - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIdx])); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); func_80034CC4(play, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); } diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.h b/src/overlays/actors/ovl_En_Md/z_en_md.h index a30ebe047a..6a78a24904 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -29,18 +29,23 @@ typedef enum EnMdLimb { typedef void (*EnMdActionFunc)(struct EnMd*, PlayState*); +#define ENMD_GET_PATH_INDEX(this) PARAMS_GET_S(this->actor.params, 8, 8) +#define ENMD_GET_PATH_INDEX_NOSHIFT(this) PARAMS_GET_NOSHIFT(this->actor.params, 8, 8) + +#define ENMD_PATH_NONE 0xFF + typedef struct EnMd { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnMdActionFunc actionFunc; /* 0x0194 */ ColliderCylinder collider; /* 0x01E0 */ NpcInteractInfo interactInfo; - /* 0x0208 */ u8 unk_208; - /* 0x0209 */ u8 unk_209; - /* 0x020A */ u8 unk_20A; - /* 0x020B */ u8 unk_20B; + /* 0x0208 */ u8 messageEntry; // tracks message state changes, like with `BOX_BREAK` or `TEXTID` + /* 0x0209 */ u8 messageState; // last known result of `Message_GetState` + /* 0x020A */ u8 animSequenceEntry; // each one changes animation info and waits + /* 0x020B */ u8 animSequence; /* 0x020C */ s16 blinkTimer; - /* 0x020E */ s16 eyeIdx; + /* 0x020E */ s16 eyeTexIndex; /* 0x0210 */ s16 alpha; /* 0x0212 */ s16 waypoint; /* 0x0214 */ s16 fidgetTableY[ENMD_LIMB_MAX]; 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 5c6b0c7886..67076188b4 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_UpdateAlphaByDistance(&this->actor, play, this->alpha, 400.0f); } else { this->alpha = 255; }