mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-29 08:16:11 +00:00
EnMu header and pointer fixes (#765)
* Commit Before Draw Decomp * Closer EnMu_Draw * Matched draw function * EnMu Matching with OK * Removed ASM * EnMu OK * Implemented pull request changes as of 2020/03/16 * Reverted header * Split increment and switched 0s to NULLs * Fixed compiler warnings * EnMu pointer fixes * Apply suggestions from code review Co-authored-by: louist103 <35883445+louist103@users.noreply.github.com> * Changed line breaks and dialogState to npcInfo Co-authored-by: louist103 <35883445+louist103@users.noreply.github.com>
This commit is contained in:
parent
25dd8e54dc
commit
3432a7d4b3
2 changed files with 21 additions and 12 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
/*
|
||||||
|
* File: z_en_mu.c
|
||||||
|
* Overlay: ovl_En_Mu
|
||||||
|
* Description: Haggling townspeople
|
||||||
|
*/
|
||||||
|
|
||||||
#include "z_en_mu.h"
|
#include "z_en_mu.h"
|
||||||
|
|
||||||
#define FLAGS 0x00000009
|
#define FLAGS 0x00000009
|
||||||
|
@ -9,8 +15,8 @@ void EnMu_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||||
void EnMu_Update(Actor* thisx, GlobalContext* globalCtx);
|
void EnMu_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||||
void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx);
|
void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||||
|
|
||||||
void EnMu_Pose(Actor* this, GlobalContext* globalCtx);
|
void EnMu_Pose(EnMu* this, GlobalContext* globalCtx);
|
||||||
s32 EnMu_CheckDialogState(GlobalContext* globalCtx, EnMu* this);
|
s16 EnMu_CheckDialogState(GlobalContext* globalCtx, Actor* thisx);
|
||||||
|
|
||||||
extern AnimationHeader D_060003F4;
|
extern AnimationHeader D_060003F4;
|
||||||
extern FlexSkeletonHeader D_06004F70;
|
extern FlexSkeletonHeader D_06004F70;
|
||||||
|
@ -102,7 +108,9 @@ u16 EnMu_GetFaceReaction(GlobalContext* globalCtx, Actor* thisx) {
|
||||||
return this->defFaceReaction;
|
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)) {
|
switch (func_8010BDBC(&globalCtx->msgCtx)) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -123,8 +131,8 @@ s32 EnMu_CheckDialogState(GlobalContext* globalCtx, EnMu* this) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnMu_Init(Actor* thisx, GlobalContext* globalCtx) {
|
void EnMu_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
s32 pad;
|
|
||||||
EnMu* this = THIS;
|
EnMu* this = THIS;
|
||||||
|
s32 pad;
|
||||||
|
|
||||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 160.0f);
|
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 160.0f);
|
||||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_06004F70, &D_060003F4, NULL, NULL, 0);
|
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) {
|
void EnMu_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
EnMu* this = THIS;
|
EnMu* this = THIS;
|
||||||
|
|
||||||
SkelAnime_Free(&this->skelAnime, globalCtx);
|
SkelAnime_Free(&this->skelAnime, globalCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnMu_Pose(Actor* thisx, GlobalContext* globalCtx) {
|
void EnMu_Pose(EnMu* this, GlobalContext* globalCtx) {
|
||||||
EnMu* this = THIS;
|
func_80034F54(globalCtx, this->unk_20A, this->unk_22A, 16);
|
||||||
func_80034F54(globalCtx, &this->unk_20A, &this->unk_22A, 16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) {
|
void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
|
@ -159,12 +167,13 @@ void EnMu_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
|
|
||||||
this->collider.dim.pos = pos;
|
this->collider.dim.pos = pos;
|
||||||
|
|
||||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider);
|
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||||
SkelAnime_Update(&this->skelAnime);
|
SkelAnime_Update(&this->skelAnime);
|
||||||
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4);
|
||||||
this->actionFunc(this, globalCtx);
|
this->actionFunc(this, globalCtx);
|
||||||
talkDist = this->collider.dim.radius + 30.0f;
|
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 = this->actor.world.pos;
|
||||||
this->actor.focus.pos.y += 60.0f;
|
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) {
|
s32 EnMu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
|
||||||
EnMu* this = THIS;
|
EnMu* this = THIS;
|
||||||
|
|
||||||
if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 12) ||
|
if ((limbIndex == 5) || (limbIndex == 6) || (limbIndex == 7) || (limbIndex == 11) || (limbIndex == 12) ||
|
||||||
(limbIndex == 13) || (limbIndex == 14)) {
|
(limbIndex == 13) || (limbIndex == 14)) {
|
||||||
rot->y += Math_SinS(this->unk_20A[limbIndex]) * 200.0f;
|
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* EnMu_DisplayListSetColor(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b, u8 a) {
|
||||||
Gfx* dlist;
|
Gfx* dlist;
|
||||||
|
|
||||||
dlist = Graph_Alloc(gfxCtx, 2 * sizeof(Gfx));
|
dlist = Graph_Alloc(gfxCtx, 2 * sizeof(Gfx));
|
||||||
gDPSetEnvColor(dlist, r, g, b, a);
|
gDPSetEnvColor(dlist, r, g, b, a);
|
||||||
gSPEndDisplayList(dlist + 1);
|
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) {
|
void EnMu_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||||
EnMu* this = THIS;
|
EnMu* this = THIS;
|
||||||
|
|
||||||
// 2 sets of 5 colors for each actor in town with different colors
|
|
||||||
Color_RGBA8 colors[2][5] = {
|
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 } },
|
{ { 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 } }
|
{ { 140, 70, 20, 0 }, { 30, 240, 200, 0 }, { 90, 60, 20, 0 }, { 160, 250, 60, 0 }, { 100, 130, 235, 0 } }
|
||||||
|
|
|
@ -13,7 +13,7 @@ typedef struct EnMu {
|
||||||
/* 0x014C */ SkelAnime skelAnime;
|
/* 0x014C */ SkelAnime skelAnime;
|
||||||
/* 0x0190 */ EnMuActionFunc actionFunc;
|
/* 0x0190 */ EnMuActionFunc actionFunc;
|
||||||
/* 0x0194 */ ColliderCylinder collider;
|
/* 0x0194 */ ColliderCylinder collider;
|
||||||
/* 0x01E0 */ struct_80034A14_arg1 dialogState;
|
/* 0x01E0 */ struct_80034A14_arg1 npcInfo;
|
||||||
/* 0x0208 */ u16 defFaceReaction;
|
/* 0x0208 */ u16 defFaceReaction;
|
||||||
/* 0x020A */ s16 unk_20A[16];
|
/* 0x020A */ s16 unk_20A[16];
|
||||||
/* 0x022A */ s16 unk_22A[17];
|
/* 0x022A */ s16 unk_22A[17];
|
||||||
|
|
Loading…
Reference in a new issue