mirror of
https://github.com/zeldaret/tww.git
synced 2026-08-21 14:07:29 -04:00
Various fixes in SSystem (#19)
* Various fixes in SSystem * Removed unused include in c_xyz.h * Removed unused include in c_xyz.cpp
This commit is contained in:
+4
-4
@@ -238,22 +238,22 @@ LIBS = [
|
||||
Object(Matching, "SSystem/SComponent/c_tag_iter.cpp"),
|
||||
Object(NonMatching, "SSystem/SComponent/c_xyz.cpp"),
|
||||
Object(Matching, "SSystem/SComponent/c_sxyz.cpp"),
|
||||
Object(NonMatching, "SSystem/SComponent/c_math.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(NonMatching, "SSystem/SComponent/c_bg_s_lin_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"),
|
||||
Object(NonMatching, "SSystem/SComponent/c_m2d_g_box.cpp"),
|
||||
Object(Matching, "SSystem/SComponent/c_m3d_g_aab.cpp"),
|
||||
Object(NonMatching, "SSystem/SComponent/c_m3d_g_cyl.cpp"),
|
||||
Object(Matching, "SSystem/SComponent/c_m3d_g_cyl.cpp"),
|
||||
Object(Matching, "SSystem/SComponent/c_m3d_g_pla.cpp"),
|
||||
Object(NonMatching, "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(NonMatching, "SSystem/SComponent/c_data_tbl.cpp"),
|
||||
Object(Matching, "SSystem/SComponent/c_data_tbl.cpp"),
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -3,16 +3,22 @@
|
||||
|
||||
#include "dolphin/types.h"
|
||||
|
||||
class cBgW;
|
||||
class cBgS_PolyInfo {
|
||||
private:
|
||||
/* 0x00 */ u16 mPolyIndex;
|
||||
/* 0x02 */ u16 mBgIndex;
|
||||
/* 0x04 */ void* unk_0x04;
|
||||
/* 0x04 */ cBgW* mpBgW;
|
||||
/* 0x08 */ unsigned int mActorId;
|
||||
|
||||
public:
|
||||
cBgS_PolyInfo();
|
||||
void ClearPi();
|
||||
void ClearPi() {
|
||||
mPolyIndex = -1;
|
||||
mBgIndex = 0x100;
|
||||
mpBgW = NULL;
|
||||
mActorId = -1;
|
||||
}
|
||||
void SetPolyInfo(const cBgS_PolyInfo&);
|
||||
void SetActorInfo(int, void*, unsigned int);
|
||||
bool ChkSafe(const void*, unsigned int) const;
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
#include "dolphin/types.h"
|
||||
|
||||
struct cDT_NamePTbl {
|
||||
u32 mCount;
|
||||
char ** mpNames;
|
||||
|
||||
cDT_NamePTbl();
|
||||
virtual ~cDT_NamePTbl();
|
||||
int GetIndex(const char *pName, int start) const;
|
||||
void Set(u32 count, char** pNames);
|
||||
|
||||
u32 mCount;
|
||||
char ** mpNames;
|
||||
};
|
||||
|
||||
struct cDT_DataSrc {
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
|
||||
/* 80247418-80247480 .text ct__11cBgS_LinChkFv */
|
||||
void cBgS_LinChk::ct() {
|
||||
mLin.mStart = cXyz::Zero;
|
||||
mLin.mEnd = cXyz::Zero;
|
||||
field_0x40 = cXyz::Zero ;
|
||||
setActorPid(0xFFFFFFFF);
|
||||
cXyz zero = cXyz::Zero;
|
||||
mLin.mStart = zero;
|
||||
mLin.mEnd = zero;
|
||||
field_0x40 = zero;
|
||||
setActorPid(-1);
|
||||
field_0x4c = 0;
|
||||
mFrontFlag = 1;
|
||||
mBackFlag = 0;
|
||||
@@ -19,7 +20,8 @@ void cBgS_LinChk::ct() {
|
||||
|
||||
/* 80247480-80247500 .text Set2__11cBgS_LinChkFP4cXyzP4cXyzUi */
|
||||
void cBgS_LinChk::Set2(cXyz* pStart, cXyz* pEnd, unsigned int actorPid) {
|
||||
mLin.SetStartEnd(*pStart, *pEnd);
|
||||
mLin.mStart.set(*pStart);
|
||||
mLin.mEnd.set(*pEnd);
|
||||
field_0x40 = *pEnd;
|
||||
setActorPid(actorPid);
|
||||
field_0x4c &= ~0x10;
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
//
|
||||
|
||||
#include "SSystem/SComponent/c_lib.h"
|
||||
#include "SSystem/SComponent/c_math.h"
|
||||
#include "MSL_C/string.h"
|
||||
#include "SSystem/SComponent/c_math.h"
|
||||
#include "dolphin/mtx/mtxvec.h"
|
||||
|
||||
|
||||
/* 802528A4-802528C4 .text cLib_memCpy__FPvPCvUl */
|
||||
void cLib_memCpy(void* dst, const void* src, unsigned long size) {
|
||||
memcpy(dst, src, size);
|
||||
@@ -202,35 +203,33 @@ void cLib_addCalcAngleS2(s16* pValue, s16 target, s16 scale, s16 maxStep) {
|
||||
}
|
||||
|
||||
/* 802532C4-8025335C .text cLib_addCalcAngleL__FPlllll */
|
||||
s16 cLib_addCalcAngleL(s32* pValue, s32 target, s32 scale, s32 maxStep, s32 minStep) {
|
||||
s32 cLib_addCalcAngleL(s32* pValue, s32 target, s32 scale, s32 maxStep, s32 minStep) {
|
||||
s32 diff = target - *pValue;
|
||||
if (*pValue != target) {
|
||||
s32 step = (diff) / scale;
|
||||
if (step > minStep || step < -minStep) {
|
||||
if (step > maxStep) {
|
||||
step = maxStep;
|
||||
scale = (diff) / scale;
|
||||
if (scale > minStep || scale < -minStep) {
|
||||
if (scale > maxStep) {
|
||||
scale = maxStep;
|
||||
}
|
||||
if (step < -maxStep) {
|
||||
step = -maxStep;
|
||||
if (scale < -maxStep) {
|
||||
scale = -maxStep;
|
||||
}
|
||||
*pValue += step;
|
||||
*pValue += scale;
|
||||
} else {
|
||||
if (0 <= diff) {
|
||||
*pValue += minStep;
|
||||
diff = target - *pValue;
|
||||
if (0 >= diff) {
|
||||
if (0 >= target - *pValue) {
|
||||
*pValue = target;
|
||||
}
|
||||
} else {
|
||||
*pValue -= minStep;
|
||||
diff = target - *pValue;
|
||||
if (0 <= diff) {
|
||||
if (0 <= target - *pValue) {
|
||||
*pValue = target;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target - *pValue;
|
||||
return diff;
|
||||
}
|
||||
|
||||
/* 8025335C-802533D0 .text cLib_chaseUC__FPUcUcUc */
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "MSL_C/float.h"
|
||||
|
||||
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(__FILE__, line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1));
|
||||
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(__FILE__, line, -1.0e32f < x && x < 1.0e32f);
|
||||
#define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(__FILE__, line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f)
|
||||
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1));
|
||||
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f);
|
||||
#define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f)
|
||||
|
||||
/* 80251D88-80252020 .text SetC__8cM3dGCylFRC4cXyz */
|
||||
void cM3dGCyl::SetC(const cXyz& pos) {
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "MSL_C/float.h"
|
||||
|
||||
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(__FILE__, line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1));
|
||||
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(__FILE__, line, -1.0e32f < x && x < 1.0e32f);
|
||||
#define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(__FILE__, line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f)
|
||||
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(((sizeof(x) == sizeof(float)) ? __fpclassifyf((float)(x)) : __fpclassifyd((double)(x)) ) == 1));
|
||||
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f);
|
||||
#define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f)
|
||||
|
||||
/* 8025238C-80252624 .text SetC__8cM3dGSphFRC4cXyz */
|
||||
void cM3dGSph::SetC(const cXyz& pos) {
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
/* 80246044-8024609C .text cM_rad2s__Ff */
|
||||
s16 cM_rad2s(float f0) {
|
||||
f32 tmpF = fmod(f0, 6.2831854820251465 /* approx. 2 * PI */);
|
||||
s32 tmp = (tmpF * 10430.378f /* approx. 32768 / PI */);
|
||||
f64 tmpF = fmod(f0, 6.2831854820251465 /* approx. 2 * PI */);
|
||||
s32 tmp = (tmpF * 10430.3779296875 /* approx. 32768 / PI */);
|
||||
if (tmp < -0x8000) {
|
||||
tmp += 0x10000;
|
||||
} else if (tmp > 0x7FFF) {
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
//
|
||||
|
||||
#include "SSystem/SComponent/c_xyz.h"
|
||||
#include "SSystem/SComponent/c_math.h"
|
||||
#include "MSL_C/float.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "MSL_C/float.h"
|
||||
#include "SSystem/SComponent/c_math.h"
|
||||
|
||||
const cXyz cXyz::Zero(0, 0, 0);
|
||||
const cXyz cXyz::BaseX(1, 0, 0);
|
||||
@@ -150,7 +150,6 @@ bool cXyz::operator!=(const Vec& vec) const {
|
||||
|
||||
/* 80245CE4-80245D48 .text isZero__4cXyzCFv */
|
||||
bool cXyz::isZero(void) const {
|
||||
return fabsf(this->x) < 3.814697e-06 &&
|
||||
fabsf(this->y) < 3.814697e-06 &&
|
||||
fabsf(this->z) < 3.814697e-06;
|
||||
return fabsf(this->x) < 3.814697e-06f && fabsf(this->y) < 3.814697e-06f &&
|
||||
fabsf(this->z) < 3.814697e-06f;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user