From f2da02f2b9a9ea84e1d48e74a6d59b1e11a8480a Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Fri, 22 Sep 2023 20:02:31 -0700 Subject: [PATCH] c_lib, c_xyz, c_angle, c_bg_s_gnd_chk fix --- configure.py | 8 ++-- include/SSystem/SComponent/c_angle.h | 50 +++++++++++------------ src/SSystem/SComponent/c_angle.cpp | 6 +-- src/SSystem/SComponent/c_bg_s_gnd_chk.cpp | 2 +- src/SSystem/SComponent/c_lib.cpp | 2 +- src/SSystem/SComponent/c_xyz.cpp | 4 ++ 6 files changed, 38 insertions(+), 34 deletions(-) diff --git a/configure.py b/configure.py index a3fcdbed3..7bc9629fb 100644 --- a/configure.py +++ b/configure.py @@ -510,12 +510,12 @@ config.libs = [ Object(Matching, "SSystem/SComponent/c_request.cpp"), Object(Matching, "SSystem/SComponent/c_tag.cpp"), Object(Matching, "SSystem/SComponent/c_tag_iter.cpp"), - Object(NonMatching, "SSystem/SComponent/c_xyz.cpp"), + Object(Matching, "SSystem/SComponent/c_xyz.cpp"), Object(Matching, "SSystem/SComponent/c_sxyz.cpp"), Object(Matching, "SSystem/SComponent/c_math.cpp"), Object(NonMatching, "SSystem/SComponent/c_bg_s.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s_chk.cpp"), - Object(NonMatching, "SSystem/SComponent/c_bg_s_gnd_chk.cpp"), + Object(Matching, "SSystem/SComponent/c_bg_s_gnd_chk.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s_lin_chk.cpp"), Object(NonMatching, "SSystem/SComponent/c_bg_w.cpp"), Object(NonMatching, "SSystem/SComponent/c_m2d.cpp"), @@ -526,8 +526,8 @@ config.libs = [ Object(Matching, "SSystem/SComponent/c_m3d_g_pla.cpp"), Object(Matching, "SSystem/SComponent/c_m3d_g_sph.cpp"), Object(Matching, "SSystem/SComponent/c_m3d_g_tri.cpp"), - Object(NonMatching, "SSystem/SComponent/c_lib.cpp"), - Object(NonMatching, "SSystem/SComponent/c_angle.cpp"), + Object(Matching, "SSystem/SComponent/c_lib.cpp"), + Object(Matching, "SSystem/SComponent/c_angle.cpp"), Object(Matching, "SSystem/SComponent/c_data_tbl.cpp"), Object(Matching, "SSystem/SStandard/s_basic.cpp"), ], diff --git a/include/SSystem/SComponent/c_angle.h b/include/SSystem/SComponent/c_angle.h index 9103b1001..13eb90cb2 100644 --- a/include/SSystem/SComponent/c_angle.h +++ b/include/SSystem/SComponent/c_angle.h @@ -23,15 +23,15 @@ public: void Val(const cSAngle&); void Val(s16); void Val(float); - float Degree(void) const; - float Radian(void) const; - float Norm(void) const; - s16 Abs(void) const; - s16 Inv(void) const; - float Sin(void) const; - float Cos(void) const; - float Tan(void) const; - cSAngle operator-(void) const; + float Degree() const; + float Radian() const; + float Norm() const; + s16 Abs() const; + s16 Inv() const; + float Sin() const; + float Cos() const; + float Tan() const; + cSAngle operator-() const; cSAngle operator+(const cSAngle&) const; cSAngle operator-(const cSAngle&) const; void operator+=(const cSAngle&); @@ -44,10 +44,10 @@ public: void operator*=(float); bool operator<(const cSAngle& other) const { return mAngle < other.mAngle; } bool operator>(const cSAngle& other) const { return mAngle > other.mAngle; } - operator s16(void) const { return mAngle; } + operator s16() const { return mAngle; } void operator=(const cSAngle& other) { mAngle = other.mAngle; } - static inline cSAngle getMaxNegative(void) { return cSAngle((s16)-0x8000); } - inline void mirrorAtMaxNeg(void) { *this = cSAngle((s16)-0x8000) - *this; } + static inline cSAngle getMaxNegative() { return cSAngle((s16)-0x8000); } + inline void mirrorAtMaxNeg() { *this = cSAngle((s16)-0x8000) - *this; } }; cSAngle operator+(short, const cSAngle&); @@ -91,11 +91,11 @@ public: cDegree(float); ~cDegree() {} - cDegree& Formal(void); + cDegree& Formal(); void Val(float); - float Radian(void) const; - float Sin(void) const; - float Cos(void) const; + float Radian() const; + float Sin() const; + float Cos() const; }; class cSPolar { @@ -107,10 +107,10 @@ private: public: cSPolar() {} cSPolar(const cXyz&); - cSPolar& Formal(void); + cSPolar& Formal(); void Val(float, short, short); void Val(const cXyz&); - cXyz Xyz(void) const; + cXyz Xyz() const; void Globe(class cSGlobe*) const; }; @@ -126,18 +126,18 @@ public: cSGlobe(float, const cSAngle&, const cSAngle&); cSGlobe(const cXyz&); ~cSGlobe() {} - cSGlobe& Formal(void); + cSGlobe& Formal(); void Val(const cSGlobe&); void Val(float, short, short); void Val(float, const cSAngle&, const cSAngle&); void Val(const cXyz&); - float R(void) const { return mRadius; } - const cSAngle& V(void) const { return mAzimuth; } - const cSAngle& U(void) const { return mInclination; } - cXyz Xyz(void) const; + float R() const { return mRadius; } + const cSAngle& V() const { return mAzimuth; } + const cSAngle& U() const { return mInclination; } + cXyz Xyz() const; void Polar(cSPolar*) const; - cXyz Norm(void) const; - cSGlobe& Invert(void); + cXyz Norm() const; + cSGlobe& Invert(); }; #endif /* C_ANGLE_H */ diff --git a/src/SSystem/SComponent/c_angle.cpp b/src/SSystem/SComponent/c_angle.cpp index 2bc4d48e8..c0090c713 100644 --- a/src/SSystem/SComponent/c_angle.cpp +++ b/src/SSystem/SComponent/c_angle.cpp @@ -326,7 +326,7 @@ void cSGlobe::Polar(cSPolar* csp) const { } /* 80254864-80254890 .text Invert__7cSGlobeFv */ -cXyz cSGlobe::Norm() const { - cSGlobe glob(1.0f, mAzimuth, mInclination); - return glob.Xyz(); +cSGlobe& cSGlobe::Invert() { + mRadius = -mRadius; + return Formal(); } diff --git a/src/SSystem/SComponent/c_bg_s_gnd_chk.cpp b/src/SSystem/SComponent/c_bg_s_gnd_chk.cpp index 8356377c0..ea0ace93d 100644 --- a/src/SSystem/SComponent/c_bg_s_gnd_chk.cpp +++ b/src/SSystem/SComponent/c_bg_s_gnd_chk.cpp @@ -10,5 +10,5 @@ cBgS_GndChk::cBgS_GndChk() { m_pos = cXyz::Zero; setActorPid(0xFFFFFFFF); - mFlags = 2; + mFlags = 3; } diff --git a/src/SSystem/SComponent/c_lib.cpp b/src/SSystem/SComponent/c_lib.cpp index 3678ef251..280a2e52c 100644 --- a/src/SSystem/SComponent/c_lib.cpp +++ b/src/SSystem/SComponent/c_lib.cpp @@ -366,7 +366,7 @@ s32 cLib_distanceAngleS(s16 x, s16 y) { return abs(static_cast(x - y)); } -static Mtx mtx[10]; +Mtx mtx[10]; Mtx* calc_mtx = mtx; diff --git a/src/SSystem/SComponent/c_xyz.cpp b/src/SSystem/SComponent/c_xyz.cpp index 3121db388..9dfc954be 100644 --- a/src/SSystem/SComponent/c_xyz.cpp +++ b/src/SSystem/SComponent/c_xyz.cpp @@ -153,3 +153,7 @@ bool cXyz::isZero(void) const { return fabsf(this->x) < 3.8146972e-06f && fabsf(this->y) < 3.8146972e-06f && fabsf(this->z) < 3.8146972e-06f; } + +// Unused, but must be in .rodata to match +static const char * fmt0 = "[%f %f %f]\n"; +static const char * fmt1 = "%s=[%f %f %f]\n";