tag_allmato almost, swhit0 treesh swball done, misc cleanup (#2312)

* d_a_tag_allmato almost done

* d_a_swhit0 done

* some SSystem cleanup

* treesh done

* swball done, some other rel cleanup
This commit is contained in:
TakaRikka
2025-03-01 04:48:49 -08:00
committed by GitHub
parent 80edf3c8a8
commit f06311cd09
54 changed files with 2162 additions and 1767 deletions
+34 -36
View File
@@ -5,26 +5,27 @@
#include "SSystem/SComponent/c_xyz.h"
#include "SSystem/SComponent/c_math.h"
#include "JSystem/JUtility/JUTAssert.h"
/* 80266AE4-80266B34 0050+00 s=0 e=103 z=300 None .text __pl__4cXyzCFRC3Vec */
cXyz cXyz::operator+(const Vec& vec) const {
Vec ret;
VECAdd(this, &vec, &ret);
return cXyz(ret);
PSVECAdd(this, &vec, &ret);
return ret;
}
/* 80266B34-80266B84 0050+00 s=0 e=196 z=1082 None .text __mi__4cXyzCFRC3Vec */
cXyz cXyz::operator-(const Vec& vec) const {
Vec ret;
VECSubtract(this, &vec, &ret);
return cXyz(ret);
PSVECSubtract(this, &vec, &ret);
return ret;
}
/* 80266B84-80266BD0 004C+00 s=1 e=99 z=158 None .text __ml__4cXyzCFf */
cXyz cXyz::operator*(f32 scale) const {
Vec ret;
VECScale(this, &ret, scale);
return cXyz(ret);
PSVECScale(this, &ret, scale);
return ret;
}
/* 80266BD0-80266C18 0048+00 s=0 e=7 z=0 None .text __ml__4cXyzCFRC3Vec */
@@ -33,21 +34,21 @@ cXyz cXyz::operator*(const Vec& vec) const {
ret.x = this->x * vec.x;
ret.y = this->y * vec.y;
ret.z = this->z * vec.z;
return cXyz(ret);
return ret;
}
/* 80266C18-80266C6C 0054+00 s=0 e=3 z=12 None .text __dv__4cXyzCFf */
cXyz cXyz::operator/(f32 scale) const {
Vec ret;
VECScale(this, &ret, 1.0f / scale);
return cXyz(ret);
PSVECScale(this, &ret, 1.0f / scale);
return ret;
}
/* 80266C6C-80266CBC 0050+00 s=1 e=0 z=0 None .text getCrossProduct__4cXyzCFRC3Vec */
cXyz cXyz::getCrossProduct(const Vec& vec) const {
Vec ret;
VECCrossProduct(this, &vec, &ret);
return cXyz(ret);
PSVECCrossProduct(this, &vec, &ret);
return ret;
}
/* 80266CBC-80266CE4 0028+00 s=0 e=7 z=6 None .text outprod__4cXyzCFRC3Vec */
@@ -58,54 +59,52 @@ cXyz cXyz::outprod(const Vec& vec) const {
/* 80266CE4-80266D30 004C+00 s=0 e=10 z=1 None .text norm__4cXyzCFv */
cXyz cXyz::norm() const {
Vec ret;
VECNormalize(this, &ret);
return cXyz(ret);
JUT_CONFIRM(251, isNearZeroSquare() == 0);
PSVECNormalize(this, &ret);
return ret;
}
/* 80266D30-80266DC4 0094+00 s=1 e=4 z=0 None .text normZP__4cXyzCFv */
cXyz cXyz::normZP() const {
Vec vec;
if (this->isNearZeroSquare() == false) {
VECNormalize(this, &vec);
PSVECNormalize(this, &vec);
} else {
vec = cXyz::Zero;
}
return cXyz(vec);
}
// doesn't exist in debug rom, but needed to match?
inline void normToUpZIfNearZero(Vec& vec) {
if (cXyz(vec).isNearZeroSquare()) {
vec.x = 0.0f;
vec.y = 0.0f;
vec.z = 1.0f;
const Vec v = {0, 0, 1};
vec = v;
}
return vec;
}
/* 80266DC4-80266EF4 0130+00 s=0 e=0 z=2 None .text normZC__4cXyzCFv */
cXyz cXyz::normZC() const {
Vec outVec;
if (this->isNearZeroSquare() == false) {
VECNormalize(this, &outVec);
if (isNearZeroSquare() == 0) {
PSVECNormalize(this, &outVec);
} else {
outVec = (*this * 1.25f * 1000000.0f).normZP();
normToUpZIfNearZero(outVec);
if (isNearZeroSquare(outVec)) {
outVec.x = 0.0f;
outVec.y = 0.0f;
outVec.z = 1.0f;
outVec = (Vec){0,0,1};
}
}
return outVec;
}
/* 80266EF4-80266F48 0054+00 s=0 e=13 z=17 None .text normalize__4cXyzFv */
cXyz cXyz::normalize() {
VECNormalize(this, this);
JUT_ASSERT(285, isNearZeroSquare() == 0);
PSVECNormalize(this, this);
return *this;
}
/* 80266F48-80266FDC 0094+00 s=0 e=19 z=59 None .text normalizeZP__4cXyzFv */
cXyz cXyz::normalizeZP() {
if (this->isNearZeroSquare() == false) {
VECNormalize(this, this);
PSVECNormalize(this, this);
} else {
*this = cXyz::Zero;
}
@@ -117,7 +116,7 @@ bool cXyz::normalizeRS() {
if (this->isNearZeroSquare()) {
return false;
} else {
VECNormalize(this, this);
PSVECNormalize(this, this);
return true;
}
}
@@ -129,7 +128,7 @@ bool cXyz::operator==(const Vec& vec) const {
/* 8026706C-802670AC 0040+00 s=0 e=6 z=6 None .text __ne__4cXyzCFRC3Vec */
bool cXyz::operator!=(const Vec& vec) const {
return !(this->x == vec.x && this->y == vec.y && this->z == vec.z);
return this->x != vec.x || this->y != vec.y || this->z != vec.z;
}
/* 802670AC-80267128 007C+00 s=0 e=4 z=7 None .text isZero__4cXyzCFv */
@@ -145,8 +144,7 @@ s16 cXyz::atan2sX_Z() const {
/* 80267150-80267290 0140+00 s=0 e=21 z=33 None .text atan2sY_XZ__4cXyzCFv */
s16 cXyz::atan2sY_XZ() const {
f32 mag = this->getMagXZ();
return cM_atan2s(-this->y, sqrtf(mag));
return cM_atan2s(-this->y, absXZ());
}
const cXyz cXyz::Zero(0, 0, 0);
@@ -156,4 +154,4 @@ const cXyz cXyz::BaseZ(0, 0, 1);
const cXyz cXyz::BaseXY(1, 1, 0);
const cXyz cXyz::BaseXZ(1, 0, 1);
const cXyz cXyz::BaseYZ(0, 1, 1);
const cXyz cXyz::BaseXYZ(1, 1, 1);
const cXyz cXyz::BaseXYZ(1, 1, 1);