diff --git a/include/ultra64/types.h b/include/ultra64/types.h index 9a34f3dd93..bb1415d6e9 100644 --- a/include/ultra64/types.h +++ b/include/ultra64/types.h @@ -33,10 +33,10 @@ typedef float MtxF_t[4][4]; typedef union { MtxF_t mf; struct { - float xx, xy, xz, xw, - yx, yy, yz, yw, - zx, zy, zz, zw, - wx, wy, wz, ww; + float xx, yx, zx, wx, + xy, yy, zy, wy, + xz, yz, zz, wz, + xw, yw, zw, ww; }; } MtxF; diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index c0c668771a..ac2555b56b 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -63,17 +63,17 @@ void Matrix_Translate(f32 x, f32 y, f32 z, u8 mode) { if (mode == MTXMODE_APPLY) { tx = cmf->xx; - ty = cmf->yx; - cmf->wx += tx * x + ty * y + cmf->zx * z; - tx = cmf->xy; + ty = cmf->xy; + cmf->xw += tx * x + ty * y + cmf->xz * z; + tx = cmf->yx; ty = cmf->yy; - cmf->wy += tx * x + ty * y + cmf->zy * z; - tx = cmf->xz; - ty = cmf->yz; - cmf->wz += tx * x + ty * y + cmf->zz * z; - tx = cmf->xw; - ty = cmf->yw; - cmf->ww += tx * x + ty * y + cmf->zw * z; + cmf->yw += tx * x + ty * y + cmf->yz * z; + tx = cmf->zx; + ty = cmf->zy; + cmf->zw += tx * x + ty * y + cmf->zz * z; + tx = cmf->wx; + ty = cmf->wy; + cmf->ww += tx * x + ty * y + cmf->wz * z; } else { SkinMatrix_SetTranslate(cmf, x, y, z); } @@ -84,17 +84,17 @@ void Matrix_Scale(f32 x, f32 y, f32 z, u8 mode) { if (mode == MTXMODE_APPLY) { cmf->xx *= x; - cmf->xy *= x; - cmf->xz *= x; - cmf->yx *= y; + cmf->yx *= x; + cmf->zx *= x; + cmf->xy *= y; cmf->yy *= y; - cmf->yz *= y; - cmf->zx *= z; - cmf->zy *= z; + cmf->zy *= y; + cmf->xz *= z; + cmf->yz *= z; cmf->zz *= z; - cmf->xw *= x; - cmf->yw *= y; - cmf->zw *= z; + cmf->wx *= x; + cmf->wy *= y; + cmf->wz *= z; } else { SkinMatrix_SetScale(cmf, x, y, z); } @@ -114,25 +114,25 @@ void Matrix_RotateX(f32 x, u8 mode) { sin = sinf(x); cos = cosf(x); - temp1 = cmf->yx; - temp2 = cmf->zx; - cmf->yx = temp1 * cos + temp2 * sin; - cmf->zx = temp2 * cos - temp1 * sin; + temp1 = cmf->xy; + temp2 = cmf->xz; + cmf->xy = temp1 * cos + temp2 * sin; + cmf->xz = temp2 * cos - temp1 * sin; temp1 = cmf->yy; - temp2 = cmf->zy; + temp2 = cmf->yz; cmf->yy = temp1 * cos + temp2 * sin; - cmf->zy = temp2 * cos - temp1 * sin; + cmf->yz = temp2 * cos - temp1 * sin; - temp1 = cmf->yz; + temp1 = cmf->zy; temp2 = cmf->zz; - cmf->yz = temp1 * cos + temp2 * sin; + cmf->zy = temp1 * cos + temp2 * sin; cmf->zz = temp2 * cos - temp1 * sin; - temp1 = cmf->yw; - temp2 = cmf->zw; - cmf->yw = temp1 * cos + temp2 * sin; - cmf->zw = temp2 * cos - temp1 * sin; + temp1 = cmf->wy; + temp2 = cmf->wz; + cmf->wy = temp1 * cos + temp2 * sin; + cmf->wz = temp2 * cos - temp1 * sin; } } else { cmf = sCurrentMatrix; @@ -145,22 +145,22 @@ void Matrix_RotateX(f32 x, u8 mode) { cos = 1.0f; } - cmf->xy = 0.0f; - cmf->xz = 0.0f; - cmf->xw = 0.0f; cmf->yx = 0.0f; - cmf->yw = 0.0f; cmf->zx = 0.0f; - cmf->zw = 0.0f; cmf->wx = 0.0f; + cmf->xy = 0.0f; cmf->wy = 0.0f; + cmf->xz = 0.0f; cmf->wz = 0.0f; + cmf->xw = 0.0f; + cmf->yw = 0.0f; + cmf->zw = 0.0f; cmf->xx = 1.0f; cmf->ww = 1.0f; cmf->yy = cos; cmf->zz = cos; - cmf->yz = sin; - cmf->zy = -sin; + cmf->zy = sin; + cmf->yz = -sin; } } @@ -179,24 +179,24 @@ void Matrix_RotateY(f32 y, u8 mode) { cos = cosf(y); temp1 = cmf->xx; - temp2 = cmf->zx; + temp2 = cmf->xz; cmf->xx = temp1 * cos - temp2 * sin; - cmf->zx = temp1 * sin + temp2 * cos; + cmf->xz = temp1 * sin + temp2 * cos; - temp1 = cmf->xy; - temp2 = cmf->zy; - cmf->xy = temp1 * cos - temp2 * sin; - cmf->zy = temp1 * sin + temp2 * cos; + temp1 = cmf->yx; + temp2 = cmf->yz; + cmf->yx = temp1 * cos - temp2 * sin; + cmf->yz = temp1 * sin + temp2 * cos; - temp1 = cmf->xz; + temp1 = cmf->zx; temp2 = cmf->zz; - cmf->xz = temp1 * cos - temp2 * sin; + cmf->zx = temp1 * cos - temp2 * sin; cmf->zz = temp1 * sin + temp2 * cos; - temp1 = cmf->xw; - temp2 = cmf->zw; - cmf->xw = temp1 * cos - temp2 * sin; - cmf->zw = temp1 * sin + temp2 * cos; + temp1 = cmf->wx; + temp2 = cmf->wz; + cmf->wx = temp1 * cos - temp2 * sin; + cmf->wz = temp1 * sin + temp2 * cos; } } else { cmf = sCurrentMatrix; @@ -209,22 +209,22 @@ void Matrix_RotateY(f32 y, u8 mode) { cos = 1.0f; } - cmf->xy = 0.0f; - cmf->xw = 0.0f; cmf->yx = 0.0f; - cmf->yz = 0.0f; - cmf->yw = 0.0f; - cmf->zy = 0.0f; - cmf->zw = 0.0f; cmf->wx = 0.0f; + cmf->xy = 0.0f; + cmf->zy = 0.0f; cmf->wy = 0.0f; + cmf->yz = 0.0f; cmf->wz = 0.0f; + cmf->xw = 0.0f; + cmf->yw = 0.0f; + cmf->zw = 0.0f; cmf->yy = 1.0f; cmf->ww = 1.0f; cmf->xx = cos; cmf->zz = cos; - cmf->xz = -sin; - cmf->zx = sin; + cmf->zx = -sin; + cmf->xz = sin; } } @@ -243,24 +243,24 @@ void Matrix_RotateZ(f32 z, u8 mode) { cos = cosf(z); temp1 = cmf->xx; - temp2 = cmf->yx; + temp2 = cmf->xy; cmf->xx = temp1 * cos + temp2 * sin; - cmf->yx = temp2 * cos - temp1 * sin; + cmf->xy = temp2 * cos - temp1 * sin; - temp1 = cmf->xy; + temp1 = cmf->yx; temp2 = cmf->yy; - cmf->xy = temp1 * cos + temp2 * sin; + cmf->yx = temp1 * cos + temp2 * sin; cmf->yy = temp2 * cos - temp1 * sin; - temp1 = cmf->xz; - temp2 = cmf->yz; - cmf->xz = temp1 * cos + temp2 * sin; - cmf->yz = temp2 * cos - temp1 * sin; + temp1 = cmf->zx; + temp2 = cmf->zy; + cmf->zx = temp1 * cos + temp2 * sin; + cmf->zy = temp2 * cos - temp1 * sin; - temp1 = cmf->xw; - temp2 = cmf->yw; - cmf->xw = temp1 * cos + temp2 * sin; - cmf->yw = temp2 * cos - temp1 * sin; + temp1 = cmf->wx; + temp2 = cmf->wy; + cmf->wx = temp1 * cos + temp2 * sin; + cmf->wy = temp2 * cos - temp1 * sin; } } else { cmf = sCurrentMatrix; @@ -273,22 +273,22 @@ void Matrix_RotateZ(f32 z, u8 mode) { cos = 1.0f; } - cmf->xz = 0.0f; - cmf->xw = 0.0f; - cmf->yz = 0.0f; - cmf->yw = 0.0f; cmf->zx = 0.0f; - cmf->zy = 0.0f; - cmf->zw = 0.0f; cmf->wx = 0.0f; + cmf->zy = 0.0f; cmf->wy = 0.0f; + cmf->xz = 0.0f; + cmf->yz = 0.0f; cmf->wz = 0.0f; + cmf->xw = 0.0f; + cmf->yw = 0.0f; + cmf->zw = 0.0f; cmf->zz = 1.0f; cmf->ww = 1.0f; cmf->xx = cos; cmf->yy = cos; - cmf->xy = sin; - cmf->yx = -sin; + cmf->yx = sin; + cmf->xy = -sin; } } @@ -310,73 +310,73 @@ void Matrix_RotateRPY(s16 x, s16 y, s16 z, u8 mode) { cos = Math_CosS(z); temp1 = cmf->xx; - temp2 = cmf->yx; + temp2 = cmf->xy; cmf->xx = temp1 * cos + temp2 * sin; - cmf->yx = temp2 * cos - temp1 * sin; + cmf->xy = temp2 * cos - temp1 * sin; - temp1 = cmf->xy; + temp1 = cmf->yx; temp2 = cmf->yy; - cmf->xy = temp1 * cos + temp2 * sin; + cmf->yx = temp1 * cos + temp2 * sin; cmf->yy = temp2 * cos - temp1 * sin; - temp1 = cmf->xz; - temp2 = cmf->yz; - cmf->xz = temp1 * cos + temp2 * sin; - cmf->yz = temp2 * cos - temp1 * sin; + temp1 = cmf->zx; + temp2 = cmf->zy; + cmf->zx = temp1 * cos + temp2 * sin; + cmf->zy = temp2 * cos - temp1 * sin; - temp1 = cmf->xw; - temp2 = cmf->yw; - cmf->xw = temp1 * cos + temp2 * sin; - cmf->yw = temp2 * cos - temp1 * sin; + temp1 = cmf->wx; + temp2 = cmf->wy; + cmf->wx = temp1 * cos + temp2 * sin; + cmf->wy = temp2 * cos - temp1 * sin; if (y != 0) { sin = Math_SinS(y); cos = Math_CosS(y); temp1 = cmf->xx; - temp2 = cmf->zx; + temp2 = cmf->xz; cmf->xx = temp1 * cos - temp2 * sin; - cmf->zx = temp1 * sin + temp2 * cos; + cmf->xz = temp1 * sin + temp2 * cos; - temp1 = cmf->xy; - temp2 = cmf->zy; - cmf->xy = temp1 * cos - temp2 * sin; - cmf->zy = temp1 * sin + temp2 * cos; + temp1 = cmf->yx; + temp2 = cmf->yz; + cmf->yx = temp1 * cos - temp2 * sin; + cmf->yz = temp1 * sin + temp2 * cos; - temp1 = cmf->xz; + temp1 = cmf->zx; temp2 = cmf->zz; - cmf->xz = temp1 * cos - temp2 * sin; + cmf->zx = temp1 * cos - temp2 * sin; cmf->zz = temp1 * sin + temp2 * cos; - temp1 = cmf->xw; - temp2 = cmf->zw; - cmf->xw = temp1 * cos - temp2 * sin; - cmf->zw = temp1 * sin + temp2 * cos; + temp1 = cmf->wx; + temp2 = cmf->wz; + cmf->wx = temp1 * cos - temp2 * sin; + cmf->wz = temp1 * sin + temp2 * cos; } if (x != 0) { sin = Math_SinS(x); cos = Math_CosS(x); - temp1 = cmf->yx; - temp2 = cmf->zx; - cmf->yx = temp1 * cos + temp2 * sin; - cmf->zx = temp2 * cos - temp1 * sin; + temp1 = cmf->xy; + temp2 = cmf->xz; + cmf->xy = temp1 * cos + temp2 * sin; + cmf->xz = temp2 * cos - temp1 * sin; temp1 = cmf->yy; - temp2 = cmf->zy; + temp2 = cmf->yz; cmf->yy = temp1 * cos + temp2 * sin; - cmf->zy = temp2 * cos - temp1 * sin; + cmf->yz = temp2 * cos - temp1 * sin; - temp1 = cmf->yz; + temp1 = cmf->zy; temp2 = cmf->zz; - cmf->yz = temp1 * cos + temp2 * sin; + cmf->zy = temp1 * cos + temp2 * sin; cmf->zz = temp2 * cos - temp1 * sin; - temp1 = cmf->yw; - temp2 = cmf->zw; - cmf->yw = temp1 * cos + temp2 * sin; - cmf->zw = temp2 * cos - temp1 * sin; + temp1 = cmf->wy; + temp2 = cmf->wz; + cmf->wy = temp1 * cos + temp2 * sin; + cmf->wz = temp2 * cos - temp1 * sin; } } else { SkinMatrix_SetRotateRPY(cmf, x, y, z); @@ -394,77 +394,77 @@ void Matrix_JointPosition(Vec3f* position, Vec3s* rotation) { f32 temp2; temp1 = cmf->xx; - temp2 = cmf->yx; - cmf->wx += temp1 * position->x + temp2 * position->y + cmf->zx * position->z; + temp2 = cmf->xy; + cmf->xw += temp1 * position->x + temp2 * position->y + cmf->xz * position->z; cmf->xx = temp1 * cos + temp2 * sin; - cmf->yx = temp2 * cos - temp1 * sin; + cmf->xy = temp2 * cos - temp1 * sin; - temp1 = cmf->xy; + temp1 = cmf->yx; temp2 = cmf->yy; - cmf->wy += temp1 * position->x + temp2 * position->y + cmf->zy * position->z; - cmf->xy = temp1 * cos + temp2 * sin; + cmf->yw += temp1 * position->x + temp2 * position->y + cmf->yz * position->z; + cmf->yx = temp1 * cos + temp2 * sin; cmf->yy = temp2 * cos - temp1 * sin; - temp1 = cmf->xz; - temp2 = cmf->yz; - cmf->wz += temp1 * position->x + temp2 * position->y + cmf->zz * position->z; - cmf->xz = temp1 * cos + temp2 * sin; - cmf->yz = temp2 * cos - temp1 * sin; + temp1 = cmf->zx; + temp2 = cmf->zy; + cmf->zw += temp1 * position->x + temp2 * position->y + cmf->zz * position->z; + cmf->zx = temp1 * cos + temp2 * sin; + cmf->zy = temp2 * cos - temp1 * sin; - temp1 = cmf->xw; - temp2 = cmf->yw; - cmf->ww += temp1 * position->x + temp2 * position->y + cmf->zw * position->z; - cmf->xw = temp1 * cos + temp2 * sin; - cmf->yw = temp2 * cos - temp1 * sin; + temp1 = cmf->wx; + temp2 = cmf->wy; + cmf->ww += temp1 * position->x + temp2 * position->y + cmf->wz * position->z; + cmf->wx = temp1 * cos + temp2 * sin; + cmf->wy = temp2 * cos - temp1 * sin; if (rotation->y != 0) { sin = Math_SinS(rotation->y); cos = Math_CosS(rotation->y); temp1 = cmf->xx; - temp2 = cmf->zx; + temp2 = cmf->xz; cmf->xx = temp1 * cos - temp2 * sin; - cmf->zx = temp1 * sin + temp2 * cos; + cmf->xz = temp1 * sin + temp2 * cos; - temp1 = cmf->xy; - temp2 = cmf->zy; - cmf->xy = temp1 * cos - temp2 * sin; - cmf->zy = temp1 * sin + temp2 * cos; + temp1 = cmf->yx; + temp2 = cmf->yz; + cmf->yx = temp1 * cos - temp2 * sin; + cmf->yz = temp1 * sin + temp2 * cos; - temp1 = cmf->xz; + temp1 = cmf->zx; temp2 = cmf->zz; - cmf->xz = temp1 * cos - temp2 * sin; + cmf->zx = temp1 * cos - temp2 * sin; cmf->zz = temp1 * sin + temp2 * cos; - temp1 = cmf->xw; - temp2 = cmf->zw; - cmf->xw = temp1 * cos - temp2 * sin; - cmf->zw = temp1 * sin + temp2 * cos; + temp1 = cmf->wx; + temp2 = cmf->wz; + cmf->wx = temp1 * cos - temp2 * sin; + cmf->wz = temp1 * sin + temp2 * cos; } if (rotation->x != 0) { sin = Math_SinS(rotation->x); cos = Math_CosS(rotation->x); - temp1 = cmf->yx; - temp2 = cmf->zx; - cmf->yx = temp1 * cos + temp2 * sin; - cmf->zx = temp2 * cos - temp1 * sin; + temp1 = cmf->xy; + temp2 = cmf->xz; + cmf->xy = temp1 * cos + temp2 * sin; + cmf->xz = temp2 * cos - temp1 * sin; temp1 = cmf->yy; - temp2 = cmf->zy; + temp2 = cmf->yz; cmf->yy = temp1 * cos + temp2 * sin; - cmf->zy = temp2 * cos - temp1 * sin; + cmf->yz = temp2 * cos - temp1 * sin; - temp1 = cmf->yz; + temp1 = cmf->zy; temp2 = cmf->zz; - cmf->yz = temp1 * cos + temp2 * sin; + cmf->zy = temp1 * cos + temp2 * sin; cmf->zz = temp2 * cos - temp1 * sin; - temp1 = cmf->yw; - temp2 = cmf->zw; - cmf->yw = temp1 * cos + temp2 * sin; - cmf->zw = temp2 * cos - temp1 * sin; + temp1 = cmf->wy; + temp2 = cmf->wz; + cmf->wy = temp1 * cos + temp2 * sin; + cmf->wz = temp2 * cos - temp1 * sin; } } @@ -476,13 +476,13 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) { f32 sp24; cmf->xx = sp2C; - cmf->xz = -sp30; - cmf->wx = x; - cmf->wy = y; - cmf->wz = z; - cmf->xw = 0.0f; - cmf->yw = 0.0f; - cmf->zw = 0.0f; + cmf->zx = -sp30; + cmf->xw = x; + cmf->yw = y; + cmf->zw = z; + cmf->wx = 0.0f; + cmf->wy = 0.0f; + cmf->wz = 0.0f; cmf->ww = 1.0f; if (vec->x != 0) { @@ -490,17 +490,17 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) { sp28 = Math_CosS(vec->x); cmf->zz = sp2C * sp28; - cmf->yz = sp2C * sp24; - cmf->zx = sp30 * sp28; - cmf->yx = sp30 * sp24; - cmf->zy = -sp24; + cmf->zy = sp2C * sp24; + cmf->xz = sp30 * sp28; + cmf->xy = sp30 * sp24; + cmf->yz = -sp24; cmf->yy = sp28; } else { cmf->zz = sp2C; - cmf->zx = sp30; - cmf->zy = 0.0f; + cmf->xz = sp30; cmf->yz = 0.0f; - cmf->yx = 0.0f; + cmf->zy = 0.0f; + cmf->xy = 0.0f; cmf->yy = 1.0f; } @@ -509,20 +509,20 @@ void func_800D1694(f32 x, f32 y, f32 z, Vec3s* vec) { sp28 = Math_CosS(vec->z); sp30 = cmf->xx; - sp2C = cmf->yx; + sp2C = cmf->xy; cmf->xx = sp30 * sp28 + sp2C * sp24; - cmf->yx = sp2C * sp28 - sp30 * sp24; + cmf->xy = sp2C * sp28 - sp30 * sp24; - sp30 = cmf->xz; - sp2C = cmf->yz; - cmf->xz = sp30 * sp28 + sp2C * sp24; - cmf->yz = sp2C * sp28 - sp30 * sp24; + sp30 = cmf->zx; + sp2C = cmf->zy; + cmf->zx = sp30 * sp28 + sp2C * sp24; + cmf->zy = sp2C * sp28 - sp30 * sp24; sp2C = cmf->yy; - cmf->xy = sp2C * sp24; + cmf->yx = sp2C * sp24; cmf->yy = sp2C * sp28; } else { - cmf->xy = 0.0f; + cmf->yx = 0.0f; } } @@ -535,19 +535,19 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) { m1[0] = (temp >> 0x10); m1[16 + 0] = temp & 0xFFFF; - temp = src->xy * 0x10000; + temp = src->yx * 0x10000; m1[1] = (temp >> 0x10); m1[16 + 1] = temp & 0xFFFF; - temp = src->xz * 0x10000; + temp = src->zx * 0x10000; m1[2] = (temp >> 0x10); m1[16 + 2] = temp & 0xFFFF; - temp = src->xw * 0x10000; + temp = src->wx * 0x10000; m1[3] = (temp >> 0x10); m1[16 + 3] = temp & 0xFFFF; - temp = src->yx * 0x10000; + temp = src->xy * 0x10000; m1[4] = (temp >> 0x10); m1[16 + 4] = temp & 0xFFFF; @@ -555,19 +555,19 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) { m1[5] = (temp >> 0x10); m1[16 + 5] = temp & 0xFFFF; - temp = src->yz * 0x10000; + temp = src->zy * 0x10000; m1[6] = (temp >> 0x10); m1[16 + 6] = temp & 0xFFFF; - temp = src->yw * 0x10000; + temp = src->wy * 0x10000; m1[7] = (temp >> 0x10); m1[16 + 7] = temp & 0xFFFF; - temp = src->zx * 0x10000; + temp = src->xz * 0x10000; m1[8] = (temp >> 0x10); m1[16 + 8] = temp & 0xFFFF; - temp = src->zy * 0x10000; + temp = src->yz * 0x10000; m1[9] = (temp >> 0x10); m2[9] = temp & 0xFFFF; @@ -575,19 +575,19 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) { m1[10] = (temp >> 0x10); m2[10] = temp & 0xFFFF; - temp = src->zw * 0x10000; + temp = src->wz * 0x10000; m1[11] = (temp >> 0x10); m2[11] = temp & 0xFFFF; - temp = src->wx * 0x10000; + temp = src->xw * 0x10000; m1[12] = (temp >> 0x10); m2[12] = temp & 0xFFFF; - temp = src->wy * 0x10000; + temp = src->yw * 0x10000; m1[13] = (temp >> 0x10); m2[13] = temp & 0xFFFF; - temp = src->wz * 0x10000; + temp = src->zw * 0x10000; m1[14] = (temp >> 0x10); m2[14] = temp & 0xFFFF; @@ -612,43 +612,43 @@ Mtx* Matrix_MtxFToNewMtx(MtxF* src, GraphicsContext* gfxCtx) { void Matrix_MultVec3f(Vec3f* src, Vec3f* dest) { MtxF* cmf = sCurrentMatrix; - dest->x = cmf->wx + (cmf->xx * src->x + cmf->yx * src->y + cmf->zx * src->z); - dest->y = cmf->wy + (cmf->xy * src->x + cmf->yy * src->y + cmf->zy * src->z); - dest->z = cmf->wz + (cmf->xz * src->x + cmf->yz * src->y + cmf->zz * src->z); + dest->x = cmf->xw + (cmf->xx * src->x + cmf->xy * src->y + cmf->xz * src->z); + dest->y = cmf->yw + (cmf->yx * src->x + cmf->yy * src->y + cmf->yz * src->z); + dest->z = cmf->zw + (cmf->zx * src->x + cmf->zy * src->y + cmf->zz * src->z); } void Matrix_MtxFCopy(MtxF* dest, MtxF* src) { dest->xx = src->xx; - dest->xy = src->xy; - dest->xz = src->xz; - dest->xw = src->xw; dest->yx = src->yx; + dest->zx = src->zx; + dest->wx = src->wx; + dest->xy = src->xy; dest->yy = src->yy; - dest->yz = src->yz; - dest->yw = src->yw; + dest->zy = src->zy; + dest->wy = src->wy; dest->xx = src->xx; - dest->xy = src->xy; - dest->xz = src->xz; - dest->xw = src->xw; dest->yx = src->yx; + dest->zx = src->zx; + dest->wx = src->wx; + dest->xy = src->xy; dest->yy = src->yy; + dest->zy = src->zy; + dest->wy = src->wy; + dest->xz = src->xz; dest->yz = src->yz; + dest->zz = src->zz; + dest->wz = src->wz; + dest->xw = src->xw; dest->yw = src->yw; - dest->zx = src->zx; - dest->zy = src->zy; - dest->zz = src->zz; dest->zw = src->zw; - dest->wx = src->wx; - dest->wy = src->wy; - dest->wz = src->wz; dest->ww = src->ww; - dest->zx = src->zx; - dest->zy = src->zy; + dest->xz = src->xz; + dest->yz = src->yz; dest->zz = src->zz; - dest->zw = src->zw; - dest->wx = src->wx; - dest->wy = src->wy; dest->wz = src->wz; + dest->xw = src->xw; + dest->yw = src->yw; + dest->zw = src->zw; dest->ww = src->ww; } @@ -657,43 +657,43 @@ void Matrix_MtxToMtxF(Mtx* src, MtxF* dest) { u16* m2 = (u16*)&src->m[2][0]; dest->xx = ((m1[0] << 0x10) | m2[0]) * (1 / 65536.0f); - dest->xy = ((m1[1] << 0x10) | m2[1]) * (1 / 65536.0f); - dest->xz = ((m1[2] << 0x10) | m2[2]) * (1 / 65536.0f); - dest->xw = ((m1[3] << 0x10) | m2[3]) * (1 / 65536.0f); - dest->yx = ((m1[4] << 0x10) | m2[4]) * (1 / 65536.0f); + dest->yx = ((m1[1] << 0x10) | m2[1]) * (1 / 65536.0f); + dest->zx = ((m1[2] << 0x10) | m2[2]) * (1 / 65536.0f); + dest->wx = ((m1[3] << 0x10) | m2[3]) * (1 / 65536.0f); + dest->xy = ((m1[4] << 0x10) | m2[4]) * (1 / 65536.0f); dest->yy = ((m1[5] << 0x10) | m2[5]) * (1 / 65536.0f); - dest->yz = ((m1[6] << 0x10) | m2[6]) * (1 / 65536.0f); - dest->yw = ((m1[7] << 0x10) | m2[7]) * (1 / 65536.0f); - dest->zx = ((m1[8] << 0x10) | m2[8]) * (1 / 65536.0f); - dest->zy = ((m1[9] << 0x10) | m2[9]) * (1 / 65536.0f); + dest->zy = ((m1[6] << 0x10) | m2[6]) * (1 / 65536.0f); + dest->wy = ((m1[7] << 0x10) | m2[7]) * (1 / 65536.0f); + dest->xz = ((m1[8] << 0x10) | m2[8]) * (1 / 65536.0f); + dest->yz = ((m1[9] << 0x10) | m2[9]) * (1 / 65536.0f); dest->zz = ((m1[10] << 0x10) | m2[10]) * (1 / 65536.0f); - dest->zw = ((m1[11] << 0x10) | m2[11]) * (1 / 65536.0f); - dest->wx = ((m1[12] << 0x10) | m2[12]) * (1 / 65536.0f); - dest->wy = ((m1[13] << 0x10) | m2[13]) * (1 / 65536.0f); - dest->wz = ((m1[14] << 0x10) | m2[14]) * (1 / 65536.0f); + dest->wz = ((m1[11] << 0x10) | m2[11]) * (1 / 65536.0f); + dest->xw = ((m1[12] << 0x10) | m2[12]) * (1 / 65536.0f); + dest->yw = ((m1[13] << 0x10) | m2[13]) * (1 / 65536.0f); + dest->zw = ((m1[14] << 0x10) | m2[14]) * (1 / 65536.0f); dest->ww = ((m1[15] << 0x10) | m2[15]) * (1 / 65536.0f); } void Matrix_MultVec3fExt(Vec3f* src, Vec3f* dest, MtxF* mf) { - dest->x = mf->wx + (mf->xx * src->x + mf->yx * src->y + mf->zx * src->z); - dest->y = mf->wy + (mf->xy * src->x + mf->yy * src->y + mf->zy * src->z); - dest->z = mf->wz + (mf->xz * src->x + mf->yz * src->y + mf->zz * src->z); + dest->x = mf->xw + (mf->xx * src->x + mf->xy * src->y + mf->xz * src->z); + dest->y = mf->yw + (mf->yx * src->x + mf->yy * src->y + mf->yz * src->z); + dest->z = mf->zw + (mf->zx * src->x + mf->zy * src->y + mf->zz * src->z); } void Matrix_Transpose(MtxF* mf) { f32 temp; - temp = mf->xy; - mf->xy = mf->yx; - mf->yx = temp; + temp = mf->yx; + mf->yx = mf->xy; + mf->xy = temp; - temp = mf->xz; - mf->xz = mf->zx; - mf->zx = temp; + temp = mf->zx; + mf->zx = mf->xz; + mf->xz = temp; - temp = mf->yz; - mf->yz = mf->zy; - mf->zy = temp; + temp = mf->zy; + mf->zy = mf->yz; + mf->yz = temp; } void func_800D1FD4(MtxF* mf) { @@ -704,38 +704,38 @@ void func_800D1FD4(MtxF* mf) { temp = cmf->xx; temp *= temp; - temp2 = cmf->xy; + temp2 = cmf->yx; temp += SQ(temp2); - temp2 = cmf->xz; + temp2 = cmf->zx; temp += SQ(temp2); temp3 = sqrtf(temp); cmf->xx = mf->xx * temp3; - cmf->xy = mf->xy * temp3; - cmf->xz = mf->xz * temp3; + cmf->yx = mf->yx * temp3; + cmf->zx = mf->zx * temp3; - temp = cmf->yx; + temp = cmf->xy; temp *= temp; temp2 = cmf->yy; temp += SQ(temp2); - temp2 = cmf->yz; + temp2 = cmf->zy; temp += SQ(temp2); temp3 = sqrtf(temp); - cmf->yx = mf->yx * temp3; + cmf->xy = mf->xy * temp3; cmf->yy = mf->yy * temp3; - cmf->yz = mf->yz * temp3; + cmf->zy = mf->zy * temp3; - temp = cmf->zx; + temp = cmf->xz; temp *= temp; - temp2 = cmf->zy; + temp2 = cmf->yz; temp += SQ(temp2); temp2 = cmf->zz; temp += SQ(temp2); temp3 = sqrtf(temp); - cmf->zx = mf->zx * temp3; - cmf->zy = mf->zy * temp3; + cmf->xz = mf->xz * temp3; + cmf->yz = mf->yz * temp3; cmf->zz = mf->zz * temp3; } @@ -749,43 +749,43 @@ void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { f32 temp3; f32 temp4; - temp = mf->zx; + temp = mf->xz; temp *= temp; temp += SQ(mf->zz); - rotDest->x = Math_FAtan2F(-mf->zy, sqrtf(temp)) * (0x8000 / M_PI); + rotDest->x = Math_FAtan2F(-mf->yz, sqrtf(temp)) * (0x8000 / M_PI); if ((rotDest->x == 0x4000) || (rotDest->x == -0x4000)) { rotDest->z = 0; - rotDest->y = Math_FAtan2F(-mf->xz, mf->xx) * (0x8000 / M_PI); + rotDest->y = Math_FAtan2F(-mf->zx, mf->xx) * (0x8000 / M_PI); } else { - rotDest->y = Math_FAtan2F(mf->zx, mf->zz) * (0x8000 / M_PI); + rotDest->y = Math_FAtan2F(mf->xz, mf->zz) * (0x8000 / M_PI); if (!flag) { - rotDest->z = Math_FAtan2F(mf->xy, mf->yy) * (0x8000 / M_PI); + rotDest->z = Math_FAtan2F(mf->yx, mf->yy) * (0x8000 / M_PI); } else { temp = mf->xx; - temp2 = mf->xz; - temp3 = mf->yz; + temp2 = mf->zx; + temp3 = mf->zy; temp *= temp; temp += SQ(temp2); - temp2 = mf->xy; + temp2 = mf->yx; temp += SQ(temp2); - /* temp = xx^2+xz^2+xy^2 == 1 for a rotation matrix */ + /* temp = xx^2+zx^2+yx^2 == 1 for a rotation matrix */ temp = sqrtf(temp); temp = temp2 / temp; - temp2 = mf->yx; + temp2 = mf->xy; temp2 *= temp2; temp2 += SQ(temp3); temp3 = mf->yy; temp2 += SQ(temp3); - /* temp2 = yx^2+yz^2+yy^2 == 1 for a rotation matrix */ + /* temp2 = xy^2+zy^2+yy^2 == 1 for a rotation matrix */ temp2 = sqrtf(temp2); temp2 = temp3 / temp2; - /* for a rotation matrix, temp == xy and temp2 == yy + /* for a rotation matrix, temp == yx and temp2 == yy * which is the same as in the !flag branch */ rotDest->z = Math_FAtan2F(temp, temp2) * (0x8000 / M_PI); } @@ -804,31 +804,31 @@ void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) { temp = mf->xx; temp *= temp; - temp += SQ(mf->xy); - rotDest->y = Math_FAtan2F(-mf->xz, sqrtf(temp)) * (0x8000 / M_PI); + temp += SQ(mf->yx); + rotDest->y = Math_FAtan2F(-mf->zx, sqrtf(temp)) * (0x8000 / M_PI); if ((rotDest->y == 0x4000) || (rotDest->y == -0x4000)) { rotDest->x = 0; - rotDest->z = Math_FAtan2F(-mf->yx, mf->yy) * (0x8000 / M_PI); + rotDest->z = Math_FAtan2F(-mf->xy, mf->yy) * (0x8000 / M_PI); } else { - rotDest->z = Math_FAtan2F(mf->xy, mf->xx) * (0x8000 / M_PI); + rotDest->z = Math_FAtan2F(mf->yx, mf->xx) * (0x8000 / M_PI); if (!flag) { - rotDest->x = Math_FAtan2F(mf->yz, mf->zz) * (0x8000 / M_PI); + rotDest->x = Math_FAtan2F(mf->zy, mf->zz) * (0x8000 / M_PI); } else { // see Matrix_MtxFToYXZRotS - temp = mf->yx; + temp = mf->xy; temp2 = mf->yy; - temp3 = mf->zy; + temp3 = mf->yz; temp *= temp; temp += SQ(temp2); - temp2 = mf->yz; + temp2 = mf->zy; temp += SQ(temp2); temp = sqrtf(temp); temp = temp2 / temp; - temp2 = mf->zx; + temp2 = mf->xz; temp2 *= temp2; temp2 += SQ(temp3); temp3 = mf->zz; @@ -864,28 +864,28 @@ void Matrix_RotateAxis(f32 f, Vec3f* vec, u8 mode) { sin = sinf(f); cos = cosf(f); - temp2 = cmf->yx; - temp3 = cmf->zx; + temp2 = cmf->xy; + temp3 = cmf->xz; temp1 = cmf->xx; temp4 = (vec->x * temp1 + vec->y * temp2 + vec->z * temp3) * (1.0f - cos); cmf->xx = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y); - cmf->yx = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z); - cmf->zx = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x); + cmf->xy = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z); + cmf->xz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x); - temp1 = cmf->xy; + temp1 = cmf->yx; temp2 = cmf->yy; - temp3 = cmf->zy; + temp3 = cmf->yz; temp4 = (vec->x * temp1 + vec->y * temp2 + vec->z * temp3) * (1.0f - cos); - cmf->xy = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y); + cmf->yx = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y); cmf->yy = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z); - cmf->zy = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x); + cmf->yz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x); - temp1 = cmf->xz; - temp2 = cmf->yz; + temp1 = cmf->zx; + temp2 = cmf->zy; temp3 = cmf->zz; temp4 = (vec->x * temp1 + vec->y * temp2 + vec->z * temp3) * (1.0f - cos); - cmf->xz = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y); - cmf->yz = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z); + cmf->zx = temp1 * cos + vec->x * temp4 + sin * (temp2 * vec->z - temp3 * vec->y); + cmf->zy = temp2 * cos + vec->y * temp4 + sin * (temp3 * vec->x - temp1 * vec->z); cmf->zz = temp3 * cos + vec->z * temp4 + sin * (temp1 * vec->y - temp2 * vec->x); } } else { @@ -904,34 +904,34 @@ void Matrix_RotateAxis(f32 f, Vec3f* vec, u8 mode) { temp2 = vec->x * rCos * vec->y; temp3 = vec->z * sin; - cmf->xy = temp2 + temp3; - cmf->yx = temp2 - temp3; + cmf->yx = temp2 + temp3; + cmf->xy = temp2 - temp3; temp2 = vec->x * rCos * vec->z; temp3 = vec->y * sin; - cmf->xz = temp2 - temp3; - cmf->zx = temp2 + temp3; + cmf->zx = temp2 - temp3; + cmf->xz = temp2 + temp3; temp2 = vec->y * rCos * vec->z; temp3 = vec->x * sin; - cmf->yz = temp2 + temp3; - cmf->zy = temp2 - temp3; + cmf->zy = temp2 + temp3; + cmf->yz = temp2 - temp3; - cmf->xw = cmf->yw = cmf->zw = cmf->wx = cmf->wy = cmf->wz = 0.0f; + cmf->wx = cmf->wy = cmf->wz = cmf->xw = cmf->yw = cmf->zw = 0.0f; cmf->ww = 1.0f; } else { - cmf->xy = 0.0f; - cmf->xz = 0.0f; - cmf->xw = 0.0f; cmf->yx = 0.0f; - cmf->yz = 0.0f; - cmf->yw = 0.0f; cmf->zx = 0.0f; - cmf->zy = 0.0f; - cmf->zw = 0.0f; cmf->wx = 0.0f; + cmf->xy = 0.0f; + cmf->zy = 0.0f; cmf->wy = 0.0f; + cmf->xz = 0.0f; + cmf->yz = 0.0f; cmf->wz = 0.0f; + cmf->xw = 0.0f; + cmf->yw = 0.0f; + cmf->zw = 0.0f; cmf->xx = 1.0f; cmf->yy = 1.0f; cmf->zz = 1.0f; @@ -951,8 +951,8 @@ MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) { "| %12.6f %12.6f %12.6f %12.6f |\n" "| %12.6f %12.6f %12.6f %12.6f |\n" "\\ %12.6f %12.6f %12.6f %12.6f /\n", - file, line, "mf", mf->xx, mf->yx, mf->zx, mf->wx, mf->xy, mf->yy, mf->zy, mf->wy, mf->xz, - mf->yz, mf->zz, mf->wz, mf->xw, mf->yw, mf->zw, mf->ww); + file, line, "mf", mf->xx, mf->xy, mf->xz, mf->xw, mf->yx, mf->yy, mf->yz, mf->yw, mf->zx, + mf->zy, mf->zz, mf->zw, mf->wx, mf->wy, mf->wz, mf->ww); Fault_AddHungupAndCrash(file, line); } } @@ -962,21 +962,21 @@ MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) { } void func_800D2A34(MtxF* mf, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { - mf->xy = 0.0f; - mf->xz = 0.0f; - mf->xw = 0.0f; mf->yx = 0.0f; - mf->yz = 0.0f; - mf->yw = 0.0f; mf->zx = 0.0f; + mf->wx = 0.0f; + mf->xy = 0.0f; mf->zy = 0.0f; - mf->zw = 0.0f; + mf->wy = 0.0f; + mf->xz = 0.0f; + mf->yz = 0.0f; + mf->wz = 0.0f; mf->xx = arg1; mf->yy = arg1; mf->zz = arg1; - mf->wx = arg2; - mf->wy = arg3; - mf->wz = arg4; + mf->xw = arg2; + mf->yw = arg3; + mf->zw = arg4; mf->ww = 1.0f; } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 4ddc2581bc..588c10c9d4 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3146,8 +3146,8 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* glob mtx = &bodyBreak->matrices[bodyBreak->count]; - spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, mtx->wx, - mtx->wy, mtx->wz, 0, 0, objBankIndex, type); + spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&globalCtx->actorCtx, actor, globalCtx, ACTOR_EN_PART, mtx->xw, + mtx->yw, mtx->zw, 0, 0, objBankIndex, type); if (spawnedEnPart != NULL) { Matrix_MtxFToYXZRotS(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0); diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 426757f759..4c13653c1b 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -225,20 +225,20 @@ void func_80038A28(CollisionPoly* poly, f32 tx, f32 ty, f32 tz, MtxF* dest) { } } dest->xx = phi_f2; - dest->xy = (-nx) * phi_f14; - dest->xz = nx * phi_f12; - dest->yx = nx; + dest->yx = (-nx) * phi_f14; + dest->zx = nx * phi_f12; + dest->xy = nx; dest->yy = ny; - dest->yz = nz; - dest->zy = phi_f12; + dest->zy = nz; + dest->yz = phi_f12; dest->zz = phi_f14; - dest->xw = 0.0f; - dest->yw = 0.0f; - dest->zx = 0.0f; - dest->zw = 0.0f; - dest->wx = tx; - dest->wy = ty; - dest->wz = tz; + dest->wx = 0.0f; + dest->wy = 0.0f; + dest->xz = 0.0f; + dest->wz = 0.0f; + dest->xw = tx; + dest->yw = ty; + dest->zw = tz; dest->ww = 1.0f; } diff --git a/src/code/z_play.c b/src/code/z_play.c index d12eddcec1..8b90a835cd 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1387,37 +1387,37 @@ f32 func_800BFCB8(GlobalContext* globalCtx, MtxF* mf, Vec3f* vec) { } mf->xx = temp1; - mf->xy = -nx * temp2; - mf->xz = nx * temp3; - mf->yx = nx; + mf->yx = -nx * temp2; + mf->zx = nx * temp3; + mf->xy = nx; mf->yy = ny; - mf->yz = nz; - mf->zy = temp3; + mf->zy = nz; + mf->yz = temp3; mf->zz = temp2; - mf->xw = 0.0f; - mf->yw = 0.0f; - mf->zx = 0.0f; - mf->zw = 0.0f; - mf->wx = vec->x; - mf->wy = floorY; - mf->wz = vec->z; + mf->wx = 0.0f; + mf->wy = 0.0f; + mf->xz = 0.0f; + mf->wz = 0.0f; + mf->xw = vec->x; + mf->yw = floorY; + mf->zw = vec->z; mf->ww = 1.0f; } else { - mf->yx = 0.0f; - mf->xz = 0.0f; mf->xy = 0.0f; - mf->xx = 0.0f; - mf->zw = 0.0f; mf->zx = 0.0f; - mf->yw = 0.0f; - mf->xw = 0.0f; + mf->yx = 0.0f; + mf->xx = 0.0f; + mf->wz = 0.0f; + mf->xz = 0.0f; + mf->wy = 0.0f; + mf->wx = 0.0f; mf->zz = 0.0f; - mf->zy = 0.0f; mf->yz = 0.0f; + mf->zy = 0.0f; mf->yy = 1.0f; - mf->wx = vec->x; - mf->wy = vec->y; - mf->wz = vec->z; + mf->xw = vec->x; + mf->yw = vec->y; + mf->zw = vec->z; mf->ww = 1.0f; } @@ -1487,7 +1487,7 @@ void func_800C016C(GlobalContext* globalCtx, Vec3f* src, Vec3f* dest) { Matrix_MultVec3f(src, dest); temp = globalCtx->mf_11D60.ww + - (globalCtx->mf_11D60.xw * src->x + globalCtx->mf_11D60.yw * src->y + globalCtx->mf_11D60.zw * src->z); + (globalCtx->mf_11D60.wx * src->x + globalCtx->mf_11D60.wy * src->y + globalCtx->mf_11D60.wz * src->z); dest->x = 160.0f + ((dest->x / temp) * 160.0f); dest->y = 120.0f - ((dest->y / temp) * 120.0f); diff --git a/src/code/z_skin.c b/src/code/z_skin.c index fdb1169da8..b340aec641 100644 --- a/src/code/z_skin.c +++ b/src/code/z_skin.c @@ -17,12 +17,12 @@ void func_800A57C0(MtxF* mtx, Struct_800A57C0* arg1, Struct_800A598C* arg2, Vtx* temp_s2->n.ob[0] = arg4->x; temp_s2->n.ob[1] = arg4->y; temp_s2->n.ob[2] = arg4->z; - temp_x = mtx->wx; - temp_y = mtx->wy; - temp_z = mtx->wz; - mtx->wz = 0.0f; - mtx->wy = 0.0f; - mtx->wx = 0.0f; + temp_x = mtx->xw; + temp_y = mtx->yw; + temp_z = mtx->zw; + mtx->zw = 0.0f; + mtx->yw = 0.0f; + mtx->xw = 0.0f; sp64.x = phi_s1->unk_6; sp64.y = phi_s1->unk_7; sp64.z = phi_s1->unk_8; @@ -30,9 +30,9 @@ void func_800A57C0(MtxF* mtx, Struct_800A57C0* arg1, Struct_800A598C* arg2, Vtx* temp_s2->n.n[0] = sp70.x; temp_s2->n.n[1] = sp70.y; temp_s2->n.n[2] = sp70.z; - mtx->wx = temp_x; - mtx->wy = temp_y; - mtx->wz = temp_z; + mtx->xw = temp_x; + mtx->yw = temp_y; + mtx->zw = temp_z; } } diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 646a26c70e..7362804f69 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -17,10 +17,10 @@ MtxF sMtxFClear = { * \f[ [\texttt{xyzDest}, \texttt{wDest}] = [\texttt{src}, 1] \cdot [mf] \f] */ void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDest) { - xyzDest->x = mf->wx + ((src->x * mf->xx) + (src->y * mf->yx) + (src->z * mf->zx)); - xyzDest->y = mf->wy + ((src->x * mf->xy) + (src->y * mf->yy) + (src->z * mf->zy)); - xyzDest->z = mf->wz + ((src->x * mf->xz) + (src->y * mf->yz) + (src->z * mf->zz)); - *wDest = mf->ww + ((src->x * mf->xw) + (src->y * mf->yw) + (src->z * mf->zw)); + xyzDest->x = mf->xw + ((src->x * mf->xx) + (src->y * mf->xy) + (src->z * mf->xz)); + xyzDest->y = mf->yw + ((src->x * mf->yx) + (src->y * mf->yy) + (src->z * mf->yz)); + xyzDest->z = mf->zw + ((src->x * mf->zx) + (src->y * mf->zy) + (src->z * mf->zz)); + *wDest = mf->ww + ((src->x * mf->wx) + (src->y * mf->wy) + (src->z * mf->wz)); } /** @@ -30,20 +30,20 @@ void SkinMatrix_Vec3fMtxFMultXYZW(MtxF* mf, Vec3f* src, Vec3f* xyzDest, f32* wDe */ void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest) { f32 mx = mf->xx; - f32 my = mf->yx; - f32 mz = mf->zx; - f32 mw = mf->wx; + f32 my = mf->xy; + f32 mz = mf->xz; + f32 mw = mf->xw; dest->x = mw + ((src->x * mx) + (src->y * my) + (src->z * mz)); - mx = mf->xy; + mx = mf->yx; my = mf->yy; - mz = mf->zy; - mw = mf->wy; + mz = mf->yz; + mw = mf->yw; dest->y = mw + ((src->x * mx) + (src->y * my) + (src->z * mz)); - mx = mf->xz; - my = mf->yz; + mx = mf->zx; + my = mf->zy; mz = mf->zz; - mw = mf->wz; + mw = mf->zw; dest->z = mw + ((src->x * mx) + (src->y * my) + (src->z * mz)); } @@ -52,130 +52,130 @@ void SkinMatrix_Vec3fMtxFMultXYZ(MtxF* mf, Vec3f* src, Vec3f* dest) { * mfA and dest should not be the same matrix. */ void SkinMatrix_MtxFMtxFMult(MtxF* mfB, MtxF* mfA, MtxF* dest) { - f32 rx; - f32 ry; - f32 rz; - f32 rw; - //---COL1--- - f32 cx = mfB->xx; - f32 cy = mfB->yx; - f32 cz = mfB->zx; - f32 cw = mfB->wx; + f32 x2; + f32 y2; + f32 z2; + f32 w2; + //---ROW1--- + f32 x1 = mfB->xx; + f32 y1 = mfB->xy; + f32 z1 = mfB->xz; + f32 w1 = mfB->xw; //-------- - rx = mfA->xx; - ry = mfA->xy; - rz = mfA->xz; - rw = mfA->xw; - dest->xx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xx; + y2 = mfA->yx; + z2 = mfA->zx; + w2 = mfA->wx; + dest->xx = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->yx; - ry = mfA->yy; - rz = mfA->yz; - rw = mfA->yw; - dest->yx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xy; + y2 = mfA->yy; + z2 = mfA->zy; + w2 = mfA->wy; + dest->xy = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->zx; - ry = mfA->zy; - rz = mfA->zz; - rw = mfA->zw; - dest->zx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xz; + y2 = mfA->yz; + z2 = mfA->zz; + w2 = mfA->wz; + dest->xz = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->wx; - ry = mfA->wy; - rz = mfA->wz; - rw = mfA->ww; - dest->wx = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xw; + y2 = mfA->yw; + z2 = mfA->zw; + w2 = mfA->ww; + dest->xw = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - //---2Col--- - cx = mfB->xy; - cy = mfB->yy; - cz = mfB->zy; - cw = mfB->wy; + //---ROW2--- + x1 = mfB->yx; + y1 = mfB->yy; + z1 = mfB->yz; + w1 = mfB->yw; //-------- - rx = mfA->xx; - ry = mfA->xy; - rz = mfA->xz; - rw = mfA->xw; - dest->xy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xx; + y2 = mfA->yx; + z2 = mfA->zx; + w2 = mfA->wx; + dest->yx = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->yx; - ry = mfA->yy; - rz = mfA->yz; - rw = mfA->yw; - dest->yy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xy; + y2 = mfA->yy; + z2 = mfA->zy; + w2 = mfA->wy; + dest->yy = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->zx; - ry = mfA->zy; - rz = mfA->zz; - rw = mfA->zw; - dest->zy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xz; + y2 = mfA->yz; + z2 = mfA->zz; + w2 = mfA->wz; + dest->yz = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->wx; - ry = mfA->wy; - rz = mfA->wz; - rw = mfA->ww; - dest->wy = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xw; + y2 = mfA->yw; + z2 = mfA->zw; + w2 = mfA->ww; + dest->yw = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - //---3Col--- - cx = mfB->xz; - cy = mfB->yz; - cz = mfB->zz; - cw = mfB->wz; + //---ROW3--- + x1 = mfB->zx; + y1 = mfB->zy; + z1 = mfB->zz; + w1 = mfB->zw; //-------- - rx = mfA->xx; - ry = mfA->xy; - rz = mfA->xz; - rw = mfA->xw; - dest->xz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xx; + y2 = mfA->yx; + z2 = mfA->zx; + w2 = mfA->wx; + dest->zx = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->yx; - ry = mfA->yy; - rz = mfA->yz; - rw = mfA->yw; - dest->yz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xy; + y2 = mfA->yy; + z2 = mfA->zy; + w2 = mfA->wy; + dest->zy = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->zx; - ry = mfA->zy; - rz = mfA->zz; - rw = mfA->zw; - dest->zz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xz; + y2 = mfA->yz; + z2 = mfA->zz; + w2 = mfA->wz; + dest->zz = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->wx; - ry = mfA->wy; - rz = mfA->wz; - rw = mfA->ww; - dest->wz = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xw; + y2 = mfA->yw; + z2 = mfA->zw; + w2 = mfA->ww; + dest->zw = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - //---4Col--- - cx = mfB->xw; - cy = mfB->yw; - cz = mfB->zw; - cw = mfB->ww; + //---ROW4--- + x1 = mfB->wx; + y1 = mfB->wy; + z1 = mfB->wz; + w1 = mfB->ww; //-------- - rx = mfA->xx; - ry = mfA->xy; - rz = mfA->xz; - rw = mfA->xw; - dest->xw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xx; + y2 = mfA->yx; + z2 = mfA->zx; + w2 = mfA->wx; + dest->wx = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->yx; - ry = mfA->yy; - rz = mfA->yz; - rw = mfA->yw; - dest->yw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xy; + y2 = mfA->yy; + z2 = mfA->zy; + w2 = mfA->wy; + dest->wy = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->zx; - ry = mfA->zy; - rz = mfA->zz; - rw = mfA->zw; - dest->zw = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xz; + y2 = mfA->yz; + z2 = mfA->zz; + w2 = mfA->wz; + dest->wz = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); - rx = mfA->wx; - ry = mfA->wy; - rz = mfA->wz; - rw = mfA->ww; - dest->ww = (cx * rx) + (cy * ry) + (cz * rz) + (cw * rw); + x2 = mfA->xw; + y2 = mfA->yw; + z2 = mfA->zw; + w2 = mfA->ww; + dest->ww = (x1 * x2) + (y1 * y2) + (z1 * z2) + (w1 * w2); } /** @@ -190,36 +190,36 @@ void SkinMatrix_Clear(MtxF* mf) { mf->yy = 1.0f; mf->zz = 1.0f; mf->ww = 1.0f; - mf->xy = 0.0f; - mf->xz = 0.0f; - mf->xw = 0.0f; mf->yx = 0.0f; - mf->yz = 0.0f; - mf->yw = 0.0f; mf->zx = 0.0f; - mf->zy = 0.0f; - mf->zw = 0.0f; mf->wx = 0.0f; + mf->xy = 0.0f; + mf->zy = 0.0f; mf->wy = 0.0f; + mf->xz = 0.0f; + mf->yz = 0.0f; mf->wz = 0.0f; + mf->xw = 0.0f; + mf->yw = 0.0f; + mf->zw = 0.0f; } void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest) { dest->xx = src->xx; - dest->xy = src->xy; - dest->xz = src->xz; - dest->xw = src->xw; dest->yx = src->yx; - dest->yy = src->yy; - dest->yz = src->yz; - dest->yw = src->yw; dest->zx = src->zx; - dest->zy = src->zy; - dest->zz = src->zz; - dest->zw = src->zw; dest->wx = src->wx; + dest->xy = src->xy; + dest->yy = src->yy; + dest->zy = src->zy; dest->wy = src->wy; + dest->xz = src->xz; + dest->yz = src->yz; + dest->zz = src->zz; dest->wz = src->wz; + dest->xw = src->xw; + dest->yw = src->yw; + dest->zw = src->zw; dest->ww = src->ww; } @@ -290,18 +290,18 @@ s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) { * Produces a matrix which scales x,y,z components of vectors or x,y,z rows of matrices (when applied on LHS) */ void SkinMatrix_SetScale(MtxF* mf, f32 x, f32 y, f32 z) { - mf->xy = 0.0f; - mf->xz = 0.0f; - mf->xw = 0.0f; mf->yx = 0.0f; - mf->yz = 0.0f; - mf->yw = 0.0f; mf->zx = 0.0f; - mf->zy = 0.0f; - mf->zw = 0.0f; mf->wx = 0.0f; + mf->xy = 0.0f; + mf->zy = 0.0f; mf->wy = 0.0f; + mf->xz = 0.0f; + mf->yz = 0.0f; mf->wz = 0.0f; + mf->xw = 0.0f; + mf->yw = 0.0f; + mf->zw = 0.0f; mf->ww = 1.0f; mf->xx = x; mf->yy = y; @@ -315,16 +315,16 @@ void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) { f32 cos2; f32 sin = Math_SinS(yaw); f32 cos = Math_CosS(yaw); - f32 yx; + f32 xy; f32 sin2; - f32 zx; + f32 xz; f32 yy; - f32 zy; + f32 yz; mf->yy = cos; - mf->yx = -sin; - mf->xw = mf->yw = mf->zw = 0; + mf->xy = -sin; mf->wx = mf->wy = mf->wz = 0; + mf->xw = mf->yw = mf->zw = 0; mf->ww = 1; if (pitch != 0) { @@ -332,20 +332,20 @@ void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) { cos2 = Math_CosS(pitch); mf->xx = cos * cos2; - mf->zx = cos * sin2; + mf->xz = cos * sin2; - mf->xy = sin * cos2; - mf->zy = sin * sin2; - mf->xz = -sin2; + mf->yx = sin * cos2; + mf->yz = sin * sin2; + mf->zx = -sin2; mf->zz = cos2; } else { mf->xx = cos; if (1) {} if (1) {} - zx = sin; // required to match - mf->xy = sin; - mf->xz = mf->zx = mf->zy = 0; + xz = sin; // required to match + mf->yx = sin; + mf->zx = mf->xz = mf->yz = 0; mf->zz = 1; } @@ -353,22 +353,22 @@ void SkinMatrix_SetRotateRPY(MtxF* mf, s16 roll, s16 pitch, s16 yaw) { sin2 = Math_SinS(roll); cos2 = Math_CosS(roll); - yx = mf->yx; - zx = mf->zx; - mf->yx = (yx * cos2) + (zx * sin2); - mf->zx = (zx * cos2) - (yx * sin2); + xy = mf->xy; + xz = mf->xz; + mf->xy = (xy * cos2) + (xz * sin2); + mf->xz = (xz * cos2) - (xy * sin2); if (1) {} - zy = mf->zy; + yz = mf->yz; yy = mf->yy; - mf->yy = (yy * cos2) + (zy * sin2); - mf->zy = (zy * cos2) - (yy * sin2); + mf->yy = (yy * cos2) + (yz * sin2); + mf->yz = (yz * cos2) - (yy * sin2); if (cos2) {} - mf->yz = mf->zz * sin2; + mf->zy = mf->zz * sin2; mf->zz = mf->zz * cos2; } else { - mf->yz = 0; + mf->zy = 0; } } @@ -379,21 +379,21 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) { f32 cos2; f32 sin; f32 cos; - f32 xz; + f32 zx; f32 sin2; - f32 yz; + f32 zy; f32 xx; - f32 yx; + f32 xy; sin = Math_SinS(roll); cos = Math_CosS(roll); mf->xx = cos; - mf->xz = -sin; - mf->zw = 0; - mf->yw = 0; - mf->xw = 0; + mf->zx = -sin; mf->wz = 0; mf->wy = 0; mf->wx = 0; + mf->zw = 0; + mf->yw = 0; + mf->xw = 0; mf->ww = 1; if (yaw != 0) { @@ -401,20 +401,20 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) { cos2 = Math_CosS(yaw); mf->zz = cos * cos2; - mf->yz = cos * sin2; + mf->zy = cos * sin2; - mf->zx = sin * cos2; - mf->yx = sin * sin2; - mf->zy = -sin2; + mf->xz = sin * cos2; + mf->xy = sin * sin2; + mf->yz = -sin2; mf->yy = cos2; } else { mf->zz = cos; if (1) {} if (1) {} - yx = sin; // required to match - mf->zx = sin; - mf->yx = mf->yz = mf->zy = 0; + xy = sin; // required to match + mf->xz = sin; + mf->xy = mf->zy = mf->yz = 0; mf->yy = 1; } @@ -422,19 +422,19 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) { sin2 = Math_SinS(pitch); cos2 = Math_CosS(pitch); xx = mf->xx; - yx = mf->yx; - mf->xx = (xx * cos2) + (yx * sin2); - mf->yx = yx * cos2 - (xx * sin2); + xy = mf->xy; + mf->xx = (xx * cos2) + (xy * sin2); + mf->xy = xy * cos2 - (xx * sin2); if (1) {} - yz = mf->yz; - xz = mf->xz; - mf->xz = (xz * cos2) + (yz * sin2); - mf->yz = (yz * cos2) - (xz * sin2); + zy = mf->zy; + zx = mf->zx; + mf->zx = (zx * cos2) + (zy * sin2); + mf->zy = (zy * cos2) - (zx * sin2); if (cos2) {} - mf->xy = mf->yy * sin2; + mf->yx = mf->yy * sin2; mf->yy = mf->yy * cos2; } else { - mf->xy = 0; + mf->yx = 0; } } @@ -442,22 +442,22 @@ void SkinMatrix_SetRotateYRP(MtxF* mf, s16 yaw, s16 roll, s16 pitch) { * Produces a matrix which translates a vector by amounts in the x, y and z directions */ void SkinMatrix_SetTranslate(MtxF* mf, f32 x, f32 y, f32 z) { - mf->xy = 0.0f; - mf->xz = 0.0f; - mf->xw = 0.0f; mf->yx = 0.0f; - mf->yz = 0.0f; - mf->yw = 0.0f; mf->zx = 0.0f; + mf->wx = 0.0f; + mf->xy = 0.0f; mf->zy = 0.0f; - mf->zw = 0.0f; + mf->wy = 0.0f; + mf->xz = 0.0f; + mf->yz = 0.0f; + mf->wz = 0.0f; mf->xx = 1.0f; mf->yy = 1.0f; mf->zz = 1.0f; mf->ww = 1.0f; - mf->wx = x; - mf->wy = y; - mf->wz = z; + mf->xw = x; + mf->yw = y; + mf->zw = z; } /** @@ -523,19 +523,19 @@ void SkinMatrix_MtxFToMtx(MtxF* src, Mtx* dest) { m1[0] = (temp >> 0x10); m1[16 + 0] = temp & 0xFFFF; - temp = src->xy * 0x10000; + temp = src->yx * 0x10000; m1[1] = (temp >> 0x10); m1[16 + 1] = temp & 0xFFFF; - temp = src->xz * 0x10000; + temp = src->zx * 0x10000; m1[2] = (temp >> 0x10); m1[16 + 2] = temp & 0xFFFF; - temp = src->xw * 0x10000; + temp = src->wx * 0x10000; m1[3] = (temp >> 0x10); m1[16 + 3] = temp & 0xFFFF; - temp = src->yx * 0x10000; + temp = src->xy * 0x10000; m1[4] = (temp >> 0x10); m1[16 + 4] = temp & 0xFFFF; @@ -543,19 +543,19 @@ void SkinMatrix_MtxFToMtx(MtxF* src, Mtx* dest) { m1[5] = (temp >> 0x10); m1[16 + 5] = temp & 0xFFFF; - temp = src->yz * 0x10000; + temp = src->zy * 0x10000; m1[6] = (temp >> 0x10); m1[16 + 6] = temp & 0xFFFF; - temp = src->yw * 0x10000; + temp = src->wy * 0x10000; m1[7] = (temp >> 0x10); m1[16 + 7] = temp & 0xFFFF; - temp = src->zx * 0x10000; + temp = src->xz * 0x10000; m1[8] = (temp >> 0x10); m1[16 + 8] = temp & 0xFFFF; - temp = src->zy * 0x10000; + temp = src->yz * 0x10000; m1[9] = (temp >> 0x10); m2[9] = temp & 0xFFFF; @@ -563,19 +563,19 @@ void SkinMatrix_MtxFToMtx(MtxF* src, Mtx* dest) { m1[10] = (temp >> 0x10); m2[10] = temp & 0xFFFF; - temp = src->zw * 0x10000; + temp = src->wz * 0x10000; m1[11] = (temp >> 0x10); m2[11] = temp & 0xFFFF; - temp = src->wx * 0x10000; + temp = src->xw * 0x10000; m1[12] = (temp >> 0x10); m2[12] = temp & 0xFFFF; - temp = src->wy * 0x10000; + temp = src->yw * 0x10000; m1[13] = (temp >> 0x10); m2[13] = temp & 0xFFFF; - temp = src->wz * 0x10000; + temp = src->zw * 0x10000; m1[14] = (temp >> 0x10); m2[14] = temp & 0xFFFF; @@ -620,21 +620,21 @@ void func_800A7EC0(MtxF* mf, s16 a, f32 x, f32 y, f32 z) { xz = x * z; mf->xx = (1.0f - xx) * cosA + xx; - mf->xy = (1.0f - cosA) * xy + z * sinA; - mf->xz = (1.0f - cosA) * xz - y * sinA; - mf->xw = 0.0f; + mf->yx = (1.0f - cosA) * xy + z * sinA; + mf->zx = (1.0f - cosA) * xz - y * sinA; + mf->wx = 0.0f; - mf->yx = (1.0f - cosA) * xy - z * sinA; + mf->xy = (1.0f - cosA) * xy - z * sinA; mf->yy = (1.0f - yy) * cosA + yy; - mf->yz = (1.0f - cosA) * yz + x * sinA; - mf->yw = 0.0f; + mf->zy = (1.0f - cosA) * yz + x * sinA; + mf->wy = 0.0f; - mf->zx = (1.0f - cosA) * xz + y * sinA; - mf->zy = (1.0f - cosA) * yz - x * sinA; + mf->xz = (1.0f - cosA) * xz + y * sinA; + mf->yz = (1.0f - cosA) * yz - x * sinA; mf->zz = (1.0f - zz) * cosA + zz; - mf->zw = 0.0f; + mf->wz = 0.0f; - mf->wx = mf->wy = mf->wz = 0.0f; + mf->xw = mf->yw = mf->zw = 0.0f; mf->ww = 1.0f; } @@ -669,19 +669,19 @@ void func_800A8030(MtxF* mf, f32* arg1) { zzNorm = arg1[2] * zNorm; mf->xx = (1.0f - (yyNorm + zzNorm)); - mf->xy = (xyNorm + wzNorm); - mf->xz = (xzNorm - wyNorm); - mf->xw = 0.0f; - mf->yx = (xyNorm - wzNorm); - mf->yy = (1.0f - (xxNorm + zzNorm)); - mf->yz = (yzNorm + wxNorm); - mf->yw = 0.0f; - mf->zx = (yzNorm + wyNorm); - mf->zy = (yzNorm - wxNorm); - mf->zz = (1.0f - (xxNorm + yyNorm)); - mf->zw = 0.0f; + mf->yx = (xyNorm + wzNorm); + mf->zx = (xzNorm - wyNorm); mf->wx = 0.0f; + mf->xy = (xyNorm - wzNorm); + mf->yy = (1.0f - (xxNorm + zzNorm)); + mf->zy = (yzNorm + wxNorm); mf->wy = 0.0f; - mf->ww = 1.0f; + mf->xz = (yzNorm + wyNorm); + mf->yz = (yzNorm - wxNorm); + mf->zz = (1.0f - (xxNorm + yyNorm)); mf->wz = 0.0f; + mf->xw = 0.0f; + mf->yw = 0.0f; + mf->ww = 1.0f; + mf->zw = 0.0f; } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index 0b6272a400..4a4cab37f8 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -211,9 +211,9 @@ Gfx* BgHidanRsekizou_DrawFireball(GlobalContext* globalCtx, BgHidanRsekizou* thi mf->xx = mf->yy = mf->zz = (0.7f * fVar6) + 0.5f; tmpf7 = (((((0.7f * fVar6) + 0.5f) * 10.0f) * fVar6) + 20.0f); - mf->wx = (tmpf7 * sins) + this->dyna.actor.world.pos.x; - mf->wy = (this->dyna.actor.world.pos.y + 30.0f) + ((7.0f / 10.0f) * fVar6); - mf->wz = (tmpf7 * coss) + this->dyna.actor.world.pos.z; + mf->xw = (tmpf7 * sins) + this->dyna.actor.world.pos.x; + mf->yw = (this->dyna.actor.world.pos.y + 30.0f) + ((7.0f / 10.0f) * fVar6); + mf->zw = (tmpf7 * coss) + this->dyna.actor.world.pos.z; gSPMatrix(displayList++, Matrix_MtxFToMtx(Matrix_CheckFloats(mf, "../z_bg_hidan_rsekizou.c", 543), diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index cd75598bcf..e83c32b4fd 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -244,16 +244,16 @@ Gfx* func_8088EB54(GlobalContext* globalCtx, BgHidanSima* this, Gfx* gfx) { v0 = 3 - (this->timer >> 1); v0 = CLAMP_MIN(v0, 0); - mtxF.wx = this->dyna.actor.world.pos.x + ((79 - ((this->timer % 6) * 4)) + v0 * 25) * sin; - mtxF.wz = this->dyna.actor.world.pos.z + ((79 - ((this->timer % 6) * 4)) + v0 * 25) * cos; - mtxF.wy = this->dyna.actor.world.pos.y + 40.0f; + mtxF.xw = this->dyna.actor.world.pos.x + ((79 - ((this->timer % 6) * 4)) + v0 * 25) * sin; + mtxF.zw = this->dyna.actor.world.pos.z + ((79 - ((this->timer % 6) * 4)) + v0 * 25) * cos; + mtxF.yw = this->dyna.actor.world.pos.y + 40.0f; mtxF.zz = v0 * 0.4f + 1.0f; mtxF.yy = v0 * 0.4f + 1.0f; mtxF.xx = v0 * 0.4f + 1.0f; for (s3 = v0; s3 < phi_s5; s3++) { - mtxF.wx += 25.0f * sin; - mtxF.wz += 25.0f * cos; + mtxF.xw += 25.0f * sin; + mtxF.zw += 25.0f * cos; mtxF.xx += 0.4f; mtxF.yy += 0.4f; mtxF.zz += 0.4f; @@ -265,8 +265,8 @@ Gfx* func_8088EB54(GlobalContext* globalCtx, BgHidanSima* this, Gfx* gfx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(gfx++, gFireTempleFireballDL); } - mtxF.wx = this->dyna.actor.world.pos.x + (phi_s5 * 25 + 80) * sin; - mtxF.wz = this->dyna.actor.world.pos.z + (phi_s5 * 25 + 80) * cos; + mtxF.xw = this->dyna.actor.world.pos.x + (phi_s5 * 25 + 80) * sin; + mtxF.zw = this->dyna.actor.world.pos.z + (phi_s5 * 25 + 80) * cos; gSPSegment(gfx++, 0x09, SEGMENTED_TO_VIRTUAL(sFireballsTexs[(this->timer + s3) % 7])); gSPMatrix(gfx++, Matrix_MtxFToMtx(Matrix_CheckFloats(&mtxF, "../z_bg_hidan_sima.c", 624), diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index a1a949ae92..fc06602eb6 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -171,15 +171,15 @@ void func_809C5BA8(EnBomChu* this, CollisionPoly* floorPoly, GlobalContext* glob if (1) {} mf.xx = this->unk_16C.x; - mf.xy = this->unk_16C.y; - mf.xz = this->unk_16C.z; + mf.yx = this->unk_16C.y; + mf.zx = this->unk_16C.z; - mf.yx = sp84.x; + mf.xy = sp84.x; mf.yy = sp84.y; - mf.yz = sp84.z; + mf.zy = sp84.z; - mf.zx = this->unk_154.x; - mf.zy = this->unk_154.y; + mf.xz = this->unk_154.x; + mf.yz = this->unk_154.y; mf.zz = this->unk_154.z; Matrix_MtxFToYXZRotS(&mf, &this->actor.world.rot, 0); diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/src/overlays/actors/ovl_En_Brob/z_en_brob.c index 50638d56d8..96d1d8a53c 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -310,13 +310,13 @@ void EnBrob_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_Get(&mtx); if (limbIndex == 3) { - this->colliders[0].dim.pos.x = mtx.wx; - this->colliders[0].dim.pos.y = mtx.wy; - this->colliders[0].dim.pos.z = mtx.wz; + this->colliders[0].dim.pos.x = mtx.xw; + this->colliders[0].dim.pos.y = mtx.yw; + this->colliders[0].dim.pos.z = mtx.zw; } else if (limbIndex == 8) { - this->colliders[1].dim.pos.x = mtx.wx; - this->colliders[1].dim.pos.y = (mtx.wy + 7.0f); - this->colliders[1].dim.pos.z = mtx.wz; + this->colliders[1].dim.pos.x = mtx.xw; + this->colliders[1].dim.pos.y = (mtx.yw + 7.0f); + this->colliders[1].dim.pos.z = mtx.zw; } } 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 2cf56aeb6b..66fa92fa10 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1192,10 +1192,10 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { } for (i = 0; i < stemSections; i++) { - mtx.wy += 20.0f * Math_SinS(this->stemSectionAngle[i]) * this->size; + mtx.yw += 20.0f * Math_SinS(this->stemSectionAngle[i]) * this->size; horizontalStepSize = 20.0f * Math_CosS(this->stemSectionAngle[i]) * this->size; - mtx.wx -= horizontalStepSize * Math_SinS(this->actor.shape.rot.y); - mtx.wz -= horizontalStepSize * Math_CosS(this->actor.shape.rot.y); + mtx.xw -= horizontalStepSize * Math_SinS(this->actor.shape.rot.y); + 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); @@ -1209,9 +1209,9 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { if (i == 0) { if (this->actionFunc != EnDekubaba_Sway) { - this->actor.focus.pos.x = mtx.wx; - this->actor.focus.pos.y = mtx.wy; - this->actor.focus.pos.z = mtx.wz; + this->actor.focus.pos.x = mtx.xw; + this->actor.focus.pos.y = mtx.yw; + this->actor.focus.pos.z = mtx.zw; } else { this->actor.focus.pos.x = this->actor.home.pos.x; this->actor.focus.pos.y = this->actor.home.pos.y + (40.0f * this->size); @@ -1221,9 +1221,9 @@ void EnDekubaba_DrawStemExtended(EnDekubaba* this, GlobalContext* globalCtx) { if ((i < 2) && (this->actor.colorFilterTimer != 0)) { // checking colorFilterTimer ensures that spA4 has been initialized earlier, so not a bug - this->bodyPartsPos[i].x = mtx.wx; - this->bodyPartsPos[i].y = mtx.wy - spA4; - this->bodyPartsPos[i].z = mtx.wz; + this->bodyPartsPos[i].x = mtx.xw; + this->bodyPartsPos[i].y = mtx.yw - spA4; + this->bodyPartsPos[i].z = mtx.zw; } } diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 1f62e29165..56f4c57984 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -756,9 +756,9 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList if ((limbIndex == 15) || (limbIndex == 21)) { if (this->actionFunc != EnFirefly_Die) { Matrix_Get(&mtx); - effPos.x = (Rand_ZeroOne() * 5.0f) + mtx.wx; - effPos.y = (Rand_ZeroOne() * 5.0f) + mtx.wy; - effPos.z = (Rand_ZeroOne() * 5.0f) + mtx.wz; + effPos.x = (Rand_ZeroOne() * 5.0f) + mtx.xw; + effPos.y = (Rand_ZeroOne() * 5.0f) + mtx.yw; + effPos.z = (Rand_ZeroOne() * 5.0f) + mtx.zw; effScaleStep = -40; effLife = 3; } else { diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index 23e30d1edc..90b0a6d429 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -375,8 +375,8 @@ void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx) { Vec3f tempVel; Vec3f shieldVec; - shieldVec.x = -player->shieldMf.zx; - shieldVec.y = -player->shieldMf.zy; + shieldVec.x = -player->shieldMf.xz; + shieldVec.y = -player->shieldMf.yz; shieldVec.z = -player->shieldMf.zz; EnHonotrap_GetNormal(&shieldNorm, &shieldVec); diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 35f50252fa..92efb1c44a 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -913,9 +913,9 @@ void EnPoField_PostLimDraw2(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } Matrix_Get(&sLimb7Mtx); if (this->actionFunc == EnPoField_Death && this->actionTimer == 27) { - this->actor.world.pos.x = sLimb7Mtx.wx; - this->actor.world.pos.y = sLimb7Mtx.wy; - this->actor.world.pos.z = sLimb7Mtx.wz; + this->actor.world.pos.x = sLimb7Mtx.xw; + this->actor.world.pos.y = sLimb7Mtx.yw; + this->actor.world.pos.z = sLimb7Mtx.zw; } Lights_PointGlowSetInfo(&this->lightInfo, vec.x, vec.y, vec.z, this->soulColor.r, this->soulColor.g, this->soulColor.b, this->soulColor.a * (200.0f / 255)); diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index b16bd54e63..b44c945b14 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -1061,9 +1061,9 @@ void EnPoh_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } Matrix_Get(&this->unk_368); if (this->actionFunc == func_80ADF15C && this->unk_198 == 27) { - this->actor.world.pos.x = this->unk_368.wx; - this->actor.world.pos.y = this->unk_368.wy; - this->actor.world.pos.z = this->unk_368.wz; + this->actor.world.pos.x = this->unk_368.xw; + this->actor.world.pos.y = this->unk_368.yw; + this->actor.world.pos.z = this->unk_368.zw; } Lights_PointGlowSetInfo(&this->lightInfo, this->colliderSph.elements[0].dim.worldSphere.center.x, this->colliderSph.elements[0].dim.worldSphere.center.y, diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index dd61f4eccd..d1b1ec21b8 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -90,20 +90,20 @@ s32 func_80B0BE20(EnSw* this, CollisionPoly* poly) { this->unk_37C.z = this->unk_37C.z * (1.0f / temp_f0); this->unk_364 = sp44; this->unk_3D8.xx = this->unk_370.x; - this->unk_3D8.xy = this->unk_370.y; - this->unk_3D8.xz = this->unk_370.z; - this->unk_3D8.xw = 0.0f; - this->unk_3D8.yx = this->unk_364.x; - this->unk_3D8.yy = this->unk_364.y; - this->unk_3D8.yz = this->unk_364.z; - this->unk_3D8.yw = 0.0f; - this->unk_3D8.zx = this->unk_37C.x; - this->unk_3D8.zy = this->unk_37C.y; - this->unk_3D8.zz = this->unk_37C.z; - this->unk_3D8.zw = 0.0f; + this->unk_3D8.yx = this->unk_370.y; + this->unk_3D8.zx = this->unk_370.z; this->unk_3D8.wx = 0.0f; + this->unk_3D8.xy = this->unk_364.x; + this->unk_3D8.yy = this->unk_364.y; + this->unk_3D8.zy = this->unk_364.z; this->unk_3D8.wy = 0.0f; + this->unk_3D8.xz = this->unk_37C.x; + this->unk_3D8.yz = this->unk_37C.y; + this->unk_3D8.zz = this->unk_37C.z; this->unk_3D8.wz = 0.0f; + this->unk_3D8.xw = 0.0f; + this->unk_3D8.yw = 0.0f; + this->unk_3D8.zw = 0.0f; this->unk_3D8.ww = 1.0f; Matrix_MtxFToYXZRotS(&this->unk_3D8, &this->actor.world.rot, 0); //! @bug: Does not return. @@ -405,20 +405,20 @@ s32 func_80B0CCF4(EnSw* this, f32* arg1) { this->unk_37C.y *= temp_f0; this->unk_37C.z *= temp_f0; sp2C.xx = this->unk_370.x; - sp2C.xy = this->unk_370.y; - sp2C.xz = this->unk_370.z; - sp2C.xw = 0.0f; - sp2C.yx = this->unk_364.x; - sp2C.yy = this->unk_364.y; - sp2C.yz = this->unk_364.z; - sp2C.yw = 0.0f; - sp2C.zx = this->unk_37C.x; - sp2C.zy = this->unk_37C.y; - sp2C.zz = this->unk_37C.z; - sp2C.zw = 0.0f; + sp2C.yx = this->unk_370.y; + sp2C.zx = this->unk_370.z; sp2C.wx = 0.0f; + sp2C.xy = this->unk_364.x; + sp2C.yy = this->unk_364.y; + sp2C.zy = this->unk_364.z; sp2C.wy = 0.0f; + sp2C.xz = this->unk_37C.x; + sp2C.yz = this->unk_37C.y; + sp2C.zz = this->unk_37C.z; sp2C.wz = 0.0f; + sp2C.xw = 0.0f; + sp2C.yw = 0.0f; + sp2C.zw = 0.0f; sp2C.ww = 1.0f; Matrix_MtxFToYXZRotS(&sp2C, &this->actor.world.rot, 0); return true; diff --git a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c index ddd4419560..9373e2576a 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c @@ -190,13 +190,13 @@ void func_80B86F68(ItemShield* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); MtxF* shield = &player->shieldMf; - this->actor.world.pos.x = shield->wx; - this->actor.world.pos.y = shield->wy; - this->actor.world.pos.z = shield->wz; + this->actor.world.pos.x = shield->xw; + this->actor.world.pos.y = shield->yw; + this->actor.world.pos.z = shield->zw; this->unk_19C &= ~2; - this->actor.shape.rot.y = Math_Atan2S(-shield->zz, -shield->zx); - this->actor.shape.rot.x = Math_Atan2S(-shield->zy, sqrtf(shield->zz * shield->zz + shield->zx * shield->zx)); + this->actor.shape.rot.y = Math_Atan2S(-shield->zz, -shield->xz); + this->actor.shape.rot.x = Math_Atan2S(-shield->yz, sqrtf(shield->zz * shield->zz + shield->xz * shield->xz)); if (ABS(this->actor.shape.rot.x) > 0x4000) { this->unk_19C |= 1; diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index 0902be8c47..6fb87d264d 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -274,10 +274,10 @@ void MirRay_SetIntensity(MirRay* this, GlobalContext* globalCtx) { this->reflectIntensity = 0.0f; - if (MirRay_CheckInFrustum(&this->sourcePt, &this->poolPt, shieldMtx->wx, shieldMtx->wy, shieldMtx->wz, + if (MirRay_CheckInFrustum(&this->sourcePt, &this->poolPt, shieldMtx->xw, shieldMtx->yw, shieldMtx->zw, this->sourceEndRad, this->poolEndRad)) { - temp_f0 = sqrtf(SQ(shieldMtx->zz) + (SQ(shieldMtx->zx) + SQ(shieldMtx->zy))); + temp_f0 = sqrtf(SQ(shieldMtx->zz) + (SQ(shieldMtx->xz) + SQ(shieldMtx->yz))); if (temp_f0 == 0.0f) { this->reflectRange = 1.0f; @@ -293,7 +293,7 @@ void MirRay_SetIntensity(MirRay* this, GlobalContext* globalCtx) { sp4C[1] = this->poolPt.y - this->sourcePt.y; sp4C[2] = this->poolPt.z - this->sourcePt.z; - temp_f2_2 = -shieldMtx->zx * sp4C[0] - shieldMtx->zy * sp4C[1] - shieldMtx->zz * sp4C[2]; + temp_f2_2 = -shieldMtx->xz * sp4C[0] - shieldMtx->yz * sp4C[1] - shieldMtx->zz * sp4C[2]; if (temp_f2_2 < 0.0f) { temp_f0_2 = sqrtf(SQ(sp4C[0]) + SQ(sp4C[1]) + SQ(sp4C[2])); @@ -319,19 +319,19 @@ void MirRay_SetupReflectionPolys(MirRay* this, GlobalContext* globalCtx, MirRayS shieldMtx = &player->shieldMf; - sp60.x = -((*shieldMtx).zx * this->reflectRange) * this->reflectIntensity * 400.0f; - sp60.y = -((*shieldMtx).zy * this->reflectRange) * this->reflectIntensity * 400.0f; + sp60.x = -((*shieldMtx).xz * this->reflectRange) * this->reflectIntensity * 400.0f; + sp60.y = -((*shieldMtx).yz * this->reflectRange) * this->reflectIntensity * 400.0f; sp60.z = -((*shieldMtx).zz * this->reflectRange) * this->reflectIntensity * 400.0f; sp60 = sp60; // Need something involving sp60 or the whole function changes for (i = 0; i < 6; i++) { - posA.x = ((*shieldMtx).wx + (this->shieldCorners[i].x * (*shieldMtx).xx)) + - (this->shieldCorners[i].y * (*shieldMtx).yx); - posA.y = ((*shieldMtx).wy + (this->shieldCorners[i].x * (*shieldMtx).xy)) + + posA.x = ((*shieldMtx).xw + (this->shieldCorners[i].x * (*shieldMtx).xx)) + + (this->shieldCorners[i].y * (*shieldMtx).xy); + posA.y = ((*shieldMtx).yw + (this->shieldCorners[i].x * (*shieldMtx).yx)) + (this->shieldCorners[i].y * (*shieldMtx).yy); - posA.z = ((*shieldMtx).wz + (this->shieldCorners[i].x * (*shieldMtx).xz)) + - (this->shieldCorners[i].y * (*shieldMtx).yz); + posA.z = ((*shieldMtx).zw + (this->shieldCorners[i].x * (*shieldMtx).zx)) + + (this->shieldCorners[i].y * (*shieldMtx).zy); posB.x = sp60.x + posA.x; posB.y = sp60.y + posA.y; posB.z = sp60.z + posA.z; @@ -383,25 +383,25 @@ void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldRe shieldMtx = &player->shieldMf; - spE8.x = -(shieldMtx->zx * this->reflectRange) * this->reflectIntensity * 400.0f; - spE8.y = -(shieldMtx->zy * this->reflectRange) * this->reflectIntensity * 400.0f; + spE8.x = -(shieldMtx->xz * this->reflectRange) * this->reflectIntensity * 400.0f; + spE8.y = -(shieldMtx->yz * this->reflectRange) * this->reflectIntensity * 400.0f; spE8.z = -(shieldMtx->zz * this->reflectRange) * this->reflectIntensity * 400.0f; - vecB.x = shieldMtx->wx; - vecB.y = shieldMtx->wy; - vecB.z = shieldMtx->wz; + vecB.x = shieldMtx->xw; + vecB.y = shieldMtx->yw; + vecB.z = shieldMtx->zw; vecD.x = spE8.x + vecB.x; vecD.y = spE8.y + vecB.y; vecD.z = spE8.z + vecB.z; vecA.x = vecB.x + (shieldMtx->xx * 300.0f); - vecA.y = vecB.y + (shieldMtx->xy * 300.0f); - vecA.z = vecB.z + (shieldMtx->xz * 300.0f); + vecA.y = vecB.y + (shieldMtx->yx * 300.0f); + vecA.z = vecB.z + (shieldMtx->zx * 300.0f); vecC.x = vecD.x + (shieldMtx->xx * 300.0f); - vecC.y = vecD.y + (shieldMtx->xy * 300.0f); - vecC.z = vecD.z + (shieldMtx->xz * 300.0f); + vecC.y = vecD.y + (shieldMtx->yx * 300.0f); + vecC.z = vecD.z + (shieldMtx->zx * 300.0f); Collider_SetQuadVertices(&this->shieldRay, &vecA, &vecB, &vecC, &vecD); @@ -430,8 +430,8 @@ void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldRe spE8 = spE8; // Required to match sp10C.x = (shieldMtx->xx * 100.0f) + vecB.x; - sp10C.y = (shieldMtx->xy * 100.0f) + vecB.y; - sp10C.z = (shieldMtx->xz * 100.0f) + vecB.z; + sp10C.y = (shieldMtx->yx * 100.0f) + vecB.y; + sp10C.z = (shieldMtx->zx * 100.0f) + vecB.z; sp100.x = (spE8.x * 4.0f) + sp10C.x; sp100.y = (spE8.y * 4.0f) + sp10C.y; @@ -439,7 +439,7 @@ void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldRe normalVec = normalVec; // Required to match - currentReflection->mtx.wz = 0.0f; + currentReflection->mtx.zw = 0.0f; if (1) {} if (1) {} @@ -448,21 +448,21 @@ void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldRe currentReflection->mtx.xx = currentReflection->mtx.yy = currentReflection->mtx.zz = currentReflection->mtx.ww = 1.0f; - currentReflection->mtx.xy = currentReflection->mtx.xz = currentReflection->mtx.xw = - currentReflection->mtx.yx = currentReflection->mtx.yz = currentReflection->mtx.yw = - currentReflection->mtx.zx = currentReflection->mtx.zy = currentReflection->mtx.zw = - currentReflection->mtx.wx = currentReflection->mtx.wy = currentReflection->mtx.wz; + currentReflection->mtx.yx = currentReflection->mtx.zx = currentReflection->mtx.wx = + currentReflection->mtx.xy = currentReflection->mtx.zy = currentReflection->mtx.wy = + currentReflection->mtx.xz = currentReflection->mtx.yz = currentReflection->mtx.wz = + currentReflection->mtx.xw = currentReflection->mtx.yw = currentReflection->mtx.zw; if (Math3D_LineSegVsPlane(normalVec.x, normalVec.y, normalVec.z, currentReflection->reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { currentReflection->mtx.xx = intersection.x - sp118.x; - currentReflection->mtx.xy = intersection.y - sp118.y; - currentReflection->mtx.xz = intersection.z - sp118.z; + currentReflection->mtx.yx = intersection.y - sp118.y; + currentReflection->mtx.zx = intersection.z - sp118.z; } - sp10C.x = (shieldMtx->yx * 100.0f) + vecB.x; + sp10C.x = (shieldMtx->xy * 100.0f) + vecB.x; sp10C.y = (shieldMtx->yy * 100.0f) + vecB.y; - sp10C.z = (shieldMtx->yz * 100.0f) + vecB.z; + sp10C.z = (shieldMtx->zy * 100.0f) + vecB.z; sp100.x = (spE8.x * 4.0f) + sp10C.x; sp100.y = (spE8.y * 4.0f) + sp10C.y; @@ -470,9 +470,9 @@ void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldRe if (Math3D_LineSegVsPlane(normalVec.x, normalVec.y, normalVec.z, currentReflection->reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { - currentReflection->mtx.yx = intersection.x - sp118.x; + currentReflection->mtx.xy = intersection.x - sp118.x; currentReflection->mtx.yy = intersection.y - sp118.y; - currentReflection->mtx.yz = intersection.z - sp118.z; + currentReflection->mtx.zy = intersection.z - sp118.z; } } else { currentReflection->reflectionPoly = NULL; 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 4f1ee8f216..b4a647fbee 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 @@ -91,7 +91,7 @@ void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { this->rRoll = rpy.x; this->rPitch = rpy.y; this->rYaw = rpy.z; - this->pos.y = mf.wy; + this->pos.y = mf.yw; this->rTimer++; }