diff --git a/include/functions.h b/include/functions.h index 6afe3cc476..42ff3f747c 100644 --- a/include/functions.h +++ b/include/functions.h @@ -766,8 +766,8 @@ void func_800B748C(void); // func_800B748C void func_800B750C(void); // func_800B750C void func_800B75A0(void); // func_800B75A0 void func_800B761C(void); // func_800B761C -void func_800B7678(void); // func_800B7678 -void func_800B78B8(GlobalContext* ctxt, Actor* iParm2, f32 uParm3, f32 uParm4, f32 param_5, u32 param_6); // func_800B78B8 +UNK_TYPE4 func_800B7678(GlobalContext* ctxt, Actor* param_2, int param_3, unsigned int param_4); // func_800B7678 +void func_800B78B8(GlobalContext* ctxt, Actor* actor, f32 uParm3, f32 uParm4, f32 param_5, u32 param_6); // func_800B78B8 void func_800B7E04(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // func_800B7E04 s32 func_800B7FE0(f32* param_1, f32* param_2, f32* param_3, GraphicsContext* gCtxt); // func_800B7FE0 void func_800B8018(void); // func_800B8018 @@ -1020,7 +1020,7 @@ void BgCheck_VerticesListAlloc(GlobalContext* ctxt, BgVertex** vertices, u32 num void BgCheck_WaterboxListInit(BgWaterboxList* waterboxList); // func_800C5F8C void BgCheck_WaterboxListAlloc(GlobalContext* ctxt, BgWaterboxList* waterboxList, u32 numWaterboxes); // func_800C5F9C void BgCheck_ActorMeshUpdateParams(GlobalContext* ctxt, ActorMesh* mesh); // func_800C5FD8 -s32 BcCheck_IsActorMeshIndexValid(s32 index); // func_800C6024 +s32 BgCheck_IsActorMeshIndexValid(s32 index); // func_800C6024 void BgCheck_DynaInit(GlobalContext* ctxt, BgDynaCollision* param_2); // func_800C6044 void BgCheck_DynaAlloc(GlobalContext* ctxt, BgDynaCollision* dyna); // func_800C6098 s32 BgCheck_AddActorMesh(GlobalContext* ctxt, BgDynaCollision* dyna, BgActor* actor, BgMeshHeader* header); // func_800C6188 @@ -1052,7 +1052,7 @@ void func_800C90AC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_ void func_800C921C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7, UNK_TYPE4 param_8); // func_800C921C void func_800C9380(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE2 param_8); // func_800C9380 void BgCheck_RelocateMeshHeaderPointers(BgMeshHeader* header); // func_800C94E0 -void BgCheck_RelocateMeshHeader(u32 meshSegPtr, BgMeshHeader** param_2); // func_800C9564 +void BgCheck_RelocateMeshHeader(BgMeshHeader* meshSegPtr, BgMeshHeader** param_2); // func_800C9564 void BgCheck_RelocateAllMeshHeaders(BgCheckContext* bgCtxt, GlobalContext* ctxt); // func_800C9598 void func_800C9640(void); // func_800C9640 u32 BgCheck_GetPolygonAttributes(BgCheckContext* bgCtxt, BgPolygon* polygon, s32 index, s32 attributeIndex); // func_800C9694 @@ -1101,25 +1101,25 @@ void func_800CA6D8(void); // func_800CA6D8 void func_800CA6F0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); // func_800CA6F0 void func_800CA9D0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); // func_800CA9D0 void func_800CAA14(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // func_800CAA14 -void func_800CAAD0(int iParm1, int iParm2, int iParm3); // func_800CAAD0 -void func_800CAC0C(void); // func_800CAC0C -void func_800CACA0(void); // func_800CACA0 -void func_800CAD2C(void); // func_800CAD2C -void BcCheck_BgActorInit(BgActor* actor, UNK_TYPE4 param_2); // func_800CAE10 -void func_800CAE34(void); // func_800CAE34 -void func_800CAE7C(void); // func_800CAE7C -void func_800CAE88(void); // func_800CAE88 -void func_800CAE9C(void); // func_800CAE9C +void BgCheck2_UpdateActorPosition(BgCheckContext* bgCtxt, s32 index, Actor* actor); // func_800CAAD0 +void BgCheck2_UpdateActorYRotation(BgCheckContext* bgCtxt, s32 index, Actor* actor); // func_800CAC0C +void BgCheck2_AttachToMesh(BgCheckContext* bgCtxt, Actor* actor, s32 index); // func_800CACA0 +u32 BgCheck2_UpdateActorAttachedToMesh(BgCheckContext* bgCtxt, s32 index, Actor* actor); // func_800CAD2C +void BcCheck3_BgActorInit(BgActor* actor, UNK_TYPE4 param_2); // func_800CAE10 +void BgCheck3_LoadMesh(GlobalContext* ctxt, BgActor* actor, BgMeshHeader* meshHeader); // func_800CAE34 +void func_800CAE7C(BgActor* actor); // func_800CAE7C +void func_800CAE88(BgActor* actor); // func_800CAE88 +void func_800CAE9C(BgActor* actor); // func_800CAE9C void func_800CAEB0(void); // func_800CAEB0 -void func_800CAEE0(void); // func_800CAEE0 +void func_800CAEE0(BgActor* actor); // func_800CAEE0 void func_800CAEF4(void); // func_800CAEF4 -void func_800CAF24(void); // func_800CAF24 -void func_800CAF38(void); // func_800CAF38 -void func_800CAF4C(void); // func_800CAF4C -void func_800CAF70(void); // func_800CAF70 -void func_800CAF94(void); // func_800CAF94 -void func_800CAFB8(void); // func_800CAFB8 -void func_800CAFDC(void); // func_800CAFDC +void func_800CAF24(BgActor* actor); // func_800CAF24 +void func_800CAF38(BgActor* actor); // func_800CAF38 +s32 func_800CAF4C(BgActor* actor); // func_800CAF4C +s32 func_800CAF70(BgActor* actor); // func_800CAF70 +s32 func_800CAF94(BgActor* actor); // func_800CAF94 +s32 func_800CAFB8(BgActor* actor); // func_800CAFB8 +s32 func_800CAFDC(BgActor* actor); // func_800CAFDC void func_800CB000(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); // func_800CB000 void func_800CB210(void); // func_800CB210 void func_800CB240(void); // func_800CB240 @@ -1803,8 +1803,8 @@ f32 Lib_sin(s16 angle); // func_800FED84 s32 Lib_StepTowardsGet_i(s32 start, s32 value, s32 step); // func_800FEDC4 void Lib_StepTowards_i(s32* start, s32 value, s32 step); // func_800FEE08 s32 Lib_StepTowardsCheck_i(s32* start, s32 value, s32 step); // func_800FEE34 -s32 Lib_StepTowardsCheckFramerateScaled_s(s16* start, s16 taret, s16 step); // func_800FEE70 -s32 Lib_StepTowardsCheck_s(s16* start, s16 taret, s16 step); // func_800FEF2C +s32 Lib_StepTowardsCheckFramerateScaled_s(s16* start, s16 target, s16 step); // func_800FEE70 +s32 Lib_StepTowardsCheck_s(s16* start, s16 target, s16 step); // func_800FEF2C s32 Lib_StepTowardsCheck_c(s8* start, s8 target, s8 step); // func_800FEFB4 s32 Lib_StepTowardsCheck_f(f32* start, f32 target, f32 step); // func_800FF03C void func_800FF0D0(void); // func_800FF0D0 @@ -1836,18 +1836,18 @@ f32 Lib_PushAwayXZVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproac f32 Lib_DistanceYVec3f(Vector3f* a, Vector3f* b); // func_800FFA4C s32 Lib_YawVec3f(Vector3f* from, Vector3f* to); // func_800FFA60 s32 Lib_PitchVec3f(Vector3f* from, Vector3f* to); // func_800FFA94 -void Lib_ApplyActorInitVars(Actor* uParm1, ActorInitVar* puParm2); // func_800FFADC -void Lib_ApplyActorInitVarByte1(u8* iParm1, ActorInitVar* puParm2); // func_800FFB54 -void Lib_ApplyActorInitVarByte2(u8* iParm1, ActorInitVar* puParm2); // func_800FFB70 -void Lib_ApplyActorInitVarShort1(u8* iParm1, ActorInitVar* puParm2); // func_800FFB8C -void Lib_ApplyActorInitVarShort2(u8* iParm1, ActorInitVar* puParm2); // func_800FFBA8 -void Lib_ApplyActorInitVarWord1(u8* iParm1, ActorInitVar* puParm2); // func_800FFBC4 -void Lib_ApplyActorInitVarWord2(u8* iParm1, ActorInitVar* puParm2); // func_800FFBE0 -void Lib_ApplyActorInitVarFloat(u8* iParm1, ActorInitVar* puParm2); // func_800FFBFC -void Lib_ApplyActorInitVarFloat1000th(u8* iParm1, ActorInitVar* puParm2); // func_800FFC20 -void Lib_ApplyActorInitVarVector3f(u8* iParm1, ActorInitVar* puParm2); // func_800FFC50 -void Lib_ApplyActorInitVarVector3f1000th(u8* iParm1, ActorInitVar* puParm2); // func_800FFC7C -void Lib_ApplyActorInitVarVector3s(u8* iParm1, ActorInitVar* puParm2); // func_800FFCB4 +void Lib_ApplyActorInitVars(Actor* actor, ActorInitVar* init); // func_800FFADC +void Lib_ApplyActorInitVarByte1(u8* actor, ActorInitVar* init); // func_800FFB54 +void Lib_ApplyActorInitVarByte2(u8* actor, ActorInitVar* init); // func_800FFB70 +void Lib_ApplyActorInitVarShort1(u8* actor, ActorInitVar* init); // func_800FFB8C +void Lib_ApplyActorInitVarShort2(u8* actor, ActorInitVar* init); // func_800FFBA8 +void Lib_ApplyActorInitVarWord1(u8* actor, ActorInitVar* init); // func_800FFBC4 +void Lib_ApplyActorInitVarWord2(u8* actor, ActorInitVar* init); // func_800FFBE0 +void Lib_ApplyActorInitVarFloat(u8* actor, ActorInitVar* init); // func_800FFBFC +void Lib_ApplyActorInitVarFloat1000th(u8* actor, ActorInitVar* init); // func_800FFC20 +void Lib_ApplyActorInitVarVector3f(u8* actor, ActorInitVar* init); // func_800FFC50 +void Lib_ApplyActorInitVarVector3f1000th(u8* actor, ActorInitVar* init); // func_800FFC7C +void Lib_ApplyActorInitVarVector3s(u8* actor, ActorInitVar* init); // func_800FFCB4 f32 func_800FFCD8(f32* a0, f32 a1, f32 a2, f32 a3, f32 a4); // func_800FFCD8 void Lib_ScaleMax_f(f32* start, f32 target, f32 scale, f32 maxStep); // func_800FFDF8 void Lib_Scale_f(f32* start, f32 scale, f32 maxStep); // func_800FFE68 @@ -2613,7 +2613,7 @@ void Matrix_Multiply(z_Matrix* l, z_Matrix* r, z_Matrix* dst); // func_80138D38 void Matrix_GetIdentity(z_Matrix** puParm1); // func_80139094 void Matrix_MakeIdentity(z_Matrix* matrix); // func_801390A8 void Matrix_Copy(z_Matrix* src, z_Matrix* dst); // func_80139100 -void func_80139188(void); // func_80139188 +s32 invert_matrix(z_Matrix* matrix, z_Matrix* invert); // func_80139188 void Matrix_MakeScale(z_Matrix* matrix, f32 x, f32 y, f32 z); // func_80139428 void Matrix_MakeRotationZYX(z_Matrix* matrix, s16 xRotation, s16 yRotation, s16 zRotation); // func_8013948C void Matrix_MakeRotationYXZ(z_Matrix* matrix, s16 xRotation, s16 yRotation, s16 zRotation); // func_8013961C diff --git a/include/structs.h b/include/structs.h index bca93917b2..1df7492c16 100644 --- a/include/structs.h +++ b/include/structs.h @@ -1581,7 +1581,7 @@ struct LoadedParticleEntry { /* 0x0C */ Vector3f velocity; /* 0x18 */ Vector3f acceleration; /* 0x24 */ effect_func update; -/* 0x28 */ global_context_func draw; +/* 0x28 */ effect_func draw; /* 0x2C */ Vector3f unk2C; /* 0x38 */ u32 displayList; /* 0x3C */ UNK_TYPE4 unk3C; @@ -2001,7 +2001,9 @@ struct Actor { /* 0x070 */ f32 speed; /* 0x074 */ f32 gravity; /* 0x078 */ f32 minYVelocity; -/* 0x07C */ UNK_TYPE1 pad7C[12]; +/* 0x07C */ UNK_TYPE1 pad7C[9]; +/* 0x085 */ u8 meshAttachedTo; +/* 0x086 */ UNK_TYPE1 pad86[2]; /* 0x088 */ f32 unk88; /* 0x08C */ f32 unk8C; /* 0x090 */ u16 unk90; @@ -2146,7 +2148,9 @@ struct ActorPlayer { /* 0x000 */ Actor base; /* 0x144 */ UNK_TYPE1 pad144[3]; /* 0x147 */ s8 unk147; -/* 0x148 */ UNK_TYPE1 pad148[2454]; +/* 0x148 */ UNK_TYPE1 pad148[2444]; +/* 0xAD4 */ s16 unkAD4; +/* 0xAD6 */ UNK_TYPE1 padAD6[8]; /* 0xADE */ u8 unkADE; /* 0xADF */ UNK_TYPE1 padADF[4]; /* 0xAE3 */ s8 unkAE3; @@ -2159,8 +2163,11 @@ struct ActorPlayer { struct BgActor { /* 0x000 */ Actor base; -/* 0x144 */ s32 unk144; -/* 0x148 */ UNK_TYPE1 pad148[20]; +/* 0x144 */ s32 bgActorId; +/* 0x148 */ UNK_TYPE1 pad148[12]; +/* 0x154 */ u32 unk154; +/* 0x158 */ u8 bgFlags; +/* 0x159 */ UNK_TYPE1 pad159[3]; }; struct ActorBgIknvObj { diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index 0187344eb9..48992a3084 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -213,7 +213,7 @@ SECTIONS build/src/code/z_actor.o(.text) build/asm/code_0x800BF9A0.o(.text) build/asm/z_bgcheck.o(.text) - build/asm/code_0x800CAAD0.o(.text) + build/src/code/code_0x800CAAD0.o(.text) build/asm/code_0x800CAE10.o(.text) build/asm/z_camera.o(.text) build/src/code/code_0x800E03A0.o(.text) diff --git a/src/code/code_0x800A5AC0.c b/src/code/code_0x800A5AC0.c index ae76b71d90..801763c668 100644 --- a/src/code/code_0x800A5AC0.c +++ b/src/code/code_0x800A5AC0.c @@ -1,53 +1,51 @@ #include #include -// TODO this file looks like an actor, it should be cleaned up as such +// This file is most likely z_en_a_obj.c -// This file is most likely En_A_Obj - -UNK_RET EnAObj_Init(ActorEnAObj* a0, GlobalContext* a1) { - ActorEnAObj* s0 = (ActorEnAObj*)a0; +void EnAObj_Init(ActorEnAObj* this, GlobalContext* ctxt) { + ActorEnAObj* s0 = (ActorEnAObj*)this; s0->base.textId = ((s0->base.variable >> 8) & 0xFF) | 0x300; s0->base.variable = (s0->base.variable & 0xFF) - 9; Lib_ApplyActorInitVars((Actor*)s0, (ActorInitVar*)&enAObjInitVar); Actor_SetPostDrawParams(&s0->base.postDrawParams, 0, (actor_post_draw_func*)func_800B3FC0, 12); - Collision_InitCylinder(a1, &s0->collision, (Actor*)s0, &enAObjCylinderInit); + Collision_InitCylinder(ctxt, &s0->collision, (Actor*)s0, &enAObjCylinderInit); Collision_CylinderMoveToActor((Actor*)s0, &s0->collision); s0->base.unkA0.unk16 = 255; s0->update = (actor_func)EnAObj_Update1; } -UNK_RET EnAObj_Fini(ActorEnAObj* a0, GlobalContext* a1) { - ColCylinder* a2 = &a0->collision; - Collision_FiniCylinder(a1, a2); +void EnAObj_Fini(ActorEnAObj* this, GlobalContext* ctxt) { + ColCylinder* a2 = &this->collision; + Collision_FiniCylinder(ctxt, a2); } -UNK_RET EnAObj_Update1(ActorEnAObj* a0, GlobalContext* a1) { +void EnAObj_Update1(ActorEnAObj* this, GlobalContext* ctxt) { s16 v0; s32 v1; - if (func_800B84D0((Actor*)a0, a1) != 0) { - a0->update = (actor_func)EnAObj_Update2; + if (func_800B84D0((Actor*)this, ctxt) != 0) { + this->update = (actor_func)EnAObj_Update2; } else { - v0 = a0->base.unk92 - a0->base.postDrawParams.rotation.y; + v0 = this->base.unk92 - this->base.postDrawParams.rotation.y; v1 = (v0 < 0)? -v0 : v0; - if ((v1 < 10240) || ((a0->base.variable == 1) && (v1 > 22528))) { - func_800B863C((Actor*)a0, a1); + if ((v1 < 10240) || ((this->base.variable == 1) && (v1 > 22528))) { + func_800B863C((Actor*)this, ctxt); } } } -UNK_RET EnAObj_Update2(ActorEnAObj* a0, GlobalContext* a1) { - if (func_800B867C((Actor*)a0, a1) != 0) { - a0->update = (actor_func)EnAObj_Update1; +void EnAObj_Update2(ActorEnAObj* this, GlobalContext* ctxt) { + if (func_800B867C((Actor*)this, ctxt) != 0) { + this->update = (actor_func)EnAObj_Update1; } } -UNK_RET EnAObj_Main(ActorEnAObj* a0, GlobalContext* a1) { - (a0->update)((Actor*)a0, (GlobalContext*)a1); - func_800B675C((Actor*)a0, 45.0f); - Collision_AddOT(a1, &a1->collisionContext, (ColCommon*)&a0->collision); +void EnAObj_Main(ActorEnAObj* this, GlobalContext* ctxt) { + (this->update)((Actor*)this, (GlobalContext*)ctxt); + func_800B675C((Actor*)this, 45.0f); + Collision_AddOT(ctxt, &ctxt->collisionContext, (ColCommon*)&this->collision); } -UNK_RET EnAObj_Draw(ActorEnAObj* a0, GlobalContext* a1) { - func_800BDFC0(a1, enAObjDisplayLists[a0->base.variable]); +void EnAObj_Draw(ActorEnAObj* this, GlobalContext* ctxt) { + func_800BDFC0(ctxt, enAObjDisplayLists[this->base.variable]); } diff --git a/src/code/code_0x800BF9A0.c b/src/code/code_0x800BF9A0.c index a1edaf92bd..31294e559d 100644 --- a/src/code/code_0x800BF9A0.c +++ b/src/code/code_0x800BF9A0.c @@ -1,10 +1,10 @@ #include #include -UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) { +void func_800BF9A0(s32 a0, s32 a1) { s32 i; ActorOverlayTableEntry* s0; - UNK_TYPE v1; + s32 v1; func_8008439C(-2, 0); func_800847CC(D_801DCBB0, D_801B4610); @@ -17,12 +17,12 @@ UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) { } } -UNK_TYPE func_800BFA78(UNK_TYPE a0, UNK_TYPE a1) { +s32 func_800BFA78(s32 a0, s32 a1) { s32 i; ActorOverlayTableEntry* v0 = &actorOverlayTable[0]; - UNK_TYPE t1; - UNK_TYPE a2; - UNK_TYPE a0_2 = a0; + s32 t1; + s32 a2; + s32 a0_2 = a0; for (i = 0; i < D_801B4610; i++, v0++) { t1 = v0->vramStart - v0->ramAddr; @@ -39,13 +39,13 @@ UNK_TYPE func_800BFA78(UNK_TYPE a0, UNK_TYPE a1) { return 0; } -UNK_RET func_800BFAE8(UNK_ARGS) { +void func_800BFAE8(void) { D_801B4610 = 690; func_800819F0(&D_801ED930, (u32)func_800BF9A0, 0, 0); func_80081BCC(&D_801ED940, (u32)func_800BFA78, 0); } -UNK_RET func_800BFB40(UNK_ARGS) { +void func_800BFB40(void) { func_80081AD4(&D_801ED930); func_80081CA4(&D_801ED940); D_801B4610 = 0; diff --git a/src/code/code_0x800CAAD0.c b/src/code/code_0x800CAAD0.c new file mode 100644 index 0000000000..544792c375 --- /dev/null +++ b/src/code/code_0x800CAAD0.c @@ -0,0 +1,104 @@ +#include +#include + +// This file comes after z_bgcheck.c and contains functions to manage actors attached to Bg Actors. +// Perhaps it is called something like z_bgcheck_attach.c +// The functions will use the BgCheck2 prefix for now. + +void BgCheck2_UpdateActorPosition(BgCheckContext* bgCtxt, s32 index, Actor* actor) { + z_Matrix prevMatrix; + z_Matrix prevMatrixInv; + z_Matrix currMatrix; + Vector3f newPos; + Vector3f posWithInv; + + if (BgCheck_IsActorMeshIndexValid(index) == 0) return; + + Matrix_MakeTranslationRotationYXZScale(&prevMatrix, + bgCtxt->dyna.actorMeshes[index].prevParams.scale.x, + bgCtxt->dyna.actorMeshes[index].prevParams.scale.y, + bgCtxt->dyna.actorMeshes[index].prevParams.scale.z, + bgCtxt->dyna.actorMeshes[index].prevParams.rotation.x, + bgCtxt->dyna.actorMeshes[index].prevParams.rotation.y, + bgCtxt->dyna.actorMeshes[index].prevParams.rotation.z, + bgCtxt->dyna.actorMeshes[index].prevParams.pos.x, + bgCtxt->dyna.actorMeshes[index].prevParams.pos.y, + bgCtxt->dyna.actorMeshes[index].prevParams.pos.z); + + if (invert_matrix(&prevMatrix, &prevMatrixInv) == 2) return; + + Matrix_MakeTranslationRotationYXZScale(&currMatrix, + bgCtxt->dyna.actorMeshes[index].currParams.scale.x, + bgCtxt->dyna.actorMeshes[index].currParams.scale.y, + bgCtxt->dyna.actorMeshes[index].currParams.scale.z, + bgCtxt->dyna.actorMeshes[index].currParams.rotation.x, + bgCtxt->dyna.actorMeshes[index].currParams.rotation.y, + bgCtxt->dyna.actorMeshes[index].currParams.rotation.z, + bgCtxt->dyna.actorMeshes[index].currParams.pos.x, + bgCtxt->dyna.actorMeshes[index].currParams.pos.y, + bgCtxt->dyna.actorMeshes[index].currParams.pos.z); + + Matrix_MultiplyByVectorXYZ(&prevMatrixInv, &actor->unk24.pos, &posWithInv); + Matrix_MultiplyByVectorXYZ(&currMatrix, &posWithInv, &newPos); + + actor->unk24.pos = newPos; +} + +void BgCheck2_UpdateActorYRotation(BgCheckContext* bgCtxt, s32 index, Actor* actor) { + s16 angleChange; + + if (BgCheck_IsActorMeshIndexValid(index) == 0) return; + + angleChange = bgCtxt->dyna.actorMeshes[index].currParams.rotation.y - bgCtxt->dyna.actorMeshes[index].prevParams.rotation.y; + + if (actor->id == 0) { + ((ActorPlayer*)actor)->unkAD4 += angleChange; + } + + actor->postDrawParams.rotation.y += angleChange; + actor->unk24.rot.y += angleChange; +} + +void BgCheck2_AttachToMesh(BgCheckContext* bgCtxt, Actor* actor, s32 index) { + BgActor *meshActor; + + if (BgCheck_IsActorMeshIndexValid(index) == 0) return; + + meshActor = BgCheck_GetActorOfMesh(bgCtxt,index); + if (meshActor != NULL) { + func_800CAE88(meshActor); + + if ((actor->flags & 0x4000000) == 0x4000000) { + func_800CAF24(meshActor); + } + if ((actor->flags & 0x20000) == 0x20000) { + func_800CAF38(meshActor); + } + } +} + +u32 BgCheck2_UpdateActorAttachedToMesh(BgCheckContext* bgCtxt, s32 index, Actor* actor) { + u32 wasUpdated = 0; + BgActor *meshActor; + + if (BgCheck_IsActorMeshIndexValid(index) == 0) return 0; + + if (((bgCtxt->dyna.meshParams[index] & 2) != 0) || ((bgCtxt->dyna.meshParams[index] & 1) == 0)) return 0; + + meshActor = BgCheck_GetActorOfMesh(bgCtxt,index); + + if (meshActor == NULL) return 0; + + if ((meshActor->unk154 & 1) != 0) { + BgCheck2_UpdateActorPosition(bgCtxt,index,actor); + wasUpdated = 1; + } + + if ((meshActor->unk154 & 2) != 0) { + BgCheck2_UpdateActorYRotation(bgCtxt,index,actor); + wasUpdated = 1; + } + + return wasUpdated; +} + diff --git a/src/code/code_0x800CAAD0.c.ignore b/src/code/code_0x800CAAD0.c.ignore deleted file mode 100644 index de931d94e1..0000000000 --- a/src/code/code_0x800CAAD0.c.ignore +++ /dev/null @@ -1,99 +0,0 @@ -#include -#include - -UNK_RET func_800CAAD0(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE spD0; - UNK_TYPE sp90; - UNK_TYPE sp50; - UNK_TYPE sp44; - UNK_TYPE sp38; - UNK_TYPE sp24; - - s800CAAD0* v1; - - if (func_800C6024(a1) == 0) return; - - v1 = (s800CAAD0*)(a0 + a1 * 100); - - func_80139894(&spD0, v1->unk68, v1->unk6C, v1->unk70, v1->unk74, v1->unk76, - v1->unk78, v1->unk7C, v1->unk80, v1->unk84); - - if (func_80139188(&spD0, &sp90) == 2) return; - - func_80139894(&sp50, v1->unk88, v1->unk8C, v1->unk90, v1->unk94, v1->unk96, - v1->unk98, v1->unk9C, v1->unkA0, v1->unkA4); - - func_80138C88(&sp90, (UNK_PTR)(a2 + 36), &sp24); - func_80138C88(&sp50, &sp38, &sp44); - - v1->unk0 = *(UNK_TYPE*)((u8*)sp24 + 0); - v1->unk4 = *(UNK_TYPE*)((u8*)sp24 + 4); - v1->unk8 = *(UNK_TYPE*)((u8*)sp24 + 8); -} - -UNK_RET func_800CAC0C(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE v0; - s16 v1; - - if (func_800C6024(a0) == 0) return; - - v0 = a0 + a1 * 100; - - v1 = *(s16*)(v0 + 150) - *(s16*)(v0 + 118); - - if (*(s16*)a2 == 0) { - *(s16*)(a2 + 2772) += v1; - } - - *(s16*)(a2 + 190) += v1; - *(s16*)(a2 + 50) += v1; -} - -UNK_RET func_800CACA0(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE sp1C; - - if (func_800C6024(a2) == 0) return; - - sp1C = func_800C6248(a0, a2); - - if (sp1C == 0) return; - - func_800CAE88(sp1C); - - if ((*(u32*)(a1 + 4) & 0x04000000) == 0x0400) { - func_800CAF24(sp1C); - } - - if ((*(u32*)(a1 + 4) & 0x20000) == 0x20000) { - func_800CAF38(sp1C); - } -} - -UNK_TYPE func_800CAD2C(UNK_TYPE a0, UNK_TYPE a1, UNK_TYPE a2) { - UNK_TYPE v1; - UNK_TYPE sp24 = 0; - - if (func_800C6024(a1) == 0) return; - - if (((*(u16*)(a0 + a1*2 + 5084) & 0x2) != 0) || - ((*(u16*)(a0 + a1*2 + 5084) & 0x1) == 0)) { - return 0; - } - - v1 = func_800C6248(a0, a1); - if (v1 == 0) { - return 0; - } - - if ((*(u32*)(v1 + 340) & 0x1) != 0) { - func_800CAAD0(a0, a1, a2); - sp24 = 1; - } - - if ((*(u32*)(v1 + 340) & 0x2) != 0) { - func_800CAC0C(a0, a1, a2); - sp24 = 1; - } - - return sp24; -} diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 9d7e03dade..f721b864f1 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -219,10 +219,7 @@ GLOBAL_ASM("./asm/nonmatching/z_effect_soft_sprite/EffectSS_LoadParticle.asm") #endif -// XXX regalloc is wrong -#ifdef NONMATCHING - -void EffectSS_UpdateParticle(GlobalContext* ctxt, u32 index) { +void EffectSS_UpdateParticle(GlobalContext* ctxt, s32 index) { LoadedParticleEntry* particle = &EffectSS2Info.data_table[index]; if (particle->update != NULL) { @@ -234,16 +231,10 @@ void EffectSS_UpdateParticle(GlobalContext* ctxt, u32 index) { particle->position.y += particle->velocity.y; particle->position.z += particle->velocity.z; - (*particle->update)(ctxt); + (*particle->update)(ctxt, index, particle); } } -#else - -GLOBAL_ASM("./asm/nonmatching/z_effect_soft_sprite/EffectSS_UpdateParticle.asm") - -#endif - void EffectSS_UpdateAllParticles(GlobalContext* ctxt) { s32 i; @@ -262,22 +253,13 @@ void EffectSS_UpdateAllParticles(GlobalContext* ctxt) { } } -// XXX regalloc is wrong -#ifdef NONMATCHING - void EffectSS_DrawParticle(GlobalContext* ctxt, s32 index) { LoadedParticleEntry* entry = &EffectSS2Info.data_table[index]; if (entry->draw != 0) { - (*entry->draw)(ctxt); + (*entry->draw)(ctxt, index, entry); } } -#else - -GLOBAL_ASM("./asm/nonmatching/z_effect_soft_sprite/EffectSS_DrawParticle.asm") - -#endif - void EffectSS_DrawAllParticles(GlobalContext* ctxt) { LightMapper* s0; s32 i; diff --git a/src/code/z_lib.c b/src/code/z_lib.c index e9eb805eb8..f8124709b5 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -5,10 +5,10 @@ extern float fabsf(float); #pragma intrinsic (fabsf) -void* Lib_bcopy(void* dst, void* src, size_t n) { - _bcopy(src, dst, n); +void* Lib_bcopy(void* dest, void* src, size_t n) { + _bcopy(src, dest, n); - return dst; + return dest; } #ifdef NONMATCHING @@ -36,99 +36,99 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/Lib_memset.asm") #endif -f32 Lib_cos(s16 a0) { - return coss(a0) * D_801DDA80; +f32 Lib_cos(s16 angle) { + return coss(angle) * D_801DDA80; } -f32 Lib_sin(s16 a0) { - return sins(a0) * D_801DDA84; +f32 Lib_sin(s16 angle) { + return sins(angle) * D_801DDA84; } -s32 Lib_StepTowardsGet_i(s32 a0, s32 a1, s32 a2) { +s32 Lib_StepTowardsGet_i(s32 start, s32 value, s32 step) { s32 v1; - if (a1 >= a0) { - v1 = a0 + a2; - if (a1 >= v1) { + if (value >= start) { + v1 = start + step; + if (value >= v1) { return v1; } } else { - v1 = a0 - a2; - if (v1 >= a1) { + v1 = start - step; + if (v1 >= value) { return v1; } } - return a1; + return value; } -void Lib_StepTowards_i(s32* a0, s32 a1, s32 a2) { - *a0 = Lib_StepTowardsGet_i(*a0, a1, a2); +void Lib_StepTowards_i(s32* start, s32 value, s32 step) { + *start = Lib_StepTowardsGet_i(*start, value, step); } -UNK_TYPE Lib_StepTowardsCheck_i(s32* a0, s32 a1, s32 a2) { - Lib_StepTowards_i(a0, a1, a2); +s32 Lib_StepTowardsCheck_i(s32* start, s32 value, s32 step) { + Lib_StepTowards_i(start, value, step); - return a1 == *a0; + return value == *start; } -UNK_TYPE Lib_StepTowardsCheckFramerateScaled_s(s16* a0, s16 a1, s16 a2) { +s32 Lib_StepTowardsCheckFramerateScaled_s(s16* start, s16 target, s16 step) { f32 f0; - if (a2 != 0) { + if (step != 0) { f0 = D_801D1508; - if ((s16)(*a0 - a1) > 0) { - a2 = -a2; + if ((s16)(*start - target) > 0) { + step = -step; } - *a0 += (s16)(a2 * f0); + *start += (s16)(step * f0); - if (((s16)(*a0 - a1) * a2) >= 0) { - *a0 = a1; + if (((s16)(*start - target) * step) >= 0) { + *start = target; return 1; } - } else if (a1 == *a0) { + } else if (target == *start) { return 1; } return 0; } -UNK_TYPE Lib_StepTowardsCheck_s(s16* a0, s16 a1, s16 a2) { - if (a2 != 0) { - if (a1 < *a0) { - a2 = -a2; +s32 Lib_StepTowardsCheck_s(s16* start, s16 target, s16 step) { + if (step != 0) { + if (target < *start) { + step = -step; } - *a0 += a2; + *start += step; - if (((*a0 - a1) * a2) >= 0) { - *a0 = a1; + if (((*start - target) * step) >= 0) { + *start = target; return 1; } - } else if (a1 == *a0) { + } else if (target == *start) { return 1; } return 0; } -UNK_TYPE Lib_StepTowardsCheck_c(s8* a0, s8 a1, s8 a2) { - if (a2 != 0) { - if (a1 < *a0) { - a2 = -a2; +s32 Lib_StepTowardsCheck_c(s8* start, s8 target, s8 step) { + if (step != 0) { + if (target < *start) { + step = -step; } - *a0 += a2; + *start += step; - if (((*a0 - a1) * a2) >= 0) { - *a0 = a1; + if (((*start - target) * step) >= 0) { + *start = target; return 1; } - } else if (a1 == *a0) { + } else if (target == *start) { return 1; } @@ -137,21 +137,21 @@ UNK_TYPE Lib_StepTowardsCheck_c(s8* a0, s8 a1, s8 a2) { #ifdef NONMATCHING -UNK_TYPE Lib_StepTowardsCheck_f(f32* a0, f32 a1, f32 a2) { - if (a2 != 0) { +s32 Lib_StepTowardsCheck_f(f32* start, f32 target, f32 step) { + if (step != 0) { // XXX: regalloc is messed up - if (a1 < *a0) { - a2 = -a2; + if (target < *start) { + step = -step; } - *a0 += a2; + *start += step; - if (((*a0 - a1) * a2) >= 0) { - *a0 = a1; + if (((*start - target) * step) >= 0) { + *start = target; return 1; } - } else if (a1 != *a0) { + } else if (target != *start) { return 1; } @@ -166,7 +166,7 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/Lib_StepTowardsCheck_f.asm") #ifdef NONMATCHING -UNK_TYPE func_800FF0D0(s16* a0, s16 a1, s16 a2) { +s32 func_800FF0D0(s16* a0, s16 a1, s16 a2) { s32 v0 = *a0; // XXX: regalloc is messed up @@ -189,7 +189,7 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/func_800FF0D0.asm") #ifdef NONMATCHING -UNK_RET func_800FF138() { +void func_800FF138() { } @@ -201,7 +201,7 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/func_800FF138.asm") #ifdef NONMATCHING -UNK_RET func_800FF1FC() { +void func_800FF1FC(void) { } @@ -213,7 +213,7 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/func_800FF1FC.asm") #ifdef NONMATCHING -UNK_RET func_800FF2A8() { +void func_800FF2A8(void) { } @@ -225,7 +225,7 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/func_800FF2A8.asm") #ifdef NONMATCHING -UNK_RET func_800FF2F8() { +void func_800FF2F8(void) { } @@ -237,7 +237,7 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/func_800FF2F8.asm") #ifdef NONMATCHING -UNK_RET func_800FF3A0() { +void func_800FF3A0(void) { } @@ -247,156 +247,156 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/func_800FF3A0.asm") #endif -s16 Lib_rand_s(s16 a0, s16 a1) { - return (s16)(randZeroOne() * a1) + a0; +s16 Lib_rand_s(s16 base, s16 range) { + return (s16)(randZeroOne() * range) + base; } -s16 Lib_randStride_s(s16 a0, s16 a1, s16 a2) { - return (s16)(randZeroOne() * a2) * a1 + a0; +s16 Lib_randestride_s(s16 base, s16 stride, s16 range) { + return (s16)(randZeroOne() * range) * stride + base; } -UNK_RET Lib_CopyVec3f(Vector3f* dst, Vector3f* src) { +void Lib_CopyVec3f(Vector3f* dest, Vector3f* src) { f32 x = src->x; f32 y = src->y; f32 z = src->z; - dst->x = x; - dst->y = y; - dst->z = z; + dest->x = x; + dest->y = y; + dest->z = z; } -UNK_RET Lib_CopyVec3s(Vector3s* dst, Vector3s* src) { +void Lib_CopyVec3s(Vector3s* dest, Vector3s* src) { s16 x = src->x; s16 y = src->y; s16 z = src->z; - dst->x = x; - dst->y = y; - dst->z = z; + dest->x = x; + dest->y = y; + dest->z = z; } -UNK_RET Lib_ToVec3f(Vector3f* dst, Vector3s* src) { +void Lib_ToVec3f(Vector3f* dest, Vector3s* src) { f32 x = src->x; f32 y = src->y; f32 z = src->z; - dst->x = x; - dst->y = y; - dst->z = z; + dest->x = x; + dest->y = y; + dest->z = z; } -UNK_RET Lib_ToVec3s(Vector3s* dst, Vector3f* src) { +void Lib_ToVec3s(Vector3s* dest, Vector3f* src) { f32 x = src->x; f32 y = src->y; f32 z = src->z; - dst->x = x; - dst->y = y; - dst->z = z; + dest->x = x; + dest->y = y; + dest->z = z; } -UNK_RET Lib_AddVec3f(Vector3f* a0, Vector3f* a1, Vector3f* a2) { - a2->x = a0->x + a1->x; - a2->y = a0->y + a1->y; - a2->z = a0->z + a1->z; +void Lib_AddVec3f(Vector3f* l, Vector3f* r, Vector3f* dest) { + dest->x = l->x + r->x; + dest->y = l->y + r->y; + dest->z = l->z + r->z; } -UNK_RET Lib_SubVec3f(Vector3f* a0, Vector3f* a1, Vector3f* a2) { - a2->x = a0->x - a1->x; - a2->y = a0->y - a1->y; - a2->z = a0->z - a1->z; +void Lib_SubVec3f(Vector3f* l, Vector3f* r, Vector3f* dest) { + dest->x = l->x - r->x; + dest->y = l->y - r->y; + dest->z = l->z - r->z; } -UNK_RET Lib_SubVec3sToVec3f(Vector3f* a0, Vector3s* a1, Vector3s* a2) { - a0->x = a1->x - a2->x; - a0->y = a1->y - a2->y; - a0->z = a1->z - a2->z; +void Lib_SubVec3sToVec3f(Vector3f* dest, Vector3s* l, Vector3s* r) { + dest->x = l->x - r->x; + dest->y = l->y - r->y; + dest->z = l->z - r->z; } -UNK_RET Lib_ScaleInPlaceVec3f(Vector3f* a0, f32 a1) { - a0->x *= a1; - a0->y *= a1; - a0->z *= a1; +void Lib_ScaleInPlaceVec3f(Vector3f* vec, f32 scale) { + vec->x *= scale; + vec->y *= scale; + vec->z *= scale; } -UNK_RET Lib_ScaleVec3f(Vector3f* a0, f32 a1, Vector3f* a2) { - a2->x = a0->x * a1; - a2->y = a0->y * a1; - a2->z = a0->z * a1; +void Lib_ScaleVec3f(Vector3f* vec, f32 scale, Vector3f* dest) { + dest->x = vec->x * scale; + dest->y = vec->y * scale; + dest->z = vec->z * scale; } -UNK_RET Lib_LerpVec3f(Vector3f* a0, Vector3f* a1, f32 a2, Vector3f* a3) { - a3->x = (a1->x - a0->x) * a2 + a0->x; - a3->y = (a1->y - a0->y) * a2 + a0->y; - a3->z = (a1->z - a0->z) * a2 + a0->z; +void Lib_LerpVec3f(Vector3f* a, Vector3f* b, f32 t, Vector3f* dest) { + dest->x = (b->x - a->x) * t + a->x; + dest->y = (b->y - a->y) * t + a->y; + dest->z = (b->z - a->z) * t + a->z; } -UNK_RET Lib_AddScaledVec3f(Vector3f* a0, Vector3f* a1, f32 a2, Vector3f* a3) { - a3->x = a1->x * a2 + a0->x; - a3->y = a1->y * a2 + a0->y; - a3->z = a1->z * a2 + a0->z; +void Lib_AddScaledVec3f(Vector3f* a, Vector3f* b, f32 scale, Vector3f* dest) { + dest->x = b->x * scale + a->x; + dest->y = b->y * scale + a->y; + dest->z = b->z * scale + a->z; } -UNK_RET Lib_ModifyRandScaled(Vector3f* a0, f32 a1, Vector3f* a2) { - a2->x = randPlusMinusPoint5Scaled(a1) + a0->x; - a2->y = randPlusMinusPoint5Scaled(a1) + a0->y; - a2->z = randPlusMinusPoint5Scaled(a1) + a0->z; +void Lib_ModifyRandScaled(Vector3f* orig, f32 scale, Vector3f* dest) { + dest->x = randPlusMinusPoint5Scaled(scale) + orig->x; + dest->y = randPlusMinusPoint5Scaled(scale) + orig->y; + dest->z = randPlusMinusPoint5Scaled(scale) + orig->z; } -void Lib_ScaledNormalizedDifferenceVec3f(Vector3f* a0, Vector3f* a1, f32 a2, Vector3f* a3) { - f32 f0 = Lib_DistanceAndDifferenceVec3f(a0, a1, a3); +void Lib_ScaledNormalizedDifferenceVec3f(Vector3f* a, Vector3f* b, f32 scale, Vector3f* dest) { + f32 f0 = Lib_DistanceAndDifferenceVec3f(a, b, dest); f32 f2; if (f0 == 0) { return; } - f2 = a2 / f0; + f2 = scale / f0; - a3->x *= f2; - a3->y *= f2; - a3->z *= f2; + dest->x *= f2; + dest->y *= f2; + dest->z *= f2; } -f32 Lib_DistanceVec3f(Vector3f* a0, Vector3f* a1) { +f32 Lib_DistanceVec3f(Vector3f* a, Vector3f* b) { Vector3f sp1C; - Lib_SubVec3f(a1, a0, &sp1C); + Lib_SubVec3f(b, a, &sp1C); return sqrtf((sp1C.x * sp1C.x) + (sp1C.y * sp1C.y) + (sp1C.z * sp1C.z)); } -f32 Lib_DistanceAndDifferenceVec3f(Vector3f* a0, Vector3f* a1, Vector3f* a2) { - Lib_SubVec3f(a1, a0, a2); - return sqrtf((a2->x * a2->x) + (a2->y * a2->y) + (a2->z * a2->z)); +f32 Lib_DistanceAndDifferenceVec3f(Vector3f* a, Vector3f* b, Vector3f* difference) { + Lib_SubVec3f(b, a, difference); + return sqrtf((difference->x * difference->x) + (difference->y * difference->y) + (difference->z * difference->z)); } -f32 Lib_DistanceXZVec3f(Vector3f* a0, Vector3f* a1) { - f32 dx = a1->x - a0->x; - f32 dz = a1->z - a0->z; +f32 Lib_DistanceXZVec3f(Vector3f* a, Vector3f* b) { + f32 dx = b->x - a->x; + f32 dz = b->z - a->z; return sqrtf((dx * dx) + (dz * dz)); } -f32 Lib_DistanceAndDifferenceXZVec3f(Vector3f* a0, Vector3f* a1, f32* a2, f32* a3) { - *a2 = a1->x - a0->x; - *a3 = a1->z - a0->z; - return sqrtf((*a2 * *a2) + (*a3 * *a3)); +f32 Lib_DistanceAndDifferenceXZVec3f(Vector3f* a, Vector3f* b, f32* xDiff, f32* zDiff) { + *xDiff = b->x - a->x; + *zDiff = b->z - a->z; + return sqrtf((*xDiff * *xDiff) + (*zDiff * *zDiff)); } #ifdef NONMATCHING -UNK_RET Lib_PushAwayXZVec3f(Vector3f* a0, Vector3f* a1, f32 a2) { +void Lib_PushAwayXZVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproach) { f32 sp24; f32 sp20; - f32 f0 = Lib_DistanceAndDifferenceXZVec3f(a1, a0, &sp24, &sp20); - f32 f2 = f0 - a2; + f32 f0 = Lib_DistanceAndDifferenceXZVec3f(pusher, start, &sp24, &sp20); + f32 f2 = f0 - distanceToApproach; - if ((f0 >= a2) && (f2 != 0)) { + if ((f0 >= distanceToApproach) && (f2 != 0)) { f2 /= f0; } else { f2 = 0; } - a0->x = a1->x + sp24 * f2; - a0->z = a1->z + sp20 * f2; + start->x = pusher->x + sp24 * f2; + start->z = pusher->z + sp20 * f2; } #else @@ -405,79 +405,79 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/Lib_PushAwayXZVec3f.asm") #endif -f32 Lib_DistanceYVec3f(Vector3f* a0, Vector3f* a1) { - return a1->y - a0->y; +f32 Lib_DistanceYVec3f(Vector3f* a, Vector3f* b) { + return b->y - a->y; } -UNK_TYPE Lib_YawVec3f(Vector3f* a0, Vector3f* a1) { - f32 f14 = a1->x - a0->x; - f32 f12 = a1->z - a0->z; +s32 Lib_YawVec3f(Vector3f* from, Vector3f* to) { + f32 f14 = to->x - from->x; + f32 f12 = to->z - from->z; return atans_flip(f12, f14); } -UNK_TYPE Lib_PitchVec3f(Vector3f* a0, Vector3f* a1) { - return atans_flip(Lib_DistanceXZVec3f(a0, a1), a0->y - a1->y); +s32 Lib_PitchVec3f(Vector3f* from, Vector3f* to) { + return atans_flip(Lib_DistanceXZVec3f(from, to), from->y - to->y); } -void Lib_ApplyActorInitVars(Actor* a0, ActorInitVar* a1) { +void Lib_ApplyActorInitVars(Actor* actor, ActorInitVar* init) { do { - actorInitVarFuncs[a1->type]((u8*)a0, a1); - } while ((a1++)->cont); + actorInitVarFuncs[init->type]((u8*)actor, init); + } while ((init++)->cont); } -UNK_RET Lib_ApplyActorInitVarByte1(u8* a0, ActorInitVar* a1) { - *(u8*)(a0 + a1->offset) = (u8)(a1->value); +void Lib_ApplyActorInitVarByte1(u8* actor, ActorInitVar* init) { + *(u8*)(actor + init->offset) = (u8)(init->value); } -UNK_RET Lib_ApplyActorInitVarByte2(u8* a0, ActorInitVar* a1) { - *(u8*)(a0 + a1->offset) = (u8)(a1->value); +void Lib_ApplyActorInitVarByte2(u8* actor, ActorInitVar* init) { + *(u8*)(actor + init->offset) = (u8)(init->value); } -UNK_RET Lib_ApplyActorInitVarShort1(u8* a0, ActorInitVar* a1) { - *(u16*)(a0 + a1->offset) = (u16)(a1->value); +void Lib_ApplyActorInitVarShort1(u8* actor, ActorInitVar* init) { + *(u16*)(actor + init->offset) = (u16)(init->value); } -UNK_RET Lib_ApplyActorInitVarShort2(u8* a0, ActorInitVar* a1) { - *(u16*)(a0 + a1->offset) = (u16)(a1->value); +void Lib_ApplyActorInitVarShort2(u8* actor, ActorInitVar* init) { + *(u16*)(actor + init->offset) = (u16)(init->value); } -UNK_RET Lib_ApplyActorInitVarWord1(u8* a0, ActorInitVar* a1) { - *(u32*)(a0 + a1->offset) = (u32)(a1->value); +void Lib_ApplyActorInitVarWord1(u8* actor, ActorInitVar* init) { + *(u32*)(actor + init->offset) = (u32)(init->value); } -UNK_RET Lib_ApplyActorInitVarWord2(u8* a0, ActorInitVar* a1) { - *(u32*)(a0 + a1->offset) = (u32)(a1->value); +void Lib_ApplyActorInitVarWord2(u8* actor, ActorInitVar* init) { + *(u32*)(actor + init->offset) = (u32)(init->value); } -UNK_RET Lib_ApplyActorInitVarFloat(u8* a0, ActorInitVar* a1) { - *(f32*)(a0 + a1->offset) = (f32)(a1->value); +void Lib_ApplyActorInitVarFloat(u8* actor, ActorInitVar* init) { + *(f32*)(actor + init->offset) = (f32)(init->value); } -UNK_RET Lib_ApplyActorInitVarFloat1000th(u8* a0, ActorInitVar* a1) { - *(f32*)(a0 + a1->offset) = (f32)(a1->value) / 1000; +void Lib_ApplyActorInitVarFloat1000th(u8* actor, ActorInitVar* init) { + *(f32*)(actor + init->offset) = (f32)(init->value) / 1000; } -UNK_RET Lib_ApplyActorInitVarVector3f(u8* a0, ActorInitVar* a1) { - Vector3f* v0 = (Vector3f*)(a0 + a1->offset); - f32 f0 = (f32)(a1->value); +void Lib_ApplyActorInitVarVector3f(u8* actor, ActorInitVar* init) { + Vector3f* v0 = (Vector3f*)(actor + init->offset); + f32 f0 = (f32)(init->value); v0->z = f0; v0->y = f0; v0->x = f0; } -UNK_RET Lib_ApplyActorInitVarVector3f1000th(u8* a0, ActorInitVar* a1) { - Vector3f* v0 = (Vector3f*)(a0 + a1->offset); - f32 f0 = (f32)(a1->value) / 1000; +void Lib_ApplyActorInitVarVector3f1000th(u8* actor, ActorInitVar* init) { + Vector3f* v0 = (Vector3f*)(actor + init->offset); + f32 f0 = (f32)(init->value) / 1000; v0->z = f0; v0->y = f0; v0->x = f0; } -UNK_RET Lib_ApplyActorInitVarVector3s(u8* a0, ActorInitVar* a1) { - Vector3s* v0 = (Vector3s*)(a0 + a1->offset); - s16 v1 = (s16)(a1->value); +void Lib_ApplyActorInitVarVector3s(u8* actor, ActorInitVar* init) { + Vector3s* v0 = (Vector3s*)(actor + init->offset); + s16 v1 = (s16)(init->value); v0->z = v1; v0->y = v1; @@ -524,37 +524,37 @@ f32 func_800FFCD8(f32* a0, f32 a1, f32 a2, f32 a3, f32 a4) { return fabsf(a1 - *a0); } -void Lib_ScaleMax_f(f32* a0, f32 a1, f32 a2, f32 a3) { +void Lib_ScaleMax_f(f32* start, f32 target, f32 scale, f32 maxStep) { f32 f2; - if (*a0 != a1) { - f2 = (a1 - *a0) * a2; + if (*start != target) { + f2 = (target - *start) * scale; - if (f2 > a3) { - f2 = a3; - } else if (f2 < -a3) { - f2 = -a3; + if (f2 > maxStep) { + f2 = maxStep; + } else if (f2 < -maxStep) { + f2 = -maxStep; } - *a0 += f2; + *start += f2; } } -void Lib_Scale_f(f32* a0, f32 a1, f32 a2) { - f32 f0 = *a0 * a1; +void Lib_Scale_f(f32* start, f32 scale, f32 maxStep) { + f32 f0 = *start * scale; - if (a2 < f0) { - f0 = a2; - } else if (f0 < -a2) { - f0 = -a2; + if (maxStep < f0) { + f0 = maxStep; + } else if (f0 < -maxStep) { + f0 = -maxStep; } - *a0 = *a0 - f0; + *start = *start - f0; } #ifdef NONMATCHING -s16 Lib_ScaleMaxMin_s(s16* a0, s16 a1, s16 a2, s16 a3, s16 a4) { +s32 Lib_ScaleMaxMin_s(s16* start, s16 target, s16 scale, s16 maxStep, s16 minStep) { } @@ -564,60 +564,60 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/Lib_ScaleMaxMin_s.asm") #endif -void Lib_ScaleMax_s(s16* a0, s16 a1, s16 a2, s16 a3) { - s16 v0 = a1 - *a0; - v0 /= a2; +void Lib_ScaleMax_s(s16* start, s16 target, s16 scale, s16 maxStep) { + s16 v0 = target - *start; + v0 /= scale; - if (v0 > a3) { - *a0 += a3; + if (v0 > maxStep) { + *start += maxStep; return; } - if (v0 < -a3) { - *a0 -= a3; + if (v0 < -maxStep) { + *start -= maxStep; return; } - *a0 += v0; + *start += v0; } -UNK_RET Lib_CopyColor(ColorRGBA8* a0, ColorRGBA8* a1) { - a0->red = a1->red; - a0->green = a1->green; - a0->blue = a1->blue; - a0->alpha = a1->alpha; +void Lib_CopyColor(ColorRGBA8* dst, ColorRGBA8* src) { + dst->red = src->red; + dst->green = src->green; + dst->blue = src->blue; + dst->alpha = src->alpha; } -UNK_RET func_801000A4(u16 a0) { +void func_801000A4(u16 a0) { play_sound(a0); } -UNK_RET func_801000CC(u16 a0) { +void func_801000CC(u16 a0) { func_8019F128(a0); } -UNK_RET func_801000F4(UNK_TYPE a0, u16 a1) { +void func_801000F4(s32 a0, u16 a1) { func_8019F1C0(a0, a1); } -void Lib_TranslateAndRotateYVec3f(Vector3f* a0, s16 a1, Vector3f* a2, Vector3f* a3) { +void Lib_TranslateAndRotateYVec3f(Vector3f* translation, s16 rotation, Vector3f* src, Vector3f* dst) { f32 sp1C; f32 f0; - sp1C = Lib_cos(a1); - f0 = Lib_sin(a1); - a3->x = a0->x + (a2->x * sp1C + a2->z * f0); - a3->y = a0->y + a2->y; - a3->z = a0->z + (a2->z * sp1C - a2->x * f0); + sp1C = Lib_cos(rotation); + f0 = Lib_sin(rotation); + dst->x = translation->x + (src->x * sp1C + src->z * f0); + dst->y = translation->y + src->y; + dst->z = translation->z + (src->z * sp1C - src->x * f0); } #ifdef NONMATCHING -void Lib_LerpRGB(RGB* a0, RGB* a1, f32 a2, RGB* a3) { +void Lib_LerpRGB(RGB* a, RGB* b, f32 t, RGB* dst) { // XXX regalloc is slightly off - a3->red = (f32)a0->red + ((f32)a1->red - (f32)a0->red) * a2; - a3->green = (f32)a0->green + ((f32)a1->green - (f32)a0->green) * a2; - a3->blue = (f32)a0->blue + ((f32)a1->blue - (f32)a0->blue) * a2; + dst->red = (f32)a->red + ((f32)b->red - (f32)a->red) * t; + dst->green = (f32)a->green + ((f32)b->green - (f32)a->green) * t; + dst->blue = (f32)a->blue + ((f32)b->blue - (f32)a->blue) * t; } #else @@ -626,21 +626,21 @@ GLOBAL_ASM("./asm/nonmatching/z_lib/Lib_LerpRGB.asm") #endif -f32 Lib_PushAwayVec3f(Vector3f* a0, Vector3f* a1, f32 a2) { +f32 Lib_PushAwayVec3f(Vector3f* start, Vector3f* pusher, f32 distanceToApproach) { Vector3f sp24; f32 f2; f32 f0; - Lib_SubVec3f(a1, a0, &sp24); + Lib_SubVec3f(pusher, start, &sp24); f0 = Math3D_Length(&sp24); - if (a2 < f0) { - f2 = a2 / f0; - f0 = f0 - a2; - a0->x = a0->x + f2 * sp24.x; - a0->y = a0->y + f2 * sp24.y; - a0->z = a0->z + f2 * sp24.z; + if (distanceToApproach < f0) { + f2 = distanceToApproach / f0; + f0 = f0 - distanceToApproach; + start->x = start->x + f2 * sp24.x; + start->y = start->y + f2 * sp24.y; + start->z = start->z + f2 * sp24.z; } else { - Lib_CopyVec3f(a0, a1); + Lib_CopyVec3f(start, pusher); f0 = 0; } @@ -649,30 +649,30 @@ f32 Lib_PushAwayVec3f(Vector3f* a0, Vector3f* a1, f32 a2) { void Lib_Nop801004FC(void) {} -u32 Lib_PtrSegToVirt(u32 a0) { - return(gRspSegmentPhysAddrs[(a0 << 4) >> 28] + (a0 & 0xFFFFFF)) + 0x80000000; +u32 Lib_PtrSegToVirt(u32 ptr) { + return(gRspSegmentPhysAddrs[(ptr << 4) >> 28] + (ptr & 0xFFFFFF)) + 0x80000000; } -u32 Lib_PtrSegToVirtNull(u32 a0) { - if ((a0 >> 28) == 0) { - return a0; +u32 Lib_PtrSegToVirtNull(u32 ptr) { + if ((ptr >> 28) == 0) { + return ptr; } - return(gRspSegmentPhysAddrs[(a0 << 4) >> 28] + (a0 & 0xFFFFFF)) + 0x80000000; + return(gRspSegmentPhysAddrs[(ptr << 4) >> 28] + (ptr & 0xFFFFFF)) + 0x80000000; } -u32 Lib_PtrSegToK0(u32 a0) { - if (a0 == 0) { +u32 Lib_PtrSegToK0(u32 ptr) { + if (ptr == 0) { return 0; } else { - return a0 + 0x80000000; + return ptr + 0x80000000; } } -u32 Lib_PtrSegToK0Null(u32 a0) { - if (a0 == 0) { +u32 Lib_PtrSegToK0Null(u32 ptr) { + if (ptr == 0) { return 0; } else { - return a0 + 0x80000000; + return ptr + 0x80000000; } } \ No newline at end of file diff --git a/tables/functions.py b/tables/functions.py index 8fe11c4c34..b875967bdd 100644 --- a/tables/functions.py +++ b/tables/functions.py @@ -755,8 +755,8 @@ 0x800B750C:("func_800B750C","void","void"), 0x800B75A0:("func_800B75A0","void","void"), 0x800B761C:("func_800B761C","void","void"), - 0x800B7678:("func_800B7678","void","void"), - 0x800B78B8:("func_800B78B8","void","GlobalContext* ctxt, Actor* iParm2, f32 uParm3, f32 uParm4, f32 param_5, u32 param_6"), + 0x800B7678:("func_800B7678","UNK_TYPE4","GlobalContext* ctxt, Actor* param_2, int param_3, unsigned int param_4"), + 0x800B78B8:("func_800B78B8","void","GlobalContext* ctxt, Actor* actor, f32 uParm3, f32 uParm4, f32 param_5, u32 param_6"), 0x800B7E04:("func_800B7E04","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6"), 0x800B7FE0:("func_800B7FE0","s32","f32* param_1, f32* param_2, f32* param_3, GraphicsContext* gCtxt"), 0x800B8018:("func_800B8018","void","void"), @@ -1009,7 +1009,7 @@ 0x800C5F8C:("BgCheck_WaterboxListInit","void","BgWaterboxList* waterboxList"), 0x800C5F9C:("BgCheck_WaterboxListAlloc","void","GlobalContext* ctxt, BgWaterboxList* waterboxList, u32 numWaterboxes"), 0x800C5FD8:("BgCheck_ActorMeshUpdateParams","void","GlobalContext* ctxt, ActorMesh* mesh"), - 0x800C6024:("BcCheck_IsActorMeshIndexValid","s32","s32 index"), + 0x800C6024:("BgCheck_IsActorMeshIndexValid","s32","s32 index"), 0x800C6044:("BgCheck_DynaInit","void","GlobalContext* ctxt, BgDynaCollision* param_2"), 0x800C6098:("BgCheck_DynaAlloc","void","GlobalContext* ctxt, BgDynaCollision* dyna"), 0x800C6188:("BgCheck_AddActorMesh","s32","GlobalContext* ctxt, BgDynaCollision* dyna, BgActor* actor, BgMeshHeader* header"), @@ -1041,7 +1041,7 @@ 0x800C921C:("func_800C921C","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7, UNK_TYPE4 param_8"), 0x800C9380:("func_800C9380","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE2 param_8"), 0x800C94E0:("BgCheck_RelocateMeshHeaderPointers","void","BgMeshHeader* header"), - 0x800C9564:("BgCheck_RelocateMeshHeader","void","u32 meshSegPtr, BgMeshHeader** param_2"), + 0x800C9564:("BgCheck_RelocateMeshHeader","void","BgMeshHeader* meshSegPtr, BgMeshHeader** param_2"), 0x800C9598:("BgCheck_RelocateAllMeshHeaders","void","BgCheckContext* bgCtxt, GlobalContext* ctxt"), 0x800C9640:("func_800C9640","void","void"), 0x800C9694:("BgCheck_GetPolygonAttributes","u32","BgCheckContext* bgCtxt, BgPolygon* polygon, s32 index, s32 attributeIndex"), @@ -1090,25 +1090,25 @@ 0x800CA6F0:("func_800CA6F0","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7"), 0x800CA9D0:("func_800CA9D0","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6"), 0x800CAA14:("func_800CAA14","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5"), - 0x800CAAD0:("func_800CAAD0","void","int iParm1, int iParm2, int iParm3"), - 0x800CAC0C:("func_800CAC0C","void","void"), - 0x800CACA0:("func_800CACA0","void","void"), - 0x800CAD2C:("func_800CAD2C","void","void"), - 0x800CAE10:("BcCheck_BgActorInit","void","BgActor* actor, UNK_TYPE4 param_2"), - 0x800CAE34:("func_800CAE34","void","void"), - 0x800CAE7C:("func_800CAE7C","void","void"), - 0x800CAE88:("func_800CAE88","void","void"), - 0x800CAE9C:("func_800CAE9C","void","void"), + 0x800CAAD0:("BgCheck2_UpdateActorPosition","void","BgCheckContext* bgCtxt, s32 index, Actor* actor"), + 0x800CAC0C:("BgCheck2_UpdateActorYRotation","void","BgCheckContext* bgCtxt, s32 index, Actor* actor"), + 0x800CACA0:("BgCheck2_AttachToMesh","void","BgCheckContext* bgCtxt, Actor* actor, s32 index"), + 0x800CAD2C:("BgCheck2_UpdateActorAttachedToMesh","u32","BgCheckContext* bgCtxt, s32 index, Actor* actor"), + 0x800CAE10:("BcCheck3_BgActorInit","void","BgActor* actor, UNK_TYPE4 param_2"), + 0x800CAE34:("BgCheck3_LoadMesh","void","GlobalContext* ctxt, BgActor* actor, BgMeshHeader* meshHeader"), + 0x800CAE7C:("func_800CAE7C","void","BgActor* actor"), + 0x800CAE88:("func_800CAE88","void","BgActor* actor"), + 0x800CAE9C:("func_800CAE9C","void","BgActor* actor"), 0x800CAEB0:("func_800CAEB0","void","void"), - 0x800CAEE0:("func_800CAEE0","void","void"), + 0x800CAEE0:("func_800CAEE0","void","BgActor* actor"), 0x800CAEF4:("func_800CAEF4","void","void"), - 0x800CAF24:("func_800CAF24","void","void"), - 0x800CAF38:("func_800CAF38","void","void"), - 0x800CAF4C:("func_800CAF4C","void","void"), - 0x800CAF70:("func_800CAF70","void","void"), - 0x800CAF94:("func_800CAF94","void","void"), - 0x800CAFB8:("func_800CAFB8","void","void"), - 0x800CAFDC:("func_800CAFDC","void","void"), + 0x800CAF24:("func_800CAF24","void","BgActor* actor"), + 0x800CAF38:("func_800CAF38","void","BgActor* actor"), + 0x800CAF4C:("func_800CAF4C","s32","BgActor* actor"), + 0x800CAF70:("func_800CAF70","s32","BgActor* actor"), + 0x800CAF94:("func_800CAF94","s32","BgActor* actor"), + 0x800CAFB8:("func_800CAFB8","s32","BgActor* actor"), + 0x800CAFDC:("func_800CAFDC","s32","BgActor* actor"), 0x800CB000:("func_800CB000","void","UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5"), 0x800CB210:("func_800CB210","void","void"), 0x800CB240:("func_800CB240","void","void"), @@ -1792,8 +1792,8 @@ 0x800FEDC4:("Lib_StepTowardsGet_i","s32","s32 start, s32 value, s32 step"), 0x800FEE08:("Lib_StepTowards_i","void","s32* start, s32 value, s32 step"), 0x800FEE34:("Lib_StepTowardsCheck_i","s32","s32* start, s32 value, s32 step"), - 0x800FEE70:("Lib_StepTowardsCheckFramerateScaled_s","s32","s16* start, s16 taret, s16 step"), - 0x800FEF2C:("Lib_StepTowardsCheck_s","s32","s16* start, s16 taret, s16 step"), + 0x800FEE70:("Lib_StepTowardsCheckFramerateScaled_s","s32","s16* start, s16 target, s16 step"), + 0x800FEF2C:("Lib_StepTowardsCheck_s","s32","s16* start, s16 target, s16 step"), 0x800FEFB4:("Lib_StepTowardsCheck_c","s32","s8* start, s8 target, s8 step"), 0x800FF03C:("Lib_StepTowardsCheck_f","s32","f32* start, f32 target, f32 step"), 0x800FF0D0:("func_800FF0D0","void","void"), @@ -1825,18 +1825,18 @@ 0x800FFA4C:("Lib_DistanceYVec3f","f32","Vector3f* a, Vector3f* b"), 0x800FFA60:("Lib_YawVec3f","s32","Vector3f* from, Vector3f* to"), 0x800FFA94:("Lib_PitchVec3f","s32","Vector3f* from, Vector3f* to"), - 0x800FFADC:("Lib_ApplyActorInitVars","void","Actor* uParm1, ActorInitVar* puParm2"), - 0x800FFB54:("Lib_ApplyActorInitVarByte1","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFB70:("Lib_ApplyActorInitVarByte2","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFB8C:("Lib_ApplyActorInitVarShort1","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFBA8:("Lib_ApplyActorInitVarShort2","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFBC4:("Lib_ApplyActorInitVarWord1","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFBE0:("Lib_ApplyActorInitVarWord2","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFBFC:("Lib_ApplyActorInitVarFloat","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFC20:("Lib_ApplyActorInitVarFloat1000th","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFC50:("Lib_ApplyActorInitVarVector3f","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFC7C:("Lib_ApplyActorInitVarVector3f1000th","void","u8* iParm1, ActorInitVar* puParm2"), - 0x800FFCB4:("Lib_ApplyActorInitVarVector3s","void","u8* iParm1, ActorInitVar* puParm2"), + 0x800FFADC:("Lib_ApplyActorInitVars","void","Actor* actor, ActorInitVar* init"), + 0x800FFB54:("Lib_ApplyActorInitVarByte1","void","u8* actor, ActorInitVar* init"), + 0x800FFB70:("Lib_ApplyActorInitVarByte2","void","u8* actor, ActorInitVar* init"), + 0x800FFB8C:("Lib_ApplyActorInitVarShort1","void","u8* actor, ActorInitVar* init"), + 0x800FFBA8:("Lib_ApplyActorInitVarShort2","void","u8* actor, ActorInitVar* init"), + 0x800FFBC4:("Lib_ApplyActorInitVarWord1","void","u8* actor, ActorInitVar* init"), + 0x800FFBE0:("Lib_ApplyActorInitVarWord2","void","u8* actor, ActorInitVar* init"), + 0x800FFBFC:("Lib_ApplyActorInitVarFloat","void","u8* actor, ActorInitVar* init"), + 0x800FFC20:("Lib_ApplyActorInitVarFloat1000th","void","u8* actor, ActorInitVar* init"), + 0x800FFC50:("Lib_ApplyActorInitVarVector3f","void","u8* actor, ActorInitVar* init"), + 0x800FFC7C:("Lib_ApplyActorInitVarVector3f1000th","void","u8* actor, ActorInitVar* init"), + 0x800FFCB4:("Lib_ApplyActorInitVarVector3s","void","u8* actor, ActorInitVar* init"), 0x800FFCD8:("func_800FFCD8","f32","f32* a0, f32 a1, f32 a2, f32 a3, f32 a4"), 0x800FFDF8:("Lib_ScaleMax_f","void","f32* start, f32 target, f32 scale, f32 maxStep"), 0x800FFE68:("Lib_Scale_f","void","f32* start, f32 scale, f32 maxStep"), @@ -2602,7 +2602,7 @@ 0x80139094:("Matrix_GetIdentity","void","z_Matrix** puParm1"), 0x801390A8:("Matrix_MakeIdentity","void","z_Matrix* matrix"), 0x80139100:("Matrix_Copy","void","z_Matrix* src, z_Matrix* dst"), - 0x80139188:("func_80139188","void","void"), + 0x80139188:("invert_matrix","s32","z_Matrix* matrix, z_Matrix* invert"), 0x80139428:("Matrix_MakeScale","void","z_Matrix* matrix, f32 x, f32 y, f32 z"), 0x8013948C:("Matrix_MakeRotationZYX","void","z_Matrix* matrix, s16 xRotation, s16 yRotation, s16 zRotation"), 0x8013961C:("Matrix_MakeRotationYXZ","void","z_Matrix* matrix, s16 xRotation, s16 yRotation, s16 zRotation"),