Merge remote-tracking branch 'decomp/main'

This commit is contained in:
Max Roncace
2026-03-18 01:56:47 -04:00
133 changed files with 1091 additions and 584 deletions
+6 -2
View File
@@ -36,7 +36,7 @@ public:
void SetHit() { mStts |= STTS_HIT; }
u32 ChkHit() const { return mStts & STTS_HIT; }
void SetCross(const cXyz& pos) { mLin.SetEnd(pos); }
cXyz* GetCrossP() { return &mLin.GetEndP(); }
cXyz* GetCrossP() { return mLin.GetEndP(); }
cM3dGLin* GetLinP() { return &mLin; }
bool ChkBackFlag() const { return mBackFlag; }
void OnBackFlag() { mBackFlag = true; }
@@ -45,13 +45,17 @@ public:
bool GetPreWallChk() const { return mPreWallChk; }
bool GetPreGroundChk() const { return mPreGroundChk; }
bool GetPreRoofChk() const { return mPreRoofChk; }
cXyz* GetStartP() { return &mLin.GetStartP(); }
cXyz* GetStartP() { return mLin.GetStartP(); }
void ClrSttsRoofOff() { mStts &= ~STTS_ROOF_OFF; }
void SetSttsRoofOff() { mStts |= STTS_ROOF_OFF; }
void ClrSttsWallOff() { mStts &= ~STTS_WALL_OFF; }
void SetSttsWallOff() { mStts |= STTS_WALL_OFF; }
void ClrSttsGroundOff() { mStts &= ~STTS_GROUND_OFF; }
void SetSttsGroundOff() { mStts |= STTS_GROUND_OFF; }
void ClearCheckIndex() { ClearPi(); }
bool ChkSttsWallOff() const { return (mStts & STTS_WALL_OFF); }
bool ChkSttsGroundOff() const { return (mStts & STTS_GROUND_OFF); }
bool ChkSttsRoofOff() const { return (mStts & STTS_ROOF_OFF); }
};
#endif /* C_BG_S_LIN_CHK_H */
+15 -12
View File
@@ -188,6 +188,7 @@ public:
cXyz* GetCCMoveP() { return &m_cc_move; }
fpc_ProcID GetApid() const { return m_apid; }
u8 GetDmg() const { return m_dmg; }
void ClrCo() { ClrCcMove(); }
}; // Size = 0x1C
STATIC_ASSERT(0x1C == sizeof(cCcD_Stts));
@@ -213,7 +214,7 @@ public:
void ct();
void SetSPrm(u32 sprm) { mSPrm = sprm; }
s32 getSPrm() const { return mSPrm; }
void setRPrm(s32 rprm) { mRPrm = rprm; }
void SetRPrm(u32 rprm) { mRPrm = rprm; }
s32 getRPrm() const { return mRPrm; }
cCcD_Obj* GetHitObj() { return mHitObj; }
const cCcD_Obj* GetHitObj() const { return mHitObj; }
@@ -222,6 +223,9 @@ public:
void OnSPrmBit(u32 flag) { mSPrm |= flag; }
void OffSPrmBit(u32 flag) { mSPrm &= ~flag; }
u32 ChkSPrm(u32 prm) const { return MskSPrm(prm) != 0; }
void SetHitObj(cCcD_Obj* pobj) { mHitObj = pobj; }
void ClrRPrm(u32 prm) { mRPrm &= ~prm; }
void ClrObj() { mHitObj = NULL; }
void Set(cCcD_SrcObjCommonBase const& src) { mSPrm = src.mSPrm; }
};
@@ -240,7 +244,7 @@ public:
void ClrHit();
int GetType() const { return mType; }
u32 GetGrp() const { return MskSPrm(0x1E); }
bool ChkSet() const { return MskSPrm(1); }
BOOL ChkSet() const { return MskSPrm(1); }
u8 GetAtp() const { return mAtp; }
u32 MskType(u32 msk) const { return mType & msk; }
void SetType(u32 type) { mType = type; }
@@ -269,7 +273,7 @@ public:
int GetType() const { return mType; }
void SetType(u32 type) { mType = type; }
u32 GetGrp() const { return MskSPrm(0x1E); }
bool ChkSet() const { return MskSPrm(1); }
BOOL ChkSet() const { return MskSPrm(1); }
void ClrSet() { OffSPrmBit(1); }
u32 ChkHit() const { return MskRPrm(1); }
@@ -289,7 +293,7 @@ public:
void SetIGrp(u32);
void SetVsGrp(u32);
u32 GetGrp() const { return MskSPrm(0x1E); }
bool ChkSet() const { return MskSPrm(1); }
BOOL ChkSet() const { return MskSPrm(1); }
u32 GetVsGrp() const { return MskSPrm(0x70); }
u32 GetIGrp() const { return MskSPrm(0xE); }
u32 ChkNoCrr() const { return MskSPrm(0x100); }
@@ -323,10 +327,10 @@ public:
u32 GetCoGrp() const { return mObjCo.GetGrp(); }
int GetTgType() const { return mObjTg.GetType(); }
u32 GetAtType() const { return mObjAt.GetType(); }
bool ChkTgSet() const { return mObjTg.ChkSet(); }
bool ChkAtSet() const { return mObjAt.ChkSet(); }
bool ChkCoSet() const { return mObjCo.ChkSet(); }
u32 ChkCoSameActorHit() const { return mObjCo.ChkCoSameActorHit(); }
BOOL ChkTgSet() const { return mObjTg.ChkSet(); }
BOOL ChkAtSet() const { return mObjAt.ChkSet(); }
BOOL ChkCoSet() const { return mObjCo.ChkSet(); }
u32 ChkCoSameActorHit() { return mObjCo.MskSPrm(0x400); }
void OnCoSameActorHit() { mObjCo.OnCoSameActorHit(); }
void OffCoSameActorHit() { mObjCo.OffCoSameActorHit(); }
u32 GetCoVsGrp() const { return mObjCo.GetVsGrp(); }
@@ -334,8 +338,8 @@ public:
u8 GetAtAtp() const { return mObjAt.GetAtp(); }
u32 ChkAtNoTgHitInfSet() const { return mObjAt.MskSPrm(0x20); }
u32 ChkTgNoAtHitInfSet() const { return mObjTg.MskSPrm(0x20); }
u32 ChkCoNoCoHitInfSet() const { return mObjCo.MskSPrm(0x200); }
bool ChkTgNoSlingHitInfSet() const { return mObjTg.MskSPrm(0x40); }
u32 ChkCoNoCoHitInfSet() { return mObjCo.MskSPrm(0x200); }
BOOL ChkTgNoSlingHitInfSet() { return mObjTg.MskSPrm(0x40); }
void SetAtHit(cCcD_Obj* obj) { mObjAt.SetHit(obj); }
void SetTgHit(cCcD_Obj* obj) { mObjTg.SetHit(obj); }
void SetCoHit(cCcD_Obj* obj) { mObjCo.SetHit(obj); }
@@ -430,7 +434,6 @@ public:
/* vt[21]*/ virtual void getShapeAccess(cCcD_ShapeAttr::Shape*) const;
cM3dGAab& GetWorkAab() { return mAab; }
cM3dGAab const& GetWorkAab() const { return mAab; }
static cXyz m_virtual_center;
};
@@ -456,7 +459,7 @@ public:
void SetStts(cCcD_Stts* stts) { mStts = stts; }
cCcD_DivideInfo& GetDivideInfo() { return mDivideInfo; }
cCcD_DivideInfo* GetPDivideInfo() { return &mDivideInfo; }
int ChkBsRevHit() const { return mFlags & 2; }
int ChkBsRevHit() { return mFlags & 2; }
private:
/* 0x040 */ int mFlags;
+1 -1
View File
@@ -16,7 +16,7 @@ public:
/* 0x1000 */ cCcD_Obj* mpObjCo[0x100];
/* 0x1400 */ cCcD_Obj* mpObj[0x500];
#if DEBUG
/* 0x2800 */ int m_debug_code;
/* 0x2800 */ u32 m_debug_code;
#endif
/* 0x2800 */ u16 mObjAtCount;
/* 0x2802 */ u16 mObjTgCount;
+12 -12
View File
@@ -18,25 +18,25 @@ public:
bool CrossY(const cXyz*) const;
bool UnderPlaneYUnder(f32) const;
bool TopPlaneYUnder(f32) const;
void ClearForMinMax(void);
void ClearForMinMax();
void SetMinMax(const cXyz&);
void SetMinMax(const cM3dGAab&);
void SetMin(const cXyz&);
void SetMax(const cXyz&);
void CalcCenter(cXyz*) const;
void PlusR(f32);
const cXyz* GetMaxP(void) const { return &mMax; }
cXyz* GetMaxP(void) { return &mMax; }
const cXyz* GetMinP(void) const { return &mMin; }
cXyz* GetMinP(void) { return &mMin; }
const f32 GetMaxX(void) const { return mMax.x; }
const f32 GetMaxY(void) const { return mMax.y; }
const f32 GetMaxZ(void) const { return mMax.z; }
const f32 GetMinX(void) const { return mMin.x; }
const f32 GetMinY(void) const { return mMin.y; }
const f32 GetMinZ(void) const { return mMin.z; }
const cXyz* GetMaxP() const { return &mMax; }
cXyz* GetMaxP() { return &mMax; }
const cXyz* GetMinP() const { return &mMin; }
cXyz* GetMinP() { return &mMin; }
const f32 GetMaxX() const { return mMax.x; }
const f32 GetMaxY() const { return mMax.y; }
const f32 GetMaxZ() const { return mMax.z; }
const f32 GetMinX() const { return mMin.x; }
const f32 GetMinY() const { return mMin.y; }
const f32 GetMinZ() const { return mMin.z; }
bool Cross(const cM3dGLin *param_1) const {
return cM3d_Cross_MinMaxBoxLine(GetMinP(), GetMaxP(), (Vec*)&param_1->GetStartP(), (Vec*)&param_1->GetEndP());
return cM3d_Cross_MinMaxBoxLine(GetMinP(), GetMaxP(), param_1->GetStartP(), param_1->GetEndP());
}
bool Cross(const cM3dGAab *param_1) const {
return cM3d_Cross_AabAab(this, param_1);
+4 -2
View File
@@ -3,6 +3,7 @@
#include "SSystem/SComponent/c_m3d.h"
#include "SSystem/SComponent/c_m3d_g_lin.h"
#include "SSystem/SComponent/c_m3d_g_tri.h"
struct cM3dGCpsS {
/* 0x00 */ Vec mStart;
@@ -14,8 +15,8 @@ class cM3dGCps : public cM3dGLin {
public:
/* 0x1C */ f32 mRadius;
cM3dGCps(void);
virtual ~cM3dGCps(void);
cM3dGCps();
virtual ~cM3dGCps();
void Set(const cXyz&, const cXyz&, f32);
void Set(const cM3dGCpsS&);
void SetCps(const cM3dGCps&);
@@ -24,6 +25,7 @@ public:
}
bool Cross(cM3dGCyl const* cyl, cXyz* xyz) const { return cM3d_Cross_CpsCyl(*this, *cyl, xyz); }
bool Cross(cM3dGSph const* sph, cXyz* xyz) const { return cM3d_Cross_CpsSph(*this, *sph, xyz); }
bool Cross(cM3dGTri const& tri, cXyz* xyz) const { return cM3d_Cross_CpsTri(*this, tri, xyz); }
void SetR(f32 r) { mRadius = r; }
f32 GetR() const { return mRadius; }
+2 -2
View File
@@ -40,8 +40,8 @@ public:
bool Cross(const cM3dGCps* cps, cXyz* xyz) const { return cM3d_Cross_CpsCyl(*cps, *this, xyz); }
bool Cross(const cM3dGTri& tri, cXyz* xyz) const { return cM3d_Cross_CylTri(this, &tri, xyz); }
bool Cross(const cM3dGCyl* other, f32* f) const { return cM3d_Cross_CylCyl(this, other, f); }
bool Cross(const cM3dGSph* sph, f32* f) const { return cM3d_Cross_CylSph(this, sph, f); }
bool cross(const cM3dGCyl* other, f32* f) const { return cM3d_Cross_CylCyl(this, other, f); }
bool cross(const cM3dGSph* sph, f32* f) const { return cM3d_Cross_CylSph(this, sph, f); }
}; // Size = 0x18
STATIC_ASSERT(0x18 == sizeof(cM3dGCyl));
+4 -4
View File
@@ -22,13 +22,13 @@ public:
void SetEnd(const cXyz&);
void set(const Vec& i_start, const Vec& i_end) { SetStartEnd(i_start, i_end); }
const cXyz& GetStartP(void) const { return mStart; }
cXyz& GetStartP(void) { return mStart; }
const cXyz* GetStartP() const { return &mStart; }
cXyz* GetStartP() { return &mStart; }
cXyz& GetStart() { return mStart; }
const cXyz& GetStart() const { return mStart; }
const cXyz& GetEndP(void) const { return mEnd; }
cXyz& GetEndP(void) { return mEnd; }
const cXyz* GetEndP() const { return &mEnd; }
cXyz* GetEndP() { return &mEnd; }
cXyz& GetEnd() { return mEnd; }
const cXyz& GetEnd() const { return mEnd; }
f32 GetLen() const { return PSVECDistance(&mStart, &mEnd); }
+3 -2
View File
@@ -39,9 +39,10 @@ public:
f32 GetCY(void) const { return mCenter.y; }
f32 GetCZ(void) const { return mCenter.z; }
bool Cross(const cM3dGSph* other, f32* f) const { return cM3d_Cross_SphSph(this, other, f); }
bool cross(const cM3dGSph* other, f32* f) const { return cM3d_Cross_SphSph(this, other, f); }
bool Cross(const cM3dGCps* cps, cXyz* xyz) const { return cM3d_Cross_CpsSph(*cps, *this, xyz); }
bool Cross(const cM3dGCyl* cyl, f32* f) const { return cM3d_Cross_CylSph(cyl, this, f); }
bool cross(const cM3dGCyl* cyl, f32* f) const { return cM3d_Cross_CylSph(cyl, this, f); }
bool Cross(const cM3dGTri& tri, cXyz* xyz) const { return cM3d_Cross_SphTri(this, &tri, xyz); }
}; // Size = 0x14
STATIC_ASSERT(0x14 == sizeof(cM3dGSph));
+4 -4
View File
@@ -26,10 +26,10 @@ public:
void setPos(const Vec*, const Vec*, const Vec*);
void setBg(const Vec*, const Vec*, const Vec*, const cM3dGPla*);
void set(const Vec*, const Vec*, const Vec*, const Vec*);
bool Cross(cM3dGCps const& cps, cXyz* xyz) const { return cM3d_Cross_CpsTri(cps, *this, xyz); }
bool Cross(cM3dGCyl const& cyl, cXyz* xyz) const { return this->cross(&cyl, xyz); }
bool Cross(cM3dGSph const& sph, cXyz* xyz) const { return cM3d_Cross_SphTri(&sph, this, xyz); }
bool Cross(cM3dGTri const& other, cXyz* xyz) const {
bool Cross(cM3dGCps const& cps, Vec* xyz) const { return cM3d_Cross_CpsTri(cps, *this, xyz); }
bool Cross(cM3dGCyl const& cyl, Vec* xyz) const { return this->cross(&cyl, xyz); }
bool Cross(cM3dGSph const& sph, Vec* xyz) const { return cM3d_Cross_SphTri(&sph, this, xyz); }
bool Cross(cM3dGTri const& other, Vec* xyz) const {
return cM3d_Cross_TriTri(*this, other, xyz);
}
bool cross(const cM3dGLin* lin, Vec* xyz, bool param_2, bool param_3) const {
+1 -1
View File
@@ -87,7 +87,7 @@ private:
/* 0x6B4 */ s16 field_0x6b4;
/* 0x6B6 */ s16 field_0x6b6;
/* 0x6B8 */ u8 field_0x6B8[0x6BC - 0x6B8];
/* 0x6BC */ char* mpName;
/* 0x6BC */ const char* mpName;
/* 0x6C0 */ s32 mAction;
/* 0x6C4 */ s32 mPrevAction;
/* 0x6C8 */ s32 mMode; // That's just a guess. Might need a better name for it's usage
+1 -1
View File
@@ -134,7 +134,7 @@ public:
/* 0x842 */ u16 field_0x842;
/* 0x844 */ u8 field_0x844;
/* 0x845 */ u8 field_0x845[0x848 - 0x845];
/* 0x848 */ s32 field_0x848;
/* 0x848 */ s32 mFlowID;
/* 0x84C */ dMsgFlow_c mMsgFlow;
/* 0x898 */ u8 field_0x898[0x89A - 0x898];
/* 0x89A */ s16 mEvtIdx;
+1 -1
View File
@@ -72,7 +72,7 @@ public:
void setExpression(int, f32);
bool talk(void*);
bool demo(void*);
inline fopAc_ac_c* searchInstructionTag();
inline fopAc_ac_c* searchInstructionTag();
bool instruction(void*);
bool checkIntroDemoStart();
int EvCut_BousIntroSumo1(int);
+1 -1
View File
@@ -160,7 +160,7 @@ private:
/* 0x14B0 */ int field_0x1460;
/* 0x1464 */ int field_0x1464;
/* 0x1468 */ int field_0x1468;
/* 0x146C */ int field_0x146C;
/* 0x146C */ int mFlowID;
/* 0x1470 */ s16 mLookMode;
/* 0x1472 */ u16 field_0x1472;
/* 0x1474 */ u8 mType;
+1 -1
View File
@@ -103,7 +103,7 @@ private:
/* 0xE00 */ int field_0xe00;
/* 0xE04 */ int field_0xe04;
/* 0xE08 */ int field_0xe08;
/* 0xE0C */ int field_0xe0c;
/* 0xE0C */ int mFlowID;
/* 0xE10 */ s16 mLookMode;
/* 0xE12 */ u16 mActionState;
/* 0xE14 */ u8 mType;
+1 -1
View File
@@ -121,7 +121,7 @@ private:
/* 0xDFC */ int field_0xdfc;
/* 0xE00 */ int field_0xe00;
/* 0xE04 */ int field_0xe04;
/* 0xE08 */ int field_0xe08;
/* 0xE08 */ int mFlowID;
/* 0xE0C */ s16 mLookMode;
/* 0xE0E */ u16 mMode;
/* 0xE10 */ u8 mType;
+2 -1
View File
@@ -182,7 +182,8 @@ public:
s16 getMessageNo() { return s16(home.angle.x); }
s8 getType() {
s8 rv = fopAcM_GetParam(this) & 0xFF;
// !@bug Comparison of s8 with 0xFF will always evaluate to false
if (rv == 0xFF) {
rv = 0;
}
+2 -1
View File
@@ -98,7 +98,8 @@ public:
s8 getType() {
s8 rv = fopAcM_GetParam(this) & 0xFF;
// !@bug Comparison of s8 with 0xFF will always evaluate to false
if (rv == 0xFF) {
rv = 0;
}
+2 -1
View File
@@ -99,7 +99,8 @@ public:
s8 getType() {
s8 rv = fopAcM_GetParam(this) & 0xFF;
// !@bug Comparison of s8 with 0xFF will always evaluate to false
if (rv == 0xFF) {
rv = 0;
}
+1 -1
View File
@@ -77,7 +77,7 @@ public:
class daNpc_Kn_prtclMngr_c {
public:
/* 0x00 */ bool mpModel;
/* 0x00 */ bool field_0x00;
/* 0x04 */ cXyz mPos;
/* 0x10 */ csXyz mAngle;
/* 0x18 */ cXyz mScale;
+1 -1
View File
@@ -89,7 +89,7 @@ public:
/* 0x5B7 */ u8 field_0x5b7;
/* 0x5B8 */ int order;
/* 0x5BC */ int bitTRB;
/* 0x5C0 */ char* res_name;
/* 0x5C0 */ const char* res_name;
/* 0x5C4 */ f32 dis;
/* 0x5C8 */ s16 target_angle;
/* 0x5CC */ mDoExt_McaMorfSO* model;
+1 -1
View File
@@ -104,7 +104,7 @@ public:
/* 0xDF8 */ int field_0xdf8;
/* 0xDFC */ int field_0xdfc;
/* 0xE00 */ int field_0xe00;
/* 0xE04 */ int field_0xe04;
/* 0xE04 */ int mFlowID;
/* 0xE08 */ s16 mLookMode;
/* 0xE0A */ u16 mMode;
/* 0xE0C */ u8 mType;
+1 -1
View File
@@ -95,7 +95,7 @@ public:
/* 0x5D8 */ f32 mDistToTarget;
/* 0x5DC */ s16 mAngleToPlayer;
/* 0x5E0 */ f32 mDistScale;
/* 0x5E4 */ char* mResName;
/* 0x5E4 */ const char* mResName;
/* 0x5E8 */ mDoExt_McaMorf* mpMorf;
/* 0x5EC */ mDoExt_btkAnm* mpBtkAnm;
/* 0x5F0 */ mDoExt_btpAnm* mpBtpAnm;
+3
View File
@@ -24,6 +24,9 @@ public:
u8 getBitSW2() { return (fopAcM_GetParam(this) & 0xFF00) >> 8; }
u32 getFlowNodeNo() {
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
return (u16)home.angle.x;
}
+4
View File
@@ -19,6 +19,10 @@ public:
u32 getProcessID() { return mProcessID; }
int getFlowNodeNum() {
return (u16)home.angle.x == 0xFFFF ? -1 : (u16)home.angle.x;
}
/* 0x56C */ u32 mProcessID;
/* 0x570 */ s16 mCreateTimer;
/* 0x572 */ u8 field_0x572;
+5 -5
View File
@@ -144,7 +144,7 @@ public:
void ClrEffCounter() { mEffCounter = 0; }
u32 GetGFlag() const { return mGFlag; }
u32 GetRPrm() const { return mRPrm; }
u32 MskSPrm(u32 mask) const { return mGFlag & mask; }
u32 MskSPrm(u32 mask) { return mGFlag & mask; }
u32 MskRPrm(u32 mask) const { return mRPrm & mask; }
bool ChkSPrm(u32 mask) { return MskSPrm(mask); }
void OnSPrm(u32 flag) { mGFlag |= flag; }
@@ -173,7 +173,7 @@ public:
u8 GetSe() { return mSe; }
dCcG_At_Spl GetSpl() { return (dCcG_At_Spl)mSpl; }
u8 GetMtrl() { return mMtrl; }
u8 GetHitMark() { return mHitMark; }
int GetHitMark() { return mHitMark; }
void SetRVec(cXyz& vec) { mRVec = vec; }
void SetHitPos(cXyz& pos) { mHitPos = pos; }
cXyz* GetHitPosP() { return &mHitPos; }
@@ -203,10 +203,10 @@ public:
void SetHitMark(CcG_Tg_HitMark mark) { mHitMark = mark; }
s16* GetShieldFrontRangeYAngle() { return mShieldFrontRangeYAngle; }
s16 GetShieldRange() { return mShieldRange; }
u8 GetSpl() { return mSpl; }
int GetSpl() { return mSpl; }
void SetSpl(dCcG_Tg_Spl tg_spl) { mSpl = tg_spl; }
void SetSpl(u8 tg_spl) { mSpl = tg_spl; }
u8 GetHitMark() { return mHitMark; }
int GetHitMark() { return mHitMark; }
void SetRVec(cXyz& vec) { mRVec = vec; }
cXyz* GetVecP() { return &mVec; }
cXyz* GetRVecP() { return &mRVec; }
@@ -250,7 +250,7 @@ public:
void SetRoomId(int id) { mRoomId = id; }
fpc_ProcID GetAtOldApid() { return mAtOldApid; }
fpc_ProcID GetTgOldApid() { return mTgOldApid; }
bool ChkNoActor() { return field_0x1C & 1;}
BOOL ChkNoActor() { return field_0x1C & 1;}
bool ChkNoneActorPerfTblId() { return field_0x08 == 0xFFFF; }
dCcG_At_Spl GetAtSpl() { return (dCcG_At_Spl)mAt; }
void SetAtSpl(dCcG_At_Spl spl) { mAt = spl; }
+4 -4
View File
@@ -9,7 +9,7 @@ class dCcMassS_Obj {
private:
/* 0x00 */ cCcD_Obj* mpObj;
/* 0x04 */ u8 mPriority;
/* 0x08 */ dCcMassS_ObjCallback mpCallback;
/* 0x08 */ dCcMassS_ObjCallback mpAreaCheckFunc;
/* 0x0C */ cCcD_DivideInfo mDivideInfo;
/* 0x1C vtable */
@@ -19,10 +19,10 @@ public:
void Set(cCcD_Obj* p_obj, u8 priority, dCcMassS_ObjCallback callback);
void Clear();
cCcD_Obj* GetObj() { return mpObj; }
cCcD_Obj* GetObj() const { return mpObj; }
u8 GetPriority() const { return mPriority; }
dCcMassS_ObjCallback GetCallback() const { return mpCallback; }
cCcD_DivideInfo& GetDivideInfo() { return mDivideInfo; }
dCcMassS_ObjCallback GetAreaCheckFunc() const { return mpAreaCheckFunc; }
cCcD_DivideInfo* GetPDivideInfo() { return &mDivideInfo; }
}; // Size = 0x20
STATIC_ASSERT(0x20 == sizeof(dCcMassS_Obj));
+11 -1
View File
@@ -44,6 +44,16 @@ public:
virtual void MoveAfterCheck();
virtual void CalcParticleAngle(dCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, csXyz*);
#if DEBUG
void OnMassAllTimer() {
m_is_mass_all_timer = 1;
}
void OffMassAllTimer() {
m_is_mass_all_timer = 0;
}
#endif
void SetMass(cCcD_Obj* i_obj, u8 i_priority) { mMass_Mng.Set(i_obj, i_priority); }
void SetMassCam(cM3dGCps& i_cps) { mMass_Mng.SetCam(i_cps); }
u32 GetMassResultCam() { return mMass_Mng.GetResultCam(); }
@@ -70,7 +80,7 @@ public:
// /* 0x0000 */ cCcS mCCcS;
/* 0x284C */ dCcMassS_Mng mMass_Mng;
#if DEBUG
/* 0x2AD0 */ u8 field_0x2ad0;
/* 0x2AD0 */ u8 m_is_mass_all_timer;
#endif
}; // Size = 0x2AC4
+1 -22
View File
@@ -340,27 +340,6 @@ public:
virtual JPABaseEmitter* emitter_create(u32);
};
namespace {
class jstudio_tAdaptor_message : public JStudio::TAdaptor_message {
public:
typedef JStudio::TObject_message ObjectType;
jstudio_tAdaptor_message() {}
virtual ~jstudio_tAdaptor_message();
virtual void adaptor_do_MESSAGE(JStudio::data::TEOperationData, const void*, u32);
};
class jstudio_tCreateObject_message : public JStudio::TCreateObject {
public:
jstudio_tCreateObject_message() {}
virtual ~jstudio_tCreateObject_message();
virtual bool create(JStudio::TObject**, const JStudio::stb::data::TParse_TBlock_object&);
};
}; // namespace
int dDemo_setDemoData(fopAc_ac_c*, u8, mDoExt_McaMorf*, char const*, int, u16*, u32, s8);
class dDemo_c {
@@ -409,7 +388,7 @@ public:
static JStudio_JStage::TCreateObject* m_stage;
static JStudio_JAudio2::TCreateObject* m_audio;
static dDemo_particle_c* m_particle;
static jstudio_tCreateObject_message* m_message;
static JStudio::TCreateObject* m_message;
static JStudio::TFactory* m_factory;
static jmessage_tControl* m_mesgControl;
static dDemo_object_c* m_object;
+6 -1
View File
@@ -33,7 +33,7 @@ public:
void offPassNum(int num) { field_0xc &= ~(1 << num); }
bool checkShieldType(int i) { return getType(i) == 3; }
s8 getType(int i) { return mData[i].mType; }
int getType(int i) { return mData[i].mType; }
int getJntNum(int i) { return (s16)mData[i].mJntNum; }
/* 0x00 */ const dJntColData_c* mData;
@@ -64,4 +64,9 @@ public:
};
#if DEBUG
void dJntCol_setDebugHIO();
void dJntCol_deleteDebugHIO();
#endif
#endif /* D_D_JNT_COL_H */
+1 -1
View File
@@ -190,7 +190,7 @@ public:
bool isPauseWindow() { return mPauseWindow != false; }
void onShowFlag() { mShowFlag |= 1; }
void offShowFlag() { mShowFlag &= ~1; }
bool isShowFlag() { return mShowFlag & 1 != 0; }
bool isShowFlag() { return (mShowFlag & 1) != 0; }
bool isFadeNowCheck() { return mDoGph_gInf_c::getFader()->getStatus() == 1; }
private:
-3
View File
@@ -112,7 +112,4 @@ struct dMsgScrnHowl_c : public dMsgScrnBase_c {
/* 0x27A8 */ f32 field_0x27a8;
};
#define LINE_MAX 30
#define PLOT_BUFFER_MAX_e 0x300
#endif /* MSG_SCRN_D_MSG_SCRN_HOWL_H */
+9 -9
View File
@@ -437,11 +437,11 @@ inline void fopAcM_SetAngle(fopAc_ac_c* i_actor, s16 x, s16 y, s16 z) {
i_actor->current.angle.set(x, y, z);
}
inline void dComIfGs_onSwitch(int i_no, int i_roomNo);
inline void dComIfGs_offSwitch(int i_no, int i_roomNo);
inline void dComIfGs_revSwitch(int i_no, int i_roomNo);
inline BOOL dComIfGs_isSwitch(int i_no, int i_roomNo);
inline void dComIfGs_offActor(int i_no, int i_roomNo);
void dComIfGs_onSwitch(int i_no, int i_roomNo);
void dComIfGs_offSwitch(int i_no, int i_roomNo);
void dComIfGs_revSwitch(int i_no, int i_roomNo);
BOOL dComIfGs_isSwitch(int i_no, int i_roomNo);
void dComIfGs_offActor(int i_no, int i_roomNo);
inline void fopAcM_onSwitch(const fopAc_ac_c* i_actor, int sw) {
return dComIfGs_onSwitch(sw, fopAcM_GetHomeRoomNo(i_actor));
@@ -463,12 +463,12 @@ inline fopAc_ac_c* fopAcM_SearchByName(s16 proc_id) {
return (fopAc_ac_c*)fopAcIt_Judge(fpcSch_JudgeForPName, &proc_id);
}
inline void dComIfGs_onItem(int bitNo, int roomNo);
void dComIfGs_onItem(int bitNo, int roomNo);
inline void fopAcM_onItem(const fopAc_ac_c* item, int bitNo) {
dComIfGs_onItem(bitNo, fopAcM_GetHomeRoomNo(item));
}
inline bool dComIfGs_isItem(int bitNo, int roomNo);
bool dComIfGs_isItem(int bitNo, int roomNo);
inline bool fopAcM_isItem(const fopAc_ac_c* item, int bitNo) {
return dComIfGs_isItem(bitNo, fopAcM_GetHomeRoomNo(item));
}
@@ -481,7 +481,7 @@ inline int fopAcM_GetSetId(const fopAc_ac_c* i_actor) {
return i_actor->setID;
}
inline void dComIfGs_onActor(int bitNo, int roomNo);
void dComIfGs_onActor(int bitNo, int roomNo);
inline void fopAcM_onActor(const fopAc_ac_c* i_actor) {
dComIfGs_onActor(fopAcM_GetSetId(i_actor), fopAcM_GetHomeRoomNo(i_actor));
@@ -716,7 +716,7 @@ inline void make_prm_warp_hole(u32* o_params, u8 prm1, u8 prm2, u8 prm3) {
*o_params = pprm2 | pprm3 | pprm1;
}
inline fopAc_ac_c* dComIfGp_getPlayer(int);
fopAc_ac_c* dComIfGp_getPlayer(int);
inline s16 fopAcM_searchPlayerAngleY(const fopAc_ac_c* actor) {
return fopAcM_searchActorAngleY(actor, dComIfGp_getPlayer(0));
+12 -1
View File
@@ -130,7 +130,7 @@ static const float INF = 2000000000.0f;
#define NO_INLINE
#endif
#endif
// Hack to trick the compiler into not inlining functions that use this macro.
#define FORCE_DONT_INLINE \
(void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; (void*)0; \
@@ -200,4 +200,15 @@ static const float INF = 2000000000.0f;
using std::isnan;
#endif
// Comparing a non-volatile reference type to NULL is tautological
// and triggers a warning on modern compilers, but in some cases is
// required to match the original assembly.
#if defined(__MWERKS__) || defined(DECOMPCTX)
#define IS_REF_NULL(r) (&(r) == NULL)
#define IS_REF_NONNULL(r) (&(r) != NULL)
#else
#define IS_REF_NULL(r) (0)
#define IS_REF_NONNULL(r) (1)
#endif
#endif
@@ -3,6 +3,8 @@
#include "JSystem/J3DGraphAnimator/J3DAnimation.h"
class J3DMaterial;
/**
* @ingroup jsystem-j3d
*
+1 -1
View File
@@ -434,7 +434,7 @@ void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
field_0x120 = 0;
field_0x12c |= 2;
if (field_0x0c4 < 0xffffffff) {
field_0x0c4++;
field_0x0c4 += 1;
}
field_0x0c0 = false;
}
+1 -1
View File
@@ -107,7 +107,7 @@ void* JASAudioThread::run() {
case AUDIOMSG_DSP:
JUT_ASSERT(125, snIntCount != 0);
snIntCount--;
snIntCount -= 1;
if (snIntCount == 0) {
JASProbe::stop(7);
JASDriver::finishDSPFrame();
+1 -1
View File
@@ -21,7 +21,7 @@ bool JASBasicBank::getInstParam(int prg_no, int param_1, int param_2,
JASInstParam* o_param) const {
JASInst* inst = getInst(prg_no);
if (inst == NULL) {
return NULL;
return false;
}
return inst->getParam(param_1, param_2, o_param);
}
+1 -1
View File
@@ -5,7 +5,7 @@
#include <limits>
void JASCalc::imixcopy(const s16* s1, const s16* s2, s16* dst, u32 n) {
for (n; n != 0; n--) {
for (; n != 0; n--) {
*dst++ = *(s1)++;
*dst++ = *(s2)++;
}
+1 -1
View File
@@ -295,7 +295,7 @@ u32 JASSeqParser::readReg(JASTrack* param_0, u32 param_1) const {
case 0x6a:
result = param_0->getReleasePrio();
// @bug this should have been <<=
result << 8;
(void)(result << 8);
result |= param_0->getNoteOnPrio();
break;
case 0x6b:
+3 -3
View File
@@ -1260,7 +1260,7 @@ JPABaseShape::JPABaseShape(u8 const* pData, JKRHeap* pHeap) {
}
if (isTexAnm()) {
JUT_ASSERT(1698, pBsd->texAnmKeyNum != NULL);
JUT_ASSERT(1698, pBsd->texAnmKeyNum != 0);
u32 offs = sizeof(JPABaseShapeData);
if (isTexCrdAnm()) {
offs += 0x28;
@@ -1271,7 +1271,7 @@ JPABaseShape::JPABaseShape(u8 const* pData, JKRHeap* pHeap) {
}
if (isPrmAnm()) {
JUT_ASSERT(1707, pBsd->prmAnmKeyNum != NULL);
JUT_ASSERT(1707, pBsd->prmAnmKeyNum != 0);
JPAClrAnmKeyData* anmKeyData = (JPAClrAnmKeyData*)(pData + pBsd->mClrPrmAnmOffset);
makeColorTable(&mpPrmClrAnmTbl, anmKeyData,
pBsd->prmAnmKeyNum, pBsd->mClrAnmFrmMax, pHeap);
@@ -1280,7 +1280,7 @@ JPABaseShape::JPABaseShape(u8 const* pData, JKRHeap* pHeap) {
}
if (isEnvAnm()) {
JUT_ASSERT(1716, pBsd->envAnmKeyNum != NULL);
JUT_ASSERT(1716, pBsd->envAnmKeyNum != 0);
JPAClrAnmKeyData* anmKeyData = (JPAClrAnmKeyData*)(pData + pBsd->mClrEnvAnmOffset);
makeColorTable(&mpEnvClrAnmTbl, anmKeyData,
pBsd->envAnmKeyNum, pBsd->mClrAnmFrmMax, pHeap);
@@ -37,7 +37,7 @@ bool JStudio_JStage::TCreateObject::create(
eObject = JStage::OBJECT_FOG;
break;
default:
return NULL;
return false;
}
JUT_ASSERT(99, pfnCreateObject!=NULL);
JUT_ASSERT(100, eObject!=JStage::OBJECT_UNDEFINED);
+1 -1
View File
@@ -181,7 +181,7 @@ void JUTConsole::doDraw(JUTConsole::EConsoleType consoleType) const {
mFont->drawString_scale((int)f31, sp94, mFontSizeX, mFontSizeY,
mVisible ? "[ON]" : "[OFF]", TRUE);
f31 += (int)(mFontSizeX * 6.0f);
if (this == NULL) // ????
if (IS_REF_NULL(*this)) // ????
{
mFont->setCharColor(JUtility::TColor(0xff, 0xff, 0x64, 0xff));
mFont->drawString_scale((int)(f31 - mFontSizeX), mFontSizeX, mFontSizeY, sp94,
+1 -1
View File
@@ -949,7 +949,7 @@ bool JUTException::queryMapAddress_single(char* mapPath, u32 address, s32 sectio
dst--;
i--;
}
(void)*src; // needed to match debug
UNUSED(*src); // needed to match debug
*dst = 0;
if (print) {
if (begin_with_newline) {
+27 -1
View File
@@ -5,6 +5,12 @@
#include "SSystem/SComponent/c_bg_s_gnd_chk.h"
#include "f_pc/f_pc_manager.h"
#include "JSystem/JUtility/JUTAssert.h"
#define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !isnan(x));
#define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -INF < x && x < INF);
#define CHECK_FLOAT_MIN(line, x) JUT_ASSERT(line, -INF < x);
#define CHECK_FLOAT_MAX(line, x) JUT_ASSERT(line, x < INF);
cBgS_GndChk::cBgS_GndChk() {
m_pos = cXyz::Zero;
@@ -15,11 +21,31 @@ cBgS_GndChk::cBgS_GndChk() {
cBgS_GndChk::~cBgS_GndChk() {}
void cBgS_GndChk::SetPos(Vec const* pos) {
m_pos = *pos;
m_pos.x = pos->x;
m_pos.y = pos->y;
m_pos.z = pos->z;
CHECK_FLOAT_CLASS(37, m_pos.x);
CHECK_FLOAT_CLASS(38, m_pos.y);
CHECK_FLOAT_CLASS(39, m_pos.z);
CHECK_FLOAT_RANGE(43, m_pos.x);
CHECK_FLOAT_MIN(44, m_pos.y);
CHECK_FLOAT_MAX(45, m_pos.y);
CHECK_FLOAT_RANGE(46, m_pos.z);
}
void cBgS_GndChk::SetPos(cXyz const* pos) {
m_pos = *pos;
CHECK_FLOAT_CLASS(59, m_pos.x);
CHECK_FLOAT_CLASS(60, m_pos.y);
CHECK_FLOAT_CLASS(61, m_pos.z);
CHECK_FLOAT_RANGE(65, m_pos.x);
CHECK_FLOAT_MIN(66, m_pos.y);
CHECK_FLOAT_MAX(67, m_pos.y);
CHECK_FLOAT_RANGE(68, m_pos.z);
}
void cBgS_GndChk::PreCheck() {
+4 -4
View File
@@ -28,11 +28,11 @@ void cBgS_LinChk::Set2(cXyz const* startPos, cXyz const* endPos, unsigned int ac
field_0x40 = *endPos;
SetActorPid(actorPid);
mStts &= ~STTS_HIT;
ClearPi();
ClearCheckIndex();
}
void cBgS_LinChk::PreCalc() {
mPreWallChk = !(mStts & STTS_WALL_OFF);
mPreGroundChk = !(mStts & STTS_GROUND_OFF);
mPreRoofChk = !(mStts & STTS_ROOF_OFF);
mPreWallChk = !ChkSttsWallOff();
mPreGroundChk = !ChkSttsGroundOff();
mPreRoofChk = !ChkSttsRoofOff();
}
+104 -102
View File
@@ -218,9 +218,7 @@ void cCcD_Stts::PlusCcMove(f32 x, f32 y, f32 z) {
}
void cCcD_Stts::ClrCcMove() {
m_cc_move.z = 0.0f;
m_cc_move.y = 0.0f;
m_cc_move.x = 0.0f;
m_cc_move.x = m_cc_move.y = m_cc_move.z = 0.0f;
}
void cCcD_Stts::PlusDmg(int dmg) {
@@ -231,7 +229,8 @@ void cCcD_Stts::PlusDmg(int dmg) {
}
f32 cCcD_Stts::GetWeightF() const {
return (s32)m_weight;
int weighti = GetWeightUc();
return weighti;
}
void cCcD_ObjCommonBase::ct() {
@@ -259,17 +258,13 @@ fopAc_ac_c* cCcD_Obj::GetAc() {
if (mStts == NULL) {
return NULL;
} else {
return mStts->GetAc();
return mStts->GetActor();
}
}
void cCcD_ShapeAttr::getShapeAccess(cCcD_ShapeAttr::Shape* pshape) const {
pshape->_0 = 2;
pshape->_14 = 0.0f;
pshape->_10 = 0.0f;
pshape->_4.z = 0.0f;
pshape->_4.y = 0.0f;
pshape->_4.x = 0.0f;
pshape->_4.x = pshape->_4.y = pshape->_4.z = pshape->_10 = pshape->_14 = 0.0f;
}
bool cCcD_PntAttr::GetNVec(cXyz const& param_0, cXyz* param_1) const {
@@ -321,19 +316,20 @@ bool cCcD_TriAttr::CrossAtTg(const cCcD_TriAttr& other, cXyz* pxyz) const {
}
void cCcD_TriAttr::CalcAabBox() {
mAab.ClearForMinMax();
mAab.SetMinMax(mA);
mAab.SetMinMax(mB);
mAab.SetMinMax(mC);
GetWorkAab().ClearForMinMax();
GetWorkAab().SetMinMax(mA);
GetWorkAab().SetMinMax(mB);
GetWorkAab().SetMinMax(mC);
}
bool cCcD_TriAttr::GetNVec(const cXyz& param_0, cXyz* pOut) const {
if (getPlaneFunc(&param_0) >= 0.0f) {
*pOut = mNormal;
*pOut = *GetNP();
} else {
*pOut = mNormal;
VECScale(pOut, pOut, -1.0f);
*pOut = *GetNP();
PSVECScale(pOut, pOut, -1.0f);
}
return true;
}
@@ -362,7 +358,7 @@ bool cCcD_CpsAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const {
}
bool cCcD_CpsAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const {
if (triAttr.cM3dGTri::Cross(*this, pxyz)) {
if (cM3dGCps::Cross(triAttr, pxyz)) {
return true;
} else {
return false;
@@ -400,44 +396,47 @@ bool cCcD_CpsAttr::CrossCo(const cCcD_SphAttr& sphAttr, f32* param_1) const {
}
void cCcD_CpsAttr::CalcAabBox() {
mAab.ClearForMinMax();
mAab.SetMinMax(mStart);
mAab.SetMinMax(mEnd);
mAab.PlusR(mRadius);
GetWorkAab().ClearForMinMax();
GetWorkAab().SetMinMax(*GetStartP());
GetWorkAab().SetMinMax(*GetEndP());
GetWorkAab().PlusR(GetR());
}
bool cCcD_CpsAttr::GetNVec(const cXyz& param_0, cXyz* param_1) const {
Vec diff;
const cXyz& endP = GetEndP();
VECSubtract(&endP, &mStart, &diff);
cXyz diff;
PSVECSubtract(GetEndP(), GetStartP(), &diff);
f32 diffLen = VECDotProduct(&diff, &diff);
f32 diffLen = PSVECDotProduct(&diff, &diff);
if (cM3d_IsZero(diffLen)) {
return false;
} else {
Vec vec1, vec2;
VECSubtract(&param_0, &mStart, &vec1);
f32 vec1Len = VECDotProduct(&vec1, &diff) / diffLen;
if (vec1Len < 0.0f) {
vec2 = mStart;
} else {
if (vec1Len > 1.0f) {
vec2 = endP;
} else {
VECScale(&diff, &diff, vec1Len);
VECAdd(&diff, &mStart, &vec2);
}
}
}
VECSubtract(&param_0, &vec2, param_1);
if (cM3d_IsZero(VECMag(param_1))) {
param_1->set(0.0f, 0.0f, 0.0f);
return false;
cXyz vec1;
PSVECSubtract(&param_0, GetStartP(), &vec1);
f32 vec1Len = PSVECDotProduct(&vec1, &diff) / diffLen;
cXyz vec2;
if (vec1Len < 0.0f) {
vec2 = *GetStartP();
} else {
if (vec1Len > 1.0f) {
vec2 = *GetEndP();
} else {
VECNormalize(param_1, param_1);
return true;
PSVECScale(&diff, &diff, vec1Len);
PSVECAdd(&diff, GetStartP(), &vec2);
}
}
PSVECSubtract(&param_0, &vec2, param_1);
if (cM3d_IsZero(PSVECMag(param_1))) {
param_1->x = 0.0f;
param_1->y = 0.0f;
param_1->z = 0.0f;
return false;
} else {
PSVECNormalize(param_1, param_1);
return true;
}
}
bool cCcD_CylAttr::CrossAtTg(const cCcD_CpsAttr& cpsAttr, cXyz* pxyz) const {
@@ -473,7 +472,7 @@ bool cCcD_CylAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const {
}
bool cCcD_CylAttr::CrossCo(const cCcD_CylAttr& other, f32* f) const {
if (cM3dGCyl::Cross(&other, f)) {
if (cM3dGCyl::cross(&other, f)) {
return true;
} else {
return false;
@@ -481,7 +480,7 @@ bool cCcD_CylAttr::CrossCo(const cCcD_CylAttr& other, f32* f) const {
}
bool cCcD_CylAttr::CrossCo(const cCcD_SphAttr& sphAttr, f32* f) const {
if (cM3dGCyl::Cross(&sphAttr, f)) {
if (cM3dGCyl::cross(&sphAttr, f)) {
return true;
} else {
return false;
@@ -507,51 +506,51 @@ void cCcD_CylAttr::CalcAabBox() {
max.x = GetCP()->x + GetR();
max.y = GetCP()->y + GetH();
max.z = GetCP()->z + GetR();
mAab.Set(&min, &max);
GetWorkAab().Set(&min, &max);
}
bool cCcD_CylAttr::GetNVec(const cXyz& param_0, cXyz* param_1) const {
Vec vec;
if (GetCP()->y > param_0.y) {
vec = mCenter;
const cXyz* cp = GetCP();
cXyz vec;
if (cp->y > param_0.y) {
vec = *cp;
} else {
if (GetCP()->y + GetH() < param_0.y) {
vec.x = GetCP()->x;
vec.y = GetCP()->y;
vec.z = GetCP()->z;
vec.y = GetCP()->y + GetH();
if (cp->y + GetH() < param_0.y) {
vec = *cp;
vec.y += GetH();
} else {
vec = mCenter;
vec = *cp;
vec.y = param_0.y;
}
}
VECSubtract(&param_0, &vec, param_1);
if (cM3d_IsZero(VECMag(param_1))) {
param_1->set(0.0f, 0.0f, 0.0f);
PSVECSubtract(&param_0, &vec, param_1);
if (cM3d_IsZero(PSVECMag(param_1))) {
param_1->x = 0.0f;
param_1->y = 0.0f;
param_1->z = 0.0f;
return false;
} else {
VECNormalize(param_1, param_1);
PSVECNormalize(param_1, param_1);
return true;
}
return false;
}
void cCcD_CylAttr::getShapeAccess(cCcD_ShapeAttr::Shape* pshape) const {
pshape->_0 = 1;
pshape->_4.x = mCenter.x;
pshape->_4.y = mCenter.y;
pshape->_4.z = mCenter.z;
pshape->_10 = mRadius;
pshape->_14 = mHeight;
}
inline bool inlineCross(const cM3dGSph& sph, const cM3dGCps* pcps, cXyz* pxyz) {
return cM3d_Cross_CpsSph(*pcps, sph, pxyz);
const cXyz& center = GetC();
pshape->_4.x = center.x;
pshape->_4.y = center.y;
pshape->_4.z = center.z;
pshape->_10 = GetR();
pshape->_14 = GetH();
}
bool cCcD_SphAttr::CrossAtTg(const cCcD_CpsAttr& cpsAttr, cXyz* pxyz) const {
if (inlineCross(*this, &cpsAttr, pxyz)) {
if (cM3dGSph::Cross(&cpsAttr, pxyz)) {
return true;
} else {
return false;
@@ -575,7 +574,7 @@ bool cCcD_SphAttr::CrossAtTg(const cCcD_SphAttr& sphAttr, cXyz* pxyz) const {
}
bool cCcD_SphAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const {
if (triAttr.cM3dGTri::Cross(*this, pxyz)) {
if (cM3dGSph::Cross(triAttr, pxyz)) {
return true;
} else {
return false;
@@ -583,7 +582,7 @@ bool cCcD_SphAttr::CrossAtTg(const cCcD_TriAttr& triAttr, cXyz* pxyz) const {
}
bool cCcD_SphAttr::CrossCo(const cCcD_CylAttr& cylAttr, f32* f) const {
if (cM3dGSph::Cross(&cylAttr, f)) {
if (cM3dGSph::cross(&cylAttr, f)) {
return true;
} else {
return false;
@@ -591,7 +590,7 @@ bool cCcD_SphAttr::CrossCo(const cCcD_CylAttr& cylAttr, f32* f) const {
}
bool cCcD_SphAttr::CrossCo(const cCcD_SphAttr& sphAttr, f32* f) const {
if (cM3dGSph::Cross(&sphAttr, f)) {
if (cM3dGSph::cross(&sphAttr, f)) {
return true;
} else {
return false;
@@ -622,37 +621,40 @@ void cCcD_SphAttr::CalcAabBox() {
max.y += GetR();
max.z += GetR();
mAab.Set(&min, &max);
GetWorkAab().Set(&min, &max);
}
bool cCcD_SphAttr::GetNVec(const cXyz& param_0, cXyz* param_1) const {
param_1->x = param_0.x - mCenter.x;
param_1->y = param_0.y - mCenter.y;
param_1->z = param_0.z - mCenter.z;
const cXyz& center = GetC();
param_1->x = param_0.x - center.x;
param_1->y = param_0.y - center.y;
param_1->z = param_0.z - center.z;
if (cM3d_IsZero(VECMag(param_1))) {
if (cM3d_IsZero(PSVECMag(param_1))) {
param_1->x = 0.0f;
param_1->y = 0.0f;
param_1->z = 0.0f;
return false;
} else {
VECNormalize(param_1, param_1);
PSVECNormalize(param_1, param_1);
return true;
}
}
void cCcD_SphAttr::getShapeAccess(cCcD_ShapeAttr::Shape* pshape) const {
pshape->_0 = 0;
pshape->_4.x = mCenter.x;
pshape->_4.y = mCenter.y;
pshape->_4.z = mCenter.z;
pshape->_10 = mRadius;
const cXyz& center = GetC();
pshape->_4.x = center.x;
pshape->_4.y = center.y;
pshape->_4.z = center.z;
pshape->_10 = GetR();
pshape->_14 = 0.0f;
}
void cCcD_ObjAt::SetHit(cCcD_Obj* pObj) {
mRPrm = 1;
mHitObj = pObj;
SetRPrm(1);
SetHitObj(pObj);
}
void cCcD_ObjAt::Set(const cCcD_SrcObjAt& src) {
@@ -662,8 +664,8 @@ void cCcD_ObjAt::Set(const cCcD_SrcObjAt& src) {
}
void cCcD_ObjAt::ClrHit() {
mRPrm &= ~1;
mHitObj = NULL;
ClrRPrm(1);
ClrObj();
}
void cCcD_ObjTg::Set(const cCcD_SrcObjTg& src) {
@@ -672,36 +674,36 @@ void cCcD_ObjTg::Set(const cCcD_SrcObjTg& src) {
}
void cCcD_ObjTg::SetGrp(u32 grp) {
mSPrm &= ~0x1E;
mSPrm |= grp;
OffSPrmBit(0x1E);
OnSPrmBit(grp);
}
void cCcD_ObjTg::ClrHit() {
mRPrm &= ~1;
mHitObj = NULL;
ClrRPrm(1);
ClrObj();
}
void cCcD_ObjTg::SetHit(cCcD_Obj* pObj) {
mRPrm = 1;
mHitObj = pObj;
SetRPrm(1);
SetHitObj(pObj);
}
void cCcD_ObjCo::SetHit(cCcD_Obj* pObj) {
mRPrm = 1;
mHitObj = pObj;
SetRPrm(1);
SetHitObj(pObj);
}
void cCcD_ObjCo::ClrHit() {
mRPrm &= ~1;
mHitObj = NULL;
ClrRPrm(1);
ClrObj();
}
void cCcD_ObjCo::SetIGrp(u32 grp) {
mSPrm &= ~0xE;
mSPrm |= grp;
OffSPrmBit(0xE);
OnSPrmBit(grp);
}
void cCcD_ObjCo::SetVsGrp(u32 grp) {
mSPrm &= ~0x70;
mSPrm |= grp;
OffSPrmBit(0x70);
OnSPrmBit(grp);
}
+53 -34
View File
@@ -33,6 +33,10 @@ void cCcS::Ct() {
*obj = NULL;
}
mObjCount = 0;
#if DEBUG
m_debug_code = 1234;
#endif
}
void cCcS::Dt() {
@@ -98,9 +102,8 @@ void cCcS::ClrCoHitInf() {
if (*obj != NULL) {
(*obj)->GetGObjInf()->ClrCoHit();
cCcD_Stts* stts = (*obj)->GetStts();
if (stts != NULL) {
stts->ClrCcMove();
if ((*obj)->GetStts() != NULL) {
(*obj)->GetStts()->ClrCo();
}
}
}
@@ -111,9 +114,8 @@ void cCcS::ClrTgHitInf() {
if (*obj != NULL) {
(*obj)->GetGObjInf()->ClrTgHit();
cCcD_Stts* stts = (*obj)->GetStts();
if (stts != NULL) {
stts->ClrTg();
if ((*obj)->GetStts() != NULL) {
(*obj)->GetStts()->ClrTg();
}
}
}
@@ -124,9 +126,8 @@ void cCcS::ClrAtHitInf() {
if (*obj != NULL) {
(*obj)->GetGObjInf()->ClrAtHit();
cCcD_Stts* stts = (*obj)->GetStts();
if (stts != NULL) {
stts->ClrAt();
if ((*obj)->GetStts() != NULL) {
(*obj)->GetStts()->ClrAt();
}
}
}
@@ -155,18 +156,18 @@ void cCcS::ChkAtTg() {
continue;
cCcD_ShapeAttr* pat_sa = (*pat_obj)->GetShapeAttr();
JUT_ASSERT(0, pat_sa != NULL);
JUT_ASSERT(338, pat_sa != NULL);
for (cCcD_Obj** ptg_obj = mpObjTg; ptg_obj < objTgEnd; ++ptg_obj) {
if (*ptg_obj == NULL || !(*ptg_obj)->ChkTgSet())
continue;
if (!(*pat_obj)->GetDivideInfo().Chk((*ptg_obj)->GetDivideInfo()))
if (!(*pat_obj)->GetPDivideInfo()->Chk(*(*ptg_obj)->GetPDivideInfo()))
continue;
if (ChkNoHitAtTg(*pat_obj, *ptg_obj))
continue;
cCcD_ShapeAttr* ptg_sa = (*ptg_obj)->GetShapeAttr();
JUT_ASSERT(0, ptg_sa != NULL);
JUT_ASSERT(354, ptg_sa != NULL);
static cXyz cross;
bool didCross = pat_sa->CrossAtTg(*ptg_sa, &cross);
@@ -176,9 +177,12 @@ void cCcS::ChkAtTg() {
} else if (anyBsRevHit && !didCross) {
cCcD_ShapeAttr* pat_sa = (*pat_obj)->GetShapeAttr();
if (pat_sa == NULL) {
cross.set(0.0f, 0.0f, 0.0f);
cross.x = 0.0f;
cross.y = 0.0f;
cross.z = 0.0f;
} else {
pat_sa->GetWorkAab().CalcCenter(&cross);
cM3dGAab& aab = pat_sa->GetWorkAab();
aab.CalcCenter(&cross);
}
SetAtTgCommonHitInf(*pat_obj, *ptg_obj, &cross);
@@ -213,24 +217,22 @@ void cCcS::ChkCo() {
continue;
cCcD_ShapeAttr* pco1_sa = (*pco1_obj)->GetShapeAttr();
JUT_ASSERT(0, pco1_sa != NULL);
JUT_ASSERT(444, pco1_sa != NULL);
for (cCcD_Obj** pco2_obj = pco1_obj + 1; pco2_obj < objCoEnd; ++pco2_obj) {
if (*pco2_obj == NULL || !(*pco2_obj)->ChkCoSet())
continue;
if (!(*pco1_obj)->GetDivideInfo().Chk((*pco2_obj)->GetDivideInfo()))
if (!(*pco1_obj)->GetPDivideInfo()->Chk(*(*pco2_obj)->GetPDivideInfo()))
continue;
if (ChkNoHitCo(*pco1_obj, *pco2_obj))
continue;
cCcD_ShapeAttr* pco2_sa = (*pco2_obj)->GetShapeAttr();
JUT_ASSERT(0, pco2_sa != NULL);
JUT_ASSERT(456, pco2_sa != NULL);
f32 cross_len;
if (pco1_sa->CrossCo(*pco2_sa, &cross_len)) {
cXyz& co2_center = pco2_sa->GetCoCP();
cXyz& co1_center = pco1_sa->GetCoCP();
SetCoCommonHitInf(*pco1_obj, &co1_center, *pco2_obj, &co2_center, cross_len);
SetCoCommonHitInf(*pco1_obj, &pco1_sa->GetCoCP(), *pco2_obj, &pco2_sa->GetCoCP(), cross_len);
}
}
}
@@ -238,7 +240,11 @@ void cCcS::ChkCo() {
void cCcS::CalcTgPlusDmg(cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj, cCcD_Stts* pat_stts,
cCcD_Stts* ptg_stts) {
ptg_stts->PlusDmg(pat_obj->GetAtAtp());
UNUSED(ptg_obj);
UNUSED(pat_stts);
int atp = pat_obj->GetAtAtp();
ptg_stts->PlusDmg(atp);
}
void cCcS::SetAtTgCommonHitInf(cCcD_Obj* pat_obj, cCcD_Obj* ptg_obj, cXyz* pcross) {
@@ -296,8 +302,8 @@ void cCcS::SetPosCorrect(cCcD_Obj* pco1_obj, cXyz* ppos1, cCcD_Obj* pco2_obj, cX
return;
if (pco1_obj->GetStts() == NULL || pco2_obj->GetStts() == NULL)
return;
if (pco1_obj->GetStts()->GetAc() != NULL &&
pco1_obj->GetStts()->GetAc() == pco2_obj->GetStts()->GetAc())
if (pco1_obj->GetStts()->GetActor() != NULL &&
pco1_obj->GetStts()->GetActor() == pco2_obj->GetStts()->GetActor())
return;
if (!(fabsf(cross_len) < (1.0f / 125.0f))) {
@@ -346,12 +352,12 @@ void cCcS::SetPosCorrect(cCcD_Obj* pco1_obj, cXyz* ppos1, cCcD_Obj* pco2_obj, cX
}
f32 objDistLen;
Vec vec1;
Vec vec2;
cXyz vec1;
cXyz vec2;
Vec objsDist;
if (bothCoSph3DCrr) {
VECSubtract(ppos2, ppos1, &objsDist);
objDistLen = VECMag(&objsDist);
PSVECSubtract(ppos2, ppos1, &objsDist);
objDistLen = PSVECMag(&objsDist);
} else {
objsDist.x = ppos2->x - ppos1->x;
objsDist.y = 0;
@@ -361,10 +367,11 @@ void cCcS::SetPosCorrect(cCcD_Obj* pco1_obj, cXyz* ppos1, cCcD_Obj* pco2_obj, cX
if (!cM3d_IsZero(objDistLen)) {
if (bothCoSph3DCrr) {
VECScale(&objsDist, &objsDist, cross_len / objDistLen);
f32 sp1C = cross_len / objDistLen;
PSVECScale(&objsDist, &objsDist, sp1C);
obj2Weight *= -1;
VECScale(&objsDist, &vec1, obj2Weight);
VECScale(&objsDist, &vec2, obj1Weight);
PSVECScale(&objsDist, &vec1, obj2Weight);
PSVECScale(&objsDist, &vec2, obj1Weight);
} else {
f32 pushFactor = cross_len / objDistLen;
objsDist.x *= pushFactor;
@@ -435,7 +442,7 @@ void cCcS::CalcArea() {
for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) {
if (*pset_obj != NULL) {
cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr();
JUT_ASSERT(0, pset_sa != NULL);
JUT_ASSERT(826, pset_sa != NULL);
pset_sa->CalcAabBox();
aab.SetMinMax(pset_sa->GetWorkAab());
@@ -445,10 +452,10 @@ void cCcS::CalcArea() {
mDivideArea.SetArea(aab);
for (cCcD_Obj** pset_obj = mpObj; pset_obj < mpObj + mObjCount; ++pset_obj) {
if (*pset_obj != NULL) {
const cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr();
JUT_ASSERT(0, pset_sa != NULL);
cCcD_ShapeAttr* pset_sa = (*pset_obj)->GetShapeAttr();
JUT_ASSERT(839, pset_sa != NULL);
cCcD_DivideInfo* divideInfo = &(*pset_obj)->GetDivideInfo();
cCcD_DivideInfo* divideInfo = (*pset_obj)->GetPDivideInfo();
mDivideArea.CalcDivideInfo(divideInfo, pset_sa->GetWorkAab(),
(*pset_obj)->ChkBsRevHit());
}
@@ -456,10 +463,22 @@ void cCcS::CalcArea() {
}
void cCcS::Move() {
#if DEBUG
JUT_ASSERT(866, m_debug_code == 1234);
#endif
CalcArea();
ChkAtTg();
ChkCo();
MoveAfterCheck();
#if DEBUG
field_0x280c = mObjAtCount;
field_0x280e = mObjTgCount;
field_0x2810 = mObjCoCount;
field_0x2812 = mObjCount;
#endif
mObjAtCount = 0;
mObjTgCount = 0;
mObjCoCount = 0;
+74 -74
View File
@@ -66,14 +66,14 @@ bool cM3d_Len2dSqPntAndSegLine(f32 param_1, f32 param_2, f32 param_3, f32 param_
bool cM3d_Len3dSqPntAndSegLine(const cM3dGLin* pLine, const Vec* pVec, Vec* pOutVec, f32* pOutF) {
bool retVal = false;
Vec tmp;
VECSubtract(&pLine->GetEndP(), &pLine->GetStartP(), &tmp);
VECSubtract(pLine->GetEndP(), pLine->GetStartP(), &tmp);
f32 seqLen = VECDotProduct(&tmp, &tmp);
if (cM3d_IsZero(seqLen)) {
*pOutF = 0.0f;
return retVal;
} else {
Vec tmp2;
VECSubtract(pVec, &pLine->GetStartP(), &tmp2);
VECSubtract(pVec, pLine->GetStartP(), &tmp2);
f32 tmpF = VECDotProduct(&tmp2, &tmp);
tmpF /= seqLen;
if (tmpF < 0.0f || tmpF > 1.0f) {
@@ -82,7 +82,7 @@ bool cM3d_Len3dSqPntAndSegLine(const cM3dGLin* pLine, const Vec* pVec, Vec* pOut
retVal = true;
}
VECScale(&tmp, &tmp, tmpF);
VECAdd(&tmp, &pLine->GetStartP(), pOutVec);
VECAdd(&tmp, pLine->GetStartP(), pOutVec);
*pOutF = VECSquareDistance(pOutVec, pVec);
return retVal;
}
@@ -213,7 +213,7 @@ int cM3d_Check_LinLin(const cM3dGLin* lin_a, const cM3dGLin* lin_b, f32* dst_a,
VECScale(&linAVec, &linAVec, invLinALen);
VECScale(&linBVec, &linBVec, invLinBLen);
Vec tmp;
VECSubtract(&lin_a->GetStartP(), &lin_b->GetStartP(), &tmp);
VECSubtract(lin_a->GetStartP(), lin_b->GetStartP(), &tmp);
f32 tmpF = -VECDotProduct(&linAVec, &linBVec);
f32 tmpF2 = VECDotProduct(&tmp, &linAVec);
VECSquareMag(&tmp); // result not used
@@ -262,19 +262,19 @@ static bool cM3d_CrossInfLineVsInfPlane_proc(f32 pFloatA, f32 pFloatB, const Vec
}
bool cM3d_Cross_LinPla(const cM3dGLin* lin, const cM3dGPla* pla, Vec* dst, bool a, bool b) {
f32 startVal = pla->getPlaneFunc(&lin->GetStartP());
f32 endVal = pla->getPlaneFunc(&lin->GetEndP());
f32 startVal = pla->getPlaneFunc(lin->GetStartP());
f32 endVal = pla->getPlaneFunc(lin->GetEndP());
if (startVal * endVal > 0.0f) {
*dst = lin->GetEnd();
return false;
} else {
if (startVal >= 0.0f && endVal <= 0.0f) {
if (a) {
return cM3d_CrossInfLineVsInfPlane_proc(startVal, endVal, &lin->GetStartP(), &lin->GetEndP(), dst);
return cM3d_CrossInfLineVsInfPlane_proc(startVal, endVal, lin->GetStartP(), lin->GetEndP(), dst);
}
} else {
if (b) {
return cM3d_CrossInfLineVsInfPlane_proc(startVal, endVal, &lin->GetStartP(), &lin->GetEndP(), dst);
return cM3d_CrossInfLineVsInfPlane_proc(startVal, endVal, lin->GetStartP(), lin->GetEndP(), dst);
}
}
*dst = lin->GetEnd();
@@ -1034,53 +1034,53 @@ bool cM3d_Cross_LinSph(cM3dGLin const* line, cM3dGSph const* sph, Vec* param_2)
const Vec* center = sph->GetCP();
f32 max_x = center->x + sph->GetR();
if (max_x < line->GetStartP().x && max_x < line->GetEndP().x) {
if (max_x < line->GetStartP()->x && max_x < line->GetEndP()->x) {
return false;
}
f32 min_x = center->x - sph->GetR();
if (min_x > line->GetStartP().x && min_x > line->GetEndP().x) {
if (min_x > line->GetStartP()->x && min_x > line->GetEndP()->x) {
return false;
}
f32 max_y = center->y + sph->GetR();
if (max_y < line->GetStartP().y && max_y < line->GetEndP().y) {
if (max_y < line->GetStartP()->y && max_y < line->GetEndP()->y) {
return false;
}
f32 min_y = center->y - sph->GetR();
if (min_y > line->GetStartP().y && min_y > line->GetEndP().y) {
if (min_y > line->GetStartP()->y && min_y > line->GetEndP()->y) {
return false;
}
f32 max_z = center->z + sph->GetR();
if (max_z < line->GetStartP().z && max_z < line->GetEndP().z) {
if (max_z < line->GetStartP()->z && max_z < line->GetEndP()->z) {
return false;
}
f32 min_z = center->z - sph->GetR();
if (min_z > line->GetStartP().z && min_z > line->GetEndP().z) {
if (min_z > line->GetStartP()->z && min_z > line->GetEndP()->z) {
return false;
}
VECSubtract(&line->GetEndP(), &line->GetStartP(), &lin_vec);
VECSubtract(line->GetEndP(), line->GetStartP(), &lin_vec);
f32 len_sq = VECSquareMag(&lin_vec);
if (cM3d_IsZero(len_sq)) {
return false;
}
VECSubtract(center, &line->GetStartP(), &vec);
VECSubtract(center, line->GetStartP(), &vec);
f32 proj = VECDotProduct(&vec, &lin_vec) / len_sq;
if (proj < 0.0f || proj > 1.0f) {
if (line->GetStartP().abs2(*center) < line->GetEndP().abs2(*center)) {
if (cM3d_Cross_SphPnt(sph, &line->GetStartP())) {
param_2->x = line->GetStartP().x;
param_2->y = line->GetStartP().y;
param_2->z = line->GetStartP().z;
if (line->GetStartP()->abs2(*center) < line->GetEndP()->abs2(*center)) {
if (cM3d_Cross_SphPnt(sph, line->GetStartP())) {
param_2->x = line->GetStartP()->x;
param_2->y = line->GetStartP()->y;
param_2->z = line->GetStartP()->z;
return true;
}
} else {
if (cM3d_Cross_SphPnt(sph, &line->GetEndP())) {
param_2->x = line->GetEndP().x;
param_2->y = line->GetEndP().y;
param_2->z = line->GetEndP().z;
if (cM3d_Cross_SphPnt(sph, line->GetEndP())) {
param_2->x = line->GetEndP()->x;
param_2->y = line->GetEndP()->y;
param_2->z = line->GetEndP()->z;
return true;
}
}
@@ -1089,7 +1089,7 @@ bool cM3d_Cross_LinSph(cM3dGLin const* line, cM3dGSph const* sph, Vec* param_2)
Vec proj_vec;
VECScale(&lin_vec, &proj_vec, proj);
VECAdd(&proj_vec, &line->GetStartP(), param_2);
VECAdd(&proj_vec, line->GetStartP(), param_2);
if (cM3d_LenSq(param_2, center) <= sph->GetR() * sph->GetR()) {
return true;
}
@@ -1100,8 +1100,8 @@ int cM3d_Cross_LinSph_CrossPos(cM3dGSph const& sph, cM3dGLin const& line, Vec* p
Vec* param_3) {
int ret;
Vec line_vec, vec;
VECSubtract(&line.GetEndP(), &line.GetStartP(), &line_vec);
VECSubtract(&line.GetStartP(), sph.GetCP(), &vec);
VECSubtract(line.GetEndP(), line.GetStartP(), &line_vec);
VECSubtract(line.GetStartP(), sph.GetCP(), &vec);
f32 len_sq = VECDotProduct(&line_vec, &line_vec);
f32 dVar9 = VECDotProduct(&line_vec, &vec) * 2.0f;
f32 dVar6 = VECDotProduct(&vec, &vec) - sph.GetR() * sph.GetR();
@@ -1113,7 +1113,7 @@ int cM3d_Cross_LinSph_CrossPos(cM3dGSph const& sph, cM3dGLin const& line, Vec* p
ret = 1;
Vec vec2;
VECScale(&line_vec, &vec2, -dVar6 / dVar9);
VECAdd(&vec2, &line.GetStartP(), param_2);
VECAdd(&vec2, line.GetStartP(), param_2);
}
} else {
f32 f11 = dVar9 * dVar9 - len_sq * 4.0f * dVar6;
@@ -1121,7 +1121,7 @@ int cM3d_Cross_LinSph_CrossPos(cM3dGSph const& sph, cM3dGLin const& line, Vec* p
ret = 1;
Vec vec2;
VECScale(&line_vec, &vec2, -dVar9 / (len_sq * 2.0f));
VECAdd(&vec2, &line.GetStartP(), param_2);
VECAdd(&vec2, line.GetStartP(), param_2);
} else if (f11 < 0.0f) {
ret = 0;
} else {
@@ -1131,9 +1131,9 @@ int cM3d_Cross_LinSph_CrossPos(cM3dGSph const& sph, cM3dGLin const& line, Vec* p
f32 scale1 = f1 * (-dVar9 + sqrtf(f11));
f32 scale2 = f1 * (-dVar9 - sqrtf(f11));
VECScale(&line_vec, &vec2, scale1);
VECAdd(&vec2, &line.GetStartP(), param_2);
VECAdd(&vec2, line.GetStartP(), param_2);
VECScale(&line_vec, &vec2, scale2);
VECAdd(&vec2, &line.GetStartP(), param_3);
VECAdd(&vec2, line.GetStartP(), param_3);
}
}
@@ -1460,17 +1460,17 @@ int cM3d_Cross_CylLin(cM3dGCyl const* cyl, cM3dGLin const* line, Vec* param_2, V
f2 = 0.0f;
uVar11 = 0;
if (cM3d_Cross_CylPnt(cyl, &line->GetStartP()) && cM3d_Cross_CylPnt(cyl, &line->GetEndP())) {
*param_2 = line->GetStartP();
*param_3 = line->GetEndP();
if (cM3d_Cross_CylPnt(cyl, line->GetStartP()) && cM3d_Cross_CylPnt(cyl, line->GetEndP())) {
*param_2 = *line->GetStartP();
*param_3 = *line->GetEndP();
return 2;
}
Vec vec1, vec2, vec3;
Vec vec[4];
const Vec* center = cyl->GetCP();
VECSubtract(&line->GetStartP(), center, &vec1);
VECSubtract(&line->GetEndP(), center, &vec2);
VECSubtract(line->GetStartP(), center, &vec1);
VECSubtract(line->GetEndP(), center, &vec2);
VECSubtract(&vec2, &vec1, &vec3);
r_sq = cyl->GetR() * cyl->GetR();
@@ -1599,7 +1599,7 @@ int cM3d_Cross_CylLin(cM3dGCyl const* cyl, cM3dGLin const* line, Vec* param_2, V
if (count == 0) {
*param_2 = vec[i];
} else if (count == 1) {
if (cM3d_LenSq(&line->GetStartP(), param_2) < cM3d_LenSq(&line->GetStartP(), &vec[i])) {
if (cM3d_LenSq(line->GetStartP(), param_2) < cM3d_LenSq(line->GetStartP(), &vec[i])) {
*param_3 = vec[i];
} else {
*param_3 = *param_2;
@@ -1707,36 +1707,36 @@ inline bool cM3d_Cross_CpsCyl_Check(cM3dGCps const& cps, cM3dGCyl const& cyl, Ve
bool cM3d_Cross_CpsCyl(cM3dGCps const& cps, cM3dGCyl const& cyl, Vec* param_2) {
cM3dGLin line;
if (cM3d_Cross_CylPnt(&cyl, &cps.GetEndP())) {
*param_2 = cps.GetEndP();
if (cM3d_Cross_CylPnt(&cyl, cps.GetEndP())) {
*param_2 = *cps.GetEndP();
return true;
}
if (cM3d_Cross_CylPnt(&cyl, &cps.GetStartP())) {
*param_2 = cps.GetStartP();
if (cM3d_Cross_CylPnt(&cyl, cps.GetStartP())) {
*param_2 = *cps.GetStartP();
return true;
}
line.GetStartP() = *cyl.GetCP();
line.GetEndP() = *cyl.GetCP();
line.GetEndP().y += cyl.GetH();
*line.GetStartP() = *cyl.GetCP();
*line.GetEndP() = *cyl.GetCP();
line.GetEndP()->y += cyl.GetH();
Vec vec;
f32 tmp;
if (cM3d_Len3dSqPntAndSegLine(&cps, &line.GetEndP(), &vec, &tmp)) {
f32 dist = VECDistance(&line.GetEndP(), &vec);
if (cM3d_Len3dSqPntAndSegLine(&cps, line.GetEndP(), &vec, &tmp)) {
f32 dist = VECDistance(line.GetEndP(), &vec);
if (dist < cps.GetR()) {
VECAdd(&line.GetEndP(), &vec, param_2);
VECAdd(line.GetEndP(), &vec, param_2);
VECScale(param_2, param_2, 0.5f);
*param_2 = line.GetEndP();
*param_2 = *line.GetEndP();
return true;
}
}
if (cM3d_Len3dSqPntAndSegLine(&cps, &line.GetStartP(), &vec, &tmp)) {
f32 dist = VECDistance(&line.GetStartP(), &vec);
if (cM3d_Len3dSqPntAndSegLine(&cps, line.GetStartP(), &vec, &tmp)) {
f32 dist = VECDistance(line.GetStartP(), &vec);
if (dist < cps.GetR()) {
VECAdd(&line.GetStartP(), &vec, param_2);
VECAdd(line.GetStartP(), &vec, param_2);
VECScale(param_2, param_2, 0.5f);
return true;
}
@@ -1749,7 +1749,7 @@ bool cM3d_Cross_CpsCyl(cM3dGCps const& cps, cM3dGCyl const& cyl, Vec* param_2) {
cM3dGSph sph;
f32 tmp2;
sph.SetR(cps.GetR());
sph.SetC(cps.GetStartP());
sph.SetC(*cps.GetStartP());
return cM3d_Cross_CylSph(&cyl, &sph, param_2, &tmp2);
} else if (iVar2 == 2) {
if (f1 >= 0.0f && f1 <= 1.0f && f2 >= 0.0f && f2 <= 1.0f) {
@@ -1818,8 +1818,8 @@ static void cM3d_Cross_CpsSph_CrossPos(cM3dGCps const& param_1, cM3dGSph const&
if (iVar5 == 1) {
*param_4 = aVStack_70;
} else if (iVar5 == 2) {
f32 dVar8 = VECSquareDistance(&aVStack_70, &param_1.GetStartP());
f32 dVar9 = VECSquareDistance(&VStack_7c, &param_1.GetStartP());
f32 dVar8 = VECSquareDistance(&aVStack_70, param_1.GetStartP());
f32 dVar9 = VECSquareDistance(&VStack_7c, param_1.GetStartP());
if (dVar8 < dVar9) {
*param_4 = aVStack_70;
} else {
@@ -1840,14 +1840,14 @@ static void cM3d_Cross_CpsSph_CrossPos(cM3dGCps const& param_1, cM3dGSph const&
bool cM3d_Cross_CpsSph(cM3dGCps const& param_1, cM3dGSph const& param_2, Vec* param_3) {
f32 local_38 = VECDistance(&param_1.GetStartP(), param_2.GetCP());
f32 local_38 = VECDistance(param_1.GetStartP(), param_2.GetCP());
if (local_38 < param_1.GetR() + param_2.GetR()) {
cM3d_Cross_CpsSph_CrossPos(param_1, param_2, param_1.GetStartP(), param_3);
cM3d_Cross_CpsSph_CrossPos(param_1, param_2, *param_1.GetStartP(), param_3);
return true;
}
local_38 = VECDistance(&param_1.GetEndP(), param_2.GetCP());
local_38 = VECDistance(param_1.GetEndP(), param_2.GetCP());
if (local_38 < param_1.GetR() + param_2.GetR()) {
cM3d_Cross_CpsSph_CrossPos(param_1, param_2, param_1.GetEndP(), param_3);
cM3d_Cross_CpsSph_CrossPos(param_1, param_2, *param_1.GetEndP(), param_3);
return true;
}
Vec auStack_34;
@@ -1922,13 +1922,13 @@ inline f32 cM3d_2LinCenter(cM3dGLin const& pLinA, f32 pLinAF, cM3dGLin const& pL
bool cM3d_Cross_CpsTri(cM3dGCps const& cps, cM3dGTri tri, Vec* param_2) {
cM3dGSph sph;
sph.SetC(cps.GetStartP());
sph.SetC(*cps.GetStartP());
sph.SetR(cps.GetR());
if (cM3d_Cross_SphTri(&sph, &tri, param_2)) {
return true;
}
sph.SetC(cps.GetEndP());
sph.SetC(*cps.GetEndP());
sph.SetR(cps.GetR());
if (cM3d_Cross_SphTri(&sph, &tri, param_2)) {
return true;
@@ -2044,25 +2044,25 @@ static int cM3d_2PlaneCrossLine(const cM3dGPla& pPlaneA, const cM3dGPla& pPlaneB
if (absTX >= absTY && absTX >= absTZ) {
cM3d_PlaneCrossLineProcWork(pPlaneA.GetNP()->y, pPlaneA.GetNP()->z, pPlaneB.GetNP()->y,
pPlaneB.GetNP()->z, tmp.x, pPlaneA.GetD(), pPlaneB.GetD(),
&pLinOut->GetStartP().y, &pLinOut->GetStartP().z);
pLinOut->GetStartP().x = 0.0f;
&pLinOut->GetStartP()->y, &pLinOut->GetStartP()->z);
pLinOut->GetStartP()->x = 0.0f;
} else if (absTY >= absTX && absTY >= absTZ) {
cM3d_PlaneCrossLineProcWork(pPlaneA.GetNP()->z, pPlaneA.GetNP()->x, pPlaneB.GetNP()->z,
pPlaneB.GetNP()->x, tmp.y, pPlaneA.GetD(), pPlaneB.GetD(),
&pLinOut->GetStartP().z, &pLinOut->GetStartP().x);
pLinOut->GetStartP().y = 0.0f;
&pLinOut->GetStartP()->z, &pLinOut->GetStartP()->x);
pLinOut->GetStartP()->y = 0.0f;
} else {
cM3d_PlaneCrossLineProcWork(pPlaneA.GetNP()->x, pPlaneA.GetNP()->y, pPlaneB.GetNP()->x,
pPlaneB.GetNP()->y, tmp.z, pPlaneA.GetD(), pPlaneB.GetD(),
&pLinOut->GetStartP().x, &pLinOut->GetStartP().y);
pLinOut->GetStartP().z = 0.0f;
&pLinOut->GetStartP()->x, &pLinOut->GetStartP()->y);
pLinOut->GetStartP()->z = 0.0f;
}
f32 scale = VECMag(&pLinOut->GetStartP());
f32 scale = VECMag(pLinOut->GetStartP());
if (cM3d_IsZero(scale)) {
scale = 1.0f;
}
VECScale(&tmp, &tmp, scale);
VECAdd(&pLinOut->GetStartP(), &tmp, &pLinOut->GetEndP());
VECAdd(pLinOut->GetStartP(), &tmp, pLinOut->GetEndP());
return 1;
}
}
@@ -2073,10 +2073,10 @@ BOOL cM3d_3PlaneCrossPos(const cM3dGPla& pPlaneA, const cM3dGPla& pPlaneB, const
if (!cM3d_2PlaneCrossLine(pPlaneA, pPlaneB, &lin)) {
return false;
} else {
const Vec* end = &lin.GetEndP();
f32 tmpf1 = pPlaneC.getPlaneFunc(&lin.GetStartP());
const Vec* end = lin.GetEndP();
f32 tmpf1 = pPlaneC.getPlaneFunc(lin.GetStartP());
f32 tmpf2 = pPlaneC.getPlaneFunc(end);
if (!cM3d_CrossInfLineVsInfPlane_proc(tmpf1, tmpf2, &lin.GetStartP(), end, pVecOut)) {
if (!cM3d_CrossInfLineVsInfPlane_proc(tmpf1, tmpf2, lin.GetStartP(), end, pVecOut)) {
return false;
} else {
return true;
@@ -2094,10 +2094,10 @@ f32 cM3d_lineVsPosSuisenCross(const cM3dGLin* pLine, const Vec* pPoint, Vec* pVe
*pVecOut = *pPoint;
return 0.0f;
} else {
VECSubtract(pPoint, &pLine->GetStartP(), &tmp2);
VECSubtract(pPoint, pLine->GetStartP(), &tmp2);
f32 retVal = VECDotProduct(&tmp2, &tmp1) / diffLen;
VECScale(&tmp1, &tmp3, retVal);
VECAdd(&tmp3, &pLine->GetStartP(), pVecOut);
VECAdd(&tmp3, pLine->GetStartP(), pVecOut);
return retVal;
}
}
+1 -1
View File
@@ -15717,7 +15717,7 @@ int daAlink_c::procMoveTurnInit(int param_0) {
dComIfGp_setPlayerStatus0(0, 0x800);
if (param_0 != 0) {
mProcVar3.field_0x300e = (mpHIO->mMove.m.mMaxTurnAngle * 4) + 19030;
mProcVar3.field_0x300e = (s16)((mpHIO->mMove.m.mMaxTurnAngle * 4) + 19030);
mProcVar4.field_0x3010 = mpHIO->mMove.m.mMaxTurnAngle * 2;
mProcVar1.field_0x300a = 2;
current.angle.y = mMoveAngle;
+1 -1
View File
@@ -1872,7 +1872,7 @@ static void demo_camera(b_bq_class* i_this) {
spFC.set(BREG_F(5) + -30.0f, 0.0f, BREG_F(6) + 1938.0f);
}
daPy_getPlayerActorClass()->setPlayerPosAndAngle(&spFC, BREG_S(5) + 0x8000, 0);
daPy_getPlayerActorClass()->setPlayerPosAndAngle(&spFC, (s16)(BREG_S(5) + 0x8000), 0);
if (i_this->field_0x5c8 != 0) {
i_this->field_0x5cc.y += i_this->field_0x5d8;
+1
View File
@@ -1325,6 +1325,7 @@ void daB_MGN_c::executeDash() {
}
if (mMoveMode == 11) {
// @bug - parenthesis should not be on the condition
if (abs((s16)(angle - field_0xa90) < 0x1800) != 0) {
if ((s16)(angle - field_0xa90) < 0) {
angle = field_0xa90 - 0x1800;
+1 -1
View File
@@ -881,7 +881,7 @@ void daBgObj_c::setParticle() {
for (; partNum != 0; partNum--) {
u32 flags = *(BE(u32)*)partBlockItems++;
u16 res_id = *(BE(u32)*)partBlockItems;
*partBlockItems++;
partBlockItems++;
GXColor prmColor = { 0xFF, 0xFF, 0xFF, 0xFF };
GXColor envColor = { 0xFF, 0xFF, 0xFF, 0xFF };
+1 -1
View File
@@ -254,7 +254,7 @@ BOOL daBdoor_c::checkArea() {
if (fabsf(vec.z) > 100.0f) {
return false;
}
return (s16)fabs(current.angle.y - 0x7fff - player->current.angle.y) <= 0x4000 ? 1 : 0;
return (s16)fabs((f64)(current.angle.y - 0x7fff - player->current.angle.y)) <= 0x4000 ? 1 : 0;
}
BOOL daBdoor_c::checkFront() {
+1 -1
View File
@@ -825,7 +825,7 @@ int daBdoorL1_c::checkArea() {
if (fabsf(local_48.z) > 100.0f) {
return 0;
}
if ((s16)fabs(current.angle.y - 0x7fff - player->current.angle.y) <= 0x4000) {
if ((s16)fabs((f64)(current.angle.y - 0x7fff - player->current.angle.y)) <= 0x4000) {
return 1;
} else {
return 0;
+1 -1
View File
@@ -348,7 +348,7 @@ int daBdoorL5_c::checkArea() {
if (fabsf(local_48.z) > 100.0f) {
return 0;
}
if ((s16)fabs(current.angle.y - 0x7fff - player->current.angle.y) <= 0x4000) {
if ((s16)fabs((f64)(current.angle.y - 0x7fff - player->current.angle.y)) <= 0x4000) {
return 1;
} else {
return 0;
+1 -1
View File
@@ -1318,7 +1318,7 @@ int daMBdoorL1_c::checkArea() {
return 0;
}
if ((s16)fabs(angle - 0x7fff - player->current.angle.y) > 0x4000) {
if ((s16)fabs((f64)(angle - 0x7fff - player->current.angle.y)) > 0x4000) {
return 0;
} else {
return 1;
+6
View File
@@ -1934,7 +1934,13 @@ int daE_HZ_c::CreateHeap() {
return 0;
}
// This happens to work with MWCC since the member will only ever be initialized a pointer to a
// string in this TU's .data section, but comparing against a string literal is still UB.
#if AVOID_UB
if (strcmp(mpName, "E_hzp") == 0) {
#else
if (mpName == "E_hzp") {
#endif
modelData = (J3DModelData*)dComIfG_getObjectRes(mpName, 3);
} else {
modelData = (J3DModelData*)dComIfG_getObjectRes(mpName, 3);
+1
View File
@@ -496,6 +496,7 @@ static s8 e_kr_path_move(e_kr_class* i_this) {
if (totalDiff < 10.0f * TREG_F(10) + 300.0f) {
point = &i_this->field_0x6e4->m_points[i_this->field_0x6e2];
u8 pointArg1 = point->mArg1;
// !@bug Comparison of u8 with -1 will always evaluate to false
if (pointArg1 == -1) {
i_this->field_0x684 = 50.0f * 1.2f;
} else {
+1 -1
View File
@@ -370,7 +370,7 @@ static void e_mm_mt_drop(e_mm_mt_class* i_this) {
i_this->enemy.speed.y += -5.0f;
i_this->enemy.eyePos = i_this->enemy.current.pos;
i_this->enemy.attention_info.position = i_this->enemy.current.pos;
cLib_addCalcAngleS2(&i_this->m_rotation.z, (TREG_S(6)+0x10000)-0x8000, 1, 0x1000);
cLib_addCalcAngleS2(&i_this->m_rotation.z, (s16)((TREG_S(6) + 0x10000) - 0x8000), 1, 0x1000);
cLib_onBit<u32>(i_this->enemy.attention_info.flags, fopAc_AttnFlag_CARRY_e);
i_this->enemy.attention_info.distances[fopAc_attn_CARRY_e] = 7;
i_this->m_rotation.y += i_this->m_spin;
+36
View File
@@ -724,7 +724,13 @@ void daE_OC_c::damage_check() {
} else if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_40)) {
S16_ADD(health, 10);
} else if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_SLINGSHOT)) {
// This happens to work with MWCC since the member will only ever be initialized a pointer to a
// string in this TU's .data section, but comparing against a string literal is still UB.
#if AVOID_UB
if (strcmp(mName, "E_OC") == 0) {
#else
if (mName == "E_OC") {
#endif
S16_SUB(health, 5);
if (health < 0) {
health = 0;
@@ -855,7 +861,12 @@ void daE_OC_c::setDashSound() {
} else if (mpMorf->checkFrame(8.5f)) {
mSound.startCreatureSound(Z2SE_EN_OC_FOOTNOTE_R, 0, -1);
}
// See comment in damage_check
#if AVOID_UB
if (strcmp(mName, "E_OC") == 0) {
#else
if (mName == "E_OC") {
#endif
mSound.startCreatureSoundLevel(Z2SE_EN_OC_CLUB_DAGGLE, 0, -1);
} else {
mSound.startCreatureSoundLevel(Z2SE_EN_OC_NATA_DAGGLE, 0, -1);
@@ -1421,7 +1432,12 @@ void daE_OC_c::executeAttack() {
} else if (mpMorf->checkFrame(12.5f)) {
mSound.startCreatureSound(Z2SE_EN_OC_ATTACK_B, 0, -1);
} else if (mpMorf->checkFrame(19.0f)) {
// See comment in damage_check
#if AVOID_UB
if (strcmp(mName, "E_OC") == 0) {
#else
if (mName == "E_OC") {
#endif
mSound.startCreatureSound(Z2SE_EN_OC_CLUB_HIT, 0, -1);
} else {
mSound.startCreatureSound(Z2SE_EN_OC_NATA_HIT, 0, -1);
@@ -1843,7 +1859,12 @@ void daE_OC_c::executeDeath() {
case 2:
cLib_chaseF(&speedF, 0.0f, 1.0f);
if (field_0x6c0 == 0) {
// See comment in damage_check
#if AVOID_UB
if (strcmp(mName, "E_OC") == 0) {
#else
if (mName == "E_OC") {
#endif
fopAcM_createDisappear(this, &current.pos, 10, 0, 4);
} else {
fopAcM_createDisappear(this, &current.pos, 10, 0, 0x34);
@@ -1917,7 +1938,12 @@ void daE_OC_c::executeWaterDeath() {
}
if (mpMorf->isStop()) {
// See comment in damage_check
#if AVOID_UB
if (strcmp(mName, "E_OC") == 0) {
#else
if (mName == "E_OC") {
#endif
fopAcM_createDisappear(this, &current.pos, 10, 0, 4);
} else {
fopAcM_createDisappear(this, &current.pos, 10, 0, 0x34);
@@ -2741,7 +2767,12 @@ cPhs_Step daE_OC_c::create() {
mAcchCir.SetWallH(70.0f);
}
mAcchCir.SetWallR(100.0f);
// See comment in damage_check
#if AVOID_UB
if (strcmp(mName, "E_OC") == 0) {
#else
if (mName == "E_OC") {
#endif
field_0x560 = health = 40;
} else {
field_0x560 = health = 220;
@@ -2756,7 +2787,12 @@ cPhs_Step daE_OC_c::create() {
mSphs_at[0].SetStts(&mStts);
mSphs_at[1].Set(E_OC_n::at_sph_src);
mSphs_at[1].SetStts(&mStts);
// See comment in damage_check
#if AVOID_UB
if (strcmp(mName, "E_OC") == 0) {
#else
if (mName == "E_OC") {
#endif
mSphs_at[0].SetAtAtp(1);
mSphs_at[1].SetAtAtp(1);
fopAcM_OnStatus(this, fopAcStts_UNK_0x10000_e);
+2 -2
View File
@@ -2155,7 +2155,7 @@ static void e_rdy_damage(e_rdy_class* i_this) {
case 1:
if (i_this->mAcch.ChkWallHit() && i_this->mTimer[0] == 0) {
if (check = kado_check(i_this)) {
if ((check = kado_check(i_this))) {
OS_REPORT(" ..KADO KABE ..%x\n", check);
if (check == 2) {
i_this->field_0xac6 = 0x1000;
@@ -4721,7 +4721,7 @@ static int daE_RDY_Execute(e_rdy_class* i_this) {
}
MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(JNT_HAND_R), *calc_mtx);
MtxTrans(20.0f + NREG_F(0), 5.0f + NREG_F(1), -10.0f + NREG_F(2), 1);
cMtx_XrotM(*calc_mtx, NREG_S(0) + 0x8000);
cMtx_XrotM(*calc_mtx, (s16)(NREG_S(0) + 0x8000));
cMtx_YrotM(*calc_mtx, NREG_S(1) + ang_y + -0x15cd);
cMtx_ZrotM(*calc_mtx, NREG_S(2) + 0x28cd);
i_this->mpHawkGrassModel->setBaseTRMtx(*calc_mtx);
+1 -1
View File
@@ -1100,7 +1100,7 @@ static void e_wb_f_run(e_wb_class* i_this) {
} else {
e_rd_class* local_90 = (e_rd_class*)fopAcM_SearchByID(i_this->rd_id);
int saku;
if (saku = e_wb_saku_check(i_this)) {
if ((saku = e_wb_saku_check(i_this))) {
i_this->field_0x6d4 = 60;
if ((saku & 2) != 0) {
i_this->field_0x6d6 = 0x3000;
+1 -1
View File
@@ -1235,7 +1235,7 @@ static int daE_YG_Execute(e_yg_class* i_this) {
MTXCopy(daPy_getLinkPlayerActorClass()->getWolfMouthMatrix(), mDoMtx_stack_c::get());
mDoMtx_stack_c::multVecZero(&actor->current.pos);
mDoMtx_stack_c::YrotM(KREG_S(0));
mDoMtx_stack_c::XrotM(KREG_S(1) + 0x8000);
mDoMtx_stack_c::XrotM((s16)(KREG_S(1) + 0x8000));
mDoMtx_stack_c::ZrotM(KREG_S(2) + 2500);
mDoMtx_stack_c::transM(KREG_F(0) + 10.0f, KREG_F(1) + -60.0f, KREG_F(2) + -20.0f);
model->setBaseTRMtx(mDoMtx_stack_c::get());
+1 -1
View File
@@ -1930,7 +1930,7 @@ static void eff_set(e_yh_class* i_this) {
dComIfGp_particle_set(i_this->mParticleIds2[2], dPa_RM(ID_ZI_S_YD_YODAHIT_A),
&a_this->current.pos, 0, NULL);
{
JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticleIds[5]);
JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticleIds2[2]);
if (emitter != NULL) {
MTXCopy(model->getAnmMtx(1), *calc_mtx);
emitter->setGlobalRTMatrix(*calc_mtx);
+1 -1
View File
@@ -516,7 +516,7 @@ void daE_YMB_c::checkWaterPos() {
field_0x6cc = wtr_pos;
field_0x69c.y = wtr_pos + 1000.0f + l_HIO.fly_height_adjust;
std::fabsf(field_0x6cc - current.pos.y);
UNUSED(std::fabsf(field_0x6cc - current.pos.y));
if (current.pos.y < (200.0f + field_0x6cc)) {
if (field_0x715 == 0) {
setWaterEffect1();
+1 -1
View File
@@ -542,7 +542,7 @@ bool daE_ZH_c::mBallBgLineCheck() {
bool daE_ZH_c::mSearchMove(u8 param_1) {
if (mS_Ball == NULL) {
setActionMode(ACTION_EXECUTE_FLY_DELETE, 0);
return NULL;
return false;
}
cXyz sp50, sp5c;
+4 -3
View File
@@ -51,9 +51,10 @@
#define ANM_HS_WALK_FAST 34
#define ANM_HS_WALK_SLOW 35
static f32* strippedFunc() {
f32 v[3] = {};
return v;
static void strippedFunc() {
extern void F(f32*);
f32 v[3] = {0.0f};
F(v);
}
static char const l_arcName[] = "Horse";
+2 -2
View File
@@ -2977,8 +2977,8 @@ static void hook_set(dmg_rod_class* i_this, cXyz* param_1, int param_2) {
mDoMtx_stack_c::XrotM(-0x4000);
if (param_2 == 1 && (i_this->action <= ACTION_LURE_STANDBY || (i_this->lure_type != MG_LURE_SP && i_this->action == ACTION_LURE_CATCH))) {
sp38.x = fabsf(hook->field_0x18.y);
sp38.z = fabsf(hook->field_0x18.x - 0x4000);
sp38.x = fabsf((f32)hook->field_0x18.y);
sp38.z = fabsf((f32)(hook->field_0x18.x - 0x4000));
f32 var_f31 = JMAFastSqrt(SQUARE(sp38.x) + SQUARE(sp38.z));
if (var_f31 > 7000.0f) {
+1 -1
View File
@@ -986,7 +986,7 @@ BOOL daNbomb_c::procWait() {
speedF *= player->getBombBoundRate();
current.angle.y = (mAcchCir.GetWallAngleY() * 2) - (current.angle.y + 0x8000);
} else if (mAcch.ChkGroundLanding() && speedF > 5.0f && cM_deg2s(50.0f) <= field_0xb5a) {
if ((f32)fabs(var_r28) >= (f32)0x4000) {
if ((f32)fabs((f64)var_r28) >= (f32)0x4000) {
speedF *= player->getBombBoundRate();
current.angle.y = (var_r27 * 2) - (current.angle.y + 0x8000);
mAcch.ClrGroundLanding();
+1 -1
View File
@@ -544,7 +544,7 @@ void daBaseNpc_c::orderEvent(int param_0, char* i_evtName) {
if (i_evtName != NULL) {
mEvtIdx = dComIfGp_getEventManager().getEventIdx(this, i_evtName, -1);
fopAcM_orderOtherEventId(this, mEvtIdx, 0xFF, 0xFFFF, 0, 1);
} else if (field_0x848 >= 0 && attention_info.flags == (fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e)) {
} else if (mFlowID >= 0 && attention_info.flags == (fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e)) {
eventInfo.onCondition(1);
if (param_0 != 0) {
fopAcM_orderSpeakEvent(this, 0, 0);
+1 -1
View File
@@ -635,7 +635,7 @@ void daNpc_Bou_c::action() {
hit_actor = field_0xba0.getActorP();
if (hit_actor != NULL) {
abs( (s16)(fopAcM_searchPlayerAngleY(this) - mCurAngle.y) );
UNUSED(abs((s16)(fopAcM_searchPlayerAngleY(this) - mCurAngle.y)));
switch (((daTag_Push_c*) hit_actor)->getId()) {
case 7: {
mEvtNo = 8;
+1 -1
View File
@@ -2628,7 +2628,7 @@ BOOL daNpcChat_c::setAttention(int param_1) {
cXyz(0.0f, 10.0f, 0.0f),
};
int jointNo = isM_() ? JNTM_HEAD : JNTW_HEAD;
int jointNo = isM_() ? (int)JNTM_HEAD : (int)JNTW_HEAD;
mDoMtx_stack_c::copy(mAnm_p->getModel()->getAnmMtx(jointNo));
mDoMtx_stack_c::multVec(&a_eyeOfsTbl[param_1], &eyePos);
mBaseAttnPos.set(current.pos.x, current.pos.y + AtnOfs(param_1), current.pos.z);
+2 -4
View File
@@ -517,8 +517,7 @@ BOOL daNpcChPath_c::setPath(int path_index, int room_no, cXyz& i_vec, bool param
mCurrentID = path_index;
mPntIndex = 0;
// Is this really what the Nintendo devs wrote?? The debug ROM suggests as such.
if (param_4 && &i_vec) {
if (param_4 && IS_REF_NONNULL(i_vec)) {
f32 fVar1 = G_CM3D_F_INF;
for (int pnt_index = 0; pnt_index < mpPath->m_num; pnt_index++) {
dPnt* pnt = dPath_GetPnt(mpPath, pnt_index);
@@ -534,8 +533,7 @@ BOOL daNpcChPath_c::setPath(int path_index, int room_no, cXyz& i_vec, bool param
field_0x8 = G_CM3D_F_INF;
// ditto.
if (&i_vec) {
if (IS_REF_NONNULL(i_vec)) {
field_0x4 = &i_vec;
cXyz targetPoint;
getTargetPoint(targetPoint);
+9 -6
View File
@@ -343,10 +343,13 @@ BOOL daNpc_grA_c::create() {
mType = getTypeFromParam();
mMode = getMode();
mSwBit = getSwBit();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xffff) {
field_0x146C = home.angle.x;
mFlowID = home.angle.x;
} else{
field_0x146C = -1;
mFlowID = -1;
}
if (isDelete()) {
return cPhs_ERROR_e;
@@ -2146,7 +2149,7 @@ BOOL daNpc_grA_c::ECut_talkSpa(int i_staffID) {
setLookMode(5);
break;
case 1:
initTalk(field_0x146C, arr);
initTalk(mFlowID, arr);
break;
case 2:
if (daNpcF_chkEvtBit(6) && daNpcF_chkEvtBit(0x3e) == FALSE) {
@@ -3020,7 +3023,7 @@ BOOL daNpc_grA_c::ECut_rollRockCrash(int i_staffID) {
break;
case 0x14: {
setLookMode(0);
initTalk(field_0x146C, NULL);
initTalk(mFlowID, NULL);
cXyz c(200.0f, 100.0f, 0.0f);
mDoMtx_stack_c::YrotS(home.angle.y);
mDoMtx_stack_c::multVec(&c, &c);
@@ -3588,7 +3591,7 @@ BOOL daNpc_grA_c::waitSpaWater(void*) {
}
setLookMode(0);
mTurnMode = 0;
field_0x146C = 0x28;
mFlowID = 0x28;
field_0x1472 = 2;
field_0x9ea = 1;
// fallthrough
@@ -3968,7 +3971,7 @@ BOOL daNpc_grA_c::talk(void*) {
setGateWalk();
}
} else {
r27 = field_0x146C;
r27 = mFlowID;
}
initTalk(r27, NULL);
field_0x1484 = fopAcM_searchPlayerAngleY(this);
+3
View File
@@ -308,6 +308,9 @@ cPhs_Step daNpc_grC_c::create() {
mTwilight = dKy_darkworld_check();
mType = getTypeFromParam();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
mFlowID = home.angle.x;
} else {
+3
View File
@@ -172,6 +172,9 @@ int daNpc_Grd_c::create() {
mType = getTypeFromParam();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xffff) {
mFlowID = home.angle.x;
} else {
+3
View File
@@ -396,6 +396,9 @@ cPhs_Step daNpc_grO_c::create() {
mType = getTypeFromParam();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
mMsgNo = home.angle.x;
} else {
+3
View File
@@ -264,6 +264,9 @@ cPhs_Step daNpc_grR_c::create() {
mType = getTypeFromParam();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
mFlowID = home.angle.x;
} else {
+8 -5
View File
@@ -138,10 +138,13 @@ int daNpc_grS_c::create() {
mType = getTypeFromParam();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xffff) {
field_0xe0c = home.angle.x;
mFlowID = home.angle.x;
} else {
field_0xe0c = -1;
mFlowID = -1;
}
if (isDelete()) {
@@ -856,7 +859,7 @@ int daNpc_grS_c::selectAction() {
mpNextActionFn = &daNpc_grS_c::test;
}
else {
(int)mType;
UNUSED((int)mType);
mpNextActionFn = &daNpc_grS_c::wait;
}
@@ -936,7 +939,7 @@ int daNpc_grS_c::doEvent() {
if (eventInfo.checkCommandDemoAccrpt() && mEventIdx != -1 &&
eventManager->endCheck(mEventIdx))
{
(int)mOrderEvtNo;
UNUSED((int)mOrderEvtNo);
dComIfGp_event_reset();
mOrderEvtNo = 0;
mEventIdx = -1;
@@ -1157,7 +1160,7 @@ int daNpc_grS_c::talk(void* param_0) {
daNpcF_offTmpBit(11);
}
unkInt1 = field_0xe0c;
unkInt1 = mFlowID;
mIsSpeaking = false;
initTalk(unkInt1, NULL);
mTurnMode = 0;
+3
View File
@@ -455,6 +455,9 @@ cPhs_Step daNpc_Grz_c::create() {
mType = getTypeFromParam();
mSwNo = fopAcM_GetParam(this) >> 16;
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
mMsgNo = home.angle.x;
} else {
+6 -3
View File
@@ -291,10 +291,13 @@ cPhs_Step daNpc_GWolf_c::create() {
mExitId = fopAcM_GetParam(this) >> 24;
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
field_0xe08 = home.angle.x;
mFlowID = home.angle.x;
} else {
field_0xe08 = -1;
mFlowID = -1;
}
swBit = getSwBitFromParam();
@@ -1817,7 +1820,7 @@ BOOL daNpc_GWolf_c::talk(void* param_1) {
break;
}
int msgNo = field_0xe08;
int msgNo = mFlowID;
mOrderSpeakEvt = false;
initTalk(msgNo, NULL);
mTurnMode = 0;
+7 -7
View File
@@ -4961,11 +4961,11 @@ int daNpc_Kn_c::setPrtcl() {
// cXyz* pos = mParticleMngr[i].mpModel == true ? &mParticleMngr[i].mPos : NULL;
mParticleMngr[i].mManager.setEffectCenter(&tevStr, &mParticleMngr[i].mPos, check, sp_0x18,
mParticleMngr[i].mpModel == true ? &mParticleMngr[i].mPos : NULL,
mParticleMngr[i].mpModel == true ? &mParticleMngr[i].mAngle : NULL,
mParticleMngr[i].field_0x00 == true ? &mParticleMngr[i].mPos : NULL,
mParticleMngr[i].field_0x00 == true ? &mParticleMngr[i].mAngle : NULL,
0, fopAcM_GetRoomNo(this), 0.0f, speedF);
if (mParticleMngr[i].mpModel != false) {
if (mParticleMngr[i].field_0x00 != false) {
emitter = mParticleMngr[i].mManager.getCenterEmitter(0, 0);
if (emitter != NULL) {
switch (i) {
@@ -4984,7 +4984,7 @@ int daNpc_Kn_c::setPrtcl() {
}
}
mParticleMngr[i].mpModel = NULL;
mParticleMngr[i].field_0x00 = false;
}
return 1;
@@ -4996,21 +4996,21 @@ int daNpc_Kn_c::setSlipPrtcl() {
mParticleMngr[0].mPos.y -= 20.0f;
mParticleMngr[0].mAngle = current.angle;
ANGLE_SUB_2(mParticleMngr[0].mAngle.y, 0x8000);
mParticleMngr[0].mpModel = true;
mParticleMngr[0].field_0x00 = true;
mDoMtx_stack_c::copy(mpModelMorf[0]->getModel()->getAnmMtx(0x1b));
mDoMtx_stack_c::multVecZero(&mParticleMngr[1].mPos);
mParticleMngr[1].mPos.y -= 20.0f;
mParticleMngr[1].mAngle = current.angle;
ANGLE_SUB_2(mParticleMngr[1].mAngle.y, 0x8000);
mParticleMngr[1].mpModel = true;
mParticleMngr[1].field_0x00 = true;
return 1;
}
int daNpc_Kn_c::setLandingPrtcl() {
mParticleMngr[2].mPos = current.pos;
mParticleMngr[2].mAngle = mCurAngle;
mParticleMngr[2].mpModel = true;
mParticleMngr[2].field_0x00 = true;
return 1;
}
+6
View File
@@ -250,7 +250,13 @@ static int daNpc_Ks_Draw(npc_ks_class* i_this) {
fopAc_ac_c* actor = &i_this->actor;
J3DModel* model = i_this->model->getModel();
// This happens to work with MWCC since the member will only ever be initialized a pointer to a
// string in this TU's .data section, but comparing against a string literal is still UB.
#if AVOID_UB
if (strcmp(i_this->res_name, "Npc_kst") == 0) {
#else
if (i_this->res_name == "Npc_kst") {
#endif
g_env_light.settingTevStruct(4, &actor->current.pos, &actor->tevStr);
} else {
g_env_light.settingTevStruct(0, &actor->current.pos, &actor->tevStr);
+11 -8
View File
@@ -189,10 +189,13 @@ int daNpc_myna2_c::create() {
mType = getTypeFromParam();
field_0xe0d = (fopAcM_GetParam(this) & 0xFF00) >> 8;
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
field_0xe04 = home.angle.x;
mFlowID = home.angle.x;
} else {
field_0xe04 = -1;
mFlowID = -1;
}
if (isDelete()) {
@@ -928,7 +931,7 @@ int daNpc_myna2_c::talk(void* param_0) {
switch (mMode) {
case 0:
if (!mIsDamaged) {
initTalk(field_0xe04, NULL);
initTalk(mFlowID, NULL);
mTurnMode = 0;
mAnm_p->setPlaySpeed(1.0f);
mMode = 2;
@@ -1014,7 +1017,7 @@ int daNpc_myna2_c::ECut_firstTalk(int i_staffId) {
case 10:
break;
case 20:
initTalk(field_0xe04, NULL);
initTalk(mFlowID, NULL);
break;
}
}
@@ -1063,7 +1066,7 @@ int daNpc_myna2_c::ECut_gameFailure(int i_staffId) {
case 20:
break;
case 10:
initTalk(field_0xe04, NULL);
initTalk(mFlowID, NULL);
break;
}
}
@@ -1121,7 +1124,7 @@ int daNpc_myna2_c::ECut_gameGoal(int i_staffId) {
}
break;
case 10:
initTalk(field_0xe04, NULL);
initTalk(mFlowID, NULL);
break;
case 20:
break;
@@ -1183,7 +1186,7 @@ int daNpc_myna2_c::ECut_gameGoalSuccess(int i_staffId) {
}
break;
case 10:
initTalk(field_0xe04, NULL);
initTalk(mFlowID, NULL);
break;
case 20: {
int itemNo = 0;
@@ -1193,7 +1196,7 @@ int daNpc_myna2_c::ECut_gameGoalSuccess(int i_staffId) {
break;
}
case 25:
initTalk(field_0xe04, NULL);
initTalk(mFlowID, NULL);
break;
case 30:
break;
+58 -12
View File
@@ -135,7 +135,13 @@ static int daNpc_Ne_Draw(npc_ne_class* i_this) {
}
J3DModel* model = i_this->mpMorf->getModel();
// This happens to work with MWCC since the member will only ever be initialized a pointer to a
// string in this TU's .data section, but comparing against a string literal is still UB.
#if AVOID_UB
if (strcmp(i_this->mResName, "Npc_net") == 0) {
#else
if (i_this->mResName == "Npc_net") {
#endif
if (!dComIfGs_wolfeye_effect_check()) {
return 1;
}
@@ -426,7 +432,12 @@ static void npc_ne_wait(npc_ne_class* i_this) {
daPy_py_c* player = static_cast<daPy_py_c*>(dComIfGp_getPlayer(0));
cLib_addCalc0(&_this->speedF, 1.0f, 1.3f);
// See comment in daNpc_Ne_Draw
#if AVOID_UB
if (strcmp(i_this->mResName, "Npc_net") == 0) {
#else
if (i_this->mResName == "Npc_net") {
#endif
switch (i_this->mMode) {
case 0:
i_this->mTargetAngleY = cM_rndF(0x10000);
@@ -2173,7 +2184,12 @@ static void action(npc_ne_class* i_this) {
_this->gravity = -7.0f;
// See comment in daNpc_Ne_Draw
#if AVOID_UB
if (strcmp(i_this->mResName, "Npc_net") == 0) {
#else
if (i_this->mResName == "Npc_net") {
#endif
i_this->mDistToTarget = 10000.0f;
} else {
i_this->mDistToTarget = i_this->mDistScale * fopAcM_searchPlayerDistance(_this);
@@ -2298,9 +2314,15 @@ static void action(npc_ne_class* i_this) {
break;
}
// See comment in daNpc_Ne_Draw
#if AVOID_UB
if (strcmp(i_this->mResName, "Npc_net") != 0) {
#else
if (i_this->mResName != "Npc_net") {
if (i_this->mMessageState == 1 && daPy_py_c::checkNowWolf()
&& i_this->mDistToTarget < 300.0f) {
#endif
if (i_this->mMessageState == 1 &&
daPy_py_c::checkNowWolf() &&
i_this->mDistToTarget < 300.0f) {
i_this->mAction = npc_ne_class::ACT_MESSAGE;
i_this->mMode = 0;
bird_check = false;
@@ -2846,8 +2868,15 @@ static void demo_camera(npc_ne_class* i_this) {
}
static int message(npc_ne_class* i_this) {
if (i_this->mResName == "Npc_net" && !dComIfGs_wolfeye_effect_check()) {
i_this->mMessageState = 0;
// See comment in daNpc_Ne_Draw
#if AVOID_UB
if (strcmp(i_this->mResName, "Npc_net") == 0) {
#else
if (i_this->mResName == "Npc_net") {
#endif
if (!dComIfGs_wolfeye_effect_check()) {
i_this->mMessageState = 0;
}
}
if (i_this->mIsTalking) {
@@ -2872,7 +2901,12 @@ static int message(npc_ne_class* i_this) {
!fopAcM_otherBgCheck(daPy_getLinkPlayerActorClass(), i_this)) {
fopAcM_OnStatus(i_this, 0);
cLib_onBit<u32>(i_this->attention_info.flags, fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e);
// See comment in daNpc_Ne_Draw
#if AVOID_UB
if (strcmp(i_this->mResName, "Npc_net") == 0) {
#else
if (i_this->mResName == "Npc_net") {
#endif
cLib_onBit<u32>(i_this->attention_info.flags, fopAc_AttnFlag_UNK_0x800000 | fopAc_AttnFlag_UNK_0x400000);
}
i_this->eventInfo.onCondition(dEvtCnd_CANTALK_e);
@@ -2978,14 +3012,21 @@ static int daNpc_Ne_Execute(npc_ne_class* i_this) {
message(i_this);
demo_camera(i_this);
if (i_this->mResName == "Npc_net" && !dComIfGs_wolfeye_effect_check()) {
static u16 e_name[2] = {0x8497, 0x8498};
for (int i = 0; i < 2; i++) {
i_this->mParticle[i] = dComIfGp_particle_set(i_this->mParticle[i], e_name[i],
&i_this->eyePos, NULL, NULL);
JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticle[i]);
if (emitter != NULL) {
emitter->setGlobalAlpha(!dComIfGs_wolfeye_effect_check() ? 0xff : 0);
// See comment in daNpc_Ne_Draw
#if AVOID_UB
if (strcmp(i_this->mResName, "Npc_net") == 0) {
#else
if (i_this->mResName == "Npc_net") {
#endif
if (!dComIfGs_wolfeye_effect_check()) {
static u16 e_name[2] = {0x8497, 0x8498};
for (int i = 0; i < 2; i++) {
i_this->mParticle[i] = dComIfGp_particle_set(i_this->mParticle[i], e_name[i],
&i_this->eyePos, NULL, NULL);
JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticle[i]);
if (emitter != NULL) {
emitter->setGlobalAlpha(!dComIfGs_wolfeye_effect_check() ? 0xff : 0);
}
}
}
}
@@ -3231,7 +3272,12 @@ static cPhs_Step daNpc_Ne_Create(fopAc_ac_c* i_this) {
_this->mAcchCir.SetWall(_this->mBaseScale.y * 30.0f, _this->mBaseScale.z * 35.0f);
_this->mDistScale = cM_rndFX(0.2f) + 1.0f;
_this->mGroundY = i_this->current.pos.y;
// See comment in daNpc_Ne_Draw
#if AVOID_UB
if (strcmp(_this->mResName, "Npc_net") == 0) {
#else
if (_this->mResName == "Npc_net") {
#endif
_this->mAction = npc_ne_class::ACT_WAIT;
_this->mMode = 0;
}
+1 -1
View File
@@ -1098,7 +1098,7 @@ int daNpc_Pachi_Maro_c::wait(void* param_1) {
}
if (mJntAnm.getMode() == 0) {
(s32)mType;
UNUSED((int)mType);
}
}
break;
+1 -1
View File
@@ -1464,7 +1464,7 @@ int daNpc_Pachi_Taro_c::wait(void* param_1) {
// ???
if (mJntAnm.getMode() == 0) {
(int)mType;
UNUSED((int)mType);
}
if (field_0x1004 == 0) {
+1 -1
View File
@@ -696,7 +696,7 @@ BOOL daNpc_Post_c::checkChangeEvt() {
return TRUE;
}
(int)mType;
UNUSED((int)mType);
}
return FALSE;
+3
View File
@@ -206,6 +206,9 @@ cPhs_Step daNpc_SoldierA_c::create() {
mType = getTypeFromParam();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
mMsgNo = home.angle.x;
} else {
+3
View File
@@ -171,6 +171,9 @@ cPhs_Step daNpc_SoldierB_c::create() {
mType = getTypeFromParam();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xFFFF) {
mMsgNo = home.angle.x;
} else {
+3
View File
@@ -244,6 +244,9 @@ cPhs_Step daNpcTheB_c::create() {
return cPhs_ERROR_e;
}
// !@bug The return value (an s16) is promoted to a 32-bit signed
// integer prior to being compared, so the compared value can
// never exceed SHORT_MAX and the condition always passes.
if (getMessageNo() != 0xFFFF) {
mMsgNo = getMessageNo();
} else {
+2 -2
View File
@@ -2219,8 +2219,8 @@ bool daNpcWrestler_c::sumouReady(void* param_1) {
// fallthrough
case 2:
field_0xe5e += field_0xbd8->field_0xac;
field_0xe54 -= fabsf(field_0xbd8->field_0xac);
if (field_0xe54 < fabsf(field_0xbd8->field_0xac)) {
field_0xe54 -= fabsf((f32)field_0xbd8->field_0xac);
if (field_0xe54 < fabsf((f32)field_0xbd8->field_0xac)) {
field_0xe80 = 1;
field_0xe84++;
}
+3
View File
@@ -493,6 +493,9 @@ cPhs_Step daNpc_zrA_c::create() {
fopAcM_ct(this, daNpc_zrA_c);
mType = getTypeFromArgument();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xffff) {
mFlowID = home.angle.x;
} else {
+3
View File
@@ -222,6 +222,9 @@ cPhs_Step daNpc_zrC_c::create() {
fopAcM_ct(this, daNpc_zrC_c);
mType = getTypeFromParam();
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xffff) {
mFlowID = home.angle.x;
} else {
+3
View File
@@ -203,6 +203,9 @@ cPhs_Step daNpc_zrZ_c::create() {
mSwitch1 = home.angle.z & 0xff;
mSwitch2 = (home.angle.z >> 8) & 0xff;
mSwitch3 = fopAcM_GetParam(this) >> 0x18;
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always passes.
if (home.angle.x != 0xffff) {
mFlowID = home.angle.x;
} else {
+7 -7
View File
@@ -666,8 +666,8 @@ static void obj_brg_move(obj_brg_class* i_this) {
if ((i_this->mType & 1) == 1) {
i_this->mBr[i].field_0x0e0 = 1.0f;
} else {
var_f27 = ( f32(i) / (i_this->field_0xb1ea - 1)) * M_PI;
i_this->mBr[i].field_0x0e0 = fabsf(sin(var_f27));
var_f27 = ((f32)i / (i_this->field_0xb1ea - 1)) * M_PI;
i_this->mBr[i].field_0x0e0 = fabsf(sinf(var_f27));
}
i_this->mBr[i].field_0x704 = i_this->mBr[i].field_0x705 = 3;
@@ -994,11 +994,11 @@ static int daObj_Brg_Execute(obj_brg_class* i_this) {
f32 dbg_0x5c;
for (int i = 0; i < i_this->field_0xb1ea; i++, part++) {
if (i_this->field_0xb1ed == 2) {
dbg_0x5c = f32(i) / f32(i_this->field_0xb1ea - 1) * M_PI;
var_f26 = (-300.0f + WREG_F(15)) * f32(sin(dbg_0x5c));
dbg_0x5c = (f32)i / (f32)(i_this->field_0xb1ea - 1) * M_PI;
var_f26 = (-300.0f + WREG_F(15)) * (f32)sin(dbg_0x5c);
} else if (i_this->field_0xb1ed == 1) {
dbg_0x5c = f32(i) / f32(i_this->field_0xb1ea - 1) * M_PI;
var_f26 = (-100.0f + WREG_F(13)) * f32(sin(dbg_0x5c));
dbg_0x5c = (f32)i / (f32)(i_this->field_0xb1ea - 1) * M_PI;
var_f26 = (-100.0f + WREG_F(13)) * (f32)sin(dbg_0x5c);
}
MtxTrans(part->field_0x0bc.x, part->field_0x0bc.y, part->field_0x0bc.z, 0);
@@ -1795,7 +1795,7 @@ static int daObj_Brg_Create(fopAc_ac_c* i_this) {
};
for (brno = 0; brno < a_this->field_0xb1ea; brno++) {
a_this->mBr[brno].field_0x098[2] = brg_init_pos[brno];
a_this->mBr[brno].field_0x0b0 = brg_init_pos[brno];
}
}
+4
View File
@@ -333,6 +333,10 @@ void daObjCwall_c::getChainBasePos(cXyz* pBasePos) {
void daObjCwall_c::setChainMtx() {
chain_s* pChain = mChains;
s16 sVar7 = home.angle.y;
// !@bug The variable is promoted to a 32-bit signed integer prior
// to being compared to 0xC000, so the compared value can never
// exceed SHORT_MAX and the subcondition fails.
if (sVar7 == 0x4000 || sVar7 == 0xc000) {
sVar7 += 0x4000;
}
+6 -3
View File
@@ -277,7 +277,10 @@ cPhs_Step daObj_GrA_c::create() {
}
}
field_0x848 = ((int)home.angle.x == 0xFFFF) ? -1 : home.angle.x;
// !@bug home.angle.x is promoted to a 32-bit signed integer prior
// to being compared, so the compared value can never exceed
// SHORT_MAX and the condition always fails.
mFlowID = home.angle.x == 0xFFFF ? -1 : home.angle.x;
field_0x1fe8 = (fopAcM_GetParam(this) & 0xC0000000) >> 30;
field_0xa7f = home.angle.z & 0xFF;
@@ -1435,7 +1438,7 @@ int daObj_GrA_c::talk(void* param_1) {
int iVar1, iVar2;
int rv = 0;
int iVar3;
int iVar4 = field_0x848;
int iVar4 = mFlowID;
s16 sVar1;
switch (field_0xa7c) {
case 0:
@@ -2013,7 +2016,7 @@ int daObj_GrA_c::face999(int param_1) {
}
int daObj_GrA_c::evtcutTalk(int param_1, int param_2) {
s32 sVar1 = field_0x848;
s32 sVar1 = mFlowID;
if (param_2 != 0) {
mMsgFlow.init(this, sVar1, 0, NULL);
field_0xaa0 = 0;
+2 -2
View File
@@ -768,7 +768,7 @@ int daObj_GrA_c::rollDemo(void* param_1) {
field_0x91a.y = current.angle.y;
if (mDemoCamMode >= 5) {
field_0x848 = 4;
mFlowID = 4;
evtcutTalk(-1, 1);
field_0x2000 = 0;
}
@@ -1169,7 +1169,7 @@ int daObj_GrA_c::rollAttacked(void* param_1) {
case 2:
if (mDemoCamMode >= 5) {
field_0x848 = 5;
mFlowID = 5;
evtcutTalk(-1, 1);
field_0x2018 = 3;
}
+1 -1
View File
@@ -947,7 +947,7 @@ void daObjMarm_c::calcHimo() {
getRopeStartPos(&offset1);
getFpartsOffset(&offset2);
fabs(offset1.y - offset2.y);
UNUSED(fabs(offset1.y - offset2.y));
cXyz* line_mat1_pos = mpRope1->getPos(0);
*line_mat1_pos = offset1;

Some files were not shown because too many files have changed in this diff Show More