From 68bdbf77593e709e3ac60525143e93a6da262ff3 Mon Sep 17 00:00:00 2001 From: hiisuya <112015628+hiisuya@users.noreply.github.com> Date: Sun, 19 Nov 2023 04:11:52 -0600 Subject: [PATCH] Doc Actor: En_Brob (Jabu Jabu Wobble Flesh Block) (#1581) * brob function naming * modified brob header file * renamed skel, collision, and anims * named limbs and dls * renamed shock function * ran formatter * doc modifications * Update assets/xml/objects/object_brob.xml Co-authored-by: Dragorn421 --------- Co-authored-by: Dragorn421 --- assets/xml/objects/object_brob.xml | 42 +++---- src/overlays/actors/ovl_En_Brob/z_en_brob.c | 129 ++++++++++---------- src/overlays/actors/ovl_En_Brob/z_en_brob.h | 2 +- 3 files changed, 88 insertions(+), 85 deletions(-) diff --git a/assets/xml/objects/object_brob.xml b/assets/xml/objects/object_brob.xml index 718dcd5617..bef5bbc55f 100644 --- a/assets/xml/objects/object_brob.xml +++ b/assets/xml/objects/object_brob.xml @@ -1,25 +1,25 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/src/overlays/actors/ovl_En_Brob/z_en_brob.c index 0915fe72b6..e39a5ff212 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -14,13 +14,13 @@ void EnBrob_Destroy(Actor* thisx, PlayState* play); void EnBrob_Update(Actor* thisx, PlayState* play2); void EnBrob_Draw(Actor* thisx, PlayState* play); -void func_809CADDC(EnBrob* this, PlayState* play); -void func_809CB054(EnBrob* this, PlayState* play); -void func_809CB114(EnBrob* this, PlayState* play); -void func_809CB218(EnBrob* this, PlayState* play); -void func_809CB2B8(EnBrob* this, PlayState* play); -void func_809CB354(EnBrob* this, PlayState* play); -void func_809CB458(EnBrob* this, PlayState* play); +void EnBrob_SetupIdle(EnBrob* this, PlayState* play); +void EnBrob_Idle(EnBrob* this, PlayState* play); +void EnBrob_MoveUp(EnBrob* this, PlayState* play); +void EnBrob_Wobble(EnBrob* this, PlayState* play); +void EnBrob_Stunned(EnBrob* this, PlayState* play); +void EnBrob_MoveDown(EnBrob* this, PlayState* play); +void EnBrob_Shock(EnBrob* this, PlayState* play); ActorInit En_Brob_InitVars = { /**/ ACTOR_EN_BROB, @@ -61,16 +61,16 @@ void EnBrob_Init(Actor* thisx, PlayState* play) { EnBrob* this = (EnBrob*)thisx; CollisionHeader* colHeader = NULL; - SkelAnime_InitFlex(play, &this->skelAnime, &object_brob_Skel_0015D8, &object_brob_Anim_001750, this->jointTable, - this->morphTable, 10); + SkelAnime_InitFlex(play, &this->skelAnime, &gBrobSkel, &gBrobMoveUpAnim, this->jointTable, this->morphTable, 10); DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&object_brob_Col_001A70, &colHeader); + CollisionHeader_GetVirtual(&gBrobCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); Collider_InitCylinder(play, &this->colliders[0]); Collider_SetCylinder(play, &this->colliders[0], &this->dyna.actor, &sCylinderInit); Collider_InitCylinder(play, &this->colliders[1]); Collider_SetCylinder(play, &this->colliders[1], &this->dyna.actor, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); + if (((thisx->params >> 8) & 0xFF) == 0) { Actor_SetScale(&this->dyna.actor, 0.01f); thisx->params &= 0xFF; @@ -84,6 +84,7 @@ void EnBrob_Init(Actor* thisx, PlayState* play) { thisx->scale.y *= (thisx->params & 0xFF) * (2.0f / 30.0f); } } + this->colliders[0].dim.radius *= thisx->scale.x; this->colliders[0].dim.height = thisx->scale.y * 12000.0f; this->colliders[0].dim.yShift = 0; @@ -92,7 +93,7 @@ void EnBrob_Init(Actor* thisx, PlayState* play) { this->colliders[1].dim.yShift *= thisx->scale.y; this->actionFunc = NULL; thisx->flags &= ~ACTOR_FLAG_0; - func_809CADDC(this, play); + EnBrob_SetupIdle(this, play); } void EnBrob_Destroy(Actor* thisx, PlayState* play) { @@ -103,82 +104,82 @@ void EnBrob_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->colliders[1]); } -void func_809CADDC(EnBrob* this, PlayState* play) { +void EnBrob_SetupIdle(EnBrob* this, PlayState* play) { DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); - this->timer = this->actionFunc == func_809CB2B8 ? 200 : 0; - this->unk_1AE = 0; - this->actionFunc = func_809CB054; + this->timer = this->actionFunc == EnBrob_Stunned ? 200 : 0; + this->modelOffsetY = 0; + this->actionFunc = EnBrob_Idle; } -void func_809CAE44(EnBrob* this, PlayState* play) { - Animation_PlayOnce(&this->skelAnime, &object_brob_Anim_001750); +void EnBrob_SetupMoveUp(EnBrob* this, PlayState* play) { + Animation_PlayOnce(&this->skelAnime, &gBrobMoveUpAnim); DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); - this->unk_1AE = 1000; - this->actionFunc = func_809CB114; + this->modelOffsetY = 1000; + this->actionFunc = EnBrob_MoveUp; } -void func_809CAEA0(EnBrob* this) { - Animation_MorphToLoop(&this->skelAnime, &object_brob_Anim_001958, -5.0f); - this->unk_1AE = 8000; +void EnBrob_SetupWobble(EnBrob* this) { + Animation_MorphToLoop(&this->skelAnime, &gBrobWobbleAnim, -5.0f); + this->modelOffsetY = 8000; this->timer = 1200; - this->actionFunc = func_809CB218; + this->actionFunc = EnBrob_Wobble; } -void func_809CAEF4(EnBrob* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_brob_Anim_000290, -5.0f); - this->unk_1AE -= 125.0f; +void EnBrob_SetupStunned(EnBrob* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gBrobStunnedAnim, -5.0f); + this->modelOffsetY -= 125.0f; Actor_SetColorFilter(&this->dyna.actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_GOMA_JR_FREEZE); - this->actionFunc = func_809CB2B8; + this->actionFunc = EnBrob_Stunned; } -void func_809CAF88(EnBrob* this) { - Animation_Change(&this->skelAnime, &object_brob_Anim_001750, -1.0f, - Animation_GetLastFrame(&object_brob_Anim_001750), 0.0f, ANIMMODE_ONCE, -5.0f); - this->unk_1AE = 8250; - this->actionFunc = func_809CB354; +void EnBrob_SetupMoveDown(EnBrob* this) { + Animation_Change(&this->skelAnime, &gBrobMoveUpAnim, -1.0f, Animation_GetLastFrame(&gBrobMoveUpAnim), 0.0f, + ANIMMODE_ONCE, -5.0f); + this->modelOffsetY = 8250; + this->actionFunc = EnBrob_MoveDown; } -void func_809CB008(EnBrob* this) { - Animation_MorphToLoop(&this->skelAnime, &object_brob_Anim_001678, -5.0f); +void EnBrob_SetupShock(EnBrob* this) { + Animation_MorphToLoop(&this->skelAnime, &gBrobShockAnim, -5.0f); this->timer = 10; - this->actionFunc = func_809CB458; + this->actionFunc = EnBrob_Shock; } -void func_809CB054(EnBrob* this, PlayState* play) { +void EnBrob_Idle(EnBrob* this, PlayState* play) { if (this->timer != 0) { this->timer--; } if (this->timer == 0) { if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); - func_809CAE44(this, play); + EnBrob_SetupMoveUp(this, play); } else if (this->dyna.actor.xzDistToPlayer < 300.0f) { - func_809CAE44(this, play); + EnBrob_SetupMoveUp(this, play); } } else if (this->timer >= 81) { this->dyna.actor.colorFilterTimer = 80; } } -void func_809CB114(EnBrob* this, PlayState* play) { +void EnBrob_MoveUp(EnBrob* this, PlayState* play) { f32 curFrame; if (SkelAnime_Update(&this->skelAnime)) { - func_809CAEA0(this); + EnBrob_SetupWobble(this); } else { curFrame = this->skelAnime.curFrame; if (curFrame < 8.0f) { - this->unk_1AE += 1000.0f; + this->modelOffsetY += 1000.0f; } else if (curFrame < 12.0f) { - this->unk_1AE += 250.0f; + this->modelOffsetY += 250.0f; } else { - this->unk_1AE -= 250.0f; + this->modelOffsetY -= 250.0f; } } } -void func_809CB218(EnBrob* this, PlayState* play) { +void EnBrob_Wobble(EnBrob* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 6.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_BROB_WAVE); @@ -187,37 +188,37 @@ void func_809CB218(EnBrob* this, PlayState* play) { this->timer--; } if ((this->timer == 0) && (this->dyna.actor.xzDistToPlayer > 500.0f)) { - func_809CAF88(this); + EnBrob_SetupMoveDown(this); } } -void func_809CB2B8(EnBrob* this, PlayState* play) { +void EnBrob_Stunned(EnBrob* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - func_809CADDC(this, play); + EnBrob_SetupIdle(this, play); } else if (this->skelAnime.curFrame < 8.0f) { - this->unk_1AE -= 1250.0f; + this->modelOffsetY -= 1250.0f; } this->dyna.actor.colorFilterTimer = 0x50; } -void func_809CB354(EnBrob* this, PlayState* play) { +void EnBrob_MoveDown(EnBrob* this, PlayState* play) { f32 curFrame; if (SkelAnime_Update(&this->skelAnime)) { - func_809CADDC(this, play); + EnBrob_SetupIdle(this, play); } else { curFrame = this->skelAnime.curFrame; if (curFrame < 8.0f) { - this->unk_1AE -= 1000.0f; + this->modelOffsetY -= 1000.0f; } else if (curFrame < 12.0f) { - this->unk_1AE -= 250.0f; + this->modelOffsetY -= 250.0f; } else { - this->unk_1AE += 250.0f; + this->modelOffsetY += 250.0f; } } } -void func_809CB458(EnBrob* this, PlayState* play) { +void EnBrob_Shock(EnBrob* this, PlayState* play) { Vec3f pos; f32 dist1; f32 dist2; @@ -250,7 +251,7 @@ void func_809CB458(EnBrob* this, PlayState* play) { } if (this->timer == 0) { - func_809CAEA0(this); + EnBrob_SetupWobble(this); } } @@ -270,16 +271,16 @@ void EnBrob_Update(Actor* thisx, PlayState* play2) { this->colliders[i].base.acFlags &= ~AC_HIT; } - func_809CAEF4(this); + EnBrob_SetupStunned(this); } else if ((this->colliders[0].base.atFlags & AT_HIT) || (this->colliders[1].base.atFlags & AT_HIT) || (acHits[0] && (this->colliders[0].info.acHitInfo->toucher.dmgFlags & DMG_SLASH_KOKIRI)) || (acHits[1] && (this->colliders[1].info.acHitInfo->toucher.dmgFlags & DMG_SLASH_KOKIRI))) { - if (this->actionFunc == func_809CB114 && !(this->colliders[0].base.atFlags & AT_BOUNCED) && + if (this->actionFunc == EnBrob_MoveUp && !(this->colliders[0].base.atFlags & AT_BOUNCED) && !(this->colliders[1].base.atFlags & AT_BOUNCED)) { func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); - } else if (this->actionFunc != func_809CB114) { - func_809CB008(this); + } else if (this->actionFunc != EnBrob_MoveUp) { + EnBrob_SetupShock(this); } for (i = 0; i < 2; i++) { @@ -287,12 +288,14 @@ void EnBrob_Update(Actor* thisx, PlayState* play2) { this->colliders[i].base.acFlags &= ~AC_HIT; } } + this->actionFunc(this, play); - if (this->actionFunc != func_809CB054 && this->actionFunc != func_809CB354) { - if (this->actionFunc != func_809CB2B8) { + + if (this->actionFunc != EnBrob_Idle && this->actionFunc != EnBrob_MoveDown) { + if (this->actionFunc != EnBrob_Stunned) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliders[0].base); CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliders[1].base); - if (this->actionFunc != func_809CB114) { + if (this->actionFunc != EnBrob_MoveUp) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliders[0].base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliders[1].base); } @@ -322,7 +325,7 @@ void EnBrob_Draw(Actor* thisx, PlayState* play) { EnBrob* this = (EnBrob*)thisx; Gfx_SetupDL_25Opa(play->state.gfxCtx); - Matrix_Translate(0.0f, this->unk_1AE, 0.0f, MTXMODE_APPLY); + Matrix_Translate(0.0f, this->modelOffsetY, 0.0f, MTXMODE_APPLY); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnBrob_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.h b/src/overlays/actors/ovl_En_Brob/z_en_brob.h index 2e54a46d89..a3dd0c8f8a 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.h +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.h @@ -13,7 +13,7 @@ typedef struct EnBrob { /* 0x0164 */ SkelAnime skelAnime; /* 0x01A8 */ EnBrobActionFunc actionFunc; /* 0x01AC */ s16 timer; - /* 0x01AE */ s16 unk_1AE; + /* 0x01AE */ s16 modelOffsetY; /* 0x01B0 */ Vec3s jointTable[10]; /* 0x01EC */ Vec3s morphTable[10]; /* 0x0228 */ ColliderCylinder colliders[2];