diff --git a/src/m_misc.c b/src/m_misc.c
index 1d8b13c95115825e5430c913eaf0f80312d2a02f..ba011d0a74e62e24dd0e9e78846f4bb7c057a6d0 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -2024,34 +2024,6 @@ TVector *VectorMatrixMultiply(TVector v, matrix_t m)
 	return &ret;
 }
 
-matrix_t *RotateXMatrix(angle_t rad)
-{
-	static matrix_t ret;
-	const angle_t fa = rad>>ANGLETOFINESHIFT;
-	const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
-
-	ret.m[0]  = FRACUNIT; ret.m[1]  =       0; ret.m[2]  = 0;        ret.m[3]  = 0;
-	ret.m[4]  =        0; ret.m[5]  =  cosrad; ret.m[6]  = sinrad;   ret.m[7]  = 0;
-	ret.m[8]  =        0; ret.m[9]  = -sinrad; ret.m[10] = cosrad;   ret.m[11] = 0;
-	ret.m[12] =        0; ret.m[13] =       0; ret.m[11] = 0;        ret.m[12] = FRACUNIT;
-
-	return &ret;
-}
-
-matrix_t *RotateZMatrix(angle_t rad)
-{
-	static matrix_t ret;
-	const angle_t fa = rad>>ANGLETOFINESHIFT;
-	const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
-
-	ret.m[0]  = cosrad;  ret.m[1]  = sinrad; ret.m[2]  =        0; ret.m[3]  = 0;
-	ret.m[4]  = -sinrad; ret.m[5]  = cosrad; ret.m[6]  =        0; ret.m[7]  = 0;
-	ret.m[8]  = 0;       ret.m[9]  = 0;      ret.m[10] = FRACUNIT; ret.m[11] = 0;
-	ret.m[12] = 0;       ret.m[10] = 0;      ret.m[11] =        0; ret.m[12] = FRACUNIT;
-
-	return &ret;
-}
-
 /** Set of functions to take in a size_t as an argument,
   * put the argument in a character buffer, and return the
   * pointer to that buffer.
diff --git a/src/m_misc.h b/src/m_misc.h
index 2a7b7267952929dd9347005995958c1ae968edfb..45ec9f5cd02dc700b68c5c0334f564630002fc4b 100644
--- a/src/m_misc.h
+++ b/src/m_misc.h
@@ -84,8 +84,6 @@ const char *GetRevisionString(void);
 typedef fixed_t TVector[4];
 
 TVector *VectorMatrixMultiply(TVector v, matrix_t m);
-matrix_t *RotateXMatrix(angle_t rad);
-matrix_t *RotateZMatrix(angle_t rad);
 
 // s1 = s2+s3+s1 (1024 lenghtmax)
 void strcatbf(char *s1, const char *s2, const char *s3);
diff --git a/src/p_enemy.c b/src/p_enemy.c
index 26682ee326207d8c47c2c356592e612250174bea..5cfc15eb004f2a53da0e7de9d2270b347080db46 100644
--- a/src/p_enemy.c
+++ b/src/p_enemy.c
@@ -1517,6 +1517,7 @@ void A_PointyThink(mobj_t *actor)
 	INT32 i;
 	player_t *player = NULL;
 	mobj_t *ball;
+	matrix_t m;
 	TVector v;
 	TVector *res;
 	angle_t fa;
@@ -1593,9 +1594,12 @@ void A_PointyThink(mobj_t *actor)
 		v[2] = FixedMul(FINESINE(fa),radius);
 		v[3] = FRACUNIT;
 
-		res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(actor->lastlook+i)));
+		FM_RotateX(&m, FixedAngle(actor->lastlook+i));
+		res = VectorMatrixMultiply(v, m);
 		M_Memcpy(&v, res, sizeof (v));
-		res = VectorMatrixMultiply(v, *RotateZMatrix(actor->angle+ANGLE_180));
+
+		FM_RotateZ(&m, actor->angle+ANGLE_180);
+		res = VectorMatrixMultiply(v, m);
 		M_Memcpy(&v, res, sizeof (v));
 
 		P_UnsetThingPosition(ball);
diff --git a/src/p_mobj.c b/src/p_mobj.c
index 1591189b9e491652d088ec2718c789b4055c7758..e86dce4a248be964ab166a37ad63187d8a937c60 100644
--- a/src/p_mobj.c
+++ b/src/p_mobj.c
@@ -6194,6 +6194,7 @@ static void P_MoveHoop(mobj_t *mobj)
 {
 	const fixed_t fuse = (mobj->fuse*mobj->extravalue2);
 	const angle_t fa = mobj->movedir*(FINEANGLES/mobj->extravalue1);
+	matrix_t m;
 	TVector v;
 	TVector *res;
 	fixed_t finalx, finaly, finalz;
@@ -6213,9 +6214,12 @@ static void P_MoveHoop(mobj_t *mobj)
 	v[2] = FixedMul(FINESINE(fa),fuse);
 	v[3] = FRACUNIT;
 
-	res = VectorMatrixMultiply(v, *RotateXMatrix(FixedAngle(mobj->target->movedir*FRACUNIT)));
+	FM_RotateX(&m, FixedAngle(mobj->target->movedir*FRACUNIT));
+	res = VectorMatrixMultiply(v, m);
 	M_Memcpy(&v, res, sizeof (v));
-	res = VectorMatrixMultiply(v, *RotateZMatrix(FixedAngle(mobj->target->movecount*FRACUNIT)));
+
+	FM_RotateZ(&m, FixedAngle(mobj->target->movecount*FRACUNIT));
+	res = VectorMatrixMultiply(v, m);
 	M_Memcpy(&v, res, sizeof (v));
 
 	finalx = x + v[0];
@@ -6233,6 +6237,7 @@ void P_SpawnHoopOfSomething(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT
 {
 	mobj_t *mobj;
 	INT32 i;
+	matrix_t m;
 	TVector v;
 	TVector *res;
 	fixed_t finalx, finaly, finalz;
@@ -6281,9 +6286,12 @@ void P_SpawnHoopOfSomething(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT
 		v[2] = FixedMul(FINESINE(fa),radius);
 		v[3] = FRACUNIT;
 
-		res = VectorMatrixMultiply(v, *RotateXMatrix(rotangle));
+		FM_RotateX(&m, rotangle);
+		res = VectorMatrixMultiply(v, m);
 		M_Memcpy(&v, res, sizeof (v));
-		res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle));
+
+		FM_RotateZ(&m, closestangle);
+		res = VectorMatrixMultiply(v, m);
 		M_Memcpy(&v, res, sizeof (v));
 
 		finalx = x + v[0];
@@ -6299,6 +6307,7 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb
 {
 	mobj_t *mobj;
 	INT32 i;
+	matrix_t m;
 	TVector v;
 	TVector *res;
 	fixed_t finalx, finaly, finalz, dist;
@@ -6320,9 +6329,12 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb
 		v[2] = FixedMul(FINESINE(fa),radius);
 		v[3] = FRACUNIT;
 
-		res = VectorMatrixMultiply(v, *RotateXMatrix(rotangle));
+		FM_RotateX(&m, rotangle);
+		res = VectorMatrixMultiply(v, m);
 		M_Memcpy(&v, res, sizeof (v));
-		res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle));
+
+		FM_RotateZ(&m, closestangle);
+		res = VectorMatrixMultiply(v, m);
 		M_Memcpy(&v, res, sizeof (v));
 
 		finalx = x + v[0];
@@ -6494,6 +6506,7 @@ static void P_NightsItemChase(mobj_t *thing)
 //
 void P_MaceRotate(mobj_t *center, INT32 baserot, INT32 baseprevrot)
 {
+	matrix_t m;
 	TVector unit_lengthways, unit_sideways, pos_lengthways, pos_sideways;
 	TVector *res;
 	fixed_t radius, dist, zstore;
@@ -6564,9 +6577,12 @@ void P_MaceRotate(mobj_t *center, INT32 baserot, INT32 baseprevrot)
 			}
 
 			// Calculate the angle matrixes for the link.
-			res = VectorMatrixMultiply(unit_lengthways, *RotateXMatrix(center->threshold << ANGLETOFINESHIFT));
+			FM_RotateX(&m, center->threshold << ANGLETOFINESHIFT);
+			res = VectorMatrixMultiply(unit_lengthways, m);
 			M_Memcpy(&unit_lengthways, res, sizeof(unit_lengthways));
-			res = VectorMatrixMultiply(unit_lengthways, *RotateZMatrix(center->angle));
+
+			FM_RotateZ(&m, center->angle);
+			res = VectorMatrixMultiply(unit_lengthways, m);
 			M_Memcpy(&unit_lengthways, res, sizeof(unit_lengthways));
 
 			lastthreshold = mobj->threshold;
@@ -6587,9 +6603,12 @@ void P_MaceRotate(mobj_t *center, INT32 baserot, INT32 baseprevrot)
 				unit_sideways[0] = unit_sideways[2] = 0;
 				unit_sideways[3] = FRACUNIT;
 
-				res = VectorMatrixMultiply(unit_sideways, *RotateXMatrix(center->threshold << ANGLETOFINESHIFT));
+				FM_RotateX(&m, center->threshold << ANGLETOFINESHIFT);
+				res = VectorMatrixMultiply(unit_sideways, m);
 				M_Memcpy(&unit_sideways, res, sizeof(unit_sideways));
-				res = VectorMatrixMultiply(unit_sideways, *RotateZMatrix(center->angle));
+
+				FM_RotateZ(&m, center->angle);
+				res = VectorMatrixMultiply(unit_sideways, m);
 				M_Memcpy(&unit_sideways, res, sizeof(unit_sideways));
 			}
 
@@ -13260,7 +13279,7 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
 	mobj_t *mobj = NULL;
 	mobj_t *nextmobj = NULL;
 	mobj_t *hoopcenter;
-	matrix_t *pitchmatrix, *yawmatrix;
+	matrix_t pitchmatrix, yawmatrix;
 	fixed_t radius = hoopsize*sizefactor;
 	INT32 i;
 	angle_t fa;
@@ -13280,9 +13299,9 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
 
 	// Scale 0-255 to 0-359 =(
 	hoopcenter->movedir = ((mthing->angle & 255)*360)/256; // Pitch
-	pitchmatrix = RotateXMatrix(FixedAngle(hoopcenter->movedir << FRACBITS));
+	FM_RotateX(&pitchmatrix, FixedAngle(hoopcenter->movedir << FRACBITS));
 	hoopcenter->movecount = (((UINT16)mthing->angle >> 8)*360)/256; // Yaw
-	yawmatrix = RotateZMatrix(FixedAngle(hoopcenter->movecount << FRACBITS));
+	FM_RotateZ(&yawmatrix, FixedAngle(hoopcenter->movecount << FRACBITS));
 
 	// For the hoop when it flies away
 	hoopcenter->extravalue1 = hoopsize;
@@ -13297,9 +13316,9 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
 		v[2] = FixedMul(FINESINE(fa), radius);
 		v[3] = FRACUNIT;
 
-		res = VectorMatrixMultiply(v, *pitchmatrix);
+		res = VectorMatrixMultiply(v, pitchmatrix);
 		M_Memcpy(&v, res, sizeof(v));
-		res = VectorMatrixMultiply(v, *yawmatrix);
+		res = VectorMatrixMultiply(v, yawmatrix);
 		M_Memcpy(&v, res, sizeof(v));
 
 		mobj = P_SpawnMobj(x + v[0], y + v[1], z + v[2], MT_HOOP);
@@ -13343,9 +13362,9 @@ static void P_SpawnHoopInternal(mapthing_t *mthing, INT32 hoopsize, fixed_t size
 			v[2] = FixedMul(FINESINE(fa), radius);
 			v[3] = FRACUNIT;
 
-			res = VectorMatrixMultiply(v, *pitchmatrix);
+			res = VectorMatrixMultiply(v, pitchmatrix);
 			M_Memcpy(&v, res, sizeof(v));
-			res = VectorMatrixMultiply(v, *yawmatrix);
+			res = VectorMatrixMultiply(v, yawmatrix);
 			M_Memcpy(&v, res, sizeof(v));
 
 			mobj = P_SpawnMobj(x + v[0], y + v[1], z + v[2], MT_HOOPCOLLIDE);
@@ -13452,6 +13471,7 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n
 	angle_t angle = FixedAngle(mthing->angle << FRACBITS);
 	angle_t fa;
 	INT32 i;
+	matrix_t m;
 	TVector v, *res;
 
 	for (i = 0; i < numitemtypes; i++)
@@ -13485,7 +13505,8 @@ static void P_SpawnItemCircle(mapthing_t *mthing, mobjtype_t *itemtypes, UINT8 n
 		v[2] = FixedMul(FINESINE(fa), size);
 		v[3] = FRACUNIT;
 
-		res = VectorMatrixMultiply(v, *RotateZMatrix(angle));
+		FM_RotateZ(&m, angle);
+		res = VectorMatrixMultiply(v, m);
 		M_Memcpy(&v, res, sizeof(v));
 
 		mobj = P_SpawnMobjFromMapThing(&dummything, x + v[0], y + v[1], z + v[2], itemtype);
diff --git a/src/tables.c b/src/tables.c
index 13949b6a78c337a9183a7fd857c04135899acc7e..f8b8030c956bfef7f63f526a13e66e65b327e86e 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -407,9 +407,9 @@ void FV3_Rotate(vector3_t *rotVec, const vector3_t *axisVec, const angle_t angle
 	rotVec->z = az+dz+ez;
 }
 
-void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z)
-{
 #define M(row,col) dest->m[row * 4 + col]
+matrix_t *FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z)
+{
 	const fixed_t sinA = FINESINE(angle>>ANGLETOFINESHIFT);
 	const fixed_t cosA = FINECOSINE(angle>>ANGLETOFINESHIFT);
 	const fixed_t invCosA = FRACUNIT - cosA;
@@ -459,5 +459,84 @@ void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z)
 	M(1, 3) = 0;
 	M(2, 3) = 0;
 	M(3, 3) = FRACUNIT;
-#undef M
+
+	return dest;
+}
+
+
+matrix_t *FM_RotateX(matrix_t *dest, angle_t rad)
+{
+	const angle_t fa = rad>>ANGLETOFINESHIFT;
+	const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
+
+	M(0, 0) = FRACUNIT;
+	M(0, 1) = 0;
+	M(0, 2) = 0;
+	M(0, 3) = 0;
+	M(1, 0) = 0;
+	M(1, 1) = cosrad;
+	M(1, 2) = sinrad;
+	M(1, 3) = 0;
+	M(2, 0) = 0;
+	M(2, 1) = -sinrad;
+	M(2, 2) = cosrad;
+	M(2, 3) = 0;
+	M(3, 0) = 0;
+	M(3, 1) = 0;
+	M(3, 2) = 0;
+	M(3, 3) = FRACUNIT;
+
+	return dest;
+}
+
+matrix_t *FM_RotateY(matrix_t *dest, angle_t rad)
+{
+	const angle_t fa = rad>>ANGLETOFINESHIFT;
+	const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
+
+	M(0, 0) = cosrad;
+	M(0, 1) = 0;
+	M(0, 2) = -sinrad;
+	M(0, 3) = 0;
+	M(1, 0) = 0;
+	M(1, 1) = FRACUNIT;
+	M(1, 2) = 0;
+	M(1, 3) = 0;
+	M(2, 0) = sinrad;
+	M(2, 1) = 0;
+	M(2, 2) = cosrad;
+	M(2, 3) = 0;
+	M(3, 0) = 0;
+	M(3, 1) = 0;
+	M(3, 2) = 0;
+	M(3, 3) =  FRACUNIT;
+
+	return dest;
 }
+
+matrix_t *FM_RotateZ(matrix_t *dest, angle_t rad)
+{
+	const angle_t fa = rad>>ANGLETOFINESHIFT;
+	const fixed_t cosrad = FINECOSINE(fa), sinrad = FINESINE(fa);
+
+	M(0, 0) = cosrad;
+	M(0, 1) = sinrad;
+	M(0, 2) = 0;
+	M(0, 3) = 0;
+	M(1, 0) = -sinrad;
+	M(1, 1) = cosrad;
+	M(1, 2) = 0;
+	M(1, 3) = 0;
+	M(2, 0) = 0;
+	M(2, 1) = 0;
+	M(2, 2) = FRACUNIT;
+	M(2, 3) = 0;
+	M(3, 0) = 0;
+	M(3, 1) = 0;
+	M(3, 2) = 0;
+	M(3, 3) = FRACUNIT;
+
+	return dest;
+}
+
+#undef M
diff --git a/src/tables.h b/src/tables.h
index c44c7d525b5d205197843ad083bb84d1fc257a68..172ade3785672d28c95e2812d5d5f00cf06b4b4c 100644
--- a/src/tables.h
+++ b/src/tables.h
@@ -107,7 +107,10 @@ boolean FV3_InsidePolygon(const vector3_t *vIntersection, const vector3_t *Poly,
 boolean FV3_IntersectedPolygon(const vector3_t *vPoly, const vector3_t *vLine, const INT32 vertexCount, vector3_t *collisionPoint);
 void FV3_Rotate(vector3_t *rotVec, const vector3_t *axisVec, const angle_t angle);
 /// Fixed Point Matrix functions
-void FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z);
+matrix_t *FM_Rotate(matrix_t *dest, angle_t angle, fixed_t x, fixed_t y, fixed_t z);
+matrix_t *FM_RotateX(matrix_t *dest, angle_t rad);
+matrix_t *FM_RotateY(matrix_t *dest, angle_t rad);
+matrix_t *FM_RotateZ(matrix_t *dest, angle_t rad);
 
 // The table values in tables.c are calculated with this many fractional bits.
 #define FINE_FRACBITS 16