diff options
| author | EllipticEllipsis <elliptic.ellipsis@gmail.com> | 2022-05-26 04:24:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-25 23:24:39 -0400 |
| commit | 8049dec3393c4ade687dbdfd84d3ccde73168ab0 (patch) | |
| tree | 6df40d57a3c85c86cef089c98839eec1f0b8cf43 /src/code/z_sub_s.c | |
| parent | e1477702ca139175af769347a3ad0d7a13a31fde (diff) | |
`sys_matrix` OK, documented, rename some other mathematics functions (#787)
* Import data and bss, add some name options
* Decomp rest of stack functions,
remove RSPMatrix,
split header
* sys_matrix OK (thanks Tharo)
Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
* pragma weaks in sinf and cosf, change documentation
change mcros to use 0x8000
* Rename sinf and cosf
* Correct initialisation of sMtxFClear
* More minor cleanup
* Rename stack functions
* Matrix_InsertMatrix -> Matrix_Mult
* The big transpose rename
* Fix MirRay_DrawReflectedBeam
* Matrix_InsertTranslation -> Matrix_Translate
* Matrix_Insert.Rotation_s -> Matrix_Rotate$1S
+ RotateY -> RotateYS
* Matrix_Insert(.)Rotation_f -> Matrix_Rotate$1F
* Matrix_RotateStateAroundXAxis -> Matrix_RotateXFApply
Matrix_SetStateXRotation -> Matrix_RotateXFNew
* Matrix_MultiplyVector3fByState -> Matrix_MultVec3f
* Matrix_MultiplyVector3fXZByCurrentState -> Matrix_MultVec3fXZ
* Matrix_GetStateTranslation -> Matrix_MultZero
* Matrix_GetStateTranslationAndScaled(.) -> Matrix_MultVec$1
* Matrix_FromRSPMatrix -> Matrix_MtxToMtxF
* Matrix_MultiplyVector3fByMatrix -> Matrix_MultVec3fExt
* Matrix_TransposeXYZ -> Matrix_Transpose
* Matrix_ToRSPMatrix -> Matrix_MtxFToMtx
* Matrix_AppendToPolyOpaDisp -> Matrix_MtxFToNewMtx
and document the conversion functions
* Matrix_NormalizeXYZ -> Matrix_ReplaceRotation
* Matrix_InsertRotationAroundUnitVector_f -> Matrix_RotateAxisF and S
* Matrix_InsertRotation -> Matrix_RotateZYX
* Document the last functions
* Small cleanup
* Matrix_JointPosition -> Matrix_TranslateRotateZYX
* Matrix_SetStateRotationAndTranslation -> Matrix_SetTranslateRotateYXZ
* func_8018219C -> Matrix_MtxFToYXZRot
* func_801822C4 -> Matrix_MtxFToZYXRot
* Fix files
* Format
* Review 1
* Renames
* Fix warning in EnDragon
* Format
* Convert `mode` to an actual enum
* Add enums, typedefs, externs to sys_matrix header
* Review
* One more
* More review
* Fix function names
* Format
* Fix names
* Format
* Review
* engineer's review
* Fix build
* Format
* Fix again
Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
Diffstat (limited to 'src/code/z_sub_s.c')
| -rw-r--r-- | src/code/z_sub_s.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 58812abc9..3e5443bc6 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -53,7 +53,7 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** Vec3f pos; Vec3s rot; - Matrix_StatePush(); + Matrix_Push(); limb = Lib_SegmentedToVirtual(skeleton[limbIndex]); limbIndex++; rot = jointTable[limbIndex]; @@ -63,8 +63,8 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** newDList = limbDList = limb->dList; if ((overrideLimbDraw == NULL) || !overrideLimbDraw(globalCtx, limbIndex, &newDList, &pos, &rot, actor, &gfx)) { - Matrix_JointPosition(&pos, &rot); - Matrix_StatePush(); + Matrix_TranslateRotateZYX(&pos, &rot); + Matrix_Push(); transformLimbDraw(globalCtx, limbIndex, actor, &gfx); @@ -77,7 +77,7 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** Matrix_ToMtx(*mtx); (*mtx)++; } - Matrix_StatePop(); + Matrix_Pop(); } if (postLimbDraw != NULL) { postLimbDraw(globalCtx, limbIndex, &limbDList, &rot, actor, &gfx); @@ -86,7 +86,7 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** gfx = SubS_DrawTransformFlexLimb(globalCtx, limb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, transformLimbDraw, actor, mtx, gfx); } - Matrix_StatePop(); + Matrix_Pop(); if (limb->sibling != LIMB_DONE) { gfx = SubS_DrawTransformFlexLimb(globalCtx, limb->sibling, skeleton, jointTable, overrideLimbDraw, postLimbDraw, transformLimbDraw, actor, mtx, gfx); @@ -119,7 +119,7 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo } gSPSegment(gfx++, 0x0D, mtx); - Matrix_StatePush(); + Matrix_Push(); rootLimb = Lib_SegmentedToVirtual(skeleton[0]); pos.x = jointTable->x; pos.y = jointTable->y; @@ -129,8 +129,8 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo limbDList = rootLimb->dList; if (overrideLimbDraw == NULL || !overrideLimbDraw(globalCtx, 1, &newDlist, &pos, &rot, actor, &gfx)) { - Matrix_JointPosition(&pos, &rot); - Matrix_StatePush(); + Matrix_TranslateRotateZYX(&pos, &rot); + Matrix_Push(); transformLimbDraw(globalCtx, 1, actor, &gfx); @@ -143,7 +143,7 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo Matrix_ToMtx(mtx); mtx++; } - Matrix_StatePop(); + Matrix_Pop(); } if (postLimbDraw != NULL) { @@ -154,7 +154,7 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo gfx = SubS_DrawTransformFlexLimb(globalCtx, rootLimb->child, skeleton, jointTable, overrideLimbDraw, postLimbDraw, transformLimbDraw, actor, &mtx, gfx); } - Matrix_StatePop(); + Matrix_Pop(); return gfx; } @@ -187,9 +187,9 @@ s32 SubS_UpdateLimb(s16 newRotZ, s16 newRotY, Vec3f* pos, Vec3s* rot, s32 stepRo Vec3s newRot; MtxF curState; - Matrix_MultiplyVector3fByState(&zeroVec, &newPos); - Matrix_CopyCurrentState(&curState); - func_8018219C(&curState, &newRot, MTXMODE_NEW); + Matrix_MultVec3f(&zeroVec, &newPos); + Matrix_Get(&curState); + Matrix_MtxFToYXZRot(&curState, &newRot, MTXMODE_NEW); *pos = newPos; if (!stepRot && !overrideRot) { @@ -538,7 +538,7 @@ void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween pos.z = bodyPartPos->z - worldPos->z; } - Matrix_MultiplyVector3fByState(&pos, &startVec); + Matrix_MultVec3f(&pos, &startVec); startCol = 64.0f + startVec.x; startRow = 64.0f - startVec.z; SubS_FillShadowTex(startCol >> 1, startRow >> 1, tex, sizes[i]); @@ -554,7 +554,7 @@ void SubS_DrawShadowTex(Actor* actor, GameState* gameState, u8* tex) { func_8012C28C(gfxCtx); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 100); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); - Matrix_InsertTranslation(actor->world.pos.x, 0.0f, actor->world.pos.z, MTXMODE_NEW); + Matrix_Translate(actor->world.pos.x, 0.0f, actor->world.pos.z, MTXMODE_NEW); Matrix_Scale(0.6f, 1.0f, 0.6f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gShadowDL); |
