Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc Actor: En_Brob (Jabu Jabu Wobble Flesh Block) #1581

Merged
merged 8 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions assets/xml/objects/object_brob.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<Root>
<File Name="object_brob" Segment="6">
<Animation Name="object_brob_Anim_000290" Offset="0x290"/>
<DList Name="object_brob_DL_0007E0" Offset="0x7E0"/>
<DList Name="object_brob_DL_000898" Offset="0x898"/>
<DList Name="object_brob_DL_0009D0" Offset="0x9D0"/>
<DList Name="object_brob_DL_000AE8" Offset="0xAE8"/>
<DList Name="object_brob_DL_000C00" Offset="0xC00"/>
<Texture Name="object_brob_Tex_000D48" OutName="tex_00000D48" Format="rgba16" Width="32" Height="32" Offset="0xD48"/>
<Limb Name="object_brob_Limb_001548" LimbType="Standard" Offset="0x1548"/>
<Limb Name="object_brob_Limb_001554" LimbType="Standard" Offset="0x1554"/>
<Limb Name="object_brob_Limb_001560" LimbType="Standard" Offset="0x1560"/>
<Limb Name="object_brob_Limb_00156C" LimbType="Standard" Offset="0x156C"/>
<Limb Name="object_brob_Limb_001578" LimbType="Standard" Offset="0x1578"/>
<Limb Name="object_brob_Limb_001584" LimbType="Standard" Offset="0x1584"/>
<Limb Name="object_brob_Limb_001590" LimbType="Standard" Offset="0x1590"/>
<Limb Name="object_brob_Limb_00159C" LimbType="Standard" Offset="0x159C"/>
<Limb Name="object_brob_Limb_0015A8" LimbType="Standard" Offset="0x15A8"/>
<Skeleton Name="object_brob_Skel_0015D8" Type="Flex" LimbType="Standard" Offset="0x15D8"/>
<Animation Name="object_brob_Anim_001678" Offset="0x1678"/>
<Animation Name="object_brob_Anim_001750" Offset="0x1750"/>
<Animation Name="object_brob_Anim_001958" Offset="0x1958"/>
<Collision Name="object_brob_Col_001A70" Offset="0x1A70"/>
<Animation Name="gBrobStunnedAnim" Offset="0x290"/>
<DList Name="gBrobBaseSegmentDL" Offset="0x7E0"/>
<DList Name="gBrobLowerSegmentDL" Offset="0x898"/>
<DList Name="gBrobMiddleSegmentDL" Offset="0x9D0"/>
<DList Name="gBrobUpperSegmentDL" Offset="0xAE8"/>
<DList Name="gBrobTopSegmentDL" Offset="0xC00"/>
<Texture Name="gBrobFleshTex" OutName="flesh" Format="rgba16" Width="32" Height="32" Offset="0xD48"/>
<Limb Name="gBrobRootLimb" LimbType="Standard" Offset="0x1548"/>
<Limb Name="gBrobBaseSegmentRootLimb" LimbType="Standard" Offset="0x1554"/>
<Limb Name="gBrobBaseSegmentLimb" LimbType="Standard" Offset="0x1560"/>
<Limb Name="gBrobLowerSegmentLimb" LimbType="Standard" Offset="0x156C"/>
<Limb Name="gBrobLowerSegmentRootLimb" LimbType="Standard" Offset="0x1578"/>
hiisuya marked this conversation as resolved.
Show resolved Hide resolved
<Limb Name="gBrobMiddleSegmentLimb" LimbType="Standard" Offset="0x1584"/>
<Limb Name="gBrobUpperSegmentRootLimb" LimbType="Standard" Offset="0x1590"/>
<Limb Name="gBrobUpperSegmentLimb" LimbType="Standard" Offset="0x159C"/>
<Limb Name="gBrobTopSegmentLimb" LimbType="Standard" Offset="0x15A8"/>
<Skeleton Name="gBrobSkel" Type="Flex" LimbType="Standard" Offset="0x15D8"/>
<Animation Name="gBrobShockAnim" Offset="0x1678"/>
<Animation Name="gBrobMoveUpAnim" Offset="0x1750"/>
<Animation Name="gBrobWobbleAnim" Offset="0x1958"/>
<Collision Name="gBrobCol" Offset="0x1A70"/>
</File>
</Root>
129 changes: 66 additions & 63 deletions src/overlays/actors/ovl_En_Brob/z_en_brob.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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) {
Expand All @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -250,7 +251,7 @@ void func_809CB458(EnBrob* this, PlayState* play) {
}

if (this->timer == 0) {
func_809CAEA0(this);
EnBrob_SetupWobble(this);
}
}

Expand All @@ -270,29 +271,31 @@ 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++) {
this->colliders[i].base.atFlags &= ~(AT_HIT | AT_BOUNCED);
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);
}
Expand Down Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_En_Brob/z_en_brob.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down