Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ def MatchingFor(*versions):
Object(NonMatching, "Shiraiwa/JugemGoal.cpp"),
Object(NonMatching, "Shiraiwa/JugemFlag.cpp"),
Object(NonMatching, "Shiraiwa/MapObjWanwan.cpp"),
Object(NonMatching, "Shiraiwa/MapObjWanwanChain.cpp"),
Object(Matching, "Shiraiwa/MapObjWanwanChain.cpp"),
Object(Matching, "Shiraiwa/AnmPlayer.cpp"),
Object(NonMatching, "Shiraiwa/MapObjSkyShip.cpp"),
Object(NonMatching, "Shiraiwa/MapObjDonkyRockGen.cpp"),
Expand Down
6 changes: 3 additions & 3 deletions include/JSystem/JAudio/JAUAudience.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class JAUAudience_withSetting_doppler : public JAUAudience_withSetting {
class JAUAudienceState {
public:
JAUAudienceState() {}
//~JAUDopplerAudienceState() {}
//~JAUAudienceState() {}

void init() {
Mtx m;
Expand All @@ -163,7 +163,7 @@ class JAUAudienceState {
JGeometry::TPos3f m;
mMtx.set(in);
m.setPositionFromLookAt(mMtx);
m.getTransInline(_3c);
m.getTrans(_3c);
_48.set(_3c);
_30.zero();

Expand All @@ -190,7 +190,7 @@ class JAUDopplerAudienceState {
JGeometry::TPos3f m;
mMtx.set(in);
m.setPositionFromLookAt(mMtx);
m.getTransInline(_3c);
m.getTrans(_3c);
_48.set(_3c);
_30.zero();
}
Expand Down
35 changes: 12 additions & 23 deletions include/JSystem/JGeometry/Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ namespace JGeometry {
{
public:
SMatrix34C() {}
void set(const SMatrix34C<T> &rSrc);
void set(const SMatrix34C<T> &rSrc) {
JMath::gekko_ps_copy12(this, rSrc);
}
void set(T rxx, T ryx, T rzx, T tx, T rxy, T ryy, T rzy, T ty, T rxz, T ryz, T rzz, T tz);

void scale(T);
Expand All @@ -23,6 +25,8 @@ namespace JGeometry {
JMath::gekko_ps_copy12(this, pSrc);
}

f32 at(u32 i, u32 j) const { return mMtx[i][j]; }

T &ref(u32 i, u32 j) { return mMtx[i][j]; }

inline Mtx *toMtx()
Expand Down Expand Up @@ -82,26 +86,16 @@ namespace JGeometry {
TRotation3() {}
void identity33();

// TODO: seems fakematch to me but that's a problem for later i guess
inline void getXDir(TVec3f &rDest) const {
f32 z = this->mMtx[2][0];
f32 y = this->mMtx[1][0];
f32 x = this->mMtx[0][0];
rDest.set(x, y, z);
rDest.set(this->at(0, 0), this->at(1, 0), this->at(2, 0));
}

inline void getYDir(TVec3f &rDest) const {
f32 z = this->mMtx[2][1];
f32 y = this->mMtx[1][1];
f32 x = this->mMtx[0][1];
rDest.set(x, y, z);
rDest.set(this->at(0,1), this->at(1, 1), this->at(2, 1));
}

inline void getZDir(TVec3f &rDest) const {
f32 z = this->mMtx[2][2];
f32 y = this->mMtx[1][2];
f32 x = this->mMtx[0][2];
rDest.set(x, y, z);
rDest.set(this->at(0, 2), this->at(1, 2), this->at(2, 2));
}

void getXYZDir(TVec3f &rDestX, TVec3f &rDestY, TVec3f &rDestZ) const;
Expand Down Expand Up @@ -209,9 +203,12 @@ namespace JGeometry {
{
public:
TPosition3() {}


void getTrans(TVec3f &rDest) const {
rDest.set(this->mMtx[0][3], this->mMtx[1][3], this->mMtx[2][3]);
rDest.set(this->at(0, 3), this->at(1, 3), this->at(2, 3));
}

void setTrans(const TVec3f &rSrc);
void setTrans(f32 x, f32 y, f32 z);
void zeroTrans()
Expand Down Expand Up @@ -245,14 +242,6 @@ namespace JGeometry {
this->ref(2, 3) = (rLookAt[0][3] * this->mMtx[2][0]) - (rLookAt[1][3] * this->mMtx[2][1]) + rLookAt[0][3] * this->mMtx[2][2];
}
void setQT(const TQuat4f &rSrcQuat, const TVec3f &rSrcTrans);

inline void getTransInline(TVec3f &rDest) const
{
f32 z = this->mMtx[2][3];
f32 y = this->mMtx[1][3];
f32 x = this->mMtx[0][3];
rDest.set(x, y, z);
}
};

typedef TMatrix34<TSMtxf> TMtx34f;
Expand Down
28 changes: 23 additions & 5 deletions include/JSystem/JGeometry/Vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,20 @@ namespace JGeometry {
return *this;
}

/*TVec3 operator+(const TVec3 &operand)
TVec3 operator-(const TVec3 &operand)
{
TVec3 tmp(*this);
tmp -= operand;
return tmp;
}

TVec3 operator+(const TVec3 &operand)
{
TVec3 tmp(*this);
tmp += operand;
return tmp;
}
*/

TVec3 operator*(f32 scalar) const
{
TVec3 scaled(*this);
Expand Down Expand Up @@ -348,20 +355,31 @@ namespace JGeometry {
return 0.0f;

f32 invsqrt = TUtilf::inv_sqrt(this_squared);
scale(invsqrt);
this->scale(invsqrt);
return invsqrt * this_squared;
}

f32 normalize(f32 scalar) // fabricated
{
f32 this_squared = squared();
if (this_squared <= TUtilf::epsilon())
return 0.0f;

f32 invsqrt = TUtilf::inv_sqrt(this_squared);
this->scale(invsqrt * scalar);
return invsqrt * this_squared;
}

f32 normalize(const TVec3 &other)
{
f32 sq = other.squared();
if (sq <= TUtilf::epsilon()) {
zero();
this->zero();
return 0.0f;
}

f32 invsqrt = TUtilf::inv_sqrt(sq);
scale(invsqrt, other);
this->scale(invsqrt, other);
return invsqrt * sq;
}
};
Expand Down
1 change: 1 addition & 0 deletions include/Kaneshige/Course/CrsGround.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class CrsGround
enum EMat
{
// TODO
Mat_1 = 1,
Mat_255 = 0xff,
};

Expand Down
4 changes: 2 additions & 2 deletions include/Sato/GeographyObj.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class GeographyObj
virtual u32 getJ3DModelDataTevStageNum() const { return 0x20000; } // 50
virtual void createColModel(J3DModelData *); // 54
virtual void createBoundsSphere(J3DModelData *); // 58
virtual GeoAnmTableEntry *getAnmTbl() { return nullptr; } // 5C
virtual GeoAnmTableEntry *getAnmTbl() { return nullptr; } // 5C
virtual u16 getSizeAnmTbl() { return 0; } // 60
virtual GeoObjSupervisor *getSupervisor() { return nullptr; } // 64
virtual void getItemThrowDirPow(JGeometry::TVec3f *, f32 *, const ItemObj &); // 68
Expand Down Expand Up @@ -314,7 +314,7 @@ class TMapObjHioNode : public GeographyObj
public:
TMapObjHioNode(u32 id) : GeographyObj(id) {}
TMapObjHioNode(const CrsData::SObject &rObj) : GeographyObj(rObj) {}
virtual ~TMapObjHioNode();
virtual ~TMapObjHioNode() {}
};

#endif
1 change: 1 addition & 0 deletions include/Sato/ItemObj.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ class ItemObj
int get_1fc() const { return _1fc; }

const JGeometry::TVec3f &getPos() const { return mPos; }
const JGeometry::TVec3f &getVel() const { return mVel; }
const JGeometry::TVec3f getColPos() const { return mColPos; }
ItemObjSuc *getSuccessionParent() const { return mSuccessionParent; }

Expand Down
44 changes: 39 additions & 5 deletions include/Sato/J3DAnmObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
#define SATO_J3DANMOBJECT_H

#include "JSystem/J3D/J3DAnmBase.h"
#include "JSystem/J3D/J3DAnmCluster.h"
#include "JSystem/J3D/J3DAnmColor.h"
#include "JSystem/J3D/J3DAnmTransform.h"
#include "JSystem/J3D/J3DFrameCtrl.h"
#include "JSystem/J3D/J3DModel.h"
#include "JSystem/J3D/J3DMtxCalc.h"
#include "JSystem/J3D/J3DSkinDeform.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "Kaneshige/ExModel.h"
#include "types.h"

class J3DAnmObjBase
{
Expand All @@ -19,15 +22,15 @@ class J3DAnmObjBase
void frameProc() { mFrameCtrl.update(); }
void update() { mFrameCtrl.update(); }
void resetFrame() { mFrameCtrl.reset(); }

void initFrameCtrl() {
initFrameCtrl(mAnmBase);
}

J3DFrameCtrl *getFrameCtrl() { return &mFrameCtrl; }
f32 getFrame() const { return mFrameCtrl.getFrame(); }
f32 getRate() const { return mFrameCtrl.getRate(); }

void setExModel(ExModel *model) { mModel = model; }
void setRate(const float &rate) { mFrameCtrl.setRate(rate); }
void setFrame(float frame) { mFrameCtrl.setFrame(frame); }
void stop() { mFrameCtrl.stop(); }

J3DModelData *getModelData() { return mModel->getModelData(); }

Expand All @@ -36,9 +39,40 @@ class J3DAnmObjBase

ExModel *mModel; // 04
J3DFrameCtrl mFrameCtrl; // 08

// TODO: does this belong here or in J3DAnmObjMaterial? it doesn't make much sense to be here but it does fix offsets for all classes that inherit J3DAnmObjBase
J3DAnmBase *mAnmBase; // 1c
}; // Size: 0x20

class J3DAnmObjCluster : public J3DAnmObjBase {
public:
J3DAnmObjCluster() {
mDeformData = nullptr;
}
virtual ~J3DAnmObjCluster() {}
virtual void anmFrameProc();

void attach(J3DAnmCluster *);

static void loadClusterAnmData(J3DAnmCluster **, void *);
static void loadClusterData(J3DDeformData * *, void *);
static void setDeformData(ExModel *, J3DDeformData *, bool);

void setExModel(ExModel *mdl, J3DDeformData *deformData) {
mModel = mdl;
mDeformData = deformData;
}

void update() {
mDeformData->setAnm((J3DAnmCluster*)mAnmBase);
mFrameCtrl.update();
anmFrameProc();
}

private:
J3DDeformData *mDeformData;
};

class J3DAnmObjMaterial : public J3DAnmObjBase
{
public:
Expand All @@ -54,7 +88,7 @@ class J3DAnmObjMaterial : public J3DAnmObjBase
template <typename T>
void attach(T *anm) {
mAnmBase = anm;
initFrameCtrl(mAnmBase);
J3DAnmObjBase::initFrameCtrl(mAnmBase);
}

J3DAnmBase *getAnmBase() { return mAnmBase; }
Expand Down
3 changes: 2 additions & 1 deletion include/Sato/ObjCollision.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class ObjColBase

u8 IsHitBoundPos(JGeometry::TVec3f, JGeometry::TVec3f);

void setRadius(f32 rad) { mRadius = rad; }
void setRadius(const f32 rad) { mRadius = rad; }
void scaleRadius(const f32 scale) { mRadius = scale * mRadius; }
void setScale(f32 scale) { mScale = scale; }

f32 getRadius() const { return mRadius; }
Expand Down
27 changes: 24 additions & 3 deletions include/Shiraiwa/Coord3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#include "JSystem/JGeometry/Quat.h"
#include "JSystem/JGeometry/Vec.h"
#include "Kaneshige/Course/CrsData.h"
#include "macros.h"

class TFreeMove {
public:
TFreeMove();
virtual ~TFreeMove() {}
void init(JGeometry::TVec3f *, JGeometry::TVec3f *, f32);
Expand All @@ -24,6 +26,23 @@ class TFreeMove {
void initStart();
void setTargetPosUniform(const JGeometry::TVec3f &, int);
void fixCurPosition();

bool hasTarget() const {
return _18;
}

void releaseTarget() { // not sure what to name this
_18 = false;
}

private:
JGeometry::TVec3f mTagret;
JGeometry::TVec3f *mpPos;
JGeometry::TVec3f *mpVel;
bool _18;
f32 _1c;
f32 _20;
f32 _24;
};

class TPathMove {
Expand All @@ -46,12 +65,14 @@ class TPathMove {
void getNodeDir(u16, JGeometry::TVec3f *);

protected:

const CrsData::SObject *mpObj; // 04
short _8; //
s16 _8; //
JGeometry::TVec3f *mpPos; // 0c
JGeometry::TVec3f *mpVel; // 10

f32 _14;
f32 _18;
bool _1c;
PLACEHOLDER_BYTES(0x1d, 0x24);
}; // Size: 0x24

class TFreeRotate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Sato/GeographyObj.h"
#include "Sato/StateObserver.h"
#include "Sato/Objects/GeoItemBox.h"
#include "Shiraiwa/MapObjDemoObj.h"
#include "Shiraiwa/Objects/MapObjDemoObj.h"

// Inline/Unused
//void JSULink<TMapObjAwardItemBox>::~JSULink();
Expand Down
File renamed without changes.
Loading