summaryrefslogtreecommitdiff
path: root/src/code/sys_matrix.c
diff options
context:
space:
mode:
authorcadmic <cadmic24@gmail.com>2024-01-09 04:59:03 -0800
committerGitHub <noreply@github.com>2024-01-09 07:59:03 -0500
commitcd917b0cb8c20e457d43805ee27d2597daed63e3 (patch)
tree6506a87bb08252072ca10e6993f64f2b475fca09 /src/code/sys_matrix.c
parente146d7bc2642633f8b09357c115014a3dfca59da (diff)
Create debug macros for common functions (#1597)
* Create debug macros for common functions * Revert NDEBUG change * MALLOCR -> MALLOC_R * DEBUG -> OOT_DEBUG * Use the same name for debug and non-debug matrix functions * Fix file/line argument order * Revert g[s]DPNoOp[Tag] * Use SystemArena_MallocDebug directly in GameAlloc_MallocDebug * MTXF_TO_MTX -> MATRIX_TO_MTX
Diffstat (limited to 'src/code/sys_matrix.c')
-rw-r--r--src/code/sys_matrix.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c
index f58872d07..fa038a76c 100644
--- a/src/code/sys_matrix.c
+++ b/src/code/sys_matrix.c
@@ -20,7 +20,7 @@ MtxF* sMatrixStack; // "Matrix_stack"
MtxF* sCurrentMatrix; // "Matrix_now"
void Matrix_Init(GameState* gameState) {
- sCurrentMatrix = GameState_Alloc(gameState, 20 * sizeof(MtxF), "../sys_matrix.c", 153);
+ sCurrentMatrix = GAME_STATE_ALLOC(gameState, 20 * sizeof(MtxF), "../sys_matrix.c", 153);
sMatrixStack = sCurrentMatrix;
}
@@ -603,16 +603,30 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) {
return dest;
}
+#ifdef OOT_DEBUG
+
Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) {
- return Matrix_MtxFToMtx(Matrix_CheckFloats(sCurrentMatrix, file, line), dest);
+ return Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(sCurrentMatrix, file, line), dest);
}
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line) {
- return Matrix_ToMtx(Graph_Alloc(gfxCtx, sizeof(Mtx)), file, line);
+ return Matrix_ToMtx(GRAPH_ALLOC(gfxCtx, sizeof(Mtx)), file, line);
+}
+
+#else
+
+Mtx* Matrix_ToMtx(Mtx* dest) {
+ return Matrix_MtxFToMtx(sCurrentMatrix, dest);
}
+Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx) {
+ return Matrix_ToMtx(GRAPH_ALLOC(gfxCtx, sizeof(Mtx)));
+}
+
+#endif /* OOT_DEBUG */
+
Mtx* Matrix_MtxFToNewMtx(MtxF* src, GraphicsContext* gfxCtx) {
- return Matrix_MtxFToMtx(src, Graph_Alloc(gfxCtx, sizeof(Mtx)));
+ return Matrix_MtxFToMtx(src, GRAPH_ALLOC(gfxCtx, sizeof(Mtx)));
}
void Matrix_MultVec3f(Vec3f* src, Vec3f* dest) {