summaryrefslogtreecommitdiff
path: root/src/math_util_2.c
diff options
context:
space:
mode:
authorcoco875 <59367621+coco875@users.noreply.github.com>2023-10-08 00:31:48 +0200
committerGitHub <noreply@github.com>2023-10-07 16:31:48 -0600
commitd8cfed94913f06e31f48b3e63f3e12cfa9907405 (patch)
tree395598dcf9e71e6948f6ded563e47cbaa9d7028c /src/math_util_2.c
parent2b74bbbcefe396564a55357eda094fc8c8baf36a (diff)
Various Naming (#445)
* Mass renames
Diffstat (limited to 'src/math_util_2.c')
-rw-r--r--src/math_util_2.c351
1 files changed, 180 insertions, 171 deletions
diff --git a/src/math_util_2.c b/src/math_util_2.c
index 2c03184d5..d2978b9cb 100644
--- a/src/math_util_2.c
+++ b/src/math_util_2.c
@@ -13,24 +13,24 @@
#pragma intrinsic (sqrtf)
-UNUSED void func_80040E50(s32 *arg0, s32 arg1) {
+UNUSED void operator_or(s32 *arg0, s32 arg1) {
*arg0 = (s32) (*arg0 | arg1);
}
-UNUSED void func_80040E60(s32 *arg0,s32 arg1) {
+UNUSED void operator_and_not(s32 *arg0,s32 arg1) {
*arg0 = (s32) (*arg0 & ~arg1);
}
-UNUSED void func_80040E74(s32 *arg0, s32 arg1) {
+UNUSED void operator_xor(s32 *arg0, s32 arg1) {
*arg0 = (s32) (*arg0 ^ arg1);
}
-UNUSED s32 func_80040E84(s32 *arg0, s32 arg1) {
- s32 phi_v1;
+UNUSED bool func_80040E84(s32 *arg0, s32 arg1) {
+ bool phi_v1;
- phi_v1 = 0;
+ phi_v1 = FALSE;
if ((*arg0 & arg1) != 0) {
- phi_v1 = 1;
+ phi_v1 = TRUE;
}
return phi_v1;
}
@@ -335,15 +335,14 @@ void func_80041480(s16 *arg0, s16 arg1, s16 arg2, s16 *arg3) {
}
}
-Vec3f *vec3f_set_dupe_2_electric_boogaloo(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3) {
+Vec3f *vec3f_set_xyz(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3) {
arg0[0] = arg1;
arg0[1] = arg2;
arg0[2] = arg3;
return (Vec3f *) &arg0;
}
-// look like normalise vector
-Vec3f *func_80041530(Vec3f dest) {
+Vec3f *vec3f_normalize(Vec3f dest) {
f32 invsqrt = 1.0f / sqrtf(dest[0] * dest[0] + dest[1] * dest[1] + dest[2] * dest[2]);
dest[0] = dest[0] * invsqrt;
@@ -352,7 +351,7 @@ Vec3f *func_80041530(Vec3f dest) {
return (Vec3f *) &dest;
}
-Vec3f *func_80041594(Vec3f dest, Vec3f arg1, Vec3f arg2) {
+Vec3f *vec3f_cross_product(Vec3f dest, Vec3f arg1, Vec3f arg2) {
dest[0] = (arg1[1] * arg2[2]) - (arg2[1] * arg1[2]);
dest[1] = (arg1[2] * arg2[0]) - (arg2[2] * arg1[0]);
@@ -361,7 +360,7 @@ Vec3f *func_80041594(Vec3f dest, Vec3f arg1, Vec3f arg2) {
return (Vec3f *) &dest;
}
-UNUSED s32 func_80041608(f32 x1, f32 y1, f32 x2, f32 y2, f32 distance) {
+UNUSED s32 is_within_distance_2d(f32 x1, f32 y1, f32 x2, f32 y2, f32 distance) {
f32 x;
f32 y;
s32 ret = 0;
@@ -464,15 +463,15 @@ s32 func_80041980(Vec3f arg0, Camera *arg1, u16 arg2) {
void func_800419F8(void) {
Vec3f sp18;
- Vec3f sp24;
+ Vec3f vec;
sp18[0] = 0.0f;
sp18[1] = 0.0f;
sp18[2] = 120.0f;
- func_80042D14(sp24, sp18, D_80165834);
- D_80165840[0] = sp24[0];
- D_80165840[1] = sp24[1];
- D_80165840[2] = sp24[2];
+ vec3f_rotate_x_y(vec, sp18, D_80165834);
+ D_80165840[0] = vec[0];
+ D_80165840[1] = vec[1];
+ D_80165840[2] = vec[2];
}
UNUSED void func_80041A70(void) {
@@ -637,13 +636,13 @@ void func_80041EF4(void) {
}
extern s32 gMatrixHudCount;
-//void func_80022180(Mtx*, Mat4);
+//void convert_to_fixed_point_matrix(Mtx*, Mat4);
UNUSED void func_80041F54(s32 x, s32 y) {
Mat4 matrix;
mtfx_translation_x_y(matrix, x, y);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
@@ -652,7 +651,7 @@ UNUSED void func_80042000(u16 angle_z) {
Mat4 matrix;
mtxf_u16_rotate_z(matrix, angle_z);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
@@ -661,7 +660,7 @@ UNUSED void func_800420A8(f32 scale) {
Mat4 matrix;
mtxf_scale_x_y(matrix, scale);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
@@ -671,7 +670,7 @@ UNUSED void func_8004214C(u16 angle, f32 scale) {
Mat4 matrix;
mtxf_rotate_z_scale_x_y(matrix, angle, scale);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
@@ -680,19 +679,19 @@ UNUSED void func_800421FC(s32 x, s32 y, f32 scale) {
Mat4 matrix;
mtfx_translation_x_y(matrix, x, y);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
mtxf_scale_x_y(matrix, scale);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
}
void func_80042330(s32 x, s32 y, u16 angle, f32 scale) {
Mat4 matrix;
mtxf_translation_x_y_rotate_z_scale_x_y(matrix, x, y, angle, scale);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
@@ -748,49 +747,49 @@ UNUSED void func_8004252C(Mat4 arg0, u16 arg1, u16 arg2) {
arg0[2][2] = sp28 * cos_theta_y;
}
-void func_800425D0(Mat4 arg0, Vec3f arg1, Vec3su arg2, f32 arg3) {
- f32 sp44 = sins(arg2[0]);
- f32 temp_f22 = coss(arg2[0]);
- f32 sp3C = sins(arg2[1]);
- f32 sp38 = coss(arg2[1]);
- f32 sp34 = sins(arg2[2]);
- f32 temp_f0 = coss(arg2[2]);
-
- arg0[0][0] = ((sp38 * temp_f0) + (sp44 * sp3C * sp34)) * arg3;
- arg0[1][0] = ((-sp38 * sp34) + (sp44 * sp3C * temp_f0)) * arg3;
- arg0[2][0] = (temp_f22 * sp3C) * arg3;
- arg0[3][0] = arg1[0];
- arg0[0][1] = temp_f22 * sp34 * arg3;
- arg0[1][1] = temp_f22 * temp_f0 * arg3;
- arg0[2][1] = -sp44 * arg3;
- arg0[3][1] = arg1[1];
- arg0[0][2] = ((-sp3C * temp_f0) + (sp44 * sp38 * sp34)) * arg3;
- arg0[1][2] = ((sp3C * sp34) + (sp44 * sp38 * temp_f0)) * arg3;
- arg0[2][2] = temp_f22 * sp38 * arg3;
- arg0[3][2] = arg1[2];
- arg0[0][3] = 0.0f;
- arg0[1][3] = 0.0f;
- arg0[2][3] = 0.0f;
- arg0[3][3] = 1.0f;
-}
-
-void func_80042760(Mat4 dest, Vec3f arg1, Vec3f arg2, f32 scale) {
- dest[0][0] = scale;
- dest[1][0] = 0.0f;
- dest[2][0] = 0.0f;
- dest[3][0] = arg1[0] - arg2[0];
- dest[0][1] = 0.0f;
- dest[1][1] = -scale;
- dest[2][1] = 0.0f;
- dest[3][1] = arg1[1] - arg2[1];
- dest[0][2] = 0.0f;
- dest[1][2] = 0.0f;
- dest[2][2] = -scale;
- dest[3][2] = arg1[2] - arg2[2];
- dest[0][3] = 0.0f;
- dest[1][3] = 0.0f;
- dest[2][3] = 0.0f;
- dest[3][3] = 1.0f;
+void mtxf_set_matrix_transformation(Mat4 transformMatrix, Vec3f translationVector, Vec3su rotationVector, f32 scalingFactor) {
+ f32 sinX = sins(rotationVector[0]);
+ f32 cosX = coss(rotationVector[0]);
+ f32 sinY = sins(rotationVector[1]);
+ f32 cosY = coss(rotationVector[1]);
+ f32 sinZ = sins(rotationVector[2]);
+ f32 cosZ = coss(rotationVector[2]);
+
+ transformMatrix[0][0] = (( cosY * cosZ) + (sinX * sinY * sinZ)) * scalingFactor;
+ transformMatrix[1][0] = ((-cosY * sinZ) + (sinX * sinY * cosZ)) * scalingFactor;
+ transformMatrix[2][0] = (cosX * sinY) * scalingFactor;
+ transformMatrix[3][0] = translationVector[0];
+ transformMatrix[0][1] = cosX * sinZ * scalingFactor;
+ transformMatrix[1][1] = cosX * cosZ * scalingFactor;
+ transformMatrix[2][1] = -sinX * scalingFactor;
+ transformMatrix[3][1] = translationVector[1];
+ transformMatrix[0][2] = ((-sinY * cosZ) + (sinX * cosY * sinZ)) * scalingFactor;
+ transformMatrix[1][2] = (( sinY * sinZ) + (sinX * cosY * cosZ)) * scalingFactor;
+ transformMatrix[2][2] = cosX * cosY * scalingFactor;
+ transformMatrix[3][2] = translationVector[2];
+ transformMatrix[0][3] = 0.0f;
+ transformMatrix[1][3] = 0.0f;
+ transformMatrix[2][3] = 0.0f;
+ transformMatrix[3][3] = 1.0f;
+}
+
+void mtxf_set_matrix_scale_transl(Mat4 transformMatrix, Vec3f vec1, Vec3f vec2, f32 scale) {
+ transformMatrix[0][0] = scale;
+ transformMatrix[1][0] = 0.0f;
+ transformMatrix[2][0] = 0.0f;
+ transformMatrix[3][0] = vec1[0] - vec2[0];
+ transformMatrix[0][1] = 0.0f;
+ transformMatrix[1][1] = -scale;
+ transformMatrix[2][1] = 0.0f;
+ transformMatrix[3][1] = vec1[1] - vec2[1];
+ transformMatrix[0][2] = 0.0f;
+ transformMatrix[1][2] = 0.0f;
+ transformMatrix[2][2] = -scale;
+ transformMatrix[3][2] = vec1[2] - vec2[2];
+ transformMatrix[0][3] = 0.0f;
+ transformMatrix[1][3] = 0.0f;
+ transformMatrix[2][3] = 0.0f;
+ transformMatrix[3][3] = 1.0f;
}
/**
@@ -801,38 +800,38 @@ void func_80042760(Mat4 dest, Vec3f arg1, Vec3f arg2, f32 scale) {
* @param arg1
**/
-void func_800427DC(s32 arg0, Mat4 arg1) {
- f32 sp3C;
- struct_80165C18_entry *temp_s0 = &D_80165C18[arg0];
- f32 sp34;
- f32 sp30;
- f32 sp2C;
- f32 temp_f0;
- f32 temp_f20;
-
- sp3C = sins(temp_s0->unk_0B2[0]);
- temp_f20 = coss(temp_s0->unk_0B2[0]);
- sp34 = sins(temp_s0->unk_0B2[1]);
- sp30 = coss(temp_s0->unk_0B2[1]);
- sp2C = sins(temp_s0->unk_0B2[2]);
- temp_f0 = coss(temp_s0->unk_0B2[2]);
-
- arg1[0][0] = temp_s0->sizeScaling * ((sp30 * temp_f0) + (sp3C * sp34 * sp2C));
- arg1[1][0] = temp_s0->sizeScaling * ((-sp30 * sp2C) + sp3C * sp34 * temp_f0);
- arg1[2][0] = temp_s0->sizeScaling * (temp_f20 * sp34);
- arg1[3][0] = temp_s0->pos[0];
- arg1[0][1] = temp_s0->sizeScaling * (temp_f20 * sp2C);
- arg1[1][1] = temp_s0->sizeScaling * (temp_f20 * temp_f0);
- arg1[2][1] = temp_s0->sizeScaling * -sp3C;
- arg1[3][1] = temp_s0->pos[1];
- arg1[0][2] = temp_s0->sizeScaling * ((-sp34 * temp_f0) + (sp3C * sp30 * sp2C));
- arg1[1][2] = temp_s0->sizeScaling * ((sp34 * sp2C) + (sp3C * sp30 * temp_f0));
- arg1[2][2] = temp_s0->sizeScaling * (temp_f20 * sp30);
- arg1[3][2] = temp_s0->pos[2];
- arg1[0][3] = 0.0f;
- arg1[1][3] = 0.0f;
- arg1[2][3] = 0.0f;
- arg1[3][3] = 1.0f;
+void mtxf_set_matrix_gObjectList(s32 objectIndex, Mat4 transformMatrix) {
+ f32 sinX;
+ Objects *temp_s0 = &gObjectList[objectIndex];
+ f32 sinY;
+ f32 cosY;
+ f32 sinZ;
+ f32 cosZ;
+ f32 cosX;
+
+ sinX = sins(temp_s0->unk_0B2[0]);
+ cosX = coss(temp_s0->unk_0B2[0]);
+ sinY = sins(temp_s0->unk_0B2[1]);
+ cosY = coss(temp_s0->unk_0B2[1]);
+ sinZ = sins(temp_s0->unk_0B2[2]);
+ cosZ = coss(temp_s0->unk_0B2[2]);
+
+ transformMatrix[0][0] = temp_s0->sizeScaling * ((cosY * cosZ) + (sinX * sinY * sinZ));
+ transformMatrix[1][0] = temp_s0->sizeScaling * ((-cosY * sinZ) + sinX * sinY * cosZ);
+ transformMatrix[2][0] = temp_s0->sizeScaling * (cosX * sinY);
+ transformMatrix[3][0] = temp_s0->pos[0];
+ transformMatrix[0][1] = temp_s0->sizeScaling * (cosX * sinZ);
+ transformMatrix[1][1] = temp_s0->sizeScaling * (cosX * cosZ);
+ transformMatrix[2][1] = temp_s0->sizeScaling * -sinX;
+ transformMatrix[3][1] = temp_s0->pos[1];
+ transformMatrix[0][2] = temp_s0->sizeScaling * ((-sinY * cosZ) + (sinX * cosY * sinZ));
+ transformMatrix[1][2] = temp_s0->sizeScaling * ((sinY * sinZ) + (sinX * cosY * cosZ));
+ transformMatrix[2][2] = temp_s0->sizeScaling * (cosX * cosY);
+ transformMatrix[3][2] = temp_s0->pos[2];
+ transformMatrix[0][3] = 0.0f;
+ transformMatrix[1][3] = 0.0f;
+ transformMatrix[2][3] = 0.0f;
+ transformMatrix[3][3] = 1.0f;
}
UNUSED void mtxf_mult_first_column(Mat4 arg0, f32 arg1) {
@@ -853,36 +852,37 @@ UNUSED void mtxf_mult_third_column(Mat4 arg0, f32 arg1) {
arg0[2][2] *= arg1;
}
-void func_80042A20(Mat4 dest, Vec3f arg1, Vec3f arg2, u16 arg3, f32 arg4) {
+void set_transform_matrix(Mat4 dest, Vec3f orientationVector, Vec3f positionVector, u16 rotationAngle, f32 scaleFactor) {
Vec3f sp44;
Vec3f sp38;
Vec3f sp2C;
- vec3f_set_dupe_2_electric_boogaloo(sp44, sins(arg3), 0.0f, coss(arg3));
- func_80041530(arg1);
- func_80041594(sp38, arg1, sp44);
- func_80041530(sp38);
- func_80041594(sp2C, sp38, arg1);
- func_80041530(sp2C);
- dest[0][0] = sp38[0] * arg4;
- dest[0][1] = sp38[1] * arg4;
- dest[0][2] = sp38[2] * arg4;
- dest[3][0] = arg2[0];
- dest[1][0] = arg1[0] * arg4;
- dest[1][1] = arg1[1] * arg4;
- dest[1][2] = arg1[2] * arg4;
- dest[3][1] = arg2[1];
- dest[2][0] = sp2C[0] * arg4;
- dest[2][1] = sp2C[1] * arg4;
- dest[2][2] = sp2C[2] * arg4;
- dest[3][2] = arg2[2];
+ vec3f_set_xyz(sp44, sins(rotationAngle), 0.0f, coss(rotationAngle));
+ vec3f_normalize(orientationVector);
+ vec3f_cross_product(sp38, orientationVector, sp44);
+ vec3f_normalize(sp38);
+ vec3f_cross_product(sp2C, sp38, orientationVector);
+ vec3f_normalize(sp2C);
+ dest[0][0] = sp38[0] * scaleFactor;
+ dest[0][1] = sp38[1] * scaleFactor;
+ dest[0][2] = sp38[2] * scaleFactor;
+ dest[3][0] = positionVector[0];
+ dest[1][0] = orientationVector[0] * scaleFactor;
+ dest[1][1] = orientationVector[1] * scaleFactor;
+ dest[1][2] = orientationVector[2] * scaleFactor;
+ dest[3][1] = positionVector[1];
+ dest[2][0] = sp2C[0] * scaleFactor;
+ dest[2][1] = sp2C[1] * scaleFactor;
+ dest[2][2] = sp2C[2] * scaleFactor;
+ dest[3][2] = positionVector[2];
dest[0][3] = 0.0f;
dest[1][3] = 0.0f;
dest[2][3] = 0.0f;
dest[3][3] = 1.0f;
}
-UNUSED void func_80042B5C(Vec3f arg0, Vec3f arg1, Vec3s arg2) {
+// aplly to position a rotation and put in dest
+UNUSED void vec3f_rotate(Vec3f dest, Vec3f pos, Vec3s rot) {
f32 sp74;
f32 sp70;
f32 sp6C;
@@ -899,27 +899,29 @@ UNUSED void func_80042B5C(Vec3f arg0, Vec3f arg1, Vec3s arg2) {
f32 sine3;
f32 cosine3;
- sine1 = sins(arg2[0]);
- cosine1 = coss(arg2[0]);
- sine2 = sins(arg2[1]);
- cosine2 = coss(arg2[1]);
- sine3 = sins(arg2[2]);
- cosine3 = coss(arg2[2]);
- sp74 = arg1[0] * ((cosine2 * cosine3) + ((sine1 * sine2) * sine3));
- temp_f4 = arg1[1] * ((-cosine2 * sine3) + ((sine1 * sine2) * cosine3));
- temp_f8 = arg1[2] * (cosine1 * sine2);
- sp70 = arg1[0] * (cosine1 * sine3);
- sp64 = arg1[1] * (cosine1 * cosine3);
- sp58 = arg1[2] * -sine1;
- sp6C = arg1[0] * ((-sine2 * cosine3) + ((sine1 * cosine2) * sine3));
- sp60 = arg1[1] * ((sine2 * sine3) + ((sine1 * cosine2) * cosine3));
- sp54 = arg1[2] * (cosine1 * cosine2);
- arg0[0] = sp74 + temp_f4 + temp_f8;
- arg0[1] = sp70 + sp64 + sp58;
- arg0[2] = sp6C + sp60 + sp54;
-}
-
-void func_80042D14(Vec3f arg0, Vec3f arg1, Vec3s arg2) {
+ sine1 = sins(rot[0]);
+ cosine1 = coss(rot[0]);
+ sine2 = sins(rot[1]);
+ cosine2 = coss(rot[1]);
+ sine3 = sins(rot[2]);
+ cosine3 = coss(rot[2]);
+ // it's a matrix multiplication
+ sp74 = pos[0] * ((cosine2 * cosine3) + ((sine1 * sine2) * sine3));
+ temp_f4 = pos[1] * ((-cosine2 * sine3) + ((sine1 * sine2) * cosine3));
+ temp_f8 = pos[2] * (cosine1 * sine2);
+ sp70 = pos[0] * (cosine1 * sine3);
+ sp64 = pos[1] * (cosine1 * cosine3);
+ sp58 = pos[2] * -sine1;
+ sp6C = pos[0] * ((-sine2 * cosine3) + ((sine1 * cosine2) * sine3));
+ sp60 = pos[1] * ((sine2 * sine3) + ((sine1 * cosine2) * cosine3));
+ sp54 = pos[2] * (cosine1 * cosine2);
+ dest[0] = sp74 + temp_f4 + temp_f8;
+ dest[1] = sp70 + sp64 + sp58;
+ dest[2] = sp6C + sp60 + sp54;
+}
+
+// apply to position a rotation x y only and put in dest
+void vec3f_rotate_x_y(Vec3f dest, Vec3f pos, Vec3s rot) {
f32 sp2C;
f32 sp28;
f32 sp24;
@@ -928,61 +930,68 @@ void func_80042D14(Vec3f arg0, Vec3f arg1, Vec3s arg2) {
f32 sine2;
f32 cosine2;
- sp2C = arg1[0];
- sp28 = arg1[1];
- sp24 = arg1[2];
- sine1 = sins(arg2[0]);
- cosine1 = coss(arg2[0]);
- sine2 = sins(arg2[1]);
- cosine2 = coss(arg2[1]);
- arg0[0] = (sp2C * cosine2) - (sp24 * sine2);
- arg0[1] = (sp2C * sine1 * sine2) + (sp28 * cosine1) + (sp24 * sine1 * cosine2);
- arg0[2] = ((sp2C * cosine1 * sine2) - (sp28 * sine1)) + (sp24 * cosine1 * cosine2);
+ sp2C = pos[0];
+ sp28 = pos[1];
+ sp24 = pos[2];
+ sine1 = sins(rot[0]);
+ cosine1 = coss(rot[0]);
+ sine2 = sins(rot[1]);
+ cosine2 = coss(rot[1]);
+ dest[0] = (sp2C * cosine2) - (sp24 * sine2);
+ dest[1] = (sp2C * sine1 * sine2) + (sp28 * cosine1) + (sp24 * sine1 * cosine2);
+ dest[2] = ((sp2C * cosine1 * sine2) - (sp28 * sine1)) + (sp24 * cosine1 * cosine2);
}
-void func_80042E00(Vec3f arg0, Vec3su arg1, f32 arg2) {
+/**
+ * @brief set the matrix to a transformation matrix
+ *
+ * @param translate or position
+ * @param orientation
+ * @param scale
+ */
+void rsp_set_matrix_transformation(Vec3f translate, Vec3su orientation, f32 scale) {
Mat4 matrix;
- func_800425D0(matrix, arg0, arg1, arg2);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ mtxf_set_matrix_transformation(matrix, translate, orientation, scale);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
-UNUSED void func_80042EB8(Vec3f arg0, Vec3f arg1, f32 arg2) {
+UNUSED void rsp_set_matrix_diff_translation_scale(Vec3f pos1, Vec3f pos2, f32 scale) {
Mat4 matrix;
- func_80042760(matrix, arg0, arg1, arg2);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ mtxf_set_matrix_scale_transl(matrix, pos1, pos2, scale);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
-void func_80042F70(Vec3f arg0, Vec3su arg1, f32 arg2) {
+void rsp_set_matrix_transformation_inverted_x_y_orientation(Vec3f arg0, Vec3su arg1, f32 arg2) {
Mat4 matrix;
- Vec3su sp20;
+ Vec3su orientation;
- sp20[0] = arg1[0] + 0x8000;
- sp20[1] = arg1[1] + 0x8000;
- sp20[2] = arg1[2];
- func_800425D0(matrix, arg0, sp20, arg2);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ orientation[0] = arg1[0] + 0x8000; // change the sign
+ orientation[1] = arg1[1] + 0x8000; // change the sign
+ orientation[2] = arg1[2];
+ mtxf_set_matrix_transformation(matrix, arg0, orientation, arg2);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
-void func_80043050(Vec3f arg0,Vec3f arg1, f32 arg2) {
+void rsp_set_matrix_transl_rot_scale(Vec3f arg0,Vec3f arg1, f32 arg2) {
Mat4 matrix;
- func_80042A20(matrix, arg1, arg0, 0, arg2);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
+ set_transform_matrix(matrix, arg1, arg0, 0, arg2);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}
-void func_80043104(s32 arg0) {
- Mat4 sp20;
+void rsp_set_matrix_gObjectList(s32 transformIndex) {
+ Mat4 matrix;
- func_800427DC(arg0, sp20);
- func_80022180(&gGfxPool->mtxHud[gMatrixHudCount], sp20);
+ mtxf_set_matrix_gObjectList(transformIndex, matrix);
+ convert_to_fixed_point_matrix(&gGfxPool->mtxHud[gMatrixHudCount], matrix);
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxHud[gMatrixHudCount++]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
}