Merge branch 'skmp/fix-staring-into-the-void' into 'main'
Some checks are pending
re3 conan+cmake / build-cmake (openal, glfw, macos-latest, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, glfw, ubuntu-18.04, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, glfw, windows-latest, gl3) (push) Waiting to run
re3 conan+cmake / build-cmake (openal, windows-latest, d3d9) (push) Waiting to run
re3 cmake devkitA64 (Nintendo Switch) / build-nintendo-switch (push) Waiting to run
re3 premake amd64 / build (Debug, win-amd64-librw_d3d9-oal) (push) Waiting to run
re3 premake amd64 / build (Debug, win-amd64-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake amd64 / build (Release, win-amd64-librw_d3d9-oal) (push) Waiting to run
re3 premake amd64 / build (Release, win-amd64-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Debug, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Release, win-x86-librw_gl3_glfw-oal) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-mss) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_d3d9-oal) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-mss) (push) Waiting to run
re3 premake x86 / build (Vanilla, win-x86-librw_gl3_glfw-oal) (push) Waiting to run

Revert buggy optimizations in CMatrix::Rotate*. Didn't investigate much, they aren't often called

Closes #8 and #6

See merge request skmp/dca3-game!9
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis
2025-01-05 08:21:54 +00:00

View File

@@ -282,7 +282,7 @@ CMatrix::SetRotate(float xAngle, float yAngle, float zAngle)
void
CMatrix::RotateX(float x)
{
#ifdef DC_SH4
#if 0 && defined(DC_SH4) // this is bugged and does not yield correct results
mat_load(reinterpret_cast<matrix_t *>(this));
mat_rotate_x(x);
mat_store(reinterpret_cast<matrix_t *>(this));
@@ -312,7 +312,7 @@ CMatrix::RotateX(float x)
void
CMatrix::RotateY(float y)
{
#ifdef DC_SH4
#if 0 && defined(DC_SH4) // this is bugged and does not yield correct results
mat_load(reinterpret_cast<matrix_t *>(this));
mat_rotate_y(y);
mat_store(reinterpret_cast<matrix_t *>(this));
@@ -342,7 +342,7 @@ CMatrix::RotateY(float y)
void
CMatrix::RotateZ(float z)
{
#ifdef DC_SH4
#if 0 && defined(DC_SH4) // this is bugged and does not yield correct results
mat_load(reinterpret_cast<matrix_t *>(this));
mat_rotate_z(z);
mat_store(reinterpret_cast<matrix_t *>(this));
@@ -372,7 +372,7 @@ CMatrix::RotateZ(float z)
void
CMatrix::Rotate(float x, float y, float z)
{
#ifdef DC_SH4
#if 0 && defined(DC_SH4) // this is bugged and does not yield correct results
mat_load(reinterpret_cast<matrix_t *>(this));
mat_rotate(x, y, z);
mat_store(reinterpret_cast<matrix_t *>(this));
@@ -404,6 +404,20 @@ CMatrix::Rotate(float x, float y, float z)
float z2 = sZ * sY - (cZ * sX) * cY;
float z3 = cX * cY;
#if !defined(DC_TEXCONV) && !defined(DC_SIM)
this->rx = fipr(x1, y1, z1, 0, rx, ry, rz, 0);
this->ry = fipr(x2, y2, z2, 0, rx, ry, rz, 0);
this->rz = fipr(x3, y3, z3, 0, rx, ry, rz, 0);
this->fx = fipr(x1, y1, z1, 0, ux, uy, uz, 0);
this->fy = fipr(x2, y2, z2, 0, ux, uy, uz, 0);
this->fz = fipr(x3, y3, z3, 0, ux, uy, uz, 0);
this->ux = fipr(x1, y1, z1, 0, ax, ay, az, 0);
this->uy = fipr(x2, y2, z2, 0, ax, ay, az, 0);
this->uz = fipr(x3, y3, z3, 0, ax, ay, az, 0);
this->px = fipr(x1, y1, z1, 0, px, py, pz, 0);
this->py = fipr(x2, y2, z2, 0, px, py, pz, 0);
this->pz = fipr(x3, y3, z3, 0, px, py, pz, 0);
#else
this->rx = x1 * rx + y1 * ry + z1 * rz;
this->ry = x2 * rx + y2 * ry + z2 * rz;
this->rz = x3 * rx + y3 * ry + z3 * rz;
@@ -416,6 +430,7 @@ CMatrix::Rotate(float x, float y, float z)
this->px = x1 * px + y1 * py + z1 * pz;
this->py = x2 * px + y2 * py + z2 * pz;
this->pz = x3 * px + y3 * py + z3 * pz;
#endif
#endif
}