Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(wwmath): correct five collision and vector math defects
Olcay Seygan7c570caec6ef
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/colmathplane.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/colmathplane.cppindex 72d2d0749..af6266580 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/colmathplane.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/colmathplane.cpp@@ -90,7 +90,7 @@ CollisionMath::Overlap_Test(const AAPlaneClass & plane,const SphereClass & spherif (delta > sphere.Radius) {return POS;}- if (delta < sphere.Radius) {+ if (delta < -sphere.Radius) {return NEG;}return BOTH;diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/colmathsphere.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/colmathsphere.cppindex 088c54292..ea541f907 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/colmathsphere.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/colmathsphere.cpp@@ -75,9 +75,9 @@ bool CollisionMath::Intersection_Test(const SphereClass & sphere,const AABoxClas** against a cube which encloses the sphere...*/Vector3 dc = box.Center - sphere.Center;- if (WWMath::Fabs(dc.X) < box.Extent.X + sphere.Radius) return false;- if (WWMath::Fabs(dc.Y) < box.Extent.Y + sphere.Radius) return false;- if (WWMath::Fabs(dc.Z) < box.Extent.Z + sphere.Radius) return false;+ if (WWMath::Fabs(dc.X) > box.Extent.X + sphere.Radius) return false;+ if (WWMath::Fabs(dc.Y) > box.Extent.Y + sphere.Radius) return false;+ if (WWMath::Fabs(dc.Z) > box.Extent.Z + sphere.Radius) return false;return true;}diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/matrix3.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/matrix3.hindex 9ada2ac67..877b1d2fa 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/matrix3.h+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/matrix3.h@@ -487,7 +487,7 @@ WWINLINE float Matrix3x3::Determinant(void) const{return Row[0][0] * (Row[1][1] * Row[2][2] - Row[1][2] * Row[2][1])- Row[0][1] * (Row[1][0] * Row[2][2] - Row[1][2] * Row[2][0])- - Row[0][2] * (Row[1][0] * Row[2][1] - Row[1][1] * Row[2][0]);+ + Row[0][2] * (Row[1][0] * Row[2][1] - Row[1][1] * Row[2][0]);}/***********************************************************************************************diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/vector3.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/vector3.hindex 29f97f6d6..fe51a3607 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/vector3.h+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/vector3.h@@ -495,7 +495,7 @@ WWINLINE float Vector3::Quick_Length(void) constif (max < mid) { tmp = max; max = mid; mid = tmp; }if (max < min) { tmp = max; max = min; min = tmp; }- if (mid < min) { tmp = mid; mid = min; min = mid; }+ if (mid < min) { tmp = mid; mid = min; min = tmp; }return max + (11.0f / 32.0f)*mid + (1.0f / 4.0f)*min;}diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/vp.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/vp.cppindex ec96ce4bc..143aff346 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/vp.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WWMath/vp.cpp@@ -464,16 +464,16 @@ void VectorProcessorClass::Clamp(Vector4 *dst,const Vector4 *src, const float mifor (i=0; i<count; i++){dst[i].X=(src[i].X<min)?min:src[i].X;- dst[i].X=(src[i].X>max)?max:src[i].X;+ dst[i].X=(dst[i].X>max)?max:dst[i].X;dst[i].Y=(src[i].Y<min)?min:src[i].Y;- dst[i].Y=(src[i].Y>max)?max:src[i].Y;+ dst[i].Y=(dst[i].Y>max)?max:dst[i].Y;dst[i].Z=(src[i].Z<min)?min:src[i].Z;- dst[i].Z=(src[i].Z>max)?max:src[i].Z;+ dst[i].Z=(dst[i].Z>max)?max:dst[i].Z;dst[i].W=(src[i].W<min)?min:src[i].W;- dst[i].W=(src[i].W>max)?max:src[i].W;+ dst[i].W=(dst[i].W>max)?max:dst[i].W;}}