Clean up some code

Couldn't manage to make the lbl_8011DD20 variable implicit in hsfdraw.c. I think this is from a SetHiliteTexMtx inline.
This commit is contained in:
gamemasterplc 2024-01-15 19:48:48 -06:00
parent 38ddfa01fc
commit 8201e5bf9a
6 changed files with 36 additions and 30 deletions

View file

@ -441,8 +441,8 @@ GetBitMap = .text:0x800285E8; // type:function size:0x64
Hu3DJointMotion = .text:0x8002864C; // type:function size:0xCC Hu3DJointMotion = .text:0x8002864C; // type:function size:0xCC
JointModel_Motion = .text:0x80028718; // type:function size:0x124 JointModel_Motion = .text:0x80028718; // type:function size:0x124
Hu3DMotionCalc = .text:0x8002883C; // type:function size:0x19C Hu3DMotionCalc = .text:0x8002883C; // type:function size:0x19C
SearchObjectIndex = .text:0x800289D8; // type:function size:0x90 SearchObjectIndex = .text:0x800289D8; // type:function size:0x90 scope:local
SearchAttributeIndex = .text:0x80028A68; // type:function size:0x9C SearchAttributeIndex = .text:0x80028A68; // type:function size:0x9C scope:local
Hu3DAnimInit = .text:0x80028B04; // type:function size:0x7C Hu3DAnimInit = .text:0x80028B04; // type:function size:0x7C
Hu3DAnimCreate = .text:0x80028B80; // type:function size:0x1D0 Hu3DAnimCreate = .text:0x80028B80; // type:function size:0x1D0
Hu3DAnimLink = .text:0x80028D50; // type:function size:0x1C4 Hu3DAnimLink = .text:0x80028D50; // type:function size:0x1C4
@ -4604,7 +4604,7 @@ __destroy_global_chain_reference = .dtors:0x8011DCE0; // type:object size:0x4 sc
__fini_cpp_exceptions_reference = .dtors:0x8011DCE4; // type:object size:0x4 scope:global __fini_cpp_exceptions_reference = .dtors:0x8011DCE4; // type:object size:0x4 scope:global
lbl_8011DD00 = .rodata:0x8011DD00; // type:object size:0x10 data:4byte lbl_8011DD00 = .rodata:0x8011DD00; // type:object size:0x10 data:4byte
lbl_8011DD10 = .rodata:0x8011DD10; // type:object size:0x10 data:4byte lbl_8011DD10 = .rodata:0x8011DD10; // type:object size:0x10 data:4byte
lbl_8011DD20 = .rodata:0x8011DD20; // type:object size:0x10 data:4byte lbl_8011DD20 = .rodata:0x8011DD20; // type:object size:0xC data:4byte
lbl_8011DD30 = .rodata:0x8011DD30; // type:object size:0x20 data:byte lbl_8011DD30 = .rodata:0x8011DD30; // type:object size:0x20 data:byte
lbl_8011DD50 = .rodata:0x8011DD50; // type:object size:0x10 data:4byte lbl_8011DD50 = .rodata:0x8011DD50; // type:object size:0x10 data:4byte
lbl_8011DD60 = .rodata:0x8011DD60; // type:object size:0x24 data:4byte lbl_8011DD60 = .rodata:0x8011DD60; // type:object size:0x24 data:4byte

View file

@ -149,6 +149,18 @@ static inline void GXColor1x8(u8 index) {
GXWGFifo.u8 = index; GXWGFifo.u8 = index;
} }
static inline void GXPosition1x16(u16 index) {
GXWGFifo.u16 = index;
}
static inline void GXColor1x16(u16 index) {
GXWGFifo.u16 = index;
}
static inline void GXTexCoord1x16(u16 index) {
GXWGFifo.u16 = index;
}
static inline void GXEnd(void) {} static inline void GXEnd(void) {}
#endif #endif

View file

@ -73,6 +73,7 @@ _MATH_INLINE float sinf(float x) { return (float)sin((double)x); }
_MATH_INLINE float cosf(float x) { return (float)cos((double)x); } _MATH_INLINE float cosf(float x) { return (float)cos((double)x); }
_MATH_INLINE float atan2f(float y, float x) { return (float)atan2((double)y, (double)x); } _MATH_INLINE float atan2f(float y, float x) { return (float)atan2((double)y, (double)x); }
_MATH_INLINE float atanf(float x) { return (float)atan((double)x); } _MATH_INLINE float atanf(float x) { return (float)atan((double)x); }
_MATH_INLINE float asinf(float x) { return (float)asin((double)x); }
_MATH_INLINE float fmodf(float x, float m) { return (float)fmod((double)x, (double)m); } _MATH_INLINE float fmodf(float x, float m) { return (float)fmod((double)x, (double)m); }

View file

@ -35,13 +35,6 @@ Hu3DTexAnimDataStruct Hu3DTexAnimData[256];
Hu3DTexScrDataStruct Hu3DTexScrData[16]; Hu3DTexScrDataStruct Hu3DTexScrData[16];
static Process *parManProc[64]; static Process *parManProc[64];
// TODO: move to GXVert
static inline void GXUnknownu16(const u16 x, const u16 y, const u16 z) {
GXWGFifo.u16 = x;
GXWGFifo.u16 = y;
GXWGFifo.u16 = z;
}
void Hu3DAnimInit(void) { void Hu3DAnimInit(void) {
Hu3DTexAnimDataStruct *var_r30; Hu3DTexAnimDataStruct *var_r30;
Hu3DTexScrDataStruct *var_r29; Hu3DTexScrDataStruct *var_r29;
@ -537,10 +530,18 @@ s16 Hu3DParticleCreate(AnimData *arg0, s16 arg1) {
GXBeginDisplayList(temp_r24, 0x20000); GXBeginDisplayList(temp_r24, 0x20000);
GXBegin(GX_QUADS, GX_VTXFMT0, arg1 * 4); GXBegin(GX_QUADS, GX_VTXFMT0, arg1 * 4);
for (i = 0; i < arg1; i++) { for (i = 0; i < arg1; i++) {
GXUnknownu16(i * 4, i, 0); GXPosition1x16(i*4);
GXUnknownu16(i * 4 + 1, i, 1); GXColor1x16(i);
GXUnknownu16(i * 4 + 2, i, 2); GXTexCoord1x16(0);
GXUnknownu16(i * 4 + 3, i, 3); GXPosition1x16((i*4)+1);
GXColor1x16(i);
GXTexCoord1x16(1);
GXPosition1x16((i*4)+2);
GXColor1x16(i);
GXTexCoord1x16(2);
GXPosition1x16((i*4)+3);
GXColor1x16(i);
GXTexCoord1x16(3);
} }
temp_r31->unk_40 = GXEndDisplayList(); temp_r31->unk_40 = GXEndDisplayList();
return temp_r25; return temp_r25;

View file

@ -470,15 +470,7 @@ void Hu3DMtxTransGet(Mtx arg0, Vec *arg1) {
arg1->z = arg0[2][3]; arg1->z = arg0[2][3];
} }
static inline float Hu3DMtxRotGetInlineFunc01(float arg0, float arg1) { static inline float GetAngleXY(float arg0, float arg1) {
return atan2(arg0, arg1);
}
static inline float Hu3DMtxRotGetInlineFunc02(float arg0) {
return asin(arg0);
}
static inline float Hu3DMtxRotGetInlineFunc03(float arg0, float arg1) {
if (arg1 == 0.0f) { if (arg1 == 0.0f) {
if (arg0 >= 0.0f) { if (arg0 >= 0.0f) {
return M_PI / 2; return M_PI / 2;
@ -486,7 +478,7 @@ static inline float Hu3DMtxRotGetInlineFunc03(float arg0, float arg1) {
return -(M_PI / 2); return -(M_PI / 2);
} }
} else { } else {
return Hu3DMtxRotGetInlineFunc01(arg0, arg1); return atan2f(arg0, arg1);
} }
} }
@ -516,15 +508,15 @@ void Hu3DMtxRotGet(Mtx arg0, Vec *arg1) {
} else if (temp_f24 <= -1.0f) { } else if (temp_f24 <= -1.0f) {
var_f25 = -(M_PI / 2); var_f25 = -(M_PI / 2);
} else { } else {
var_f25 = Hu3DMtxRotGetInlineFunc02(temp_f24); var_f25 = asinf(temp_f24);
} }
arg1->y = var_f25; arg1->y = var_f25;
sp48 = cos(arg1->y); sp48 = cos(arg1->y);
if (sp48 >= 0.00000001f) { if (sp48 >= 0.00000001f) {
arg1->x = Hu3DMtxRotGetInlineFunc03(arg0[2][1] / sp3C, arg0[2][2] / sp34); arg1->x = GetAngleXY(arg0[2][1] / sp3C, arg0[2][2] / sp34);
arg1->z = Hu3DMtxRotGetInlineFunc03(arg0[1][0], arg0[0][0]); arg1->z = GetAngleXY(arg0[1][0], arg0[0][0]);
} else { } else {
arg1->x = Hu3DMtxRotGetInlineFunc03(arg0[0][1], arg0[1][1]); arg1->x = GetAngleXY(arg0[0][1], arg0[1][1]);
arg1->z = 0.0f; arg1->z = 0.0f;
} }
arg1->x = arg1->x * 57.29578f; arg1->x = arg1->x * 57.29578f;

View file

@ -1397,7 +1397,7 @@ void Hu3DMotionCalc(s16 arg0) {
temp_r31->attr |= 0x800; temp_r31->attr |= 0x800;
} }
s32 SearchObjectIndex(HsfData *arg0, u32 arg1) { static s32 SearchObjectIndex(HsfData *arg0, u32 arg1) {
s32 i; s32 i;
char *temp_r28; char *temp_r28;
HsfObject *var_r30; HsfObject *var_r30;
@ -1412,7 +1412,7 @@ s32 SearchObjectIndex(HsfData *arg0, u32 arg1) {
return -1; return -1;
} }
s32 SearchAttributeIndex(HsfData *arg0, u32 arg1) { static s32 SearchAttributeIndex(HsfData *arg0, u32 arg1) {
HsfAttribute *var_r31; HsfAttribute *var_r31;
size_t temp_r28; size_t temp_r28;
char *temp_r27; char *temp_r27;