diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index 49b1f46b50..ae267dbfae 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -1,3 +1,9 @@ +/* + * File: z_en_mu.c + * Overlay: ovl_En_Mu + * Description: Haggling townspeople + */ + #include "z_en_mu.h" #define FLAGS 0x00000009 @@ -9,8 +15,8 @@ void EnMu_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnMu_Update(Actor* thisx, GlobalContext* globalCtx); void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx); -void EnMu_Pose(Actor* this, GlobalContext* globalCtx); -s32 EnMu_CheckDialogState(GlobalContext* globalCtx, EnMu* this); +void EnMu_Pose(EnMu* this, GlobalContext* globalCtx); +s16 EnMu_CheckDialogState(GlobalContext* globalCtx, Actor* thisx); extern AnimationHeader D_060003F4; extern FlexSkeletonHeader D_06004F70; @@ -102,7 +108,9 @@ u16 EnMu_GetFaceReaction(GlobalContext* globalCtx, Actor* thisx) { return this->defFaceReaction; } -s32 EnMu_CheckDialogState(GlobalContext* globalCtx, EnMu* this) { +s16 EnMu_CheckDialogState(GlobalContext* globalCtx, Actor* thisx) { + EnMu* this = THIS; + switch (func_8010BDBC(&globalCtx->msgCtx)) { case 0: case 1: @@ -123,8 +131,8 @@ s32 EnMu_CheckDialogState(GlobalContext* globalCtx, EnMu* this) { } void EnMu_Init(Actor* thisx, GlobalContext* globalCtx) { - s32 pad; EnMu* this = THIS; + s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 160.0f); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06004F70, &D_060003F4, NULL, NULL, 0); @@ -139,12 +147,12 @@ void EnMu_Init(Actor* thisx, GlobalContext* globalCtx) { void EnMu_Destroy(Actor* thisx, GlobalContext* globalCtx) { EnMu* this = THIS; + SkelAnime_Free(&this->skelAnime, globalCtx); } -void EnMu_Pose(Actor* thisx, GlobalContext* globalCtx) { - EnMu* this = THIS; - func_80034F54(globalCtx, &this->unk_20A, &this->unk_22A, 16); +void EnMu_Pose(EnMu* this, GlobalContext* globalCtx) { + func_80034F54(globalCtx, this->unk_20A, this->unk_22A, 16); } void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) { @@ -159,12 +167,13 @@ void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) { this->collider.dim.pos = pos; - CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); this->actionFunc(this, globalCtx); talkDist = this->collider.dim.radius + 30.0f; - func_800343CC(globalCtx, this, &this->dialogState, talkDist, EnMu_GetFaceReaction, EnMu_CheckDialogState); + func_800343CC(globalCtx, &this->actor, &this->npcInfo.unk_00, talkDist, EnMu_GetFaceReaction, + EnMu_CheckDialogState); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 60.0f; @@ -172,6 +181,7 @@ void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) { s32 EnMu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnMu* this = THIS; + if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 12) || (limbIndex == 13) || (limbIndex == 14)) { rot->y += Math_SinS(this->unk_20A[limbIndex]) * 200.0f; @@ -185,6 +195,7 @@ void EnMu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec Gfx* EnMu_DisplayListSetColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { Gfx* dlist; + dlist = Graph_Alloc(gfxCtx, 2 * sizeof(Gfx)); gDPSetEnvColor(dlist, r, g, b, a); gSPEndDisplayList(dlist + 1); @@ -193,8 +204,6 @@ Gfx* EnMu_DisplayListSetColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) { void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx) { EnMu* this = THIS; - - // 2 sets of 5 colors for each actor in town with different colors Color_RGBA8 colors[2][5] = { { { 100, 130, 235, 0 }, { 160, 250, 60, 0 }, { 90, 60, 20, 0 }, { 30, 240, 200, 0 }, { 140, 70, 20, 0 } }, { { 140, 70, 20, 0 }, { 30, 240, 200, 0 }, { 90, 60, 20, 0 }, { 160, 250, 60, 0 }, { 100, 130, 235, 0 } } diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.h b/src/overlays/actors/ovl_En_Mu/z_en_mu.h index b50574a255..af708fa7cb 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.h +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.h @@ -13,7 +13,7 @@ typedef struct EnMu { /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnMuActionFunc actionFunc; /* 0x0194 */ ColliderCylinder collider; - /* 0x01E0 */ struct_80034A14_arg1 dialogState; + /* 0x01E0 */ struct_80034A14_arg1 npcInfo; /* 0x0208 */ u16 defFaceReaction; /* 0x020A */ s16 unk_20A[16]; /* 0x022A */ s16 unk_22A[17];