diff --git a/include/JSystem/J3DGraphAnimator/J3DJoint.h b/include/JSystem/J3DGraphAnimator/J3DJoint.h index 4e2072325..ca6504e0f 100644 --- a/include/JSystem/J3DGraphAnimator/J3DJoint.h +++ b/include/JSystem/J3DGraphAnimator/J3DJoint.h @@ -120,7 +120,7 @@ public: u32 getType() const { return 'NJNT'; } void recursiveCalc(); - J3DJoint(); + J3DJoint() { initialize(); } ~J3DJoint() {} J3DMaterial* getMesh() { return mMesh; } @@ -148,7 +148,7 @@ private: /* 0x1A */ u8 mKind; /* 0x1B */ u8 mScaleCompensate; /* 0x1C */ J3DTransformInfo mTransformInfo; - /* 0x3C */ f32 mBoundingSphereRadius; + /* 0x3C */ f32 mRadius; /* 0x40 */ Vec mMin; /* 0x4C */ Vec mMax; /* 0x58 */ J3DMtxCalc* mMtxCalc; diff --git a/include/JSystem/J3DGraphLoader/J3DJointFactory.h b/include/JSystem/J3DGraphLoader/J3DJointFactory.h index cd90b029c..0b2d0c024 100644 --- a/include/JSystem/J3DGraphLoader/J3DJointFactory.h +++ b/include/JSystem/J3DGraphLoader/J3DJointFactory.h @@ -32,8 +32,8 @@ struct J3DJointFactory { J3DJointFactory(J3DJointBlock const&); J3DJoint* create(int); - J3DJointInitData* mJointInitData; - u16* mIndexTable; + /* 0x0 */ J3DJointInitData* mJointInitData; + /* 0x4 */ u16* mIndexTable; u16 getKind(int no) const { return mJointInitData[mIndexTable[no]].mKind; } u8 getScaleCompensate(int no) const { return mJointInitData[mIndexTable[no]].mScaleCompensate; } diff --git a/src/JSystem/J3DGraphAnimator/J3DJoint.cpp b/src/JSystem/J3DGraphAnimator/J3DJoint.cpp index cf415bf5e..1d4201af2 100644 --- a/src/JSystem/J3DGraphAnimator/J3DJoint.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DJoint.cpp @@ -201,7 +201,7 @@ void J3DJoint::initialize() { mKind = 1; mScaleCompensate = 0; mTransformInfo = j3dDefaultTransformInfo; - mBoundingSphereRadius = 0.0f; + mRadius = 0.0f; mMin = (Vec){0.0f, 0.0f, 0.0f}; mMax = (Vec){0.0f, 0.0f, 0.0f}; mMtxCalc = NULL; diff --git a/src/JSystem/J3DGraphLoader/J3DJointFactory.cpp b/src/JSystem/J3DGraphLoader/J3DJointFactory.cpp index 3d67ad888..528e9d59f 100644 --- a/src/JSystem/J3DGraphLoader/J3DJointFactory.cpp +++ b/src/JSystem/J3DGraphLoader/J3DJointFactory.cpp @@ -4,19 +4,30 @@ // #include "JSystem/J3DGraphLoader/J3DJointFactory.h" -#include "dolphin/types.h" +#include "JSystem/JSupport/JSupport.h" +#include "JSystem/J3DGraphAnimator/J3DJoint.h" /* 802FE1A4-802FE1FC .text __ct__15J3DJointFactoryFRC13J3DJointBlock */ -J3DJointFactory::J3DJointFactory(const J3DJointBlock&) { +J3DJointFactory::J3DJointFactory(const J3DJointBlock& jointBlock) { /* Nonmatching */ + mJointInitData = JSUConvertOffsetToPtr(&jointBlock, jointBlock.mJointInitData); + mIndexTable = JSUConvertOffsetToPtr(&jointBlock, jointBlock.mIndexTable); } /* 802FE1FC-802FE390 .text create__15J3DJointFactoryFi */ -void J3DJointFactory::create(int) { - /* Nonmatching */ -} - -/* 802FE390-802FE3A8 .text JSUConvertOffsetToPtr<16J3DJointInitData>__FPCvUl */ -void JSUConvertOffsetToPtr(const void*, unsigned long) { - /* Nonmatching */ +J3DJoint* J3DJointFactory::create(int jntNo) { + J3DJoint* joint = new J3DJoint(); + joint->mJntNo = jntNo; + joint->mKind = mJointInitData[mIndexTable[jntNo]].mKind; + joint->mScaleCompensate = mJointInitData[mIndexTable[jntNo]].mScaleCompensate; + joint->mTransformInfo = mJointInitData[mIndexTable[jntNo]].mTransformInfo; + joint->mRadius = mJointInitData[mIndexTable[jntNo]].mRadius; + joint->mMin = mJointInitData[mIndexTable[jntNo]].mMin; + joint->mMax = mJointInitData[mIndexTable[jntNo]].mMax; + joint->mMtxCalc = NULL; + joint->mOldMtxCalc = NULL; + if (joint->mScaleCompensate == 0xFF) { + joint->mScaleCompensate = false; + } + return joint; }