From 8f7f3d24c750cec3e99cf5f6309406dbd98eaf6b Mon Sep 17 00:00:00 2001 From: Alejandro Asenjo <96613413+sonicdcer@users.noreply.github.com> Date: Thu, 4 Aug 2022 01:42:00 -0300 Subject: [PATCH] ovl_En_Mkk Decompiled (#959) * progress * all functions matching * fixes * progress * ovl_En_Mkk Decompiled * format * spec * pr review * pr review * format * pr review --- spec | 3 +- src/overlays/actors/ovl_En_Mkk/z_en_mkk.c | 544 ++++++++++++++++++++-- src/overlays/actors/ovl_En_Mkk/z_en_mkk.h | 18 +- 3 files changed, 523 insertions(+), 42 deletions(-) diff --git a/spec b/spec index 4ac8b2ccd2..2fe3386463 100644 --- a/spec +++ b/spec @@ -2810,8 +2810,7 @@ beginseg name "ovl_En_Mkk" compress include "build/src/overlays/actors/ovl_En_Mkk/z_en_mkk.o" - include "build/data/ovl_En_Mkk/ovl_En_Mkk.data.o" - include "build/data/ovl_En_Mkk/ovl_En_Mkk.reloc.o" + include "build/src/overlays/actors/ovl_En_Mkk/ovl_En_Mkk_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c index c383a000c4..c8cc1abb1d 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.c @@ -5,6 +5,7 @@ */ #include "z_en_mkk.h" +#include "objects/object_mkk/object_mkk.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4) @@ -22,8 +23,18 @@ void func_80A4E60C(EnMkk* this, PlayState* play); void func_80A4E72C(EnMkk* this, PlayState* play); void func_80A4EE48(EnMkk* this, PlayState* play); void func_80A4EF74(EnMkk* this, PlayState* play); +void func_80A4E0CC(EnMkk* this); +void func_80A4E190(EnMkk* this); +void func_80A4E2B8(EnMkk* this); +void func_80A4E58C(EnMkk* this); +void func_80A4EDF0(EnMkk* this); +void func_80A4EEF4(EnMkk* this); +void func_80A4F16C(Actor* thisx, PlayState* play); +void func_80A4F4C8(Actor* thisx, PlayState* play); +void func_80A4E67C(EnMkk* this); +void func_80A4E84C(EnMkk* this); +void func_80A4EBBC(EnMkk* this, PlayState* play); -#if 0 const ActorInit En_Mkk_InitVars = { ACTOR_EN_MKK, ACTORCAT_ENEMY, @@ -36,18 +47,36 @@ const ActorInit En_Mkk_InitVars = { (ActorFunc)EnMkk_Draw, }; -// static ColliderSphereInit sSphereInit = { -static ColliderSphereInit D_80A4F720 = { - { COLTYPE_HIT3, AT_NONE | AT_TYPE_ENEMY, AC_NONE | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_SPHERE, }, - { ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x04 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_HARD, BUMP_ON, OCELEM_ON, }, +static ColliderSphereInit sSphereInit = { + { + COLTYPE_HIT3, + AT_NONE | AT_TYPE_ENEMY, + AC_NONE | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_SPHERE, + }, + { + ELEMTYPE_UNK0, + { 0xF7CFFFFF, 0x00, 0x04 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_ON | TOUCH_SFX_HARD, + BUMP_ON, + OCELEM_ON, + }, { 1, { { 0, 0, 0 }, 15 }, 100 }, }; -// sColChkInfoInit -static CollisionCheckInfoInit D_80A4F74C = { 1, 15, 30, 10 }; +typedef struct EnMkkDlists { + /* 0x00 */ Gfx* unk0; + /* 0x04 */ Gfx* unk4; + /* 0x08 */ Gfx* unk8; + /* 0x0C */ Gfx* unkC; +} EnMkkDlists; // size = 0x10 -// static DamageTable sDamageTable = { -static DamageTable D_80A4F754 = { +static CollisionCheckInfoInit sColChkInfoInit = { 1, 15, 30, 10 }; + +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(1, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(1, 0x0), @@ -82,62 +111,499 @@ static DamageTable D_80A4F754 = { /* Powder Keg */ DMG_ENTRY(1, 0x0), }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80A4F774[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE), ICHAIN_F32(terminalVelocity, -5, ICHAIN_CONTINUE), ICHAIN_F32(targetArrowOffset, 3000, ICHAIN_STOP), }; -#endif +static Color_RGBA8 D_80A4F780 = { 250, 250, 250, 255 }; -extern ColliderSphereInit D_80A4F720; -extern CollisionCheckInfoInit D_80A4F74C; -extern DamageTable D_80A4F754; -extern InitChainEntry D_80A4F774[]; +static Color_RGBA8 D_80A4F784 = { 180, 180, 180, 255 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/EnMkk_Init.s") +static Vec3f D_80A4F788 = { 0.0f, 0.45f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/EnMkk_Destroy.s") +static Color_RGBA8 sEffPrimColors[] = { { 50, 50, 50, 255 }, { 255, 255, 255, 255 } }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E0CC.s") +static Color_RGBA8 sEffEnvColors[] = { { 200, 200, 200, 255 }, { 255, 255, 255, 255 } }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E100.s") +static EnMkkDlists sBoeDLists[] = { + { object_mkk_DL_000030, object_mkk_DL_0000B0, object_mkk_DL_0000C8, object_mkk_DL_000140 }, + { object_mkk_DL_0001F0, object_mkk_DL_000278, object_mkk_DL_000290, object_mkk_DL_000310 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E190.s") +static Color_RGBA8 D_80A4F7C4[] = { + { 255, 255, 255, 255 }, { 128, 128, 128, 255 }, { 0, 0, 0, 255 }, + { 0, 0, 0, 255 }, { 128, 128, 128, 255 }, { 255, 255, 255, 255 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E1F0.s") +void EnMkk_Init(Actor* thisx, PlayState* play) { + EnMkk* this = THIS; + s32 paramsFF00; + s32 params2; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E22C.s") + Actor_ProcessInitChain(&this->actor, sInitChain); + Collider_InitAndSetSphere(play, &this->collider, &this->actor, &sSphereInit); + this->collider.dim.worldSphere.radius = sSphereInit.dim.modelSphere.radius; + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + ActorShape_Init(&this->actor.shape, 1000.0f, NULL, 0.0f); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E2B8.s") + this->primColorSelect = 0; + this->unk_149 = 0; + this->unk_152 = (this->actor.shape.rot.x >= 0) ? this->actor.shape.rot.x : this->actor.shape.rot.x * -0x50; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E2E8.s") + this->unk_14C = CLAMP(this->actor.shape.rot.z, 0, 16); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E58C.s") + this->actor.shape.rot.z = 0; + this->actor.world.rot.z = 0; + this->actor.shape.rot.x = 0; + this->actor.world.rot.x = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E60C.s") + Math_Vec3f_Copy(&this->unk_154, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_160, &this->actor.world.pos); + this->unk_14B = ENMKK_GET_4(thisx) ? 8 : 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E67C.s") + paramsFF00 = ENMKK_GET_FF00(&this->actor); + params2 = ENMKK_GET_2(&this->actor); + this->actor.params &= 1; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E72C.s") + if (this->actor.params == 1) { + this->actor.hintId = 0x3C; + } else { + this->actor.hintId = 0x2C; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4E84C.s") + if ((paramsFF00 == 0) || (paramsFF00 == 255)) { + func_80A4E0CC(this); + this->unk_178 = 30000.0f; + if (params2 > 0) { + this->unk_14B |= 4; + } + } else { + this->unk_178 = paramsFF00 * 40.0f * 0.1f; + func_80A4EDF0(this); + this->unk_14E = 0; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EBBC.s") +void EnMkk_Destroy(Actor* thisx, PlayState* play) { + EnMkk* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/EnMkk_Update.s") + Collider_DestroySphere(play, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EDF0.s") +void func_80A4E0CC(EnMkk* this) { + this->alpha = 0; + this->unk_14B |= 3; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actionFunc = func_80A4E100; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EE48.s") +void func_80A4E100(EnMkk* this, PlayState* play) { + s32 newAlpha; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EEF4.s") + if (this->unk_14B & 4) { + newAlpha = this->alpha + 15; + } else { + newAlpha = this->alpha + 5; + } + if (newAlpha >= 255) { + this->primColorSelect = 3; + this->collider.base.acFlags |= AC_ON; + this->alpha = 255; + this->actor.flags |= ACTOR_FLAG_1; + this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + this->unk_14B &= ~4; + func_80A4E190(this); + } else { + this->alpha = newAlpha; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4EF74.s") +void func_80A4E190(EnMkk* this) { + this->unk_14E = (s32)(Rand_ZeroOne() * 20.0f) + 10; + if (this->unk_149 != 0) { + this->unk_149--; + } + this->actionFunc = func_80A4E1F0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4F16C.s") +void func_80A4E1F0(EnMkk* this, PlayState* play) { + this->unk_14E--; + if (this->unk_14E == 0) { + func_80A4E2B8(this); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/EnMkk_Draw.s") +void func_80A4E22C(EnMkk* this, PlayState* play) { + Vec3f pos; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mkk/func_80A4F4C8.s") + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + 15.0f; + pos.z = this->actor.world.pos.z; + func_800B0DE0(play, &pos, &gZeroVec3f, &D_80A4F788, &D_80A4F780, &D_80A4F784, 350, 20); +} + +void func_80A4E2B8(EnMkk* this) { + this->unk_14E = 30; + this->unk_150 = this->actor.shape.rot.y; + this->unk_14B &= ~1; + this->actionFunc = func_80A4E2E8; +} + +void func_80A4E2E8(EnMkk* this, PlayState* play) { + Player* player = GET_PLAYER(play); + s32 sp20; + + this->unk_14E--; + if ((this->actor.params == 1) && (this->actor.bgCheckFlags & 1) && (this->actor.speedXZ > 2.5f) && + ((play->gameplayFrames % 3) == 0)) { + func_80A4E22C(this, play); + } + if (this->unk_14E > 0) { + Math_StepToF(&this->actor.speedXZ, 5.0f, 0.7f); + sp20 = false; + } else { + sp20 = Math_StepToF(&this->actor.speedXZ, 0.0f, 0.7f); + } + if ((player->stateFlags3 & 0x100) || (Player_GetMask(play) == PLAYER_MASK_STONE)) { + Math_ScaledStepToS(&this->unk_150, Actor_YawToPoint(&this->actor, &this->actor.home.pos), 0x400); + } else if ((player->stateFlags2 & 0x80) || (player->actor.freezeTimer > 0)) { + Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer + 0x8000, 0x400); + } else { + Math_ScaledStepToS(&this->unk_150, this->actor.yawTowardsPlayer, 0x400); + } + this->actor.shape.rot.y = + (s32)(sin_rad(this->unk_14E * ((2 * M_PI) / 15)) * (614.4f * this->actor.speedXZ)) + this->unk_150; + func_800B9010(&this->actor, NA_SE_EN_KUROSUKE_MOVE - SFX_FLAG); + if (sp20) { + this->unk_14B &= ~2; + func_80A4E190(this); + } else if ((this->unk_149 == 0) && (!(player->stateFlags3 & 0x100)) && + (Player_GetMask(play) != PLAYER_MASK_STONE) && (this->actor.bgCheckFlags & 1) && + (Actor_IsFacingPlayer(&this->actor, 0x1800)) && (this->actor.xzDistToPlayer < 120.0f) && + (fabsf(this->actor.playerHeightRel) < 100.0f)) { + func_80A4E58C(this); + } +} + +void func_80A4E58C(EnMkk* this) { + this->unk_14B |= 1; + this->actor.speedXZ = 3.0f; + this->actor.velocity.y = 5.0f; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KUROSUKE_ATTACK); + this->collider.base.atFlags |= AT_ON; + Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x800); + this->actionFunc = func_80A4E60C; +} + +void func_80A4E60C(EnMkk* this, PlayState* play) { + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~(AT_ON | AT_HIT); + } + if ((this->actor.velocity.y < 0.0f) && (this->actor.bgCheckFlags & 1)) { + this->unk_149 = 2; + this->collider.base.atFlags &= ~AT_ON; + func_80A4E2B8(this); + } +} + +void func_80A4E67C(EnMkk* this) { + this->unk_14B |= 1; + this->actor.flags &= ~ACTOR_FLAG_1; + this->collider.base.acFlags &= ~AC_ON; + this->actor.flags |= ACTOR_FLAG_10; + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_PO_DEAD); + this->alpha = 254; + func_800BE568(&this->actor, &this->collider); + this->actor.speedXZ = 7.0f; + this->actor.shape.rot.y = this->actor.world.rot.y; + this->actor.velocity.y = 5.0f; + this->actor.gravity = -1.3f; + this->actor.bgCheckFlags &= ~1; + this->actionFunc = func_80A4E72C; +} + +void func_80A4E72C(EnMkk* this, PlayState* play) { + Vec3f temp; + + if (this->actor.bgCheckFlags & 1) { + if (this->actor.velocity.y > -1.0f) { + temp.x = this->actor.world.pos.x; + temp.y = this->actor.world.pos.y + 15.0f; + temp.z = this->actor.world.pos.z; + EffectSsDeadDb_Spawn(play, &temp, &gZeroVec3f, &gZeroVec3f, &sEffPrimColors[this->actor.params], + &sEffEnvColors[this->actor.params], 0x46, 4, 0xC); + Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_EXTINCT); + if (this->unk_14C != 0) { + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, this->unk_14C * 0x10); + } + func_80A4EEF4(this); + } else { + this->actor.velocity.y *= -0.8f; + this->actor.bgCheckFlags &= ~1; + } + } +} + +void func_80A4E84C(EnMkk* this) { + if (this->unk_14B & 3) { + Vec3f sp34; + f32 temp_fv0 = Math_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.prevPos); + + Math_Vec3f_Copy(&sp34, &this->unk_154); + if (temp_fv0 < 0.001f) { + Math_Vec3f_Copy(&this->unk_154, &this->actor.prevPos); + } else { + temp_fv0 = 1.0f / temp_fv0; + + this->unk_154.x = + ((this->actor.prevPos.x - this->actor.world.pos.x) * temp_fv0 * 10.0f) + this->actor.world.pos.x; + this->unk_154.y = + ((this->actor.prevPos.y - this->actor.world.pos.y) * temp_fv0 * 10.0f) + this->actor.world.pos.y; + this->unk_154.z = + ((this->actor.prevPos.z - this->actor.world.pos.z) * temp_fv0 * 10.0f) + this->actor.world.pos.z; + } + temp_fv0 = Math_Vec3f_DistXYZ(&this->unk_154, &sp34); + if (temp_fv0 < 0.001f) { + Math_Vec3f_Copy(&this->unk_160, &sp34); + } else { + temp_fv0 = 1.0f / temp_fv0; + + this->unk_160.x = ((sp34.x - this->unk_154.x) * temp_fv0 * 12.0f) + this->unk_154.x; + this->unk_160.y = ((sp34.y - this->unk_154.y) * temp_fv0 * 12.0f) + this->unk_154.y; + this->unk_160.z = ((sp34.z - this->unk_154.z) * temp_fv0 * 12.0f) + this->unk_154.z; + } + } else { + this->unk_160.y = this->unk_154.y; + this->unk_154.y = this->actor.world.pos.y; + this->unk_154.x = this->actor.world.pos.x - + 10.0f * Math_SinS(this->actor.shape.rot.y + + (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + this->unk_154.z = this->actor.world.pos.z - + 10.0f * Math_CosS(this->actor.shape.rot.y + + (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + this->unk_160.x = this->unk_154.x - + 12.0f * Math_SinS(this->actor.shape.rot.y - + (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + this->unk_160.z = this->unk_154.z - + 12.0f * Math_CosS(this->actor.shape.rot.y - + (s32)(1228.8f * this->actor.speedXZ * sin_rad(this->unk_14E * (M_PI / 5)))); + } +} + +void func_80A4EBBC(EnMkk* this, PlayState* play) { + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + Actor_SetDropFlag(&this->actor, &this->collider.info); + Enemy_StartFinishingBlow(play, &this->actor); + func_80A4E67C(this); + } +} + +void EnMkk_Update(Actor* thisx, PlayState* play) { + s32 pad; + Player* player; + EnMkk* this = THIS; + + if (this->primColorSelect > 0) { + this->primColorSelect--; + } else if ((Rand_ZeroOne() < 0.075f) && (this->actor.params != 1)) { + this->primColorSelect = 6; + } + func_80A4EBBC(this, play); + this->actionFunc(this, play); + this->actor.world.rot.y = this->actor.shape.rot.y; + Actor_MoveWithGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, 0x1D); + if (this->actor.params == 0) { + func_80A4E84C(this); + } + if (Actor_IsFacingPlayer(&this->actor, 0x3000)) { + player = GET_PLAYER(play); + this->actor.shape.rot.x = Actor_PitchToPoint(&this->actor, &player->actor.focus.pos); + this->actor.shape.rot.x = CLAMP(this->actor.shape.rot.x, -0x1800, 0x1800); + } + Actor_SetFocus(&this->actor, 10.0f); + this->collider.dim.worldSphere.center.x = this->actor.focus.pos.x; + this->collider.dim.worldSphere.center.y = this->actor.focus.pos.y; + this->collider.dim.worldSphere.center.z = this->actor.focus.pos.z; + if (this->collider.base.atFlags & AT_ON) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + } + if (this->collider.base.acFlags & AT_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + } + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); +} + +void func_80A4EDF0(EnMkk* this) { + this->alpha = 0; + this->unk_14B |= 3; + this->actor.flags &= ~ACTOR_FLAG_1; + this->actor.draw = NULL; + this->actor.update = func_80A4F16C; + this->actor.gravity = -0.5f; + this->unk_14E = this->unk_152; + this->actionFunc = func_80A4EE48; +} + +void func_80A4EE48(EnMkk* this, PlayState* play) { + if (this->unk_14E > 0) { + this->unk_14E--; + if (this->unk_14E == 0) { + this->actor.flags &= ~ACTOR_FLAG_10; + } + } else if ((this->actor.xzDistToPlayer < this->unk_178) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { + this->actor.update = EnMkk_Update; + this->actor.draw = EnMkk_Draw; + this->actor.flags &= ~ACTOR_FLAG_10; + func_80A4E0CC(this); + } +} + +void func_80A4EEF4(EnMkk* this) { + Math_Vec3f_Copy(&this->unk_16C, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_154, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_160, &this->actor.world.pos); + Actor_SetScale(&this->actor, 0.005f); + this->actor.update = func_80A4F16C; + this->actor.draw = func_80A4F4C8; + this->actionFunc = func_80A4EF74; +} + +void func_80A4EF74(EnMkk* this, PlayState* play) { + s32 newAlpha = this->alpha - 20; + + if (newAlpha <= 0) { + if (this->unk_14B & 8) { + Actor_SetScale(&this->actor, 0.01f); + this->primColorSelect = 0; + this->unk_149 = 0; + Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.home.pos); + Math_Vec3f_Copy(&this->unk_154, &this->actor.world.pos); + Math_Vec3f_Copy(&this->unk_160, &this->actor.world.pos); + this->actor.speedXZ = 0.0f; + this->actor.velocity.y = 0.0f; + func_80A4EDF0(this); + } else { + Actor_MarkForDeath(&this->actor); + } + } else { + this->alpha = newAlpha; + this->actor.world.pos.x += 0.3f + (3.0f * Rand_ZeroOne()); + this->actor.world.pos.y += 0.5f + (3.5f * Rand_ZeroOne()); + this->unk_16C.x -= 0.3f + (3.0f * Rand_ZeroOne()); + this->unk_16C.y += 0.5f + (3.5f * Rand_ZeroOne()); + this->unk_154.z += 0.3f + (3.0f * Rand_ZeroOne()); + this->unk_154.y += 0.5f + (3.5f * Rand_ZeroOne()); + this->unk_160.z -= 0.3f + (3.0f * Rand_ZeroOne()); + this->unk_160.y += 0.5f + (3.5f * Rand_ZeroOne()); + } +} + +void func_80A4F16C(Actor* thisx, PlayState* play) { + EnMkk* this = THIS; + + this->actionFunc(this, play); +} + +void EnMkk_Draw(Actor* thisx, PlayState* play) { + EnMkkDlists* dLists = &sBoeDLists[thisx->params]; + Gfx* gfx; + Color_RGBA8* primColors; + EnMkk* this = THIS; + + if (this->actor.projectedPos.z > 0.0f) { + MtxF* matrix; + + OPEN_DISPS(play->state.gfxCtx); + + if (this->alpha == 255) { + primColors = &D_80A4F7C4[this->primColorSelect]; + gfx = POLY_OPA_DISP; + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gDPSetPrimColor(&gfx[1], 0, 0xFF, primColors->r, primColors->g, primColors->b, primColors->a); + gSPSegment(&gfx[2], 0x08, D_801AEFA0); + gSPMatrix(&gfx[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[4], dLists->unkC); + POLY_OPA_DISP = &gfx[5]; + } + gfx = POLY_XLU_DISP; + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gDPSetEnvColor(&gfx[1], 255, 255, 255, this->alpha); + gSPDisplayList(&gfx[2], dLists->unk0); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(&gfx[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[4], dLists->unk4); + if (thisx->params == 0) { + matrix = Matrix_GetCurrent(); + matrix->mf[3][0] = this->unk_154.x; + matrix->mf[3][1] = this->unk_154.y + 8.5f; + matrix->mf[3][2] = this->unk_154.z; + + Matrix_Scale(0.85f, 0.85f, 0.85f, MTXMODE_APPLY); + gSPMatrix(&gfx[5], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[6], dLists->unk4); + + matrix->mf[3][0] = this->unk_160.x; + matrix->mf[3][1] = this->unk_160.y + 7.2250004f; + matrix->mf[3][2] = this->unk_160.z; + + Matrix_Scale(0.85f, 0.85f, 0.85f, MTXMODE_APPLY); + gSPMatrix(&gfx[7], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[8], dLists->unk4); + gSPDisplayList(&gfx[9], dLists->unk8); + + POLY_XLU_DISP = &gfx[10]; + } else { + gSPDisplayList(&gfx[5], dLists->unk8); + POLY_XLU_DISP = &gfx[6]; + } + } + CLOSE_DISPS(play->state.gfxCtx); +} + +void func_80A4F4C8(Actor* thisx, PlayState* play) { + s32 pad; + Gfx* gfx; + MtxF* matrix; + EnMkkDlists* dLists = &sBoeDLists[thisx->params]; + EnMkk* this = THIS; + + OPEN_DISPS(play->state.gfxCtx); + + gfx = POLY_XLU_DISP; + gSPDisplayList(&gfx[0], &sSetupDL[6 * 25]); + gDPSetEnvColor(&gfx[1], 255, 255, 255, this->alpha); + gSPDisplayList(&gfx[2], dLists->unk0); + Matrix_ReplaceRotation(&play->billboardMtxF); + gSPMatrix(&gfx[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[4], dLists->unk4); + + matrix = Matrix_GetCurrent(); + matrix->mf[3][0] = this->unk_154.x; + matrix->mf[3][1] = this->unk_154.y + 5.0f; + matrix->mf[3][2] = this->unk_154.z; + + gSPMatrix(&gfx[5], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[6], dLists->unk4); + + matrix->mf[3][0] = this->unk_160.x; + matrix->mf[3][1] = this->unk_160.y + 5.0f; + matrix->mf[3][2] = this->unk_160.z; + + gSPMatrix(&gfx[7], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[8], dLists->unk4); + + matrix->mf[3][0] = this->unk_16C.x; + matrix->mf[3][1] = this->unk_16C.y + 5.0f; + matrix->mf[3][2] = this->unk_16C.z; + + gSPMatrix(&gfx[9], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(&gfx[10], dLists->unk4); + gSPDisplayList(&gfx[11], dLists->unk8); + POLY_XLU_DISP = &gfx[12]; + + CLOSE_DISPS(play->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h index 200186c447..a8e047284b 100644 --- a/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h +++ b/src/overlays/actors/ovl_En_Mkk/z_en_mkk.h @@ -3,6 +3,10 @@ #include "global.h" +#define ENMKK_GET_2(thisx) ((thisx)->params & 2) +#define ENMKK_GET_4(thisx) ((thisx)->params & 4) +#define ENMKK_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) + struct EnMkk; typedef void (*EnMkkActionFunc)(struct EnMkk*, PlayState*); @@ -10,7 +14,19 @@ typedef void (*EnMkkActionFunc)(struct EnMkk*, PlayState*); typedef struct EnMkk { /* 0x000 */ Actor actor; /* 0x144 */ EnMkkActionFunc actionFunc; - /* 0x148 */ char unk_148[0x8C]; + /* 0x148 */ u8 primColorSelect; + /* 0x149 */ u8 unk_149; + /* 0x14A */ u8 alpha; + /* 0x14B */ u8 unk_14B; + /* 0x14C */ u8 unk_14C; + /* 0x14E */ s16 unk_14E; + /* 0x150 */ s16 unk_150; + /* 0x152 */ s16 unk_152; + /* 0x154 */ Vec3f unk_154; + /* 0x160 */ Vec3f unk_160; + /* 0x16C */ Vec3f unk_16C; + /* 0x178 */ f32 unk_178; + /* 0x17C */ ColliderSphere collider; } EnMkk; // size = 0x1D4 extern const ActorInit En_Mkk_InitVars;