diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 07ca0ebbef..b7bdb7c9e8 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -16,46 +16,46 @@ void EnDinofos_Destroy(Actor* thisx, PlayState* play); void EnDinofos_Update(Actor* thisx, PlayState* play2); void EnDinofos_Draw(Actor* thisx, PlayState* play); -void func_8089B834(EnDinofos* this, PlayState* play); -void func_8089D318(EnDinofos* this, PlayState* play); -void func_8089BBB4(EnDinofos* this, PlayState* play); -void func_8089B8B0(EnDinofos* this, PlayState* play); -void func_8089C56C(EnDinofos* this, PlayState* play); -void func_8089C44C(EnDinofos* this, PlayState* play); -void func_8089BB60(EnDinofos* this, PlayState* play); -void func_8089C0DC(EnDinofos* this, PlayState* play); -void func_8089D018(EnDinofos* this, PlayState* play); -void func_8089B288(EnDinofos* this, PlayState* play); -void func_8089BD28(EnDinofos* this, PlayState* play); -void func_8089D1E0(EnDinofos* this, PlayState* play); -void func_8089B98C(EnDinofos* this, PlayState* play); -void func_8089CA74(EnDinofos* this, PlayState* play); -void func_8089B3D4(EnDinofos* this, PlayState* play); -void func_8089CB10(EnDinofos* this, PlayState* play); -void func_8089CBEC(EnDinofos* this, PlayState* play); -void func_8089CF00(EnDinofos* this, PlayState* play); -void func_8089CF70(EnDinofos* this, PlayState* play); -void func_8089B580(EnDinofos* this, PlayState* play); -void func_8089B72C(EnDinofos* this, PlayState* play); -void func_8089C2A8(EnDinofos* this, PlayState* play); -void func_8089C1F8(EnDinofos* this, PlayState* play); -void func_8089C724(EnDinofos* this, PlayState* play); -void func_8089C7B8(EnDinofos* this, PlayState* play); -void func_8089C938(EnDinofos* this, PlayState* play); -void func_8089C4F8(EnDinofos* this); -void func_8089BAC0(EnDinofos* this); -void func_8089C024(EnDinofos* this, s32 arg1); -void func_8089D11C(EnDinofos* this, s16 arg1); -void func_8089B7B0(EnDinofos* this); -void func_8089D2E0(EnDinofos* this); -void func_8089CA14(EnDinofos* this); -void func_8089B320(EnDinofos* this); -void func_8089B4A4(EnDinofos* this); -void func_8089B6E8(EnDinofos* this); -void func_8089CFAC(EnDinofos* this); -void func_8089C398(EnDinofos* this); -void func_8089C164(EnDinofos* this); -void func_8089C244(EnDinofos* this); +void EnDinofos_Idle(EnDinofos* this, PlayState* play); +void EnDinofos_PlayCutscene(EnDinofos* this, PlayState* play); +void EnDinofos_SetupCircleAroundPlayer(EnDinofos* this, PlayState* play); +void EnDinofos_SetupWalk(EnDinofos* this, PlayState* play); +void EnDinofos_Slash(EnDinofos* this, PlayState* play); +void EnDinofos_Land(EnDinofos* this, PlayState* play); +void EnDinofos_TurnToPlayer(EnDinofos* this, PlayState* play); +void EnDinofos_ChooseJump(EnDinofos* this, PlayState* play); +void EnDinofos_Die(EnDinofos* this, PlayState* play); +void EnDinofos_IntroCutsceneBeforeFall(EnDinofos* this, PlayState* play); +void EnDinofos_CircleAroundPlayer(EnDinofos* this, PlayState* play); +void EnDinofos_DodgeProjectile(EnDinofos* this, PlayState* play); +void EnDinofos_Walk(EnDinofos* this, PlayState* play); +void EnDinofos_StartBreatheFire(EnDinofos* this, PlayState* play); +void EnDinofos_IntroCutsceneFall(EnDinofos* this, PlayState* play); +void EnDinofos_SetupBreatheFire(EnDinofos* this, PlayState* play); +void EnDinofos_BreatheFire(EnDinofos* this, PlayState* play); +void EnDinofos_SetupEndBreatheFire(EnDinofos* this, PlayState* play); +void EnDinofos_EndBreatheFire(EnDinofos* this, PlayState* play); +void EnDinofos_IntroCutsceneLandAndBreatheFire(EnDinofos* this, PlayState* play); +void EnDinofos_IntroCutsceneYell(EnDinofos* this, PlayState* play); +void EnDinofos_JumpSlash(EnDinofos* this, PlayState* play); +void EnDinofos_Jump(EnDinofos* this, PlayState* play); +void EnDinofos_Recoil(EnDinofos* this, PlayState* play); +void EnDinofos_Stunned(EnDinofos* this, PlayState* play); +void EnDinofos_Damaged(EnDinofos* this, PlayState* play); +void EnDinofos_SetupSlash(EnDinofos* this); +void EnDinofos_SetupTurnToPlayer(EnDinofos* this); +void EnDinofos_SetupChooseJump(EnDinofos* this, s32 jumpType); +void EnDinofos_SetupDodgeProjectile(EnDinofos* this, s16 angleToProjectile); +void EnDinofos_SetupIdle(EnDinofos* this); +void EnDinofos_SetupPlayCutscene(EnDinofos* this); +void EnDinofos_SetupStartBreatheFire(EnDinofos* this); +void EnDinofos_SetupIntroCutsceneFall(EnDinofos* this); +void EnDinofos_SetupIntroCutsceneLandAndBreatheFire(EnDinofos* this); +void EnDinofos_SetupIntroCutsceneYell(EnDinofos* this); +void EnDinofos_SetupDie(EnDinofos* this); +void EnDinofos_SetupLand(EnDinofos* this); +void EnDinofos_SetupJump(EnDinofos* this); +void EnDinofos_SetupJumpSlash(EnDinofos* this); ActorInit En_Dinofos_InitVars = { /**/ ACTOR_EN_DINOFOS, @@ -79,7 +79,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, - { 1, { { 200, 300, 0 }, 19 }, 100 }, + { DINOLFOS_LIMB_LOWER_BODY, { { 200, 300, 0 }, 19 }, 100 }, }, { { @@ -90,7 +90,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, - { 8, { { 200, 200, 0 }, 17 }, 100 }, + { DINOLFOS_LIMB_UPPER_BODY, { { 200, 200, 0 }, 17 }, 100 }, }, { { @@ -101,7 +101,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, - { 16, { { 600, 200, 0 }, 15 }, 100 }, + { DINOLFOS_LIMB_HEAD, { { 600, 200, 0 }, 15 }, 100 }, }, { { @@ -112,7 +112,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, - { 15, { { 700, 100, 0 }, 10 }, 100 }, + { DINOLFOS_LIMB_NECK, { { 700, 100, 0 }, 10 }, 100 }, }, { { @@ -123,7 +123,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, - { 2, { { 1300, 100, 0 }, 12 }, 100 }, + { DINOLFOS_LIMB_LEFT_UPPER_LEG, { { 1300, 100, 0 }, 12 }, 100 }, }, { { @@ -134,7 +134,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, }, - { 5, { { 1300, 100, 0 }, 12 }, 100 }, + { DINOLFOS_LIMB_RIGHT_UPPER_LEG, { { 1300, 100, 0 }, 12 }, 100 }, }, { { @@ -145,7 +145,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { BUMP_NONE, OCELEM_NONE, }, - { 21, { { 0, -10, 35 }, 20 }, 100 }, + { DINOLFOS_LIMB_MAX, { { 0, -10, 35 }, 20 }, 100 }, }, { { @@ -156,7 +156,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { BUMP_NONE, OCELEM_NONE, }, - { 21, { { 0, -10, 70 }, 28 }, 100 }, + { DINOLFOS_LIMB_MAX, { { 0, -10, 70 }, 28 }, 100 }, }, { { @@ -167,7 +167,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[9] = { BUMP_NONE, OCELEM_NONE, }, - { 21, { { 0, -5, 110 }, 30 }, 100 }, + { DINOLFOS_LIMB_MAX, { { 0, -5, 110 }, 30 }, 100 }, }, }; @@ -204,39 +204,49 @@ static ColliderQuadInit sQuadInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; +typedef enum EnDinofosDamageEffect { + /* 0x0 */ DINOLFOS_DMGEFF_NONE, + /* 0x1 */ DINOLFOS_DMGEFF_STUN, + /* 0x2 */ DINOLFOS_DMGEFF_FIRE, + /* 0x3 */ DINOLFOS_DMGEFF_ICE, + /* 0x4 */ DINOLFOS_DMGEFF_LIGHT_SPARKS, + /* 0x5 */ DINOLFOS_DMGEFF_ZORA_MAGIC, + /* 0xF */ DINOLFOS_DMGEFF_IMMUNE = 0xF +} EnDinofosDamageEffect; + static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, 0x1), - /* Deku Stick */ DMG_ENTRY(1, 0x0), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(1, 0x0), - /* Zora boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(1, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0xF), - /* Goron punch */ DMG_ENTRY(1, 0x0), - /* Sword */ DMG_ENTRY(1, 0x0), - /* Goron pound */ DMG_ENTRY(1, 0x0), - /* Fire arrow */ DMG_ENTRY(1, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x4), - /* Goron spikes */ DMG_ENTRY(1, 0x0), - /* Deku spin */ DMG_ENTRY(0, 0x1), - /* Deku bubble */ DMG_ENTRY(1, 0x0), - /* Deku launch */ DMG_ENTRY(2, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x1), - /* Zora barrier */ DMG_ENTRY(0, 0x5), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(1, 0x0), - /* Zora punch */ DMG_ENTRY(1, 0x0), - /* Spin attack */ DMG_ENTRY(1, 0x0), - /* Sword beam */ DMG_ENTRY(1, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(1, 0x0), + /* Deku Nut */ DMG_ENTRY(0, DINOLFOS_DMGEFF_STUN), + /* Deku Stick */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Horse trample */ DMG_ENTRY(0, DINOLFOS_DMGEFF_NONE), + /* Explosives */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Zora boomerang */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Normal arrow */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, DINOLFOS_DMGEFF_NONE), + /* Hookshot */ DMG_ENTRY(0, DINOLFOS_DMGEFF_IMMUNE), + /* Goron punch */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Sword */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Goron pound */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Fire arrow */ DMG_ENTRY(1, DINOLFOS_DMGEFF_FIRE), + /* Ice arrow */ DMG_ENTRY(2, DINOLFOS_DMGEFF_ICE), + /* Light arrow */ DMG_ENTRY(2, DINOLFOS_DMGEFF_LIGHT_SPARKS), + /* Goron spikes */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Deku spin */ DMG_ENTRY(0, DINOLFOS_DMGEFF_STUN), + /* Deku bubble */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Deku launch */ DMG_ENTRY(2, DINOLFOS_DMGEFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, DINOLFOS_DMGEFF_STUN), + /* Zora barrier */ DMG_ENTRY(0, DINOLFOS_DMGEFF_ZORA_MAGIC), + /* Normal shield */ DMG_ENTRY(0, DINOLFOS_DMGEFF_NONE), + /* Light ray */ DMG_ENTRY(0, DINOLFOS_DMGEFF_NONE), + /* Thrown object */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Zora punch */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Spin attack */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Sword beam */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, DINOLFOS_DMGEFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, DINOLFOS_DMGEFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, DINOLFOS_DMGEFF_NONE), + /* Unblockable */ DMG_ENTRY(0, DINOLFOS_DMGEFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, DINOLFOS_DMGEFF_NONE), + /* Powder Keg */ DMG_ENTRY(1, DINOLFOS_DMGEFF_NONE), }; static CollisionCheckInfoInit sColChkInfoInit = { 4, 40, 100, 80 }; @@ -249,7 +259,7 @@ static TexturePtr sEyeTextures[] = { }; static s16 sCsId = CS_ID_NONE; -static s32 D_8089E350 = 0; +static s32 sNumAlive = 0; static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 2000, ICHAIN_CONTINUE), @@ -260,7 +270,7 @@ static InitChainEntry sInitChain[] = { void EnDinofos_Init(Actor* thisx, PlayState* play) { static s32 sTexturesDesegmented = false; - static EffectBlureInit2 D_8089E368 = { + static EffectBlureInit2 sBlureInit = { 0, EFFECT_BLURE_ELEMENT_FLAG_8, 0, @@ -281,9 +291,10 @@ void EnDinofos_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f); - Effect_Add(play, &this->unk_2A0, EFFECT_BLURE2, 0, 0, &D_8089E368); - Collider_InitAndSetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElement); - Collider_InitAndSetQuad(play, &this->colliderQuad, &this->actor, &sQuadInit); + Effect_Add(play, &this->effectIndex, EFFECT_BLURE2, 0, 0, &sBlureInit); + Collider_InitAndSetJntSph(play, &this->bodyAndFireCollider, &this->actor, &sJntSphInit, + this->bodyAndFireColliderElements); + Collider_InitAndSetQuad(play, &this->knifeCollider, &this->actor, &sQuadInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); SkelAnime_InitFlex(play, &this->skelAnime, &gDinolfosSkel, &gDinolfosIdleAnim, this->jointTable, this->morphTable, DINOLFOS_LIMB_MAX); @@ -295,84 +306,86 @@ void EnDinofos_Init(Actor* thisx, PlayState* play) { sTexturesDesegmented = true; } - this->unk_288 = 255; - for (i = 6; i < ARRAY_COUNT(this->colliderJntSphElement); i++) { - dim = &this->colliderJntSph.elements[i].dim; + this->envColorAlpha = 255; + + for (i = DINOFOS_COLLIDER_FIRE_START_INDEX; i < ARRAY_COUNT(this->bodyAndFireColliderElements); i++) { + dim = &this->bodyAndFireCollider.elements[i].dim; dim->worldSphere.radius = dim->modelSphere.radius; } - this->unk_28B = 0; - if (thisx->csId == CS_ID_NONE) { - func_8089B7B0(this); + this->isDodgingGoronPound = false; + + if (this->actor.csId == CS_ID_NONE) { + EnDinofos_SetupIdle(this); } else { this->actor.flags |= ACTOR_FLAG_100000; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; sCsId = thisx->csId; - func_8089D2E0(this); + EnDinofos_SetupPlayCutscene(this); } - D_8089E350++; + sNumAlive++; } void EnDinofos_Destroy(Actor* thisx, PlayState* play) { EnDinofos* this = THIS; - Effect_Destroy(play, this->unk_2A0); - Collider_DestroyJntSph(play, &this->colliderJntSph); - Collider_DestroyQuad(play, &this->colliderQuad); + Effect_Destroy(play, this->effectIndex); + Collider_DestroyJntSph(play, &this->bodyAndFireCollider); + Collider_DestroyQuad(play, &this->knifeCollider); } -void func_8089A900(EnDinofos* this) { - if (this->unk_289 != 0) { - this->unk_289++; - if (this->unk_289 == 4) { - this->unk_289 = 0; +void EnDinofos_Blink(EnDinofos* this) { + if (this->eyeTexIndex != 0) { + this->eyeTexIndex++; + if (this->eyeTexIndex == 4) { + this->eyeTexIndex = 0; } } else if (Rand_ZeroOne() < 0.05f) { - this->unk_289 = 1; + this->eyeTexIndex = 1; } } -s32 func_8089A968(EnDinofos* this) { - s16 temp_v0 = (this->actor.yawTowardsPlayer - this->unk_28E) - this->actor.shape.rot.y; +s32 EnDinofos_IsFacingPlayer(EnDinofos* this) { + s16 angleToPlayer = (this->actor.yawTowardsPlayer - this->headRotY) - this->actor.shape.rot.y; - if (ABS_ALT(temp_v0) < 0x3000) { + if (ABS_ALT(angleToPlayer) < 0x3000) { return true; } return false; } -void func_8089A9B0(EnDinofos* this, PlayState* play) { - if (func_8089A968(this)) { +void EnDinofos_ChooseAction(EnDinofos* this, PlayState* play) { + if (EnDinofos_IsFacingPlayer(this)) { if (this->actor.xzDistToPlayer < 100.0f) { if (!Actor_OtherIsTargeted(play, &this->actor) && - (((this->actionFunc != func_8089C56C) && (Rand_ZeroOne() > 0.35f)) || - ((this->actionFunc == func_8089C56C) && (Rand_ZeroOne() > 0.8f)))) { - func_8089C4F8(this); + (((this->actionFunc != EnDinofos_Slash) && (Rand_ZeroOne() > 0.35f)) || + ((this->actionFunc == EnDinofos_Slash) && (Rand_ZeroOne() > 0.8f)))) { + EnDinofos_SetupSlash(this); } else { - func_8089BBB4(this, play); + EnDinofos_SetupCircleAroundPlayer(this, play); } } else if ((this->actor.xzDistToPlayer < 260.0f) && (this->actor.xzDistToPlayer > 180.0f)) { - if (((this->actionFunc != func_8089C44C) && (Rand_ZeroOne() < 0.1f)) || - ((this->actionFunc == func_8089C44C) && (Rand_ZeroOne() < 0.05f))) { - func_8089C024(this, 0); + if (((this->actionFunc != EnDinofos_Land) && (Rand_ZeroOne() < 0.1f)) || + ((this->actionFunc == EnDinofos_Land) && (Rand_ZeroOne() < 0.05f))) { + EnDinofos_SetupChooseJump(this, DINOFOS_JUMP_TYPE_FORWARD); } else { - func_8089BBB4(this, play); + EnDinofos_SetupCircleAroundPlayer(this, play); } } else if (Rand_ZeroOne() < 0.8f) { - func_8089B8B0(this, play); + EnDinofos_SetupWalk(this, play); } else { - func_8089BBB4(this, play); + EnDinofos_SetupCircleAroundPlayer(this, play); } } else if (Rand_ZeroOne() < 0.6f) { - func_8089BAC0(this); + EnDinofos_SetupTurnToPlayer(this); } else { - func_8089B7B0(this); + EnDinofos_SetupIdle(this); } } -void func_8089ABF4(EnDinofos* this, PlayState* play) { +void EnDinofos_EndCutscene(EnDinofos* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { Camera* subCam = Play_GetCamera(play, this->subCamId); @@ -385,143 +398,149 @@ void func_8089ABF4(EnDinofos* this, PlayState* play) { } } -void func_8089AC70(EnDinofos* this) { +void EnDinofos_Freeze(EnDinofos* this) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; this->drawDmgEffScale = 0.55f; - this->colliderJntSph.base.colType = COLTYPE_HIT3; + this->bodyAndFireCollider.base.colType = COLTYPE_HIT3; this->drawDmgEffFrozenSteamScale = 825.0f * 0.001f; this->drawDmgEffAlpha = 1.0f; - this->unk_290 = 80; + this->stunTimer = 80; this->actor.flags &= ~ACTOR_FLAG_400; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 80); } -void func_8089ACEC(EnDinofos* this, PlayState* play) { +void EnDinofos_ThawIfFrozen(EnDinofos* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; - this->colliderJntSph.base.colType = COLTYPE_HIT0; + this->bodyAndFireCollider.base.colType = COLTYPE_HIT0; this->drawDmgEffAlpha = 0.0f; Actor_SpawnIceEffects(play, &this->actor, this->bodyPartsPos, DINOFOS_BODYPART_MAX, 2, 0.3f, 0.2f); this->actor.flags |= ACTOR_FLAG_400; } } -void func_8089AD70(EnDinofos* this) { +/** + * After this function is run, Dinolfos resumes being vulnerable to goron pound if it had dodged one. + */ +void EnDinofos_EnableBumperCollision(EnDinofos* this) { s32 i; - if (this->unk_28B != 0) { - for (i = 0; i < ARRAY_COUNT(this->colliderJntSphElement) - 3; i++) { - this->colliderJntSph.elements[i].info.bumper.dmgFlags |= 0x400; + if (this->isDodgingGoronPound) { + for (i = 0; i < DINOFOS_COLLIDER_FIRE_START_INDEX; i++) { + this->bodyAndFireCollider.elements[i].info.bumper.dmgFlags |= 0x400; } - this->unk_28B = 0; + this->isDodgingGoronPound = false; } } -s32 func_8089AE00(EnDinofos* this, PlayState* play) { +s32 EnDinofos_Dodge(EnDinofos* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 temp_v1; - s16 temp_v1_2; - Actor* temp_v0; + s16 angleToProjectile; + s16 angleToBombchu; + Actor* actor; s32 i; - temp_v0 = func_800BC270(play, &this->actor, 80.0f, 0x138B0); - if (temp_v0 != NULL) { - temp_v1 = (Actor_WorldYawTowardActor(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; - if (ABS_ALT(temp_v1) < 0x3000) { - func_8089D11C(this, temp_v1 + this->unk_28E); + // Subtracts headRotY from angleToProjectile to then add it back. + actor = func_800BC270(play, &this->actor, 80.0f, 0x138B0); + if (actor != NULL) { + angleToProjectile = (Actor_WorldYawTowardActor(&this->actor, actor) - this->actor.shape.rot.y) - this->headRotY; + if (ABS_ALT(angleToProjectile) < 0x3000) { + EnDinofos_SetupDodgeProjectile(this, angleToProjectile + this->headRotY); Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WARAU); return true; } } - temp_v0 = func_800BC444(play, &this->actor, 80.0f); - if ((temp_v0 != NULL) && (temp_v0->id == ACTOR_EN_BOM_CHU)) { - temp_v1_2 = (Actor_WorldYawTowardActor(&this->actor, temp_v0) - this->actor.shape.rot.y) - this->unk_28E; - if (ABS_ALT(temp_v1_2) < 0x3000) { - func_8089C024(this, 1); + actor = func_800BC444(play, &this->actor, 80.0f); + if ((actor != NULL) && (actor->id == ACTOR_EN_BOM_CHU)) { + angleToBombchu = (Actor_WorldYawTowardActor(&this->actor, actor) - this->actor.shape.rot.y) - this->headRotY; + if (ABS_ALT(angleToBombchu) < 0x3000) { + EnDinofos_SetupChooseJump(this, DINOFOS_JUMP_TYPE_IN_PLACE); Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WARAU); return true; } } if (play->actorCtx.unk2 != 0) { - func_8089C024(this, 1); + EnDinofos_SetupChooseJump(this, DINOFOS_JUMP_TYPE_IN_PLACE); return true; } if ((this->actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) && - this->actor.isLockedOn && (Rand_ZeroOne() < 0.5f) && func_8089A968(this) && + this->actor.isLockedOn && (Rand_ZeroOne() < 0.5f) && EnDinofos_IsFacingPlayer(this) && Player_IsFacingActor(&this->actor, 0x2000, play)) { if (Rand_ZeroOne() < 0.5f) { - func_8089C024(this, 2); + EnDinofos_SetupChooseJump(this, DINOFOS_JUMP_TYPE_BACKWARD); } else { - func_8089C024(this, 3); + EnDinofos_SetupChooseJump(this, DINOFOS_JUMP_TYPE_SLASH); } Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WARAU); return true; } if ((GET_PLAYER_FORM == PLAYER_FORM_GORON) && (player->actor.velocity.y < -5.0f) && (player->av1.actionVar1 == 1) && - (this->unk_28B == 0)) { - this->unk_28B = 1; - for (i = 0; i < ARRAY_COUNT(this->colliderJntSphElement) - 3; i++) { - this->colliderJntSph.elements[i].info.bumper.dmgFlags &= ~0x400; + (!this->isDodgingGoronPound)) { + this->isDodgingGoronPound = true; + for (i = 0; i < DINOFOS_COLLIDER_FIRE_START_INDEX; i++) { + this->bodyAndFireCollider.elements[i].info.bumper.dmgFlags &= ~0x400; } } return false; } -void func_8089B100(EnDinofos* this, PlayState* play) { +void EnDinofos_SetupIntroCutsceneBeforeFall(EnDinofos* this, PlayState* play) { Camera* subCam = Play_GetCamera(play, this->subCamId); Player* player = GET_PLAYER(play); - Vec3f sp3C; + Vec3f diffToPlayer; Animation_Change(&this->skelAnime, &gDinolfosJumpAnim, 1.0f, Animation_GetLastFrame(&gDinolfosJumpAnim), Animation_GetLastFrame(&gDinolfosJumpAnim), ANIMMODE_ONCE, 0.0f); - func_800BE33C(&subCam->eye, &subCam->at, &this->unk_29A, true); - Math_Vec3f_Diff(&this->actor.world.pos, &player->actor.world.pos, &sp3C); - this->unk_2BC.x = player->actor.world.pos.x + (0.4f * sp3C.x); - this->unk_2BC.y = player->actor.world.pos.y + 5.0f; - this->unk_2BC.z = player->actor.world.pos.z + (0.4f * sp3C.z); - this->unk_2C8.x = this->actor.world.pos.x; - this->unk_2C8.y = this->actor.focus.pos.y - 400.0f; - this->unk_2C8.z = this->actor.world.pos.z; - this->unk_2AC = Math_Vec3f_DistXYZ(&subCam->eye, &this->unk_2BC) * 0.05f; - this->unk_2A8 = Math_Vec3f_DistXYZ(&subCam->at, &this->unk_2C8) * 0.05f; - this->unk_290 = 20; - this->actionFunc = func_8089B288; + func_800BE33C(&subCam->eye, &subCam->at, &this->subCamRot, true); + Math_Vec3f_Diff(&this->actor.world.pos, &player->actor.world.pos, &diffToPlayer); + this->subCamEye.x = player->actor.world.pos.x + (0.4f * diffToPlayer.x); + this->subCamEye.y = player->actor.world.pos.y + 5.0f; + this->subCamEye.z = player->actor.world.pos.z + (0.4f * diffToPlayer.z); + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.y = this->actor.focus.pos.y - 400.0f; + this->subCamAt.z = this->actor.world.pos.z; + this->subCamEyeStep = Math_Vec3f_DistXYZ(&subCam->eye, &this->subCamEye) * 0.05f; + this->subCamAtStep = Math_Vec3f_DistXYZ(&subCam->at, &this->subCamAt) * 0.05f; + this->cutsceneTimer = 20; + this->actionFunc = EnDinofos_IntroCutsceneBeforeFall; } -void func_8089B288(EnDinofos* this, PlayState* play) { +void EnDinofos_IntroCutsceneBeforeFall(EnDinofos* this, PlayState* play) { Camera* subCam = Play_GetCamera(play, this->subCamId); - this->unk_290--; - Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, this->unk_2AC); - Math_Vec3f_StepTo(&subCam->at, &this->unk_2C8, this->unk_2A8); + this->cutsceneTimer--; + Math_Vec3f_StepTo(&subCam->eye, &this->subCamEye, this->subCamEyeStep); + Math_Vec3f_StepTo(&subCam->at, &this->subCamAt, this->subCamAtStep); Play_SetCameraAtEye(play, this->subCamId, &subCam->at, &subCam->eye); - if (this->unk_290 == 0) { - func_8089B320(this); + + if (this->cutsceneTimer == 0) { + EnDinofos_SetupIntroCutsceneFall(this); } } -void func_8089B320(EnDinofos* this) { +void EnDinofos_SetupIntroCutsceneFall(EnDinofos* this) { this->actor.gravity = -2.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); - this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y - 0x0E00) * 86.0f) + this->actor.world.pos.x; - this->unk_2BC.y = this->actor.floorHeight + 6.0f; - this->unk_2BC.z = (Math_CosS(this->actor.shape.rot.y - 0x0E00) * 86.0f) + this->actor.world.pos.z; - this->unk_290 = 0; - this->actionFunc = func_8089B3D4; + this->subCamEye.x = (Math_SinS(this->actor.shape.rot.y - 0x0E00) * 86.0f) + this->actor.world.pos.x; + this->subCamEye.y = this->actor.floorHeight + 6.0f; + this->subCamEye.z = (Math_CosS(this->actor.shape.rot.y - 0x0E00) * 86.0f) + this->actor.world.pos.z; + this->cutsceneTimer = 0; + this->actionFunc = EnDinofos_IntroCutsceneFall; } -void func_8089B3D4(EnDinofos* this, PlayState* play) { +void EnDinofos_IntroCutsceneFall(EnDinofos* this, PlayState* play) { Camera* subCam = Play_GetCamera(play, this->subCamId); Vec3f subCamAt; - Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); - this->unk_290++; - if (this->unk_290 == 10) { + Math_Vec3f_StepTo(&subCam->eye, &this->subCamEye, 10.0f); + this->cutsceneTimer++; + + if (this->cutsceneTimer == 10) { Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); } @@ -535,29 +554,29 @@ void func_8089B3D4(EnDinofos* this, PlayState* play) { Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCam->eye); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_8089B4A4(this); + EnDinofos_SetupIntroCutsceneLandAndBreatheFire(this); } } -void func_8089B4A4(EnDinofos* this) { - if (this->unk_290 < 10) { +void EnDinofos_SetupIntroCutsceneLandAndBreatheFire(EnDinofos* this) { + if (this->cutsceneTimer < 10) { Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); } Animation_PlayOnce(&this->skelAnime, &gDinolfosIntroAnim); - this->unk_2BC.x = (Math_SinS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.x; - this->unk_2BC.y = this->actor.floorHeight + 11.0f; - this->unk_2BC.z = (Math_CosS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.z; + this->subCamEye.x = (Math_SinS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.x; + this->subCamEye.y = this->actor.floorHeight + 11.0f; + this->subCamEye.z = (Math_CosS(this->actor.shape.rot.y + 0x200) * 123.0f) + this->actor.world.pos.z; Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_WALK); - this->unk_290 = 0; - this->unk_292 = -1; - this->actionFunc = func_8089B580; + this->cutsceneTimer = 0; + this->timer2 = -1; + this->actionFunc = EnDinofos_IntroCutsceneLandAndBreatheFire; } -void func_8089B580(EnDinofos* this, PlayState* play) { +void EnDinofos_IntroCutsceneLandAndBreatheFire(EnDinofos* this, PlayState* play) { Camera* subCam = Play_GetCamera(play, this->subCamId); - this->unk_290++; - if (this->unk_290 < 8) { + this->cutsceneTimer++; + if (this->cutsceneTimer < 8) { Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); } @@ -566,7 +585,7 @@ void func_8089B580(EnDinofos* this, PlayState* play) { play->envCtx.lightSettingOverride = 11; } - Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); + Math_Vec3f_StepTo(&subCam->eye, &this->subCamEye, 10.0f); Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCam->eye); if (this->skelAnime.curFrame <= 55.0f) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); @@ -578,102 +597,102 @@ void func_8089B580(EnDinofos* this, PlayState* play) { } if (SkelAnime_Update(&this->skelAnime)) { - func_8089B6E8(this); + EnDinofos_SetupIntroCutsceneYell(this); } } -void func_8089B6E8(EnDinofos* this) { +void EnDinofos_SetupIntroCutsceneYell(EnDinofos* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gDinolfosCryAnim, -3.0f); - this->actionFunc = func_8089B72C; + this->actionFunc = EnDinofos_IntroCutsceneYell; } -void func_8089B72C(EnDinofos* this, PlayState* play) { +void EnDinofos_IntroCutsceneYell(EnDinofos* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, 2.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); } if (SkelAnime_Update(&this->skelAnime)) { - func_8089ABF4(this, play); + EnDinofos_EndCutscene(this, play); this->actor.flags &= ~ACTOR_FLAG_100000; this->actor.csId = CS_ID_NONE; - func_8089B7B0(this); + EnDinofos_SetupIdle(this); } } -void func_8089B7B0(EnDinofos* this) { +void EnDinofos_SetupIdle(EnDinofos* this) { Animation_MorphToLoop(&this->skelAnime, &gDinolfosIdleAnim, -4.0f); - this->unk_290 = (s32)Rand_ZeroFloat(20.0f) + 40; - this->unk_292 = 30; + this->actionTimer = (s32)Rand_ZeroFloat(20.0f) + 40; + this->idleTimer = 30; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - func_8089AD70(this); - this->actionFunc = func_8089B834; + EnDinofos_EnableBumperCollision(this); + this->actionFunc = EnDinofos_Idle; } -void func_8089B834(EnDinofos* this, PlayState* play) { +void EnDinofos_Idle(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 != 0) { - this->unk_292--; - } else if (func_8089A968(this)) { - this->unk_290 = 0; + if (this->idleTimer != 0) { + this->idleTimer--; + } else if (EnDinofos_IsFacingPlayer(this)) { + this->actionTimer = 0; } - if (this->unk_290 != 0) { - this->unk_290--; + if (this->actionTimer != 0) { + this->actionTimer--; } else { - func_8089A9B0(this, play); + EnDinofos_ChooseAction(this, play); } } -void func_8089B8B0(EnDinofos* this, PlayState* play) { - f32 phi_f0; +void EnDinofos_SetupWalk(EnDinofos* this, PlayState* play) { + f32 targetDist; - if (this->actionFunc != func_8089B98C) { + if (this->actionFunc != EnDinofos_Walk) { Animation_MorphToLoop(&this->skelAnime, &gDinolfosWalkAnim, -4.0f); if (Actor_OtherIsTargeted(play, &this->actor)) { - phi_f0 = 170.0f; + targetDist = 170.0f; } else { - phi_f0 = 70.0f; + targetDist = 70.0f; } - if (this->actor.xzDistToPlayer <= phi_f0) { + if (this->actor.xzDistToPlayer <= targetDist) { this->actor.speed = -3.5f; } else { this->actor.speed = 3.5f; } } - this->unk_292 = (s32)Rand_ZeroFloat(10.0f) + 20; + this->walkTimer = (s32)Rand_ZeroFloat(10.0f) + 20; this->actor.world.rot.y = this->actor.shape.rot.y; - this->actionFunc = func_8089B98C; + this->actionFunc = EnDinofos_Walk; } -void func_8089B98C(EnDinofos* this, PlayState* play) { - f32 phi_f0; +void EnDinofos_Walk(EnDinofos* this, PlayState* play) { + f32 targetDist; SkelAnime_Update(&this->skelAnime); - if (!func_8089AE00(this, play)) { + if (!EnDinofos_Dodge(this, play)) { if (Actor_OtherIsTargeted(play, &this->actor)) { - phi_f0 = 170.0f; + targetDist = 170.0f; } else { - phi_f0 = 70.0f; + targetDist = 70.0f; } Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; - if (this->actor.xzDistToPlayer <= phi_f0) { + if (this->actor.xzDistToPlayer <= targetDist) { Math_StepToF(&this->actor.speed, -7.0f, 0.5f); } else { Math_StepToF(&this->actor.speed, 7.0f, 0.5f); } if (this->actor.xzDistToPlayer < 80.0f) { - this->unk_292 = 0; + this->walkTimer = 0; } - if (this->unk_292 != 0) { - this->unk_292--; + if (this->walkTimer != 0) { + this->walkTimer--; } else { - func_8089A9B0(this, play); + EnDinofos_ChooseAction(this, play); } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { @@ -682,33 +701,35 @@ void func_8089B98C(EnDinofos* this, PlayState* play) { } } -void func_8089BAC0(EnDinofos* this) { - if (this->actionFunc != func_8089BB60) { +void EnDinofos_SetupTurnToPlayer(EnDinofos* this) { + if (this->actionFunc != EnDinofos_TurnToPlayer) { Animation_MorphToLoop(&this->skelAnime, &gDinolfosWalkAnim, -4.0f); this->actor.speed = 0.0f; } + if (BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y) > 0) { - this->unk_28C = BINANG_ADD(this->actor.shape.rot.y, 0x4000); + this->targetRotY = BINANG_ADD(this->actor.shape.rot.y, 0x4000); } else { - this->unk_28C = BINANG_SUB(this->actor.shape.rot.y, 0x4000); + this->targetRotY = BINANG_SUB(this->actor.shape.rot.y, 0x4000); } + this->actor.world.rot.y = this->actor.shape.rot.y; - func_8089AD70(this); - this->actionFunc = func_8089BB60; + EnDinofos_EnableBumperCollision(this); + this->actionFunc = EnDinofos_TurnToPlayer; } -void func_8089BB60(EnDinofos* this, PlayState* play) { +void EnDinofos_TurnToPlayer(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->unk_28C, 0x400)) { - func_8089A9B0(this, play); + if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetRotY, 0x400)) { + EnDinofos_ChooseAction(this, play); } this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_8089BBB4(EnDinofos* this, PlayState* play) { +void EnDinofos_SetupCircleAroundPlayer(EnDinofos* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (this->actionFunc != func_8089BD28) { + if (this->actionFunc != EnDinofos_CircleAroundPlayer) { s16 rotY = player->actor.shape.rot.y - this->actor.shape.rot.y; if (ABS_ALT(rotY) > 0x7800) { if (Rand_ZeroOne() < 0.5f) { @@ -722,37 +743,39 @@ void func_8089BBB4(EnDinofos* this, PlayState* play) { this->actor.speed = -6.0f; } - if (this->actionFunc == func_8089D1E0) { - this->skelAnime.playSpeed = this->actor.speed * 0.166666671634f; + if (this->actionFunc == EnDinofos_DodgeProjectile) { + this->skelAnime.playSpeed = this->actor.speed * (1.0f / 6.0f); } else { - Animation_Change(&this->skelAnime, &gDinolfosSidestepAnim, this->actor.speed * 0.166666671634f, 0.0f, 0.0f, + Animation_Change(&this->skelAnime, &gDinolfosSidestepAnim, this->actor.speed * (1.0f / 6.0f), 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f); } this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); - this->unk_2A4 = 0; - this->unk_292 = (s32)Rand_ZeroFloat(10.0f) + 5; + this->circlingRate = 0; + this->sidestepTimer = (s32)Rand_ZeroFloat(10.0f) + 5; } - this->actionFunc = func_8089BD28; + this->actionFunc = EnDinofos_CircleAroundPlayer; } -void func_8089BD28(EnDinofos* this, PlayState* play) { +void EnDinofos_CircleAroundPlayer(EnDinofos* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 phi_v0; - f32 sp2C = 0.0f; + s16 angle; + f32 targetDistAdjustment = 0.0f; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xBB8); - if (!func_8089AE00(this, play)) { + if (!EnDinofos_Dodge(this, play)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speed >= 0.0f) { - phi_v0 = BINANG_ADD(this->actor.shape.rot.y, 0x4000); + angle = BINANG_ADD(this->actor.shape.rot.y, 0x4000); } else { - phi_v0 = BINANG_SUB(this->actor.shape.rot.y, 0x4000); + angle = BINANG_SUB(this->actor.shape.rot.y, 0x4000); } - phi_v0 = this->actor.wallYaw - phi_v0; - if (ABS_ALT(phi_v0) > 0x4000) { + angle = this->actor.wallYaw - angle; + + // facing wall + if (ABS_ALT(angle) > 0x4000) { this->actor.speed *= -0.8f; if (this->actor.speed < 0.0f) { this->actor.speed -= 0.5f; @@ -762,10 +785,10 @@ void func_8089BD28(EnDinofos* this, PlayState* play) { } } - phi_v0 = BINANG_SUB(player->actor.shape.rot.y, this->actor.shape.rot.y); - if ((phi_v0 >= 0) && (phi_v0 < 0x7800)) { + angle = BINANG_SUB(player->actor.shape.rot.y, this->actor.shape.rot.y); + if ((angle >= 0) && (angle < 0x7800)) { this->actor.speed += 0.125f; - } else if ((phi_v0 < 0) && (phi_v0 > -0x7800)) { + } else if ((angle < 0) && (angle > -0x7800)) { this->actor.speed -= 0.125f; } @@ -777,24 +800,24 @@ void func_8089BD28(EnDinofos* this, PlayState* play) { this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); if (Actor_OtherIsTargeted(play, &this->actor)) { - sp2C = 100.0f; + targetDistAdjustment = 100.0f; } - if (this->actor.xzDistToPlayer <= (70.0f + sp2C)) { - Math_StepToF(&this->unk_2A4, -4.0f, 1.5f); - } else if ((90.0f + sp2C) < this->actor.xzDistToPlayer) { - Math_StepToF(&this->unk_2A4, 4.0f, 1.5f); + if (this->actor.xzDistToPlayer <= (70.0f + targetDistAdjustment)) { + Math_StepToF(&this->circlingRate, -4.0f, 1.5f); + } else if ((90.0f + targetDistAdjustment) < this->actor.xzDistToPlayer) { + Math_StepToF(&this->circlingRate, 4.0f, 1.5f); } else { - Math_StepToF(&this->unk_2A4, 0.0f, 5.65f); + Math_StepToF(&this->circlingRate, 0.0f, 5.65f); } - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_2A4; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_2A4; + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->circlingRate; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->circlingRate; SkelAnime_Update(&this->skelAnime); - if (this->unk_292 != 0) { - this->unk_292--; + if (this->sidestepTimer != 0) { + this->sidestepTimer--; } else { - func_8089A9B0(this, play); + EnDinofos_ChooseAction(this, play); } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { @@ -803,262 +826,266 @@ void func_8089BD28(EnDinofos* this, PlayState* play) { } } -void func_8089C024(EnDinofos* this, s32 arg1) { - if (arg1 == 0) { +void EnDinofos_SetupChooseJump(EnDinofos* this, s32 jumpType) { + if (jumpType == DINOFOS_JUMP_TYPE_FORWARD) { Animation_MorphToPlayOnce(&this->skelAnime, &gDinolfosJumpAnim, 2.0f); - func_8089AD70(this); + EnDinofos_EnableBumperCollision(this); } else { Animation_MorphToPlayOnce(&this->skelAnime, &gDinolfosJumpAnim, -1.0f); - if ((arg1 == 2) || (arg1 == 3)) { - this->colliderJntSph.base.acFlags &= ~AC_ON; - func_8089AD70(this); + if ((jumpType == DINOFOS_JUMP_TYPE_BACKWARD) || (jumpType == DINOFOS_JUMP_TYPE_SLASH)) { + this->bodyAndFireCollider.base.acFlags &= ~AC_ON; + EnDinofos_EnableBumperCollision(this); } } this->actor.speed = 0.0f; - this->unk_290 = arg1; + this->jumpType = jumpType; this->actor.world.rot.y = this->actor.shape.rot.y; - this->actionFunc = func_8089C0DC; + this->actionFunc = EnDinofos_ChooseJump; } -void func_8089C0DC(EnDinofos* this, PlayState* play) { +void EnDinofos_ChooseJump(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x1000); this->actor.world.rot.y = this->actor.shape.rot.y; SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - if (this->unk_290 == 3) { - func_8089C244(this); + if (this->jumpType == DINOFOS_JUMP_TYPE_SLASH) { + EnDinofos_SetupJumpSlash(this); } else { - func_8089C164(this); + EnDinofos_SetupJump(this); } } } -void func_8089C164(EnDinofos* this) { - if (this->unk_290 == 2) { +void EnDinofos_SetupJump(EnDinofos* this) { + if (this->jumpType == DINOFOS_JUMP_TYPE_BACKWARD) { this->actor.speed = -10.0f; this->actor.velocity.y = 9.0f; - this->colliderJntSph.base.acFlags |= AC_ON; + this->bodyAndFireCollider.base.acFlags |= AC_ON; } else { this->actor.velocity.y = 12.5f; - if (this->unk_290 == 0) { + if (this->jumpType == DINOFOS_JUMP_TYPE_FORWARD) { this->actor.speed = 4.5f; } } this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - this->actionFunc = func_8089C1F8; + this->actionFunc = EnDinofos_Jump; } -void func_8089C1F8(EnDinofos* this, PlayState* play) { +void EnDinofos_Jump(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_8089C398(this); + EnDinofos_SetupLand(this); } } -void func_8089C244(EnDinofos* this) { +void EnDinofos_SetupJumpSlash(EnDinofos* this) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.speed = 8.0f; this->actor.velocity.y = 16.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - this->unk_290 = 0; - this->unk_292 = -1; - this->actionFunc = func_8089C2A8; + this->attackTimer = 0; + this->timer2 = -1; + this->actionFunc = EnDinofos_JumpSlash; } -void func_8089C2A8(EnDinofos* this, PlayState* play) { +/** + * The Dinolfos will always swing its knife when it begins falling from jumping over the player. + */ +void EnDinofos_JumpSlash(EnDinofos* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - this->unk_290++; + this->attackTimer++; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x1800); + if ((this->actor.velocity.y < 0.0f) && (this->skelAnime.animation == &gDinolfosJumpAnim)) { - this->colliderQuad.base.atFlags |= AT_ON; - this->colliderJntSph.base.acFlags |= AC_ON; + this->knifeCollider.base.atFlags |= AT_ON; + this->bodyAndFireCollider.base.acFlags |= AC_ON; Animation_Change(&this->skelAnime, &gDinolfosAttackAnim, 1.0f, 7.0f, 13.0f, ANIMMODE_ONCE, -2.0f); } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->colliderQuad.base.atFlags &= ~AT_ON; - func_8089C398(this); + this->knifeCollider.base.atFlags &= ~AT_ON; + EnDinofos_SetupLand(this); } } -void func_8089C398(EnDinofos* this) { - if (this->actionFunc != func_8089C2A8) { +void EnDinofos_SetupLand(EnDinofos* this) { + if (this->actionFunc != EnDinofos_JumpSlash) { Animation_PlayOnce(&this->skelAnime, &gDinolfosLandAnim); } else { this->skelAnime.endFrame = Animation_GetLastFrame(&gDinolfosAttackAnim); } if (this->actor.speed < 0.0f) { - this->unk_290 = 1; + this->isJumpingBackward = true; } else { - this->unk_290 = 0; + this->isJumpingBackward = false; } this->actor.speed = 0.0f; - func_8089AD70(this); + EnDinofos_EnableBumperCollision(this); Actor_PlaySfx(&this->actor, NA_SE_EN_BOMCHU_WALK); - this->actionFunc = func_8089C44C; + this->actionFunc = EnDinofos_Land; } -void func_8089C44C(EnDinofos* this, PlayState* play) { +void EnDinofos_Land(EnDinofos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - if ((this->unk_290 == 1) && (this->actor.xzDistToPlayer < 280.0f) && func_8089A968(this) && - (Rand_ZeroOne() < 0.6f)) { - func_8089CA14(this); + if ((this->isJumpingBackward == true) && (this->actor.xzDistToPlayer < 280.0f) && + EnDinofos_IsFacingPlayer(this) && (Rand_ZeroOne() < 0.6f)) { + EnDinofos_SetupStartBreatheFire(this); } else { - func_8089A9B0(this, play); + EnDinofos_ChooseAction(this, play); } } } -void func_8089C4F8(EnDinofos* this) { +void EnDinofos_SetupSlash(EnDinofos* this) { Animation_PlayOnce(&this->skelAnime, &gDinolfosAttackAnim); - this->colliderQuad.base.atFlags &= ~AT_BOUNCED; + this->knifeCollider.base.atFlags &= ~AT_BOUNCED; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); - this->unk_290 = 0; - this->unk_292 = -1; + this->attackTimer = 0; + this->timer2 = -1; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->actionFunc = func_8089C56C; + this->actionFunc = EnDinofos_Slash; } -void func_8089C56C(EnDinofos* this, PlayState* play) { - this->unk_290++; +void EnDinofos_Slash(EnDinofos* this, PlayState* play) { + this->attackTimer++; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); this->actor.world.rot.y = this->actor.shape.rot.y; if (SkelAnime_Update(&this->skelAnime)) { - EffectBlure_AddSpace(Effect_GetByIndex(this->unk_2A0)); - this->colliderQuad.base.atFlags &= ~AT_ON; - func_8089A9B0(this, play); + EffectBlure_AddSpace(Effect_GetByIndex(this->effectIndex)); + this->knifeCollider.base.atFlags &= ~AT_ON; + EnDinofos_ChooseAction(this, play); } else if (Animation_OnFrame(&this->skelAnime, 7.0f)) { - this->colliderQuad.base.atFlags |= AT_ON; - func_8089AD70(this); + this->knifeCollider.base.atFlags |= AT_ON; + EnDinofos_EnableBumperCollision(this); } else if (Animation_OnFrame(&this->skelAnime, 13.0f)) { - this->colliderQuad.base.atFlags &= ~AT_ON; + this->knifeCollider.base.atFlags &= ~AT_ON; } else if (Animation_OnFrame(&this->skelAnime, 11.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); } else if (this->skelAnime.curFrame < 7.0f) { - func_8089AE00(this, play); + EnDinofos_Dodge(this, play); } } -void func_8089C690(EnDinofos* this) { +void EnDinofos_SetupRecoil(EnDinofos* this) { Animation_Change(&this->skelAnime, &gDinolfosAttackAnim, -1.0f, this->skelAnime.curFrame, 0.0f, ANIMMODE_ONCE, 0.0f); - this->colliderQuad.base.atFlags &= ~(AT_ON | AT_BOUNCED); - if (this->actionFunc != func_8089C2A8) { + this->knifeCollider.base.atFlags &= ~(AT_ON | AT_BOUNCED); + if (this->actionFunc != EnDinofos_JumpSlash) { this->actor.world.rot.y = this->actor.shape.rot.y; } else { this->actor.speed = 3.0f; } - this->actionFunc = func_8089C724; + this->actionFunc = EnDinofos_Recoil; } -void func_8089C724(EnDinofos* this, PlayState* play) { +void EnDinofos_Recoil(EnDinofos* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_StepToF(&this->actor.speed, 0.0f, 0.5f); } if (SkelAnime_Update(&this->skelAnime)) { - func_8089A9B0(this, play); + EnDinofos_ChooseAction(this, play); } } -void func_8089C784(EnDinofos* this) { +void EnDinofos_SetupStunned(EnDinofos* this) { this->actor.speed = 0.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } - this->actionFunc = func_8089C7B8; + this->actionFunc = EnDinofos_Stunned; } -void func_8089C7B8(EnDinofos* this, PlayState* play) { - if (this->unk_290 != 0) { - this->unk_290--; +void EnDinofos_Stunned(EnDinofos* this, PlayState* play) { + if (this->stunTimer != 0) { + this->stunTimer--; } - if (this->unk_290 == 0) { - func_8089ACEC(this, play); + if (this->stunTimer == 0) { + EnDinofos_ThawIfFrozen(this, play); if (this->actor.colChkInfo.health == 0) { if (this->actor.csId == CS_ID_NONE) { - func_8089CFAC(this); + EnDinofos_SetupDie(this); } else { - func_8089D2E0(this); + EnDinofos_SetupPlayCutscene(this); } - } else if (func_8089A968(this) && (this->actor.xzDistToPlayer < 100.0f)) { - func_8089CA14(this); + } else if (EnDinofos_IsFacingPlayer(this) && (this->actor.xzDistToPlayer < 100.0f)) { + EnDinofos_SetupStartBreatheFire(this); } else { - func_8089A9B0(this, play); + EnDinofos_ChooseAction(this, play); } } } -void func_8089C87C(EnDinofos* this, s32 arg1) { +void EnDinofos_SetupDamaged(EnDinofos* this, s32 colliderIndex) { Animation_PlayOnce(&this->skelAnime, &gDinolfosHitAnim); - func_800BE5CC(&this->actor, &this->colliderJntSph, arg1); + func_800BE5CC(&this->actor, &this->bodyAndFireCollider, colliderIndex); this->actor.shape.rot.y = BINANG_ROT180(this->actor.world.rot.y); this->actor.speed = 10.0f; if (this->actor.velocity.y > 0.0f) { this->actor.velocity.y = 0.0f; } - this->unk_28E = 0; + this->headRotY = 0; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DAMAGE); - this->colliderJntSph.base.acFlags &= ~AC_ON; + this->bodyAndFireCollider.base.acFlags &= ~AC_ON; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 18); - this->actionFunc = func_8089C938; + this->actionFunc = EnDinofos_Damaged; } -void func_8089C938(EnDinofos* this, PlayState* play) { +void EnDinofos_Damaged(EnDinofos* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { if (this->actor.csId == CS_ID_NONE) { - func_8089CFAC(this); + EnDinofos_SetupDie(this); } else { - func_8089D2E0(this); + EnDinofos_SetupPlayCutscene(this); } } else if (this->actor.xzDistToPlayer < 280.0f) { - func_8089CA14(this); + EnDinofos_SetupStartBreatheFire(this); } else { - this->colliderJntSph.base.acFlags |= AC_ON; - func_8089A9B0(this, play); + this->bodyAndFireCollider.base.acFlags |= AC_ON; + EnDinofos_ChooseAction(this, play); } } } -void func_8089CA14(EnDinofos* this) { +void EnDinofos_SetupStartBreatheFire(EnDinofos* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gDinolfosFireStartAnim, -5.0f); - this->colliderJntSph.base.acFlags |= AC_ON; + this->bodyAndFireCollider.base.acFlags |= AC_ON; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->actionFunc = func_8089CA74; + this->actionFunc = EnDinofos_StartBreatheFire; } -void func_8089CA74(EnDinofos* this, PlayState* play) { +void EnDinofos_StartBreatheFire(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); Math_StepToF(&this->actor.speed, 0.0f, 0.5f); if (SkelAnime_Update(&this->skelAnime)) { - func_8089CB10(this, play); - } else if (!func_8089AE00(this, play) && Animation_OnFrame(&this->skelAnime, 12.0f)) { + EnDinofos_SetupBreatheFire(this, play); + } else if (!EnDinofos_Dodge(this, play) && Animation_OnFrame(&this->skelAnime, 12.0f)) { this->actor.speed = 8.0f; } } -void func_8089CB10(EnDinofos* this, PlayState* play) { +void EnDinofos_SetupBreatheFire(EnDinofos* this, PlayState* play) { s32 i; Sphere16* worldSphere; Animation_PlayLoop(&this->skelAnime, &gDinolfosFireLoopAnim); - this->unk_290 = 20; + this->attackTimer = 20; this->actor.speed = 0.0f; - this->colliderJntSph.base.atFlags |= AT_ON; - func_8089AD70(this); + this->bodyAndFireCollider.base.atFlags |= AT_ON; + EnDinofos_EnableBumperCollision(this); - for (i = 6; i < ARRAY_COUNT(this->colliderJntSphElement); i++) { - worldSphere = &this->colliderJntSph.elements[i].dim.worldSphere; + for (i = 6; i < ARRAY_COUNT(this->bodyAndFireColliderElements); i++) { + worldSphere = &this->bodyAndFireCollider.elements[i].dim.worldSphere; worldSphere->center.x = this->bodyPartsPos[DINOFOS_BODYPART_JAW].x; worldSphere->center.y = this->bodyPartsPos[DINOFOS_BODYPART_JAW].y; worldSphere->center.z = this->bodyPartsPos[DINOFOS_BODYPART_JAW].z; @@ -1068,115 +1095,119 @@ void func_8089CB10(EnDinofos* this, PlayState* play) { play->envCtx.lightSettingOverride = 11; } - this->actionFunc = func_8089CBEC; + this->actionFunc = EnDinofos_BreatheFire; } -void func_8089CBEC(EnDinofos* this, PlayState* play) { - s16 temp_s3 = ((s32)Rand_CenteredFloat(0x1000) + this->actor.shape.rot.y) + this->unk_28E; - Vec3f sp88; - Vec3f sp7C; +void EnDinofos_BreatheFire(EnDinofos* this, PlayState* play) { + s16 fireRotY = ((s32)Rand_CenteredFloat(0x1000) + this->actor.shape.rot.y) + this->headRotY; + Vec3f velocity; + Vec3f accel; ColliderJntSphElementDim* dim; s32 i; s32 end; - f32 temp_f20; - f32 temp_f22; - s32 temp_s0; + f32 sin; + f32 cos; + s32 dimAlphaStep; SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); - temp_f20 = Math_SinS(temp_s3); - temp_f22 = Math_CosS(temp_s3); + sin = Math_SinS(fireRotY); + cos = Math_CosS(fireRotY); - temp_s0 = 10 - this->unk_290; - temp_s0 = CLAMP_MIN(temp_s0, 0); + dimAlphaStep = 10 - this->attackTimer; + dimAlphaStep = CLAMP_MIN(dimAlphaStep, 0); - sp88.x = 11.0f * temp_f20; - sp88.y = Rand_CenteredFloat(2.0f) + -5.4f; - sp88.z = 11.0f * temp_f22; - sp7C.x = 0.9f * temp_f20; - sp7C.y = Rand_CenteredFloat(0.6f) + 1.4f; - sp7C.z = 0.9f * temp_f22; + velocity.x = 11.0f * sin; + velocity.y = Rand_CenteredFloat(2.0f) + -5.4f; + velocity.z = 11.0f * cos; + accel.x = 0.9f * sin; + accel.y = Rand_CenteredFloat(0.6f) + 1.4f; + accel.z = 0.9f * cos; Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); - EffectSsDFire_Spawn(play, &this->bodyPartsPos[DINOFOS_BODYPART_JAW], &sp88, &sp7C, 30, 22, 255 - (temp_s0 * 20), 20, - 3, 8); + EffectSsDFire_Spawn(play, &this->bodyPartsPos[DINOFOS_BODYPART_JAW], &velocity, &accel, 30, 22, + 255 - (dimAlphaStep * 20), 20, 3, 8); - for (end = 6, i = 3; i > 0; i--) { - if (this->unk_290 < (20 + -(i * 2))) { - end = i + 6; + // This lets the fire balls go away from Dinolfos' jaw one after the other. + end = DINOFOS_COLLIDER_FIRE_START_INDEX; + for (i = ARRAY_COUNT(this->bodyAndFireColliderElements) - DINOFOS_COLLIDER_FIRE_START_INDEX; i > 0; i--) { + if (this->attackTimer < (20 + -(i * 2))) { + end = i + DINOFOS_COLLIDER_FIRE_START_INDEX; break; } } - for (i = 6; i < end; i++) { - dim = &this->colliderJntSph.elements[i].dim; - temp_s3 = (s32)(Math_CosF((this->unk_290 + ((i - 5) << 1)) * (M_PIf / 20)) * 0x2C00) + this->actor.shape.rot.y; + // The fire balls sweep in front of Dinolfos. + for (i = DINOFOS_COLLIDER_FIRE_START_INDEX; i < end; i++) { + dim = &this->bodyAndFireCollider.elements[i].dim; + fireRotY = + (s32)(Math_CosF((this->attackTimer + ((i - 5) << 1)) * (M_PIf / 20)) * 0x2C00) + this->actor.shape.rot.y; dim->worldSphere.center.x = - (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].x + (s32)(Math_SinS(temp_s3) * dim->modelSphere.center.z); + (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].x + (s32)(Math_SinS(fireRotY) * dim->modelSphere.center.z); dim->worldSphere.center.y = (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].y + (s32)dim->modelSphere.center.y; dim->worldSphere.center.z = - (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].z + (s32)(Math_CosS(temp_s3) * dim->modelSphere.center.z); + (s32)this->bodyPartsPos[DINOFOS_BODYPART_JAW].z + (s32)(Math_CosS(fireRotY) * dim->modelSphere.center.z); } - if (this->unk_290 != 0) { - this->unk_290--; + if (this->attackTimer != 0) { + this->attackTimer--; } else { - func_8089CF00(this, play); + EnDinofos_SetupEndBreatheFire(this, play); } } -void func_8089CF00(EnDinofos* this, PlayState* play) { +void EnDinofos_SetupEndBreatheFire(EnDinofos* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gDinolfosFireEndAnim); - this->colliderJntSph.base.atFlags &= ~AT_ON; + this->bodyAndFireCollider.base.atFlags &= ~AT_ON; if (play->sceneId == SCENE_MITURIN) { play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } - this->actionFunc = func_8089CF70; + this->actionFunc = EnDinofos_EndBreatheFire; } -void func_8089CF70(EnDinofos* this, PlayState* play) { +void EnDinofos_EndBreatheFire(EnDinofos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - func_8089A9B0(this, play); + EnDinofos_ChooseAction(this, play); } } -void func_8089CFAC(EnDinofos* this) { +void EnDinofos_SetupDie(EnDinofos* this) { Animation_PlayOnce(&this->skelAnime, &gDinolfosDieAnim); this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DEAD); this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->actionFunc = func_8089D018; + this->actionFunc = EnDinofos_Die; } -void func_8089D018(EnDinofos* this, PlayState* play) { +void EnDinofos_Die(EnDinofos* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - s32 temp_v0 = this->unk_288 - 10; + s32 envColorAlpha = this->envColorAlpha - 10; if (this->actor.category == ACTORCAT_ENEMY) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); - func_8089ABF4(this, play); + EnDinofos_EndCutscene(this, play); } - if (temp_v0 <= 0) { + if (envColorAlpha <= 0) { Actor_Kill(&this->actor); - this->unk_288 = 0; + this->envColorAlpha = 0; } else { - this->unk_288 = temp_v0; + this->envColorAlpha = envColorAlpha; } if (this->drawDmgEffAlpha > 0.0f) { - this->drawDmgEffAlpha = this->unk_288 * (1.0f / 255.0f); + this->drawDmgEffAlpha = this->envColorAlpha * (1.0f / 255.0f); } - this->actor.shape.shadowAlpha = this->unk_288; + this->actor.shape.shadowAlpha = this->envColorAlpha; } else if (Animation_OnFrame(&this->skelAnime, 26.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_DOWN); } } -void func_8089D11C(EnDinofos* this, s16 arg1) { - if (arg1 >= 0) { +void EnDinofos_SetupDodgeProjectile(EnDinofos* this, s16 angleToProjectile) { + if (angleToProjectile >= 0) { this->actor.speed = -15.0f; } else { this->actor.speed = 15.0f; @@ -1184,13 +1215,13 @@ void func_8089D11C(EnDinofos* this, s16 arg1) { Animation_Change(&this->skelAnime, &gDinolfosSidestepAnim, this->actor.speed * (1.0f / 7.5f), 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f); this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); - this->unk_292 = 10; - this->unk_2A4 = 0.0f; - func_8089AD70(this); - this->actionFunc = func_8089D1E0; + this->sidestepTimer = 10; + this->circlingRate = 0.0f; + EnDinofos_EnableBumperCollision(this); + this->actionFunc = EnDinofos_DodgeProjectile; } -void func_8089D1E0(EnDinofos* this, PlayState* play) { +void EnDinofos_DodgeProjectile(EnDinofos* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xBB8); Math_StepToF(&this->actor.speed, 0.0f, 2.0f); @@ -1198,10 +1229,10 @@ void func_8089D1E0(EnDinofos* this, PlayState* play) { (1.0f + fabsf(this->actor.speed * (1.0f / 15.0f))) * ((this->actor.speed >= 0.0f) ? 1.0f : -1.0f); this->actor.world.rot.y = BINANG_ADD(this->actor.shape.rot.y, 0x4000); SkelAnime_Update(&this->skelAnime); - if (this->unk_292 != 0) { - this->unk_292--; + if (this->sidestepTimer != 0) { + this->sidestepTimer--; } else { - func_8089A9B0(this, play); + EnDinofos_ChooseAction(this, play); } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f)) { @@ -1209,12 +1240,12 @@ void func_8089D1E0(EnDinofos* this, PlayState* play) { } } -void func_8089D2E0(EnDinofos* this) { +void EnDinofos_SetupPlayCutscene(EnDinofos* this) { CutsceneManager_Queue(this->actor.csId); - this->actionFunc = func_8089D318; + this->actionFunc = EnDinofos_PlayCutscene; } -void func_8089D318(EnDinofos* this, PlayState* play) { +void EnDinofos_PlayCutscene(EnDinofos* this, PlayState* play) { Vec3f subCamEye; if (CutsceneManager_IsNext(this->actor.csId)) { @@ -1230,63 +1261,63 @@ void func_8089D318(EnDinofos* this, PlayState* play) { subCamEye.y = this->actor.focus.pos.y; subCamEye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.z; Play_SetCameraAtEye(play, this->subCamId, &this->actor.focus.pos, &subCamEye); - func_8089CFAC(this); + EnDinofos_SetupDie(this); } else { - func_8089B100(this, play); + EnDinofos_SetupIntroCutsceneBeforeFall(this, play); } } else { CutsceneManager_Queue(this->actor.csId); } } -void func_8089D42C(EnDinofos* this, PlayState* play) { - s16 temp_v0_2; +void EnDinofos_RotateHead(EnDinofos* this, PlayState* play) { + s16 headRotYDiff; - if ((this->actionFunc == func_8089B834) && (this->unk_290 != 0)) { - Math_ScaledStepToS(&this->unk_28E, Math_SinS(this->unk_290 * 1400) * 0x2C00, 0x300); - } else if (this->actionFunc == func_8089CA74) { - Math_ScaledStepToS(&this->unk_28E, Math_CosF(M_PIf) * 0x2C00, 0x2C00 / 20); - } else if (this->actionFunc == func_8089CBEC) { - this->unk_28E = Math_CosF(this->unk_290 * (M_PIf / 20)) * 0x2C00; + if ((this->actionFunc == EnDinofos_Idle) && (this->headTimer != 0)) { + Math_ScaledStepToS(&this->headRotY, Math_SinS(this->headTimer * 1400) * 0x2C00, 0x300); + } else if (this->actionFunc == EnDinofos_StartBreatheFire) { + Math_ScaledStepToS(&this->headRotY, Math_CosF(M_PIf) * 0x2C00, 0x2C00 / 20); + } else if (this->actionFunc == EnDinofos_BreatheFire) { + this->headRotY = Math_CosF(this->headTimer * (M_PIf / 20)) * 0x2C00; } else if (!Play_InCsMode(play)) { - temp_v0_2 = this->unk_28E + this->actor.shape.rot.y; - temp_v0_2 = BINANG_SUB(this->actor.yawTowardsPlayer, temp_v0_2); - temp_v0_2 = CLAMP(temp_v0_2, -0x300, 0x300); - this->unk_28E += temp_v0_2; - this->unk_28E = CLAMP(this->unk_28E, -0x2C00, 0x2C00); + headRotYDiff = this->headRotY + this->actor.shape.rot.y; + headRotYDiff = BINANG_SUB(this->actor.yawTowardsPlayer, headRotYDiff); + headRotYDiff = CLAMP(headRotYDiff, -0x300, 0x300); + this->headRotY += headRotYDiff; + this->headRotY = CLAMP(this->headRotY, -0x2C00, 0x2C00); } } -s32 func_8089D60C(EnDinofos* this, PlayState* play) { +s32 EnDinofos_UpdateDamage(EnDinofos* this, PlayState* play) { s32 i; - if (this->colliderJntSph.base.acFlags & AC_HIT) { - this->colliderJntSph.base.acFlags &= ~AC_HIT; - Actor_SetDropFlagJntSph(&this->actor, &this->colliderJntSph); + if (this->bodyAndFireCollider.base.acFlags & AC_HIT) { + this->bodyAndFireCollider.base.acFlags &= ~AC_HIT; + Actor_SetDropFlagJntSph(&this->actor, &this->bodyAndFireCollider); - for (i = 0; i < ARRAY_COUNT(this->colliderJntSphElement); i++) { - if (this->colliderJntSph.elements[i].info.bumperFlags & BUMP_HIT) { + for (i = 0; i < ARRAY_COUNT(this->bodyAndFireColliderElements); i++) { + if (this->bodyAndFireCollider.elements[i].info.bumperFlags & BUMP_HIT) { break; } } - if (i == ARRAY_COUNT(this->colliderJntSphElement)) { + if (i == ARRAY_COUNT(this->bodyAndFireColliderElements)) { return false; } if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) && - (this->colliderJntSph.elements[i].info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { + (this->bodyAndFireCollider.elements[i].info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { return false; } - if (this->actor.colChkInfo.damageEffect == 0xF) { + if (this->actor.colChkInfo.damageEffect == DINOLFOS_DMGEFF_IMMUNE) { return false; } if (!Actor_ApplyDamage(&this->actor)) { Enemy_StartFinishingBlow(play, &this->actor); - D_8089E350--; - if (D_8089E350 == 0) { + sNumAlive--; + if (sNumAlive == 0) { if (sCsId != CS_ID_NONE) { this->actor.csId = sCsId; } @@ -1297,58 +1328,58 @@ s32 func_8089D60C(EnDinofos* this, PlayState* play) { } } - func_8089ACEC(this, play); - func_8089AD70(this); + EnDinofos_ThawIfFrozen(this, play); + EnDinofos_EnableBumperCollision(this); if (play->sceneId == SCENE_MITURIN) { play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } - this->colliderQuad.base.atFlags &= ~(AT_ON | AT_BOUNCED); - this->colliderJntSph.base.atFlags &= ~AT_ON; - if (this->actor.colChkInfo.damageEffect == 3) { - func_8089AC70(this); + this->knifeCollider.base.atFlags &= ~(AT_ON | AT_BOUNCED); + this->bodyAndFireCollider.base.atFlags &= ~AT_ON; + if (this->actor.colChkInfo.damageEffect == DINOLFOS_DMGEFF_ICE) { + EnDinofos_Freeze(this); if (this->actor.colChkInfo.health == 0) { - this->unk_290 = 3; - this->colliderJntSph.base.acFlags &= ~AC_ON; + this->stunTimer = 3; + this->bodyAndFireCollider.base.acFlags &= ~AC_ON; } - func_8089C784(this); + EnDinofos_SetupStunned(this); return true; } - if (this->actor.colChkInfo.damageEffect == 1) { - this->unk_290 = 40; + if (this->actor.colChkInfo.damageEffect == DINOLFOS_DMGEFF_STUN) { + this->stunTimer = 40; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); - func_8089C784(this); + EnDinofos_SetupStunned(this); return true; } - if (this->actor.colChkInfo.damageEffect == 5) { - this->unk_290 = 40; + if (this->actor.colChkInfo.damageEffect == DINOLFOS_DMGEFF_ZORA_MAGIC) { + this->stunTimer = 40; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); this->drawDmgEffScale = 0.55f; this->drawDmgEffAlpha = 2.0f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; Actor_PlaySfx(&this->actor, NA_SE_EN_COMMON_FREEZE); - func_8089C784(this); + EnDinofos_SetupStunned(this); return true; } - if (this->actor.colChkInfo.damageEffect == 2) { + if (this->actor.colChkInfo.damageEffect == DINOLFOS_DMGEFF_FIRE) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.55f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; - } else if (this->actor.colChkInfo.damageEffect == 4) { + } else if (this->actor.colChkInfo.damageEffect == DINOLFOS_DMGEFF_LIGHT_SPARKS) { this->drawDmgEffAlpha = 4.0f; this->drawDmgEffScale = 0.55f; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, - this->colliderJntSph.elements[i].info.bumper.hitPos.x, - this->colliderJntSph.elements[i].info.bumper.hitPos.y, - this->colliderJntSph.elements[i].info.bumper.hitPos.z, 0, 0, 0, + this->bodyAndFireCollider.elements[i].info.bumper.hitPos.x, + this->bodyAndFireCollider.elements[i].info.bumper.hitPos.y, + this->bodyAndFireCollider.elements[i].info.bumper.hitPos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); } - func_8089C87C(this, i); + EnDinofos_SetupDamaged(this, i); return true; } @@ -1361,12 +1392,12 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { s32 pad; Vec3f bodyPartPos; - if (this->actionFunc != func_8089C7B8) { - func_8089A900(this); + if (this->actionFunc != EnDinofos_Stunned) { + EnDinofos_Blink(this); } - if (!func_8089D60C(this, play) && (this->colliderQuad.base.atFlags & AT_BOUNCED)) { - func_8089C690(this); + if (!EnDinofos_UpdateDamage(this, play) && (this->knifeCollider.base.atFlags & AT_BOUNCED)) { + EnDinofos_SetupRecoil(this); } this->actionFunc(this, play); @@ -1374,7 +1405,7 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10 | UPDBGCHECKINFO_FLAG_40); - if (this->actionFunc != func_8089C7B8) { + if (this->actionFunc != EnDinofos_Stunned) { if ((this->actor.depthInWater > 0.0f) && (this->actor.depthInWater < 10.0f)) { if (((play->gameplayFrames % 4) & 1) == 0) { Math_Vec3f_Copy(&bodyPartPos, @@ -1383,28 +1414,28 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { EffectSsGRipple_Spawn(play, &bodyPartPos, 100, 320, 0); } } - if (this->actionFunc != func_8089D018) { - func_8089D42C(this, play); + if (this->actionFunc != EnDinofos_Die) { + EnDinofos_RotateHead(this, play); } } - if ((this->actionFunc == func_8089D018) || (this->actionFunc == func_8089C938)) { - Math_ScaledStepToS(&this->unk_28E, 0, 2000); + if ((this->actionFunc == EnDinofos_Die) || (this->actionFunc == EnDinofos_Damaged)) { + Math_ScaledStepToS(&this->headRotY, 0, 2000); } Math_Vec3f_Copy(&this->actor.focus.pos, &this->bodyPartsPos[DINOFOS_BODYPART_UPPER_BODY]); - this->actor.focus.rot.y = this->actor.shape.rot.y + this->unk_28E; - if (this->colliderJntSph.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); + this->actor.focus.rot.y = this->actor.shape.rot.y + this->headRotY; + if (this->bodyAndFireCollider.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyAndFireCollider.base); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); - if (this->colliderJntSph.base.atFlags & AT_ON) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyAndFireCollider.base); + if (this->bodyAndFireCollider.base.atFlags & AT_ON) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyAndFireCollider.base); } - if (this->colliderQuad.base.atFlags & AT_ON) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderQuad.base); + if (this->knifeCollider.base.atFlags & AT_ON) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->knifeCollider.base); } if (this->drawDmgEffAlpha > 0.0f) { @@ -1412,7 +1443,7 @@ void EnDinofos_Update(Actor* thisx, PlayState* play2) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * (11.0f / 40.0f); this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.55f); - } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, 0.01375f)) { + } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.55f, (11.0f / 800.0f))) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } } @@ -1423,15 +1454,15 @@ s32 EnDinofos_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 EnDinofos* this = THIS; if (limbIndex == DINOLFOS_LIMB_HEAD) { - rot->y -= this->unk_28E; + rot->y -= this->headRotY; } - return 0; + return false; } -static Vec3f D_8089E38C = { 400.0f, -3600.0f, 0.0f }; -static Vec3f D_8089E398 = { 300.0f, 500.0f, 0.0f }; -static Vec3f D_8089E3A4 = { 700.0f, 400.0f, 0.0f }; +static Vec3f sKnifeTipQuadOffset = { 400.0f, -3600.0f, 0.0f }; +static Vec3f sKnifeBaseQuadOffset = { 300.0f, 500.0f, 0.0f }; +static Vec3f sCsFireVelocityOffset = { 700.0f, 400.0f, 0.0f }; static s8 sLimbToBodyParts[DINOLFOS_LIMB_MAX] = { BODYPART_NONE, // DINOLFOS_LIMB_NONE @@ -1459,30 +1490,31 @@ static s8 sLimbToBodyParts[DINOLFOS_LIMB_MAX] = { void EnDinofos_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { EnDinofos* this = THIS; - Vec3f sp80; - Vec3f sp74; - Vec3f sp68; - Vec3f sp5C; - s32 sp58; - Vec3f sp4C; - MtxF* sp48; + Vec3f prevKnifeTipQuadPos; + Vec3f prevKnifeBaseQuadPos; + Vec3f knifeTipQuadPos; + Vec3f knifeBaseQuadPos; + s32 dimAlphaStep; + Vec3f fireVelocity; + MtxF* matrix; - Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); + Collider_UpdateSpheres(limbIndex, &this->bodyAndFireCollider); if (sLimbToBodyParts[limbIndex] != BODYPART_NONE) { Matrix_MultZero(&this->bodyPartsPos[sLimbToBodyParts[limbIndex]]); } - if ((limbIndex == DINOLFOS_LIMB_RIGHT_HAND) && (this->unk_292 != this->unk_290) && - ((this->actionFunc == func_8089C56C) || (this->actionFunc == func_8089C2A8))) { - Math_Vec3f_Copy(&sp74, &this->colliderQuad.dim.quad[0]); - Math_Vec3f_Copy(&sp80, &this->colliderQuad.dim.quad[1]); - Matrix_MultVec3f(&D_8089E38C, &sp68); - Matrix_MultVec3f(&D_8089E398, &sp5C); - Collider_SetQuadVertices(&this->colliderQuad, &sp5C, &sp68, &sp74, &sp80); - if (this->colliderQuad.base.atFlags & AT_ON) { - EffectBlure_AddVertex(Effect_GetByIndex(this->unk_2A0), &sp68, &sp5C); + if ((limbIndex == DINOLFOS_LIMB_RIGHT_HAND) && (this->timer2 != this->attackTimer) && + ((this->actionFunc == EnDinofos_Slash) || (this->actionFunc == EnDinofos_JumpSlash))) { + Math_Vec3f_Copy(&prevKnifeBaseQuadPos, &this->knifeCollider.dim.quad[0]); + Math_Vec3f_Copy(&prevKnifeTipQuadPos, &this->knifeCollider.dim.quad[1]); + Matrix_MultVec3f(&sKnifeTipQuadOffset, &knifeTipQuadPos); + Matrix_MultVec3f(&sKnifeBaseQuadOffset, &knifeBaseQuadPos); + Collider_SetQuadVertices(&this->knifeCollider, &knifeBaseQuadPos, &knifeTipQuadPos, &prevKnifeBaseQuadPos, + &prevKnifeTipQuadPos); + if (this->knifeCollider.base.atFlags & AT_ON) { + EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &knifeTipQuadPos, &knifeBaseQuadPos); } - this->unk_292 = this->unk_290; + this->timer2 = this->attackTimer; } if (limbIndex == DINOLFOS_LIMB_LEFT_CLAWS) { @@ -1491,19 +1523,19 @@ void EnDinofos_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVecX(300.0f, &this->actor.shape.feetPos[1]); } - if ((limbIndex == DINOLFOS_LIMB_HEAD) && (this->actionFunc == func_8089B580)) { + if ((limbIndex == DINOLFOS_LIMB_HEAD) && (this->actionFunc == EnDinofos_IntroCutsceneLandAndBreatheFire)) { if ((this->skelAnime.curFrame > 38.0f) && (this->skelAnime.curFrame <= 55.0f) && - (this->unk_292 != this->unk_290)) { - sp48 = Matrix_GetCurrent(); - sp58 = 48 - (s32)this->skelAnime.curFrame; - sp58 = CLAMP_MIN(sp58, 0); - Matrix_MultVec3f(&D_8089E3A4, &sp4C); - sp4C.x -= sp48->mf[3][0]; - sp4C.y -= sp48->mf[3][1]; - sp4C.z -= sp48->mf[3][2]; - EffectSsDFire_Spawn(play, &this->bodyPartsPos[DINOFOS_BODYPART_JAW], &sp4C, &gZeroVec3f, 30, 22, - 255 - (sp58 * 20), 20, 3, 8); - this->unk_292 = this->unk_290; + (this->timer2 != this->cutsceneTimer)) { + matrix = Matrix_GetCurrent(); + dimAlphaStep = 48 - (s32)this->skelAnime.curFrame; + dimAlphaStep = CLAMP_MIN(dimAlphaStep, 0); + Matrix_MultVec3f(&sCsFireVelocityOffset, &fireVelocity); + fireVelocity.x -= matrix->mf[3][0]; + fireVelocity.y -= matrix->mf[3][1]; + fireVelocity.z -= matrix->mf[3][2]; + EffectSsDFire_Spawn(play, &this->bodyPartsPos[DINOFOS_BODYPART_JAW], &fireVelocity, &gZeroVec3f, 30, 22, + 255 - (dimAlphaStep * 20), 20, 3, 8); + this->timer2 = this->cutsceneTimer; } } } @@ -1513,11 +1545,11 @@ void EnDinofos_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - if (this->unk_288 == 255) { + if (this->envColorAlpha == 255) { Gfx_SetupDL25_Opa(play->state.gfxCtx); func_800B8050(&this->actor, play, 0); - gSPSegment(POLY_OPA_DISP++, 0x08, sEyeTextures[this->unk_289]); + gSPSegment(POLY_OPA_DISP++, 0x08, sEyeTextures[this->eyeTexIndex]); gDPSetEnvColor(POLY_OPA_DISP++, 20, 40, 40, 255); Scene_SetRenderModeXlu(play, 0, 1); @@ -1528,8 +1560,8 @@ void EnDinofos_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Xlu(play->state.gfxCtx); func_800B8118(&this->actor, play, 0); - gSPSegment(POLY_XLU_DISP++, 0x08, sEyeTextures[this->unk_289]); - gDPSetEnvColor(POLY_XLU_DISP++, 20, 40, 40, this->unk_288); + gSPSegment(POLY_XLU_DISP++, 0x08, sEyeTextures[this->eyeTexIndex]); + gDPSetEnvColor(POLY_XLU_DISP++, 20, 40, 40, this->envColorAlpha); Scene_SetRenderModeXlu(play, 1, 2); POLY_XLU_DISP = diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h index dd39135ae1..36c6c42d46 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h @@ -24,36 +24,79 @@ typedef enum EnDinofosBodyPart { /* 12 */ DINOFOS_BODYPART_MAX } EnDinofosBodyPart; +typedef enum EnDinofosJumpType { + /* 0 */ DINOFOS_JUMP_TYPE_FORWARD, + /* 1 */ DINOFOS_JUMP_TYPE_IN_PLACE, + /* 2 */ DINOFOS_JUMP_TYPE_BACKWARD, + /* 3 */ DINOFOS_JUMP_TYPE_SLASH +} EnDinofosJumpType; + +/** + * The elements before DINOFOS_COLLIDER_FIRE_START_INDEX are for a Dinofos' body in the actor's collider. + * The last three elements are for the flame. + */ +#define DINOFOS_COLLIDER_FIRE_START_INDEX 6 + +/** + * unk_294 explanation : + * + * The best way to compare is to look from timer1 to circlingRate in this current actor struct and from + * 0x03F0 to 0x0408 in OoT's struct for Lizalfos/Dinolfos. + * + * In OoT, an additionnal ice timer, booleans related to the platforms fight and platforms indices are stored + * after the two timers EnDinofos still has (all integers). Moreover, the alpha value (envColorAlpha) has been moved up + * in MM. + * + * In MM, subCamId and subCamRot were added to handle the new cutscenes. Also, the effectIndex for blur is new. + * + * All in all, unk_294 is probably remnants of the now unnecessary variables mentioned above. + */ + typedef struct EnDinofos { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[DINOLFOS_LIMB_MAX]; /* 0x206 */ Vec3s morphTable[DINOLFOS_LIMB_MAX]; /* 0x284 */ EnDinofosActionFunc actionFunc; - /* 0x288 */ u8 unk_288; - /* 0x289 */ u8 unk_289; + /* 0x288 */ u8 envColorAlpha; + /* 0x289 */ u8 eyeTexIndex; /* 0x28A */ u8 drawDmgEffType; - /* 0x28B */ u8 unk_28B; - /* 0x28C */ s16 unk_28C; - /* 0x28E */ s16 unk_28E; - /* 0x290 */ s16 unk_290; - /* 0x292 */ s16 unk_292; + /* 0x28B */ u8 isDodgingGoronPound; + /* 0x28C */ s16 targetRotY; + /* 0x28E */ s16 headRotY; + /* 0x290 */ union { // multi-use timer + s16 timer1; + s16 cutsceneTimer; + s16 attackTimer; + s16 actionTimer; + s16 headTimer; + s16 stunTimer; + s16 jumpType; + s16 isJumpingBackward; + }; + /* 0x292 */ union { // second multi-use timer + s16 timer2; + s16 sidestepTimer; + s16 walkTimer; + s16 idleTimer; + }; + // unk_294 is all zeroes in-game. Leftovers from OoT. /* 0x294 */ UNK_TYPE1 unk_294[4]; /* 0x298 */ s16 subCamId; - /* 0x29A */ Vec3s unk_29A; - /* 0x2A0 */ s32 unk_2A0; - /* 0x2A4 */ f32 unk_2A4; - /* 0x2A8 */ f32 unk_2A8; - /* 0x2AC */ f32 unk_2AC; + /* 0x29A */ Vec3s subCamRot; + /* 0x2A0 */ s32 effectIndex; + /* 0x2A4 */ f32 circlingRate; + /* 0x2A8 */ f32 subCamAtStep; + /* 0x2AC */ f32 subCamEyeStep; /* 0x2B0 */ f32 drawDmgEffAlpha; /* 0x2B4 */ f32 drawDmgEffScale; /* 0x2B8 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2BC */ Vec3f unk_2BC; - /* 0x2C8 */ Vec3f unk_2C8; + /* 0x2BC */ Vec3f subCamEye; + /* 0x2C8 */ Vec3f subCamAt; /* 0x2D4 */ Vec3f bodyPartsPos[DINOFOS_BODYPART_MAX]; - /* 0x364 */ ColliderJntSph colliderJntSph; - /* 0x384 */ ColliderJntSphElement colliderJntSphElement[9]; - /* 0x5C4 */ ColliderQuad colliderQuad; + /* 0x364 */ ColliderJntSph bodyAndFireCollider; + /* 0x384 */ ColliderJntSphElement bodyAndFireColliderElements[9]; + /* 0x5C4 */ ColliderQuad knifeCollider; } EnDinofos; // size = 0x644 #endif // Z_EN_DINOFOS_H diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index d7d6f776ff..14e69e9b07 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -5544,60 +5544,60 @@ 0x8089A3FC:("EnHoll_Draw",), 0x8089A6E0:("EnDinofos_Init",), 0x8089A8B0:("EnDinofos_Destroy",), - 0x8089A900:("func_8089A900",), - 0x8089A968:("func_8089A968",), - 0x8089A9B0:("func_8089A9B0",), - 0x8089ABF4:("func_8089ABF4",), - 0x8089AC70:("func_8089AC70",), - 0x8089ACEC:("func_8089ACEC",), - 0x8089AD70:("func_8089AD70",), - 0x8089AE00:("func_8089AE00",), - 0x8089B100:("func_8089B100",), - 0x8089B288:("func_8089B288",), - 0x8089B320:("func_8089B320",), - 0x8089B3D4:("func_8089B3D4",), - 0x8089B4A4:("func_8089B4A4",), - 0x8089B580:("func_8089B580",), - 0x8089B6E8:("func_8089B6E8",), - 0x8089B72C:("func_8089B72C",), - 0x8089B7B0:("func_8089B7B0",), - 0x8089B834:("func_8089B834",), - 0x8089B8B0:("func_8089B8B0",), - 0x8089B98C:("func_8089B98C",), - 0x8089BAC0:("func_8089BAC0",), - 0x8089BB60:("func_8089BB60",), - 0x8089BBB4:("func_8089BBB4",), - 0x8089BD28:("func_8089BD28",), - 0x8089C024:("func_8089C024",), - 0x8089C0DC:("func_8089C0DC",), - 0x8089C164:("func_8089C164",), - 0x8089C1F8:("func_8089C1F8",), - 0x8089C244:("func_8089C244",), - 0x8089C2A8:("func_8089C2A8",), - 0x8089C398:("func_8089C398",), - 0x8089C44C:("func_8089C44C",), - 0x8089C4F8:("func_8089C4F8",), - 0x8089C56C:("func_8089C56C",), - 0x8089C690:("func_8089C690",), - 0x8089C724:("func_8089C724",), - 0x8089C784:("func_8089C784",), - 0x8089C7B8:("func_8089C7B8",), - 0x8089C87C:("func_8089C87C",), - 0x8089C938:("func_8089C938",), - 0x8089CA14:("func_8089CA14",), - 0x8089CA74:("func_8089CA74",), - 0x8089CB10:("func_8089CB10",), - 0x8089CBEC:("func_8089CBEC",), - 0x8089CF00:("func_8089CF00",), - 0x8089CF70:("func_8089CF70",), - 0x8089CFAC:("func_8089CFAC",), - 0x8089D018:("func_8089D018",), - 0x8089D11C:("func_8089D11C",), - 0x8089D1E0:("func_8089D1E0",), - 0x8089D2E0:("func_8089D2E0",), - 0x8089D318:("func_8089D318",), - 0x8089D42C:("func_8089D42C",), - 0x8089D60C:("func_8089D60C",), + 0x8089A900:("EnDinofos_Blink",), + 0x8089A968:("EnDinofos_IsFacingPlayer",), + 0x8089A9B0:("EnDinofos_ChooseAction",), + 0x8089ABF4:("EnDinofos_EndCutscene",), + 0x8089AC70:("EnDinofos_Freeze",), + 0x8089ACEC:("EnDinofos_ThawIfFrozen",), + 0x8089AD70:("EnDinofos_EnableBumperCollision",), + 0x8089AE00:("EnDinofos_Dodge",), + 0x8089B100:("EnDinofos_SetupIntroCutsceneBeforeFall",), + 0x8089B288:("EnDinofos_IntroCutsceneBeforeFall",), + 0x8089B320:("EnDinofos_SetupIntroCutsceneFall",), + 0x8089B3D4:("EnDinofos_IntroCutsceneFall",), + 0x8089B4A4:("EnDinofos_SetupIntroCutsceneLandAndBreatheFire",), + 0x8089B580:("EnDinofos_IntroCutsceneLandAndBreatheFire",), + 0x8089B6E8:("EnDinofos_SetupIntroCutsceneYell",), + 0x8089B72C:("EnDinofos_IntroCutsceneYell",), + 0x8089B7B0:("EnDinofos_SetupIdle",), + 0x8089B834:("EnDinofos_Idle",), + 0x8089B8B0:("EnDinofos_SetupWalk",), + 0x8089B98C:("EnDinofos_Walk",), + 0x8089BAC0:("EnDinofos_SetupTurnToPlayer",), + 0x8089BB60:("EnDinofos_TurnToPlayer",), + 0x8089BBB4:("EnDinofos_SetupCircleAroundPlayer",), + 0x8089BD28:("EnDinofos_CircleAroundPlayer",), + 0x8089C024:("EnDinofos_SetupChooseJump",), + 0x8089C0DC:("EnDinofos_ChooseJump",), + 0x8089C164:("EnDinofos_SetupJump",), + 0x8089C1F8:("EnDinofos_Jump",), + 0x8089C244:("EnDinofos_SetupJumpSlash",), + 0x8089C2A8:("EnDinofos_JumpSlash",), + 0x8089C398:("EnDinofos_SetupLand",), + 0x8089C44C:("EnDinofos_Land",), + 0x8089C4F8:("EnDinofos_SetupSlash",), + 0x8089C56C:("EnDinofos_Slash",), + 0x8089C690:("EnDinofos_SetupRecoil",), + 0x8089C724:("EnDinofos_Recoil",), + 0x8089C784:("EnDinofos_SetupStunned",), + 0x8089C7B8:("EnDinofos_Stunned",), + 0x8089C87C:("EnDinofos_SetupDamaged",), + 0x8089C938:("EnDinofos_Damaged",), + 0x8089CA14:("EnDinofos_SetupStartBreatheFire",), + 0x8089CA74:("EnDinofos_StartBreatheFire",), + 0x8089CB10:("EnDinofos_SetupBreatheFire",), + 0x8089CBEC:("EnDinofos_BreatheFire",), + 0x8089CF00:("EnDinofos_SetupEndBreatheFire",), + 0x8089CF70:("EnDinofos_EndBreatheFire",), + 0x8089CFAC:("EnDinofos_SetupDie",), + 0x8089D018:("EnDinofos_Die",), + 0x8089D11C:("EnDinofos_SetupDodgeProjectile",), + 0x8089D1E0:("EnDinofos_DodgeProjectile",), + 0x8089D2E0:("EnDinofos_SetupPlayCutscene",), + 0x8089D318:("EnDinofos_PlayCutscene",), + 0x8089D42C:("EnDinofos_RotateHead",), + 0x8089D60C:("EnDinofos_UpdateDamage",), 0x8089D960:("EnDinofos_Update",), 0x8089DC4C:("EnDinofos_OverrideLimbDraw",), 0x8089DC84:("EnDinofos_PostLimbDraw",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 00d79af385..7147f9cc28 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -5966,13 +5966,13 @@ 0x8089E334:("D_8089E334","UNK_TYPE1","",0x1), 0x8089E33C:("D_8089E33C","UNK_TYPE4","",0x4), 0x8089E34C:("sCsId","UNK_TYPE2","",0x2), - 0x8089E350:("D_8089E350","UNK_TYPE4","",0x4), + 0x8089E350:("sNumAlive","s32","",0x4), 0x8089E354:("D_8089E354","UNK_TYPE1","",0x1), 0x8089E364:("sTexturesDesegmented","UNK_TYPE4","",0x4), 0x8089E368:("D_8089E368","EffectBlureInit2","",0x24), - 0x8089E38C:("D_8089E38C","UNK_TYPE1","",0x1), - 0x8089E398:("D_8089E398","UNK_TYPE1","",0x1), - 0x8089E3A4:("D_8089E3A4","UNK_TYPE1","",0x1), + 0x8089E38C:("sKnifeTipQuadOffset","UNK_TYPE1","",0x1), + 0x8089E398:("sKnifeBaseQuadOffset","UNK_TYPE1","",0x1), + 0x8089E3A4:("sCsFireVelocityOffset","Vec3f","",0x1), 0x8089E3B0:("sLimbToBodyParts","UNK_TYPE1","",0x1), 0x8089E3B4:("D_8089E3B4","UNK_TYPE1","",0x1), 0x8089E3B6:("D_8089E3B6","UNK_TYPE1","",0x1),