diff --git a/assets/xml/overlays/ovl_En_Mm3.xml b/assets/xml/overlays/ovl_En_Mm3.xml new file mode 100644 index 0000000000..207b5ec8f6 --- /dev/null +++ b/assets/xml/overlays/ovl_En_Mm3.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/include/functions.h b/include/functions.h index 05fe124747..05262d2c41 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1900,7 +1900,7 @@ void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); // void func_8010E028(void); // void func_8010E968(void); void func_8010E9F0(s16 arg0, s16 arg1); -// void func_8010EA9C(void); +void func_8010EA9C(s32 arg0, s32 arg1); // void func_8010EB50(void); // void func_8010EBA0(void); // void func_8010EC54(void); @@ -3634,7 +3634,7 @@ void func_801A0124(Vec3f* pos, u8 arg1); // void func_801A0184(void); // void func_801A01C4(void); void func_801A0204(s8 seqId); -// void func_801A0238(void); +void func_801A0238(s32 arg0, s32 arg1); // void func_801A026C(void); // void func_801A0318(void); // void func_801A046C(void); diff --git a/spec b/spec index 488852c5f9..8040fd441d 100644 --- a/spec +++ b/spec @@ -3092,8 +3092,7 @@ beginseg name "ovl_En_Mm3" compress include "build/src/overlays/actors/ovl_En_Mm3/z_en_mm3.o" - include "build/data/ovl_En_Mm3/ovl_En_Mm3.data.o" - include "build/data/ovl_En_Mm3/ovl_En_Mm3.reloc.o" + include "build/src/overlays/actors/ovl_En_Mm3/ovl_En_Mm3_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 8ff09e32b3..fd676186ef 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -5,6 +5,7 @@ */ #include "z_en_mm3.h" +#include "objects/object_mm/object_mm.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -15,7 +16,19 @@ void EnMm3_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnMm3_Update(Actor* thisx, GlobalContext* globalCtx); void EnMm3_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80A6F270(EnMm3* this); +void func_80A6F2C8(EnMm3* this, GlobalContext* globalCtx); +void func_80A6F9C8(EnMm3* this); +void func_80A6F9DC(EnMm3* this, GlobalContext* globalCtx); +void func_80A6FBA0(EnMm3* this); +void func_80A6FBFC(EnMm3* this, GlobalContext* globalCtx); +void func_80A6FE1C(EnMm3* this); +void func_80A6FE30(EnMm3* this, GlobalContext* globalCtx); +void func_80A6FED8(EnMm3* this); +void func_80A6FEEC(EnMm3* this, GlobalContext* globalCtx); +s32 func_80A6FFAC(EnMm3* this, GlobalContext* globalCtx); +void func_80A70084(EnMm3* this, GlobalContext* globalCtx); + const ActorInit En_Mm3_InitVars = { ACTOR_EN_MM3, ACTORCAT_NPC, @@ -28,61 +41,532 @@ const ActorInit En_Mm3_InitVars = { (ActorFunc)EnMm3_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80A703F0 = { - { COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0x00000000, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, 63, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80A7041C = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -#endif +static AnimationInfo sAnimations[] = { + { &object_mm_Anim_002238, 1.0f, 0.0f, 0.0f, 0, -7.0f }, { &object_mm_Anim_00A4E0, -1.0f, 0.0f, 0.0f, 2, -7.0f }, + { &object_mm_Anim_00C640, 1.0f, 0.0f, 0.0f, 0, -7.0f }, { &object_mm_Anim_00A4E0, 1.0f, 0.0f, 0.0f, 2, -7.0f }, + { &object_mm_Anim_000468, 1.0f, 0.0f, 0.0f, 0, -7.0f }, { &object_mm_Anim_00CD90, 1.0f, 0.0f, 0.0f, 0, -12.0f }, + { &object_mm_Anim_00DA50, 1.0f, 0.0f, 0.0f, 0, -12.0f }, { &object_mm_Anim_00DA50, 1.0f, 0.0f, 10.0f, 2, -10.0f }, +}; -extern ColliderCylinderInit D_80A703F0; -extern CollisionCheckInfoInit2 D_80A7041C; +#include "overlays/ovl_En_Mm3/ovl_En_Mm3.c" -extern UNK_TYPE D_0600A4E0; +Vec3f D_80A704F0 = { 0.0f, 0.0f, 0.0f }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/EnMm3_Init.s") +TexturePtr D_80A704FC[] = { object_mm_Tex_002950, object_mm_Tex_002750 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/EnMm3_Destroy.s") +void EnMm3_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnMm3* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F22C.s") + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 21.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mm_Skel_0096E8, &object_mm_Anim_00A4E0, this->jointTable, + this->morphTable, 16); + Animation_Change(&this->skelAnime, &object_mm_Anim_00A4E0, -1.0f, Animation_GetLastFrame(&object_mm_Anim_00A4E0), + 0.0f, 2, 0.0f); + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actor.parent = NULL; + this->actor.targetMode = 0; + this->unk_1DC = 1; + this->unk_2B4 = 0; + this->unk_2AE = 0; + this->unk_2B0 &= ~1; + this->actor.world.pos.y = this->actor.floorHeight; + func_80A6F270(this); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F270.s") +void EnMm3_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnMm3* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F2C8.s") + gSaveContext.weekEventReg[63] &= (u8)~1; + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F3B4.s") +s32 func_80A6F22C(EnMm3* this) { + s16 abs = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F5E4.s") + abs = ABS_ALT(abs); + if (abs < 0x4000) { + return true; + } + return false; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F9C8.s") +void func_80A6F270(EnMm3* this) { + this->unk_1DC = 1; + this->unk_2B0 &= ~1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 5); + this->actionFunc = func_80A6F2C8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6F9DC.s") +void func_80A6F2C8(EnMm3* this, GlobalContext* globalCtx) { + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + Message_StartTextbox(globalCtx, 0x278A, &this->actor); + this->unk_2B4 = 0x278A; + func_80A6F9C8(this); + } else if (func_80A6F22C(this)) { + func_800B8614(&this->actor, globalCtx, 100.0f); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FBA0.s") + Math_SmoothStepToS(&this->unk_2A0.x, 0, 5, 0x1000, 0x100); + Math_SmoothStepToS(&this->unk_2A0.y, 0, 5, 0x1000, 0x100); + Math_SmoothStepToS(&this->unk_2A6.x, 0, 5, 0x1000, 0x100); + Math_SmoothStepToS(&this->unk_2A6.y, 0, 5, 0x1000, 0x100); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FBFC.s") +void func_80A6F3B4(EnMm3* this, GlobalContext* globalCtx) { + if (func_80147624(globalCtx)) { + switch (this->unk_2B4) { + case 0x278E: + if (globalCtx->msgCtx.choiceIndex == 0) { + if (this->unk_2B2 & 0x20) { + if (gSaveContext.rupees >= globalCtx->msgCtx.unk1206C) { + func_8019F208(); + Message_StartTextbox(globalCtx, 0x2790, &this->actor); + this->unk_2B4 = 0x2790; + func_801159EC(-globalCtx->msgCtx.unk1206C); + } else { + play_sound(NA_SE_SY_ERROR); + Message_StartTextbox(globalCtx, 0x279C, &this->actor); + this->unk_2B4 = 0x279C; + func_80151BB4(globalCtx, 0xB); + } + } else { + func_8019F208(); + Message_StartTextbox(globalCtx, 0x2790, &this->actor); + this->unk_2B4 = 0x2790; + } + } else { + func_8019F230(); + Message_StartTextbox(globalCtx, 0x278F, &this->actor); + this->unk_2B4 = 0x278F; + func_80151BB4(globalCtx, 0xB); + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FE1C.s") + case 0x279A: + if (globalCtx->msgCtx.choiceIndex == 0) { + if (gSaveContext.rupees >= globalCtx->msgCtx.unk1206C) { + func_8019F208(); + Message_StartTextbox(globalCtx, 0x2790, &this->actor); + this->unk_2B4 = 0x2790; + func_801159EC(-globalCtx->msgCtx.unk1206C); + } else { + play_sound(NA_SE_SY_ERROR); + Message_StartTextbox(globalCtx, 0x279C, &this->actor); + this->unk_2B4 = 0x279C; + func_80151BB4(globalCtx, 0xB); + } + } else { + func_8019F230(); + Message_StartTextbox(globalCtx, 0x279B, &this->actor); + this->unk_2B4 = 0x279B; + func_80151BB4(globalCtx, 0xB); + } + break; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FE30.s") +void func_80A6F5E4(EnMm3* this, GlobalContext* globalCtx) { + if (((this->unk_2B4 != 0x2791) || (this->unk_2AC == 0)) && func_80147624(globalCtx)) { + switch (this->unk_2B4) { + case 0x278A: + if (func_80A6FFAC(this, globalCtx)) { + Message_StartTextbox(globalCtx, 0x279D, &this->actor); + this->unk_2B4 = 0x279D; + } else { + func_80A70084(this, globalCtx); + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + Message_StartTextbox(globalCtx, 0x27A0, &this->actor); + this->unk_2B4 = 0x27A0; + } else { + Message_StartTextbox(globalCtx, 0x278B, &this->actor); + this->unk_2B4 = 0x278B; + } + } + this->unk_1DC = 0; + this->unk_2B0 |= 1; + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 7); + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FED8.s") + case 0x278B: + case 0x27A0: + this->unk_2AE = 0; + Message_StartTextbox(globalCtx, 0x278C, &this->actor); + this->unk_2B4 = 0x278C; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FEEC.s") + case 0x278C: + Message_StartTextbox(globalCtx, 0x278D, &this->actor); + this->unk_2B4 = 0x278D; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A6FFAC.s") + case 0x279D: + this->unk_2AE = 0; + Message_StartTextbox(globalCtx, 0x279E, &this->actor); + this->unk_2B4 = 0x279E; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A70084.s") + case 0x279E: + this->unk_2B2 |= 0x20; + Message_StartTextbox(globalCtx, 0x279F, &this->actor); + this->unk_2B4 = 0x279F; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/EnMm3_Update.s") + case 0x278D: + case 0x279F: + Message_StartTextbox(globalCtx, 0x278E, &this->actor); + this->unk_2B4 = 0x278E; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A701E0.s") + case 0x2791: + if (gSaveContext.unk_3DE0[0] == 1000) { + Message_StartTextbox(globalCtx, 0x2792, &this->actor); + this->unk_2B4 = 0x2792; + } else if ((gSaveContext.unk_3DE0[0] >= 1500)) { + Message_StartTextbox(globalCtx, 0x2797, &this->actor); + this->unk_2B4 = 0x2797; + } else if ((gSaveContext.unk_3DE0[0] <= 1050) && (gSaveContext.unk_3DE0[0] >= 950)) { + Message_StartTextbox(globalCtx, 0x2795, &this->actor); + this->unk_2B4 = 0x2795; + } else { + Message_StartTextbox(globalCtx, 0x2796, &this->actor); + this->unk_2B4 = 0x2796; + } + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/func_80A702B0.s") + case 0x2792: + Message_StartTextbox(globalCtx, 0x2793, &this->actor); + this->unk_2B4 = 0x2793; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Mm3/EnMm3_Draw.s") + case 0x2793: + func_801477B4(globalCtx); + func_80A6FE1C(this); + func_80A6FE30(this, globalCtx); + break; + + case 0x2795: + case 0x2796: + case 0x2797: + if (gSaveContext.weekEventReg[63] & 2) { + Message_StartTextbox(globalCtx, 0x279B, &this->actor); + this->unk_2B4 = 0x279B; + func_80151BB4(globalCtx, 0xB); + } else { + Message_StartTextbox(globalCtx, 0x2798, &this->actor); + this->unk_2B4 = 0x2798; + } + break; + + case 0x2798: + Message_StartTextbox(globalCtx, 0x2799, &this->actor); + this->unk_2B4 = 0x2799; + break; + + case 0x2799: + Message_StartTextbox(globalCtx, 0x279A, &this->actor); + this->unk_2B4 = 0x279A; + break; + } + } else if ((this->unk_2AC > 0) && (this->unk_2B4 == 0x2791)) { + this->unk_2AC--; + if (this->unk_2AC == 0) { + if (gSaveContext.unk_3DE0[0] == 1000) { + func_801A3098(0x922); + } else { + play_sound(NA_SE_SY_ERROR); + } + } + } +} + +void func_80A6F9C8(EnMm3* this) { + this->actionFunc = func_80A6F9DC; +} + +void func_80A6F9DC(EnMm3* this, GlobalContext* globalCtx) { + this->unk_2B0 &= ~2; + + switch (Message_GetState(&globalCtx->msgCtx)) { + case 0: + case 1: + case 2: + break; + + case 3: + this->unk_2B0 |= 2; + break; + + case 4: + func_80A6F3B4(this, globalCtx); + break; + + case 5: + func_80A6F5E4(this, globalCtx); + break; + + case 6: + if (func_80147624(globalCtx)) { + if (this->unk_2B4 == 0x2790) { + Player* player = GET_PLAYER(globalCtx); + + player->stateFlags1 |= 0x20; + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + func_8010EA9C(0, 2); + } else { + func_8010EA9C(0, 0); + } + func_801477B4(globalCtx); + play_sound(NA_SE_SY_START_SHOT); + func_80A6FBA0(this); + } else { + gSaveContext.weekEventReg[63] &= (u8)~1; + gSaveContext.weekEventReg[63] &= (u8)~2; + func_80A6F270(this); + } + } + break; + } + + if ((this->skelAnime.mode == 2) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 2); + } + + if (((this->unk_2B4 == 0x279D) || (this->unk_2B4 == 0x27A0) || (this->unk_2B4 == 0x278B)) && + Animation_OnFrame(&this->skelAnime, 8.0f) && (this->unk_2AE == 0)) { + Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_LIE_DOWN_ON_BED); + this->unk_2AE = 1; + } +} + +void func_80A6FBA0(EnMm3* this) { + func_801A5BD0(0x6F); + func_801A0238(0, 5); + gSaveContext.weekEventReg[63] |= 1; + gSaveContext.weekEventReg[63] &= (u8)~2; + this->actionFunc = func_80A6FBFC; +} + +void func_80A6FBFC(EnMm3* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + OSTime a; + OSTime b; + + if (gSaveContext.unk_3DD0[0] == 0x10) { + player->stateFlags1 &= ~0x20; + this->actor.flags |= ACTOR_FLAG_10000; + if (gSaveContext.unk_3DE0[0] >= 0x5DD) { + gSaveContext.unk_3DE0[0] = 0x5DC; + } else { + a = gSaveContext.unk_3DE0[0]; + if (a >= (OSTime)(995 - XREG(16))) { + b = gSaveContext.unk_3DE0[0]; + if ((OSTime)(XREG(17) + 1005) >= b) { + gSaveContext.unk_3DE0[0] = 1000; + } + } + } + } else if (gSaveContext.unk_3DE0[0] >= 0x5DD) { + gSaveContext.unk_3DD0[0] = 15; + gSaveContext.unk_3DC8 = osGetTime(); + } + + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + func_801A5BD0(0); + func_801A0238(0x7F, 5); + Message_StartTextbox(globalCtx, 0x2791, &this->actor); + this->unk_2B4 = 0x2791; + this->unk_2AC = 7; + gSaveContext.unk_3DD0[0] = 0; + this->actor.flags &= ~ACTOR_FLAG_10000; + play_sound(NA_SE_SY_START_SHOT); + func_80A6F9C8(this); + } else { + func_800B8614(&this->actor, globalCtx, this->actor.xzDistToPlayer + 10.0f); + func_80123E90(globalCtx, &this->actor); + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + play_sound(NA_SE_SY_STOPWATCH_TIMER_INF - SFX_FLAG); + } else { + play_sound(NA_SE_SY_STOPWATCH_TIMER_3 - SFX_FLAG); + } + } +} + +void func_80A6FE1C(EnMm3* this) { + this->actionFunc = func_80A6FE30; +} + +void func_80A6FE30(EnMm3* this, GlobalContext* globalCtx) { + if (Actor_HasParent(&this->actor, globalCtx)) { + if (!(gSaveContext.weekEventReg[77] & 1)) { + gSaveContext.weekEventReg[77] |= 1; + } + this->actor.parent = NULL; + func_80A6FED8(this); + } else if (gSaveContext.weekEventReg[77] & 1) { + Actor_PickUp(&this->actor, globalCtx, GI_RUPEE_PURPLE, 500.0f, 100.0f); + } else { + Actor_PickUp(&this->actor, globalCtx, GI_HEART_PIECE, 500.0f, 100.0f); + } +} + +void func_80A6FED8(EnMm3* this) { + this->actionFunc = func_80A6FEEC; +} + +void func_80A6FEEC(EnMm3* this, GlobalContext* globalCtx) { + Player* player = GET_PLAYER(globalCtx); + + if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { + player->stateFlags1 &= ~0x20; + Message_StartTextbox(globalCtx, 0x2794, &this->actor); + this->unk_2B4 = 0x2794; + func_80151BB4(globalCtx, 0xB); + func_80151BB4(globalCtx, 0x2B); + this->actor.flags &= ~ACTOR_FLAG_10000; + func_80A6F9C8(this); + } else { + func_800B85E0(&this->actor, globalCtx, 200.0f, -1); + } +} + +s32 func_80A6FFAC(EnMm3* this, GlobalContext* globalCtx) { + switch (gSaveContext.playerForm) { + case 4: + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + if (this->unk_2B2 & 0x10) { + return true; + } + } else if (this->unk_2B2 & 1) { + return true; + } + break; + + case 3: + if (this->unk_2B2 & 2) { + return true; + } + break; + + case 2: + if (this->unk_2B2 & 4) { + return true; + } + break; + + case 1: + if (this->unk_2B2 & 8) { + return true; + } + break; + } + + return false; +} + +void func_80A70084(EnMm3* this, GlobalContext* globalCtx) { + switch (gSaveContext.playerForm) { + case 4: + if (Player_GetMask(globalCtx) == PLAYER_MASK_BUNNY) { + this->unk_2B2 |= 0x10; + this->unk_2B2 |= 1; + } else { + this->unk_2B2 |= 1; + } + break; + + case 3: + this->unk_2B2 |= 2; + break; + + case 2: + this->unk_2B2 |= 4; + break; + + case 1: + this->unk_2B2 |= 8; + break; + } +} + +void EnMm3_Update(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + EnMm3* this = THIS; + + this->actionFunc(this, globalCtx); + + SkelAnime_Update(&this->skelAnime); + + if (this->unk_2B0 & 1) { + func_800E9250(globalCtx, &this->actor, &this->unk_2A0, &this->unk_2A6, this->actor.focus.pos); + } + + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); +} + +s32 EnMm3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { + EnMm3* this = THIS; + + if (limbIndex == 8) { + rot->x += this->unk_2A6.y; + rot->y -= this->unk_2A6.x; + } else if (limbIndex == 15) { + rot->x += this->unk_2A0.y; + rot->z += this->unk_2A0.x; + if ((this->unk_2B0 & 2) && ((globalCtx->gameplayFrames % 3) == 0)) { + Matrix_InsertTranslation(40.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } + } + return false; +} + +void EnMm3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + EnMm3* this = THIS; + + if (limbIndex == 15) { + Matrix_MultiplyVector3fByState(&D_80A704F0, &this->actor.focus.pos); + } +} + +void EnMm3_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnMm3* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C28C(globalCtx->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_80A704FC[this->unk_1DC])); + gSPSegment(POLY_OPA_DISP++, 0x0C, sEnMm3DL); + + SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnMm3_OverrideLimbDraw, EnMm3_PostLimbDraw, &this->actor); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h index b3a8c28938..fe2e7ba06e 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.h @@ -9,9 +9,20 @@ typedef void (*EnMm3ActionFunc)(struct EnMm3*, GlobalContext*); typedef struct EnMm3 { /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x90]; + /* 0x0144 */ SkelAnime skelAnime; + /* 0x0188 */ ColliderCylinder collider; /* 0x01D4 */ EnMm3ActionFunc actionFunc; - /* 0x01D8 */ char unk_1D8[0xE0]; + /* 0x01D8 */ UNK_TYPE1 unk1D8[4]; + /* 0x01DC */ s32 unk_1DC; + /* 0x01E0 */ Vec3s jointTable[16]; + /* 0x0240 */ Vec3s morphTable[16]; + /* 0x02A0 */ Vec3s unk_2A0; + /* 0x02A6 */ Vec3s unk_2A6; + /* 0x02AC */ s16 unk_2AC; + /* 0x02AE */ s16 unk_2AE; + /* 0x02B0 */ u16 unk_2B0; + /* 0x02B2 */ u16 unk_2B2; + /* 0x02B4 */ u16 unk_2B4; } EnMm3; // size = 0x2B8 extern const ActorInit En_Mm3_InitVars; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 76a3a3d55f..32982655da 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -10956,8 +10956,8 @@ 0x80A6FFAC:("func_80A6FFAC",), 0x80A70084:("func_80A70084",), 0x80A70134:("EnMm3_Update",), - 0x80A701E0:("func_80A701E0",), - 0x80A702B0:("func_80A702B0",), + 0x80A701E0:("EnMm3_OverrideLimbDraw",), + 0x80A702B0:("EnMm3_PostLimbDraw",), 0x80A702F0:("EnMm3_Draw",), 0x80A706F0:("BgCraceMovebg_Init",), 0x80A7090C:("func_80A7090C",), diff --git a/undefined_syms.txt b/undefined_syms.txt index e212409c26..a003b1ae3d 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1594,11 +1594,6 @@ D_06002EC0 = 0x06002EC0; D_06001C38 = 0x06001C38; D_06006CA0 = 0x06006CA0; -// ovl_En_Mm3 - -D_060096E8 = 0x060096E8; -D_0600A4E0 = 0x0600A4E0; - // ovl_En_Mnk D_06003584 = 0x06003584;