From ebbabb7d91f97b75cf52984961012562290d52a7 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Thu, 12 Feb 2026 18:22:21 -0500 Subject: [PATCH] Document `EnWeiyer` (#2686) * Document `EnWeiyer` * Rename function --- .../actors/ovl_En_Weiyer/z_en_weiyer.c | 302 +++++++++--------- .../actors/ovl_En_Weiyer/z_en_weiyer.h | 8 +- 2 files changed, 155 insertions(+), 155 deletions(-) diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c index 919eb6bd75..78a284a881 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -26,17 +26,17 @@ void EnWeiyer_Destroy(Actor* thisx, PlayState* play); void EnWeiyer_Update(Actor* thisx, PlayState* play); void EnWeiyer_Draw(Actor* thisx, PlayState* play); -void func_80B32804(EnWeiyer* this, PlayState* play); -void func_80B328E8(EnWeiyer* this, PlayState* play); -void func_80B32C2C(EnWeiyer* this, PlayState* play); -void func_80B32D30(EnWeiyer* this, PlayState* play); -void func_80B32E34(EnWeiyer* this, PlayState* play); -void func_80B33018(EnWeiyer* this, PlayState* play); -void func_80B331CC(EnWeiyer* this, PlayState* play); -void func_80B333B8(EnWeiyer* this, PlayState* play); -void func_80B332B4(EnWeiyer* this, PlayState* play); -void func_80B33338(EnWeiyer* this, PlayState* play); -void func_80B3349C(EnWeiyer* this, PlayState* play); +void EnWeiyer_InitInsideWaterBox(EnWeiyer* this, PlayState* play); +void EnWeiyer_FreeSwim(EnWeiyer* this, PlayState* play); +void EnWeiyer_TurnAround(EnWeiyer* this, PlayState* play); +void EnWeiyer_StuckOnFloor(EnWeiyer* this, PlayState* play); +void EnWeiyer_Attack(EnWeiyer* this, PlayState* play); +void EnWeiyer_Inactive(EnWeiyer* this, PlayState* play); +void EnWeiyer_Hurt(EnWeiyer* this, PlayState* play); +void EnWeiyer_Stunned(EnWeiyer* this, PlayState* play); +void EnWeiyer_Die(EnWeiyer* this, PlayState* play); +void EnWeiyer_Dead(EnWeiyer* this, PlayState* play); +void EnWeiyer_OutOfWater(EnWeiyer* this, PlayState* play); ActorProfile En_Weiyer_Profile = { /**/ ACTOR_EN_WEIYER, @@ -122,7 +122,7 @@ void EnWeiyer_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->actionFunc = func_80B32804; + this->actionFunc = EnWeiyer_InitInsideWaterBox; } void EnWeiyer_Destroy(Actor* thisx, PlayState* play) { @@ -131,52 +131,52 @@ void EnWeiyer_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80B32384(EnWeiyer* this) { - this->unk_196 = this->actor.shape.rot.y; - this->unk_27C = (cosf(-M_PI / 8) * 3.0f) + this->actor.world.pos.y; +void EnWeiyer_SetupFreeSwim(EnWeiyer* this) { + this->targetYaw = this->actor.shape.rot.y; + this->swimHeight = (cosf(-M_PI / 8) * 3.0f) + this->actor.world.pos.y; Animation_MorphToLoop(&this->skelAnime, &gStingerHitAnim, -5.0f); - this->unk_194 = 30; + this->timer = 30; this->actor.speed = CLAMP_MAX(this->actor.speed, 2.5f); this->collider.base.atFlags &= ~AT_ON; - this->unk_280 = this->actor.floorHeight; - this->actionFunc = func_80B328E8; + this->targetSwimHeight = this->actor.floorHeight; + this->actionFunc = EnWeiyer_FreeSwim; } -void func_80B32434(EnWeiyer* this) { +void EnWeiyer_SetupTurnAround(EnWeiyer* this) { Animation_MorphToLoop(&this->skelAnime, &gStingerHitAnim, -5.0f); this->collider.base.atFlags |= AT_ON; - this->unk_194 = 0; + this->timer = 0; this->actor.speed = 5.0f; - this->actionFunc = func_80B32C2C; + this->actionFunc = EnWeiyer_TurnAround; } -void func_80B32494(EnWeiyer* this) { +void EnWeiyer_SetupStuckOnFloor(EnWeiyer* this) { Animation_Change(&this->skelAnime, &gStingerPopOutAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f); - this->unk_194 = 40; + this->timer = 40; this->collider.base.atFlags |= AT_ON; - this->actionFunc = func_80B32D30; + this->actionFunc = EnWeiyer_StuckOnFloor; } -void func_80B32508(EnWeiyer* this) { - this->unk_194 = 200; +void EnWeiyer_SetupAttack(EnWeiyer* this) { + this->timer = 200; this->collider.base.atFlags |= AT_ON; this->skelAnime.playSpeed = 3.0f; - this->actionFunc = func_80B32E34; + this->actionFunc = EnWeiyer_Attack; } -void func_80B32538(EnWeiyer* this) { - this->unk_194 = 200; - this->unk_196 = this->actor.yawTowardsPlayer + 0x8000; - this->unk_27C = this->actor.world.pos.y; +void EnWeiyer_SetupInactive(EnWeiyer* this) { + this->timer = 200; + this->targetYaw = this->actor.yawTowardsPlayer + 0x8000; + this->swimHeight = this->actor.world.pos.y; this->actor.speed = CLAMP_MAX(this->actor.speed, 4.0f); this->collider.base.atFlags &= ~AT_ON; this->skelAnime.playSpeed = 1.0f; - this->actionFunc = func_80B33018; + this->actionFunc = EnWeiyer_Inactive; } -void func_80B325A0(EnWeiyer* this) { +void EnWeiyer_SetupHurt(EnWeiyer* this) { Animation_Change(&this->skelAnime, &gStingerHitAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -3.0f); - this->unk_194 = 40; + this->timer = 40; this->collider.base.atFlags &= ~AT_ON; this->collider.base.acFlags &= ~AC_ON; this->actor.gravity = 0.0f; @@ -184,12 +184,12 @@ void func_80B325A0(EnWeiyer* this) { this->actor.speed = 3.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_OPA, 40); this->collider.dim.height = sCylinderInit.dim.height; - this->actionFunc = func_80B331CC; + this->actionFunc = EnWeiyer_Hurt; } -void func_80B32660(EnWeiyer* this) { +void EnWeiyer_SetupStunned(EnWeiyer* this) { Animation_Change(&this->skelAnime, &gStingerPopOutAnim, 2.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f); - this->unk_194 = 80; + this->timer = 80; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; @@ -197,34 +197,34 @@ void func_80B32660(EnWeiyer* this) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 200, COLORFILTER_BUFFLAG_OPA, 80); this->collider.base.atFlags &= ~AT_ON; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->actionFunc = func_80B333B8; + this->actionFunc = EnWeiyer_Stunned; } -void func_80B32724(EnWeiyer* this) { +void EnWeiyer_SetupDie(EnWeiyer* this) { Animation_MorphToLoop(&this->skelAnime, &gStingerHitAnim, -5.0f); - this->unk_194 = 20; + this->timer = 20; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_OPA, 40); this->collider.base.atFlags &= ~AT_ON; this->collider.base.acFlags &= ~AC_ON; this->actor.speed = 3.0f; - this->actionFunc = func_80B332B4; + this->actionFunc = EnWeiyer_Die; } -void func_80B327B0(EnWeiyer* this) { +void EnWeiyer_SetupDead(EnWeiyer* this) { this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.colorFilterParams |= 0x2000; - this->actionFunc = func_80B33338; + this->actionFunc = EnWeiyer_Dead; } -void func_80B327D8(EnWeiyer* this) { +void EnWeiyer_SetupOutOfWater(EnWeiyer* this) { this->actor.shape.rot.x = -0x2000; - this->unk_194 = -1; + this->timer = -1; this->actor.speed = 5.0f; - this->actionFunc = func_80B3349C; + this->actionFunc = EnWeiyer_OutOfWater; } -void func_80B32804(EnWeiyer* this, PlayState* play) { +void EnWeiyer_InitInsideWaterBox(EnWeiyer* this, PlayState* play) { WaterBox* waterBox; s32 bgId; @@ -239,20 +239,20 @@ void func_80B32804(EnWeiyer* this, PlayState* play) { } else { this->actor.home.pos.y -= 5.0f; this->actor.world.pos.y = (this->actor.home.pos.y + this->actor.floorHeight) / 2.0f; - func_80B32384(this); + EnWeiyer_SetupFreeSwim(this); } } -void func_80B328E8(EnWeiyer* this, PlayState* play) { - s32 sp34; +void EnWeiyer_FreeSwim(EnWeiyer* this, PlayState* play) { + s32 animRestarted; f32 curFrame; SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x800); - sp34 = Animation_OnFrame(&this->skelAnime, 0.0f); + animRestarted = Animation_OnFrame(&this->skelAnime, 0.0f); curFrame = this->skelAnime.curFrame; - Math_StepToF(&this->unk_27C, this->unk_280, 0.5f); - this->actor.world.pos.y = this->unk_27C - cosf((curFrame - 5.0f) * (M_PI / 40)) * 3.0f; + Math_StepToF(&this->swimHeight, this->targetSwimHeight, 0.5f); + this->actor.world.pos.y = this->swimHeight - cosf((curFrame - 5.0f) * (M_PI / 40)) * 3.0f; if (curFrame <= 45.0f) { Math_StepToF(&this->actor.speed, 1.0f, 0.03f); @@ -261,19 +261,19 @@ void func_80B328E8(EnWeiyer* this, PlayState* play) { } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - this->unk_196 = this->actor.wallYaw; - this->unk_194 = 30; + this->targetYaw = this->actor.wallYaw; + this->timer = 30; } - if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_196, 182)) { - if (this->unk_194 != 0) { - this->unk_194--; + if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 182)) { + if (this->timer != 0) { + this->timer--; } - if (this->unk_194 == 0) { - this->unk_196 = + if (this->timer == 0) { + this->targetYaw = Rand_S16Offset(0x2000, 0x2000) * ((Rand_ZeroOne() < 0.5f) ? -1 : 1) + this->actor.shape.rot.y; - this->unk_194 = 30; + this->timer = 30; if (Rand_ZeroOne() < 0.3333f) { Actor_PlaySfx(&this->actor, NA_SE_EN_EIER_CRY); @@ -283,38 +283,38 @@ void func_80B328E8(EnWeiyer* this, PlayState* play) { if (this->actor.home.pos.y < this->actor.world.pos.y) { if (this->actor.home.pos.y < this->actor.floorHeight) { - func_80B32434(this); + EnWeiyer_SetupTurnAround(this); } else { this->actor.world.pos.y = this->actor.home.pos.y; - this->unk_280 = + this->targetSwimHeight = Rand_ZeroOne() * ((this->actor.home.pos.y - this->actor.floorHeight) / 2.0f) + this->actor.floorHeight; } } else { Player* player = GET_PLAYER(play); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk_280 = + this->targetSwimHeight = this->actor.home.pos.y - Rand_ZeroOne() * ((this->actor.home.pos.y - this->actor.floorHeight) / 2.0f); - } else if (sp34 && (Rand_ZeroOne() < 0.1f)) { - this->unk_280 = + } else if (animRestarted && (Rand_ZeroOne() < 0.1f)) { + this->targetSwimHeight = Rand_ZeroOne() * (this->actor.home.pos.y - this->actor.floorHeight) + this->actor.floorHeight; } if ((this->actor.xzDistToPlayer < 400.0f) && (fabsf(this->actor.yDistToPlayer) < 250.0f) && (player->actor.world.pos.y < (this->actor.home.pos.y + 20.0f))) { - func_80B32508(this); + EnWeiyer_SetupAttack(this); } } } -void func_80B32C2C(EnWeiyer* this, PlayState* play) { +void EnWeiyer_TurnAround(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_194 == 0) { + if (this->timer == 0) { if (Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x800)) { this->actor.shape.rot.z = 0; this->actor.shape.rot.y += 0x8000; - this->unk_194 = 1; + this->timer = 1; } else { this->actor.shape.rot.z = this->actor.shape.rot.x * 2; } @@ -327,14 +327,14 @@ void func_80B32C2C(EnWeiyer* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_SINK); } - func_80B32538(this); + EnWeiyer_SetupInactive(this); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_80B32494(this); + EnWeiyer_SetupStuckOnFloor(this); } } } -void func_80B32D30(EnWeiyer* this, PlayState* play) { +void EnWeiyer_StuckOnFloor(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f)) { @@ -344,40 +344,40 @@ void func_80B32D30(EnWeiyer* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x800); Math_StepToF(&this->actor.speed, 0.0f, 1.0f); - if (this->unk_194 != 0) { - this->unk_194--; + if (this->timer != 0) { + this->timer--; } - if (this->unk_194 == 0) { - func_80B32434(this); + if (this->timer == 0) { + EnWeiyer_SetupTurnAround(this); } else if (this->actor.world.pos.y < this->actor.home.pos.y) { - func_80B32384(this); + EnWeiyer_SetupFreeSwim(this); } } -s16 func_80B32DEC(EnWeiyer* this, PlayState* play) { +s16 EnWeiyer_PitchTowardPlayer(EnWeiyer* this, PlayState* play) { Player* player = GET_PLAYER(play); - Vec3f vec; + Vec3f playerWorldPos; - vec.x = player->actor.world.pos.x; - vec.y = player->actor.world.pos.y + 20.0f; - vec.z = player->actor.world.pos.z; + playerWorldPos.x = player->actor.world.pos.x; + playerWorldPos.y = player->actor.world.pos.y + 20.0f; + playerWorldPos.z = player->actor.world.pos.z; - return Actor_WorldPitchTowardPoint(&this->actor, &vec); + return Actor_WorldPitchTowardPoint(&this->actor, &playerWorldPos); } -void func_80B32E34(EnWeiyer* this, PlayState* play) { +void EnWeiyer_Attack(EnWeiyer* this, PlayState* play) { Player* player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if (this->unk_194 != 0) { - this->unk_194--; + if (this->timer != 0) { + this->timer--; } - if ((this->unk_194 == 0) || ((this->actor.home.pos.y + 20.0f) <= player->actor.world.pos.y) || + if ((this->timer == 0) || ((this->actor.home.pos.y + 20.0f) <= player->actor.world.pos.y) || (this->collider.base.atFlags & AT_HIT)) { - func_80B32538(this); + EnWeiyer_SetupInactive(this); } else { if (Actor_IsFacingPlayer(&this->actor, 0x2800)) { Math_StepToF(&this->actor.speed, 4.0f, 0.2f); @@ -388,34 +388,34 @@ void func_80B32E34(EnWeiyer* this, PlayState* play) { if (this->actor.home.pos.y < this->actor.world.pos.y) { if (this->actor.home.pos.y < this->actor.floorHeight) { this->actor.shape.rot.x = 0; - func_80B32434(this); + EnWeiyer_SetupTurnAround(this); return; } this->actor.world.pos.y = this->actor.home.pos.y; Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1000, 2, 0x100, 0x40); } else { - Math_SmoothStepToS(&this->actor.shape.rot.x, func_80B32DEC(this, play), 2, 0x100, 0x40); + Math_SmoothStepToS(&this->actor.shape.rot.x, EnWeiyer_PitchTowardPlayer(this, play), 2, 0x100, 0x40); } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0x200, 0x80); if ((player->actor.depthInWater < 50.0f) && (this->actor.depthInWater < 20.0f) && Actor_IsFacingPlayer(&this->actor, 0x2000)) { - func_80B327D8(this); + EnWeiyer_SetupOutOfWater(this); } } } -void func_80B33018(EnWeiyer* this, PlayState* play) { +void EnWeiyer_Inactive(EnWeiyer* this, PlayState* play) { f32 curFrame; SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x800); curFrame = this->skelAnime.curFrame; - Math_StepToF(&this->unk_27C, (this->actor.home.pos.y - this->actor.floorHeight) / 4.0f + this->actor.floorHeight, + Math_StepToF(&this->swimHeight, (this->actor.home.pos.y - this->actor.floorHeight) / 4.0f + this->actor.floorHeight, 1.0f); - this->actor.world.pos.y = this->unk_27C - cosf((curFrame - 5.0f) * (M_PI / 40)) * 3.0f; + this->actor.world.pos.y = this->swimHeight - cosf((curFrame - 5.0f) * (M_PI / 40)) * 3.0f; if (curFrame <= 45.0f) { Math_StepToF(&this->actor.speed, 1.0f, 0.03f); @@ -423,70 +423,70 @@ void func_80B33018(EnWeiyer* this, PlayState* play) { Math_StepToF(&this->actor.speed, 1.3f, 0.03f); } - if (this->unk_194 != 0) { - this->unk_194--; + if (this->timer != 0) { + this->timer--; } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - this->unk_196 = this->actor.wallYaw; + this->targetYaw = this->actor.wallYaw; } - if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_196, 2, 0x200, 0x80) == 0) { - this->unk_196 = this->actor.yawTowardsPlayer + 0x8000; + if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->targetYaw, 2, 0x200, 0x80) == 0) { + this->targetYaw = this->actor.yawTowardsPlayer + 0x8000; } if (this->actor.home.pos.y < this->actor.world.pos.y) { if (this->actor.home.pos.y < this->actor.floorHeight) { - func_80B32434(this); + EnWeiyer_SetupTurnAround(this); } else { this->actor.world.pos.y = this->actor.home.pos.y; } } - if (this->unk_194 == 0) { - func_80B32384(this); + if (this->timer == 0) { + EnWeiyer_SetupFreeSwim(this); } } -void func_80B331CC(EnWeiyer* this, PlayState* play) { +void EnWeiyer_Hurt(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_194 != 0) { - this->unk_194--; + if (this->timer != 0) { + this->timer--; } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - this->unk_196 = this->actor.wallYaw; + this->targetYaw = this->actor.wallYaw; } else { - this->unk_196 = this->actor.yawTowardsPlayer + 0x8000; + this->targetYaw = this->actor.yawTowardsPlayer + 0x8000; } - Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_196, 0x38E); + Math_ScaledStepToS(&this->actor.world.rot.y, this->targetYaw, 0x38E); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x200); - this->actor.shape.rot.z = sinf(this->unk_194 * (M_PI / 5)) * 5120.0f; + this->actor.shape.rot.z = sinf(this->timer * (M_PI / 5)) * 5120.0f; - if (this->unk_194 == 0) { + if (this->timer == 0) { this->actor.shape.rot.z = 0; this->collider.base.acFlags |= AC_ON; - func_80B32384(this); + EnWeiyer_SetupFreeSwim(this); } } -void func_80B332B4(EnWeiyer* this, PlayState* play) { +void EnWeiyer_Die(EnWeiyer* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x400); this->actor.shape.rot.z += 0x1000; - if (this->unk_194 != 0) { - this->unk_194--; + if (this->timer != 0) { + this->timer--; } - if ((this->unk_194 == 0) || (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING)) { - func_80B327B0(this); + if ((this->timer == 0) || (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING)) { + EnWeiyer_SetupDead(this); } } -void func_80B33338(EnWeiyer* this, PlayState* play) { +void EnWeiyer_Dead(EnWeiyer* this, PlayState* play) { this->actor.shape.shadowAlpha = CLAMP_MIN((s16)(this->actor.shape.shadowAlpha - 5), 0); this->actor.world.pos.y -= 2.0f; @@ -496,9 +496,9 @@ void func_80B33338(EnWeiyer* this, PlayState* play) { } } -void func_80B333B8(EnWeiyer* this, PlayState* play) { - if (this->unk_194 != 0) { - this->unk_194--; +void EnWeiyer_Stunned(EnWeiyer* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; } Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x200); @@ -515,78 +515,78 @@ void func_80B333B8(EnWeiyer* this, PlayState* play) { } } - if (this->unk_194 == 0) { + if (this->timer == 0) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->collider.dim.height = sCylinderInit.dim.height; - func_80B32384(this); + EnWeiyer_SetupFreeSwim(this); } } -void func_80B3349C(EnWeiyer* this, PlayState* play) { +void EnWeiyer_OutOfWater(EnWeiyer* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 phi_a1; - s32 phi_a0; + s16 pitch; + s32 playerIsOutOfWater; SkelAnime_Update(&this->skelAnime); - phi_a0 = ((this->actor.home.pos.y + 20.0f) <= player->actor.world.pos.y); + playerIsOutOfWater = ((this->actor.home.pos.y + 20.0f) <= player->actor.world.pos.y); - if (this->unk_194 == -1) { - if (phi_a0 || (this->collider.base.atFlags & AT_HIT)) { - func_80B32538(this); + if (this->timer == -1) { + if (playerIsOutOfWater || (this->collider.base.atFlags & AT_HIT)) { + EnWeiyer_SetupInactive(this); } else if (this->actor.depthInWater < 0.0f) { - this->unk_194 = 10; + this->timer = 10; EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 400); Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_JUMP); } } else { - if (phi_a0 || (this->collider.base.atFlags & AT_HIT)) { - this->unk_194 = 0; - } else if (this->unk_194 != 0) { - this->unk_194--; + if (playerIsOutOfWater || (this->collider.base.atFlags & AT_HIT)) { + this->timer = 0; + } else if (this->timer != 0) { + this->timer--; } - if (this->unk_194 == 0) { - phi_a1 = 0x1800; + if (this->timer == 0) { + pitch = 0x1800; } else { - phi_a1 = func_80B32DEC(this, play); - phi_a1 = CLAMP_MIN(phi_a1, 0); + pitch = EnWeiyer_PitchTowardPlayer(this, play); + pitch = CLAMP_MIN(pitch, 0); } - if (this->actor.shape.rot.x < phi_a1) { - Math_ScaledStepToS(&this->actor.shape.rot.x, phi_a1, 0x400); + if (this->actor.shape.rot.x < pitch) { + Math_ScaledStepToS(&this->actor.shape.rot.x, pitch, 0x400); } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_80B32434(this); + EnWeiyer_SetupTurnAround(this); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.shape.rot.x > 0)) { EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 1, 400); Actor_PlaySfx(&this->actor, NA_SE_EN_OCTAROCK_SINK); - func_80B32538(this); + EnWeiyer_SetupInactive(this); } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 8, 0x100, 0x80); } } } -void func_80B3368C(EnWeiyer* this, PlayState* play) { +void EnWeiyer_UpdateDamage(EnWeiyer* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.elem, true); if ((this->actor.colChkInfo.damageReaction != 0) || (this->actor.colChkInfo.damage != 0)) { if (this->actor.colChkInfo.damageReaction == 1) { - if (this->actionFunc != func_80B333B8) { - func_80B32660(this); + if (this->actionFunc != EnWeiyer_Stunned) { + EnWeiyer_SetupStunned(this); } } else if (Actor_ApplyDamage(&this->actor) == 0) { Enemy_StartFinishingBlow(play, &this->actor); Actor_PlaySfx(&this->actor, NA_SE_EN_EIER_DEAD); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - func_80B32724(this); + EnWeiyer_SetupDie(this); } else { - func_80B325A0(this); + EnWeiyer_SetupHurt(this); } } } @@ -597,12 +597,12 @@ void EnWeiyer_Update(Actor* thisx, PlayState* play) { s32 pad; this->actor.home.pos.y = this->actor.depthInWater + this->actor.world.pos.y - 5.0f; - func_80B3368C(this, play); + EnWeiyer_UpdateDamage(this, play); this->actionFunc(this, play); this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.x = -this->actor.shape.rot.x; - if ((this->actor.world.rot.x == 0) || (this->actionFunc == func_80B333B8)) { + if ((this->actor.world.rot.x == 0) || (this->actionFunc == EnWeiyer_Stunned)) { Actor_MoveXZGravity(&this->actor); } else { Actor_MoveXYZ(&this->actor); @@ -644,7 +644,7 @@ void EnWeiyer_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_weiyer.c", 1193); - if (this->actionFunc != func_80B33338) { + if (this->actionFunc != EnWeiyer_Dead) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h index d35e43544f..2ab34e2c87 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.h @@ -12,12 +12,12 @@ typedef struct EnWeiyer { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnWeiyerActionFunc actionFunc; - /* 0x0194 */ s16 unk_194; - /* 0x0196 */ s16 unk_196; + /* 0x0194 */ s16 timer; + /* 0x0196 */ s16 targetYaw; /* 0x0198 */ Vec3s jointTable[19]; /* 0x020A */ Vec3s morphTable[19]; - /* 0x027C */ f32 unk_27C; - /* 0x0280 */ f32 unk_280; + /* 0x027C */ f32 swimHeight; + /* 0x0280 */ f32 targetSwimHeight; /* 0x0284 */ ColliderCylinder collider; } EnWeiyer; // size = 0x02D0