diff --git a/include/functions.h b/include/functions.h index 620dd856c2..3e84c6f6c5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1309,7 +1309,7 @@ void SkinMatrix_SetTranslateRotateYXZScale(MtxF* dest, f32 scaleX, f32 scaleY, f void SkinMatrix_SetTranslateRotateZYX(MtxF* dest, s16 rotX, s16 rotY, s16 rotZ, f32 translateX, f32 translateY, f32 translateZ); Mtx* SkinMatrix_MtxFToNewMtx(GraphicsContext* gfxCtx, MtxF* src); -void func_800A7EC0(MtxF* mf, s16 a, f32 x, f32 y, f32 z); +void SkinMatrix_SetRotateAxis(MtxF* mf, s16 angle, f32 axisX, f32 axisY, f32 axisZ); void Sram_InitNewSave(void); void Sram_InitDebugSave(void); void Sram_OpenSave(SramContext* sramCtx); @@ -1759,7 +1759,7 @@ void Matrix_RotateY(f32 y, u8 mode); void Matrix_RotateZ(f32 z, u8 mode); void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode); void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation); -void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec); +void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot); Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest); Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line); Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line); @@ -1769,12 +1769,13 @@ void Matrix_MtxFCopy(MtxF* dest, MtxF* src); void Matrix_MtxToMtxF(Mtx* src, MtxF* dest); void Matrix_MultVec3fExt(Vec3f* src, Vec3f* dest, MtxF* mf); void Matrix_Transpose(MtxF* mf); -void func_800D1FD4(MtxF* mf); +void Matrix_ReplaceRotation(MtxF* mf); void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag); void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag); -void Matrix_RotateAxis(f32 f, Vec3f* vec, u8 mode); +void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode); MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line); -void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6); +void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY, + f32 translateZ); u32 SysUcode_GetUCodeBoot(void); u32 SysUcode_GetUCodeBootSize(void); u32 SysUcode_GetUCode(void); diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index 856db9e03a..b903a77b17 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -470,59 +470,63 @@ void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation) { } } -void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) { +/** + * Set the current matrix to translate and rotate using YXZ Tait-Bryan angles. + * This means a (column) vector is first rotated around Z, then around X, then around Y, then translated. + */ +void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot) { MtxF* cmf = sCurrentMatrix; - f32 sp30 = Math_SinS(vec->y); - f32 sp2C = Math_CosS(vec->y); - f32 sp28; - f32 sp24; + f32 temp1 = Math_SinS(rot->y); + f32 temp2 = Math_CosS(rot->y); + f32 cos; + f32 sin; - cmf->xx = sp2C; - cmf->zx = -sp30; - cmf->xw = x; - cmf->yw = y; - cmf->zw = z; + cmf->xx = temp2; + cmf->zx = -temp1; + cmf->xw = translateX; + cmf->yw = translateY; + cmf->zw = translateZ; cmf->wx = 0.0f; cmf->wy = 0.0f; cmf->wz = 0.0f; cmf->ww = 1.0f; - if (vec->x != 0) { - sp24 = Math_SinS(vec->x); - sp28 = Math_CosS(vec->x); + if (rot->x != 0) { + sin = Math_SinS(rot->x); + cos = Math_CosS(rot->x); - cmf->zz = sp2C * sp28; - cmf->zy = sp2C * sp24; - cmf->xz = sp30 * sp28; - cmf->xy = sp30 * sp24; - cmf->yz = -sp24; - cmf->yy = sp28; + cmf->zz = temp2 * cos; + cmf->zy = temp2 * sin; + cmf->xz = temp1 * cos; + cmf->xy = temp1 * sin; + cmf->yz = -sin; + cmf->yy = cos; } else { - cmf->zz = sp2C; - cmf->xz = sp30; + cmf->zz = temp2; + cmf->xz = temp1; cmf->yz = 0.0f; cmf->zy = 0.0f; cmf->xy = 0.0f; cmf->yy = 1.0f; } - if (vec->z != 0) { - sp24 = Math_SinS(vec->z); - sp28 = Math_CosS(vec->z); + if (rot->z != 0) { + sin = Math_SinS(rot->z); + cos = Math_CosS(rot->z); - sp30 = cmf->xx; - sp2C = cmf->xy; - cmf->xx = sp30 * sp28 + sp2C * sp24; - cmf->xy = sp2C * sp28 - sp30 * sp24; + temp1 = cmf->xx; + temp2 = cmf->xy; + cmf->xx = temp1 * cos + temp2 * sin; + cmf->xy = temp2 * cos - temp1 * sin; - sp30 = cmf->zx; - sp2C = cmf->zy; - cmf->zx = sp30 * sp28 + sp2C * sp24; - cmf->zy = sp2C * sp28 - sp30 * sp24; + temp1 = cmf->zx; + temp2 = cmf->zy; + cmf->zx = temp1 * cos + temp2 * sin; + cmf->zy = temp2 * cos - temp1 * sin; - sp2C = cmf->yy; - cmf->yx = sp2C * sp24; - cmf->yy = sp2C * sp28; + temp2 = cmf->yy; + cmf->yx = temp2 * sin; + cmf->yy = temp2 * cos; } else { cmf->yx = 0.0f; } @@ -698,47 +702,58 @@ void Matrix_Transpose(MtxF* mf) { mf->yz = temp; } -void func_800D1FD4(MtxF* mf) { +/** + * Changes the 3x3 part of the current matrix to `mf` * S, where S is the scale in the current matrix. + * + * In details, S is a diagonal where each coefficient is the norm of the column in the 3x3 current matrix. + * The 3x3 part can then be written as R * S where R has its columns normalized. + * Since R is typically a rotation matrix, and the 3x3 part is changed from R * S to `mf` * S, this operation can be + * seen as replacing the R rotation with `mf`, hence the function name. + */ +void Matrix_ReplaceRotation(MtxF* mf) { MtxF* cmf = sCurrentMatrix; + f32 acc; f32 temp; - f32 temp2; - f32 temp3; + f32 curColNorm; - temp = cmf->xx; - temp *= temp; - temp2 = cmf->yx; - temp += SQ(temp2); - temp2 = cmf->zx; - temp += SQ(temp2); - temp3 = sqrtf(temp); + // compute the Euclidean norm of the first column of the current matrix + acc = cmf->xx; + acc *= acc; + temp = cmf->yx; + acc += SQ(temp); + temp = cmf->zx; + acc += SQ(temp); + curColNorm = sqrtf(acc); - cmf->xx = mf->xx * temp3; - cmf->yx = mf->yx * temp3; - cmf->zx = mf->zx * temp3; + cmf->xx = mf->xx * curColNorm; + cmf->yx = mf->yx * curColNorm; + cmf->zx = mf->zx * curColNorm; - temp = cmf->xy; - temp *= temp; - temp2 = cmf->yy; - temp += SQ(temp2); - temp2 = cmf->zy; - temp += SQ(temp2); - temp3 = sqrtf(temp); + // second column + acc = cmf->xy; + acc *= acc; + temp = cmf->yy; + acc += SQ(temp); + temp = cmf->zy; + acc += SQ(temp); + curColNorm = sqrtf(acc); - cmf->xy = mf->xy * temp3; - cmf->yy = mf->yy * temp3; - cmf->zy = mf->zy * temp3; + cmf->xy = mf->xy * curColNorm; + cmf->yy = mf->yy * curColNorm; + cmf->zy = mf->zy * curColNorm; - temp = cmf->xz; - temp *= temp; - temp2 = cmf->yz; - temp += SQ(temp2); - temp2 = cmf->zz; - temp += SQ(temp2); - temp3 = sqrtf(temp); + // third column + acc = cmf->xz; + acc *= acc; + temp = cmf->yz; + acc += SQ(temp); + temp = cmf->zz; + acc += SQ(temp); + curColNorm = sqrtf(acc); - cmf->xz = mf->xz * temp3; - cmf->yz = mf->yz * temp3; - cmf->zz = mf->zz * temp3; + cmf->xz = mf->xz * curColNorm; + cmf->yz = mf->yz * curColNorm; + cmf->zz = mf->zz * curColNorm; } /** @@ -844,78 +859,76 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { } /* - * Rotate the matrix by `f` radians around a unit vector `vec`. - * NB: vec is assumed to be a unit vector. + * Rotate the matrix by `angle` radians around a unit vector `axis`. + * NB: `axis` is assumed to be a unit vector. */ -void Matrix_RotateAxis(f32 f, Vec3f* vec, u8 mode) { +void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) { MtxF* cmf; f32 sin; f32 cos; f32 rCos; - f32 vrs; f32 temp1; f32 temp2; f32 temp3; f32 temp4; - f32 temp5; if (mode == MTXMODE_APPLY) { - if (f != 0) { + if (angle != 0) { cmf = sCurrentMatrix; - sin = sinf(f); - cos = cosf(f); + sin = sinf(angle); + cos = cosf(angle); + temp1 = cmf->xx; temp2 = cmf->xy; temp3 = cmf->xz; - temp1 = cmf->xx; - temp4 = (vec->x * temp1 + vec->y * temp2 + vec->z * temp3) * (1.0f - cos); - cmf->xx = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y); - cmf->xy = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z); - cmf->xz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x); + temp4 = (axis->x * temp1 + axis->y * temp2 + axis->z * temp3) * (1.0f - cos); + cmf->xx = temp1 * cos + axis->x * temp4 + sin * (temp2 * axis->z - temp3 * axis->y); + cmf->xy = temp2 * cos + axis->y * temp4 + sin * (temp3 * axis->x - temp1 * axis->z); + cmf->xz = temp3 * cos + axis->z * temp4 + sin * (temp1 * axis->y - temp2 * axis->x); temp1 = cmf->yx; temp2 = cmf->yy; temp3 = cmf->yz; - temp4 = (vec->x * temp1 + vec->y * temp2 + vec->z * temp3) * (1.0f - cos); - cmf->yx = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y); - cmf->yy = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z); - cmf->yz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x); + temp4 = (axis->x * temp1 + axis->y * temp2 + axis->z * temp3) * (1.0f - cos); + cmf->yx = temp1 * cos + axis->x * temp4 + sin * (temp2 * axis->z - temp3 * axis->y); + cmf->yy = temp2 * cos + axis->y * temp4 + sin * (temp3 * axis->x - temp1 * axis->z); + cmf->yz = temp3 * cos + axis->z * temp4 + sin * (temp1 * axis->y - temp2 * axis->x); temp1 = cmf->zx; temp2 = cmf->zy; temp3 = cmf->zz; - temp4 = (vec->x * temp1 + vec->y * temp2 + vec->z * temp3) * (1.0f - cos); - cmf->zx = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y); - cmf->zy = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z); - cmf->zz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x); + temp4 = (axis->x * temp1 + axis->y * temp2 + axis->z * temp3) * (1.0f - cos); + cmf->zx = temp1 * cos + axis->x * temp4 + sin * (temp2 * axis->z - temp3 * axis->y); + cmf->zy = temp2 * cos + axis->y * temp4 + sin * (temp3 * axis->x - temp1 * axis->z); + cmf->zz = temp3 * cos + axis->z * temp4 + sin * (temp1 * axis->y - temp2 * axis->x); } } else { cmf = sCurrentMatrix; - if (f != 0) { - sin = sinf(f); - cos = cosf(f); + if (angle != 0) { + sin = sinf(angle); + cos = cosf(angle); rCos = 1.0f - cos; - cmf->xx = vec->x * vec->x * rCos + cos; - cmf->yy = vec->y * vec->y * rCos + cos; - cmf->zz = vec->z * vec->z * rCos + cos; + cmf->xx = axis->x * axis->x * rCos + cos; + cmf->yy = axis->y * axis->y * rCos + cos; + cmf->zz = axis->z * axis->z * rCos + cos; if (0) {} - temp2 = vec->x * rCos * vec->y; - temp3 = vec->z * sin; + temp2 = axis->x * rCos * axis->y; + temp3 = axis->z * sin; cmf->yx = temp2 + temp3; cmf->xy = temp2 - temp3; - temp2 = vec->x * rCos * vec->z; - temp3 = vec->y * sin; + temp2 = axis->x * rCos * axis->z; + temp3 = axis->y * sin; cmf->zx = temp2 - temp3; cmf->xz = temp2 + temp3; - temp2 = vec->y * rCos * vec->z; - temp3 = vec->x * sin; + temp2 = axis->y * rCos * axis->z; + temp3 = axis->x * sin; cmf->zy = temp2 + temp3; cmf->yz = temp2 - temp3; @@ -963,7 +976,7 @@ MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) { return mf; } -void func_800D2A34(MtxF* mf, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { +void Matrix_SetTranslateUniformScaleMtxF(MtxF* mf, f32 scale, f32 translateX, f32 translateY, f32 translateZ) { mf->yx = 0.0f; mf->zx = 0.0f; mf->wx = 0.0f; @@ -973,131 +986,133 @@ void func_800D2A34(MtxF* mf, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { mf->xz = 0.0f; mf->yz = 0.0f; mf->wz = 0.0f; - mf->xx = arg1; - mf->yy = arg1; - mf->zz = arg1; - mf->xw = arg2; - mf->yw = arg3; - mf->zw = arg4; + mf->xx = scale; + mf->yy = scale; + mf->zz = scale; + mf->xw = translateX; + mf->yw = translateY; + mf->zw = translateZ; mf->ww = 1.0f; } -void func_800D2A98(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { +void Matrix_SetTranslateUniformScaleMtx(Mtx* mtx, f32 scale, f32 translateX, f32 translateY, f32 translateZ) { MtxF mf; - func_800D2A34(&mf, arg1, arg2, arg3, arg4); + Matrix_SetTranslateUniformScaleMtxF(&mf, scale, translateX, translateY, translateZ); guMtxF2L(&mf, mtx); } -void func_800D2AE4(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { - u16* m1 = (u16*)&mtx->m[0][0]; - u16* m2 = (u16*)&mtx->m[2][0]; - u32 temp; +void Matrix_SetTranslateUniformScaleMtx2(Mtx* mtx, f32 scale, f32 translateX, f32 translateY, f32 translateZ) { + u16* intPart = (u16*)&mtx->m[0][0]; + u16* fracPart = (u16*)&mtx->m[2][0]; + u32 fixedPoint; - temp = (s32)(arg1 * 65536.0f); - m2[0] = temp & 0xFFFF; - m1[0] = (temp >> 16) & 0xFFFF; + fixedPoint = (s32)(scale * 0x10000); + fracPart[0] = fixedPoint & 0xFFFF; + intPart[0] = (fixedPoint >> 16) & 0xFFFF; - temp = (s32)(arg1 * 65536.0f); - m1[5] = (temp >> 16) & 0xFFFF; - m2[5] = temp & 0xFFFF; + fixedPoint = (s32)(scale * 0x10000); + intPart[5] = (fixedPoint >> 16) & 0xFFFF; + fracPart[5] = fixedPoint & 0xFFFF; - temp = (s32)(arg1 * 65536.0f); - m1[10] = (temp >> 16) & 0xFFFF; - m2[10] = temp & 0xFFFF; + fixedPoint = (s32)(scale * 0x10000); + intPart[10] = (fixedPoint >> 16) & 0xFFFF; + fracPart[10] = fixedPoint & 0xFFFF; - temp = (s32)(arg2 * 65536.0f); - m1[12] = (temp >> 16) & 0xFFFF; - m2[12] = temp & 0xFFFF; + fixedPoint = (s32)(translateX * 0x10000); + intPart[12] = (fixedPoint >> 16) & 0xFFFF; + fracPart[12] = fixedPoint & 0xFFFF; - temp = (s32)(arg3 * 65536.0f); - m1[13] = (temp >> 16) & 0xFFFF; - m2[13] = temp & 0xFFFF; + fixedPoint = (s32)(translateY * 0x10000); + intPart[13] = (fixedPoint >> 16) & 0xFFFF; + fracPart[13] = fixedPoint & 0xFFFF; - temp = (s32)(arg4 * 65536.0f); - m1[14] = (temp >> 16) & 0xFFFF; - m2[14] = temp & 0xFFFF; + fixedPoint = (s32)(translateZ * 0x10000); + intPart[14] = (fixedPoint >> 16) & 0xFFFF; + fracPart[14] = fixedPoint & 0xFFFF; - m1[1] = 0; - m1[2] = 0; - m1[3] = 0; - m1[4] = 0; - m1[6] = 0; - m1[7] = 0; - m1[8] = 0; - m1[9] = 0; - m1[11] = 0; - m1[15] = 1; + intPart[1] = 0; + intPart[2] = 0; + intPart[3] = 0; + intPart[4] = 0; + intPart[6] = 0; + intPart[7] = 0; + intPart[8] = 0; + intPart[9] = 0; + intPart[11] = 0; + intPart[15] = 1; - m2[1] = 0; - m2[2] = 0; - m2[3] = 0; - m2[4] = 0; - m2[6] = 0; - m2[7] = 0; - m2[8] = 0; - m2[9] = 0; - m2[11] = 0; - m2[15] = 0; + fracPart[1] = 0; + fracPart[2] = 0; + fracPart[3] = 0; + fracPart[4] = 0; + fracPart[6] = 0; + fracPart[7] = 0; + fracPart[8] = 0; + fracPart[9] = 0; + fracPart[11] = 0; + fracPart[15] = 0; } -void func_800D2BD0(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) { - u16* m1 = (u16*)&mtx->m[0][0]; - u16* m2 = (u16*)&mtx->m[2][0]; - u32 temp; +void Matrix_SetTranslateScaleMtx1(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY, + f32 translateZ) { + u16* intPart = (u16*)&mtx->m[0][0]; + u16* fracPart = (u16*)&mtx->m[2][0]; + u32 fixedPoint; - temp = (s32)(arg1 * 65536.0f); - m1[0] = (temp >> 16) & 0xFFFF; - m2[0] = temp & 0xFFFF; + fixedPoint = (s32)(scaleX * 0x10000); + intPart[0] = (fixedPoint >> 16) & 0xFFFF; + fracPart[0] = fixedPoint & 0xFFFF; - temp = (s32)(arg2 * 65536.0f); - m1[5] = (temp >> 16) & 0xFFFF; - m2[5] = temp & 0xFFFF; + fixedPoint = (s32)(scaleY * 0x10000); + intPart[5] = (fixedPoint >> 16) & 0xFFFF; + fracPart[5] = fixedPoint & 0xFFFF; - temp = (s32)(arg3 * 65536.0f); - m1[10] = (temp >> 16) & 0xFFFF; - m2[10] = temp & 0xFFFF; + fixedPoint = (s32)(scaleZ * 0x10000); + intPart[10] = (fixedPoint >> 16) & 0xFFFF; + fracPart[10] = fixedPoint & 0xFFFF; - temp = (s32)(arg4 * 65536.0f); - m1[12] = (temp >> 16) & 0xFFFF; - m2[12] = temp & 0xFFFF; + fixedPoint = (s32)(translateX * 0x10000); + intPart[12] = (fixedPoint >> 16) & 0xFFFF; + fracPart[12] = fixedPoint & 0xFFFF; - temp = (s32)(arg5 * 65536.0f); - m1[13] = (temp >> 16) & 0xFFFF; - m2[13] = temp & 0xFFFF; + fixedPoint = (s32)(translateY * 0x10000); + intPart[13] = (fixedPoint >> 16) & 0xFFFF; + fracPart[13] = fixedPoint & 0xFFFF; - temp = (s32)(arg6 * 65536.0f); - m1[14] = (temp >> 16) & 0xFFFF; - m2[14] = temp & 0xFFFF; + fixedPoint = (s32)(translateZ * 0x10000); + intPart[14] = (fixedPoint >> 16) & 0xFFFF; + fracPart[14] = fixedPoint & 0xFFFF; - m1[1] = 0; - m1[2] = 0; - m1[3] = 0; - m1[4] = 0; - m1[6] = 0; - m1[7] = 0; - m1[8] = 0; - m1[9] = 0; - m1[11] = 0; - m1[15] = 1; + intPart[1] = 0; + intPart[2] = 0; + intPart[3] = 0; + intPart[4] = 0; + intPart[6] = 0; + intPart[7] = 0; + intPart[8] = 0; + intPart[9] = 0; + intPart[11] = 0; + intPart[15] = 1; - m2[1] = 0; - m2[2] = 0; - m2[3] = 0; - m2[4] = 0; - m2[6] = 0; - m2[7] = 0; - m2[8] = 0; - m2[9] = 0; - m2[11] = 0; - m2[15] = 0; + fracPart[1] = 0; + fracPart[2] = 0; + fracPart[3] = 0; + fracPart[4] = 0; + fracPart[6] = 0; + fracPart[7] = 0; + fracPart[8] = 0; + fracPart[9] = 0; + fracPart[11] = 0; + fracPart[15] = 0; } -void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6) { +void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY, + f32 translateZ) { Mtx_t* m = &mtx->m; - u16* m1 = (u16*)(*m)[0]; - u16* m2 = (u16*)(*m)[2]; - u32 temp; + u16* intPart = (u16*)&(*m)[0][0]; + u16* fracPart = (u16*)&(*m)[2][0]; + u32 fixedPoint; (*m)[0][1] = 0; (*m)[2][1] = 0; @@ -1105,33 +1120,32 @@ void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f (*m)[2][3] = 0; (*m)[0][4] = 0; - temp = (s32)(arg1 * 65536.0f); - (*m)[0][0] = temp; + fixedPoint = (s32)(scaleX * 0x10000); + (*m)[0][0] = fixedPoint; + intPart[1] = 0; + (*m)[2][0] = fixedPoint << 16; - m1[1] = 0; - (*m)[2][0] = temp << 16; + fixedPoint = (s32)(scaleY * 0x10000); + (*m)[0][2] = fixedPoint >> 16; + (*m)[2][2] = fixedPoint & 0xFFFF; - temp = (s32)(arg2 * 65536.0f); - (*m)[0][2] = temp >> 16; - (*m)[2][2] = temp & 0xFFFF; - - temp = (s32)(arg3 * 65536.0f); - (*m)[1][1] = temp; - m1[11] = 0; - (*m)[3][1] = temp << 16; + fixedPoint = (s32)(scaleZ * 0x10000); + (*m)[1][1] = fixedPoint; + intPart[11] = 0; + (*m)[3][1] = fixedPoint << 16; (*m)[2][4] = 0; - temp = (s32)(arg4 * 65536.0f); - m1[12] = (temp >> 16) & 0xFFFF; - m2[12] = temp & 0xFFFF; + fixedPoint = (s32)(translateX * 0x10000); + intPart[12] = (fixedPoint >> 16) & 0xFFFF; + fracPart[12] = fixedPoint & 0xFFFF; - temp = (s32)(arg5 * 65536.0f); - m1[13] = (temp >> 16) & 0xFFFF; - m2[13] = temp & 0xFFFF; + fixedPoint = (s32)(translateY * 0x10000); + intPart[13] = (fixedPoint >> 16) & 0xFFFF; + fracPart[13] = fixedPoint & 0xFFFF; - temp = (s32)(arg6 * 65536.0f); - m1[14] = (temp >> 16) & 0xFFFF; - m1[15] = 1; - (*m)[3][3] = temp << 16; + fixedPoint = (s32)(translateZ * 0x10000); + intPart[14] = (fixedPoint >> 16) & 0xFFFF; + intPart[15] = 1; + (*m)[3][3] = fixedPoint << 16; } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index b1e5366cbd..7f77064c61 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2165,13 +2165,13 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { Lights_Draw(lights, globalCtx->state.gfxCtx); if (actor->flags & ACTOR_FLAG_12) { - func_800D1694(actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x, - actor->world.pos.y + - (f32)((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y), - actor->world.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot); + Matrix_SetTranslateRotateYXZ( + actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x, + actor->world.pos.y + (f32)((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y), + actor->world.pos.z + globalCtx->mainCamera.skyboxOffset.z, &actor->shape.rot); } else { - func_800D1694(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y), - actor->world.pos.z, &actor->shape.rot); + Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y), + actor->world.pos.z, &actor->shape.rot); } Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY); diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index 443e553194..efa25dc893 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -97,7 +97,7 @@ void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, void* dlist, GlobalConte gSPSetLights1(POLY_XLU_DISP++, sDebugObjectLights); - func_800D1694(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot); + Matrix_SetTranslateRotateYXZ(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot); Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 228), diff --git a/src/code/z_draw.c b/src/code/z_draw.c index 0e26fd6abd..20ff39b0b0 100644 --- a/src/code/z_draw.c +++ b/src/code/z_draw.c @@ -422,7 +422,7 @@ void GetItem_DrawBlueFire(GlobalContext* globalCtx, s16 drawId) { 1 * -(globalCtx->state.frames * 8), 16, 32)); Matrix_Push(); Matrix_Translate(-8.0f, -2.0f, 0.0f, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 615), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[1]); @@ -450,7 +450,7 @@ void GetItem_DrawPoes(GlobalContext* globalCtx, s16 drawId) { 0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 6), 16, 32)); Matrix_Push(); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 656), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[3]); @@ -479,7 +479,7 @@ void GetItem_DrawFairy(GlobalContext* globalCtx, s16 drawId) { 0 * (globalCtx->state.frames * 0), 32, 32, 1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 6), 32, 32)); Matrix_Push(); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 698), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[2]); diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index c983175af6..5dd5d40d7a 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -48,7 +48,7 @@ void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { Math_Vec3f_Scale(&sp154, scale); SkinMatrix_SetTranslate(&sp110, sp160.x, sp160.y, sp160.z); - func_800A7EC0(&spD0, this->addAngle, sp154.x, sp154.y, sp154.z); + SkinMatrix_SetRotateAxis(&spD0, this->addAngle, sp154.x, sp154.y, sp154.z); SkinMatrix_MtxFMtxFMult(&sp110, &spD0, &sp90); SkinMatrix_SetTranslate(&sp110, -sp160.x, -sp160.y, -sp160.z); SkinMatrix_MtxFMtxFMult(&sp90, &sp110, &sp50); @@ -804,7 +804,7 @@ void EffectBlure_DrawSimpleVertices(GraphicsContext* gfxCtx, EffectBlure* this, Math_Vec3f_Scale(&sp198, scale); SkinMatrix_SetTranslate(&sp154, sp1B0.x, sp1B0.y, sp1B0.z); - func_800A7EC0(&sp114, 0x3FFF, sp198.x, sp198.y, sp198.z); + SkinMatrix_SetRotateAxis(&sp114, 0x3FFF, sp198.x, sp198.y, sp198.z); SkinMatrix_MtxFMtxFMult(&sp154, &sp114, &spD4); SkinMatrix_SetTranslate(&sp154, -sp1B0.x, -sp1B0.y, -sp1B0.z); SkinMatrix_MtxFMtxFMult(&spD4, &sp154, &sp94); diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 68137f8364..dc5228a9e0 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -471,8 +471,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { { Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); - func_800D2CEC(matrix, 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), - -130.0f + offsetX, 94.5f - offsetY, 0.0f); + Matrix_SetTranslateScaleMtx2(matrix, 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), + 1.0f - (0.32f * sp144), -130.0f + offsetX, 94.5f - offsetY, 0.0f); gSPMatrix(OVERLAY_DISP++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(OVERLAY_DISP++, sp154, 4, 0); gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 7db5569dc2..b1707a5651 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1544,7 +1544,7 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime sp12C[0] = sword; sp12C[1] = shield; - func_800D1694(pos->x, pos->y, pos->z, rot); + Matrix_SetTranslateRotateYXZ(pos->x, pos->y, pos->z, rot); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPSegment(POLY_OPA_DISP++, 0x04, seg04); diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 0ddd576214..bc6aa432c1 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -604,9 +604,10 @@ Mtx* SkinMatrix_MtxFToNewMtx(GraphicsContext* gfxCtx, MtxF* src) { } /** - * Produces a matrix which rotates vectors by angle a around a unit vector with components (x,y,z) + * Produces a matrix which rotates by binary angle `angle` around a unit vector (`axisX`,`axisY`,`axisZ`). + * NB: the rotation axis is assumed to be a unit vector. */ -void func_800A7EC0(MtxF* mf, s16 a, f32 x, f32 y, f32 z) { +void SkinMatrix_SetRotateAxis(MtxF* mf, s16 angle, f32 axisX, f32 axisY, f32 axisZ) { f32 sinA; f32 cosA; f32 xx; @@ -617,28 +618,28 @@ void func_800A7EC0(MtxF* mf, s16 a, f32 x, f32 y, f32 z) { f32 xz; f32 pad; - sinA = Math_SinS(a); - cosA = Math_CosS(a); + sinA = Math_SinS(angle); + cosA = Math_CosS(angle); - xx = x * x; - yy = y * y; - zz = z * z; - xy = x * y; - yz = y * z; - xz = x * z; + xx = axisX * axisX; + yy = axisY * axisY; + zz = axisZ * axisZ; + xy = axisX * axisY; + yz = axisY * axisZ; + xz = axisX * axisZ; mf->xx = (1.0f - xx) * cosA + xx; - mf->yx = (1.0f - cosA) * xy + z * sinA; - mf->zx = (1.0f - cosA) * xz - y * sinA; + mf->yx = (1.0f - cosA) * xy + axisZ * sinA; + mf->zx = (1.0f - cosA) * xz - axisY * sinA; mf->wx = 0.0f; - mf->xy = (1.0f - cosA) * xy - z * sinA; + mf->xy = (1.0f - cosA) * xy - axisZ * sinA; mf->yy = (1.0f - yy) * cosA + yy; - mf->zy = (1.0f - cosA) * yz + x * sinA; + mf->zy = (1.0f - cosA) * yz + axisX * sinA; mf->wy = 0.0f; - mf->xz = (1.0f - cosA) * xz + y * sinA; - mf->yz = (1.0f - cosA) * yz - x * sinA; + mf->xz = (1.0f - cosA) * xz + axisY * sinA; + mf->yz = (1.0f - cosA) * yz - axisX * sinA; mf->zz = (1.0f - zz) * cosA + zz; mf->wz = 0.0f; diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index 6a6d514455..1de9c7dca1 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -506,9 +506,9 @@ void BgBdanSwitch_Update(Actor* thisx, GlobalContext* globalCtx) { } void func_8086DF58(BgBdanSwitch* this, GlobalContext* globalCtx, Gfx* dlist) { - func_800D1694(this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->unk_1D0), - this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); + Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y + (this->dyna.actor.shape.yOffset * this->unk_1D0), + this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(this->unk_1D4, this->unk_1D0, this->unk_1D4, MTXMODE_APPLY); Gfx_DrawDListOpa(globalCtx, dlist); } diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 64fb379ffa..14833a9c55 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -1026,7 +1026,7 @@ void BgDyYoseizo_ParticleDraw(BgDyYoseizo* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, particle->envColor.r, particle->envColor.g, particle->envColor.b, 0); Matrix_Translate(particle->pos.x, particle->pos.y, particle->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(particle->scale, particle->scale, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(particle->roll, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index e9c5b565db..f505d554fd 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -490,10 +490,11 @@ void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 904); if (BgHeavyBlock_LiftedUp == this->actionFunc) { - func_800D1694(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z, &thisx->shape.rot); + Matrix_SetTranslateRotateYXZ(player->leftHandPos.x, player->leftHandPos.y, player->leftHandPos.z, + &thisx->shape.rot); Matrix_Translate(-this->unk_164.x, -this->unk_164.y, -this->unk_164.z, MTXMODE_APPLY); } else if ((thisx->gravity == 0.0f) && (BgHeavyBlock_Land == this->actionFunc)) { - func_800D1694(thisx->home.pos.x, thisx->home.pos.y, thisx->home.pos.z, &thisx->shape.rot); + Matrix_SetTranslateRotateYXZ(thisx->home.pos.x, thisx->home.pos.y, thisx->home.pos.z, &thisx->shape.rot); Matrix_Translate(-D_80884ED4.x, -D_80884ED4.y, -D_80884ED4.z, MTXMODE_APPLY); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index 11c69c08dd..1c8f600d59 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c @@ -218,8 +218,8 @@ void BgJyaBigmirror_DrawLightBeam(Actor* thisx, GlobalContext* globalCtx) { if (lift != NULL) { this->liftHeight = lift->world.pos.y; } - func_800D1694(this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, - &this->actor.shape.rot); + Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, + &this->actor.shape.rot); Matrix_Scale(0.1f, (this->liftHeight * -(1.0f / 1280.0f)) + (1779.4f / 1280.0f), 0.1f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 457), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -227,7 +227,7 @@ void BgJyaBigmirror_DrawLightBeam(Actor* thisx, GlobalContext* globalCtx) { if (lift != NULL) { if (1) {} - func_800D1694(lift->world.pos.x, lift->world.pos.y, lift->world.pos.z, &D_80893F4C); + Matrix_SetTranslateRotateYXZ(lift->world.pos.x, lift->world.pos.y, lift->world.pos.z, &D_80893F4C); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 467), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index 2ce66e6aa0..7d4b4ff3e8 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -233,7 +233,7 @@ void BgJyaBombchuiwa_Draw(Actor* thisx, GlobalContext* globalCtx) { BgJyaBombchuiwa_DrawRock(globalCtx); } if (this->drawFlags & 4) { - func_800D1694(D_80894F88.x, D_80894F88.y, D_80894F88.z, &D_80894F94); + Matrix_SetTranslateRotateYXZ(D_80894F88.x, D_80894F88.y, D_80894F88.z, &D_80894F94); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); if (this->drawFlags & 4) { BgJyaBombchuiwa_DrawLight(thisx, globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index 711c98ad4b..f4103ba574 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -545,7 +545,7 @@ void func_80896D78(BgJyaCobra* this, GlobalContext* globalCtx) { sp44.x = D_80897308[this->dyna.actor.params & 3] + this->dyna.actor.shape.rot.x; sp44.y = this->dyna.actor.shape.rot.y; sp44.z = this->dyna.actor.shape.rot.z; - func_800D1694(this->unk_180.x, this->unk_180.y, this->unk_180.z, &sp44); + Matrix_SetTranslateRotateYXZ(this->unk_180.x, this->unk_180.y, this->unk_180.z, &sp44); Matrix_Scale(0.1f, 0.1f, this->unk_190, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_cobra.c", 939), @@ -581,7 +581,7 @@ void BgJyaCobra_DrawShadow(BgJyaCobra* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp64, &this->dyna.actor.world.pos); } - func_800D1694(sp64.x, sp64.y, sp64.z, phi_a3); + Matrix_SetTranslateRotateYXZ(sp64.x, sp64.y, sp64.z, phi_a3); Matrix_Scale(D_80897548[params].x, D_80897548[params].y, D_80897548[params].z, MTXMODE_APPLY); Matrix_Translate(0.0f, 0.0f, 40.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index b68f164371..6533d99a40 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -1694,7 +1694,7 @@ void BossDodongo_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, eff->color.r, eff->color.g, eff->color.b, eff->alpha); Matrix_Translate(eff->unk_00.x, eff->unk_00.y, eff->unk_00.z, MTXMODE_NEW); - func_800D1FD4(unkMtx); + Matrix_ReplaceRotation(unkMtx); Matrix_Scale(eff->unk_2C, eff->unk_2C, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_dodongo.c", 5253), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 8f5480ab2d..617dfe0f5d 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -1529,7 +1529,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, effect->color.r, effect->color.g, effect->color.b, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_fd.c", 4046), @@ -1573,7 +1573,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_fd.c", 4104), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1596,7 +1596,7 @@ void BossFd_DrawEffects(BossFdEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_fd.c", 4154), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 7f28e46543..74ed18fe95 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -3357,7 +3357,7 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { for (i = 0; i < ARRAY_COUNT(player->bodyPartsPos); i++) { Matrix_Translate(player->bodyPartsPos[i].x, player->bodyPartsPos[i].y, player->bodyPartsPos[i].z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_49C[i], this->unk_49C[i], this->unk_49C[i], MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7384), @@ -3367,7 +3367,7 @@ void BossGanon_DrawShock(BossGanon* this, GlobalContext* globalCtx) { } else { for (i = 1; i < 15; i++) { Matrix_Translate(this->unk_2EC[i].x, this->unk_2EC[i].y, this->unk_2EC[i].z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_49C[i], this->unk_49C[i], this->unk_49C[i], MTXMODE_APPLY); if (!this->shockGlow) { @@ -3414,7 +3414,7 @@ void BossGanon_DrawHandLightBall(BossGanon* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, gDorfLightBallMaterialDL); Matrix_Translate(this->unk_260.x, this->unk_260.y, this->unk_260.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->handLightBallScale, this->handLightBallScale, this->handLightBallScale, MTXMODE_APPLY); Matrix_RotateZ(this->unk_258, 1); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7510), @@ -3452,7 +3452,7 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->unk_1A2 * -2, 0, 0x40, 0x40, 1, 0, this->unk_1A2 * 0xA, 0x40, 0x40)); Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_28C, this->unk_28C, this->unk_28C, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7588), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -3460,7 +3460,7 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { // background circle texture Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_284, this->unk_284, this->unk_284, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7601), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -3484,7 +3484,7 @@ void BossGanon_DrawBigMagicCharge(BossGanon* this, GlobalContext* globalCtx) { // light ball geometry Matrix_Translate(this->unk_278.x, this->unk_278.y, this->unk_278.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_2D0, this->unk_2D0, this->unk_2D0, MTXMODE_APPLY); Matrix_RotateZ((this->unk_1A2 * 10.0f) / 1000.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 7673), @@ -3557,7 +3557,7 @@ void BossGanon_DrawTriforce(BossGanon* this, GlobalContext* globalCtx) { Matrix_RotateX(1.1f, 1); Matrix_RotateZ(-0.99999994f, MTXMODE_APPLY); } else { - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); } Matrix_Scale(this->fwork[GDF_TRIFORCE_SCALE], this->fwork[GDF_TRIFORCE_SCALE], 1.0f, MTXMODE_APPLY); @@ -4160,7 +4160,7 @@ void BossGanon_LightBall_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); } } else if (this->unk_1A8 == 0) { - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_RotateZ((this->actor.shape.rot.z / 32768.0f) * 3.1416f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 9907), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4285,7 +4285,7 @@ void func_808E229C(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Translate(this->unk_2EC[temp].x, this->unk_2EC[temp].y, this->unk_2EC[temp].z, MTXMODE_NEW); Matrix_Scale(this->actor.scale.x * (1.0f - (i * 0.07000001f)), this->actor.scale.y * (1.0f - (i * 0.07000001f)), this->actor.scale.z * (1.0f - (i * 0.07000001f)), MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_RotateZ(((2.0f * (i * M_PI)) / 10.0f) + BINANG_TO_RAD(this->actor.shape.rot.z), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 10109), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4576,7 +4576,7 @@ void func_808E324C(Actor* thisx, GlobalContext* globalCtx) { }; Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(10.0f, 10.0f, 10.0f, MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon.c", 10534), @@ -4850,7 +4850,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { } gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, eff->alpha); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(eff->unk_3C, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 10932), @@ -4997,7 +4997,7 @@ void BossGanon_DrawEffects(GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, eff->timer * 2, eff->timer * -20, 64, 64)); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_ganon.c", 11250), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 2096859452..e3504e3c44 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -2484,7 +2484,7 @@ void func_8090464C(BossGanon2* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 170, (s16)this->unk_1B4); gDPSetEnvColor(POLY_XLU_DISP++, 255, 200, 0, 128); Matrix_Translate(this->unk_1B8.x, this->unk_1B8.y, this->unk_1B8.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_RotateZ(-0.2f, MTXMODE_APPLY); Matrix_Scale(0.6f, 0.6f, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5290), @@ -2614,7 +2614,7 @@ void func_80904D88(BossGanon2* this, GlobalContext* globalCtx) { for (i = 0; i < 15; i++) { Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_30C, this->unk_30C, this->unk_30C, MTXMODE_APPLY); Matrix_RotateZ(Rand_CenteredFloat(M_PI), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5618), @@ -2638,7 +2638,7 @@ void func_80904FC8(BossGanon2* this, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, ovl_Boss_Ganon2_DL_00B308); Matrix_Translate(sZelda->actor.world.pos.x, sZelda->actor.world.pos.y + 80.0f, sZelda->actor.world.pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->unk_384, this->unk_384, this->unk_384, MTXMODE_APPLY); Matrix_RotateZ(this->unk_388, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5661), @@ -2678,7 +2678,7 @@ void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { phi_f20 = 1.0f - ((i - 7) * 0.2333333f); // 7 / 30 } - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(200.0f * phi_f20, 200.0f * phi_f20, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(Rand_ZeroFloat(2.0f * M_PI), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_ganon2.c", 5721), diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 9fa4ec1b7a..153b94aa9c 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -2514,7 +2514,7 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) { Matrix_Translate(((BossMo_RandZeroOne() - 0.5f) * 10.0f) * this->tentScale[i - 2].x, ((BossMo_RandZeroOne() - 0.5f) * 3.0f) + phi_f20, ((BossMo_RandZeroOne() - 0.5f) * 10.0f) * this->tentScale[i - 2].z, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(phi_f22, phi_f22, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_mo.c", 6511), @@ -2967,7 +2967,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { 255, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale / effect->fwork[MO_FX_STRETCH], effect->fwork[MO_FX_STRETCH] * effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_mo.c", 7373), @@ -3018,7 +3018,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_mo.c", 7476), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index b50b2daf2f..328d65f1b0 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -2736,7 +2736,8 @@ void BossSst_DrawHand(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < end; i++) { if (Math3D_Vec3fDistSq(&trail2->world.pos, &trail->world.pos) > 900.0f) { - func_800D1694(trail->world.pos.x, trail->world.pos.y, trail->world.pos.z, &trail->world.rot); + Matrix_SetTranslateRotateYXZ(trail->world.pos.x, trail->world.pos.y, trail->world.pos.z, + &trail->world.rot); Matrix_Scale(0.02f, 0.02f, 0.02f, MTXMODE_APPLY); gSPSegment(POLY_XLU_DISP++, 0x08, sHandTrailDList); diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 48488dc985..3d499f9e02 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -3324,7 +3324,7 @@ void func_80942180(BossTw* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 245, 255, 128); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_019D40)); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6514), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPSegment(POLY_XLU_DISP++, 8, @@ -3396,7 +3396,7 @@ void func_809426F0(BossTw* this, GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, ((this->work[CS_TIMER_2] * 3) + (i * 10)) & 0x7F, (u8)((-this->work[CS_TIMER_2] * 15) + (i * 50)), 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Scale(0.4f, 0.4f, 0.4f, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6751), G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); @@ -4461,7 +4461,7 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = 1.0f - (i * 0.09f); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 8865), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); @@ -4485,7 +4485,7 @@ void BossTw_BlastDraw(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = 1.0f - (i * 0.09f); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 9004), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); @@ -4525,7 +4525,7 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = (1.0f - (i * 0.09f)); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 9071), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430)); @@ -4545,7 +4545,7 @@ void BossTw_DrawDeathBall(Actor* thisx, GlobalContext* globalCtx2) { scaleFactor = (1.0f - (i * 0.09f)); Matrix_Scale(this->actor.scale.x * scaleFactor, this->actor.scale.y * scaleFactor, this->actor.scale.z * scaleFactor, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_tw.c", 9107), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00)); @@ -4922,7 +4922,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, currentEffect->color.r, currentEffect->color.g, currentEffect->color.b, currentEffect->alpha); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9617), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4947,7 +4947,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, (currentEffect->frame * 15) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9660), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -4972,7 +4972,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, (currentEffect->frame * 15) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9709), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -5006,7 +5006,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { } Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); if (currentEffect->work[EFF_UNKS1] == 0) { Matrix_Translate(0.0f, 0.0f, 60.0f, MTXMODE_APPLY); @@ -5091,7 +5091,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (currentEffect->frame * 3) & 0x7F, (-currentEffect->frame * 15) & 0xFF, 0x20, 0x40, 1, 0, 0, 0x20, 0x20)); Matrix_Translate(currentEffect->pos.x, currentEffect->pos.y, currentEffect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9911), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index b2b33266da..8435da950b 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -3524,7 +3524,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 230, effect->primColor[3]); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_RotateZ((effect->rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.0185f, effect->scale * 0.0185f, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_va.c", 4976), @@ -3542,7 +3542,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { flag++; } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); Matrix_RotateZ((effect->rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); @@ -3577,7 +3577,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { if (effect->mode == BLOOD_SPOT) { Matrix_RotateX(M_PI / 2, MTXMODE_APPLY); } else { - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); } Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); @@ -3679,7 +3679,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 230, 230, 230, effect->primColor[3]); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_RotateZ((effect->rot.z / (f32)0x8000) * 3.1416f, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.02f, effect->scale * 0.02f, 1.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index c1ff910a78..88cb29b8ce 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -704,7 +704,7 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(this->unk_234[i] * D_8096931C[(frames + i) & 3], this->unk_234[i] * D_8096931C[(frames + i) & 3], this->unk_234[i] * D_8096931C[(frames + i) & 3], MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_demo_6k.c", 1297), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFlash1DL); diff --git a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index 89a0ef4e52..7006bb2a7b 100644 --- a/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -174,7 +174,7 @@ void EfcErupc_DrawParticles(EfcErupcParticles* particles, GlobalContext* globalC gDPSetEnvColor(POLY_XLU_DISP++, 150, 0, 0, 0); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(particles->pos.x, particles->pos.y, particles->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(particles->scale, particles->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_efc_erupc.c", 393), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 9f0f79cf35..b5ab3185d6 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -351,7 +351,7 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Scale(*distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, *distanceTraveled * this->scalingFactor, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_dust.c", 506), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index 85957a974a..a4aef47cbf 100644 --- a/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -240,7 +240,7 @@ void EnAnubiceFire_Draw(Actor* thisx, GlobalContext* globalCtx) { if (scale >= 0.1f) { Matrix_Translate(this->unk_160[i].x, this->unk_160[i].y, this->unk_160[i].z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_RotateZ(this->actor.world.rot.z + i * 1000.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_anubice_fire.c", 546), diff --git a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c index a4269abdeb..368b928af4 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -205,7 +205,7 @@ void EnBdfire_DrawFire(EnBdfire* this, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bdfire.c", 612); temp = this->unk_156 & 7; - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); func_80094BC4(globalCtx->state.gfxCtx); POLY_XLU_DISP = func_80094968(POLY_XLU_DISP); gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 6f01c7b785..c6116736d0 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -365,7 +365,7 @@ void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) { if (thisx->params == BOMB_BODY) { func_80093D18(globalCtx->state.gfxCtx); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); func_8002EBCC(thisx, globalCtx, 0); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 928), diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index e4e3f762b7..5d99928e6c 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -470,7 +470,7 @@ Gfx* EnBombf_NewMtxDList(GraphicsContext* gfxCtx, GlobalContext* globalCtx) { displayList = Graph_Alloc(gfxCtx, 5 * sizeof(Gfx)); displayListHead = displayList; - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(displayListHead++, Matrix_NewMtx(gfxCtx, "../z_en_bombf.c", 1021), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPEndDisplayList(displayListHead); diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index f5dc0689db..3ffa35d4c1 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -414,7 +414,7 @@ void EnBubble_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); Math_SmoothStepToF(&this->graphicRotSpeed, 16.0f, 0.2f, 1000.0f, 0.0f); Math_SmoothStepToF(&this->graphicEccentricity, 0.08f, 0.2f, 1000.0f, 0.0f); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(this->expansionWidth + 1.0f, this->expansionHeight + 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(((f32)globalCtx->state.frames * (M_PI / 180.0f)) * this->graphicRotSpeed, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index e3c3164deb..ad8c0e765c 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -126,8 +126,8 @@ void EnButte_DrawTransformationEffect(EnButte* this, GlobalContext* globalCtx) { Matrix_RotateX(camDir.x * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_RotateZ(camDir.z * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_MultVec3f(&D_809CE3C4, &sp5C); - func_800D1694(this->actor.focus.pos.x + sp5C.x, this->actor.focus.pos.y + sp5C.y, this->actor.focus.pos.z + sp5C.z, - &camDir); + Matrix_SetTranslateRotateYXZ(this->actor.focus.pos.x + sp5C.x, this->actor.focus.pos.y + sp5C.y, + this->actor.focus.pos.z + sp5C.z, &camDir); Matrix_Scale(sTransformationEffectScale, sTransformationEffectScale, sTransformationEffectScale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_choo.c", 317), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/src/overlays/actors/ovl_En_Bw/z_en_bw.c index c58ef46265..5dc445e97e 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -883,7 +883,7 @@ void EnBw_Draw(Actor* thisx, GlobalContext* globalCtx2) { (globalCtx->gameplayFrames * -20) % 0x200, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); Matrix_Scale(this->unk_248 * 0.01f, this->unk_248 * 0.01f, this->unk_248 * 0.01f, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bw.c", 1500), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 2970e2eb5c..1afe5686df 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -719,7 +719,7 @@ void EnClearTag_Draw(Actor* thisx, GlobalContext* globalCtx) { // Draw the Arwing Backfire Matrix_Translate(0.0f, 0.0f, -60.0f, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(2.5f, 1.3f, 0.0f, MTXMODE_APPLY); if ((this->frameCounter % 2) != 0) { Matrix_Scale(1.15f, 1.15f, 1.15f, MTXMODE_APPLY); @@ -959,7 +959,7 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, effect->random * -5, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); Matrix_Translate(0.0f, 20.0f, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_clear_tag.c", 1392), @@ -986,7 +986,7 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (effect->random * -15) & 0xFF, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_clear_tag.c", 1439), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1009,7 +1009,7 @@ void EnClearTag_DrawEffects(GlobalContext* globalCtx) { // Draw the flash billboard effect. gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 200, (s8)effect->primColor.a); Matrix_Translate(effect->position.x, effect->position.y, effect->position.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_clear_tag.c", 1470), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 83fc7c9374..2f85b482da 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -888,7 +888,7 @@ void EnFd_DrawFlames(EnFd* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (u8)((this->fadeAlpha / 255.0f) * 255)); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fd.c", 2006), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -922,7 +922,7 @@ void EnFd_DrawDots(EnFd* this, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); if (1) {} Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fd.c", 2064), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index 4b228727fe..53e7c6e981 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -711,7 +711,7 @@ void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gPhantomLightningBlastDL)); } else if ((this->actor.params == FHGFIRE_SPEAR_LIGHT) || (this->actor.params == FHGFIRE_ENERGY_BALL)) { osSyncPrintf("yari hikari draw 1\n"); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); func_80093D84(globalCtx->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s8)this->fwork[FHGFIRE_ALPHA]); diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index fd5117bca4..91254406cc 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -1047,7 +1047,7 @@ void EnFr_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec if ((limbIndex == 7) || (limbIndex == 8)) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fr.c", 1735); Matrix_Push(); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fr.c", 1738), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, *dList); diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 1a8d51f5d6..645555096f 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -470,7 +470,7 @@ void EnFw_DrawDust(EnFw* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fw.c", 1229), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 11b81a922b..7ec18b18a6 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -878,7 +878,7 @@ void EnFz_DrawIceSmoke(EnFz* this, GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 3 * (iceSmoke->timer + (3 * i)), 15 * (iceSmoke->timer + (3 * i)), 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(iceSmoke->pos.x, iceSmoke->pos.y, iceSmoke->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(iceSmoke->xyScale, iceSmoke->xyScale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_en_fz.c", 1424), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 94bdb9f37e..7e235383f1 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -535,7 +535,7 @@ void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { Matrix_Push(); Matrix_Translate(this->cagedSouls[i].translation.x, this->cagedSouls[i].translation.y, this->cagedSouls[i].translation.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); if (this->cagedSouls[i].rotate180) { Matrix_RotateZYX(0, -0x8000, 0, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 19f435ed3c..6b744868a5 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1222,7 +1222,7 @@ void EnGo_DrawDust(EnGo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go.c", 2664), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 3a324c33fd..40a0ce8f5a 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -225,7 +225,7 @@ void EnGo2_DrawDust(EnGo2* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go2_eff.c", 137), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 19eceea908..456c90bf3a 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -597,7 +597,7 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Pop(); if (this->unk_19E & 2) { func_80093D84(globalCtx->state.gfxCtx); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(0.05f, -0.05f, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_gs.c", 1087), diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 18d386c11a..d6e1b170fd 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -553,14 +553,14 @@ void EnMm_Draw(Actor* thisx, GlobalContext* globalCtx) { sp50.y = 3518; sp50.z = -13450; - func_800D1694(97.0f, -1203.0f, -240.0f, &sp50); + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, -240.0f, &sp50); Matrix_ToMtx(mtx++, "../z_en_mm.c", 1124); sp50.x = -994; sp50.y = -3518; sp50.z = -13450; - func_800D1694(97.0f, -1203.0f, 240.0f, &sp50); + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, 240.0f, &sp50); Matrix_ToMtx(mtx, "../z_en_mm.c", 1131); gSPDisplayList(POLY_OPA_DISP++, gLinkChildBunnyHoodDL); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 0fc4e230b8..76bc2d827d 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -1213,7 +1213,7 @@ void EnNiw_FeatherDraw(EnNiw* this, GlobalContext* globalCtx) { flag++; } Matrix_Translate(feather->pos.x, feather->pos.y, feather->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(feather->scale, feather->scale, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(feather->unk_30, MTXMODE_APPLY); Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c index 789104f9e2..4a94ad5a3b 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -169,7 +169,7 @@ void EnNwc_DrawChicks(EnNwc* this, GlobalContext* globalCtx) { if (chick->type != CHICK_NONE) { Mtx* mtx; - func_800D1694(chick->pos.x, chick->pos.y + chick->height, chick->pos.z, &chick->rot); + Matrix_SetTranslateRotateYXZ(chick->pos.x, chick->pos.y + chick->height, chick->pos.z, &chick->rot); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); mtx = Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nwc.c", 346); gDPSetEnvColor(dList1++, 0, 100, 255, 255); diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index 397083bbaf..c9916626df 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -777,7 +777,7 @@ void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx) { } Matrix_Translate(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(ptr->unk_2C, ptr->unk_2C, 1.0f, MTXMODE_APPLY); Matrix_RotateZ(ptr->unk_30, MTXMODE_APPLY); Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index c7e74d1428..462c41dee1 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -109,7 +109,7 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(eff->size, eff->size, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 140), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c index 196ea1d6d5..0877589844 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -742,7 +742,7 @@ void EnTp_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0.0f, 0.0f, 8.0f, MTXMODE_APPLY); } else { func_80093D84(globalCtx->state.gfxCtx); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->red, 0, 255, this->alpha); gDPPipeSync(POLY_XLU_DISP++); diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 1df3efe222..d1bfb3509c 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -221,7 +221,7 @@ void EnZo_DrawBubbles(EnZo* this, GlobalContext* globalCtx) { } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 281), @@ -254,7 +254,7 @@ void EnZo_DrawSplashes(EnZo* this, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->color.a); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zo_eff.c", 325), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index e8f0e2fafc..9c59c813b8 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -1213,7 +1213,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 180, 180, 180, effect->alpha); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2346), @@ -1241,7 +1241,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { (effect->timer + (i * 3)) * 5, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2394), @@ -1264,7 +1264,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 2423), @@ -1341,7 +1341,7 @@ void Fishing_DrawEffects(FishingEffect* effect, GlobalContext* globalCtx) { } Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_RotateY(rotY, MTXMODE_APPLY); Matrix_Scale(effect->unk_30, effect->unk_30, 1.0f, MTXMODE_APPLY); @@ -1749,7 +1749,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3239), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1766,7 +1766,7 @@ void Fishing_DrawSinkingLure(GlobalContext* globalCtx) { Matrix_Translate(sSinkingLurePos[i].x, sSinkingLurePos[i].y, sSinkingLurePos[i].z, MTXMODE_NEW); scale = sSinkingLureSizes[i + D_80B7FEA0] * 0.04f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fishing.c", 3265), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index c89d8e0476..efbf86833e 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -93,8 +93,9 @@ void ObjLightswitch_InitCollider(ObjLightswitch* this, GlobalContext* globalCtx) Collider_InitJntSph(globalCtx, &this->collider); Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderJntSphInit, this->colliderItems); - func_800D1694(this->actor.world.pos.x, this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y), - this->actor.world.pos.z, &this->actor.shape.rot); + Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, + this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y), + this->actor.world.pos.z, &this->actor.shape.rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); Collider_UpdateSpheres(0, &this->collider); } @@ -411,7 +412,7 @@ void ObjLightswitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { this->actor.world.pos.y = child->world.pos.y + 60.0f; this->actor.world.pos.z = child->world.pos.z; Math_Vec3f_Copy(&pos, &this->actor.world.pos); - func_800D1694(pos.x, pos.y, pos.z, &this->actor.shape.rot); + Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &this->actor.shape.rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); } else { pos.x = this->actor.world.pos.x; @@ -427,14 +428,14 @@ void ObjLightswitch_DrawOpa(ObjLightswitch* this, GlobalContext* globalCtx) { rot.x = this->actor.shape.rot.x; rot.y = this->actor.shape.rot.y; rot.z = this->actor.shape.rot.z + this->flameRingRot; - func_800D1694(pos.x, pos.y, pos.z, &rot); + Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 859), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, object_lightswitch_DL_000398); rot.z = this->actor.shape.rot.z - this->flameRingRot; - func_800D1694(pos.x, pos.y, pos.z, &rot); + Matrix_SetTranslateRotateYXZ(pos.x, pos.y, pos.z, &rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 873), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -468,14 +469,14 @@ void ObjLightswitch_DrawXlu(ObjLightswitch* this, GlobalContext* globalCtx) { sp60.y = this->actor.shape.rot.y; sp60.z = this->actor.shape.rot.z + this->flameRingRot; - func_800D1694(sp68.x, sp68.y, sp68.z, &sp60); + Matrix_SetTranslateRotateYXZ(sp68.x, sp68.y, sp68.z, &sp60); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 930), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_lightswitch_DL_000398); sp60.z = this->actor.shape.rot.z - this->flameRingRot; - func_800D1694(sp68.x, sp68.y, sp68.z, &sp60); + Matrix_SetTranslateRotateYXZ(sp68.x, sp68.y, sp68.z, &sp60); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_lightswitch.c", 944), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 4e85a691d0..0f2221c10d 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -203,9 +203,10 @@ void ObjSwitch_InitJntSphCollider(ObjSwitch* this, GlobalContext* globalCtx, Col Collider_InitJntSph(globalCtx, colliderJntSph); Collider_SetJntSph(globalCtx, colliderJntSph, &this->dyna.actor, colliderJntSphInit, this->jntSph.items); - func_800D1694(this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.y + this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y, - this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); + Matrix_SetTranslateRotateYXZ(this->dyna.actor.world.pos.x, + this->dyna.actor.world.pos.y + + this->dyna.actor.shape.yOffset * this->dyna.actor.scale.y, + this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); Matrix_Scale(this->dyna.actor.scale.x, this->dyna.actor.scale.y, this->dyna.actor.scale.z, MTXMODE_APPLY); Collider_UpdateSpheres(0, colliderJntSph); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index 84951dbac4..9662c5e7ca 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -105,7 +105,7 @@ void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 375), diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 6fe8aaeba1..edeb6f6882 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -93,7 +93,7 @@ void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 400), diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index 8c36cd9103..43fa8793db 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -94,7 +94,7 @@ void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 353), diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 4b18b93f42..27011c4474 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -89,7 +89,7 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 324), diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 11a13e55e5..6df36934cb 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -10340,13 +10340,13 @@ void func_8084A0E8(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDLi sp68.x = D_80858AC8.unk_02 + 0x3E2; sp68.y = D_80858AC8.unk_04 + 0xDBE; sp68.z = D_80858AC8.unk_00 - 0x348A; - func_800D1694(97.0f, -1203.0f, -240.0f, &sp68); + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, -240.0f, &sp68); Matrix_ToMtx(sp70++, "../z_player.c", 19273); sp68.x = D_80858AC8.unk_02 - 0x3E2; sp68.y = -0xDBE - D_80858AC8.unk_04; sp68.z = D_80858AC8.unk_00 - 0x348A; - func_800D1694(97.0f, -1203.0f, 240.0f, &sp68); + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, 240.0f, &sp68); Matrix_ToMtx(sp70, "../z_player.c", 19279); } @@ -10374,8 +10374,8 @@ void func_8084A0E8(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDLi D_8085486C = D_8085486C * (sp5C * (1.0f / 9.0f)); } - func_800D1694(this->actor.world.pos.x, this->actor.world.pos.y + 2.0f, this->actor.world.pos.z, - &D_80854864); + Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 2.0f, + this->actor.world.pos.z, &D_80854864); Matrix_Scale(4.0f, 4.0f, 4.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player.c", 19317), @@ -10440,10 +10440,11 @@ void Player_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_Push(); this->actor.scale.y = -this->actor.scale.y; - func_800D1694(this->actor.world.pos.x, - (this->actor.floorHeight + (this->actor.floorHeight - this->actor.world.pos.y)) + - (this->actor.shape.yOffset * this->actor.scale.y), - this->actor.world.pos.z, &this->actor.shape.rot); + Matrix_SetTranslateRotateYXZ( + this->actor.world.pos.x, + (this->actor.floorHeight + (this->actor.floorHeight - this->actor.world.pos.y)) + + (this->actor.shape.yOffset * this->actor.scale.y), + this->actor.world.pos.z, &this->actor.shape.rot); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY); Matrix_RotateX(sp78, MTXMODE_APPLY); Matrix_RotateY(sp74, MTXMODE_APPLY); diff --git a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index f4030677dc..fe68b956cd 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -70,7 +70,7 @@ void EffectSsExtra_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); func_80093D84(globalCtx->state.gfxCtx); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_ss_extra.c", 186), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTextures[this->rScoreIdx])); diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index e138bd09c2..6b204d60fe 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -103,7 +103,7 @@ void EffectSsFhgFlash_DrawLightBall(GlobalContext* globalCtx, u32 index, EffectS gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, this->rAlpha); gDPSetEnvColor(POLY_XLU_DISP++, sColors[this->rParam].r, sColors[this->rParam].g, sColors[this->rParam].b, 0); gDPPipeSync(POLY_XLU_DISP++); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); Matrix_RotateZ((this->rXZRot / 32768.0f) * 3.1416f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_fhg_flash.c", 326), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -130,7 +130,7 @@ void EffectSsFhgFlash_DrawShock(GlobalContext* globalCtx, u32 index, EffectSs* t gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_DECAL2); } else { func_80093D84(globalCtx->state.gfxCtx); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2); } diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c index 419e5516a3..002a054866 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Smoke/z_eff_ss_ice_smoke.c @@ -75,7 +75,7 @@ void EffectSsIceSmoke_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->life * 3, this->life * 15, 32, 64, 1, 0, 0, 32, 32)); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); scale = this->rScale * 0.0001f; Matrix_Scale(scale, scale, 1.0f, MTXMODE_APPLY); diff --git a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c index 577ebfe307..237ecb963b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_K_Fire/z_eff_ss_k_fire.c @@ -69,7 +69,7 @@ void EffectSsKFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (1) {} gDPPipeSync(POLY_XLU_DISP++); - func_800D1FD4(&globalCtx->billboardMtxF); + Matrix_ReplaceRotation(&globalCtx->billboardMtxF); if ((index & 1) != 0) { Matrix_RotateY(M_PI, MTXMODE_APPLY); diff --git a/tools/namefixer.py b/tools/namefixer.py index 6f4761bcd2..8edb4b7910 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -157,9 +157,17 @@ wordReplace = { "ACTIVE_CAM": "GET_ACTIVE_CAM(globalCtx)", "SkinMatrix_SetRotateRPY": "SkinMatrix_SetRotateZYX", "SkinMatrix_SetScaleRotateYRPTranslate": "SkinMatrix_SetScaleRotateYXZTranslate", + "SkinMatrix_SetScaleRotateYXZTranslate": "SkinMatrix_SetTranslateRotateYXZScale", "SkinMatrix_SetRotateRPYTranslate": "SkinMatrix_SetRotateZYXTranslate", + "SkinMatrix_SetRotateZYXTranslate": "SkinMatrix_SetTranslateRotateZYX", "Matrix_RotateRPY": "Matrix_RotateZYX", "Matrix_JointPosition": "Matrix_TranslateRotateZYX", + "func_800D1694": "Matrix_SetTranslateRotateYXZ", + "func_800D1FD4": "Matrix_ReplaceRotation", + "func_800A7EC0": "SkinMatrix_SetRotateAxis", + "func_800D2A34": "Matrix_SetTranslateUniformScaleMtxF", + "func_800D2A98": "Matrix_SetTranslateUniformScaleMtx", + "func_800D2CEC": "Matrix_SetTranslateScaleMtx2", } # [a-zA-Z0-9_]