From 03636166b35b4ff8fac5991bea51eccb071f1f31 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 17 Nov 2021 11:52:26 +0100 Subject: [PATCH] Fix matrices documentation (#952) * Update names and doc of `Matrix_RotateRPY` and `SkinMatrix_SetRotateRPY` to ZYX Tait-Bryan angles * Update name and doc of `Matrix_JointPosition` to `Matrix_TranslateRotateZYX` * `Euler ***` -> `Tait-Bryan *** angles` * Update docs of `SkinMatrix_Vec3fMtxFMultXYZW` and `SkinMatrix_Vec3fMtxFMultXYZ` * Fix doc of `SkinMatrix_MtxFMtxFMult` * Update docs of `SkinMatrix_Invert` * Change name and docs of `SkinMatrix_SetRotateYRP` to `SkinMatrix_SetRotateYXZ` * Change name and docs of `SkinMatrix_SetScaleRotateRPYTranslate` to `SkinMatrix_SetScaleRotateZYXTranslate` * Change name and docs of `SkinMatrix_SetScaleRotateYRPTranslate` to `SkinMatrix_SetScaleRotateYXZTranslate` * Change name and docs of `SkinMatrix_SetRotateRPYTranslate` to `SkinMatrix_SetRotateZYXTranslate` * Add renamed functions to `namefixer.py` * Run formatter * Consistent function names (`ABC()` if equivalent to `A() B() C()`) --- include/functions.h | 15 +- src/code/code_800430A0.c | 4 +- src/code/sys_matrix.c | 28 +- src/code/z_bgcheck.c | 4 +- src/code/z_debug_display.c | 2 +- src/code/z_eff_shield_particle.c | 4 +- src/code/z_fcurve_data_skelanime.c | 2 +- src/code/z_player_lib.c | 16 +- src/code/z_skelanime.c | 24 +- src/code/z_skin_awb.c | 8 +- src/code/z_skin_matrix.c | 438 +++++++++--------- .../actors/ovl_Arrow_Fire/z_arrow_fire.c | 2 +- .../actors/ovl_Arrow_Ice/z_arrow_ice.c | 2 +- .../actors/ovl_Arrow_Light/z_arrow_light.c | 2 +- .../actors/ovl_Bg_Breakwall/z_bg_breakwall.c | 2 +- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c | 2 +- .../ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c | 2 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 2 +- .../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c | 2 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 2 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 4 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 2 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 10 +- src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c | 2 +- src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c | 2 +- src/overlays/actors/ovl_En_Ba/z_en_ba.c | 32 +- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 4 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 2 +- src/overlays/actors/ovl_En_Bx/z_en_bx.c | 2 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 6 +- src/overlays/actors/ovl_En_Dha/z_en_dha.c | 4 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 6 +- src/overlays/actors/ovl_En_Fz/z_en_fz.c | 2 +- src/overlays/actors/ovl_En_Gb/z_en_gb.c | 8 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 6 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 2 +- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 2 +- .../ovl_En_Horse_Normal/z_en_horse_normal.c | 2 +- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 4 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 2 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 2 +- src/overlays/actors/ovl_En_Vm/z_en_vm.c | 2 +- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 2 +- src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 18 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 18 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 2 +- .../ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c | 2 +- .../z_eff_ss_kirakira.c | 2 +- .../z_eff_ss_lightning.c | 2 +- .../ovl_Effect_Ss_Stick/z_eff_ss_stick.c | 4 +- src/overlays/gamestates/ovl_title/z_title.c | 2 +- tools/namefixer.py | 5 + 53 files changed, 373 insertions(+), 357 deletions(-) diff --git a/include/functions.h b/include/functions.h index 4325f62766..0d275ba2d1 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1302,16 +1302,17 @@ s32 func_800A698C(PSkinAwb* skin, SkinLimb** limbs, MtxF* arg2, u8 arg3, u8 arg4 s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3); void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest); void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest); -void SkinMatrix_MtxFMtxFMult(MtxF* mfB, MtxF* mfA, MtxF* dest); +void SkinMatrix_MtxFMtxFMult(MtxF* mfA, MtxF* mfB, MtxF* dest); void SkinMatrix_GetClear(MtxF** mf); void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest); s32 SkinMatrix_Invert(MtxF* src, MtxF* dest); void SkinMatrix_SetScale(MtxF* mf, f32 x, f32 y, f32 z); -void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw); +void SkinMatrix_SetRotateZYX(MtxF* mf, s16 x, s16 y, s16 z); void SkinMatrix_SetTranslate(MtxF* mf, f32 x, f32 y, f32 z); -void SkinMatrix_SetScaleRotateYRPTranslate(MtxF* mf, f32 scaleX, f32 scaleY, f32 scaleZ, s16 yaw, s16 roll, s16 pitch, - f32 dx, f32 dy, f32 dz); -void SkinMatrix_SetRotateRPYTranslate(MtxF* mf, s16 roll, s16 pitch, s16 yaw, f32 dx, f32 dy, f32 dz); +void SkinMatrix_SetTranslateRotateYXZScale(MtxF* dest, f32 scaleX, f32 scaleY, f32 scaleZ, s16 rotX, s16 rotY, s16 rotZ, + f32 translateX, f32 translateY, f32 translateZ); +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 Sram_InitNewSave(void); @@ -1761,8 +1762,8 @@ void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode); void Matrix_RotateX(f32 x, u8 mode); void Matrix_RotateY(f32 y, u8 mode); void Matrix_RotateZ(f32 z, u8 mode); -void Matrix_RotateRPY(s16 x, s16 y, s16 z, u8 mode); -void Matrix_JointPosition(Vec3f* position, Vec3s* rotation); +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); Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest); Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line); diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c index b571297f5f..673c60515a 100644 --- a/src/code/code_800430A0.c +++ b/src/code/code_800430A0.c @@ -9,14 +9,14 @@ void func_800430A0(CollisionContext* colCtx, s32 bgId, Actor* actor) { Vec3f tempPos; if (DynaPoly_IsBgIdBgActor(bgId)) { - SkinMatrix_SetScaleRotateYRPTranslate( + SkinMatrix_SetTranslateRotateYXZScale( &prevTransform, colCtx->dyna.bgActors[bgId].prevTransform.scale.x, colCtx->dyna.bgActors[bgId].prevTransform.scale.y, colCtx->dyna.bgActors[bgId].prevTransform.scale.z, colCtx->dyna.bgActors[bgId].prevTransform.rot.x, colCtx->dyna.bgActors[bgId].prevTransform.rot.y, colCtx->dyna.bgActors[bgId].prevTransform.rot.z, colCtx->dyna.bgActors[bgId].prevTransform.pos.x, colCtx->dyna.bgActors[bgId].prevTransform.pos.y, colCtx->dyna.bgActors[bgId].prevTransform.pos.z); if (SkinMatrix_Invert(&prevTransform, &prevTransformInv) != 2) { - SkinMatrix_SetScaleRotateYRPTranslate( + SkinMatrix_SetTranslateRotateYXZScale( &curTransform, colCtx->dyna.bgActors[bgId].curTransform.scale.x, colCtx->dyna.bgActors[bgId].curTransform.scale.y, colCtx->dyna.bgActors[bgId].curTransform.scale.z, colCtx->dyna.bgActors[bgId].curTransform.rot.x, colCtx->dyna.bgActors[bgId].curTransform.rot.y, diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index ac2555b56b..856db9e03a 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -293,12 +293,12 @@ void Matrix_RotateZ(f32 z, u8 mode) { } /** - * Rotates the top of the matrix stack by `z` degrees, then - * rotates that matrix by `y` degrees, then rotates that matrix - * by `x` degrees. (roll-pitch-yaw) + * Rotate using ZYX Tait-Bryan angles. + * This means a (column) vector is first rotated around X, then around Y, then around Z, then (if `mode` is + * `MTXMODE_APPLY`) gets transformed according to whatever the matrix was before adding the ZYX rotation. * Original Name: Matrix_RotateXYZ, changed to reflect rotation order. */ -void Matrix_RotateRPY(s16 x, s16 y, s16 z, u8 mode) { +void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode) { MtxF* cmf = sCurrentMatrix; f32 temp1; f32 temp2; @@ -379,14 +379,16 @@ void Matrix_RotateRPY(s16 x, s16 y, s16 z, u8 mode) { cmf->wz = temp2 * cos - temp1 * sin; } } else { - SkinMatrix_SetRotateRPY(cmf, x, y, z); + SkinMatrix_SetRotateZYX(cmf, x, y, z); } } /** - * Roll-pitch-yaw rotation and position + * Translate and rotate using ZYX Tait-Bryan angles. + * This means a (column) vector is first rotated around X, then around Y, then around Z, then translated, then gets + * transformed according to whatever the matrix was previously. */ -void Matrix_JointPosition(Vec3f* position, Vec3s* rotation) { +void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation) { MtxF* cmf = sCurrentMatrix; f32 sin = Math_SinS(rotation->z); f32 cos = Math_CosS(rotation->z); @@ -395,25 +397,25 @@ void Matrix_JointPosition(Vec3f* position, Vec3s* rotation) { temp1 = cmf->xx; temp2 = cmf->xy; - cmf->xw += temp1 * position->x + temp2 * position->y + cmf->xz * position->z; + cmf->xw += temp1 * translation->x + temp2 * translation->y + cmf->xz * translation->z; cmf->xx = temp1 * cos + temp2 * sin; cmf->xy = temp2 * cos - temp1 * sin; temp1 = cmf->yx; temp2 = cmf->yy; - cmf->yw += temp1 * position->x + temp2 * position->y + cmf->yz * position->z; + cmf->yw += temp1 * translation->x + temp2 * translation->y + cmf->yz * translation->z; cmf->yx = temp1 * cos + temp2 * sin; cmf->yy = temp2 * cos - temp1 * sin; temp1 = cmf->zx; temp2 = cmf->zy; - cmf->zw += temp1 * position->x + temp2 * position->y + cmf->zz * position->z; + cmf->zw += temp1 * translation->x + temp2 * translation->y + cmf->zz * translation->z; cmf->zx = temp1 * cos + temp2 * sin; cmf->zy = temp2 * cos - temp1 * sin; temp1 = cmf->wx; temp2 = cmf->wy; - cmf->ww += temp1 * position->x + temp2 * position->y + cmf->wz * position->z; + cmf->ww += temp1 * translation->x + temp2 * translation->y + cmf->wz * translation->z; cmf->wx = temp1 * cos + temp2 * sin; cmf->wy = temp2 * cos - temp1 * sin; @@ -740,7 +742,7 @@ void func_800D1FD4(MtxF* mf) { } /** - * Gets the rotation the specified matrix represents, using Euler YXZ. + * Gets the rotation the specified matrix represents, using Tait-Bryan YXZ angles. * The flag value doesn't matter for a rotation matrix. Not 0 does extra calculation. */ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { @@ -793,7 +795,7 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { } /** - * Gets the rotation the specified matrix represents, using Euler ZYX. + * Gets the rotation the specified matrix represents, using Tait-Bryan ZYX angles. * The flag value doesn't matter for a rotation matrix. Not 0 does extra calculation. */ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index fb9a3afd26..902abe956f 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -2810,7 +2810,7 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 *polyStartIndex += pbgdata->numPolygons; *vtxStartIndex += pbgdata->numVertices; } else { - SkinMatrix_SetScaleRotateYRPTranslate( + SkinMatrix_SetTranslateRotateYXZScale( &mtx, dyna->bgActors[bgId].curTransform.scale.x, dyna->bgActors[bgId].curTransform.scale.y, dyna->bgActors[bgId].curTransform.scale.z, dyna->bgActors[bgId].curTransform.rot.x, dyna->bgActors[bgId].curTransform.rot.y, dyna->bgActors[bgId].curTransform.rot.z, @@ -3136,7 +3136,7 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) { polyIndex = *dynaRaycast->resultPoly - polyMin; poly = &dynaRaycast->dyna->bgActors[*dynaRaycast->bgId].colHeader->polyList[polyIndex]; - SkinMatrix_SetScaleRotateYRPTranslate(&srpMtx, curTransform->scale.x, curTransform->scale.y, + SkinMatrix_SetTranslateRotateYXZScale(&srpMtx, curTransform->scale.x, curTransform->scale.y, curTransform->scale.z, curTransform->rot.x, curTransform->rot.y, curTransform->rot.z, curTransform->pos.x, curTransform->pos.y, curTransform->pos.z); diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index 5ca7ce1540..f914dede67 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -76,7 +76,7 @@ void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, void* texture, GlobalCo Matrix_Translate(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW); Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); Matrix_Mult(&globalCtx->mf_11DA0, MTXMODE_APPLY); - Matrix_RotateRPY(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY); gDPLoadTextureBlock(POLY_XLU_DISP++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index 1eae4db653..fad499286c 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -192,9 +192,9 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { } SkinMatrix_SetTranslate(&spC4, this->position.x, this->position.y, this->position.z); - SkinMatrix_SetRotateRPY(&sp104, 0, elem->yaw, 0); + SkinMatrix_SetRotateZYX(&sp104, 0, elem->yaw, 0); SkinMatrix_MtxFMtxFMult(&spC4, &sp104, &sp84); - SkinMatrix_SetRotateRPY(&sp104, 0, 0, elem->pitch); + SkinMatrix_SetRotateZYX(&sp104, 0, 0, elem->pitch); SkinMatrix_MtxFMtxFMult(&sp84, &sp104, &spC4); SkinMatrix_SetTranslate(&sp104, temp1, 0.0f, 0.0f); SkinMatrix_MtxFMtxFMult(&spC4, &sp104, &sp84); diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 3bc89c0a0a..abcf4a9e37 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -120,7 +120,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* pos.y = transform->y; pos.z = transform->z; - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); if (lod == 0) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 8c9eec2a08..69cf11f671 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -758,9 +758,9 @@ void func_8008F87C(GlobalContext* globalCtx, Player* this, SkelAnime* skelAnime, sp74 = D_80126068[(void)0, gSaveContext.linkAge] - this->unk_6C4; Matrix_Push(); - Matrix_JointPosition(pos, rot); + Matrix_TranslateRotateZYX(pos, rot); Matrix_MultVec3f(&D_8012602C, &spA4); - Matrix_JointPosition(&D_80126038[(void)0, gSaveContext.linkAge], &skelAnime->jointTable[shinLimbIndex]); + Matrix_TranslateRotateZYX(&D_80126038[(void)0, gSaveContext.linkAge], &skelAnime->jointTable[shinLimbIndex]); Matrix_Translate(D_80126050[(void)0, gSaveContext.linkAge], 0.0f, 0.0f, MTXMODE_APPLY); Matrix_MultVec3f(&D_8012602C, &sp98); Matrix_MultVec3f(&D_80126070, &footprintPos); @@ -842,7 +842,7 @@ s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p if (this->unk_6C2 != 0) { Matrix_Translate(pos->x, ((Math_CosS(this->unk_6C2) - 1.0f) * 200.0f) + pos->y, pos->z, MTXMODE_APPLY); Matrix_RotateX(this->unk_6C2 * (M_PI / 0x8000), MTXMODE_APPLY); - Matrix_RotateRPY(rot->x, rot->y, rot->z, MTXMODE_APPLY); + Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); pos->x = pos->y = pos->z = 0.0f; rot->x = rot->y = rot->z = 0; } @@ -1062,7 +1062,7 @@ void Player_DrawGetItemImpl(GlobalContext* globalCtx, Player* this, Vec3f* refPo Matrix_Translate(refPos->x + (3.3f * Math_SinS(this->actor.shape.rot.y)), refPos->y + height, refPos->z + ((3.3f + (IREG(90) / 10.0f)) * Math_CosS(this->actor.shape.rot.y)), MTXMODE_NEW); - Matrix_RotateRPY(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); GetItem_Draw(globalCtx, drawIdPlusOne - 1); @@ -1207,7 +1207,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* } Matrix_Translate(-428.26f, 267.2f, -33.82f, MTXMODE_APPLY); - Matrix_RotateRPY(-0x8000, 0, 0x4000, MTXMODE_APPLY); + Matrix_RotateZYX(-0x8000, 0, 0x4000, MTXMODE_APPLY); Matrix_Scale(1.0f, this->unk_85C, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 2653), @@ -1243,7 +1243,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* if (!Player_HoldsHookshot(this) && ((hookedActor = this->heldActor) != NULL)) { if (this->stateFlags1 & 0x200) { Matrix_MultVec3f(&D_80126128, &hookedActor->world.pos); - Matrix_RotateRPY(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY); + Matrix_RotateZYX(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY); Matrix_Get(&sp14C); Matrix_MtxFToYXZRotS(&sp14C, &hookedActor->world.rot, 0); hookedActor->shape.rot = hookedActor->world.rot; @@ -1325,7 +1325,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* s32 pad; Matrix_MultVec3f(&D_80126190, &heldActor->world.pos); - Matrix_RotateRPY(0, -0x4000, -0x4000, MTXMODE_APPLY); + Matrix_RotateZYX(0, -0x4000, -0x4000, MTXMODE_APPLY); Matrix_Get(&sp44); Matrix_MtxFToYXZRotS(&sp44, &heldActor->world.rot, 0); heldActor->shape.rot = heldActor->world.rot; @@ -1359,7 +1359,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* func_80090604(globalCtx, this, &this->shieldQuad, D_8012619C); } - Matrix_JointPosition(&D_801261CC, &D_801261D8); + Matrix_TranslateRotateZYX(&D_801261CC, &D_801261D8); Matrix_Get(&this->shieldMf); } } else if (limbIndex == PLAYER_LIMB_HEAD) { diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 9e7f0ee3ab..583dfcd665 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -39,7 +39,7 @@ void SkelAnime_DrawLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** skele dList = limb->dLists[lod]; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 805), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); @@ -97,7 +97,7 @@ void SkelAnime_DrawLod(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa dList = rootLimb->dLists[lod]; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 881), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); @@ -144,7 +144,7 @@ void SkelAnime_DrawFlexLimbLod(GlobalContext* globalCtx, s32 limbIndex, void** s newDList = limbDList = limb->dLists[lod]; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(*mtx, "../z_skelanime.c", 945); { @@ -212,7 +212,7 @@ void SkelAnime_DrawFlexLod(GlobalContext* globalCtx, void** skeleton, Vec3s* joi newDList = limbDList = rootLimb->dLists[lod]; if ((overrideLimbDraw == 0) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1033); gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_LOAD); @@ -259,7 +259,7 @@ void SkelAnime_DrawLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** skele dList = limb->dList; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1103), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); @@ -315,7 +315,7 @@ void SkelAnime_DrawOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTa dList = rootLimb->dList; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1176), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, dList); @@ -362,7 +362,7 @@ void SkelAnime_DrawFlexLimbOpa(GlobalContext* globalCtx, s32 limbIndex, void** s newDList = limbDList = limb->dList; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(*limbMatricies, "../z_skelanime.c", 1242); gSPMatrix(POLY_OPA_DISP++, *limbMatricies, G_MTX_LOAD); @@ -431,7 +431,7 @@ void SkelAnime_DrawFlexOpa(GlobalContext* globalCtx, void** skeleton, Vec3s* joi newDList = limbDList = rootLimb->dList; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1327); gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_LOAD); @@ -523,7 +523,7 @@ Gfx* SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton dList = limb->dList; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, arg, &gfx)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1489), G_MTX_LOAD); gSPDisplayList(gfx++, dList); @@ -581,7 +581,7 @@ Gfx* SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable dList = rootLimb->dList; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, arg, &gfx)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (dList != NULL) { gSPMatrix(gfx++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1558), G_MTX_LOAD); gSPDisplayList(gfx++, dList); @@ -626,7 +626,7 @@ Gfx* SkelAnime_DrawFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skel newDList = limbDList = limb->dList; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, arg, &gfx)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(*mtx, "../z_skelanime.c", 1623); gSPMatrix(gfx++, *mtx, G_MTX_LOAD); @@ -691,7 +691,7 @@ Gfx* SkelAnime_DrawFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointT newDList = limbDList = rootLimb->dList; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, 1, &newDList, &pos, &rot, arg, &gfx)) { - Matrix_JointPosition(&pos, &rot); + Matrix_TranslateRotateZYX(&pos, &rot); if (newDList != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1710); gSPMatrix(gfx++, mtx, G_MTX_LOAD); diff --git a/src/code/z_skin_awb.c b/src/code/z_skin_awb.c index e5e43787a2..704c158f40 100644 --- a/src/code/z_skin_awb.c +++ b/src/code/z_skin_awb.c @@ -150,9 +150,9 @@ s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) { yRot += horse->turnRot; } - SkinMatrix_SetRotateRPYTranslate(arg1, xRot, yRot, zRot, xTransl, yTransl, zTransl); + SkinMatrix_SetTranslateRotateZYX(arg1, xRot, yRot, zRot, xTransl, yTransl, zTransl); } else { - SkinMatrix_SetRotateRPYTranslate(arg1, xRot, yRot, zRot, 0.0f, 0.0f, 0.0f); + SkinMatrix_SetTranslateRotateZYX(arg1, xRot, yRot, zRot, 0.0f, 0.0f, 0.0f); } jointRot++; for (i = 1; i < skin->skeletonHeader->limbCount; i++) { @@ -165,10 +165,10 @@ s32 func_800A6AC4(PSkinAwb* skin, MtxF* arg1, Actor* actor, s32 arg3) { yRot = jointRot->y; zRot = jointRot->z; jointRot++; - SkinMatrix_SetRotateRPYTranslate(&arg1[i], xRot, yRot, zRot, xTransl, yTransl, zTransl); + SkinMatrix_SetTranslateRotateZYX(&arg1[i], xRot, yRot, zRot, xTransl, yTransl, zTransl); } - SkinMatrix_SetScaleRotateYRPTranslate( + SkinMatrix_SetTranslateRotateYXZScale( &skin->mtx, actor->scale.x, actor->scale.y, actor->scale.z, actor->shape.rot.x, actor->shape.rot.y, actor->shape.rot.z, actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y), actor->world.pos.z); diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 7362804f69..0ddd576214 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -11,10 +11,13 @@ MtxF sMtxFClear = { // clang-format on /** - * Multiplies a 4 component row vector [ src , 1 ] by the matrix mf and writes the resulting 4 components to xyzDest + * Multiplies the matrix mf by a 4 components column vector [ src , 1 ] and writes the resulting 4 components to xyzDest * and wDest. * - * \f[ [\texttt{xyzDest}, \texttt{wDest}] = [\texttt{src}, 1] \cdot [mf] \f] + * \f[ \begin{bmatrix} \texttt{xyzDest} \\ \texttt{wDest} \\ \end{bmatrix} + * = [\texttt{mf}] \cdot + * \begin{bmatrix} \texttt{src} \\ 1 \\ \end{bmatrix} + * \f] */ void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest) { xyzDest->x = mf->xw + ((src->x * mf->xx) + (src->y * mf->xy) + (src->z * mf->xz)); @@ -24,9 +27,12 @@ void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDe } /** - * Multiplies a 4 component row vector [ src , 1 ] by the matrix mf and writes the resulting xyz components to dest. + * Multiplies the matrix mf by a 4 components column vector [ src , 1 ] and writes the resulting xyz components to dest. * - * \f[ [\texttt{dest}, -] = [\texttt{src}, 1] \cdot [mf] \f] + * \f[ \begin{bmatrix} \texttt{dest} \\ - \\ \end{bmatrix} + * = [\texttt{mf}] \cdot + * \begin{bmatrix} \texttt{src} \\ 1 \\ \end{bmatrix} + * \f] */ void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest) { f32 mx = mf->xx; @@ -49,133 +55,133 @@ void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest) { /** * Matrix multiplication, dest = mfA * mfB. - * mfA and dest should not be the same matrix. + * mfB and dest should not be the same matrix. */ -void SkinMatrix_MtxFMtxFMult(MtxF* mfB, MtxF* mfA, MtxF* dest) { - f32 x2; - f32 y2; - f32 z2; - f32 w2; +void SkinMatrix_MtxFMtxFMult(MtxF* mfA, MtxF* mfB, MtxF* dest) { + f32 cx; + f32 cy; + f32 cz; + f32 cw; //---ROW1--- - f32 x1 = mfB->xx; - f32 y1 = mfB->xy; - f32 z1 = mfB->xz; - f32 w1 = mfB->xw; + f32 rx = mfA->xx; + f32 ry = mfA->xy; + f32 rz = mfA->xz; + f32 rw = mfA->xw; //-------- - x2 = mfA->xx; - y2 = mfA->yx; - z2 = mfA->zx; - w2 = mfA->wx; - dest->xx = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xx; + cy = mfB->yx; + cz = mfB->zx; + cw = mfB->wx; + dest->xx = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xy; - y2 = mfA->yy; - z2 = mfA->zy; - w2 = mfA->wy; - dest->xy = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xy; + cy = mfB->yy; + cz = mfB->zy; + cw = mfB->wy; + dest->xy = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xz; - y2 = mfA->yz; - z2 = mfA->zz; - w2 = mfA->wz; - dest->xz = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xz; + cy = mfB->yz; + cz = mfB->zz; + cw = mfB->wz; + dest->xz = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xw; - y2 = mfA->yw; - z2 = mfA->zw; - w2 = mfA->ww; - dest->xw = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xw; + cy = mfB->yw; + cz = mfB->zw; + cw = mfB->ww; + dest->xw = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); //---ROW2--- - x1 = mfB->yx; - y1 = mfB->yy; - z1 = mfB->yz; - w1 = mfB->yw; + rx = mfA->yx; + ry = mfA->yy; + rz = mfA->yz; + rw = mfA->yw; //-------- - x2 = mfA->xx; - y2 = mfA->yx; - z2 = mfA->zx; - w2 = mfA->wx; - dest->yx = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xx; + cy = mfB->yx; + cz = mfB->zx; + cw = mfB->wx; + dest->yx = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xy; - y2 = mfA->yy; - z2 = mfA->zy; - w2 = mfA->wy; - dest->yy = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xy; + cy = mfB->yy; + cz = mfB->zy; + cw = mfB->wy; + dest->yy = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xz; - y2 = mfA->yz; - z2 = mfA->zz; - w2 = mfA->wz; - dest->yz = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xz; + cy = mfB->yz; + cz = mfB->zz; + cw = mfB->wz; + dest->yz = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xw; - y2 = mfA->yw; - z2 = mfA->zw; - w2 = mfA->ww; - dest->yw = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xw; + cy = mfB->yw; + cz = mfB->zw; + cw = mfB->ww; + dest->yw = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); //---ROW3--- - x1 = mfB->zx; - y1 = mfB->zy; - z1 = mfB->zz; - w1 = mfB->zw; + rx = mfA->zx; + ry = mfA->zy; + rz = mfA->zz; + rw = mfA->zw; //-------- - x2 = mfA->xx; - y2 = mfA->yx; - z2 = mfA->zx; - w2 = mfA->wx; - dest->zx = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xx; + cy = mfB->yx; + cz = mfB->zx; + cw = mfB->wx; + dest->zx = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xy; - y2 = mfA->yy; - z2 = mfA->zy; - w2 = mfA->wy; - dest->zy = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xy; + cy = mfB->yy; + cz = mfB->zy; + cw = mfB->wy; + dest->zy = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xz; - y2 = mfA->yz; - z2 = mfA->zz; - w2 = mfA->wz; - dest->zz = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xz; + cy = mfB->yz; + cz = mfB->zz; + cw = mfB->wz; + dest->zz = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xw; - y2 = mfA->yw; - z2 = mfA->zw; - w2 = mfA->ww; - dest->zw = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xw; + cy = mfB->yw; + cz = mfB->zw; + cw = mfB->ww; + dest->zw = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); //---ROW4--- - x1 = mfB->wx; - y1 = mfB->wy; - z1 = mfB->wz; - w1 = mfB->ww; + rx = mfA->wx; + ry = mfA->wy; + rz = mfA->wz; + rw = mfA->ww; //-------- - x2 = mfA->xx; - y2 = mfA->yx; - z2 = mfA->zx; - w2 = mfA->wx; - dest->wx = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xx; + cy = mfB->yx; + cz = mfB->zx; + cw = mfB->wx; + dest->wx = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xy; - y2 = mfA->yy; - z2 = mfA->zy; - w2 = mfA->wy; - dest->wy = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xy; + cy = mfB->yy; + cz = mfB->zy; + cw = mfB->wy; + dest->wy = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xz; - y2 = mfA->yz; - z2 = mfA->zz; - w2 = mfA->wz; - dest->wz = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xz; + cy = mfB->yz; + cz = mfB->zz; + cw = mfB->wz; + dest->wz = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); - x2 = mfA->xw; - y2 = mfA->yw; - z2 = mfA->zw; - w2 = mfA->ww; - dest->ww = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); + cx = mfB->xw; + cy = mfB->yw; + cz = mfB->zw; + cw = mfB->ww; + dest->ww = (rx * cx) + (ry * cy) + (rz * cz) + (rw * cw); } /** @@ -224,8 +230,7 @@ void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest) { } /** - * Inverts a matrix using a slight modification of the Gauss-Jordan method - * (column operations instead of row operations). + * Inverts a matrix using the Gauss-Jordan method. * returns 0 if successfully inverted * returns 2 if matrix non-invertible (0 determinant) */ @@ -235,50 +240,53 @@ s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) { s32 pad; f32 temp2; f32 temp1; - s32 thisRow; s32 thisCol; + s32 thisRow; SkinMatrix_MtxFCopy(src, &mfCopy); SkinMatrix_Clear(dest); - for (thisRow = 0; thisRow < 4; thisRow++) { - thisCol = thisRow; - while ((thisCol < 4) && (fabsf(mfCopy.mf[thisRow][thisCol]) < 0.0005f)) { - thisCol++; + for (thisCol = 0; thisCol < 4; thisCol++) { + thisRow = thisCol; + while ((thisRow < 4) && (fabsf(mfCopy.mf[thisCol][thisRow]) < 0.0005f)) { + thisRow++; } - if (thisCol == 4) { - // reaching col = 4 means the row is either all 0 or a duplicate row. - // therefore singular matrix (0 determinant). + if (thisRow == 4) { + // Reaching row = 4 means the column is either all 0 or a duplicate column. + // Therefore src is a singular matrix (0 determinant). osSyncPrintf(VT_COL(YELLOW, BLACK)); osSyncPrintf("Skin_Matrix_InverseMatrix():逆行列つくれません\n"); osSyncPrintf(VT_RST); return 2; } - if (thisCol != thisRow) { // responsible for swapping columns if zero on diagonal - for (i = 0; i < 4; i++) { - temp1 = mfCopy.mf[i][thisCol]; - mfCopy.mf[i][thisCol] = mfCopy.mf[i][thisRow]; - mfCopy.mf[i][thisRow] = temp1; - temp2 = dest->mf[i][thisCol]; - dest->mf[i][thisCol] = dest->mf[i][thisRow]; - dest->mf[i][thisRow] = temp2; + if (thisRow != thisCol) { + // Diagonal element mf[thisCol][thisCol] is zero. + // Swap the rows thisCol and thisRow. + for (i = 0; i < 4; i++) { + temp1 = mfCopy.mf[i][thisRow]; + mfCopy.mf[i][thisRow] = mfCopy.mf[i][thisCol]; + mfCopy.mf[i][thisCol] = temp1; + + temp2 = dest->mf[i][thisRow]; + dest->mf[i][thisRow] = dest->mf[i][thisCol]; + dest->mf[i][thisCol] = temp2; } } - // Scale this whole column s.t. the diag element = 1 - temp1 = mfCopy.mf[thisRow][thisRow]; + // Scale this whole row such that the diagonal element is 1. + temp1 = mfCopy.mf[thisCol][thisCol]; for (i = 0; i < 4; i++) { - mfCopy.mf[i][thisRow] /= temp1; - dest->mf[i][thisRow] /= temp1; + mfCopy.mf[i][thisCol] /= temp1; + dest->mf[i][thisCol] /= temp1; } - for (thisCol = 0; thisCol < 4; thisCol++) { - if (thisCol != thisRow) { - temp1 = mfCopy.mf[thisRow][thisCol]; + for (thisRow = 0; thisRow < 4; thisRow++) { + if (thisRow != thisCol) { + temp1 = mfCopy.mf[thisCol][thisRow]; for (i = 0; i < 4; i++) { - mfCopy.mf[i][thisCol] -= mfCopy.mf[i][thisRow] * temp1; - dest->mf[i][thisCol] -= dest->mf[i][thisRow] * temp1; + mfCopy.mf[i][thisRow] -= mfCopy.mf[i][thisCol] * temp1; + dest->mf[i][thisRow] -= dest->mf[i][thisCol] * temp1; } } } @@ -309,85 +317,84 @@ void SkinMatrix_SetScale(MtxF* mf, f32 x, f32 y, f32 z) { } /** - * Produces a rotation matrix = (roll rotation matrix) * (pitch rotation matrix) * (yaw rotation matrix) + * Produces a rotation matrix using ZYX Tait-Bryan angles. */ -void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) { - f32 cos2; - f32 sin = Math_SinS(yaw); - f32 cos = Math_CosS(yaw); +void SkinMatrix_SetRotateZYX(MtxF* mf, s16 x, s16 y, s16 z) { + f32 cos; + f32 sinZ = Math_SinS(z); + f32 cosZ = Math_CosS(z); f32 xy; - f32 sin2; + f32 sin; f32 xz; f32 yy; f32 yz; - mf->yy = cos; - mf->xy = -sin; + mf->yy = cosZ; + mf->xy = -sinZ; mf->wx = mf->wy = mf->wz = 0; mf->xw = mf->yw = mf->zw = 0; mf->ww = 1; - if (pitch != 0) { - sin2 = Math_SinS(pitch); - cos2 = Math_CosS(pitch); + if (y != 0) { + sin = Math_SinS(y); + cos = Math_CosS(y); - mf->xx = cos * cos2; - mf->xz = cos * sin2; + mf->xx = cosZ * cos; + mf->xz = cosZ * sin; - mf->yx = sin * cos2; - mf->yz = sin * sin2; - mf->zx = -sin2; - mf->zz = cos2; + mf->yx = sinZ * cos; + mf->yz = sinZ * sin; + mf->zx = -sin; + mf->zz = cos; } else { - mf->xx = cos; + mf->xx = cosZ; if (1) {} if (1) {} - xz = sin; // required to match - mf->yx = sin; + xz = sinZ; // required to match + mf->yx = sinZ; mf->zx = mf->xz = mf->yz = 0; mf->zz = 1; } - if (roll != 0) { - sin2 = Math_SinS(roll); - cos2 = Math_CosS(roll); + if (x != 0) { + sin = Math_SinS(x); + cos = Math_CosS(x); xy = mf->xy; xz = mf->xz; - mf->xy = (xy * cos2) + (xz * sin2); - mf->xz = (xz * cos2) - (xy * sin2); + mf->xy = (xy * cos) + (xz * sin); + mf->xz = (xz * cos) - (xy * sin); if (1) {} yz = mf->yz; yy = mf->yy; - mf->yy = (yy * cos2) + (yz * sin2); - mf->yz = (yz * cos2) - (yy * sin2); + mf->yy = (yy * cos) + (yz * sin); + mf->yz = (yz * cos) - (yy * sin); - if (cos2) {} - mf->zy = mf->zz * sin2; - mf->zz = mf->zz * cos2; + if (cos) {} + mf->zy = mf->zz * sin; + mf->zz = mf->zz * cos; } else { mf->zy = 0; } } /** - * Produces a rotation matrix = (yaw rotation matrix) * (roll rotation matrix) * (pitch rotation matrix) + * Produces a rotation matrix using YXZ Tait-Bryan angles. */ -void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) { - f32 cos2; - f32 sin; +void SkinMatrix_SetRotateYXZ(MtxF* mf, s16 x, s16 y, s16 z) { f32 cos; + f32 sinY = Math_SinS(y); + f32 cosY = Math_CosS(y); f32 zx; - f32 sin2; + f32 sin; f32 zy; f32 xx; f32 xy; - sin = Math_SinS(roll); - cos = Math_CosS(roll); - mf->xx = cos; - mf->zx = -sin; + + mf->xx = cosY; + mf->zx = -sinY; mf->wz = 0; mf->wy = 0; mf->wx = 0; @@ -396,43 +403,43 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) { mf->xw = 0; mf->ww = 1; - if (yaw != 0) { - sin2 = Math_SinS(yaw); - cos2 = Math_CosS(yaw); + if (x != 0) { + sin = Math_SinS(x); + cos = Math_CosS(x); - mf->zz = cos * cos2; - mf->zy = cos * sin2; + mf->zz = cosY * cos; + mf->zy = cosY * sin; - mf->xz = sin * cos2; - mf->xy = sin * sin2; - mf->yz = -sin2; - mf->yy = cos2; + mf->xz = sinY * cos; + mf->xy = sinY * sin; + mf->yz = -sin; + mf->yy = cos; } else { - mf->zz = cos; + mf->zz = cosY; if (1) {} if (1) {} - xy = sin; // required to match - mf->xz = sin; + xy = sinY; // required to match + mf->xz = sinY; mf->xy = mf->zy = mf->yz = 0; mf->yy = 1; } - if (pitch != 0) { - sin2 = Math_SinS(pitch); - cos2 = Math_CosS(pitch); + if (z != 0) { + sin = Math_SinS(z); + cos = Math_CosS(z); xx = mf->xx; xy = mf->xy; - mf->xx = (xx * cos2) + (xy * sin2); - mf->xy = xy * cos2 - (xx * sin2); + mf->xx = (xx * cos) + (xy * sin); + mf->xy = xy * cos - (xx * sin); if (1) {} zy = mf->zy; zx = mf->zx; - mf->zx = (zx * cos2) + (zy * sin2); - mf->zy = (zy * cos2) - (zx * sin2); - if (cos2) {} - mf->yx = mf->yy * sin2; - mf->yy = mf->yy * cos2; + mf->zx = (zx * cos) + (zy * sin); + mf->zy = (zy * cos) - (zx * sin); + if (cos) {} + mf->yx = mf->yy * sin; + mf->yy = mf->yy * cos; } else { mf->yx = 0; } @@ -461,45 +468,46 @@ void SkinMatrix_SetTranslate(MtxF* mf, f32 x, f32 y, f32 z) { } /** - * Produces a matrix which scales, then rotates (RPY), then translates a vector + * Produces a matrix which scales, then rotates (using ZYX Tait-Bryan angles), then translates. */ -void SkinMatrix_SetScaleRotateRPYTranslate(MtxF* mf, f32 scaleX, f32 scaleY, f32 scaleZ, s16 roll, s16 pitch, s16 yaw, - f32 dx, f32 dy, f32 dz) { +void SkinMatrix_SetTranslateRotateZYXScale(MtxF* dest, f32 scaleX, f32 scaleY, f32 scaleZ, s16 rotX, s16 rotY, s16 rotZ, + f32 translateX, f32 translateY, f32 translateZ) { MtxF mft1; MtxF mft2; - SkinMatrix_SetTranslate(mf, dx, dy, dz); - SkinMatrix_SetRotateRPY(&mft1, roll, pitch, yaw); - SkinMatrix_MtxFMtxFMult(mf, &mft1, &mft2); + SkinMatrix_SetTranslate(dest, translateX, translateY, translateZ); + SkinMatrix_SetRotateZYX(&mft1, rotX, rotY, rotZ); + SkinMatrix_MtxFMtxFMult(dest, &mft1, &mft2); SkinMatrix_SetScale(&mft1, scaleX, scaleY, scaleZ); - SkinMatrix_MtxFMtxFMult(&mft2, &mft1, mf); + SkinMatrix_MtxFMtxFMult(&mft2, &mft1, dest); } /** - * Produces a matrix which scales, then rotates (YRP), then translates a vector + * Produces a matrix which scales, then rotates (using YXZ Tait-Bryan angles), then translates. */ -void SkinMatrix_SetScaleRotateYRPTranslate(MtxF* mf, f32 scaleX, f32 scaleY, f32 scaleZ, s16 yaw, s16 roll, s16 pitch, - f32 dx, f32 dy, f32 dz) { +void SkinMatrix_SetTranslateRotateYXZScale(MtxF* dest, f32 scaleX, f32 scaleY, f32 scaleZ, s16 rotX, s16 rotY, s16 rotZ, + f32 translateX, f32 translateY, f32 translateZ) { MtxF mft1; MtxF mft2; - SkinMatrix_SetTranslate(mf, dx, dy, dz); - SkinMatrix_SetRotateYRP(&mft1, yaw, roll, pitch); - SkinMatrix_MtxFMtxFMult(mf, &mft1, &mft2); + SkinMatrix_SetTranslate(dest, translateX, translateY, translateZ); + SkinMatrix_SetRotateYXZ(&mft1, rotX, rotY, rotZ); + SkinMatrix_MtxFMtxFMult(dest, &mft1, &mft2); SkinMatrix_SetScale(&mft1, scaleX, scaleY, scaleZ); - SkinMatrix_MtxFMtxFMult(&mft2, &mft1, mf); + SkinMatrix_MtxFMtxFMult(&mft2, &mft1, dest); } /** - * Produces a matrix which rotates (RPY), then translates a vector + * Produces a matrix which rotates (using ZYX Tait-Bryan angles), then translates. */ -void SkinMatrix_SetRotateRPYTranslate(MtxF* mf, s16 roll, s16 pitch, s16 yaw, f32 dx, f32 dy, f32 dz) { - MtxF mft1; - MtxF mft2; +void SkinMatrix_SetTranslateRotateZYX(MtxF* dest, s16 rotX, s16 rotY, s16 rotZ, f32 translateX, f32 translateY, + f32 translateZ) { + MtxF rotation; + MtxF translation; - SkinMatrix_SetTranslate(&mft2, dx, dy, dz); - SkinMatrix_SetRotateRPY(&mft1, roll, pitch, yaw); - SkinMatrix_MtxFMtxFMult(&mft2, &mft1, mf); + SkinMatrix_SetTranslate(&translation, translateX, translateY, translateZ); + SkinMatrix_SetRotateZYX(&rotation, rotX, rotY, rotZ); + SkinMatrix_MtxFMtxFMult(&translation, &rotation, dest); } void SkinMatrix_Vec3fToVec3s(Vec3f* src, Vec3s* dest) { diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 81d576d117..d1324e002d 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -226,7 +226,7 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { func_80093D84(globalCtx->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); - Matrix_RotateRPY(0x4000, 0x0, 0x0, MTXMODE_APPLY); + Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); if (this->timer != 0) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); } else { diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index 53009d2da2..07d8312a30 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -225,7 +225,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 128); - Matrix_RotateRPY(0x4000, 0x0, 0x0, MTXMODE_APPLY); + Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); if (this->timer != 0) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); } else { diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index 56f14bb07f..fd1d1415ea 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -223,7 +223,7 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128); - Matrix_RotateRPY(0x4000, 0x0, 0x0, MTXMODE_APPLY); + Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); if (this->timer != 0) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); } else { diff --git a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index 7e1cff29e9..e3b9b831d6 100644 --- a/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -164,7 +164,7 @@ Actor* BgBreakwall_SpawnFragments(GlobalContext* globalCtx, BgBreakwall* this, V angle1 = ABS(this->dyna.actor.world.rot.y) + angle2; Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, + Matrix_RotateZYX(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, MTXMODE_APPLY); Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index b8fff6b70f..64f5a76b9a 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -366,7 +366,7 @@ void func_8088BC40(GlobalContext* globalCtx, BgHidanRock* this) { MTXMODE_NEW); } - Matrix_RotateRPY(0, Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000, 0, MTXMODE_APPLY); Matrix_Translate(-10.5f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(6.0f, this->unk_16C, 6.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c index 0ad8d98cd1..1f51016a0f 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Eye/z_bg_menkuri_eye.c @@ -133,7 +133,7 @@ void BgMenkuriEye_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 200, 0, 0, 255); } Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); 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_bg_menkuri_eye.c", 331), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index e33a3fcf01..4777c7a22a 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -248,7 +248,7 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) { } else { Matrix_Translate(1999.0f, 1278.0f, -1821.0f, MTXMODE_NEW); } - Matrix_RotateRPY(0, -0x8000, this->dyna.actor.shape.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(0, -0x8000, this->dyna.actor.shape.rot.z, MTXMODE_APPLY); Matrix_Translate(0.0f, -50.0f, 0.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 652), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 5eb506a079..123365c081 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -441,7 +441,7 @@ void BgYdanSp_Draw(Actor* thisx, GlobalContext* globalCtx) { } for (i = 0; i < 8; i++) { Matrix_Put(&mtxF); - Matrix_RotateRPY(-0x5A0, i * 0x2000, 0, MTXMODE_APPLY); + Matrix_RotateZYX(-0x5A0, i * 0x2000, 0, MTXMODE_APPLY); Matrix_Translate(0.0f, 700.0f, -900.0f, MTXMODE_APPLY); Matrix_Scale(3.5f, 5.0f, 1.0f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_sp.c", 830), 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 6104aeae79..4badf4551a 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -1059,7 +1059,7 @@ s32 BossDodongo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** goto block_1; } block_1: - Matrix_JointPosition(pos, rot); + Matrix_TranslateRotateZYX(pos, rot); if (*dList != NULL) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_dodongo.c", 3787); diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index fabe83577f..a9ac3709fb 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -2002,7 +2002,7 @@ s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 255); } - Matrix_JointPosition(pos, rot); + Matrix_TranslateRotateZYX(pos, rot); if (*dList != NULL) { Matrix_Push(); @@ -2021,7 +2021,7 @@ s32 BossGoma_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLi case BOSSGOMA_LIMB_TAIL3: case BOSSGOMA_LIMB_TAIL2: case BOSSGOMA_LIMB_TAIL1: - Matrix_JointPosition(pos, rot); + Matrix_TranslateRotateZYX(pos, rot); if (*dList != NULL) { Matrix_Push(); 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 38f060391d..52beb885ab 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -3174,7 +3174,7 @@ void BossSst_DrawEffect(Actor* thisx, GlobalContext* globalCtx) { effect->pos.z + this->actor.world.pos.z, MTXMODE_NEW); } - Matrix_RotateRPY(effect->rot.x, effect->rot.y, effect->rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(effect->rot.x, effect->rot.y, effect->rot.z, MTXMODE_APPLY); Matrix_Scale(effect->scale * 0.001f, effect->scale * 0.001f, effect->scale * 0.001f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_boss_sst.c", 7350), 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 9186b2fbc1..4fdda59ef2 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -401,7 +401,7 @@ void BossVa_AttachToBody(BossVa* this) { BossVa* vaBody = GET_BODY(this); Matrix_Translate(vaBody->actor.world.pos.x, vaBody->actor.world.pos.y, vaBody->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(vaBody->actor.shape.rot.x, 0, vaBody->actor.shape.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(vaBody->actor.shape.rot.x, 0, vaBody->actor.shape.rot.z, MTXMODE_APPLY); Matrix_MultVec3f(&sInitPosOffsets[this->actor.params], &this->actor.world.pos); switch (this->actor.params) { @@ -3086,7 +3086,7 @@ void BossVa_ZapperPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL sp3C = this->headRot.y; Matrix_Push(); Matrix_Translate(this->effectPos[9].x, this->effectPos[9].y, this->effectPos[9].z, MTXMODE_NEW); - Matrix_RotateRPY(sp3E, sp3C, 0, MTXMODE_APPLY); + Matrix_RotateZYX(sp3E, sp3C, 0, MTXMODE_APPLY); sp70.x = 0.0f; if (sFightPhase >= PHASE_4) { sp70.z = ((this->timer2 - 16) & 7) * 120.0f; @@ -3251,7 +3251,7 @@ void BossVa_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&sZeroVec, &this->effectPos[1]); Matrix_Push(); Matrix_Translate(spBC.x, spBC.y, spBC.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, 0, MTXMODE_APPLY); sp80.z = sp74.z = this->unk_1A0; spB0.z = (this->timer2 & 0xF) * (this->unk_1A0 * 0.0625f); Matrix_MultVec3f(&spB0, &this->effectPos[0]); @@ -3628,7 +3628,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { effect->primColor[3]); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_RotateRPY(effect->rot.x, effect->rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(effect->rot.x, effect->rot.y, 0, MTXMODE_APPLY); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); Matrix_RotateX(effect->offset.x * 0.115f, MTXMODE_APPLY); Matrix_RotateY(effect->offset.x * 0.13f, MTXMODE_APPLY); @@ -3658,7 +3658,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, effect->primColor[3]); Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_RotateRPY(effect->rot.x, effect->rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(effect->rot.x, effect->rot.y, 0, MTXMODE_APPLY); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_va.c", 5152), diff --git a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c index f2e5efa0e0..9cd856cbb8 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -197,7 +197,7 @@ void DemoExt_DrawVortex(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(gfxCtx, "../z_demo_ext.c", 460); Matrix_Push(); Matrix_Scale(scale->x, scale->y, scale->z, MTXMODE_APPLY); - Matrix_RotateRPY((s16)(kREG(16) + 0x4000), this->rotationPitch, kREG(18), MTXMODE_APPLY); + Matrix_RotateZYX((s16)(kREG(16) + 0x4000), this->rotationPitch, kREG(18), MTXMODE_APPLY); Matrix_Translate(kREG(22), kREG(23), kREG(24), MTXMODE_APPLY); Matrix_ToMtx(mtx, "../z_demo_ext.c", 476); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 2466dab68d..3314a982ec 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -298,7 +298,7 @@ void DemoGj_DrawRotated(DemoGj* this, GlobalContext* globalCtx, Gfx* displayList OPEN_DISPS(gfxCtx, "../z_demo_gj.c", 1187); Matrix_Push(); - Matrix_RotateRPY(x, y, z, MTXMODE_APPLY); + Matrix_RotateZYX(x, y, z, MTXMODE_APPLY); Matrix_ToMtx(matrix, "../z_demo_gj.c", 1193); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index a99b1e33c5..626fb2f4cb 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -165,14 +165,14 @@ void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) { for (i = 12; i >= 0; i--) { func_80035844(&this->unk158[i + 1], &this->unk158[i], &sp5C, 0); Matrix_Translate(this->unk158[i + 1].x, this->unk158[i + 1].y, this->unk158[i + 1].z, MTXMODE_NEW); - Matrix_RotateRPY(sp5C.x, sp5C.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(sp5C.x, sp5C.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[i]); } func_80035844(&this->unk158[0], &this->unk2FC, &sp5C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk2A8[0].y, 3, this->unk31C, 182); Math_SmoothStepToS(&this->actor.shape.rot.x, this->unk2A8[0].x, 3, this->unk31C, 182); - Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); this->unk2A8[13].y = sp5C.y; this->unk2A8[13].x = sp5C.x + 0x8000; @@ -181,7 +181,7 @@ void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) { Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); Math_SmoothStepToS(&this->unk2A8[i].y, this->unk2A8[i + 1].y, 3, this->unk31C, 182); Math_SmoothStepToS(&this->unk2A8[i].x, this->unk2A8[i + 1].x, 3, this->unk31C, 182); - Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); } this->unk2A8[13].x = this->unk2A8[12].x; @@ -257,14 +257,14 @@ void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, sp58.y, 1, this->unk31C, 0); Math_SmoothStepToS(&this->actor.shape.rot.x, (sp58.x + 0x8000), 1, this->unk31C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY((this->actor.shape.rot.x - 0x8000), this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX((this->actor.shape.rot.x - 0x8000), this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); for (i = 0; i < 13; i++) { Math_SmoothStepToS(&this->unk2A8[i].x, (i * 1200) - 0x4000, 1, this->unk31C, 0); Math_SmoothStepToS(&this->unk2A8[i].y, phi_fp, 1, this->unk31C, 0); Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateRPY((this->unk2A8[i].x - 0x8000), this->unk2A8[i].y, 0, MTXMODE_APPLY); + Matrix_RotateZYX((this->unk2A8[i].x - 0x8000), this->unk2A8[i].y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); } } else { @@ -280,7 +280,7 @@ void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.x, temp, 1, this->unk31C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, this->unk158); for (i = 0; i < 13; i++) { @@ -288,7 +288,7 @@ void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->unk2A8[i].x, temp - 0x4000, 1, this->unk31C, 0); Math_SmoothStepToS(&this->unk2A8[i].y, phi_fp, 1, this->unk31C, 0); Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); } this->unk31A--; @@ -350,14 +350,14 @@ void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx) { for (i = 12; i >= 0; i--) { func_80035844(&this->unk158[i + 1], &this->unk158[i], &sp6C, 0); Matrix_Translate(this->unk158[i + 1].x, this->unk158[i + 1].y, this->unk158[i + 1].z, MTXMODE_NEW); - Matrix_RotateRPY(sp6C.x, sp6C.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(sp6C.x, sp6C.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[i]); } func_80035844(&this->actor.world.pos, &this->unk158[0], &sp6C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); Math_SmoothStepToS(&this->actor.shape.rot.y, sp6C.y, 3, this->unk31C, 182); Math_SmoothStepToS(&this->actor.shape.rot.x, sp6C.x + 0x8000, 3, this->unk31C, 182); - Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); for (i = 0; i < 13; i++) { @@ -365,7 +365,7 @@ void EnBa_RecoilFromDamage(EnBa* this, GlobalContext* globalCtx) { Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); Math_SmoothStepToS(&this->unk2A8[i].y, sp6C.y, 3, this->unk31C, 182); Math_SmoothStepToS(&this->unk2A8[i].x, sp6C.x + 0x8000, 3, this->unk31C, 182); - Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); } @@ -395,14 +395,14 @@ void func_809B75A0(EnBa* this, GlobalContext* globalCtx2) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, this->unk31C, 0); Math_SmoothStepToS(&this->actor.shape.rot.x, unk_temp, 1, this->unk31C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); this->actor.flags &= ~1; for (i = 5; i < 13; i++) { Math_SmoothStepToS(&this->unk2A8[i].x, this->unk2A8[5].x, 1, this->unk31C, 0); Math_SmoothStepToS(&this->unk2A8[i].y, this->unk2A8[5].y, 1, this->unk31C, 0); Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&sp74, &this->unk158[i + 1]); } this->unk31A = 15; @@ -422,21 +422,21 @@ void EnBa_Die(EnBa* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, this->unk31C, 0); Math_SmoothStepToS(&this->actor.shape.rot.x, temp, 1, this->unk31C, 0); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.shape.rot.x - 0x8000, this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[0]); for (i = 0; i < 5; i++) { temp = -Math_CosS(this->unk31A * 0x444) * (i * 400); Math_SmoothStepToS(&this->unk2A8[i].x, temp - 0x4000, 1, this->unk31C, 0); Math_SmoothStepToS(&this->unk2A8[i].y, this->actor.yawTowardsPlayer, 1, this->unk31C, 0); Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&D_809B8080, &this->unk158[i + 1]); } for (i = 5; i < 13; i++) { Math_SmoothStepToS(&this->unk2A8[i].x, this->unk2A8[5].x, 1, this->unk31C, 0); Math_SmoothStepToS(&this->unk2A8[i].y, this->unk2A8[5].y, 1, this->unk31C, 0); Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateRPY(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk2A8[i].x - 0x8000, this->unk2A8[i].y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&sp6C, &this->unk158[i + 1]); } this->unk31A--; @@ -487,7 +487,7 @@ void EnBa_Draw(Actor* thisx, GlobalContext* globalCtx) { (globalCtx->gameplayFrames * -10) % 128, 32, 32)); for (i = 0; i < 14; i++, mtx++) { Matrix_Translate(this->unk158[i].x, this->unk158[i].y, this->unk158[i].z, MTXMODE_NEW); - Matrix_RotateRPY(this->unk2A8[i].x, this->unk2A8[i].y, this->unk2A8[i].z, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk2A8[i].x, this->unk2A8[i].y, this->unk2A8[i].z, MTXMODE_APPLY); Matrix_Scale(this->unk200[i].x, this->unk200[i].y, this->unk200[i].z, MTXMODE_APPLY); if ((i == 6) || (i == 13)) { switch (i) { diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 548ea42245..25530486df 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -953,7 +953,7 @@ void EnBb_InitGreen(EnBb* this, GlobalContext* globalCtx) { EnBb_FaceWaypoint(this); } Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, 0, MTXMODE_APPLY); Matrix_RotateZ(this->bobPhase, MTXMODE_APPLY); bobOffset.y = this->bobSize; Matrix_MultVec3f(&bobOffset, &this->actor.world.pos); @@ -1030,7 +1030,7 @@ void EnBb_Green(EnBb* this, GlobalContext* globalCtx) { this->bobSpeedMod = Rand_ZeroOne() * 0.05f; } Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, 0, MTXMODE_APPLY); Matrix_RotateZ(this->bobPhase, MTXMODE_APPLY); bobOffset.y = this->bobSize; Matrix_MultVec3f(&bobOffset, &nextPos); 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 81cc71bf19..a52ecf5682 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -373,7 +373,7 @@ void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 928), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gBombCapDL); - Matrix_RotateRPY(0x4000, 0, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0x4000, 0, 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 934), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gDPPipeSync(POLY_OPA_DISP++); diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index 40adca64ad..f8fd77032a 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -232,7 +232,7 @@ void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { for (i = 0; i < 4; i++, mtx++) { Matrix_Translate(this->unk_154[i].x, this->unk_154[i].y, this->unk_154[i].z, MTXMODE_NEW); - Matrix_RotateRPY(this->unk_1B4[i].x, this->unk_1B4[i].y, this->unk_1B4[i].z, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk_1B4[i].x, this->unk_1B4[i].y, this->unk_1B4[i].z, MTXMODE_APPLY); Matrix_Scale(this->unk_184[i].x, this->unk_184[i].y, this->unk_184[i].z, MTXMODE_APPLY); Matrix_ToMtx(mtx, "../z_en_bx.c", 507); } diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 41de49adb6..526e82aefb 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1155,7 +1155,7 @@ void EnDekubaba_DrawStemRetracted(EnDekubaba* this, GlobalContext* globalCtx) { Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y + (-6.0f * this->size), this->actor.home.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->stemSectionAngle[0], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->stemSectionAngle[0], this->actor.shape.rot.y, 0, MTXMODE_APPLY); Matrix_Scale(horizontalScale, horizontalScale, horizontalScale, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2461), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1201,7 +1201,7 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { mtx.zw -= horizontalStepSize * Math_CosS(this->actor.shape.rot.y); Matrix_Put(&mtx); - Matrix_RotateRPY(this->stemSectionAngle[i], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->stemSectionAngle[i], this->actor.shape.rot.y, 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2533), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1236,7 +1236,7 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { void EnDekubaba_DrawStemBasePruned(EnDekubaba* this, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2579); - Matrix_RotateRPY(this->stemSectionAngle[2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->stemSectionAngle[2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dekubaba.c", 2586), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/src/overlays/actors/ovl_En_Dha/z_en_dha.c index 297d0f03dd..fa10dd884d 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -264,11 +264,11 @@ void EnDha_Wait(EnDha* this, GlobalContext* globalCtx) { func_80035844(&this->armPos, &this->handPos[0], &angle, 0); Matrix_Translate(this->handPos[0].x, this->handPos[0].y, this->handPos[0].z, MTXMODE_NEW); - Matrix_RotateRPY(angle.x, angle.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(angle.x, angle.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&armPosMultiplier2, &this->armPos); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); func_80035844(&this->actor.world.pos, &this->armPos, &angle, 0); - Matrix_RotateRPY(angle.x, angle.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(angle.x, angle.y, 0, MTXMODE_APPLY); Matrix_MultVec3f(&armPosMultiplier1, &this->armPos); this->limbAngleX[0] = Math_Vec3f_Pitch(&this->actor.world.pos, &this->armPos); yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->armPos) - this->actor.shape.rot.y; 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 db3b7a4d3d..5630cc6a24 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -544,7 +544,7 @@ void EnFr_ButterflyPath(EnFr* this, GlobalContext* globalCtx) { this->xyAngleButterfly += 0x1000; Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); vec1.x = vec1.y = 0.0f; vec1.z = 25.0f; Matrix_MultVec3f(&vec1, &vec2); @@ -553,7 +553,7 @@ void EnFr_ButterflyPath(EnFr* this, GlobalContext* globalCtx) { this->posButterfly.y = (2.0f * Math_CosS(this->xyAngleButterfly)) + (this->posLogSpot.y + 50.0f); this->posButterfly.z = (Math_CosS(rotY) * sin) + vec2.z; Matrix_Translate(this->posButterfly.x, this->posButterfly.y, this->posButterfly.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); vec1.x = 0.0f; vec1.y = -15.0f; vec1.z = 20.0f; @@ -1081,7 +1081,7 @@ void EnFr_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->isButterflyDrawn) { Matrix_Translate(this->posButterfly.x, this->posButterfly.y, this->posButterfly.z, MTXMODE_NEW); Matrix_Scale(0.015f, 0.015f, 0.015f, MTXMODE_APPLY); - Matrix_RotateRPY(this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, MTXMODE_APPLY); SkelAnime_DrawOpa(globalCtx, this->skelAnimeButterfly.skeleton, this->skelAnimeButterfly.jointTable, NULL, NULL, NULL); } 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 22ce54ec61..5a91d14538 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -224,7 +224,7 @@ void EnFz_UpdateTargetPos(EnFz* this, GlobalContext* globalCtx) { pos.z = this->actor.world.pos.z; Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.shape.rot.x, this->actor.shape.rot.y, this->actor.shape.rot.z, MTXMODE_APPLY); vec1.x = vec1.y = 0.0f; vec1.z = 220.0f; Matrix_MultVec3f(&vec1, &this->wallHitPos); 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 d94b6da8a6..307b859b72 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -207,7 +207,7 @@ void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) { this->lightColor.a = 200; Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, + Matrix_RotateZYX(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, MTXMODE_APPLY); focusOffset.x = focusOffset.y = 0.0f; focusOffset.z = 44.0f; @@ -232,7 +232,7 @@ void func_80A2F608(EnGb* this) { Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, + Matrix_RotateZYX(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, MTXMODE_APPLY); sp48.x = sp48.y = 0.0f; sp48.z = 25.0f; @@ -244,7 +244,7 @@ void func_80A2F608(EnGb* this) { for (i = 0; i < ARRAY_COUNT(sBottlesPositions); i++) { Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, + Matrix_RotateZYX(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, MTXMODE_APPLY); Matrix_MultVec3f(&sBottlesPositions[i], &sp3C); this->bottlesColliders[i].dim.pos.x = sp3C.x; @@ -540,7 +540,7 @@ void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) { func_800D1FD4(&globalCtx->mf_11DA0); if (this->cagedSouls[i].rotate180) { - Matrix_RotateRPY(0, -0x8000, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, -0x8000, 0, MTXMODE_APPLY); } Matrix_Scale(0.007f, 0.007f, 1.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 43d5584447..ccbeb8a999 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -296,7 +296,7 @@ void func_80A3E090(EnGm* this) { Matrix_Push(); Matrix_Translate(0.0f, 0.0f, 2600.0f, MTXMODE_APPLY); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); vec1.x = vec1.y = vec1.z = 0.0f; Matrix_MultVec3f(&vec1, &vec2); this->collider.dim.pos.x = vec2.x; @@ -305,12 +305,12 @@ void func_80A3E090(EnGm* this) { Matrix_Pop(); Matrix_Push(); Matrix_Translate(0.0f, 0.0f, 4300.0f, MTXMODE_APPLY); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); vec1.x = vec1.y = vec1.z = 0.0f; Matrix_MultVec3f(&vec1, &this->talkPos); Matrix_Pop(); Matrix_Translate(0.0f, 0.0f, 3800.0f, MTXMODE_APPLY); - Matrix_RotateRPY(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, MTXMODE_APPLY); vec1.x = vec1.y = vec1.z = 0.0f; Matrix_MultVec3f(&vec1, &this->actor.focus.pos); this->actor.focus.pos.y += 100.0f; 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 894c2056de..a3600e5221 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1068,7 +1068,7 @@ void EnGo_DrawRolling(EnGo* this, GlobalContext* globalCtx) { Matrix_Push(); func_80093D18(globalCtx->state.gfxCtx); - Matrix_RotateRPY((s16)(globalCtx->state.frames * ((s16)this->actor.speedXZ * 1400)), 0, this->actor.shape.rot.z, + Matrix_RotateZYX((s16)(globalCtx->state.frames * ((s16)this->actor.speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go.c", 2368), 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 280459b81e..cacef5e040 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1971,7 +1971,7 @@ s32 EnGo2_DrawRolling(EnGo2* this, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go2.c", 2914); func_80093D18(globalCtx->state.gfxCtx); speedXZ = this->actionFunc == EnGo2_ReverseRolling ? 0.0f : this->actor.speedXZ; - Matrix_RotateRPY((globalCtx->state.frames * ((s16)speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); + Matrix_RotateZYX((globalCtx->state.frames * ((s16)speedXZ * 1400)), 0, this->actor.shape.rot.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go2.c", 2926), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00C140); diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index f338e37368..c44ddf6992 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -684,7 +684,7 @@ void EnHorseNormal_Draw(Actor* thisx, GlobalContext* globalCtx) { } } func_80A6CC88(globalCtx, this, &clonePos); - SkinMatrix_SetScaleRotateYRPTranslate(&skinMtx, this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, + SkinMatrix_SetTranslateRotateYXZScale(&skinMtx, this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, this->actor.shape.rot.x, cloneRotY, this->actor.shape.rot.z, clonePos.x, (this->actor.shape.yOffset * this->actor.scale.y) + clonePos.y, clonePos.z); diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index e49eea5842..57c19565f9 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -491,7 +491,7 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_RotateRPY(this->actor.shape.rot.x, this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->actor.shape.rot.x, this->actor.shape.rot.y, 0, MTXMODE_APPLY); if (this->actionFunc == EnKarebaba_Dying) { stemSections = 2; @@ -527,7 +527,7 @@ void EnKarebaba_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(POLY_OPA_DISP++, gDekuBabaBaseLeavesDL); if (this->actionFunc == EnKarebaba_Dying) { - Matrix_RotateRPY(-0x4000, (s16)(this->actor.shape.rot.y - this->actor.home.rot.y), 0, MTXMODE_APPLY); + Matrix_RotateZYX(-0x4000, (s16)(this->actor.shape.rot.y - this->actor.home.rot.y), 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_karebaba.c", 1155), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 77e5916299..06eeb3e7f2 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -1405,7 +1405,7 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); - Matrix_RotateRPY(0, (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000), 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000), 0, MTXMODE_APPLY); if (this->actionFunc == func_80ADAFC0) { phi_f20 = (this->unk_19A - i) * 0.025f + 0.5f; phi_f20 = CLAMP(phi_f20, 0.5f, 0.8f) * 0.007f; diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index f940b3544d..622d53511c 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -868,7 +868,7 @@ void EnRr_Draw(Actor* thisx, GlobalContext* globalCtx) { for (i = 1; i < 5; i++) { Matrix_Translate(0.0f, this->bodySegs[i].height + 1000.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateRPY(this->bodySegs[i].rot.x, this->bodySegs[i].rot.y, this->bodySegs[i].rot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->bodySegs[i].rot.x, this->bodySegs[i].rot.y, this->bodySegs[i].rot.z, MTXMODE_APPLY); Matrix_Push(); Matrix_Scale((1.0f + this->bodySegs[i].scaleMod.x) * this->bodySegs[i].scale.x, (1.0f + this->bodySegs[i].scaleMod.y) * this->bodySegs[i].scale.y, diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index b35b9e2791..7df5f97c50 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1618,7 +1618,7 @@ void EnSkj_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve if ((limbIndex == 11) && (gSaveContext.itemGetInf[3] & 0x200)) { func_80093D18(globalCtx->state.gfxCtx); Matrix_Push(); - Matrix_RotateRPY(-0x4000, 0, 0, MTXMODE_APPLY); + Matrix_RotateZYX(-0x4000, 0, 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_skj.c", 2430), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gSKJskullMaskDL); diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index beb4437a39..14f499791d 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -548,7 +548,7 @@ void EnVm_Draw(Actor* thisx, GlobalContext* globalCtx2) { } gSPSegment(POLY_OPA_DISP++, 0x08, func_80094E78(globalCtx->state.gfxCtx, 0, this->beamTexScroll)); Matrix_Translate(this->beamPos1.x, this->beamPos1.y, this->beamPos1.z, MTXMODE_NEW); - Matrix_RotateRPY(this->beamRot.x, this->beamRot.y, this->beamRot.z, MTXMODE_APPLY); + Matrix_RotateZYX(this->beamRot.x, this->beamRot.y, this->beamRot.z, MTXMODE_APPLY); Matrix_Scale(this->beamScale.x * 0.1f, this->beamScale.x * 0.1f, this->beamScale.z * 0.0015f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_vm.c", 1063), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index b4775dc53e..3b47d5a35b 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -1716,7 +1716,7 @@ void EnXc_DrawTriforce(Actor* thisx, GlobalContext* globalCtx) { Matrix_Push(); Matrix_Translate(kREG(16) + 100.0f, kREG(17) + 4460.0f, kREG(18) + 1190.0f, MTXMODE_APPLY); - Matrix_RotateRPY(kREG(22), kREG(23), this->triforceAngle, MTXMODE_APPLY); + Matrix_RotateZYX(kREG(22), kREG(23), this->triforceAngle, MTXMODE_APPLY); Matrix_Scale(scale[0], scale[1], scale[2], MTXMODE_APPLY); Matrix_ToMtx(mtx, "../z_en_oA2_inMetamol.c", 602); Matrix_Pop(); diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index 4d21be0d78..b1247a780d 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -450,7 +450,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Push(); Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY); - Matrix_RotateRPY(rot->x, rot->y, rot->z, MTXMODE_APPLY); + Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); Matrix_Push(); Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY); Matrix_Get(&sp34); @@ -460,7 +460,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B4F230(this, sp2C.x, 1); func_80B4EF64(this, sp2C.z, 2); } - Matrix_RotateRPY(unk_1DC[0] + kREG(31), unk_1DC[1] + kREG(32), unk_1DC[2] + kREG(33), MTXMODE_APPLY); + Matrix_RotateZYX(unk_1DC[0] + kREG(31), unk_1DC[1] + kREG(32), unk_1DC[2] + kREG(33), MTXMODE_APPLY); Matrix_Translate(-188.0f, -184.0f, 0.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp74[0], "../z_en_zl2.c", 1056); Matrix_Get(&sp34); @@ -469,7 +469,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B4EE38(this, sp2C.y, 3); func_80B4F230(this, sp2C.x, 4); } - Matrix_RotateRPY(unk_1DC[3] + kREG(34), unk_1DC[4] + kREG(35), unk_1DC[5] + kREG(36), MTXMODE_APPLY); + Matrix_RotateZYX(unk_1DC[3] + kREG(34), unk_1DC[4] + kREG(35), unk_1DC[5] + kREG(36), MTXMODE_APPLY); Matrix_Translate(-410.0f, -184.0f, 0.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp74[1], "../z_en_zl2.c", 1100); Matrix_Get(&sp34); @@ -478,7 +478,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B4EE38(this, sp2C.y, 6); func_80B4F230(this, sp2C.x, 7); } - Matrix_RotateRPY(unk_1DC[6] + kREG(37), unk_1DC[7] + kREG(38), unk_1DC[8] + kREG(39), MTXMODE_APPLY); + Matrix_RotateZYX(unk_1DC[6] + kREG(37), unk_1DC[7] + kREG(38), unk_1DC[8] + kREG(39), MTXMODE_APPLY); Matrix_Translate(-1019.0f, -26.0f, 0.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp74[2], "../z_en_zl2.c", 1120); Matrix_Pop(); @@ -491,7 +491,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B4F230(this, sp2C.x, 10); func_80B4EF64(this, sp2C.z, 11); } - Matrix_RotateRPY(unk_1DC[9] + kREG(40), unk_1DC[10] + kREG(41), unk_1DC[11] + kREG(42), MTXMODE_APPLY); + Matrix_RotateZYX(unk_1DC[9] + kREG(40), unk_1DC[10] + kREG(41), unk_1DC[11] + kREG(42), MTXMODE_APPLY); Matrix_Translate(-427.0f, -1.0f, -3.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp74[3], "../z_en_zl2.c", 1145); Matrix_Get(&sp34); @@ -501,7 +501,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B4F230(this, sp2C.x, 13); func_80B4EF64(this, sp2C.z, 14); } - Matrix_RotateRPY(unk_1DC[12] + kREG(43), unk_1DC[13] + kREG(44), unk_1DC[14] + kREG(45), MTXMODE_APPLY); + Matrix_RotateZYX(unk_1DC[12] + kREG(43), unk_1DC[13] + kREG(44), unk_1DC[14] + kREG(45), MTXMODE_APPLY); Matrix_Translate(-446.0f, -52.0f, 84.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp74[4], "../z_en_zl2.c", 1164); Matrix_Pop(); @@ -514,7 +514,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B4F230(this, sp2C.x, 16); func_80B4EF64(this, sp2C.z, 17); } - Matrix_RotateRPY(unk_1DC[15] + kREG(46), unk_1DC[16] + kREG(47), unk_1DC[17] + kREG(48), MTXMODE_APPLY); + Matrix_RotateZYX(unk_1DC[15] + kREG(46), unk_1DC[16] + kREG(47), unk_1DC[17] + kREG(48), MTXMODE_APPLY); Matrix_Translate(-427.0f, -1.0f, 3.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp74[5], "../z_en_zl2.c", 1189); Matrix_Get(&sp34); @@ -524,7 +524,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B4F230(this, sp2C.x, 19); func_80B4EF64(this, sp2C.z, 20); } - Matrix_RotateRPY(unk_1DC[18] + kREG(49), unk_1DC[19] + kREG(50), unk_1DC[20] + kREG(51), MTXMODE_APPLY); + Matrix_RotateZYX(unk_1DC[18] + kREG(49), unk_1DC[19] + kREG(50), unk_1DC[20] + kREG(51), MTXMODE_APPLY); Matrix_Translate(-446.0f, -52.0f, -84.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp74[6], "../z_en_zl2.c", 1208); Matrix_Pop(); @@ -549,7 +549,7 @@ void EnZl2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve if (player->rightHandType == 0xFF) { Matrix_Put(&player->shieldMf); Matrix_Translate(180.0f, 979.0f, -375.0f, MTXMODE_APPLY); - Matrix_RotateRPY(-0x5DE7, -0x53E9, 0x3333, MTXMODE_APPLY); + Matrix_RotateZYX(-0x5DE7, -0x53E9, 0x3333, MTXMODE_APPLY); Matrix_Scale(1.2f, 1.2f, 1.2f, MTXMODE_APPLY); gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1253), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 59d41022c9..720b7607f1 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -616,7 +616,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p Matrix_Push(); Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY); - Matrix_RotateRPY(rot->x, rot->y, rot->z, MTXMODE_APPLY); + Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); Matrix_Push(); Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY); Matrix_Get(&sp38); @@ -626,7 +626,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B54360(this, sp30.x, 1); func_80B53B64(this, sp30.z, 2); } - Matrix_RotateRPY(unk_28C[0] + kREG(31), unk_28C[1] + kREG(32), unk_28C[2] + kREG(33), MTXMODE_APPLY); + Matrix_RotateZYX(unk_28C[0] + kREG(31), unk_28C[1] + kREG(32), unk_28C[2] + kREG(33), MTXMODE_APPLY); Matrix_Translate(-188.0f, -184.0f, 0.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp78[0], "../z_en_zl3.c", 1490); Matrix_Get(&sp38); @@ -634,7 +634,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p if (!FrameAdvance_IsEnabled(globalCtx)) { func_80B53980(this, sp30.y, 3); } - Matrix_RotateRPY(unk_28C[3] + kREG(34), unk_28C[4] + kREG(35), unk_28C[5] + kREG(36), MTXMODE_APPLY); + Matrix_RotateZYX(unk_28C[3] + kREG(34), unk_28C[4] + kREG(35), unk_28C[5] + kREG(36), MTXMODE_APPLY); Matrix_Translate(-410.0f, -184.0f, 0.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp78[1], "../z_en_zl3.c", 1534); Matrix_Get(&sp38); @@ -642,7 +642,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p if (!FrameAdvance_IsEnabled(globalCtx)) { func_80B54360(this, sp30.x, 7); } - Matrix_RotateRPY(unk_28C[6] + kREG(37), unk_28C[7] + kREG(38), unk_28C[8] + kREG(39), MTXMODE_APPLY); + Matrix_RotateZYX(unk_28C[6] + kREG(37), unk_28C[7] + kREG(38), unk_28C[8] + kREG(39), MTXMODE_APPLY); Matrix_Translate(-1019.0f, -26.0f, 0.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp78[2], "../z_en_zl3.c", 1554); Matrix_Pop(); @@ -655,7 +655,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B54360(this, sp30.x, 10); func_80B53B64(this, sp30.z, 11); } - Matrix_RotateRPY(unk_28C[9] + kREG(40), unk_28C[10] + kREG(41), unk_28C[11] + kREG(42), MTXMODE_APPLY); + Matrix_RotateZYX(unk_28C[9] + kREG(40), unk_28C[10] + kREG(41), unk_28C[11] + kREG(42), MTXMODE_APPLY); Matrix_Translate(-427.0f, -1.0f, -3.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp78[3], "../z_en_zl3.c", 1579); Matrix_Get(&sp38); @@ -665,7 +665,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B54360(this, sp30.x, 13); func_80B53B64(this, sp30.z, 14); } - Matrix_RotateRPY(unk_28C[12] + kREG(43), unk_28C[13] + kREG(44), unk_28C[14] + kREG(45), MTXMODE_APPLY); + Matrix_RotateZYX(unk_28C[12] + kREG(43), unk_28C[13] + kREG(44), unk_28C[14] + kREG(45), MTXMODE_APPLY); Matrix_Translate(-446.0f, -52.0f, 84.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp78[4], "../z_en_zl3.c", 1598); Matrix_Pop(); @@ -678,7 +678,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B54360(this, sp30.x, 16); func_80B53B64(this, sp30.z, 17); } - Matrix_RotateRPY(unk_28C[15] + kREG(46), unk_28C[16] + kREG(47), unk_28C[17] + kREG(48), MTXMODE_APPLY); + Matrix_RotateZYX(unk_28C[15] + kREG(46), unk_28C[16] + kREG(47), unk_28C[17] + kREG(48), MTXMODE_APPLY); Matrix_Translate(-427.0f, -1.0f, 3.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp78[5], "../z_en_zl3.c", 1623); Matrix_Get(&sp38); @@ -688,7 +688,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p func_80B54360(this, sp30.x, 19); func_80B53B64(this, sp30.z, 20); } - Matrix_RotateRPY(unk_28C[18] + kREG(49), unk_28C[19] + kREG(50), unk_28C[20] + kREG(51), MTXMODE_APPLY); + Matrix_RotateZYX(unk_28C[18] + kREG(49), unk_28C[19] + kREG(50), unk_28C[20] + kREG(51), MTXMODE_APPLY); Matrix_Translate(-446.0f, -52.0f, -84.0f, MTXMODE_APPLY); Matrix_ToMtx(&sp78[6], "../z_en_zl3.c", 1642); Matrix_Pop(); @@ -2458,7 +2458,7 @@ s32 func_80B5944C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p rot->z += vec->x; Matrix_Push(); Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY); - Matrix_RotateRPY(rot->x, rot->y, rot->z, MTXMODE_APPLY); + Matrix_RotateZYX(rot->x, rot->y, rot->z, MTXMODE_APPLY); Matrix_Push(); Matrix_Translate(174.0f, -317.0f, 0.0f, MTXMODE_APPLY); Matrix_ToMtx(&mtx[0], "../z_en_zl3_inEscape.c", 2471); diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 5b517a48fe..28aaf57dd6 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -197,7 +197,7 @@ void ObjIcePoly_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_ice_poly.c", 421); func_80093D84(globalCtx->state.gfxCtx); func_8002ED80(&this->actor, globalCtx, 0); - Matrix_RotateRPY(0x500, 0, -0x500, MTXMODE_APPLY); + Matrix_RotateZYX(0x500, 0, -0x500, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_ice_poly.c", 428), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c index c03e3067e3..01c08c5013 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dead_Ds/z_eff_ss_dead_ds.c @@ -96,7 +96,7 @@ void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { } Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); - Matrix_RotateRPY(this->rRoll, this->rPitch, this->rYaw, MTXMODE_APPLY); + Matrix_RotateZYX(this->rRoll, this->rPitch, this->rYaw, MTXMODE_APPLY); Matrix_RotateX(1.57f, MTXMODE_APPLY); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_ss_dead_ds.c", 246), diff --git a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c index 71ff1a0b5d..9885eeae9b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c +++ b/src/overlays/effects/ovl_Effect_Ss_KiraKira/z_eff_ss_kirakira.c @@ -92,7 +92,7 @@ void EffectSsKiraKira_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) OPEN_DISPS(gfxCtx, "../z_eff_ss_kirakira.c", 257); SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); - SkinMatrix_SetRotateRPY(&mfRotY, 0, 0, this->rYaw); + SkinMatrix_SetRotateZYX(&mfRotY, 0, 0, this->rYaw); SkinMatrix_SetScale(&mfScale, scale, scale, 1.0f); SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->mf_11DA0, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfRotY, &mfTrans11DA0RotY); diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c index 5fcce046c8..edc077c4b0 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c @@ -95,7 +95,7 @@ void EffectSsLightning_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) SkinMatrix_SetTranslate(&mfTrans, this->pos.x, this->pos.y, this->pos.z); xzScale = yScale * 0.6f; SkinMatrix_SetScale(&mfScale, xzScale, yScale, xzScale); - SkinMatrix_SetRotateRPY(&mfRotate, this->vec.x, this->vec.y, this->rYaw); + SkinMatrix_SetRotateZYX(&mfRotate, this->vec.x, this->vec.y, this->rYaw); SkinMatrix_MtxFMtxFMult(&mfTrans, &globalCtx->mf_11DA0, &mfTrans11DA0); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &mfRotate, &mfTrans11DA0Rotate); SkinMatrix_MtxFMtxFMult(&mfTrans11DA0Rotate, &mfScale, &mfResult); diff --git a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c index aa580b3198..ccdea46688 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c +++ b/src/overlays/effects/ovl_Effect_Ss_Stick/z_eff_ss_stick.c @@ -56,10 +56,10 @@ void EffectSsStick_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { if (!LINK_IS_ADULT) { Matrix_Scale(0.01f, 0.0025f, 0.01f, MTXMODE_APPLY); - Matrix_RotateRPY(0, this->rYaw, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, this->rYaw, 0, MTXMODE_APPLY); } else { Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - Matrix_RotateRPY(0, this->rYaw, globalCtx->state.frames * 10000, MTXMODE_APPLY); + Matrix_RotateZYX(0, this->rYaw, globalCtx->state.frames * 10000, MTXMODE_APPLY); } gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_eff_ss_stick.c", 176), diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 7f837a10dd..ade2937a65 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -84,7 +84,7 @@ void Title_Draw(TitleContext* this) { func_80093D18(this->state.gfxCtx); Matrix_Translate(-53.0, -5.0, 0, MTXMODE_NEW); Matrix_Scale(1.0, 1.0, 1.0, MTXMODE_APPLY); - Matrix_RotateRPY(0, sTitleRotY, 0, MTXMODE_APPLY); + Matrix_RotateZYX(0, sTitleRotY, 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(this->state.gfxCtx, "../z_title.c", 424), G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, gNintendo64LogoDL); diff --git a/tools/namefixer.py b/tools/namefixer.py index 42aced891e..6f4761bcd2 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -155,6 +155,11 @@ wordReplace = { "func_800D23FC": "Matrix_RotateAxis", "PLAYER": ("GET_PLAYER(globalCtx)", {"ignore": (-1, '"PLAYER"')}), # ignore "PLAYER" in sSoundBankNames "ACTIVE_CAM": "GET_ACTIVE_CAM(globalCtx)", + "SkinMatrix_SetRotateRPY": "SkinMatrix_SetRotateZYX", + "SkinMatrix_SetScaleRotateYRPTranslate": "SkinMatrix_SetScaleRotateYXZTranslate", + "SkinMatrix_SetRotateRPYTranslate": "SkinMatrix_SetRotateZYXTranslate", + "Matrix_RotateRPY": "Matrix_RotateZYX", + "Matrix_JointPosition": "Matrix_TranslateRotateZYX", } # [a-zA-Z0-9_]