Skip to content

Commit 03b7ccb

Browse files
authored
Merge pull request #33 from doldecomp/MapObjWanWan
Match the majority of MapObjWanWan
2 parents 65db312 + 75fb3cd commit 03b7ccb

25 files changed

Lines changed: 1104 additions & 56 deletions

configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ def MatchingFor(*versions):
13561356
Object(NonMatching, "Shiraiwa/JugemGoal.cpp"),
13571357
Object(NonMatching, "Shiraiwa/JugemFlag.cpp"),
13581358
Object(NonMatching, "Shiraiwa/MapObjWanwan.cpp"),
1359-
Object(NonMatching, "Shiraiwa/MapObjWanwanChain.cpp"),
1359+
Object(Matching, "Shiraiwa/MapObjWanwanChain.cpp"),
13601360
Object(Matching, "Shiraiwa/AnmPlayer.cpp"),
13611361
Object(NonMatching, "Shiraiwa/MapObjSkyShip.cpp"),
13621362
Object(NonMatching, "Shiraiwa/MapObjDonkyRockGen.cpp"),

include/JSystem/JAudio/JAUAudience.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class JAUAudience_withSetting_doppler : public JAUAudience_withSetting {
152152
class JAUAudienceState {
153153
public:
154154
JAUAudienceState() {}
155-
//~JAUDopplerAudienceState() {}
155+
//~JAUAudienceState() {}
156156

157157
void init() {
158158
Mtx m;
@@ -163,7 +163,7 @@ class JAUAudienceState {
163163
JGeometry::TPos3f m;
164164
mMtx.set(in);
165165
m.setPositionFromLookAt(mMtx);
166-
m.getTransInline(_3c);
166+
m.getTrans(_3c);
167167
_48.set(_3c);
168168
_30.zero();
169169

@@ -190,7 +190,7 @@ class JAUDopplerAudienceState {
190190
JGeometry::TPos3f m;
191191
mMtx.set(in);
192192
m.setPositionFromLookAt(mMtx);
193-
m.getTransInline(_3c);
193+
m.getTrans(_3c);
194194
_48.set(_3c);
195195
_30.zero();
196196
}

include/JSystem/JGeometry/Matrix.h

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ namespace JGeometry {
1313
{
1414
public:
1515
SMatrix34C() {}
16-
void set(const SMatrix34C<T> &rSrc);
16+
void set(const SMatrix34C<T> &rSrc) {
17+
JMath::gekko_ps_copy12(this, rSrc);
18+
}
1719
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);
1820

1921
void scale(T);
@@ -23,6 +25,8 @@ namespace JGeometry {
2325
JMath::gekko_ps_copy12(this, pSrc);
2426
}
2527

28+
f32 at(u32 i, u32 j) const { return mMtx[i][j]; }
29+
2630
T &ref(u32 i, u32 j) { return mMtx[i][j]; }
2731

2832
inline Mtx *toMtx()
@@ -82,26 +86,16 @@ namespace JGeometry {
8286
TRotation3() {}
8387
void identity33();
8488

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

9393
inline void getYDir(TVec3f &rDest) const {
94-
f32 z = this->mMtx[2][1];
95-
f32 y = this->mMtx[1][1];
96-
f32 x = this->mMtx[0][1];
97-
rDest.set(x, y, z);
94+
rDest.set(this->at(0,1), this->at(1, 1), this->at(2, 1));
9895
}
9996

10097
inline void getZDir(TVec3f &rDest) const {
101-
f32 z = this->mMtx[2][2];
102-
f32 y = this->mMtx[1][2];
103-
f32 x = this->mMtx[0][2];
104-
rDest.set(x, y, z);
98+
rDest.set(this->at(0, 2), this->at(1, 2), this->at(2, 2));
10599
}
106100

107101
void getXYZDir(TVec3f &rDestX, TVec3f &rDestY, TVec3f &rDestZ) const;
@@ -209,9 +203,12 @@ namespace JGeometry {
209203
{
210204
public:
211205
TPosition3() {}
206+
207+
212208
void getTrans(TVec3f &rDest) const {
213-
rDest.set(this->mMtx[0][3], this->mMtx[1][3], this->mMtx[2][3]);
209+
rDest.set(this->at(0, 3), this->at(1, 3), this->at(2, 3));
214210
}
211+
215212
void setTrans(const TVec3f &rSrc);
216213
void setTrans(f32 x, f32 y, f32 z);
217214
void zeroTrans()
@@ -245,14 +242,6 @@ namespace JGeometry {
245242
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];
246243
}
247244
void setQT(const TQuat4f &rSrcQuat, const TVec3f &rSrcTrans);
248-
249-
inline void getTransInline(TVec3f &rDest) const
250-
{
251-
f32 z = this->mMtx[2][3];
252-
f32 y = this->mMtx[1][3];
253-
f32 x = this->mMtx[0][3];
254-
rDest.set(x, y, z);
255-
}
256245
};
257246

258247
typedef TMatrix34<TSMtxf> TMtx34f;

include/JSystem/JGeometry/Vec.h

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,20 @@ namespace JGeometry {
261261
return *this;
262262
}
263263

264-
/*TVec3 operator+(const TVec3 &operand)
264+
TVec3 operator-(const TVec3 &operand)
265+
{
266+
TVec3 tmp(*this);
267+
tmp -= operand;
268+
return tmp;
269+
}
270+
271+
TVec3 operator+(const TVec3 &operand)
265272
{
266273
TVec3 tmp(*this);
267274
tmp += operand;
268275
return tmp;
269276
}
270-
*/
277+
271278
TVec3 operator*(f32 scalar) const
272279
{
273280
TVec3 scaled(*this);
@@ -348,20 +355,31 @@ namespace JGeometry {
348355
return 0.0f;
349356

350357
f32 invsqrt = TUtilf::inv_sqrt(this_squared);
351-
scale(invsqrt);
358+
this->scale(invsqrt);
359+
return invsqrt * this_squared;
360+
}
361+
362+
f32 normalize(f32 scalar) // fabricated
363+
{
364+
f32 this_squared = squared();
365+
if (this_squared <= TUtilf::epsilon())
366+
return 0.0f;
367+
368+
f32 invsqrt = TUtilf::inv_sqrt(this_squared);
369+
this->scale(invsqrt * scalar);
352370
return invsqrt * this_squared;
353371
}
354372

355373
f32 normalize(const TVec3 &other)
356374
{
357375
f32 sq = other.squared();
358376
if (sq <= TUtilf::epsilon()) {
359-
zero();
377+
this->zero();
360378
return 0.0f;
361379
}
362380

363381
f32 invsqrt = TUtilf::inv_sqrt(sq);
364-
scale(invsqrt, other);
382+
this->scale(invsqrt, other);
365383
return invsqrt * sq;
366384
}
367385
};

include/Kaneshige/Course/CrsGround.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class CrsGround
4343
enum EMat
4444
{
4545
// TODO
46+
Mat_1 = 1,
4647
Mat_255 = 0xff,
4748
};
4849

include/Sato/GeographyObj.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class GeographyObj
229229
virtual u32 getJ3DModelDataTevStageNum() const { return 0x20000; } // 50
230230
virtual void createColModel(J3DModelData *); // 54
231231
virtual void createBoundsSphere(J3DModelData *); // 58
232-
virtual GeoAnmTableEntry *getAnmTbl() { return nullptr; } // 5C
232+
virtual GeoAnmTableEntry *getAnmTbl() { return nullptr; } // 5C
233233
virtual u16 getSizeAnmTbl() { return 0; } // 60
234234
virtual GeoObjSupervisor *getSupervisor() { return nullptr; } // 64
235235
virtual void getItemThrowDirPow(JGeometry::TVec3f *, f32 *, const ItemObj &); // 68
@@ -314,7 +314,7 @@ class TMapObjHioNode : public GeographyObj
314314
public:
315315
TMapObjHioNode(u32 id) : GeographyObj(id) {}
316316
TMapObjHioNode(const CrsData::SObject &rObj) : GeographyObj(rObj) {}
317-
virtual ~TMapObjHioNode();
317+
virtual ~TMapObjHioNode() {}
318318
};
319319

320320
#endif

include/Sato/ItemObj.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ class ItemObj
289289
int get_1fc() const { return _1fc; }
290290

291291
const JGeometry::TVec3f &getPos() const { return mPos; }
292+
const JGeometry::TVec3f &getVel() const { return mVel; }
292293
const JGeometry::TVec3f getColPos() const { return mColPos; }
293294
ItemObjSuc *getSuccessionParent() const { return mSuccessionParent; }
294295

include/Sato/J3DAnmObject.h

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22
#define SATO_J3DANMOBJECT_H
33

44
#include "JSystem/J3D/J3DAnmBase.h"
5+
#include "JSystem/J3D/J3DAnmCluster.h"
56
#include "JSystem/J3D/J3DAnmColor.h"
67
#include "JSystem/J3D/J3DAnmTransform.h"
78
#include "JSystem/J3D/J3DFrameCtrl.h"
89
#include "JSystem/J3D/J3DModel.h"
910
#include "JSystem/J3D/J3DMtxCalc.h"
11+
#include "JSystem/J3D/J3DSkinDeform.h"
1012
#include "JSystem/JUtility/JUTAssert.h"
1113
#include "Kaneshige/ExModel.h"
14+
#include "types.h"
1215

1316
class J3DAnmObjBase
1417
{
@@ -19,15 +22,15 @@ class J3DAnmObjBase
1922
void frameProc() { mFrameCtrl.update(); }
2023
void update() { mFrameCtrl.update(); }
2124
void resetFrame() { mFrameCtrl.reset(); }
22-
23-
void initFrameCtrl() {
24-
initFrameCtrl(mAnmBase);
25-
}
2625

2726
J3DFrameCtrl *getFrameCtrl() { return &mFrameCtrl; }
27+
f32 getFrame() const { return mFrameCtrl.getFrame(); }
28+
f32 getRate() const { return mFrameCtrl.getRate(); }
29+
2830
void setExModel(ExModel *model) { mModel = model; }
2931
void setRate(const float &rate) { mFrameCtrl.setRate(rate); }
3032
void setFrame(float frame) { mFrameCtrl.setFrame(frame); }
33+
void stop() { mFrameCtrl.stop(); }
3134

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

@@ -36,9 +39,40 @@ class J3DAnmObjBase
3639

3740
ExModel *mModel; // 04
3841
J3DFrameCtrl mFrameCtrl; // 08
42+
43+
// 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
3944
J3DAnmBase *mAnmBase; // 1c
4045
}; // Size: 0x20
4146

47+
class J3DAnmObjCluster : public J3DAnmObjBase {
48+
public:
49+
J3DAnmObjCluster() {
50+
mDeformData = nullptr;
51+
}
52+
virtual ~J3DAnmObjCluster() {}
53+
virtual void anmFrameProc();
54+
55+
void attach(J3DAnmCluster *);
56+
57+
static void loadClusterAnmData(J3DAnmCluster **, void *);
58+
static void loadClusterData(J3DDeformData * *, void *);
59+
static void setDeformData(ExModel *, J3DDeformData *, bool);
60+
61+
void setExModel(ExModel *mdl, J3DDeformData *deformData) {
62+
mModel = mdl;
63+
mDeformData = deformData;
64+
}
65+
66+
void update() {
67+
mDeformData->setAnm((J3DAnmCluster*)mAnmBase);
68+
mFrameCtrl.update();
69+
anmFrameProc();
70+
}
71+
72+
private:
73+
J3DDeformData *mDeformData;
74+
};
75+
4276
class J3DAnmObjMaterial : public J3DAnmObjBase
4377
{
4478
public:
@@ -54,7 +88,7 @@ class J3DAnmObjMaterial : public J3DAnmObjBase
5488
template <typename T>
5589
void attach(T *anm) {
5690
mAnmBase = anm;
57-
initFrameCtrl(mAnmBase);
91+
J3DAnmObjBase::initFrameCtrl(mAnmBase);
5892
}
5993

6094
J3DAnmBase *getAnmBase() { return mAnmBase; }

include/Sato/ObjCollision.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class ObjColBase
3333

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

36-
void setRadius(f32 rad) { mRadius = rad; }
36+
void setRadius(const f32 rad) { mRadius = rad; }
37+
void scaleRadius(const f32 scale) { mRadius = scale * mRadius; }
3738
void setScale(f32 scale) { mScale = scale; }
3839

3940
f32 getRadius() const { return mRadius; }

include/Shiraiwa/Coord3D.h

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
#include "JSystem/JGeometry/Quat.h"
77
#include "JSystem/JGeometry/Vec.h"
88
#include "Kaneshige/Course/CrsData.h"
9+
#include "macros.h"
910

1011
class TFreeMove {
12+
public:
1113
TFreeMove();
1214
virtual ~TFreeMove() {}
1315
void init(JGeometry::TVec3f *, JGeometry::TVec3f *, f32);
@@ -24,6 +26,23 @@ class TFreeMove {
2426
void initStart();
2527
void setTargetPosUniform(const JGeometry::TVec3f &, int);
2628
void fixCurPosition();
29+
30+
bool hasTarget() const {
31+
return _18;
32+
}
33+
34+
void releaseTarget() { // not sure what to name this
35+
_18 = false;
36+
}
37+
38+
private:
39+
JGeometry::TVec3f mTagret;
40+
JGeometry::TVec3f *mpPos;
41+
JGeometry::TVec3f *mpVel;
42+
bool _18;
43+
f32 _1c;
44+
f32 _20;
45+
f32 _24;
2746
};
2847

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

4867
protected:
49-
5068
const CrsData::SObject *mpObj; // 04
51-
short _8; //
69+
s16 _8; //
5270
JGeometry::TVec3f *mpPos; // 0c
5371
JGeometry::TVec3f *mpVel; // 10
54-
72+
f32 _14;
73+
f32 _18;
74+
bool _1c;
75+
PLACEHOLDER_BYTES(0x1d, 0x24);
5576
}; // Size: 0x24
5677

5778
class TFreeRotate {

0 commit comments

Comments
 (0)