From c377ffe4ac629c44d5d3a7976ca1d4ee76b9fde8 Mon Sep 17 00:00:00 2001 From: kyleburnette Date: Fri, 30 Apr 2021 21:42:16 -0700 Subject: [PATCH] en_bu OK (#96) * en_bu OK * renamed action func * made the char array in the header of type UNK_TYPE1 * renamed display list pointer as suggested --- linker_scripts/code_script.txt | 4 +-- src/overlays/actors/ovl_En_Bu/z_en_bu.c | 39 ++++++++++++++++++++----- src/overlays/actors/ovl_En_Bu/z_en_bu.h | 6 +++- tables/functions.txt | 2 +- 4 files changed, 40 insertions(+), 11 deletions(-) diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index 73bdb88021..51c51ac70a 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -3649,9 +3649,9 @@ SECTIONS ovl_En_Bu : AT(RomLocation) { build/src/overlays/actors/ovl_En_Bu/z_en_bu.o(.text) - build/asm/overlays/ovl_En_Bu_data.o(.data) + build/src/overlays/actors/ovl_En_Bu/z_en_bu.o(.data) build/src/overlays/actors/ovl_En_Bu/z_en_bu.o(.rodata) - build/asm/overlays/ovl_En_Bu_rodata.o(.rodata) + build/src/overlays/actors/ovl_En_Bu/z_en_bu_overlay.o(.ovl) } SegmentEnd = .; SegmentSize = SegmentEnd - SegmentStart; diff --git a/src/overlays/actors/ovl_En_Bu/z_en_bu.c b/src/overlays/actors/ovl_En_Bu/z_en_bu.c index 63c4d14bea..f727da5330 100644 --- a/src/overlays/actors/ovl_En_Bu/z_en_bu.c +++ b/src/overlays/actors/ovl_En_Bu/z_en_bu.c @@ -9,7 +9,8 @@ void EnBu_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnBu_Update(Actor* thisx, GlobalContext* globalCtx); void EnBu_Draw(Actor* thisx, GlobalContext* globalCtx); -/* +void EnBu_DoNothing(EnBu* this, GlobalContext* globalCtx); + const ActorInit En_Bu_InitVars = { ACTOR_EN_BU, ACTORCAT_ENEMY, @@ -21,14 +22,38 @@ const ActorInit En_Bu_InitVars = { (ActorFunc)EnBu_Update, (ActorFunc)EnBu_Draw }; -*/ -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Bu_0x809ACD90/EnBu_Init.asm") +void EnBu_Init(Actor* thisx, GlobalContext* globalCtx) { + EnBu* this = THIS; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Bu_0x809ACD90/EnBu_Destroy.asm") + this->actionFunc = EnBu_DoNothing; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Bu_0x809ACD90/func_809ACDB8.asm") +void EnBu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Bu_0x809ACD90/EnBu_Update.asm") +void EnBu_DoNothing(EnBu* this, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Bu_0x809ACD90/EnBu_Draw.asm") +void EnBu_Update(Actor* thisx, GlobalContext* globalCtx) { + EnBu* this = THIS; + + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + this->actionFunc(this, globalCtx); +} + +void EnBu_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnBu* this = THIS; + + OPEN_DISPS(globalCtx->state.gfxCtx); + + SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0); + SysMatrix_InsertZRotation_s(this->actor.shape.rot.z, 1); + Matrix_RotateY(this->actor.shape.rot.y, 1); + SysMatrix_InsertXRotation_s(this->actor.shape.rot.x, 1); + Matrix_Scale(0.01f, 0.01f, 0.01f, 1); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_OPA_DISP++, this->displayListPtr); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Bu/z_en_bu.h b/src/overlays/actors/ovl_En_Bu/z_en_bu.h index 9d5eeb3591..256f44720d 100644 --- a/src/overlays/actors/ovl_En_Bu/z_en_bu.h +++ b/src/overlays/actors/ovl_En_Bu/z_en_bu.h @@ -5,9 +5,13 @@ struct EnBu; +typedef void (*EnBuActionFunc)(struct EnBu*, GlobalContext*); + typedef struct EnBu { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4C]; + /* 0x144 */ EnBuActionFunc actionFunc; + /* 0x148 */ UNK_TYPE1 unk148[0x44]; + /* 0x18C */ Gfx* displayListPtr; } EnBu; // size = 0x190 extern const ActorInit En_Bu_InitVars; diff --git a/tables/functions.txt b/tables/functions.txt index b7c5e1906b..7cb710d963 100644 --- a/tables/functions.txt +++ b/tables/functions.txt @@ -8846,7 +8846,7 @@ 0x809ACB28:("func_809ACB28",), 0x809ACD90:("EnBu_Init",), 0x809ACDA8:("EnBu_Destroy",), - 0x809ACDB8:("func_809ACDB8",), + 0x809ACDB8:("EnBu_DoNothing",), 0x809ACDC8:("EnBu_Update",), 0x809ACE00:("EnBu_Draw",), 0x809ACF40:("EnEncount3_Init",),