diff --git a/configure.py b/configure.py index 6ed56d6d916..e11d5effb7f 100644 --- a/configure.py +++ b/configure.py @@ -988,10 +988,10 @@ def JSystemLib(lib_name, objects, progress_category="third_party"): [ Object(Matching, "JSystem/J3DGraphAnimator/J3DShapeTable.cpp"), Object(Matching, "JSystem/J3DGraphAnimator/J3DJointTree.cpp"), - Object(NonMatching, "JSystem/J3DGraphAnimator/J3DModelData.cpp"), + Object(Equivalent, "JSystem/J3DGraphAnimator/J3DModelData.cpp"), Object(NonMatching, "JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp"), - Object(NonMatching, "JSystem/J3DGraphAnimator/J3DModel.cpp"), - Object(NonMatching, "JSystem/J3DGraphAnimator/J3DAnimation.cpp"), + Object(Matching, "JSystem/J3DGraphAnimator/J3DModel.cpp"), + Object(Equivalent, "JSystem/J3DGraphAnimator/J3DAnimation.cpp"), Object(Matching, "JSystem/J3DGraphAnimator/J3DMaterialAnm.cpp"), Object(NonMatching, "JSystem/J3DGraphAnimator/J3DSkinDeform.cpp"), Object(NonMatching, "JSystem/J3DGraphAnimator/J3DCluster.cpp"), @@ -1005,7 +1005,7 @@ def JSystemLib(lib_name, objects, progress_category="third_party"): Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory.cpp"), Object(NonMatching, "JSystem/J3DGraphLoader/J3DMaterialFactory_v21.cpp"), Object(NonMatching, "JSystem/J3DGraphLoader/J3DClusterLoader.cpp"), - Object(NonMatching, "JSystem/J3DGraphLoader/J3DModelLoader.cpp"), + Object(Equivalent, "JSystem/J3DGraphLoader/J3DModelLoader.cpp"), Object(NonMatching, "JSystem/J3DGraphLoader/J3DModelLoaderCalcSize.cpp"), Object(NonMatching, "JSystem/J3DGraphLoader/J3DJointFactory.cpp"), Object(NonMatching, "JSystem/J3DGraphLoader/J3DShapeFactory.cpp"), diff --git a/include/JSystem/J2DGraph/J2DAnimation.h b/include/JSystem/J2DGraph/J2DAnimation.h index 8f37c4c7af3..a4bd2fb07df 100644 --- a/include/JSystem/J2DGraph/J2DAnimation.h +++ b/include/JSystem/J2DGraph/J2DAnimation.h @@ -1,6 +1,7 @@ #ifndef J2DANIMATION_H #define J2DANIMATION_H +#include "JSystem/JMath/JMath.h" #include "JSystem/J3DGraphAnimator/J3DAnimation.h" typedef struct _GXColor GXColor; @@ -468,37 +469,6 @@ class J2DAnmColorFull : public J2DAnmColor { template inline f32 J2DHermiteInterpolation(f32, T*, T*, T*, T*, T*, T*); -inline f32 JMAHermiteInterpolation(register f32 p1, register f32 p2, register f32 p3, - register f32 p4, register f32 p5, register f32 p6, - register f32 p7) { - register f32 ff25; - register f32 ff31; - register f32 ff30; - register f32 ff29; - register f32 ff28; - register f32 ff27; - register f32 ff26; - // clang-format off - asm { - fsubs ff31, p1, p2 - fsubs ff30, p5, p2 - fdivs ff29, ff31, ff30 - fmuls ff28,ff29,ff29 - fadds ff25,ff29,ff29 - fsubs ff27,ff28,ff29 - fsubs ff30, p3, p6 - fmsubs ff26,ff25,ff27,ff28 - fmadds ff25,p4,ff27,p4 - fmadds ff26,ff26,ff30,p3 - fmadds ff25,p7,ff27,ff25 - fmsubs ff25,ff29,p4,ff25 - fnmsubs ff25,ff31,ff25,ff26 - - } - // clang-format on - return ff25; -} - template <> inline f32 J2DHermiteInterpolation(f32 f1, f32* f2, f32* f3, f32* f4, f32* f5, f32* f6, f32* f7) { diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index 4cfa7cfab3f..fa1c4e66b7d 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -464,7 +464,7 @@ class J3DAnmBase { mFrame = 0.0f; } - virtual ~J3DAnmBase(); + virtual ~J3DAnmBase() {} virtual s32 getKind() const = 0; u8 getAttribute() const { return mAttribute; } @@ -486,7 +486,7 @@ class J3DAnmTransform : public J3DAnmBase { public: /* 80328E40 */ J3DAnmTransform(s16, f32*, s16*, f32*); - /* 8003B93C */ virtual ~J3DAnmTransform(); + /* 8003B93C */ virtual ~J3DAnmTransform() {} /* 8003C77C */ virtual s32 getKind() const; virtual void getTransform(u16, J3DTransformInfo*) const = 0; @@ -528,8 +528,8 @@ class J3DAnmTransformFull : public J3DAnmTransform { public: J3DAnmTransformFull() : J3DAnmTransform(0, NULL, NULL, NULL) { mAnmTable = NULL; } - /* 8032C2AC */ virtual ~J3DAnmTransformFull(); - /* 8032C318 */ virtual s32 getKind() const; + /* 8032C2AC */ virtual ~J3DAnmTransformFull() {} + /* 8032C318 */ virtual s32 getKind() const { return 9; } /* 80328E90 */ virtual void getTransform(u16, J3DTransformInfo*) const; /* 0x20 */ J3DAnmTransformFullTable* mAnmTable; @@ -541,8 +541,8 @@ class J3DAnmTransformFull : public J3DAnmTransform { */ class J3DAnmTransformFullWithLerp : public J3DAnmTransformFull { public: - /* 8032C228 */ virtual ~J3DAnmTransformFullWithLerp(); - /* 8032C2A4 */ virtual s32 getKind() const; + /* 8032C228 */ virtual ~J3DAnmTransformFullWithLerp() {} + /* 8032C2A4 */ virtual s32 getKind() const { return 16; } /* 803291F0 */ virtual void getTransform(u16, J3DTransformInfo*) const; }; // Size: 0x24 @@ -561,8 +561,8 @@ class J3DAnmTextureSRTKey : public J3DAnmBase { /* 8032B0C0 */ void searchUpdateMaterialID(J3DMaterialTable*); /* 8032B1D4 */ void searchUpdateMaterialID(J3DModelData*); - /* 8032C198 */ virtual ~J3DAnmTextureSRTKey(); - /* 8032C220 */ virtual s32 getKind() const; + /* 8032C198 */ virtual ~J3DAnmTextureSRTKey() {} + /* 8032C220 */ virtual s32 getKind() const { return 4; } void getTransform(u16 param_0, J3DTextureSRTInfo* pSRTInfo) const { calcTransform(getFrame(), param_0, pSRTInfo); @@ -615,8 +615,8 @@ class J3DAnmTexPattern : public J3DAnmBase { /* 8032B004 */ void searchUpdateMaterialID(J3DMaterialTable*); /* 8032B09C */ void searchUpdateMaterialID(J3DModelData*); - /* 8032BD20 */ virtual ~J3DAnmTexPattern(); - /* 8032BD94 */ virtual s32 getKind() const; + /* 8032BD20 */ virtual ~J3DAnmTexPattern() {} + /* 8032BD94 */ virtual s32 getKind() const { return 2; } u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; } u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; } @@ -643,8 +643,8 @@ class J3DAnmTevRegKey : public J3DAnmBase { /* 8032B780 */ void searchUpdateMaterialID(J3DMaterialTable*); /* 8032B87C */ void searchUpdateMaterialID(J3DModelData*); - /* 8032BD9C */ virtual ~J3DAnmTevRegKey(); - /* 8032BE24 */ virtual s32 getKind() const; + /* 8032BD9C */ virtual ~J3DAnmTevRegKey() {} + /* 8032BE24 */ virtual s32 getKind() const { return 5; } u16 getCRegUpdateMaterialNum() const { return mCRegUpdateMaterialNum; } u16 getKRegUpdateMaterialNum() const { return mKRegUpdateMaterialNum; } @@ -693,9 +693,9 @@ class J3DAnmColor : public J3DAnmBase { /* 8032A828 */ J3DAnmColor(); /* 8032A8A4 */ void searchUpdateMaterialID(J3DMaterialTable*); - /* 8032BCAC */ virtual ~J3DAnmColor(); - /* 8032BF44 */ virtual s32 getKind() const; - /* 8032BF4C */ virtual void getColor(u16, _GXColor*) const; + /* 8032BCAC */ virtual ~J3DAnmColor() {} + /* 8032BF44 */ virtual s32 getKind() const { return 1; } + /* 8032BF4C */ virtual void getColor(u16, GXColor*) const {} u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; } bool isValidUpdateMaterialID(u16 id) const { return mUpdateMaterialID[id] != 0xFFFF; } @@ -718,15 +718,15 @@ class J3DAnmColorKey : public J3DAnmColor { public: /* 8032AB00 */ J3DAnmColorKey(); - /* 8032BE2C */ virtual ~J3DAnmColorKey(); - /* 8032BEB0 */ virtual s32 getKind() const; - /* 8032AB54 */ virtual void getColor(u16, _GXColor*) const; + /* 8032BE2C */ virtual ~J3DAnmColorKey() {} + /* 8032BEB0 */ virtual s32 getKind() const { return 11; } + /* 8032AB54 */ virtual void getColor(u16, GXColor*) const; - /* 0x2C */ s16* field_0x2c; - /* 0x30 */ s16* field_0x30; - /* 0x34 */ s16* field_0x34; - /* 0x38 */ s16* field_0x38; - /* 0x3C */ J3DAnmColorKeyTable* field_0x3c; + /* 0x2C */ s16* mColorR; + /* 0x30 */ s16* mColorG; + /* 0x34 */ s16* mColorB; + /* 0x38 */ s16* mColorA; + /* 0x3C */ J3DAnmColorKeyTable* mAnmTable; }; /** @@ -737,9 +737,9 @@ class J3DAnmColorFull : public J3DAnmColor { public: /* 8032AB00 */ J3DAnmColorFull(); - /* 8032BE2C */ virtual ~J3DAnmColorFull(); - /* 8032BEB0 */ virtual s32 getKind() const; - /* 8032AB54 */ virtual void getColor(u16, _GXColor*) const; + /* 8032BE2C */ virtual ~J3DAnmColorFull() {} + /* 8032BEB0 */ virtual s32 getKind() const { return 10; } + /* 8032AB54 */ virtual void getColor(u16, GXColor*) const; /* 0x2C */ u8* mColorR; /* 0x30 */ u8* mColorG; @@ -756,9 +756,9 @@ class J3DAnmVtxColor : public J3DAnmBase { public: J3DAnmVtxColor(); - virtual ~J3DAnmVtxColor(); - virtual s32 getKind() const; - virtual void getColor(u8, u16, _GXColor*) const; + virtual ~J3DAnmVtxColor() {} + virtual s32 getKind() const { return 7; } + virtual void getColor(u8, u16, GXColor*) const {} /* 0x0C */ u16 mAnmTableNum[2]; /* 0x10 */ J3DAnmVtxColorIndexData* mAnmVtxColorIndexData[2]; @@ -772,15 +772,15 @@ class J3DAnmVtxColorKey : public J3DAnmVtxColor { public: /* 8032A4E0 */ J3DAnmVtxColorKey(); - /* 8032BF50 */ virtual ~J3DAnmVtxColorKey(); - /* 8032BFBC */ virtual s32 getKind() const; - /* 8032A53C */ virtual void getColor(u8, u16, _GXColor*) const; + /* 8032BF50 */ virtual ~J3DAnmVtxColorKey() {} + /* 8032BFBC */ virtual s32 getKind() const { return 15; } + /* 8032A53C */ virtual void getColor(u8, u16, GXColor*) const; - /* 0x1C */ J3DAnmColorKeyTable* mpTable[2]; - /* 0x24 */ s16* mColorR; - /* 0x28 */ s16* mColorG; - /* 0x2C */ s16* mColorB; - /* 0x30 */ s16* mColorA; + /* 0x18 */ J3DAnmColorKeyTable* mpTable[2]; + /* 0x20 */ s16* mColorR; + /* 0x24 */ s16* mColorG; + /* 0x28 */ s16* mColorB; + /* 0x2C */ s16* mColorA; }; /** @@ -791,15 +791,15 @@ class J3DAnmVtxColorFull : public J3DAnmVtxColor { public: /* 8032A30C */ J3DAnmVtxColorFull(); - /* 8032BFC4 */ virtual ~J3DAnmVtxColorFull(); - /* 8032C030 */ virtual s32 getKind() const; - /* 8032A368 */ virtual void getColor(u8, u16, _GXColor*) const; + /* 8032BFC4 */ virtual ~J3DAnmVtxColorFull() {} + /* 8032C030 */ virtual s32 getKind() const { return 14; } + /* 8032A368 */ virtual void getColor(u8, u16, GXColor*) const; - /* 0x1C */ J3DAnmColorFullTable* mpTable[2]; - /* 0x24 */ u8* mColorR; - /* 0x28 */ u8* mColorG; - /* 0x2C */ u8* mColorB; - /* 0x30 */ u8* mColorA; + /* 0x18 */ J3DAnmColorFullTable* mpTable[2]; + /* 0x20 */ u8* mColorR; + /* 0x24 */ u8* mColorG; + /* 0x28 */ u8* mColorB; + /* 0x2C */ u8* mColorA; }; /** @@ -810,9 +810,9 @@ class J3DAnmCluster : public J3DAnmBase { public: J3DAnmCluster(s16 param_1, f32* param_2) : J3DAnmBase(param_1) { mWeight = param_2; } - /* 8032BCAC */ virtual ~J3DAnmCluster(); - /* 8032BF44 */ virtual s32 getKind() const; - /* 8032BF4C */ virtual f32 getWeight(u16) const; + /* 8032BCAC */ virtual ~J3DAnmCluster() {} + /* 8032BF44 */ virtual s32 getKind() const { return 3; } + /* 8032BF4C */ virtual f32 getWeight(u16) const { return 1.0f; } /* 0x0C */ f32* mWeight; }; // Size: 0x10 @@ -825,8 +825,8 @@ class J3DAnmClusterFull : public J3DAnmCluster { public: J3DAnmClusterFull() : J3DAnmCluster(0, 0) { mAnmTable = NULL; } - /* 8032BCAC */ virtual ~J3DAnmClusterFull(); - /* 8032BF44 */ virtual s32 getKind() const; + /* 8032BCAC */ virtual ~J3DAnmClusterFull() {} + /* 8032BF44 */ virtual s32 getKind() const { return 12; } /* 8032BF4C */ virtual f32 getWeight(u16) const; /* 0x10 */ J3DAnmClusterFullTable* mAnmTable; @@ -840,8 +840,8 @@ class J3DAnmClusterKey : public J3DAnmCluster { public: J3DAnmClusterKey() : J3DAnmCluster(0, NULL) { mAnmTable = NULL; } - /* 8032C044 */ virtual ~J3DAnmClusterKey(); - /* 8032C0B0 */ virtual s32 getKind() const; + /* 8032C044 */ virtual ~J3DAnmClusterKey() {} + /* 8032C0B0 */ virtual s32 getKind() const { return 13; } /* 8032A218 */ virtual f32 getWeight(u16) const; /* 0x10 */ J3DAnmClusterKeyTable* mAnmTable; diff --git a/include/JSystem/J3DGraphAnimator/J3DJoint.h b/include/JSystem/J3DGraphAnimator/J3DJoint.h index fa697135820..9c789733ff4 100644 --- a/include/JSystem/J3DGraphAnimator/J3DJoint.h +++ b/include/JSystem/J3DGraphAnimator/J3DJoint.h @@ -2,6 +2,7 @@ #define J3DJOINT_H #include "JSystem/J3DGraphBase/J3DTransform.h" +#include "JSystem/J3DGraphBase/J3DSys.h" class J3DAnmTransform; class J3DJoint; @@ -16,7 +17,7 @@ class J3DMtxCalc { public: /* 80325D1C */ static void setMtxBuffer(J3DMtxBuffer*); - /* 8000D948 */ virtual ~J3DMtxCalc(); + /* 8000D948 */ virtual ~J3DMtxCalc() {} /* 80014E90 */ virtual void setAnmTransform(J3DAnmTransform*); /* 80014E9C */ virtual J3DAnmTransform* getAnmTransform(); /* 80014E8C */ virtual void setAnmTransform(u8, J3DAnmTransform*); @@ -34,29 +35,6 @@ class J3DMtxCalc { static J3DJoint* mJoint; }; // Size: 0x4 -/** - * @ingroup jsystem-j3d - * - */ -class J3DMtxCalcNoAnmBase : public J3DMtxCalc { -public: - /* 8000FA8C */ virtual ~J3DMtxCalcNoAnmBase(); -}; - -/** - * @ingroup jsystem-j3d - * - */ -template -class J3DMtxCalcNoAnm : public J3DMtxCalcNoAnmBase { -public: - J3DMtxCalcNoAnm() {} - virtual ~J3DMtxCalcNoAnm() {} - virtual void init(const Vec& param_0, const Mtx& param_1); - virtual void calc(); -}; - -class J3DJoint; typedef int (*J3DJointCallBack)(J3DJoint*, int); /** @@ -85,6 +63,7 @@ class J3DJoint { J3DMtxCalc* getMtxCalc() { return mMtxCalc; } J3DMtxCalc* getCurrentMtxCalc() { return mCurrentMtxCalc; }; J3DJoint* getChild() { return mChild; } + u8 getMtxType() { return (mKind & 0xf0) >> 4; } void setMtxType(u8 type) { mKind = (mKind & ~0xf0) | (type << 4); } static J3DMtxCalc* mCurrentMtxCalc; @@ -109,6 +88,39 @@ class J3DJoint { /* 0x58 */ J3DMaterial* mMesh; }; // Size: 0x5C +/** + * @ingroup jsystem-j3d + * + */ +class J3DMtxCalcNoAnmBase : public J3DMtxCalc { +public: + /* 8000FA8C */ virtual ~J3DMtxCalcNoAnmBase() {} +}; + +/** + * @ingroup jsystem-j3d + * + */ +template +class J3DMtxCalcNoAnm : public J3DMtxCalcNoAnmBase { +public: + J3DMtxCalcNoAnm() {} + virtual ~J3DMtxCalcNoAnm() {} + virtual void init(const Vec& param_0, const Mtx& param_1) { B::init(param_0, param_1); } + virtual void calc() { A::calcTransform(mJoint->getTransformInfo()); } +}; + +/** + * @ingroup jsystem-j3d + * + */ +struct J3DMtxCalcJ3DSysInitSoftimage { + /* 8032ECAC */ static void init(const Vec& param_0, const Mtx& param_1) { + J3DSys::mCurrentS = param_0; + MTXCopy(param_1, J3DSys::mCurrentMtx); + } +}; + /** * @ingroup jsystem-j3d * diff --git a/include/JSystem/J3DGraphAnimator/J3DJointTree.h b/include/JSystem/J3DGraphAnimator/J3DJointTree.h index e0b809eb25a..89c67392121 100644 --- a/include/JSystem/J3DGraphAnimator/J3DJointTree.h +++ b/include/JSystem/J3DGraphAnimator/J3DJointTree.h @@ -44,14 +44,14 @@ class J3DJointTree { /* 80325C00 */ void findImportantMtxIndex(); /* 80325CAC */ virtual void calc(J3DMtxBuffer*, Vec const&, f32 const (&)[3][4]); - /* 80325D24 */ virtual ~J3DJointTree(); + /* 80325D24 */ virtual ~J3DJointTree() {} J3DModelHierarchy const* getHierarchy() { return mHierarchy; } void setHierarchy(J3DModelHierarchy* hierarchy) { mHierarchy = hierarchy; } void setBasicMtxCalc(J3DMtxCalc* calc) { mBasicMtxCalc = calc; } u16 getWEvlpMtxNum() const { return mWEvlpMtxNum; } u8 getWEvlpMixMtxNum(u16 idx) const { return mWEvlpMixMtxNum[idx]; } - u16 * getWEvlpMixIndex() const { return mWEvlpMixIndex; } + u16 * getWEvlpMixMtxIndex() const { return mWEvlpMixMtxIndex; } f32 * getWEvlpMixWeight() const { return mWEvlpMixWeight; } u16 * getWEvlpImportantMtxIndex() const { return mWEvlpImportantMtxIdx; } u16 getDrawFullWgtMtxNum() const { return mDrawMtxData.mDrawFullWgtMtxNum; } @@ -82,7 +82,7 @@ class J3DJointTree { /* 0x1C */ u16 mJointNum; /* 0x1E */ u16 mWEvlpMtxNum; /* 0x20 */ u8* mWEvlpMixMtxNum; - /* 0x24 */ u16* mWEvlpMixIndex; + /* 0x24 */ u16* mWEvlpMixMtxIndex; /* 0x28 */ f32* mWEvlpMixWeight; /* 0x2C */ Mtx* mInvJointMtx; /* 0x30 */ u16* mWEvlpImportantMtxIdx; diff --git a/include/JSystem/J3DGraphAnimator/J3DModel.h b/include/JSystem/J3DGraphAnimator/J3DModel.h index 4d878d8a416..82b2a13da64 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModel.h +++ b/include/JSystem/J3DGraphAnimator/J3DModel.h @@ -72,7 +72,7 @@ class J3DModel { /* 803276EC */ virtual void calcMaterial(); /* 80327858 */ virtual void calcDiffTexMtx(); /* 80327F40 */ virtual void viewCalc(); - /* 80328350 */ virtual ~J3DModel(); + /* 80328350 */ virtual ~J3DModel() {} J3DModelData* getModelData() { return mModelData; } diff --git a/include/JSystem/J3DGraphAnimator/J3DModelData.h b/include/JSystem/J3DGraphAnimator/J3DModelData.h index a2ac2d0f571..e746b5de23a 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModelData.h +++ b/include/JSystem/J3DGraphAnimator/J3DModelData.h @@ -25,7 +25,7 @@ class J3DModelData { /* 803260CC */ void syncJ3DSysPointers() const; /* 803260F8 */ void syncJ3DSysFlags() const; - /* 8032617C */ virtual ~J3DModelData(); + /* 8032617C */ virtual ~J3DModelData() {} J3DMaterialTable& getMaterialTable() { return mMaterialTable; } JUTNameTab* getMaterialName() const { return mMaterialTable.getMaterialName(); } @@ -54,7 +54,7 @@ class J3DModelData { J3DTexture* getTexture() const { return mMaterialTable.getTexture(); } JUTNameTab* getTextureName() const { return mMaterialTable.getTextureName(); } u16 getWEvlpMtxNum() const { return mJointTree.getWEvlpMtxNum(); } - u16* getWEvlpMixMtxIndex() const { return mJointTree.getWEvlpMixIndex(); } + u16* getWEvlpMixMtxIndex() const { return mJointTree.getWEvlpMixMtxIndex(); } f32* getWEvlpMixWeight() const { return mJointTree.getWEvlpMixWeight(); } u8 getWEvlpMixMtxNum(u16 idx) const { return mJointTree.getWEvlpMixMtxNum(idx); } u16* getWEvlpImportantMtxIndex() const { return mJointTree.getWEvlpImportantMtxIndex(); } diff --git a/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h b/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h index 28ad960ed36..abf85d35c8d 100644 --- a/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h +++ b/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h @@ -37,7 +37,7 @@ class J3DMtxBuffer { u8 getEnvScaleFlag(int idx) const { return mpEvlpScaleFlagArr[idx]; } Mtx** getDrawMtxPtrPtr() const { return mpDrawMtxArr[1]; } Mtx* getDrawMtxPtr() const { return mpDrawMtxArr[1][mCurrentViewNo]; } - Mtx* getDrawMtx(u16 idx) const { return &mpDrawMtxArr[1][mCurrentViewNo][idx]; } + Mtx* getDrawMtx(int idx) const { return &mpDrawMtxArr[1][mCurrentViewNo][idx]; } Mtx33** getNrmMtxPtrPtr() const { return mpNrmMtxArr[1]; } Mtx33* getNrmMtxPtr() const { return mpNrmMtxArr[1][mCurrentViewNo]; } Mtx33* getNrmMtx(u16 idx) const { return &mpNrmMtxArr[1][mCurrentViewNo][idx]; } @@ -45,6 +45,10 @@ class J3DMtxBuffer { Mtx33* getBumpMtxPtr(int idx) const { return mpBumpMtxArr[1][idx][mCurrentViewNo]; } J3DJointTree* getJointTree() const { return mJointTree; } + void setNrmMtx(int idx, Mtx* mtx) { + J3DPSMtx33CopyFrom34(*mtx, mpNrmMtxArr[1][mCurrentViewNo][idx]); + } + void swapDrawMtx() { Mtx* tmp = mpDrawMtxArr[0][mCurrentViewNo]; mpDrawMtxArr[0][mCurrentViewNo] = mpDrawMtxArr[1][mCurrentViewNo]; @@ -70,13 +74,13 @@ class J3DMtxBuffer { /* 0x10 */ Mtx* mpWeightEvlpMtx; /* 0x14 */ Mtx** mpDrawMtxArr[2]; /* 0x1C */ Mtx33** mpNrmMtxArr[2]; - /* 0x28 */ Mtx33*** mpBumpMtxArr[2]; + /* 0x24 */ Mtx33*** mpBumpMtxArr[2]; /* 0x2C */ u32 mFlags; /* 0x30 */ u32 mCurrentViewNo; /* 0x34 */ Mtx* mpUserAnmMtx; public: - /* 803283B4 */ virtual ~J3DMtxBuffer(); + /* 803283B4 */ virtual ~J3DMtxBuffer() {} }; void J3DCalcViewBaseMtx(f32 (*param_0)[4], Vec const& param_1, f32 const (¶m_2)[3][4], diff --git a/include/JSystem/J3DGraphAnimator/J3DShapeTable.h b/include/JSystem/J3DGraphAnimator/J3DShapeTable.h index 8ae9ff94a99..d95c9054ef9 100644 --- a/include/JSystem/J3DGraphAnimator/J3DShapeTable.h +++ b/include/JSystem/J3DGraphAnimator/J3DShapeTable.h @@ -22,7 +22,7 @@ class J3DShapeTable { /* 80325910 */ void initShapeNodes(J3DDrawMtxData*, J3DVertexData*); /* 8032597C */ void sortVcdVatCmd(); - virtual ~J3DShapeTable(); + virtual ~J3DShapeTable() {} u16 getShapeNum() const { return mShapeNum; } J3DShape* getShapeNodePointer(u16 idx) const { return mShapeNodePointer[idx]; } diff --git a/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h b/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h index 1b6ea8631f3..2cb33d13935 100644 --- a/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h +++ b/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h @@ -89,7 +89,9 @@ class J3DDeformer { /* 8032EBCC */ void normalizeWeight(int, f32*); void offFlag(u32 i_flag) { mFlags &= ~i_flag; } + bool checkFlag(u32 i_flag) { return mFlags & i_flag; } void setAnmCluster(J3DAnmCluster* anm) { mAnmCluster = anm; } + void normalize(f32* i_vec) { VECNormalize((Vec*)i_vec, (Vec*)i_vec); } /* 0x00 */ J3DDeformData* mDeformData; /* 0x04 */ J3DAnmCluster* mAnmCluster; diff --git a/include/JSystem/J3DGraphBase/J3DShape.h b/include/JSystem/J3DGraphBase/J3DShape.h index 7e7b96aaef9..3e02440cc59 100644 --- a/include/JSystem/J3DGraphBase/J3DShape.h +++ b/include/JSystem/J3DGraphBase/J3DShape.h @@ -123,6 +123,7 @@ class J3DShape { void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; } bool getNBTFlag() const { return mHasNBT; } u32 getBumpMtxOffset() const { return mBumpMtxOffset; } + void setBumpMtxOffset(u32 offset) { mBumpMtxOffset = offset; } GXVtxDescList* getVtxDesc() const { return mVtxDesc; } J3DMaterial* getMaterial() const { return mMaterial; } diff --git a/include/JSystem/J3DGraphBase/J3DShapeMtx.h b/include/JSystem/J3DGraphBase/J3DShapeMtx.h index 590b95a3ff2..3a5a7e889a1 100644 --- a/include/JSystem/J3DGraphBase/J3DShapeMtx.h +++ b/include/JSystem/J3DGraphBase/J3DShapeMtx.h @@ -15,6 +15,7 @@ class J3DTexMtxObj { Mtx& getMtx(u16 idx) { return mpTexMtx[idx]; } Mtx44& getEffectMtx(u16 idx) { return mpEffectMtx[idx]; } u16 getNumTexMtx() { return mTexMtxNum; } + void setMtx(u16 idx, Mtx const* mtx) { MTXCopy(*mtx, mpTexMtx[idx]); } /* 0x00 */ Mtx* mpTexMtx; /* 0x04 */ Mtx44* mpEffectMtx; diff --git a/include/JSystem/J3DGraphLoader/J3DModelLoader.h b/include/JSystem/J3DGraphLoader/J3DModelLoader.h index 581340cd03e..28dced7a4c0 100644 --- a/include/JSystem/J3DGraphLoader/J3DModelLoader.h +++ b/include/JSystem/J3DGraphLoader/J3DModelLoader.h @@ -268,8 +268,7 @@ class J3DModelLoader { /* 80337010 */ u32 calcSizePatchedMaterial(J3DMaterialBlock const*, u32); /* 803370A0 */ u32 calcSizeMaterialDL(J3DMaterialDLBlock const*, u32); - // Remove when J3DModelLoader.cc is ok - #ifndef NON_VIRTUAL_J3DModelLoader + /* 803347E0 */ virtual J3DModelData* load(void const*, u32); /* 80334ABC */ virtual J3DMaterialTable* loadMaterialTable(void const*); /* 80334C20 */ virtual J3DModelData* loadBinaryDisplayList(void const*, u32); @@ -278,32 +277,13 @@ class J3DModelLoader { /* 80336A98 */ virtual u32 calcLoadBinaryDisplayListSize(void const*, u32); /* 80336794 */ virtual u16 countMaterialNum(void const*); /* 80334EE0 */ virtual void setupBBoardInfo(); - /* 80336450 */ virtual ~J3DModelLoader(); - /* 8033649C */ virtual void readMaterial(J3DMaterialBlock const*, u32); - /* 80336498 */ virtual void readMaterial_v21(J3DMaterialBlock_v21 const*, u32); - /* 803364A4 */ virtual void readMaterialTable(J3DMaterialBlock const*, u32); - /* 803364A0 */ virtual void readMaterialTable_v21(J3DMaterialBlock_v21 const*, u32); - /* 803364A8 */ virtual u32 calcSizeMaterial(J3DMaterialBlock const*, u32); - /* 803364B0 */ virtual u32 calcSizeMaterialTable(J3DMaterialBlock const*, u32); - #else - /* 803347E0 */ J3DModelData* load(void const*, u32); - /* 80334ABC */ J3DMaterialTable* loadMaterialTable(void const*); - /* 80334C20 */ J3DModelData* loadBinaryDisplayList(void const*, u32); - /* 803367D4 */ u32 calcLoadSize(void const*, u32); - /* 803369A0 */ u32 calcLoadMaterialTableSize(void const*); - /* 80336A98 */ u32 calcLoadBinaryDisplayListSize(void const*, u32); - /* 80336794 */ u16 countMaterialNum(void const*); - /* 80334EE0 */ void setupBBoardInfo(); - /* 80336450 */ ~J3DModelLoader(); - /* 8033649C */ void readMaterial(J3DMaterialBlock const*, u32); - /* 80336498 */ void readMaterial_v21(J3DMaterialBlock_v21 const*, u32); - /* 803364A4 */ void readMaterialTable(J3DMaterialBlock const*, u32); - /* 803364A0 */ void readMaterialTable_v21(J3DMaterialBlock_v21 const*, u32); - /* 803364A8 */ u32 calcSizeMaterial(J3DMaterialBlock const*, u32); - /* 803364B0 */ u32 calcSizeMaterialTable(J3DMaterialBlock const*, u32); - - /* 0x00 */ void* _vtable; - #endif + /* 80336450 */ virtual ~J3DModelLoader() {} + /* 8033649C */ virtual void readMaterial(J3DMaterialBlock const*, u32) {} + /* 80336498 */ virtual void readMaterial_v21(J3DMaterialBlock_v21 const*, u32) {} + /* 803364A4 */ virtual void readMaterialTable(J3DMaterialBlock const*, u32) {} + /* 803364A0 */ virtual void readMaterialTable_v21(J3DMaterialBlock_v21 const*, u32) {} + /* 803364A8 */ virtual u32 calcSizeMaterial(J3DMaterialBlock const*, u32) { return false; } + /* 803364B0 */ virtual u32 calcSizeMaterialTable(J3DMaterialBlock const*, u32) { return false; } /* 0x04 */ J3DModelData* mpModelData; /* 0x08 */ J3DMaterialTable* mpMaterialTable; @@ -319,44 +299,24 @@ class J3DModelLoader { * @ingroup jsystem-j3d * */ -class J3DModelLoader_v21 { // : public J3DModelLoader { +class J3DModelLoader_v21 : public J3DModelLoader { public: /* 803363F4 */ ~J3DModelLoader_v21() {} /* 80335890 */ void readMaterial_v21(J3DMaterialBlock_v21 const*, u32); /* 80335E20 */ void readMaterialTable_v21(J3DMaterialBlock_v21 const*, u32); - - /* 0x00 */ void* _vtable; - /* 0x04 */ J3DModelData* mpModelData; - /* 0x08 */ J3DMaterialTable* mpMaterialTable; - /* 0x0C */ J3DShapeBlock const* mpShapeBlock; - /* 0x10 */ J3DMaterialBlock const* mpMaterialBlock; - /* 0x14 */ J3DModelHierarchy* mpModelHierarchy; - /* 0x18 */ u8 field_0x18; - /* 0x19 */ u8 field_0x19; - /* 0x1A */ u16 mEnvelopeSize; }; /** * @ingroup jsystem-j3d * */ -class J3DModelLoader_v26 { // : public J3DModelLoader { +class J3DModelLoader_v26 : public J3DModelLoader { public: /* 80336398 */ ~J3DModelLoader_v26() {} /* 80335614 */ void readMaterial(J3DMaterialBlock const*, u32); /* 80335CE4 */ void readMaterialTable(J3DMaterialBlock const*, u32); /* 80336DB4 */ u32 calcSizeMaterial(J3DMaterialBlock const*, u32); /* 80336F60 */ u32 calcSizeMaterialTable(J3DMaterialBlock const*, u32); - - /* 0x00 */ void* _vtable; - /* 0x04 */ J3DModelData* mpModelData; - /* 0x08 */ J3DMaterialTable* mpMaterialTable; - /* 0x0C */ J3DShapeBlock const* mpShapeBlock; - /* 0x10 */ J3DMaterialBlock const* mpMaterialBlock; - /* 0x14 */ J3DModelHierarchy* mpModelHierarchy; - /* 0x18 */ u8 field_0x18; - /* 0x19 */ u8 field_0x19; - /* 0x1A */ u16 mEnvelopeSize; }; /** diff --git a/include/JSystem/JMath/JMATrigonometric.h b/include/JSystem/JMath/JMATrigonometric.h index 5af842f6310..89c49447737 100644 --- a/include/JSystem/JMath/JMATrigonometric.h +++ b/include/JSystem/JMath/JMATrigonometric.h @@ -13,7 +13,10 @@ struct TAngleConstant_; */ template<> struct TAngleConstant_ { - static inline f32 RADIAN_DEG360() { return 6.2831855f; } + static f32 RADIAN_DEG090() { return 1.5707964f; } + static f32 RADIAN_DEG180() { return 3.1415927f; } + static f32 RADIAN_DEG360() { return 6.2831855f; } + static f32 RADIAN_TO_DEGREE_FACTOR() { return 180.0f / RADIAN_DEG180(); } }; /** @@ -72,12 +75,32 @@ struct TAtanTable { struct TAsinAcosTable { f32 table[1025]; u8 pad[0x1C]; + + f32 acos_(f32 x) { + if (x >= 1.0f) { + return 0.0f; + } else if (x <= -1.0f) { + return TAngleConstant_::RADIAN_DEG180(); + } else if (x < 0.0f) { + return table[(u32)(-x * 1023.5f)] + TAngleConstant_::RADIAN_DEG090(); + } else { + return TAngleConstant_::RADIAN_DEG090() - table[(u32)(x * 1023.5f)]; + } + } + + f32 acosDegree(f32 x) { + return acos_(x) * TAngleConstant_::RADIAN_TO_DEGREE_FACTOR(); + } }; namespace JMath { extern TSinCosTable<13, f32> sincosTable_; extern TAtanTable atanTable_; extern TAsinAcosTable asinAcosTable_; + +inline f32 acosDegree(f32 x) { + return asinAcosTable_.acosDegree(x); +} }; // namespace JMath inline f32 JMASCosShort(s16 v) { diff --git a/include/JSystem/JMath/JMath.h b/include/JSystem/JMath/JMath.h index 42f9f8fa8e7..3363fd94e18 100644 --- a/include/JSystem/JMath/JMath.h +++ b/include/JSystem/JMath/JMath.h @@ -34,6 +34,37 @@ inline f32 JMAFastSqrt(register f32 input) { } } +inline f32 JMAHermiteInterpolation(register f32 p1, register f32 p2, register f32 p3, + register f32 p4, register f32 p5, register f32 p6, + register f32 p7) { + register f32 ff25; + register f32 ff31; + register f32 ff30; + register f32 ff29; + register f32 ff28; + register f32 ff27; + register f32 ff26; + // clang-format off + asm { + fsubs ff31, p1, p2 + fsubs ff30, p5, p2 + fdivs ff29, ff31, ff30 + fmuls ff28,ff29,ff29 + fadds ff25,ff29,ff29 + fsubs ff27,ff28,ff29 + fsubs ff30, p3, p6 + fmsubs ff26,ff25,ff27,ff28 + fmadds ff25,p4,ff27,p4 + fmadds ff26,ff26,ff30,p3 + fmadds ff25,p7,ff27,ff25 + fmsubs ff25,ff29,p4,ff25 + fnmsubs ff25,ff31,ff25,ff26 + + } + // clang-format on + return ff25; +} + namespace JMath { inline f32 fastReciprocal(f32 value) { diff --git a/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp b/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp index fad08e2761f..ce963c03b52 100644 --- a/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DAnimation.cpp @@ -4,115 +4,9 @@ // #include "JSystem/J3DGraphAnimator/J3DAnimation.h" -#include "dol2asm.h" - -// -// Forward References: -// - -extern "C" void init__12J3DFrameCtrlFs(); -extern "C" void checkPass__12J3DFrameCtrlFf(); -extern "C" void update__12J3DFrameCtrlFv(); -extern "C" void __ct__15J3DAnmTransformFsPfPsPf(); -extern "C" void getTransform__19J3DAnmTransformFullCFUsP16J3DTransformInfo(); -extern "C" void getTransform__27J3DAnmTransformFullWithLerpCFUsP16J3DTransformInfo(); -extern "C" void calcTransform__18J3DAnmTransformKeyCFfUsP16J3DTransformInfo(); -extern "C" void __ct__19J3DAnmTextureSRTKeyFv(); -extern "C" void calcTransform__19J3DAnmTextureSRTKeyCFfUsP17J3DTextureSRTInfo(); -extern "C" void getWeight__17J3DAnmClusterFullCFUs(); -extern "C" void getWeight__16J3DAnmClusterKeyCFUs(); -extern "C" void __ct__14J3DAnmVtxColorFv(); -extern "C" void __ct__18J3DAnmVtxColorFullFv(); -extern "C" void getColor__18J3DAnmVtxColorFullCFUcUsP8_GXColor(); -extern "C" void __ct__17J3DAnmVtxColorKeyFv(); -extern "C" void getColor__17J3DAnmVtxColorKeyCFUcUsP8_GXColor(); -extern "C" void __ct__11J3DAnmColorFv(); -extern "C" void searchUpdateMaterialID__11J3DAnmColorFP16J3DMaterialTable(); -extern "C" void __ct__15J3DAnmColorFullFv(); -extern "C" void getColor__15J3DAnmColorFullCFUsP8_GXColor(); -extern "C" void __ct__14J3DAnmColorKeyFv(); -extern "C" void getColor__14J3DAnmColorKeyCFUsP8_GXColor(); -extern "C" void __ct__15J3DAnmTevRegKeyFv(); -extern "C" void __ct__16J3DAnmTexPatternFv(); -extern "C" void getTexNo__16J3DAnmTexPatternCFUsPUs(); -extern "C" void searchUpdateMaterialID__16J3DAnmTexPatternFP16J3DMaterialTable(); -extern "C" void searchUpdateMaterialID__16J3DAnmTexPatternFP12J3DModelData(); -extern "C" void searchUpdateMaterialID__19J3DAnmTextureSRTKeyFP16J3DMaterialTable(); -extern "C" void searchUpdateMaterialID__19J3DAnmTextureSRTKeyFP12J3DModelData(); -extern "C" void getTevColorReg__15J3DAnmTevRegKeyCFUsP11_GXColorS10(); -extern "C" void getTevKonstReg__15J3DAnmTevRegKeyCFUsP8_GXColor(); -extern "C" void searchUpdateMaterialID__15J3DAnmTevRegKeyFP16J3DMaterialTable(); -extern "C" void searchUpdateMaterialID__15J3DAnmTevRegKeyFP12J3DModelData(); -extern "C" void func_8032B8A0(void* _this, f32, J3DAnmKeyTableBase*, s16*); -extern "C" void func_8032BAD4(void* _this, f32, J3DAnmKeyTableBase*, f32*); -extern "C" void __dt__14J3DAnmVtxColorFv(); -extern "C" void __dt__11J3DAnmColorFv(); -extern "C" void __dt__16J3DAnmTexPatternFv(); -extern "C" s32 getKind__16J3DAnmTexPatternCFv(); -extern "C" void __dt__15J3DAnmTevRegKeyFv(); -extern "C" s32 getKind__15J3DAnmTevRegKeyCFv(); -extern "C" void __dt__14J3DAnmColorKeyFv(); -extern "C" s32 getKind__14J3DAnmColorKeyCFv(); -extern "C" void __dt__15J3DAnmColorFullFv(); -extern "C" s32 getKind__15J3DAnmColorFullCFv(); -extern "C" bool getKind__11J3DAnmColorCFv(); -extern "C" void getColor__11J3DAnmColorCFUsP8_GXColor(); -extern "C" void __dt__17J3DAnmVtxColorKeyFv(); -extern "C" s32 getKind__17J3DAnmVtxColorKeyCFv(); -extern "C" void __dt__18J3DAnmVtxColorFullFv(); -extern "C" s32 getKind__18J3DAnmVtxColorFullCFv(); -extern "C" s32 getKind__14J3DAnmVtxColorCFv(); -extern "C" void getColor__14J3DAnmVtxColorCFUcUsP8_GXColor(); -extern "C" void __dt__16J3DAnmClusterKeyFv(); -extern "C" s32 getKind__16J3DAnmClusterKeyCFv(); -extern "C" void __dt__13J3DAnmClusterFv(); -extern "C" s32 getKind__13J3DAnmClusterCFv(); -extern "C" void getWeight__13J3DAnmClusterCFUs(); -extern "C" void __dt__17J3DAnmClusterFullFv(); -extern "C" s32 getKind__17J3DAnmClusterFullCFv(); -extern "C" void __dt__19J3DAnmTextureSRTKeyFv(); -extern "C" s32 getKind__19J3DAnmTextureSRTKeyCFv(); -extern "C" void __dt__27J3DAnmTransformFullWithLerpFv(); -extern "C" s32 getKind__27J3DAnmTransformFullWithLerpCFv(); -extern "C" void __dt__19J3DAnmTransformFullFv(); -extern "C" s32 getKind__19J3DAnmTransformFullCFv(); - -// -// External References: -// - -extern "C" void __dl__FPv(); -extern "C" void __ct__10JUTNameTabFv(); -extern "C" void getIndex__10JUTNameTabCFPCc(); -extern "C" void getName__10JUTNameTabCFUs(); -extern "C" void __cvt_fp2unsigned(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern void* __vt__10J3DAnmBase[4]; -extern "C" extern void* __vt__15J3DAnmTransform[5]; -extern "C" extern void* __vt__10JUTNameTab[3]; - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 80456430-80456434 004A30 0004+00 6/6 0/0 0/0 .sdata2 @852 */ -SECTION_SDATA2 static f32 lit_852 = 1.0f; - -/* 80456434-80456438 004A34 0004+00 20/20 0/0 0/0 .sdata2 @853 */ -SECTION_SDATA2 static u8 lit_853[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; +#include "JSystem/J3DGraphBase/J3DStruct.h" +#include "JSystem/JMath/JMath.h" +#include "dolphin/os.h" /* 803283FC-8032842C 322D3C 0030+00 0/0 25/25 285/285 .text init__12J3DFrameCtrlFs */ void J3DFrameCtrl::init(s16 i_end) { @@ -121,21 +15,10 @@ void J3DFrameCtrl::init(s16 i_end) { mStart = 0; mEnd = i_end; mLoop = 0; - mRate = lit_852; - mFrame = FLOAT_LABEL(lit_853); + mRate = 1.0f; + mFrame = 0.0f; } -/* ############################################################################################## */ -/* 80456438-80456440 004A38 0004+04 2/2 0/0 0/0 .sdata2 @973 */ -SECTION_SDATA2 static f32 lit_973[1 + 1 /* padding */] = { - 0.0010000000474974513f, - /* padding */ - 0.0f, -}; - -/* 80456440-80456448 004A40 0008+00 4/4 0/0 0/0 .sdata2 @975 */ -SECTION_SDATA2 static f64 lit_975 = 4503601774854144.0 /* cast s32 to float */; - /* 8032842C-803289CC 322D6C 05A0+00 0/0 92/92 382/382 .text checkPass__12J3DFrameCtrlFf */ int J3DFrameCtrl::checkPass(f32 pass_frame) { @@ -340,143 +223,457 @@ J3DAnmTransform::J3DAnmTransform(s16 param_0, f32* param_1, s16* param_2, f32* p field_0x1e = 0; } - -/* ############################################################################################## */ -/* 80456448-80456450 004A48 0004+04 4/4 0/0 0/0 .sdata2 @1092 */ -SECTION_SDATA2 static f32 lit_1092[1 + 1 /* padding */] = { - 0.5f, - /* padding */ - 0.0f, -}; - /* 80328E90-803291F0 3237D0 0360+00 1/0 0/0 0/0 .text * getTransform__19J3DAnmTransformFullCFUsP16J3DTransformInfo */ -void J3DAnmTransformFull::getTransform(u16 param_0, J3DTransformInfo* param_1) const { - // NONMATCHING +void J3DAnmTransformFull::getTransform(u16 i_index, J3DTransformInfo* o_transform) const { + u16 idx = i_index * 3; + J3DAnmTransformFullTable* entryX = &mAnmTable[idx]; + J3DAnmTransformFullTable* entryY = &mAnmTable[idx + 1]; + J3DAnmTransformFullTable* entryZ = &mAnmTable[idx + 2]; + if (mFrame < 0.0f) { + o_transform->mScale.x = mScaleData[entryX->mScaleOffset]; + o_transform->mScale.y = mScaleData[entryY->mScaleOffset]; + o_transform->mScale.z = mScaleData[entryZ->mScaleOffset]; + o_transform->mRotation.x = mRotData[entryX->mRotationOffset]; + o_transform->mRotation.y = mRotData[entryY->mRotationOffset]; + o_transform->mRotation.z = mRotData[entryZ->mRotationOffset]; + o_transform->mTranslate.x = mTransData[entryX->mTranslateOffset]; + o_transform->mTranslate.y = mTransData[entryY->mTranslateOffset]; + o_transform->mTranslate.z = mTransData[entryZ->mTranslateOffset]; + } else { + u32 frame = (int)(mFrame + 0.5f); + if (frame >= entryX->mScaleMaxFrame) { + o_transform->mScale.x = mScaleData[entryX->mScaleOffset + (entryX->mScaleMaxFrame - 1)]; + } else { + o_transform->mScale.x = mScaleData[entryX->mScaleOffset + frame]; + } + if (frame >= entryX->mRotationMaxFrame) { + o_transform->mRotation.x = + mRotData[entryX->mRotationOffset + (entryX->mRotationMaxFrame - 1)]; + } else { + o_transform->mRotation.x = mRotData[entryX->mRotationOffset + frame]; + } + if (frame >= entryX->mTranslateMaxFrame) { + o_transform->mTranslate.x = + mTransData[entryX->mTranslateOffset + (entryX->mTranslateMaxFrame - 1)]; + } else { + o_transform->mTranslate.x = mTransData[entryX->mTranslateOffset + frame]; + } + if (frame >= entryY->mScaleMaxFrame) { + o_transform->mScale.y = mScaleData[entryY->mScaleOffset + (entryY->mScaleMaxFrame - 1)]; + } else { + o_transform->mScale.y = mScaleData[entryY->mScaleOffset + frame]; + } + if (frame >= entryY->mRotationMaxFrame) { + o_transform->mRotation.y = + mRotData[entryY->mRotationOffset + (entryY->mRotationMaxFrame - 1)]; + } else { + o_transform->mRotation.y = mRotData[entryY->mRotationOffset + frame]; + } + if (frame >= entryY->mTranslateMaxFrame) { + o_transform->mTranslate.y = + mTransData[entryY->mTranslateOffset + (entryY->mTranslateMaxFrame - 1)]; + } else { + o_transform->mTranslate.y = mTransData[entryY->mTranslateOffset + frame]; + } + if (frame >= entryZ->mScaleMaxFrame) { + o_transform->mScale.z = mScaleData[entryZ->mScaleOffset + (entryZ->mScaleMaxFrame - 1)]; + } else { + o_transform->mScale.z = mScaleData[entryZ->mScaleOffset + frame]; + } + if (frame >= entryZ->mRotationMaxFrame) { + o_transform->mRotation.z = + mRotData[entryZ->mRotationOffset + (entryZ->mRotationMaxFrame - 1)]; + } else { + o_transform->mRotation.z = mRotData[entryZ->mRotationOffset + frame]; + } + if (frame >= entryZ->mTranslateMaxFrame) { + o_transform->mTranslate.z = + mTransData[entryZ->mTranslateOffset + (entryZ->mTranslateMaxFrame - 1)]; + } else { + o_transform->mTranslate.z = mTransData[entryZ->mTranslateOffset + frame]; + } + } } -/* ############################################################################################## */ -/* 80456450-80456458 004A50 0008+00 2/2 0/0 0/0 .sdata2 @1223 */ -SECTION_SDATA2 static f64 lit_1223 = 4503599627370496.0 /* cast u32 to float */; - /* 803291F0-80329A34 323B30 0844+00 1/0 0/0 0/0 .text * getTransform__27J3DAnmTransformFullWithLerpCFUsP16J3DTransformInfo */ -void J3DAnmTransformFullWithLerp::getTransform(u16 param_0, J3DTransformInfo* param_1) const { - // NONMATCHING +void J3DAnmTransformFullWithLerp::getTransform(u16 i_index, J3DTransformInfo* o_transform) const { + u16 idx = i_index * 3; + J3DAnmTransformFullTable* entryX = &mAnmTable[idx]; + J3DAnmTransformFullTable* entryY = &mAnmTable[idx + 1]; + J3DAnmTransformFullTable* entryZ = &mAnmTable[idx + 2]; + if (mFrame < 0.0f) { + o_transform->mScale.x = mScaleData[entryX->mScaleOffset]; + o_transform->mScale.y = mScaleData[entryY->mScaleOffset]; + o_transform->mScale.z = mScaleData[entryZ->mScaleOffset]; + o_transform->mRotation.x = mRotData[entryX->mRotationOffset]; + o_transform->mRotation.y = mRotData[entryY->mRotationOffset]; + o_transform->mRotation.z = mRotData[entryZ->mRotationOffset]; + o_transform->mTranslate.x = mTransData[entryX->mTranslateOffset]; + o_transform->mTranslate.y = mTransData[entryY->mTranslateOffset]; + o_transform->mTranslate.z = mTransData[entryZ->mTranslateOffset]; + } else { + int frame_ = (int)mFrame; + u32 frame = frame_; + if (frame_ == mFrame) { + if (frame >= entryX->mScaleMaxFrame) { + o_transform->mScale.x = + mScaleData[entryX->mScaleOffset + (entryX->mScaleMaxFrame - 1)]; + } else { + o_transform->mScale.x = mScaleData[entryX->mScaleOffset + frame]; + } + if (frame >= entryX->mRotationMaxFrame) { + o_transform->mRotation.x = + mRotData[entryX->mRotationOffset + (entryX->mRotationMaxFrame - 1)]; + } else { + o_transform->mRotation.x = mRotData[entryX->mRotationOffset + frame]; + } + if (frame >= entryX->mTranslateMaxFrame) { + o_transform->mTranslate.x = + mTransData[entryX->mTranslateOffset + (entryX->mTranslateMaxFrame - 1)]; + } else { + o_transform->mTranslate.x = mTransData[entryX->mTranslateOffset + frame]; + } + if (frame >= entryY->mScaleMaxFrame) { + o_transform->mScale.y = + mScaleData[entryY->mScaleOffset + (entryY->mScaleMaxFrame - 1)]; + } else { + o_transform->mScale.y = mScaleData[entryY->mScaleOffset + frame]; + } + if (frame >= entryY->mRotationMaxFrame) { + o_transform->mRotation.y = + mRotData[entryY->mRotationOffset + (entryY->mRotationMaxFrame - 1)]; + } else { + o_transform->mRotation.y = mRotData[entryY->mRotationOffset + frame]; + } + if (frame >= entryY->mTranslateMaxFrame) { + o_transform->mTranslate.y = + mTransData[entryY->mTranslateOffset + (entryY->mTranslateMaxFrame - 1)]; + } else { + o_transform->mTranslate.y = mTransData[entryY->mTranslateOffset + frame]; + } + if (frame >= entryZ->mScaleMaxFrame) { + o_transform->mScale.z = + mScaleData[entryZ->mScaleOffset + (entryZ->mScaleMaxFrame - 1)]; + } else { + o_transform->mScale.z = mScaleData[entryZ->mScaleOffset + frame]; + } + if (frame >= entryZ->mRotationMaxFrame) { + o_transform->mRotation.z = + mRotData[entryZ->mRotationOffset + (entryZ->mRotationMaxFrame - 1)]; + } else { + o_transform->mRotation.z = mRotData[entryZ->mRotationOffset + frame]; + } + if (frame >= entryZ->mTranslateMaxFrame) { + o_transform->mTranslate.z = + mTransData[entryZ->mTranslateOffset + (entryZ->mTranslateMaxFrame - 1)]; + } else { + o_transform->mTranslate.z = mTransData[entryZ->mTranslateOffset + frame]; + } + } else { + f32 rate = mFrame - frame_; + u32 frame2 = frame + 1; + if (frame2 >= entryX->mScaleMaxFrame) { + o_transform->mScale.x = + mScaleData[entryX->mScaleOffset + (entryX->mScaleMaxFrame - 1)]; + } else { + o_transform->mScale.x = mScaleData[entryX->mScaleOffset + frame] + + rate * (mScaleData[entryX->mScaleOffset + frame2] + - mScaleData[entryX->mScaleOffset + frame]); + } + if (frame2 >= entryX->mRotationMaxFrame) { + o_transform->mRotation.x = + mRotData[entryX->mRotationOffset + (entryX->mRotationMaxFrame - 1)]; + } else { + u32 rot1 = (u16)mRotData[entryX->mRotationOffset + frame]; + u32 rot2 = (u16)mRotData[entryX->mRotationOffset + frame2]; + int delta = rot2 - rot1; + if (delta > 0x8000) { + rot1 += 0x10000; + delta -= 0x10000; + } else if (-delta > 0x8000) { + delta += 0x10000; + } + o_transform->mRotation.x = (u32)((f32)rot1 + rate * (f32)delta); + } + if (frame2 >= entryX->mTranslateMaxFrame) { + o_transform->mTranslate.x = + mTransData[entryX->mTranslateOffset + (entryX->mTranslateMaxFrame - 1)]; + } else { + o_transform->mTranslate.x = mTransData[entryX->mTranslateOffset + frame] + + rate * (mTransData[entryX->mTranslateOffset + frame2] + - mTransData[entryX->mTranslateOffset + frame]); + } + if (frame2 >= entryY->mScaleMaxFrame) { + o_transform->mScale.y = + mScaleData[entryY->mScaleOffset + (entryY->mScaleMaxFrame - 1)]; + } else { + o_transform->mScale.y = mScaleData[entryY->mScaleOffset + frame] + + rate * (mScaleData[entryY->mScaleOffset + frame2] + - mScaleData[entryY->mScaleOffset + frame]); + } + if (frame2 >= entryY->mRotationMaxFrame) { + o_transform->mRotation.y = + mRotData[entryY->mRotationOffset + (entryY->mRotationMaxFrame - 1)]; + } else { + u32 rot1 = (u16)mRotData[entryY->mRotationOffset + frame]; + u32 rot2 = (u16)mRotData[entryY->mRotationOffset + frame2]; + int delta = rot2 - rot1; + if (delta > 0x8000) { + rot1 += 0x10000; + delta -= 0x10000; + } else if (-delta > 0x8000) { + delta += 0x10000; + } + o_transform->mRotation.y = (u32)((f32)rot1 + rate * (f32)delta); + } + if (frame2 >= entryY->mTranslateMaxFrame) { + o_transform->mTranslate.y = + mTransData[entryY->mTranslateOffset + (entryY->mTranslateMaxFrame - 1)]; + } else { + o_transform->mTranslate.y = mTransData[entryY->mTranslateOffset + frame] + + rate * (mTransData[entryY->mTranslateOffset + frame2] + - mTransData[entryY->mTranslateOffset + frame]); + } + if (frame2 >= entryZ->mScaleMaxFrame) { + o_transform->mScale.z = + mScaleData[entryZ->mScaleOffset + (entryZ->mScaleMaxFrame - 1)]; + } else { + o_transform->mScale.z = mScaleData[entryZ->mScaleOffset + frame] + + rate * (mScaleData[entryZ->mScaleOffset + frame2] + - mScaleData[entryZ->mScaleOffset + frame]); + } + if (frame2 >= entryZ->mRotationMaxFrame) { + o_transform->mRotation.z = + mRotData[entryZ->mRotationOffset + (entryZ->mRotationMaxFrame - 1)]; + } else { + u32 rot1 = (u16)mRotData[entryZ->mRotationOffset + frame]; + u32 rot2 = (u16)mRotData[entryZ->mRotationOffset + frame2]; + int delta = rot2 - rot1; + if (delta > 0x8000) { + rot1 += 0x10000; + delta -= 0x10000; + } else if (-delta > 0x8000) { + delta += 0x10000; + } + o_transform->mRotation.z = (u32)((f32)rot1 + rate * (f32)delta); + } + if (frame2 >= entryZ->mTranslateMaxFrame) { + o_transform->mTranslate.z = + mTransData[entryZ->mTranslateOffset + (entryZ->mTranslateMaxFrame - 1)]; + } else { + o_transform->mTranslate.z = mTransData[entryZ->mTranslateOffset + frame] + + rate * (mTransData[entryZ->mTranslateOffset + frame2] + - mTransData[entryZ->mTranslateOffset + frame]); + } + } + } +} + +inline f32 J3DHermiteInterpolation(f32 p1, f32 const* p2, f32 const* p3, f32 const* p4, + f32 const* p5, f32 const* p6, f32 const* p7) { + return JMAHermiteInterpolation(p1, *p2, *p3, *p4, *p5, *p6, *p7); +} + +inline f32 J3DHermiteInterpolation(register f32 pp1, register s16 const* pp2, + register s16 const* pp3, register s16 const* pp4, + register s16 const* pp5, register s16 const* pp6, + register s16 const* pp7) { + register f32 p1 = pp1; + register f32 ff8; + register f32 ff7; + register f32 ff6; + register f32 ff5; + register f32 ff4; + register f32 ff3; + register f32 ff2; + register f32 ff0; + register f32 fout; + register s16 const* p2 = pp2; + register s16 const* p3 = pp3; + register s16 const* p4 = pp4; + register s16 const* p5 = pp5; + register s16 const* p6 = pp6; + register s16 const* p7 = pp7; + // clang-format off + asm { + psq_l ff2, 0(p2), 0x1, 5 + psq_l ff0, 0(p5), 0x1, 5 + psq_l ff7, 0(p3), 0x1, 5 + fsubs ff5, ff0, ff2 + psq_l ff6, 0(p6), 0x1, 5 + fsubs ff3, p1, ff2 + psq_l ff0, 0(p7), 0x1, 5 + fsubs ff4, ff6, ff7 + fdivs ff3, ff3, ff5 + psq_l fout, 0(p4), 0x1, 5 + fmadds ff0, ff0, ff5, ff7 + fmuls ff2, ff3, ff3 + fnmsubs ff4, ff5, fout, ff4 + fsubs ff0, ff0, ff6 + fsubs ff0, ff0, ff4 + fmuls ff0, ff2, ff0 + fmadds fout, ff5, fout, ff0 + fmadds fout, fout, ff3, ff7 + fmadds fout, ff4, ff2, fout + fsubs fout, fout, ff0 + } + // clang-format on + return fout; +} + +template +f32 J3DGetKeyFrameInterpolation(f32 i_frame, J3DAnmKeyTableBase* i_entry, T* i_data) { + if (i_frame < i_data[0]) { + return i_data[1]; + } + if (i_entry->mType == 0) { + u32 idx = i_entry->mMaxFrame - 1; + if (i_data[idx * 3] <= i_frame) { + return i_data[idx * 3 + 1]; + } + u32 uVar7 = i_entry->mMaxFrame; + while (uVar7 > 1) { + u32 uVar2 = uVar7 >> 1; + u32 tmp = uVar2 * 3; + if (i_frame >= i_data[tmp]) { + i_data += tmp; + uVar7 = uVar7 - uVar2; + } else { + uVar7 = uVar2; + } + } + return J3DHermiteInterpolation(i_frame, &i_data[0], &i_data[1], &i_data[2], + &i_data[3], &i_data[4], &i_data[5]); + } else { + u32 idx = i_entry->mMaxFrame - 1; + if (i_data[idx * 4] <= i_frame) { + return i_data[idx * 4 + 1]; + } + u32 uVar7 = i_entry->mMaxFrame; + while (uVar7 > 1) { + u32 uVar2 = uVar7 >> 1; + if (i_frame >= i_data[uVar2 * 4]) { + i_data += uVar2 * 4; + uVar7 = uVar7 - uVar2; + } else { + uVar7 = uVar2; + } + } + return J3DHermiteInterpolation(i_frame, &i_data[0], &i_data[1], &i_data[3], + &i_data[4], &i_data[5], &i_data[6]); + } } /* 80329A34-80329E5C 324374 0428+00 0/0 1/1 0/0 .text * calcTransform__18J3DAnmTransformKeyCFfUsP16J3DTransformInfo */ -void J3DAnmTransformKey::calcTransform(f32 param_0, u16 param_1, - J3DTransformInfo* param_2) const { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 803CED50-803CED60 02BE70 0010+00 2/2 0/0 0/0 .data __vt__16J3DAnmTexPattern */ -SECTION_DATA extern void* __vt__16J3DAnmTexPattern[4] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__16J3DAnmTexPatternFv, - (void*)getKind__16J3DAnmTexPatternCFv, -}; - -/* 803CED60-803CED70 02BE80 0010+00 2/2 0/0 0/0 .data __vt__15J3DAnmTevRegKey */ -SECTION_DATA extern void* __vt__15J3DAnmTevRegKey[4] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__15J3DAnmTevRegKeyFv, - (void*)getKind__15J3DAnmTevRegKeyCFv, -}; - -/* 803CED70-803CED84 02BE90 0014+00 2/2 0/0 0/0 .data __vt__14J3DAnmColorKey */ -SECTION_DATA extern void* __vt__14J3DAnmColorKey[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__14J3DAnmColorKeyFv, - (void*)getKind__14J3DAnmColorKeyCFv, - (void*)getColor__14J3DAnmColorKeyCFUsP8_GXColor, -}; - -/* 803CED84-803CED98 02BEA4 0014+00 2/2 0/0 0/0 .data __vt__15J3DAnmColorFull */ -SECTION_DATA extern void* __vt__15J3DAnmColorFull[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__15J3DAnmColorFullFv, - (void*)getKind__15J3DAnmColorFullCFv, - (void*)getColor__15J3DAnmColorFullCFUsP8_GXColor, -}; - -/* 803CED98-803CEDAC 02BEB8 0014+00 4/4 0/0 0/0 .data __vt__11J3DAnmColor */ -SECTION_DATA extern void* __vt__11J3DAnmColor[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__11J3DAnmColorFv, - (void*)getKind__11J3DAnmColorCFv, - (void*)getColor__11J3DAnmColorCFUsP8_GXColor, -}; - -/* 803CEDAC-803CEDC0 02BECC 0014+00 2/2 0/0 0/0 .data __vt__17J3DAnmVtxColorKey */ -SECTION_DATA extern void* __vt__17J3DAnmVtxColorKey[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__17J3DAnmVtxColorKeyFv, - (void*)getKind__17J3DAnmVtxColorKeyCFv, - (void*)getColor__17J3DAnmVtxColorKeyCFUcUsP8_GXColor, -}; - -/* 803CEDC0-803CEDD4 02BEE0 0014+00 2/2 0/0 0/0 .data __vt__18J3DAnmVtxColorFull */ -SECTION_DATA extern void* __vt__18J3DAnmVtxColorFull[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__18J3DAnmVtxColorFullFv, - (void*)getKind__18J3DAnmVtxColorFullCFv, - (void*)getColor__18J3DAnmVtxColorFullCFUcUsP8_GXColor, -}; - -/* 803CEDD4-803CEDE8 02BEF4 0014+00 4/4 0/0 0/0 .data __vt__14J3DAnmVtxColor */ -SECTION_DATA extern void* __vt__14J3DAnmVtxColor[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__14J3DAnmVtxColorFv, - (void*)getKind__14J3DAnmVtxColorCFv, - (void*)getColor__14J3DAnmVtxColorCFUcUsP8_GXColor, -}; - -/* 803CEDE8-803CEDFC 02BF08 0014+00 1/1 1/1 0/0 .data __vt__16J3DAnmClusterKey */ -SECTION_DATA extern void* __vt__16J3DAnmClusterKey[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__16J3DAnmClusterKeyFv, - (void*)getKind__16J3DAnmClusterKeyCFv, - (void*)getWeight__16J3DAnmClusterKeyCFUs, -}; - -/* 803CEDFC-803CEE10 02BF1C 0014+00 3/3 1/1 0/0 .data __vt__13J3DAnmCluster */ -SECTION_DATA extern void* __vt__13J3DAnmCluster[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__13J3DAnmClusterFv, - (void*)getKind__13J3DAnmClusterCFv, - (void*)getWeight__13J3DAnmClusterCFUs, -}; - -/* 803CEE10-803CEE24 02BF30 0014+00 1/1 1/1 0/0 .data __vt__17J3DAnmClusterFull */ -SECTION_DATA extern void* __vt__17J3DAnmClusterFull[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__17J3DAnmClusterFullFv, - (void*)getKind__17J3DAnmClusterFullCFv, - (void*)getWeight__17J3DAnmClusterFullCFUs, -}; - -/* 803CEE24-803CEE34 02BF44 0010+00 2/2 0/0 0/0 .data __vt__19J3DAnmTextureSRTKey */ -SECTION_DATA extern void* __vt__19J3DAnmTextureSRTKey[4] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__19J3DAnmTextureSRTKeyFv, - (void*)getKind__19J3DAnmTextureSRTKeyCFv, -}; +void J3DAnmTransformKey::calcTransform(f32 i_frame, u16 i_index, + J3DTransformInfo* o_transform) const { + u16 idx = i_index * 3; + J3DAnmTransformKeyTable* entryX = &mAnmTable[idx]; + J3DAnmTransformKeyTable* entryY = &mAnmTable[idx + 1]; + J3DAnmTransformKeyTable* entryZ = &mAnmTable[idx + 2]; + switch (entryX->mScaleInfo.mMaxFrame) { + case 0: + o_transform->mScale.x = 1.0f; + break; + case 1: + o_transform->mScale.x = mScaleData[entryX->mScaleInfo.mOffset]; + break; + default: + o_transform->mScale.x = J3DGetKeyFrameInterpolation(i_frame, &entryX->mScaleInfo, + &mScaleData[entryX->mScaleInfo.mOffset]); + } + switch (entryY->mScaleInfo.mMaxFrame) { + case 0: + o_transform->mScale.y = 1.0f; + break; + case 1: + o_transform->mScale.y = mScaleData[entryY->mScaleInfo.mOffset]; + break; + default: + o_transform->mScale.y = J3DGetKeyFrameInterpolation(i_frame, &entryY->mScaleInfo, + &mScaleData[entryY->mScaleInfo.mOffset]); + } + switch (entryZ->mScaleInfo.mMaxFrame) { + case 0: + o_transform->mScale.z = 1.0f; + break; + case 1: + o_transform->mScale.z = mScaleData[entryZ->mScaleInfo.mOffset]; + break; + default: + o_transform->mScale.z = J3DGetKeyFrameInterpolation(i_frame, &entryZ->mScaleInfo, + &mScaleData[entryZ->mScaleInfo.mOffset]); + } + switch (entryX->mRotationInfo.mMaxFrame) { + case 0: + o_transform->mRotation.x = 0; + break; + case 1: + o_transform->mRotation.x = mRotData[entryX->mRotationInfo.mOffset] << mDecShift; + break; + default: + o_transform->mRotation.x = (int)J3DGetKeyFrameInterpolation(i_frame, &entryX->mRotationInfo, + &mRotData[entryX->mRotationInfo.mOffset]) << mDecShift; + } + switch (entryY->mRotationInfo.mMaxFrame) { + case 0: + o_transform->mRotation.y = 0; + break; + case 1: + o_transform->mRotation.y = mRotData[entryY->mRotationInfo.mOffset] << mDecShift; + break; + default: + o_transform->mRotation.y = (int)J3DGetKeyFrameInterpolation(i_frame, &entryY->mRotationInfo, + &mRotData[entryY->mRotationInfo.mOffset]) << mDecShift; + } + switch (entryZ->mRotationInfo.mMaxFrame) { + case 0: + o_transform->mRotation.z = 0; + break; + case 1: + o_transform->mRotation.z = mRotData[entryZ->mRotationInfo.mOffset] << mDecShift; + break; + default: + o_transform->mRotation.z = (int)J3DGetKeyFrameInterpolation(i_frame, &entryZ->mRotationInfo, + &mRotData[entryZ->mRotationInfo.mOffset]) << mDecShift; + } + switch (entryX->mTranslateInfo.mMaxFrame) { + case 0: + o_transform->mTranslate.x = 0.0f; + break; + case 1: + o_transform->mTranslate.x = mTransData[entryX->mTranslateInfo.mOffset]; + break; + default: + o_transform->mTranslate.x = J3DGetKeyFrameInterpolation(i_frame, &entryX->mTranslateInfo, + &mTransData[entryX->mTranslateInfo.mOffset]); + } + switch (entryY->mTranslateInfo.mMaxFrame) { + case 0: + o_transform->mTranslate.y = 0.0f; + break; + case 1: + o_transform->mTranslate.y = mTransData[entryY->mTranslateInfo.mOffset]; + break; + default: + o_transform->mTranslate.y = J3DGetKeyFrameInterpolation(i_frame, &entryY->mTranslateInfo, + &mTransData[entryY->mTranslateInfo.mOffset]); + } + switch (entryZ->mTranslateInfo.mMaxFrame) { + case 0: + o_transform->mTranslate.z = 0.0f; + break; + case 1: + o_transform->mTranslate.z = mTransData[entryZ->mTranslateInfo.mOffset]; + break; + default: + o_transform->mTranslate.z = J3DGetKeyFrameInterpolation(i_frame, &entryZ->mTranslateInfo, + &mTransData[entryZ->mTranslateInfo.mOffset]); + } +} /* 80329E5C-80329F14 32479C 00B8+00 0/0 2/2 0/0 .text __ct__19J3DAnmTextureSRTKeyFv */ J3DAnmTextureSRTKey::J3DAnmTextureSRTKey() : J3DAnmBase(0) { @@ -485,39 +682,113 @@ J3DAnmTextureSRTKey::J3DAnmTextureSRTKey() : J3DAnmBase(0) { mRotNum = 0; mScaleNum = 0; mTrackNum = 0; - mAnmTable = 0; - mTransData = 0; - mScaleData = 0; - mRotData = 0; + mAnmTable = NULL; + mTransData = NULL; + mScaleData = NULL; + mRotData = NULL; field_0x48 = 0; field_0x46 = 0; field_0x44 = 0; field_0x4a = 0; - field_0x58 = 0; - field_0x54 = 0; - field_0x4c = 0; - field_0x50 = 0; + field_0x58 = NULL; + field_0x54 = NULL; + field_0x4c = NULL; + field_0x50 = NULL; mTexMtxCalcType = 0; } /* 80329F14-8032A184 324854 0270+00 0/0 1/1 0/0 .text * calcTransform__19J3DAnmTextureSRTKeyCFfUsP17J3DTextureSRTInfo */ -void J3DAnmTextureSRTKey::calcTransform(f32 param_0, u16 param_1, - J3DTextureSRTInfo* param_2) const { - // NONMATCHING +void J3DAnmTextureSRTKey::calcTransform(f32 i_frame, u16 i_index, + J3DTextureSRTInfo* o_texinfo) const { + u16 idx = i_index * 3; + J3DAnmTransformKeyTable* entryX = &mAnmTable[idx]; + J3DAnmTransformKeyTable* entryY = &mAnmTable[idx + 1]; + J3DAnmTransformKeyTable* entryRot = &mAnmTable[idx + 2]; + switch (entryX->mScaleInfo.mMaxFrame) { + case 0: + o_texinfo->mScaleX = 1.0f; + break; + case 1: + o_texinfo->mScaleX = mScaleData[entryX->mScaleInfo.mOffset]; + break; + default: + o_texinfo->mScaleX = J3DGetKeyFrameInterpolation(i_frame, &entryX->mScaleInfo, + &mScaleData[entryX->mScaleInfo.mOffset]); + } + switch (entryY->mScaleInfo.mMaxFrame) { + case 0: + o_texinfo->mScaleY = 1.0f; + break; + case 1: + o_texinfo->mScaleY = mScaleData[entryY->mScaleInfo.mOffset]; + break; + default: + o_texinfo->mScaleY = J3DGetKeyFrameInterpolation(i_frame, &entryY->mScaleInfo, + &mScaleData[entryY->mScaleInfo.mOffset]); + } + switch (entryRot->mRotationInfo.mMaxFrame) { + case 0: + o_texinfo->mRotation = 0; + break; + case 1: + o_texinfo->mRotation = mRotData[entryRot->mRotationInfo.mOffset] << mDecShift; + break; + default: + o_texinfo->mRotation = (int)J3DGetKeyFrameInterpolation(i_frame, &entryRot->mRotationInfo, + &mRotData[entryRot->mRotationInfo.mOffset]) << mDecShift; + } + switch (entryX->mTranslateInfo.mMaxFrame) { + case 0: + o_texinfo->mTranslationX = 0.0f; + break; + case 1: + o_texinfo->mTranslationX = mTransData[entryX->mTranslateInfo.mOffset]; + break; + default: + o_texinfo->mTranslationX = J3DGetKeyFrameInterpolation(i_frame, &entryX->mTranslateInfo, + &mTransData[entryX->mTranslateInfo.mOffset]); + } + switch (entryY->mTranslateInfo.mMaxFrame) { + case 0: + o_texinfo->mTranslationY = 0.0f; + break; + case 1: + o_texinfo->mTranslationY = mTransData[entryY->mTranslateInfo.mOffset]; + break; + default: + o_texinfo->mTranslationY = J3DGetKeyFrameInterpolation(i_frame, &entryY->mTranslateInfo, + &mTransData[entryY->mTranslateInfo.mOffset]); + } } /* 8032A184-8032A218 324AC4 0094+00 1/0 0/0 0/0 .text getWeight__17J3DAnmClusterFullCFUs */ -f32 J3DAnmClusterFull::getWeight(u16 param_0) const { - // NONMATCHING +f32 J3DAnmClusterFull::getWeight(u16 i_index) const { + int maxFrame = mAnmTable[i_index].mMaxFrame; + int frame = (int)(mFrame + 0.5f); + if (mFrame < 0.0f) { + return mWeight[mAnmTable[i_index].mOffset]; + } else if (frame >= maxFrame) { + return mWeight[mAnmTable[i_index].mOffset + (maxFrame - 1)]; + } else { + return mWeight[mAnmTable[i_index].mOffset + frame]; + } } /* 8032A218-8032A29C 324B58 0084+00 1/0 0/0 0/0 .text getWeight__16J3DAnmClusterKeyCFUs */ -f32 J3DAnmClusterKey::getWeight(u16 param_0) const { - // NONMATCHING +f32 J3DAnmClusterKey::getWeight(u16 i_index) const { + switch (mAnmTable[i_index].mWeightTable.mMaxFrame) { + case 0: + return 1.0f; + case 1: + return mWeight[mAnmTable[i_index].mWeightTable.mOffset]; + default: + return J3DGetKeyFrameInterpolation(mFrame, &mAnmTable[i_index].mWeightTable, + &mWeight[mAnmTable[i_index].mWeightTable.mOffset]); + } } /* 8032A29C-8032A30C 324BDC 0070+00 2/2 0/0 0/0 .text __ct__14J3DAnmVtxColorFv */ @@ -526,7 +797,7 @@ J3DAnmVtxColor::J3DAnmVtxColor() : J3DAnmBase(0) { mAnmTableNum[i] = 0; } for (int i = 0; i < 2; i++) { - mAnmVtxColorIndexData[i] = 0; + mAnmVtxColorIndexData[i] = NULL; } } @@ -534,14 +805,42 @@ J3DAnmVtxColor::J3DAnmVtxColor() : J3DAnmBase(0) { /* 8032A30C-8032A368 324C4C 005C+00 0/0 1/1 0/0 .text __ct__18J3DAnmVtxColorFullFv */ J3DAnmVtxColorFull::J3DAnmVtxColorFull() { for (int i = 0; i < 2; i++) { - mpTable[i] = 0; + mpTable[i] = NULL; } } /* 8032A368-8032A4E0 324CA8 0178+00 1/0 0/0 0/0 .text * getColor__18J3DAnmVtxColorFullCFUcUsP8_GXColor */ -void J3DAnmVtxColorFull::getColor(u8 param_0, u16 param_1, _GXColor* param_2) const { - // NONMATCHING +void J3DAnmVtxColorFull::getColor(u8 i_table, u16 i_index, GXColor* o_color) const { + J3DAnmColorFullTable* entry = &mpTable[i_table][i_index]; + if (mFrame < 0.0f) { + o_color->r = mColorR[entry->mROffset]; + o_color->g = mColorG[entry->mGOffset]; + o_color->b = mColorB[entry->mBOffset]; + o_color->a = mColorA[entry->mAOffset]; + } else { + int frame = (int)(mFrame + 0.5f); + if (frame >= entry->mRMaxFrame) { + o_color->r = mColorR[entry->mROffset + (entry->mRMaxFrame - 1)]; + } else { + o_color->r = mColorR[entry->mROffset + frame]; + } + if (frame >= entry->mGMaxFrame) { + o_color->g = mColorG[entry->mGOffset + (entry->mGMaxFrame - 1)]; + } else { + o_color->g = mColorG[entry->mGOffset + frame]; + } + if (frame >= entry->mBMaxFrame) { + o_color->b = mColorB[entry->mBOffset + (entry->mBMaxFrame - 1)]; + } else { + o_color->b = mColorB[entry->mBOffset + frame]; + } + if (frame >= entry->mAMaxFrame) { + o_color->a = mColorA[entry->mAOffset + (entry->mAMaxFrame - 1)]; + } else { + o_color->a = mColorA[entry->mAOffset + frame]; + } + } } /* 8032A4E0-8032A53C 324E20 005C+00 0/0 1/1 0/0 .text __ct__17J3DAnmVtxColorKeyFv */ @@ -551,52 +850,230 @@ J3DAnmVtxColorKey::J3DAnmVtxColorKey() { } } -/* ############################################################################################## */ -/* 80456458-8045645C 004A58 0004+00 3/3 0/0 0/0 .sdata2 @1499 */ -SECTION_SDATA2 static f32 lit_1499 = 255.0f; - /* 8032A53C-8032A828 324E7C 02EC+00 1/0 0/0 0/0 .text * getColor__17J3DAnmVtxColorKeyCFUcUsP8_GXColor */ -void J3DAnmVtxColorKey::getColor(u8 param_0, u16 param_1, _GXColor* param_2) const { - // NONMATCHING +void J3DAnmVtxColorKey::getColor(u8 i_table, u16 i_index, GXColor* o_color) const { + J3DAnmColorKeyTable* entry = &mpTable[i_table][i_index]; + f32 col; + switch (entry->mRInfo.mMaxFrame) { + case 0: + o_color->r = 0; + break; + case 1: + o_color->r = mColorR[entry->mRInfo.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mRInfo, + &mColorR[entry->mRInfo.mOffset]); + if (col <= 0.0f) { + o_color->r = 0; + } else if (col <= 255.0f) { + OSf32tou8(&col, &o_color->r); + } else { + o_color->r = 255; + } + } + switch (entry->mGInfo.mMaxFrame) { + case 0: + o_color->g = 0; + break; + case 1: + o_color->g = mColorG[entry->mGInfo.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mGInfo, + &mColorG[entry->mGInfo.mOffset]); + if (col <= 0.0f) { + o_color->g = 0; + } else if (col <= 255.0f) { + OSf32tou8(&col, &o_color->g); + } else { + o_color->g = 255; + } + } + switch (entry->mBInfo.mMaxFrame) { + case 0: + o_color->b = 0; + break; + case 1: + o_color->b = mColorB[entry->mBInfo.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mBInfo, + &mColorB[entry->mBInfo.mOffset]); + if (col <= 0.0f) { + o_color->b = 0; + } else if (col <= 255.0f) { + OSf32tou8(&col, &o_color->b); + } else { + o_color->b = 255; + } + } + switch (entry->mAInfo.mMaxFrame) { + case 0: + o_color->a = 0; + break; + case 1: + o_color->a = mColorA[entry->mAInfo.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mAInfo, + &mColorA[entry->mAInfo.mOffset]); + if (col <= 0.0f) { + o_color->a = 0; + } else if (col <= 255.0f) { + OSf32tou8(&col, &o_color->a); + } else { + o_color->a = 255; + } + } } /* 8032A828-8032A8A4 325168 007C+00 2/2 0/0 0/0 .text __ct__11J3DAnmColorFv */ -J3DAnmColor::J3DAnmColor() : J3DAnmBase(0), field_0xc(0), field_0xe(0), field_0x10(0), field_0x12(0), mUpdateMaterialNum(0), mUpdateMaterialID(NULL) {} +J3DAnmColor::J3DAnmColor() : J3DAnmBase(0), field_0xc(0), field_0xe(0), field_0x10(0), + field_0x12(0), mUpdateMaterialNum(0), mUpdateMaterialID(NULL) {} /* 8032A8A4-8032A93C 3251E4 0098+00 0/0 1/1 0/0 .text * searchUpdateMaterialID__11J3DAnmColorFP16J3DMaterialTable */ -void J3DAnmColor::searchUpdateMaterialID(J3DMaterialTable* param_0) { - // NONMATCHING +void J3DAnmColor::searchUpdateMaterialID(J3DMaterialTable* i_materialTable) { + for (u16 i = 0; i < mUpdateMaterialNum; i++) { + int index = i_materialTable->getMaterialName()->getIndex(mUpdateMaterialName.getName(i)); + if (index != -1) { + mUpdateMaterialID[i] = index; + } else { + mUpdateMaterialID[i] = 0xffff; + } + } } /* 8032A93C-8032A990 32527C 0054+00 0/0 1/1 0/0 .text __ct__15J3DAnmColorFullFv */ J3DAnmColorFull::J3DAnmColorFull() { - mColorR = 0; - mColorG = 0; - mColorB = 0; - mColorA = 0; - mAnmTable = 0; + mColorR = NULL; + mColorG = NULL; + mColorB = NULL; + mColorA = NULL; + mAnmTable = NULL; } /* 8032A990-8032AB00 3252D0 0170+00 1/0 0/0 0/0 .text getColor__15J3DAnmColorFullCFUsP8_GXColor */ -void J3DAnmColorFull::getColor(u16 param_0, _GXColor* param_1) const { - // NONMATCHING +void J3DAnmColorFull::getColor(u16 i_index, GXColor* o_color) const { + J3DAnmColorFullTable* entry = &mAnmTable[i_index]; + if (mFrame < 0.0f) { + o_color->r = mColorR[entry->mROffset]; + o_color->g = mColorG[entry->mGOffset]; + o_color->b = mColorB[entry->mBOffset]; + o_color->a = mColorA[entry->mAOffset]; + } else { + int frame = (int)(mFrame + 0.5f); + if (frame >= entry->mRMaxFrame) { + o_color->r = mColorR[entry->mROffset + (entry->mRMaxFrame - 1)]; + } else { + o_color->r = mColorR[entry->mROffset + frame]; + } + if (frame >= entry->mGMaxFrame) { + o_color->g = mColorG[entry->mGOffset + (entry->mGMaxFrame - 1)]; + } else { + o_color->g = mColorG[entry->mGOffset + frame]; + } + if (frame >= entry->mBMaxFrame) { + o_color->b = mColorB[entry->mBOffset + (entry->mBMaxFrame - 1)]; + } else { + o_color->b = mColorB[entry->mBOffset + frame]; + } + if (frame >= entry->mAMaxFrame) { + o_color->a = mColorA[entry->mAOffset + (entry->mAMaxFrame - 1)]; + } else { + o_color->a = mColorA[entry->mAOffset + frame]; + } + } } /* 8032AB00-8032AB54 325440 0054+00 0/0 1/1 0/0 .text __ct__14J3DAnmColorKeyFv */ J3DAnmColorKey::J3DAnmColorKey() { - field_0x2c = 0; - field_0x30 = 0; - field_0x34 = 0; - field_0x38 = 0; - field_0x3c = 0; + mColorR = NULL; + mColorG = NULL; + mColorB = NULL; + mColorA = NULL; + mAnmTable = NULL; } /* 8032AB54-8032AE18 325494 02C4+00 1/0 0/0 0/0 .text getColor__14J3DAnmColorKeyCFUsP8_GXColor */ -void J3DAnmColorKey::getColor(u16 param_0, _GXColor* param_1) const { - // NONMATCHING +void J3DAnmColorKey::getColor(u16 i_index, GXColor* o_color) const { + J3DAnmColorKeyTable* entry = &mAnmTable[i_index]; + f32 col; + switch (entry->mRInfo.mMaxFrame) { + case 0: + o_color->r = 0; + break; + case 1: + o_color->r = mColorR[entry->mRInfo.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mRInfo, + &mColorR[entry->mRInfo.mOffset]); + if (col < 0.0f) { + o_color->r = 0; + } else if (col > 255.0f) { + o_color->r = 255; + } else { + OSf32tou8(&col, &o_color->r); + } + } + switch (entry->mGInfo.mMaxFrame) { + case 0: + o_color->g = 0; + break; + case 1: + o_color->g = mColorG[entry->mGInfo.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mGInfo, + &mColorG[entry->mGInfo.mOffset]); + if (col < 0.0f) { + o_color->g = 0; + } else if (col > 255.0f) { + o_color->g = 255; + } else { + OSf32tou8(&col, &o_color->g); + } + } + switch (entry->mBInfo.mMaxFrame) { + case 0: + o_color->b = 0; + break; + case 1: + o_color->b = mColorB[entry->mBInfo.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mBInfo, + &mColorB[entry->mBInfo.mOffset]); + if (col < 0.0f) { + o_color->b = 0; + } else if (col > 255.0f) { + o_color->b = 255; + } else { + OSf32tou8(&col, &o_color->b); + } + } + switch (entry->mAInfo.mMaxFrame) { + case 0: + o_color->a = 0; + break; + case 1: + o_color->a = mColorA[entry->mAInfo.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mAInfo, + &mColorA[entry->mAInfo.mOffset]); + if (col < 0.0f) { + o_color->a = 0; + } else if (col > 255.0f) { + o_color->a = 255; + } else { + OSf32tou8(&col, &o_color->a); + } + } } /* 8032AE18-8032AED8 325758 00C0+00 0/0 1/1 0/0 .text __ct__15J3DAnmTevRegKeyFv */ @@ -611,34 +1088,42 @@ J3DAnmTevRegKey::J3DAnmTevRegKey() : J3DAnmBase(0) { mKRegDataCountB = 0; mKRegDataCountG = 0; mKRegDataCountR = 0; - mKRegUpdateMaterialID = 0; - mCRegUpdateMaterialID = 0; - mAnmCRegDataA = 0; - mAnmCRegDataB = 0; - mAnmCRegDataG = 0; - mAnmCRegDataR = 0; - mAnmKRegDataA = 0; - mAnmKRegDataB = 0; - mAnmKRegDataG = 0; - mAnmKRegDataR = 0; + mKRegUpdateMaterialID = NULL; + mCRegUpdateMaterialID = NULL; + mAnmCRegDataA = NULL; + mAnmCRegDataB = NULL; + mAnmCRegDataG = NULL; + mAnmCRegDataR = NULL; + mAnmKRegDataA = NULL; + mAnmKRegDataB = NULL; + mAnmKRegDataG = NULL; + mAnmKRegDataR = NULL; } /* 8032AED8-8032AF50 325818 0078+00 0/0 2/2 0/0 .text __ct__16J3DAnmTexPatternFv */ -J3DAnmTexPattern::J3DAnmTexPattern() : J3DAnmBase(0), mTextureIndex(NULL), mAnmTable(NULL), field_0x14(0), mUpdateMaterialNum(0), mUpdateMaterialID(NULL) {} +J3DAnmTexPattern::J3DAnmTexPattern() : J3DAnmBase(0), mTextureIndex(NULL), mAnmTable(NULL), + field_0x14(0), mUpdateMaterialNum(0), mUpdateMaterialID(NULL) {} /* 8032AF50-8032B004 325890 00B4+00 0/0 1/1 72/72 .text getTexNo__16J3DAnmTexPatternCFUsPUs */ -void J3DAnmTexPattern::getTexNo(u16 param_0, u16* param_1) const { - // NONMATCHING +void J3DAnmTexPattern::getTexNo(u16 i_index, u16* o_texNo) const { + u32 maxFrame = mAnmTable[i_index].mMaxFrame; + if (mFrame < 0.0f) { + *o_texNo = mTextureIndex[mAnmTable[i_index].mOffset]; + } else if (mFrame >= maxFrame) { + *o_texNo = mTextureIndex[mAnmTable[i_index].mOffset + (maxFrame - 1)]; + } else { + *o_texNo = mTextureIndex[mAnmTable[i_index].mOffset + (int)mFrame]; + } } /* 8032B004-8032B09C 325944 0098+00 1/1 1/1 0/0 .text * searchUpdateMaterialID__16J3DAnmTexPatternFP16J3DMaterialTable */ -void J3DAnmTexPattern::searchUpdateMaterialID(J3DMaterialTable* param_0) { +void J3DAnmTexPattern::searchUpdateMaterialID(J3DMaterialTable* i_materialTable) { for (u16 i = 0; i < mUpdateMaterialNum; i++) { - s32 r3 = param_0->getMaterialName()->getIndex(mUpdateMaterialName.getName(i)); - if (r3 != -1) { - mUpdateMaterialID[i] = r3; + s32 index = i_materialTable->getMaterialName()->getIndex(mUpdateMaterialName.getName(i)); + if (index != -1) { + mUpdateMaterialID[i] = index; } else { mUpdateMaterialID[i] = -1; } @@ -647,25 +1132,25 @@ void J3DAnmTexPattern::searchUpdateMaterialID(J3DMaterialTable* param_0) { /* 8032B09C-8032B0C0 3259DC 0024+00 0/0 4/4 1/1 .text * searchUpdateMaterialID__16J3DAnmTexPatternFP12J3DModelData */ -void J3DAnmTexPattern::searchUpdateMaterialID(J3DModelData* param_0) { - searchUpdateMaterialID(¶m_0->getMaterialTable()); +void J3DAnmTexPattern::searchUpdateMaterialID(J3DModelData* i_modelData) { + searchUpdateMaterialID(&i_modelData->getMaterialTable()); } /* 8032B0C0-8032B1D4 325A00 0114+00 1/1 1/1 0/0 .text * searchUpdateMaterialID__19J3DAnmTextureSRTKeyFP16J3DMaterialTable */ -void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DMaterialTable* param_0) { +void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DMaterialTable* i_materialTable) { for (u16 i = 0; i < u16(mTrackNum / 3); i++) { - s32 r3 = param_0->getMaterialName()->getIndex(mUpdateMaterialName.getName(i)); - if (r3 != -1) { - mUpdateMaterialID[i] = r3; + s32 index = i_materialTable->getMaterialName()->getIndex(mUpdateMaterialName.getName(i)); + if (index != -1) { + mUpdateMaterialID[i] = index; } else { mUpdateMaterialID[i] = -1; } } for (u16 i = 0; i < u16(field_0x4a / 3); i++) { - s32 r3 = param_0->getMaterialName()->getIndex(mPostUpdateMaterialName.getName(i)); - if (r3 != -1) { - mPostUpdateMaterialID[i] = r3; + s32 index = i_materialTable->getMaterialName()->getIndex(mPostUpdateMaterialName.getName(i)); + if (index != -1) { + mPostUpdateMaterialID[i] = index; } else { mPostUpdateMaterialID[i] = -1; } @@ -674,249 +1159,191 @@ void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DMaterialTable* param_0) { /* 8032B1D4-8032B1F8 325B14 0024+00 0/0 8/8 6/6 .text * searchUpdateMaterialID__19J3DAnmTextureSRTKeyFP12J3DModelData */ -void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DModelData* param_0) { - searchUpdateMaterialID(¶m_0->getMaterialTable()); +void J3DAnmTextureSRTKey::searchUpdateMaterialID(J3DModelData* i_modelData) { + searchUpdateMaterialID(&i_modelData->getMaterialTable()); } -/* ############################################################################################## */ -/* 8045645C-80456460 004A5C 0004+00 1/1 0/0 0/0 .sdata2 @1817 */ -SECTION_SDATA2 static f32 lit_1817 = -1024.0f; - -/* 80456460-80456468 004A60 0004+04 1/1 0/0 0/0 .sdata2 @1818 */ -SECTION_SDATA2 static f32 lit_1818[1 + 1 /* padding */] = { - 1023.0f, - /* padding */ - 0.0f, -}; - /* 8032B1F8-8032B4BC 325B38 02C4+00 0/0 2/2 1/1 .text * getTevColorReg__15J3DAnmTevRegKeyCFUsP11_GXColorS10 */ -void J3DAnmTevRegKey::getTevColorReg(u16 param_0, _GXColorS10* param_1) const { - // NONMATCHING +void J3DAnmTevRegKey::getTevColorReg(u16 i_index, GXColorS10* o_color) const { + J3DAnmCRegKeyTable* entry = &mAnmCRegKeyTable[i_index]; + f32 col; + switch (entry->mRTable.mMaxFrame) { + case 0: + o_color->r = 0; + break; + case 1: + o_color->r = mAnmCRegDataR[entry->mRTable.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mRTable, + &mAnmCRegDataR[entry->mRTable.mOffset]); + if (col < -0x400) { + o_color->r = -0x400; + } else if (col > 0x3FF) { + o_color->r = 0x3FF; + } else { + OSf32tos16(&col, &o_color->r); + } + } + switch (entry->mGTable.mMaxFrame) { + case 0: + o_color->g = 0; + break; + case 1: + o_color->g = mAnmCRegDataG[entry->mGTable.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mGTable, + &mAnmCRegDataG[entry->mGTable.mOffset]); + if (col < -0x400) { + o_color->g = -0x400; + } else if (col > 0x3FF) { + o_color->g = 0x3FF; + } else { + OSf32tos16(&col, &o_color->g); + } + } + switch (entry->mBTable.mMaxFrame) { + case 0: + o_color->b = 0; + break; + case 1: + o_color->b = mAnmCRegDataB[entry->mBTable.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mBTable, + &mAnmCRegDataB[entry->mBTable.mOffset]); + if (col < -0x400) { + o_color->b = -0x400; + } else if (col > 0x3FF) { + o_color->b = 0x3FF; + } else { + OSf32tos16(&col, &o_color->b); + } + } + switch (entry->mATable.mMaxFrame) { + case 0: + o_color->a = 0; + break; + case 1: + o_color->a = mAnmCRegDataA[entry->mATable.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mATable, + &mAnmCRegDataA[entry->mATable.mOffset]); + if (col < -0x400) { + o_color->a = -0x400; + } else if (col > 0x3FF) { + o_color->a = 0x3FF; + } else { + OSf32tos16(&col, &o_color->a); + } + } } /* 8032B4BC-8032B780 325DFC 02C4+00 0/0 1/1 1/1 .text * getTevKonstReg__15J3DAnmTevRegKeyCFUsP8_GXColor */ -void J3DAnmTevRegKey::getTevKonstReg(u16 param_0, _GXColor* param_1) const { - // NONMATCHING +void J3DAnmTevRegKey::getTevKonstReg(u16 i_index, GXColor* o_color) const { + J3DAnmKRegKeyTable* entry = &mAnmKRegKeyTable[i_index]; + f32 col; + switch (entry->mRTable.mMaxFrame) { + case 0: + o_color->r = 0; + break; + case 1: + o_color->r = mAnmKRegDataR[entry->mRTable.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mRTable, + &mAnmKRegDataR[entry->mRTable.mOffset]); + if (col < 0) { + o_color->r = 0; + } else if (col > 0xFF) { + o_color->r = 0xFF; + } else { + OSf32tou8(&col, &o_color->r); + } + } + switch (entry->mGTable.mMaxFrame) { + case 0: + o_color->g = 0; + break; + case 1: + o_color->g = mAnmKRegDataG[entry->mGTable.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mGTable, + &mAnmKRegDataG[entry->mGTable.mOffset]); + if (col < 0) { + o_color->g = 0; + } else if (col > 0xFF) { + o_color->g = 0xFF; + } else { + OSf32tou8(&col, &o_color->g); + } + } + switch (entry->mBTable.mMaxFrame) { + case 0: + o_color->b = 0; + break; + case 1: + o_color->b = mAnmKRegDataB[entry->mBTable.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mBTable, + &mAnmKRegDataB[entry->mBTable.mOffset]); + if (col < 0) { + o_color->b = 0; + } else if (col > 0xFF) { + o_color->b = 0xFF; + } else { + OSf32tou8(&col, &o_color->b); + } + } + switch (entry->mATable.mMaxFrame) { + case 0: + o_color->a = 0; + break; + case 1: + o_color->a = mAnmKRegDataA[entry->mATable.mOffset]; + break; + default: + col = J3DGetKeyFrameInterpolation(mFrame, &entry->mATable, + &mAnmKRegDataA[entry->mATable.mOffset]); + if (col < 0) { + o_color->a = 0; + } else if (col > 0xFF) { + o_color->a = 0xFF; + } else { + OSf32tou8(&col, &o_color->a); + } + } } /* 8032B780-8032B87C 3260C0 00FC+00 1/1 1/1 0/0 .text * searchUpdateMaterialID__15J3DAnmTevRegKeyFP16J3DMaterialTable */ -void J3DAnmTevRegKey::searchUpdateMaterialID(J3DMaterialTable* param_0) { - // NONMATCHING +void J3DAnmTevRegKey::searchUpdateMaterialID(J3DMaterialTable* i_materialTable) { + for (u16 i = 0; i < mCRegUpdateMaterialNum; i++) { + s32 index = i_materialTable->getMaterialName()->getIndex(mCRegUpdateMaterialName.getName(i)); + if (index != -1) { + mCRegUpdateMaterialID[i] = index; + } else { + mCRegUpdateMaterialID[i] = -1; + } + } + for (u16 i = 0; i < mKRegUpdateMaterialNum; i++) { + s32 index = i_materialTable->getMaterialName()->getIndex(mKRegUpdateMaterialName.getName(i)); + if (index != -1) { + mKRegUpdateMaterialID[i] = index; + } else { + mKRegUpdateMaterialID[i] = -1; + } + } } /* 8032B87C-8032B8A0 3261BC 0024+00 0/0 9/9 4/4 .text * searchUpdateMaterialID__15J3DAnmTevRegKeyFP12J3DModelData */ -void J3DAnmTevRegKey::searchUpdateMaterialID(J3DModelData* param_0) { - searchUpdateMaterialID(¶m_0->getMaterialTable()); -} - -/* 8032B8A0-8032BAD4 3261E0 0234+00 6/6 0/0 0/0 .text - * J3DGetKeyFrameInterpolation__FfP18J3DAnmKeyTableBasePs */ -extern "C" void func_8032B8A0(void* _this, f32 param_0, J3DAnmKeyTableBase* param_1, - s16* param_2) { - // NONMATCHING -} - -/* 8032BAD4-8032BC50 326414 017C+00 3/3 0/0 0/0 .text - * J3DGetKeyFrameInterpolation__FfP18J3DAnmKeyTableBasePf */ -extern "C" void func_8032BAD4(void* _this, f32 param_0, J3DAnmKeyTableBase* param_1, - f32* param_2) { - // NONMATCHING -} - -/* 8032BC50-8032BCAC 326590 005C+00 1/0 0/0 0/0 .text __dt__14J3DAnmVtxColorFv */ -extern "C" void __dt__14J3DAnmVtxColorFv() { - // asm J3DAnmVtxColor::~J3DAnmVtxColor() { - // NONMATCHING -} - -/* 8032BCAC-8032BD20 3265EC 0074+00 1/0 0/0 0/0 .text __dt__11J3DAnmColorFv */ -extern "C" void __dt__11J3DAnmColorFv() { - // asm J3DAnmColor::~J3DAnmColor() { - // NONMATCHING -} - -/* 8032BD20-8032BD94 326660 0074+00 1/0 0/0 0/0 .text __dt__16J3DAnmTexPatternFv */ -extern "C" void __dt__16J3DAnmTexPatternFv() { - // asm J3DAnmTexPattern::~J3DAnmTexPattern() { - // NONMATCHING -} - -/* 8032BD94-8032BD9C 3266D4 0008+00 1/0 0/0 0/0 .text getKind__16J3DAnmTexPatternCFv */ -s32 J3DAnmTexPattern::getKind() const { - return 2; +void J3DAnmTevRegKey::searchUpdateMaterialID(J3DModelData* i_modelData) { + searchUpdateMaterialID(&i_modelData->getMaterialTable()); } - -/* 8032BD9C-8032BE24 3266DC 0088+00 1/0 0/0 0/0 .text __dt__15J3DAnmTevRegKeyFv */ -extern "C" void __dt__15J3DAnmTevRegKeyFv() { - // asm J3DAnmTevRegKey::~J3DAnmTevRegKey() { - // NONMATCHING -} - -/* 8032BE24-8032BE2C 326764 0008+00 1/0 0/0 0/0 .text getKind__15J3DAnmTevRegKeyCFv */ -s32 J3DAnmTevRegKey::getKind() const { - return 5; -} - -/* 8032BE2C-8032BEB0 32676C 0084+00 1/0 0/0 0/0 .text __dt__14J3DAnmColorKeyFv */ -extern "C" void __dt__14J3DAnmColorKeyFv() { - // asm J3DAnmColorKey::~J3DAnmColorKey() { - // NONMATCHING -} - -/* 8032BEB0-8032BEB8 3267F0 0008+00 1/0 0/0 0/0 .text getKind__14J3DAnmColorKeyCFv */ -s32 J3DAnmColorKey::getKind() const { - return 11; -} - -/* 8032BEB8-8032BF3C 3267F8 0084+00 1/0 0/0 0/0 .text __dt__15J3DAnmColorFullFv */ -extern "C" void __dt__15J3DAnmColorFullFv() { - // asm J3DAnmColorFull::~J3DAnmColorFull() { - // NONMATCHING -} - -/* 8032BF3C-8032BF44 32687C 0008+00 1/0 0/0 0/0 .text getKind__15J3DAnmColorFullCFv */ -s32 J3DAnmColorFull::getKind() const { - return 10; -} - -/* 8032BF44-8032BF4C 326884 0008+00 1/0 0/0 0/0 .text getKind__11J3DAnmColorCFv */ -s32 J3DAnmColor::getKind() const { - return 1; -} - -/* 8032BF4C-8032BF50 32688C 0004+00 1/0 0/0 0/0 .text getColor__11J3DAnmColorCFUsP8_GXColor */ -void J3DAnmColor::getColor(u16 param_0, _GXColor* param_1) const { - /* empty function */ -} - -/* 8032BF50-8032BFBC 326890 006C+00 1/0 0/0 0/0 .text __dt__17J3DAnmVtxColorKeyFv */ -extern "C" void __dt__17J3DAnmVtxColorKeyFv() { - // asm J3DAnmVtxColorKey::~J3DAnmVtxColorKey() { - // NONMATCHING -} - -/* 8032BFBC-8032BFC4 3268FC 0008+00 1/0 0/0 0/0 .text getKind__17J3DAnmVtxColorKeyCFv */ -s32 J3DAnmVtxColorKey::getKind() const { - return 15; -} - -/* 8032BFC4-8032C030 326904 006C+00 1/0 0/0 0/0 .text __dt__18J3DAnmVtxColorFullFv */ -extern "C" void __dt__18J3DAnmVtxColorFullFv() { - // asm J3DAnmVtxColorFull::~J3DAnmVtxColorFull() { - // NONMATCHING -} - -/* 8032C030-8032C038 326970 0008+00 1/0 0/0 0/0 .text getKind__18J3DAnmVtxColorFullCFv */ -s32 J3DAnmVtxColorFull::getKind() const { - return 14; -} - -/* 8032C038-8032C040 326978 0008+00 1/0 0/0 0/0 .text getKind__14J3DAnmVtxColorCFv */ -s32 J3DAnmVtxColor::getKind() const { - return 7; -} - -/* 8032C040-8032C044 326980 0004+00 1/0 0/0 0/0 .text getColor__14J3DAnmVtxColorCFUcUsP8_GXColor - */ -void J3DAnmVtxColor::getColor(u8 param_0, u16 param_1, _GXColor* param_2) const { - /* empty function */ -} - -/* 8032C044-8032C0B0 326984 006C+00 1/0 0/0 0/0 .text __dt__16J3DAnmClusterKeyFv */ -extern "C" void __dt__16J3DAnmClusterKeyFv() { - // asm J3DAnmClusterKey::~J3DAnmClusterKey() { - // NONMATCHING -} - -/* 8032C0B0-8032C0B8 3269F0 0008+00 1/0 0/0 0/0 .text getKind__16J3DAnmClusterKeyCFv */ -s32 J3DAnmClusterKey::getKind() const { - return 13; -} - -/* 8032C0B8-8032C114 3269F8 005C+00 1/0 0/0 0/0 .text __dt__13J3DAnmClusterFv */ -extern "C" void __dt__13J3DAnmClusterFv() { - // asm J3DAnmCluster::~J3DAnmCluster() { - // NONMATCHING -} - -/* 8032C114-8032C11C 326A54 0008+00 1/0 0/0 0/0 .text getKind__13J3DAnmClusterCFv */ -s32 J3DAnmCluster::getKind() const { - return 3; -} - -/* 8032C11C-8032C124 326A5C 0008+00 1/0 0/0 0/0 .text getWeight__13J3DAnmClusterCFUs */ -f32 J3DAnmCluster::getWeight(u16 param_0) const { - return lit_852; -} - -/* 8032C124-8032C190 326A64 006C+00 1/0 0/0 0/0 .text __dt__17J3DAnmClusterFullFv */ -extern "C" void __dt__17J3DAnmClusterFullFv() { - // asm J3DAnmClusterFull::~J3DAnmClusterFull() { - // NONMATCHING -} - -/* 8032C190-8032C198 326AD0 0008+00 1/0 0/0 0/0 .text getKind__17J3DAnmClusterFullCFv */ -s32 J3DAnmClusterFull::getKind() const { - return 12; -} - -/* 8032C198-8032C220 326AD8 0088+00 1/0 0/0 0/0 .text __dt__19J3DAnmTextureSRTKeyFv */ -extern "C" void __dt__19J3DAnmTextureSRTKeyFv() { - // asm J3DAnmTextureSRTKey::~J3DAnmTextureSRTKey() { - // NONMATCHING -} - -/* 8032C220-8032C228 326B60 0008+00 1/0 0/0 0/0 .text getKind__19J3DAnmTextureSRTKeyCFv - */ -s32 J3DAnmTextureSRTKey::getKind() const { - return 4; -} - -/* ############################################################################################## */ -/* 803CEE34-803CEE48 02BF54 0014+00 1/1 1/1 0/0 .data __vt__27J3DAnmTransformFullWithLerp - */ -SECTION_DATA extern void* __vt__27J3DAnmTransformFullWithLerp[5] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__27J3DAnmTransformFullWithLerpFv, - (void*)getKind__27J3DAnmTransformFullWithLerpCFv, - (void*)getTransform__27J3DAnmTransformFullWithLerpCFUsP16J3DTransformInfo, -}; - -/* 803CEE48-803CEE60 02BF68 0014+04 2/2 1/1 0/0 .data __vt__19J3DAnmTransformFull */ -SECTION_DATA extern void* __vt__19J3DAnmTransformFull[5 + 1 /* padding */] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__19J3DAnmTransformFullFv, - (void*)getKind__19J3DAnmTransformFullCFv, - (void*)getTransform__19J3DAnmTransformFullCFUsP16J3DTransformInfo, - /* padding */ - NULL, -}; - -/* 8032C228-8032C2A4 326B68 007C+00 1/0 0/0 0/0 .text __dt__27J3DAnmTransformFullWithLerpFv */ -extern "C" void __dt__27J3DAnmTransformFullWithLerpFv() { - // asm J3DAnmTransformFullWithLerp::~J3DAnmTransformFullWithLerp() { - // NONMATCHING -} - -/* 8032C2A4-8032C2AC 326BE4 0008+00 1/0 0/0 0/0 .text getKind__27J3DAnmTransformFullWithLerpCFv */ -s32 J3DAnmTransformFullWithLerp::getKind() const { - return 16; -} - -/* 8032C2AC-8032C318 326BEC 006C+00 1/0 0/0 0/0 .text __dt__19J3DAnmTransformFullFv */ -extern "C" void __dt__19J3DAnmTransformFullFv() { - // asm J3DAnmTransformFull::~J3DAnmTransformFull() { - // NONMATCHING -} - -/* 8032C318-8032C320 326C58 0008+00 1/0 0/0 0/0 .text getKind__19J3DAnmTransformFullCFv - */ -s32 J3DAnmTransformFull::getKind() const { - return 9; -} \ No newline at end of file diff --git a/src/JSystem/J3DGraphAnimator/J3DCluster.cpp b/src/JSystem/J3DGraphAnimator/J3DCluster.cpp index 01222291915..dbca675e9bb 100644 --- a/src/JSystem/J3DGraphAnimator/J3DCluster.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DCluster.cpp @@ -6,7 +6,8 @@ #include "JSystem/J3DGraphAnimator/J3DCluster.h" #include "JSystem/J3DGraphAnimator/J3DAnimation.h" #include "JSystem/J3DGraphAnimator/J3DModel.h" -#include "dol2asm.h" +#include "JSystem/JMath/JMATrigonometric.h" +#include "dolphin/base/PPCArch.h" #include "dolphin/os.h" #ifdef DEBUG @@ -20,42 +21,6 @@ #define J3D_ASSERT(COND) #endif -// -// Forward References: -// - -extern "C" void __ct__13J3DDeformDataFv(); -extern "C" void offAllFlag__13J3DDeformDataFUl(); -extern "C" void deform__13J3DDeformDataFP8J3DModel(); -extern "C" void deform__13J3DDeformDataFP15J3DVertexBuffer(); -extern "C" void setAnm__13J3DDeformDataFP13J3DAnmCluster(); -extern "C" void __ct__11J3DDeformerFP13J3DDeformData(); -extern "C" void deform__11J3DDeformerFP15J3DVertexBufferUs(); -extern "C" void deform_VtxPosF32__11J3DDeformerFP15J3DVertexBufferP10J3DClusterP13J3DClusterKeyPf(); -extern "C" void deform_VtxNrmF32__11J3DDeformerFP15J3DVertexBufferP10J3DClusterP13J3DClusterKeyPf(); -extern "C" void deform__11J3DDeformerFP15J3DVertexBufferUsPf(); -extern "C" void normalizeWeight__11J3DDeformerFiPf(); - -// -// External References: -// - -extern "C" void PPCSync(); -extern "C" void __cvt_fp2unsigned(); -extern "C" void _savegpr_21(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_21(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_29(); -extern "C" f32 asinAcosTable___5JMath[1032]; - -// -// Declarations: -// - /* 8032E1F8-8032E230 328B38 0038+00 0/0 1/1 0/0 .text __ct__13J3DDeformDataFv */ J3DDeformData::J3DDeformData() { mClusterNum = 0; @@ -145,68 +110,169 @@ void J3DDeformer::deform(J3DVertexBuffer* buffer, u16 param_1) { } } -/* ############################################################################################## */ -/* 80456470-80456474 004A70 0004+00 2/2 0/0 0/0 .sdata2 @830 */ -SECTION_SDATA2 static f32 lit_830 = 1.0f; - -/* 80456474-80456478 004A74 0004+00 1/1 0/0 0/0 .sdata2 @840 */ -SECTION_SDATA2 static f32 lit_840 = 1.0f; - -/* 80456478-8045647C 004A78 0004+00 1/1 0/0 0/0 .sdata2 None */ -SECTION_SDATA2 static f32 data_80456478 = -1.0f; - -/* 8045647C-80456480 004A7C 0004+00 3/3 0/0 0/0 .sdata2 @866 */ -SECTION_SDATA2 static u8 lit_866[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; - /* 8032E4A4-8032E60C 328DE4 0168+00 1/1 0/0 0/0 .text * deform_VtxPosF32__11J3DDeformerFP15J3DVertexBufferP10J3DClusterP13J3DClusterKeyPf */ -void J3DDeformer::deform_VtxPosF32(J3DVertexBuffer* param_0, J3DCluster* param_1, - J3DClusterKey* param_2, f32* param_3) { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 80456480-80456484 004A80 0004+00 1/1 0/0 0/0 .sdata2 @1020 */ -SECTION_SDATA2 static f32 lit_1020 = -1.0f; - -/* 80456484-80456488 004A84 0004+00 1/1 0/0 0/0 .sdata2 @1021 */ -SECTION_SDATA2 static f32 lit_1021 = 3.1415927410125732f; - -/* 80456488-8045648C 004A88 0004+00 1/1 0/0 0/0 .sdata2 @1022 */ -SECTION_SDATA2 static f32 lit_1022 = 1023.5f; - -/* 8045648C-80456490 004A8C 0004+00 1/1 0/0 0/0 .sdata2 @1023 */ -SECTION_SDATA2 static f32 lit_1023 = 1.5707963705062866f; - -/* 80456490-80456494 004A90 0004+00 1/1 0/0 0/0 .sdata2 @1024 */ -SECTION_SDATA2 static f32 lit_1024 = 57.2957763671875f; - -/* 80456494-80456498 004A94 0004+00 1/1 0/0 0/0 .sdata2 @1025 */ -SECTION_SDATA2 static f32 lit_1025 = 180.0f; +void J3DDeformer::deform_VtxPosF32(J3DVertexBuffer* i_buffer, J3DCluster* i_cluster, + J3DClusterKey* i_key, f32* i_weights) { + int posNum = i_cluster->mPosNum; + int keyNum = i_cluster->mKeyNum; + f32* vtxPosArray = (f32*)i_buffer->getVtxPosArrayPointer(0); + f32* deformVtxPos = mDeformData->getVtxPos(); + u16* iVar9 = i_cluster->field_0x18; + + for (int i = 0; i < posNum; i++) { + int index = iVar9[i] * 3; + vtxPosArray[index] = 0.0f; + vtxPosArray[index + 1] = 0.0f; + vtxPosArray[index + 2] = 0.0f; + } -/* 80456498-804564A0 004A98 0008+00 1/1 0/0 0/0 .sdata2 @1027 */ -SECTION_SDATA2 static f64 lit_1027 = 4503599627370496.0 /* cast u32 to float */; + f32 local_58[2] = {1.0f, -1.0f}; + + for (u16 i = 0; i < posNum; i++) { + int index = i_cluster->field_0x18[i] * 3; + for (u16 j = 0; j < keyNum; j++) { + int uVar7 = ((u16*)i_key[j].field_0x4)[i]; + f32* deform = &deformVtxPos[(uVar7 & ~0xE000) * 3]; + f32 deform0 = deform[0]; + f32 deform1 = deform[1]; + f32 deform2 = deform[2]; + deform0 *= local_58[((uVar7 & 0x8000) >> 0xF)]; + deform1 *= local_58[((uVar7 & 0x4000) >> 0xE)]; + deform2 *= local_58[((uVar7 & 0x2000) >> 0xD)]; + vtxPosArray[index] += deform0 * i_weights[j]; + vtxPosArray[index + 1] += deform1 * i_weights[j]; + vtxPosArray[index + 2] += deform2 * i_weights[j]; + } + } +} /* 8032E60C-8032EAB4 328F4C 04A8+00 1/1 0/0 0/0 .text * deform_VtxNrmF32__11J3DDeformerFP15J3DVertexBufferP10J3DClusterP13J3DClusterKeyPf */ -void J3DDeformer::deform_VtxNrmF32(J3DVertexBuffer* param_0, J3DCluster* param_1, - J3DClusterKey* param_2, f32* param_3) { - // NONMATCHING +// NONMATCHING one missing mr +void J3DDeformer::deform_VtxNrmF32(J3DVertexBuffer* i_buffer, J3DCluster* i_cluster, + J3DClusterKey* i_key, f32* i_weights) { + f32* vtxNrmArray = (f32*)i_buffer->getVtxNrmArrayPointer(0); + f32* deformVtxNrm = mDeformData->getVtxNrm(); + f32* iVar13 = field_0xc; + u16 keyNum = i_cluster->mKeyNum; + int uVar2 = i_cluster->field_0x16; + + for (u16 i = 0; i < i_cluster->field_0x14; i++) { + int index = i * 3; + iVar13[index] = 0.0f; + iVar13[index + 1] = 0.0f; + iVar13[index + 2] = 0.0f; + for (u16 j = 0; j < keyNum; j++) { + int uVar3 = ((u16*)i_key[j].field_0x8)[i]; + f32 deform0, deform1, deform2; + if (uVar3 & 0x8000) { + deform0 = -deformVtxNrm[(uVar3 & ~0xE000) * 3]; + } else { + deform0 = deformVtxNrm[(uVar3 & ~0xE000) * 3]; + } + if (uVar3 & 0x4000) { + deform1 = -deformVtxNrm[(uVar3 & ~0xE000) * 3 + 1]; + } else { + deform1 = deformVtxNrm[(uVar3 & ~0xE000) * 3 + 1]; + } + if (uVar3 & 0x2000) { + deform2 = -deformVtxNrm[(uVar3 & ~0xE000) * 3 + 2]; + } else { + deform2 = deformVtxNrm[(uVar3 & ~0xE000) * 3 + 2]; + } + iVar13[index] += deform0 * i_weights[j]; + iVar13[index + 1] += deform1 * i_weights[j]; + iVar13[index + 2] += deform2 * i_weights[j]; + } + normalize(&iVar13[index]); + } + + for (u16 i = 0; i < uVar2; i++) { + J3DClusterVertex* clusterVtx = &i_cluster->mClusterVertex[i]; + Vec vec; + vec.x = 0.0f; + vec.y = 0.0f; + vec.z = 0.0f; + f32 scale = 1.0f / clusterVtx->mNum; + for (u16 j = 0; j < clusterVtx->mNum; j++) { + int index = clusterVtx->field_0x4[j] * 3; + vec.x += scale * iVar13[index]; + vec.y += scale * iVar13[index + 1]; + vec.z += scale * iVar13[index + 2]; + } + normalize((f32*)&vec); + + for (u16 j = 0; j < clusterVtx->mNum; j++) { + u16 tmp = clusterVtx->field_0x8[j]; + if (tmp == 0xffff) { + continue; + } + int index = tmp * 3; + int index2 = clusterVtx->field_0x4[j] * 3; + + f32 dot = vec.x * iVar13[index2] + vec.y * iVar13[index2 + 1] + + vec.z * iVar13[index2 + 2]; + f32 angle; + if (dot >= 1.0f) { + angle = 0.0f; + } else if (dot > -1.0f) { + angle = JMath::acosDegree(dot); + } else { + angle = 180.0f; + } + + if (angle <= i_cluster->mMinAngle) { + vtxNrmArray[index] = vec.x; + vtxNrmArray[index + 1] = vec.y; + vtxNrmArray[index + 2] = vec.z; + } else if (angle > i_cluster->mMaxAngle) { + int index3 = clusterVtx->field_0x4[j]; + Vec* iVar13a = (Vec*)iVar13; + vtxNrmArray[index] = iVar13a[index3].x; + vtxNrmArray[index + 1] = iVar13a[index3].y; + vtxNrmArray[index + 2] = iVar13a[index3].z; + } else { + f32 weight1 = (angle - i_cluster->mMinAngle) + / (i_cluster->mMaxAngle - i_cluster->mMinAngle); + f32 weight2 = 1.0f - weight1; + vtxNrmArray[index] = weight1 * iVar13[index2] + weight2 * vec.x; + vtxNrmArray[index + 1] = weight1 * iVar13[index2 + 1] + weight2 * vec.y; + vtxNrmArray[index + 2] = weight1 * iVar13[index2 + 2] + weight2 * vec.z; + } + } + } } /* 8032EAB4-8032EBCC 3293F4 0118+00 1/1 0/0 0/0 .text deform__11J3DDeformerFP15J3DVertexBufferUsPf */ -void J3DDeformer::deform(J3DVertexBuffer* param_0, u16 param_1, f32* param_2) { - // NONMATCHING +void J3DDeformer::deform(J3DVertexBuffer* i_buffer, u16 param_1, f32* i_weights) { + if (checkFlag(2) && i_buffer->getVertexData()->getVtxPosType() == 4) { + J3DCluster* cluster = mDeformData->getClusterPointer(param_1); + u16 offset = 0; + for (u16 i = 0; i < param_1; i++) { + offset += mDeformData->getClusterPointer(i)->mKeyNum + 1; + } + J3DClusterKey* clusterKey = mDeformData->getClusterKeyPointer(offset); + + normalizeWeight(cluster->mKeyNum, i_weights); + deform_VtxPosF32(i_buffer, cluster, clusterKey, i_weights); + if (checkFlag(1) && cluster->mFlags != 0 && i_buffer->getVertexData()->getVtxNrmType() == 4) + { + deform_VtxNrmF32(i_buffer, cluster, clusterKey, i_weights); + } + } } /* 8032EBCC-8032EC28 32950C 005C+00 1/1 0/0 0/0 .text normalizeWeight__11J3DDeformerFiPf */ -void J3DDeformer::normalizeWeight(int param_0, f32* param_1) { - // NONMATCHING +void J3DDeformer::normalizeWeight(int i_keyNum, f32* i_weights) { + f32 totalWeight = 0.0f; + for (u16 i = 0; i < i_keyNum; i++) { + totalWeight += i_weights[i]; + } + f32 scale = 1.0f / totalWeight; + for (u16 i = 0; i < i_keyNum; i++) { + i_weights[i] *= scale; + } } \ No newline at end of file diff --git a/src/JSystem/J3DGraphAnimator/J3DJoint.cpp b/src/JSystem/J3DGraphAnimator/J3DJoint.cpp index e6e02dcce92..900edf00f4b 100644 --- a/src/JSystem/J3DGraphAnimator/J3DJoint.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DJoint.cpp @@ -4,7 +4,6 @@ #include "JSystem/J3DGraphBase/J3DDrawBuffer.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" #include "JSystem/JMath/JMath.h" -#include "dol2asm.h" #include "m_Do/m_Do_mtx.h" /* 8032EC28-8032ECAC 329568 0084+00 0/0 1/1 0/0 .text diff --git a/src/JSystem/J3DGraphAnimator/J3DJointTree.cpp b/src/JSystem/J3DGraphAnimator/J3DJointTree.cpp index 7a1368a74f9..b9aaa4618b8 100644 --- a/src/JSystem/J3DGraphAnimator/J3DJointTree.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DJointTree.cpp @@ -6,9 +6,9 @@ /* 80325A18-80325A9C 320358 0084+00 0/0 1/1 0/0 .text __ct__12J3DJointTreeFv */ J3DJointTree::J3DJointTree() : mHierarchy(NULL), mFlags(0), mModelDataType(0), mRootNode(NULL), mBasicMtxCalc(NULL), - mJointNodePointer(NULL), mJointNum(0), mWEvlpMtxNum(0), mWEvlpMixMtxNum(0), mWEvlpMixIndex(0), - mWEvlpMixWeight(0), mInvJointMtx(NULL), mWEvlpImportantMtxIdx(0), field_0x40(0), - mJointName(NULL) {} + mJointNodePointer(NULL), mJointNum(0), mWEvlpMtxNum(0), mWEvlpMixMtxNum(0), + mWEvlpMixMtxIndex(0), mWEvlpMixWeight(0), mInvJointMtx(NULL), mWEvlpImportantMtxIdx(0), + field_0x40(0), mJointName(NULL) {} /* 80325A9C-80325C00 3203DC 0164+00 1/0 2/2 0/0 .text * makeHierarchy__12J3DJointTreeFP8J3DJointPPC17J3DModelHierarchyP16J3DMaterialTableP13J3DShapeTable @@ -86,7 +86,7 @@ void J3DJointTree::findImportantMtxIndex() { const s32 wEvlpMtxNum = getWEvlpMtxNum(); u32 tableIdx = 0; const u16 drawFullWgtMtxNum = getDrawFullWgtMtxNum(); - const u16 * wEvlpMixIndex = getWEvlpMixIndex(); + const u16 * wEvlpMixIndex = getWEvlpMixMtxIndex(); const f32 * wEvlpMixWeight = getWEvlpMixWeight(); u16 * wEvlpImportantMtxIdx = getWEvlpImportantMtxIndex(); @@ -132,6 +132,3 @@ void J3DJointTree::calc(J3DMtxBuffer* pMtxBuffer, Vec const& scale, f32 const (& void J3DMtxCalc::setMtxBuffer(J3DMtxBuffer* mtxBuffer) { J3DMtxCalc::mMtxBuffer = mtxBuffer; } - -/* 80325D24-80325D88 320664 0064+00 1/0 0/0 0/0 .text __dt__12J3DJointTreeFv */ -J3DJointTree::~J3DJointTree() {} \ No newline at end of file diff --git a/src/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp b/src/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp index 1ae982efa66..e187a2d6c0f 100644 --- a/src/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp @@ -7,46 +7,6 @@ #include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" #include "JSystem/JUtility/JUTAssert.h" -#include "dolphin/types.h" - -// -// Forward References: -// - -extern "C" void clear__16J3DMaterialTableFv(); -extern "C" void __ct__16J3DMaterialTableFv(); -extern "C" void __dt__16J3DMaterialTableFv(); -extern "C" void removeMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor(); -extern "C" void removeTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern(); -extern "C" void removeTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey(); -extern "C" void removeTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey(); -extern "C" void createTexMtxForAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey(); -extern "C" void entryMatColorAnimator__16J3DMaterialTableFP11J3DAnmColor(); -extern "C" void entryTexNoAnimator__16J3DMaterialTableFP16J3DAnmTexPattern(); -extern "C" void entryTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey(); -extern "C" void entryTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey(); - -// -// External References: -// - -extern "C" void* __nw__FUl(); -extern "C" void __dl__FPv(); -extern "C" void __as__13J3DTexMtxInfoFRC13J3DTexMtxInfo(); -extern "C" void setMatColorAnm__14J3DMaterialAnmFiP14J3DMatColorAnm(); -extern "C" void setTexMtxAnm__14J3DMaterialAnmFiP12J3DTexMtxAnm(); -extern "C" void setTexNoAnm__14J3DMaterialAnmFiP11J3DTexNoAnm(); -extern "C" void setTevColorAnm__14J3DMaterialAnmFiP14J3DTevColorAnm(); -extern "C" void setTevKColorAnm__14J3DMaterialAnmFiP15J3DTevKColorAnm(); -extern "C" void _savegpr_22(); -extern "C" void _savegpr_24(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _restgpr_22(); -extern "C" void _restgpr_24(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" extern void* __vt__11J3DTexNoAnm[3]; /* 8032F5A8-8032F5D0 329EE8 0028+00 0/0 1/1 0/0 .text clear__16J3DMaterialTableFv */ void J3DMaterialTable::clear() { @@ -250,8 +210,7 @@ int J3DMaterialTable::entryTexNoAnimator(J3DAnmTexPattern* param_1) { /* 8032FCC4-8032FE70 32A604 01AC+00 0/0 14/14 6/6 .text * entryTexMtxAnimator__16J3DMaterialTableFP19J3DAnmTextureSRTKey */ -// getUpdateTexMtxID u8 issue / getSRTCenter -#ifdef NONMATCHING +// NONMATCHING getUpdateTexMtxID u8 issue int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* param_1) { int rv = 0; u16 materialNum = param_1->getUpdateMaterialNum(); @@ -275,10 +234,13 @@ int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* param_1) { material->getTexCoord(texMtxID)->setTexGenMtx(texMtxID * 3 + 30); } J3DTexMtxInfo& iVar3 = material->getTexMtx(texMtxID)->getTexMtxInfo(); - iVar3.mInfo = (iVar3.mInfo & 0x3f)| (param_1->getTexMtxCalcType() << 7); - iVar3.mCenter.x = param_1->getSRTCenter(i)->x; - iVar3.mCenter.y = param_1->getSRTCenter(i)->y; - iVar3.mCenter.z = param_1->getSRTCenter(i)->z; + iVar3.mInfo = (iVar3.mInfo & 0x3f) | (param_1->getTexMtxCalcType() << 7); + Vec* vec = param_1->getSRTCenter(i); + iVar3.mCenter.x = vec->x; + vec = param_1->getSRTCenter(i); + iVar3.mCenter.y = vec->y; + vec = param_1->getSRTCenter(i); + iVar3.mCenter.z = vec->z; J3DTexMtxAnm texMtxAnm(i, param_1); materialAnm->setTexMtxAnm(texMtxID, &texMtxAnm); } @@ -287,11 +249,6 @@ int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* param_1) { } return rv; } -#else -int J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* param_0) { - // NONMATCHING -} -#endif /* 8032FE70-8032FFEC 32A7B0 017C+00 0/0 10/10 4/4 .text * entryTevRegAnimator__16J3DMaterialTableFP15J3DAnmTevRegKey */ diff --git a/src/JSystem/J3DGraphAnimator/J3DModel.cpp b/src/JSystem/J3DGraphAnimator/J3DModel.cpp index cefaf4db7e5..b6ebbc29c08 100644 --- a/src/JSystem/J3DGraphAnimator/J3DModel.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DModel.cpp @@ -6,106 +6,8 @@ #include "JSystem/J3DGraphAnimator/J3DModel.h" #include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" -#include "dol2asm.h" #include "dolphin/os.h" -// -// Forward References: -// - -extern "C" void initialize__8J3DModelFv(); -extern "C" void entryModelData__8J3DModelFP12J3DModelDataUlUl(); -extern "C" void createShapePacket__8J3DModelFP12J3DModelData(); -extern "C" void createMatPacket__8J3DModelFP12J3DModelDataUl(); -extern "C" void newDifferedDisplayList__8J3DModelFUl(); -extern "C" void lock__8J3DModelFv(); -extern "C" void unlock__8J3DModelFv(); -extern "C" void calcMaterial__8J3DModelFv(); -extern "C" void calcDiffTexMtx__8J3DModelFv(); -extern "C" void diff__8J3DModelFv(); -extern "C" void setDeformData__8J3DModelFP13J3DDeformDataUl(); -extern "C" void setSkinDeform__8J3DModelFP13J3DSkinDeformUl(); -extern "C" void calcAnmMtx__8J3DModelFv(); -extern "C" void calcWeightEnvelopeMtx__8J3DModelFv(); -extern "C" void update__8J3DModelFv(); -extern "C" void calc__8J3DModelFv(); -extern "C" void entry__8J3DModelFv(); -extern "C" void viewCalc__8J3DModelFv(); -extern "C" void calcNrmMtx__8J3DModelFv(); -extern "C" void calcBumpMtx__8J3DModelFv(); -extern "C" void calcBBoardMtx__8J3DModelFv(); -extern "C" void prepareShapePackets__8J3DModelFv(); -extern "C" void __dt__8J3DModelFv(); -extern "C" void __dt__12J3DMtxBufferFv(); - -// -// External References: -// - -extern "C" void* __nw__FUl(); -extern "C" void* __nwa__FUl(); -extern "C" void __dl__FPv(); -extern "C" void setVertexData__15J3DVertexBufferFP13J3DVertexData(); -extern "C" void __dt__15J3DVertexBufferFv(); -extern "C" void copyLocalVtxArray__15J3DVertexBufferFUl(); -extern "C" void allocTransformedVtxPosArray__15J3DVertexBufferFv(); -extern "C" void allocTransformedVtxNrmArray__15J3DVertexBufferFv(); -extern "C" void single_To_Double__17J3DDisplayListObjFv(); -extern "C" void newDisplayList__13J3DDrawPacketFUl(); -extern "C" void newSingleDisplayList__13J3DDrawPacketFUl(); -extern "C" void __ct__12J3DMatPacketFv(); -extern "C" void __dt__12J3DMatPacketFv(); -extern "C" void addShapePacket__12J3DMatPacketFP14J3DShapePacket(); -extern "C" void __ct__14J3DShapePacketFv(); -extern "C" void __dt__14J3DShapePacketFv(); -extern "C" void newDifferedDisplayList__14J3DShapePacketFUl(); -extern "C" void calcNBTScale__8J3DShapeFRC3VecPA3_A3_fPA3_A3_f(); -extern "C" void countDLSize__11J3DMaterialFv(); -extern "C" void newSharedDisplayList__11J3DMaterialFUl(); -extern "C" void newSingleSharedDisplayList__11J3DMaterialFUl(); -extern "C" void syncJ3DSysFlags__12J3DModelDataCFv(); -extern "C" void initialize__12J3DMtxBufferFv(); -extern "C" void create__12J3DMtxBufferFP12J3DModelDataUl(); -extern "C" void calcWeightEnvelopeMtx__12J3DMtxBufferFv(); -extern "C" void calcDrawMtx__12J3DMtxBufferFUlRC3VecRA3_A4_Cf(); -extern "C" void calcNrmMtx__12J3DMtxBufferFv(); -extern "C" void calcBBoardMtx__12J3DMtxBufferFv(); -extern "C" void J3DCalcViewBaseMtx__FPA4_fRC3VecRA3_A4_CfPA4_f(); -extern "C" void initSkinInfo__13J3DSkinDeformFP12J3DModelData(); -extern "C" void initMtxIndexArray__13J3DSkinDeformFP12J3DModelData(); -extern "C" void changeFastSkinDL__13J3DSkinDeformFP12J3DModelData(); -extern "C" void transformVtxPosNrm__13J3DSkinDeformFP12J3DModelData(); -extern "C" void deform__13J3DSkinDeformFP8J3DModel(); -extern "C" void calc__15J3DVtxColorCalcFP8J3DModel(); -extern "C" void offAllFlag__13J3DDeformDataFUl(); -extern "C" void deform__13J3DDeformDataFP8J3DModel(); -extern "C" void entryIn__8J3DJointFv(); -extern "C" void __construct_new_array(); -extern "C" void _savegpr_23(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_23(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 80456428-80456430 004A28 0004+04 1/1 0/0 0/0 .sdata2 @896 */ -SECTION_SDATA2 static f32 lit_896[1 + 1 /* padding */] = { - 1.0f, - /* padding */ - 0.0f, -}; - /* 80327100-80327184 321A40 0084+00 0/0 3/3 0/0 .text initialize__8J3DModelFv */ void J3DModel::initialize() { mModelData = NULL; @@ -131,27 +33,6 @@ void J3DModel::initialize() { mUnkCalc2 = NULL; } -/* ############################################################################################## */ -/* 803CED20-803CED44 02BE40 0024+00 1/1 3/3 0/0 .data __vt__8J3DModel */ -SECTION_DATA extern void* __vt__8J3DModel[9] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)update__8J3DModelFv, - (void*)entry__8J3DModelFv, - (void*)calc__8J3DModelFv, - (void*)calcMaterial__8J3DModelFv, - (void*)calcDiffTexMtx__8J3DModelFv, - (void*)viewCalc__8J3DModelFv, - (void*)__dt__8J3DModelFv, -}; - -/* 803CED44-803CED50 02BE64 000C+00 2/2 0/0 0/0 .data __vt__12J3DMtxBuffer */ -SECTION_DATA extern void* __vt__12J3DMtxBuffer[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12J3DMtxBufferFv, -}; - /* 80327184-80327300 321AC4 017C+00 0/0 3/3 0/0 .text * entryModelData__8J3DModelFP12J3DModelDataUlUl */ s32 J3DModel::entryModelData(J3DModelData* p_modelData, u32 modelFlag, u32 mtxBufferFlag) { @@ -373,38 +254,29 @@ void J3DModel::calcMaterial() { } /* 80327858-803279A0 322198 0148+00 1/0 0/0 0/0 .text calcDiffTexMtx__8J3DModelFv */ -#if defined NON_MATCHING +// NONMATCHING regalloc void J3DModel::calcDiffTexMtx() { - // regalloc j3dSys.setModel(this); - u16 num; - num = getModelData()->getMaterialNum(); - for (u16 i = 0; i < num; i++) { - j3dSys.setMatPacket(getMatPacket(i)); - J3DMaterial* materialNode = getModelData()->getMaterialNodePointer(i); + for (u16 num = mModelData->getMaterialNum(), i = 0; i < num; i++) { + j3dSys.setMatPacket(&mMatPacket[i]); + J3DMaterial* materialNode = mModelData->getMaterialNodePointer(i); materialNode->calcDiffTexMtx(getAnmMtx(materialNode->getJoint()->getJntNo())); } - num = getModelData()->getShapeNum(); - for (u16 i = 0; i < num; i++) { + for (u16 num = mModelData->getShapeNum(), i = 0; i < num; i++) { J3DShapePacket* shapePacket = getShapePacket(i); J3DTexGenBlock* texGenBlock = - getModelData()->getShapeNodePointer(i)->getMaterial()->getTexGenBlock(); + mModelData->getShapeNodePointer(i)->getMaterial()->getTexGenBlock(); for (u16 j = 0; (int)j < 8; j++) { J3DTexMtx* texMtxNode = texGenBlock->getTexMtx(j); J3DTexMtxObj* texMtxObj = shapePacket->getTexMtxObj(); if (texMtxNode != NULL && texMtxObj != NULL) { - MTXCopy(texMtxNode->getMtx(), texMtxObj->getMtx(j)); + texMtxObj->setMtx(j, &texMtxNode->getMtx()); } } } } -#else -void J3DModel::calcDiffTexMtx() { - // NONMATCHING -} -#endif /* 803279A0-80327A2C 3222E0 008C+00 0/0 2/2 0/0 .text diff__8J3DModelFv */ void J3DModel::diff() { @@ -668,12 +540,3 @@ void J3DModel::prepareShapePackets() { } } } - -/* 80328350-803283B4 322C90 0064+00 1/0 0/0 0/0 .text __dt__8J3DModelFv */ -J3DModel::~J3DModel() {} - -/* 803283B4-803283FC 322CF4 0048+00 1/0 0/0 0/0 .text __dt__12J3DMtxBufferFv */ -extern "C" void __dt__12J3DMtxBufferFv() { - // asm J3DMtxBuffer::~J3DMtxBuffer() { - // NONMATCHING -} \ No newline at end of file diff --git a/src/JSystem/J3DGraphAnimator/J3DModelData.cpp b/src/JSystem/J3DGraphAnimator/J3DModelData.cpp index 804bb570447..8883f8c163a 100644 --- a/src/JSystem/J3DGraphAnimator/J3DModelData.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DModelData.cpp @@ -6,47 +6,8 @@ #include "JSystem/J3DGraphAnimator/J3DModelData.h" #include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" -#include "dol2asm.h" #include "dolphin/os.h" -// -// Forward References: -// - -extern "C" void clear__12J3DModelDataFv(); -extern "C" void __ct__12J3DModelDataFv(); -extern "C" void newSharedDisplayList__12J3DModelDataFUl(); -extern "C" void indexToPtr__12J3DModelDataFv(); -extern "C" void makeSharedDL__12J3DModelDataFv(); -extern "C" void simpleCalcMaterial__12J3DModelDataFUsPA4_f(); -extern "C" void syncJ3DSysPointers__12J3DModelDataCFv(); -extern "C" void syncJ3DSysFlags__12J3DModelDataCFv(); -extern "C" void __dt__13J3DShapeTableFv(); -extern "C" void __dt__12J3DModelDataFv(); - -// -// External References: -// - -extern "C" void __dl__FPv(); -extern "C" void __ct__13J3DVertexDataFv(); -extern "C" void __dt__14J3DDrawMtxDataFv(); -extern "C" void countDLSize__11J3DMaterialFv(); -extern "C" void newSharedDisplayList__11J3DMaterialFUl(); -extern "C" void newSingleSharedDisplayList__11J3DMaterialFUl(); -extern "C" void __ct__12J3DJointTreeFv(); -extern "C" void __ct__16J3DMaterialTableFv(); -extern "C" void __dt__16J3DMaterialTableFv(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_29(); -extern "C" extern void* __vt__12J3DJointTree[4 + 1 /* padding */]; - -// -// Declarations: -// - /* 80325D88-80325DA0 3206C8 0018+00 1/1 2/2 0/0 .text clear__12J3DModelDataFv */ void J3DModelData::clear() { mpRawData = 0; @@ -55,21 +16,6 @@ void J3DModelData::clear() { mbHasBillboard = 0; } -/* ############################################################################################## */ -/* 803CED08-803CED14 02BE28 000C+00 3/3 0/0 0/0 .data __vt__13J3DShapeTable */ -SECTION_DATA extern void* __vt__13J3DShapeTable[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__13J3DShapeTableFv, -}; - -/* 803CED14-803CED20 02BE34 000C+00 2/2 0/0 0/0 .data __vt__12J3DModelData */ -SECTION_DATA extern void* __vt__12J3DModelData[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12J3DModelDataFv, -}; - /* 80325DA0-80325E14 3206E0 0074+00 0/0 2/2 0/0 .text __ct__12J3DModelDataFv */ J3DModelData::J3DModelData() { clear(); @@ -169,14 +115,3 @@ void J3DModelData::syncJ3DSysFlags() const { j3dSys.offFlag(J3DSysFlag_PostTexMtx); } } - -/* 80326134-8032617C 320A74 0048+00 1/0 0/0 0/0 .text __dt__13J3DShapeTableFv */ -extern "C" void __dt__13J3DShapeTableFv() { - // asm J3DShapeTable::~J3DShapeTable() { - // NONMATCHING -} - -/* 8032617C-80326214 320ABC 0098+00 1/0 0/0 0/0 .text __dt__12J3DModelDataFv */ -J3DModelData::~J3DModelData() { - // NONMATCHING -} \ No newline at end of file diff --git a/src/JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp b/src/JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp index 1728a77134e..d3faa6b8943 100644 --- a/src/JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DMtxBuffer.cpp @@ -4,55 +4,8 @@ // #include "JSystem/J3DGraphAnimator/J3DMtxBuffer.h" +#include "JSystem/J3DGraphBase/J3DMaterial.h" #include "JSystem/JKernel/JKRHeap.h" -#include "dol2asm.h" - -// -// Forward References: -// - -extern "C" void initialize__12J3DMtxBufferFv(); -extern "C" void create__12J3DMtxBufferFP12J3DModelDataUl(); -extern "C" void createAnmMtx__12J3DMtxBufferFP12J3DModelData(); -extern "C" void createWeightEnvelopeMtx__12J3DMtxBufferFP12J3DModelData(); -extern "C" void setNoUseDrawMtx__12J3DMtxBufferFv(); -extern "C" void createDoubleDrawMtx__12J3DMtxBufferFP12J3DModelDataUl(); -extern "C" void createBumpMtxArray__12J3DMtxBufferFP12J3DModelDataUl(); -extern "C" void calcWeightEnvelopeMtx__12J3DMtxBufferFv(); -extern "C" void calcDrawMtx__12J3DMtxBufferFUlRC3VecRA3_A4_Cf(); -extern "C" void calcNrmMtx__12J3DMtxBufferFv(); -extern "C" void calcBBoardMtx__12J3DMtxBufferFv(); -extern "C" void J3DCalcViewBaseMtx__FPA4_fRC3VecRA3_A4_CfPA4_f(); -extern "C" u8 sNoUseDrawMtx__12J3DMtxBuffer[48]; -extern "C" u8 sNoUseNrmMtx__12J3DMtxBuffer[36 + 4 /* padding */]; -extern "C" void* sNoUseDrawMtxPtr__12J3DMtxBuffer; -extern "C" void* sNoUseNrmMtxPtr__12J3DMtxBuffer; - -// -// External References: -// - -extern "C" void* __nwa__FUl(); -extern "C" void* __nwa__FUli(); -extern "C" void J3DCalcBBoardMtx__FPA4_f(); -extern "C" void J3DCalcYBBoardMtx__FPA4_f(); -extern "C" void J3DPSCalcInverseTranspose__FPA4_fPA3_f(); -extern "C" void J3DPSMtxArrayConcat__FPA4_fPA4_fPA4_fUl(); -extern "C" void countBumpMtxNum__8J3DShapeCFv(); -extern "C" void _savegpr_19(); -extern "C" void _savegpr_24(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_19(); -extern "C" void _restgpr_24(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); - -// -// Declarations: -// /* 80326214-80326258 320B54 0044+00 0/0 1/1 0/0 .text initialize__12J3DMtxBufferFv */ void J3DMtxBuffer::initialize() { @@ -156,7 +109,6 @@ s32 J3DMtxBuffer::createWeightEnvelopeMtx(J3DModelData* p_modelData) { return kJ3DError_Success; } -/* ############################################################################################## */ /* 804371C0-804371F0 063EE0 0030+00 1/0 0/0 0/0 .bss sNoUseDrawMtx__12J3DMtxBuffer */ Mtx J3DMtxBuffer::sNoUseDrawMtx; @@ -226,13 +178,71 @@ s32 J3DMtxBuffer::createDoubleDrawMtx(J3DModelData* p_modelData, u32 num) { /* 80326664-803268D4 320FA4 0270+00 1/1 0/0 0/0 .text * createBumpMtxArray__12J3DMtxBufferFP12J3DModelDataUl */ -s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* param_0, u32 param_1) { - // NONMATCHING +s32 J3DMtxBuffer::createBumpMtxArray(J3DModelData* i_modelData, u32 param_1) { + if (i_modelData->getModelDataType() == 0) { + u32 bumpMtxNum = 0; + u16 materialCount = 0; + u16 materialNum = i_modelData->getMaterialNum(); + for (u16 j = 0; j < materialNum; j++) { + J3DMaterial* material = i_modelData->getMaterialNodePointer(j); + if (material->getNBTScale()->mbHasScale == true) { + bumpMtxNum += material->getShape()->countBumpMtxNum(); + materialCount++; + } + } + + if ((u16)bumpMtxNum != 0 && param_1 != 0) { + for (int i = 0; i < 2; i++) { + mpBumpMtxArr[i] = new Mtx33**[(u16)materialCount]; + if (mpBumpMtxArr[i] == NULL) { + return kJ3DError_Alloc; + } + } + } + + for (int i = 0; i < 2; i++) { + u32 offset = 0; + u16 materialNum = i_modelData->getMaterialNum(); + for (u16 j = 0; j < materialNum; j++) { + J3DMaterial* material = i_modelData->getMaterialNodePointer(j); + if (material->getNBTScale()->mbHasScale == true) { + mpBumpMtxArr[i][offset] = new Mtx33*[param_1]; + if (mpBumpMtxArr[i][offset] == NULL) { + return kJ3DError_Alloc; + } + material->getShape()->setBumpMtxOffset(offset); + offset++; + } + } + } + + for (int i = 0; i < 2; i++) { + u32 offset = 0; + u16 materialNum = i_modelData->getMaterialNum(); + for (u16 j = 0; j < materialNum; j++) { + J3DMaterial* material = i_modelData->getMaterialNodePointer(j); + if (material->getNBTScale()->mbHasScale == true) { + for (int k = 0; k < param_1; k++) { + mpBumpMtxArr[i][offset][k] = new (0x20) Mtx33[i_modelData->getDrawMtxNum()]; + if (mpBumpMtxArr[i][offset][k] == NULL) { + return kJ3DError_Alloc; + } + } + offset++; + } + } + } + + if (materialCount != 0) { + i_modelData->setBumpFlag(1); + } + } + + return kJ3DError_Success; } -/* ############################################################################################## */ /* 80450978-80450980 0003F8 0008+00 1/1 0/0 0/0 .sdata J3DUnit01 */ -SECTION_SDATA static u8 J3DUnit01[8] = { +static u8 J3DUnit01[8] = { 0x00, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, }; @@ -243,32 +253,99 @@ void J3DMtxBuffer::calcWeightEnvelopeMtx() { /* 80326ACC-80326D3C 32140C 0270+00 0/0 1/1 0/0 .text * calcDrawMtx__12J3DMtxBufferFUlRC3VecRA3_A4_Cf */ -void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, f32 const (¶m_2)[3][4]) { - // NONMATCHING +void J3DMtxBuffer::calcDrawMtx(u32 param_0, Vec const& param_1, Mtx const& param_2) { + MtxP viewMtx; + Mtx viewBaseMtx; + u16 fullWgtNum; + + switch (param_0) { + case 0: + viewMtx = j3dSys.getViewMtx(); + fullWgtNum = mJointTree->getDrawFullWgtMtxNum(); + for (u16 i = 0; i < fullWgtNum; i++) { + MTXConcat(viewMtx, getAnmMtx(mJointTree->getDrawMtxIndex(i)), *getDrawMtx(i)); + } + if (mJointTree->getDrawMtxNum() > fullWgtNum) { + J3DPSMtxArrayConcat(viewMtx, *mpWeightEvlpMtx, *getDrawMtx(fullWgtNum), + mJointTree->getWEvlpMtxNum()); + } + break; + + case 1: + fullWgtNum = mJointTree->getDrawFullWgtMtxNum(); + for (u16 i = 0; i < fullWgtNum; i++) { + MTXCopy(getAnmMtx(mJointTree->getDrawMtxIndex(i)), *getDrawMtx(i)); + } + fullWgtNum = mJointTree->getDrawFullWgtMtxNum(); + for (u16 i = 0; i < fullWgtNum; i++) { + MTXCopy(getWeightAnmMtx(i), *getDrawMtx(mJointTree->getDrawFullWgtMtxNum() + i)); + } + break; + + case 2: + J3DCalcViewBaseMtx(j3dSys.getViewMtx(), param_1, param_2, viewBaseMtx); + fullWgtNum = mJointTree->getDrawFullWgtMtxNum(); + for (u16 i = 0; i < fullWgtNum; i++) { + MTXConcat(viewBaseMtx, getAnmMtx(mJointTree->getDrawMtxIndex(i)), *getDrawMtx(i)); + } + if (mJointTree->getDrawMtxNum() > mJointTree->getDrawFullWgtMtxNum()) { + J3DPSMtxArrayConcat(viewBaseMtx, *mpWeightEvlpMtx, + *getDrawMtx(mJointTree->getDrawFullWgtMtxNum()), + mJointTree->getWEvlpMtxNum()); + } + break; + } } extern void J3DPSCalcInverseTranspose(Mtx p1, Mtx33 p2); /* 80326D3C-80326EF0 32167C 01B4+00 0/0 1/1 0/0 .text calcNrmMtx__12J3DMtxBufferFv */ void J3DMtxBuffer::calcNrmMtx() { - // NONMATCHING + u16 drawMtxNum = mJointTree->getDrawMtxNum(); + for (u16 i = 0; i < drawMtxNum; i++) { + if (mJointTree->getDrawMtxFlag(i) == 0) { + if (getScaleFlag(mJointTree->getDrawMtxIndex(i)) == 1) { + setNrmMtx(i, getDrawMtx(i)); + } else { + J3DPSCalcInverseTranspose(*getDrawMtx(i), *getNrmMtx(i)); + } + } else { + if (getEnvScaleFlag(mJointTree->getDrawMtxIndex(i)) == 1) { + setNrmMtx(i, getDrawMtx(i)); + } else { + J3DPSCalcInverseTranspose(*getDrawMtx(i), *getNrmMtx(i)); + } + } + } } -/* ############################################################################################## */ -/* 80456420-80456424 004A20 0004+00 1/1 0/0 0/0 .sdata2 @1320 */ -SECTION_SDATA2 static f32 lit_1320 = 1.0f; - -/* 80456424-80456428 004A24 0004+00 1/1 0/0 0/0 .sdata2 @1321 */ -SECTION_SDATA2 static u8 lit_1321[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; - /* 80326EF0-80327048 321830 0158+00 0/0 1/1 0/0 .text calcBBoardMtx__12J3DMtxBufferFv */ void J3DMtxBuffer::calcBBoardMtx() { - // NONMATCHING + u16 drawMtxNum = mJointTree->getDrawMtxNum(); + for (u16 i = 0; i < drawMtxNum; i++) { + if (mJointTree->getDrawMtxFlag(i) == 0) { + u16 index = mJointTree->getDrawMtxIndex(i); + if (mJointTree->getJointNodePointer(index)->getMtxType() == 1) { + MtxP drawMtx = *getDrawMtx(i); + J3DCalcBBoardMtx(drawMtx); + Mtx33* nrmMtx = getNrmMtx(i); + (*nrmMtx)[0][0] = 1.0f / drawMtx[0][0]; + (*nrmMtx)[0][1] = 0.0f; + (*nrmMtx)[0][2] = 0.0f; + (*nrmMtx)[1][0] = 0.0f; + (*nrmMtx)[1][1] = 1.0f / drawMtx[1][1]; + (*nrmMtx)[1][2] = 0.0f; + (*nrmMtx)[2][0] = 0.0f; + (*nrmMtx)[2][1] = 0.0f; + (*nrmMtx)[2][2] = 1.0f / drawMtx[2][2]; + } else if (mJointTree->getJointNodePointer(index)->getMtxType() == 2) { + MtxP drawMtx = *getDrawMtx(i); + J3DCalcYBBoardMtx(drawMtx); + Mtx33* nrmMtx = getNrmMtx(i); + J3DPSCalcInverseTranspose(drawMtx, *nrmMtx); + } + } + } } /* 80327048-80327100 321988 00B8+00 1/1 1/1 0/0 .text @@ -292,4 +369,4 @@ void J3DCalcViewBaseMtx(Mtx view, Vec const& scale, const Mtx& base, Mtx dst) { m[2][3] = base[2][3]; MTXConcat(view, m, dst); -} \ No newline at end of file +} diff --git a/src/JSystem/J3DGraphLoader/J3DAnmLoader.cpp b/src/JSystem/J3DGraphLoader/J3DAnmLoader.cpp index dcd6087bcaa..aca933f0179 100644 --- a/src/JSystem/J3DGraphLoader/J3DAnmLoader.cpp +++ b/src/JSystem/J3DGraphLoader/J3DAnmLoader.cpp @@ -795,12 +795,12 @@ void J3DAnmKeyLoader_v15::setAnmColor(J3DAnmColorKey* param_1, const J3DAnmColor param_1->field_0xe = param_2->field_0x12; param_1->field_0x10 = param_2->field_0x14; param_1->field_0x12 = param_2->field_0x16; - param_1->field_0x3c = + param_1->mAnmTable = JSUConvertOffsetToPtr(param_2, (void*)param_2->mTableOffset); - param_1->field_0x2c = JSUConvertOffsetToPtr(param_2, (void*)param_2->mRValOffset); - param_1->field_0x30 = JSUConvertOffsetToPtr(param_2, (void*)param_2->mGValOffset); - param_1->field_0x34 = JSUConvertOffsetToPtr(param_2, (void*)param_2->mBValOffset); - param_1->field_0x38 = JSUConvertOffsetToPtr(param_2, (void*)param_2->mAValOffset); + param_1->mColorR = JSUConvertOffsetToPtr(param_2, (void*)param_2->mRValOffset); + param_1->mColorG = JSUConvertOffsetToPtr(param_2, (void*)param_2->mGValOffset); + param_1->mColorB = JSUConvertOffsetToPtr(param_2, (void*)param_2->mBValOffset); + param_1->mColorA = JSUConvertOffsetToPtr(param_2, (void*)param_2->mAValOffset); param_1->mUpdateMaterialID = JSUConvertOffsetToPtr(param_2, (void*)param_2->mUpdateMaterialIDOffset); param_1->mUpdateMaterialName.setResource( @@ -942,4 +942,4 @@ extern "C" void func_80339860(void* _this, void const* param_0, void const* para // NONMATCHING } -/* 803A2130-803A2130 02E790 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 803A2130-803A2130 02E790 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ diff --git a/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp b/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp index f0372670230..a306d5427fd 100644 --- a/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp +++ b/src/JSystem/J3DGraphLoader/J3DModelLoader.cpp @@ -3,8 +3,6 @@ // Translation Unit: J3DModelLoader // -#define NON_VIRTUAL_J3DModelLoader - #include "JSystem/J3DGraphLoader/J3DModelLoader.h" #include "JSystem/J3DGraphLoader/J3DJointFactory.h" #include "JSystem/J3DGraphLoader/J3DMaterialFactory.h" @@ -16,251 +14,8 @@ #include "JSystem/JKernel/JKRHeap.h" #include "JSystem/JSupport/JSupport.h" #include "dolphin/os.h" -#include "dol2asm.h" - -// -// Types: -// - -struct J3DAnmTransform {}; - -// -// Forward References: -// - -extern "C" void __ct__14J3DModelLoaderFv(); -extern "C" void load__22J3DModelLoaderDataBaseFPCvUl(); -extern "C" void load__14J3DModelLoaderFPCvUl(); -extern "C" void loadMaterialTable__14J3DModelLoaderFPCv(); -extern "C" void loadBinaryDisplayList__14J3DModelLoaderFPCvUl(); -extern "C" void setupBBoardInfo__14J3DModelLoaderFv(); -extern "C" void readInformation__14J3DModelLoaderFPC17J3DModelInfoBlockUl(); -extern "C" static void getFmtType__FP17_GXVtxAttrFmtList7_GXAttr(); -extern "C" void readVertex__14J3DModelLoaderFPC14J3DVertexBlock(); -extern "C" void readEnvelop__14J3DModelLoaderFPC16J3DEnvelopeBlock(); -extern "C" void readDraw__14J3DModelLoaderFPC12J3DDrawBlock(); -extern "C" void readJoint__14J3DModelLoaderFPC13J3DJointBlock(); -extern "C" void readMaterial__18J3DModelLoader_v26FPC16J3DMaterialBlockUl(); -extern "C" void readMaterial_v21__18J3DModelLoader_v21FPC20J3DMaterialBlock_v21Ul(); -extern "C" void readShape__14J3DModelLoaderFPC13J3DShapeBlockUl(); -extern "C" void readTexture__14J3DModelLoaderFPC15J3DTextureBlock(); -extern "C" void readMaterialTable__18J3DModelLoader_v26FPC16J3DMaterialBlockUl(); -extern "C" void readMaterialTable_v21__18J3DModelLoader_v21FPC20J3DMaterialBlock_v21Ul(); -extern "C" void readTextureTable__14J3DModelLoaderFPC15J3DTextureBlock(); -extern "C" void readPatchedMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl(); -extern "C" void readMaterialDL__14J3DModelLoaderFPC18J3DMaterialDLBlockUl(); -extern "C" void modifyMaterial__14J3DModelLoaderFUl(); -extern "C" void __dt__18J3DModelLoader_v26Fv(); -extern "C" void __dt__18J3DModelLoader_v21Fv(); -extern "C" void __dt__14J3DModelLoaderFv(); -extern "C" void readMaterial_v21__14J3DModelLoaderFPC20J3DMaterialBlock_v21Ul(); -extern "C" void readMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl(); -extern "C" void readMaterialTable_v21__14J3DModelLoaderFPC20J3DMaterialBlock_v21Ul(); -extern "C" void readMaterialTable__14J3DModelLoaderFPC16J3DMaterialBlockUl(); -extern "C" bool calcSizeMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl(); -extern "C" bool calcSizeMaterialTable__14J3DModelLoaderFPC16J3DMaterialBlockUl(); -extern "C" void func_803364B8(void* _this); -extern "C" void func_80336524(void* _this, Vec const&, f32 const (&)[3][4]); -extern "C" void func_8033656C(void* _this); -extern "C" void func_80336594(void* _this); -extern "C" void func_80336600(void* _this, Vec const&, f32 const (&)[3][4]); -extern "C" void func_80336628(void* _this); -extern "C" void __ct__11J3DMaterialFv(); -extern "C" void __dt__10J3DTextureFv(); -extern "C" ResTIMG* func_803366EC(void const*, void const*); -extern "C" Mtx* func_80336704(void const*, void const*); -extern "C" void* func_8033671C(void const*, void const*); -extern "C" _GXVtxAttrFmtList* func_80336734(void const*, void const*); -extern "C" J3DModelHierarchy* func_8033674C(void const*, void const*); -extern "C" J3DShapeInitData* func_80336764(void const*, void const*); -extern "C" u16* func_8033677C(void const*, void const*); -extern "C" extern char const* const J3DModelLoader__stringBase0; - -// -// External References: -// - -extern "C" void setAnmTransform__10J3DMtxCalcFUcP15J3DAnmTransform(); -extern "C" void setAnmTransform__10J3DMtxCalcFP15J3DAnmTransform(); -extern "C" bool getAnmTransform__10J3DMtxCalcFUc(); -extern "C" bool getAnmTransform__10J3DMtxCalcFv(); -extern "C" void setWeight__10J3DMtxCalcFUcf(); -extern "C" void getWeight__10J3DMtxCalcCFUc(); -extern "C" void getTotalFreeSize__7JKRHeapFv(); -extern "C" void* __nw__FUl(); -extern "C" void* __nwa__FUl(); -extern "C" void* __nwa__FUli(); -extern "C" void __dl__FPv(); -extern "C" void __ct__10JUTNameTabFPC7ResNTAB(); -extern "C" u8* func_802F4260(void const*, void const*); -extern "C" u16* func_802F42C0(void const*, void const*); -extern "C" ResNTAB* func_8030A530(void const*, void const*); -extern "C" f32* func_8030A560(void const*, void const*); -extern "C" void initialize__11J3DMaterialFv(); -extern "C" void initShapeNodes__13J3DShapeTableFP14J3DDrawMtxDataP13J3DVertexData(); -extern "C" void sortVcdVatCmd__13J3DShapeTableFv(); -extern "C" void -makeHierarchy__12J3DJointTreeFP8J3DJointPPC17J3DModelHierarchyP16J3DMaterialTableP13J3DShapeTable(); -extern "C" void findImportantMtxIndex__12J3DJointTreeFv(); -extern "C" void clear__12J3DModelDataFv(); -extern "C" void __ct__12J3DModelDataFv(); -extern "C" void indexToPtr__12J3DModelDataFv(); -extern "C" void init__25J3DMtxCalcJ3DSysInitBasicFRC3VecRA3_A4_Cf(); -extern "C" void calcTransform__28J3DMtxCalcCalcTransformBasicFRC16J3DTransformInfo(); -extern "C" void calcTransform__32J3DMtxCalcCalcTransformSoftimageFRC16J3DTransformInfo(); -extern "C" void clear__16J3DMaterialTableFv(); -extern "C" void __ct__16J3DMaterialTableFv(); -extern "C" void __ct__18J3DMaterialFactoryFRC16J3DMaterialBlock(); -extern "C" void __ct__18J3DMaterialFactoryFRC18J3DMaterialDLBlock(); -extern "C" void countUniqueMaterials__18J3DMaterialFactoryFv(); -extern "C" void -create__18J3DMaterialFactoryCFP11J3DMaterialQ218J3DMaterialFactory12MaterialTypeiUl(); -extern "C" void modifyPatchedCurrentMtx__18J3DMaterialFactoryCFP11J3DMateriali(); -extern "C" void __dt__11J3DMaterialFv(); -extern "C" void __ct__22J3DMaterialFactory_v21FRC20J3DMaterialBlock_v21(); -extern "C" void countUniqueMaterials__22J3DMaterialFactory_v21Fv(); -extern "C" void create__22J3DMaterialFactory_v21CFP11J3DMaterialiUl(); -extern "C" void countMaterialNum__14J3DModelLoaderFPCv(); -extern "C" void calcLoadSize__14J3DModelLoaderFPCvUl(); -extern "C" void calcLoadMaterialTableSize__14J3DModelLoaderFPCv(); -extern "C" void calcLoadBinaryDisplayListSize__14J3DModelLoaderFPCvUl(); -extern "C" void calcSizeMaterial__18J3DModelLoader_v26FPC16J3DMaterialBlockUl(); -extern "C" void calcSizeMaterialTable__18J3DModelLoader_v26FPC16J3DMaterialBlockUl(); -extern "C" void __ct__15J3DJointFactoryFRC13J3DJointBlock(); -extern "C" void create__15J3DJointFactoryFi(); -extern "C" void __ct__15J3DShapeFactoryFRC13J3DShapeBlock(); -extern "C" void create__15J3DShapeFactoryFiUlP14_GXVtxDescList(); -extern "C" void allocVcdVatCmdBuffer__15J3DShapeFactoryFUl(); -extern "C" void __construct_new_array(); -extern "C" void _savegpr_24(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_24(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern void* data_803A3360[11]; -extern "C" extern void* __vt__19J3DMtxCalcNoAnmBase[11]; -extern "C" extern void* __vt__10J3DMtxCalc[11 + 1 /* padding */]; -extern "C" extern void* __vt__11J3DMaterial[12]; -extern "C" u8 mCurrentMtx__6J3DSys[48]; -extern "C" f32 mCurrentS__6J3DSys[3]; -extern "C" u8 sCurrentHeap__7JKRHeap[4]; -extern "C" u8 mJoint__10J3DMtxCalc[4]; - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 803CF108-803CF14C 02C228 0044+00 2/2 0/0 0/0 .data __vt__18J3DModelLoader_v21 */ -SECTION_DATA extern void* __vt__18J3DModelLoader_v21[17] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)load__14J3DModelLoaderFPCvUl, - (void*)loadMaterialTable__14J3DModelLoaderFPCv, - (void*)loadBinaryDisplayList__14J3DModelLoaderFPCvUl, - (void*)calcLoadSize__14J3DModelLoaderFPCvUl, - (void*)calcLoadMaterialTableSize__14J3DModelLoaderFPCv, - (void*)calcLoadBinaryDisplayListSize__14J3DModelLoaderFPCvUl, - (void*)countMaterialNum__14J3DModelLoaderFPCv, - (void*)setupBBoardInfo__14J3DModelLoaderFv, - (void*)__dt__18J3DModelLoader_v21Fv, - (void*)readMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl, - (void*)readMaterial_v21__18J3DModelLoader_v21FPC20J3DMaterialBlock_v21Ul, - (void*)readMaterialTable__14J3DModelLoaderFPC16J3DMaterialBlockUl, - (void*)readMaterialTable_v21__18J3DModelLoader_v21FPC20J3DMaterialBlock_v21Ul, - (void*)calcSizeMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl, - (void*)calcSizeMaterialTable__14J3DModelLoaderFPC16J3DMaterialBlockUl, -}; - -/* 803CF14C-803CF190 02C26C 0044+00 2/2 0/0 0/0 .data __vt__18J3DModelLoader_v26 */ -SECTION_DATA extern void* __vt__18J3DModelLoader_v26[17] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)load__14J3DModelLoaderFPCvUl, - (void*)loadMaterialTable__14J3DModelLoaderFPCv, - (void*)loadBinaryDisplayList__14J3DModelLoaderFPCvUl, - (void*)calcLoadSize__14J3DModelLoaderFPCvUl, - (void*)calcLoadMaterialTableSize__14J3DModelLoaderFPCv, - (void*)calcLoadBinaryDisplayListSize__14J3DModelLoaderFPCvUl, - (void*)countMaterialNum__14J3DModelLoaderFPCv, - (void*)setupBBoardInfo__14J3DModelLoaderFv, - (void*)__dt__18J3DModelLoader_v26Fv, - (void*)readMaterial__18J3DModelLoader_v26FPC16J3DMaterialBlockUl, - (void*)readMaterial_v21__14J3DModelLoaderFPC20J3DMaterialBlock_v21Ul, - (void*)readMaterialTable__18J3DModelLoader_v26FPC16J3DMaterialBlockUl, - (void*)readMaterialTable_v21__14J3DModelLoaderFPC20J3DMaterialBlock_v21Ul, - (void*)calcSizeMaterial__18J3DModelLoader_v26FPC16J3DMaterialBlockUl, - (void*)calcSizeMaterialTable__18J3DModelLoader_v26FPC16J3DMaterialBlockUl, -}; - -/* 803CF190-803CF1BC 02C2B0 002C+00 2/2 0/0 0/0 .data - * __vt__83J3DMtxCalcNoAnm<32J3DMtxCalcCalcTransformSoftimage,29J3DMtxCalcJ3DSysInitSoftimage> */ -SECTION_DATA extern void* data_803CF190[11] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)func_803364B8, - (void*)setAnmTransform__10J3DMtxCalcFP15J3DAnmTransform, - (void*)getAnmTransform__10J3DMtxCalcFv, - (void*)setAnmTransform__10J3DMtxCalcFUcP15J3DAnmTransform, - (void*)getAnmTransform__10J3DMtxCalcFUc, - (void*)setWeight__10J3DMtxCalcFUcf, - (void*)getWeight__10J3DMtxCalcCFUc, - (void*)func_80336524, - (void*)func_8033656C, -}; - -/* 803CF1BC-803CF1E8 02C2DC 002C+00 2/2 0/0 0/0 .data - * __vt__75J3DMtxCalcNoAnm<28J3DMtxCalcCalcTransformBasic,25J3DMtxCalcJ3DSysInitBasic> */ -SECTION_DATA extern void* data_803CF1BC[11] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)func_80336594, - (void*)setAnmTransform__10J3DMtxCalcFP15J3DAnmTransform, - (void*)getAnmTransform__10J3DMtxCalcFv, - (void*)setAnmTransform__10J3DMtxCalcFUcP15J3DAnmTransform, - (void*)getAnmTransform__10J3DMtxCalcFUc, - (void*)setWeight__10J3DMtxCalcFUcf, - (void*)getWeight__10J3DMtxCalcCFUc, - (void*)func_80336600, - (void*)func_80336628, -}; - -/* 803CF1E8-803CF1F4 02C308 000C+00 4/4 0/0 0/0 .data __vt__10J3DTexture */ -SECTION_DATA extern void* __vt__10J3DTexture[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__10J3DTextureFv, -}; - -/* 803CF1F4-803CF238 02C314 0044+00 5/5 0/0 0/0 .data __vt__14J3DModelLoader */ -SECTION_DATA extern void* __vt__14J3DModelLoader[17] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)load__14J3DModelLoaderFPCvUl, - (void*)loadMaterialTable__14J3DModelLoaderFPCv, - (void*)loadBinaryDisplayList__14J3DModelLoaderFPCvUl, - (void*)calcLoadSize__14J3DModelLoaderFPCvUl, - (void*)calcLoadMaterialTableSize__14J3DModelLoaderFPCv, - (void*)calcLoadBinaryDisplayListSize__14J3DModelLoaderFPCvUl, - (void*)countMaterialNum__14J3DModelLoaderFPCv, - (void*)setupBBoardInfo__14J3DModelLoaderFv, - (void*)__dt__14J3DModelLoaderFv, - (void*)readMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl, - (void*)readMaterial_v21__14J3DModelLoaderFPC20J3DMaterialBlock_v21Ul, - (void*)readMaterialTable__14J3DModelLoaderFPC16J3DMaterialBlockUl, - (void*)readMaterialTable_v21__14J3DModelLoaderFPC20J3DMaterialBlock_v21Ul, - (void*)calcSizeMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl, - (void*)calcSizeMaterialTable__14J3DModelLoaderFPC16J3DMaterialBlockUl, -}; /* 8033468C-803346BC 32EFCC 0030+00 1/1 0/0 0/0 .text __ct__14J3DModelLoaderFv */ -#ifdef NONMATCHING -// matches once vtable ordering is correct J3DModelLoader::J3DModelLoader() : mpModelData(NULL), mpMaterialTable(NULL), @@ -271,15 +26,8 @@ J3DModelLoader::J3DModelLoader() : mEnvelopeSize(0) { /* empty function */ } -#else -J3DModelLoader::J3DModelLoader() { - // NONMATCHING -} -#endif /* 803346BC-803347E0 32EFFC 0124+00 0/0 4/4 0/0 .text load__22J3DModelLoaderDataBaseFPCvUl */ -#ifdef NONMATCHING -// matches once vtable ordering is correct J3DModelData* J3DModelLoaderDataBase::load(void const* i_data, u32 i_flags) { if (i_data == NULL) { return NULL; @@ -297,18 +45,6 @@ J3DModelData* J3DModelLoaderDataBase::load(void const* i_data, u32 i_flags) { } return NULL; } -#else -J3DModelData* J3DModelLoaderDataBase::load(void const* param_0, u32 param_1) { - // NONMATCHING -} -#endif - -/* ############################################################################################## */ -/* 803A20B0-803A20B0 02E710 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_803A20B0 = "Unknown data block\n"; -#pragma pop /* 803347E0-80334ABC 32F120 02DC+00 4/1 0/0 0/0 .text load__14J3DModelLoaderFPCvUl */ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) { @@ -370,8 +106,6 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) { /* 80334ABC-80334C20 32F3FC 0164+00 3/0 0/0 0/0 .text loadMaterialTable__14J3DModelLoaderFPCv */ -#ifdef NONMATCHING -// weak fn ordering J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) { mpMaterialTable = new J3DMaterialTable(); mpMaterialTable->clear(); @@ -399,11 +133,6 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) { } return mpMaterialTable; } -#else -J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* param_0) { - // NONMATCHING -} -#endif /* 80334C20-80334EE0 32F560 02C0+00 3/0 0/0 0/0 .text * loadBinaryDisplayList__14J3DModelLoaderFPCvUl */ @@ -416,10 +145,11 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl J3DModelFileData const* data = (J3DModelFileData*)i_data; J3DModelBlock const* block = data->mBlocks; for (u32 block_no = 0; block_no < data->mBlockNum; block_no++) { + s32 flags; switch (block->mBlockType) { case 'INF1': - s32 flags2 = i_flags; - readInformation((J3DModelInfoBlock*)block, flags2); + flags = i_flags; + readInformation((J3DModelInfoBlock*)block, flags); break; case 'VTX1': readVertex((J3DVertexBlock*)block); @@ -444,7 +174,7 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl modifyMaterial(i_flags); break; case 'MAT3': - s32 flags = 0x50100000; + flags = 0x50100000; flags |= (i_flags & 0x3000000); mpMaterialBlock = (J3DMaterialBlock*)block; if (((u32)i_flags & 0x3000) == 0) { @@ -468,14 +198,6 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl return mpModelData; } - -/* ############################################################################################## */ -/* 803A20B0-803A20B0 02E710 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_803A20C4 = "WRONG SHAPE MATRIX TYPE (__FILE__)\n"; -#pragma pop - /* 80334EE0-80335048 32F820 0168+00 3/0 0/0 0/0 .text setupBBoardInfo__14J3DModelLoaderFv */ void J3DModelLoader::setupBBoardInfo() { @@ -483,12 +205,11 @@ void J3DModelLoader::setupBBoardInfo() { J3DMaterial* mesh = mpModelData->getJointNodePointer(i)->getMesh(); if (mesh != NULL) { u16 shape_index = mesh->getShape()->getIndex(); - // u16* index_table = JSUConvertOffsetToPtr(mpShapeBlock, mpShapeBlock->mpIndexTable); - u16* index_table = func_8033677C(mpShapeBlock, mpShapeBlock->mpIndexTable); + u16* index_table = JSUConvertOffsetToPtr(mpShapeBlock, + (u32)mpShapeBlock->mpIndexTable); J3DShapeInitData* shape_init_data = - // JSUConvertOffsetToPtr(mpShapeBlock, - // mpShapeBlock->mpShapeInitData); - func_80336764(mpShapeBlock, mpShapeBlock->mpShapeInitData); + JSUConvertOffsetToPtr(mpShapeBlock, + (u32)mpShapeBlock->mpShapeInitData); J3DJoint* joint; switch (shape_init_data[index_table[shape_index]].mShapeMtxType) { case 0: @@ -519,8 +240,6 @@ void J3DModelLoader::setupBBoardInfo() { /* 80335048-803351A4 32F988 015C+00 2/2 0/0 0/0 .text * readInformation__14J3DModelLoaderFPC17J3DModelInfoBlockUl */ -#ifdef NONMATCHING -// will match once generics located correctly void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_flags) { mpModelData->mFlags = i_flags | i_block->mFlags; mpModelData->getJointTree().setFlag(mpModelData->mFlags); @@ -541,11 +260,6 @@ void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_fla mpModelData->getVertexData().mVtxNum = i_block->mVtxNum; mpModelData->setHierarchy(JSUConvertOffsetToPtr(i_block, i_block->mpHierarchy)); } -#else -void J3DModelLoader::readInformation(J3DModelInfoBlock const* i_block, u32 i_flags) { - // NONMATCHING -} -#endif /* 803351A4-803351D0 32FAE4 002C+00 1/1 0/0 0/0 .text getFmtType__FP17_GXVtxAttrFmtList7_GXAttr */ static _GXCompType getFmtType(_GXVtxAttrFmtList* i_fmtList, _GXAttr i_attr) { @@ -562,23 +276,17 @@ static _GXCompType getFmtType(_GXVtxAttrFmtList* i_fmtList, _GXAttr i_attr) { void J3DModelLoader::readVertex(J3DVertexBlock const* i_block) { J3DVertexData& vertex_data = mpModelData->getVertexData(); vertex_data.mVtxAttrFmtList = - // JSUConvertOffsetToPtr(i_block, i_block->mpVtxAttrFmtList); - func_80336734(i_block, i_block->mpVtxAttrFmtList); - // vertex_data.mVtxPosArray = JSUConvertOffsetToPtr(i_block, i_block->mpVtxPosArray); - vertex_data.mVtxPosArray = func_8033671C(i_block, i_block->mpVtxPosArray); - // vertex_data.mVtxNrmArray = JSUConvertOffsetToPtr(i_block, i_block->mpVtxNrmArray); - vertex_data.mVtxNrmArray = func_8033671C(i_block, i_block->mpVtxNrmArray); - // vertex_data.mVtxNBTArray = JSUConvertOffsetToPtr(i_block, i_block->mpVtxNBTArray); - vertex_data.mVtxNBTArray = func_8033671C(i_block, i_block->mpVtxNBTArray); + JSUConvertOffsetToPtr(i_block, i_block->mpVtxAttrFmtList); + vertex_data.mVtxPosArray = JSUConvertOffsetToPtr(i_block, i_block->mpVtxPosArray); + vertex_data.mVtxNrmArray = JSUConvertOffsetToPtr(i_block, i_block->mpVtxNrmArray); + vertex_data.mVtxNBTArray = JSUConvertOffsetToPtr(i_block, i_block->mpVtxNBTArray); for (int i = 0; i < 2; i++) { vertex_data.mVtxColorArray[i] = - // (GXColor*)JSUConvertOffsetToPtr(i_block, i_block->mpVtxColorArray[i]); - (GXColor*)func_8033671C(i_block, i_block->mpVtxColorArray[i]); + (GXColor*)JSUConvertOffsetToPtr(i_block, i_block->mpVtxColorArray[i]); } for (int i = 0; i < 8; i++) { vertex_data.mVtxTexCoordArray[i] = - // JSUConvertOffsetToPtr(i_block, i_block->mpVtxTexCoordArray[i]); - func_8033671C(i_block, i_block->mpVtxTexCoordArray[i]); + JSUConvertOffsetToPtr(i_block, i_block->mpVtxTexCoordArray[i]); } _GXCompType nrm_type = getFmtType(vertex_data.mVtxAttrFmtList, GX_VA_NRM); @@ -629,14 +337,12 @@ void J3DModelLoader::readEnvelop(J3DEnvelopeBlock const* i_block) { mpModelData->getJointTree().mWEvlpMtxNum = i_block->mWEvlpMtxNum; mpModelData->getJointTree().mWEvlpMixMtxNum = JSUConvertOffsetToPtr(i_block, i_block->mpWEvlpMixMtxNum); - mpModelData->getJointTree().mWEvlpMixIndex = + mpModelData->getJointTree().mWEvlpMixMtxIndex = JSUConvertOffsetToPtr(i_block, i_block->mpWEvlpMixIndex); mpModelData->getJointTree().mWEvlpMixWeight = - // JSUConvertOffsetToPtr(i_block, i_block->mpWEvlpMixWeight); - func_8030A560(i_block, i_block->mpWEvlpMixWeight); + JSUConvertOffsetToPtr(i_block, i_block->mpWEvlpMixWeight); mpModelData->getJointTree().mInvJointMtx = - // JSUConvertOffsetToPtr(i_block, i_block->mpInvJointMtx); - func_80336704(i_block, i_block->mpInvJointMtx); + JSUConvertOffsetToPtr(i_block, i_block->mpInvJointMtx); } /* 80335480-80335530 32FDC0 00B0+00 2/2 0/0 0/0 .text readDraw__14J3DModelLoaderFPC12J3DDrawBlock @@ -664,8 +370,7 @@ void J3DModelLoader::readJoint(J3DJointBlock const* i_block) { mpModelData->getJointTree().mJointNum = i_block->mJointNum; if (i_block->mpNameTable != NULL) { mpModelData->getJointTree().mJointName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { mpModelData->getJointTree().mJointName = NULL; } @@ -684,8 +389,7 @@ void J3DModelLoader_v26::readMaterial(J3DMaterialBlock const* i_block, u32 i_fla mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials(); if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { mpMaterialTable->mMaterialName = NULL; } @@ -729,8 +433,7 @@ void J3DModelLoader_v21::readMaterial_v21(J3DMaterialBlock_v21 const* i_block, u mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials(); if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { mpMaterialTable->mMaterialName = NULL; } @@ -772,8 +475,7 @@ void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) { shape_table->mShapeNum = i_block->mShapeNum; if (i_block->mpNameTable != NULL) { shape_table->mShapeName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { shape_table->mShapeName = NULL; } @@ -792,26 +494,17 @@ void J3DModelLoader::readShape(J3DShapeBlock const* i_block, u32 i_flags) { /* 80335C18-80335CE4 330558 00CC+00 2/2 0/0 0/0 .text * readTexture__14J3DModelLoaderFPC15J3DTextureBlock */ -#ifdef NONMATCHING -// weak fn ordering void J3DModelLoader::readTexture(J3DTextureBlock const* i_block) { u16 texture_num = i_block->mTextureNum; - // ResTIMG* texture_res = JSUConvertOffsetToPtr(i_block, i_block->mpTextureRes); - ResTIMG* texture_res = func_803366EC(i_block, i_block->mpTextureRes); + ResTIMG* texture_res = JSUConvertOffsetToPtr(i_block, i_block->mpTextureRes); if (i_block->mpNameTable != NULL) { mpMaterialTable->mTextureName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { mpMaterialTable->mTextureName = NULL; } mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res); } -#else -void J3DModelLoader::readTexture(J3DTextureBlock const* param_0) { - // NONMATCHING -} -#endif /* 80335CE4-80335E20 330624 013C+00 1/0 0/0 0/0 .text * readMaterialTable__18J3DModelLoader_v26FPC16J3DMaterialBlockUl */ @@ -820,8 +513,7 @@ void J3DModelLoader_v26::readMaterialTable(J3DMaterialBlock const* i_block, u32 mpMaterialTable->mMaterialNum = i_block->mMaterialNum; if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { mpMaterialTable->mMaterialName = NULL; } @@ -843,8 +535,7 @@ void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_blo mpMaterialTable->mMaterialNum = i_block->mMaterialNum; if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { mpMaterialTable->mMaterialName = NULL; } @@ -861,26 +552,17 @@ void J3DModelLoader_v21::readMaterialTable_v21(J3DMaterialBlock_v21 const* i_blo /* 80335F5C-80336028 33089C 00CC+00 1/1 0/0 0/0 .text * readTextureTable__14J3DModelLoaderFPC15J3DTextureBlock */ -#ifdef NONMATCHING -// weak fn ordering void J3DModelLoader::readTextureTable(J3DTextureBlock const* i_block) { u16 texture_num = i_block->mTextureNum; - // ResTIMG* texture_res = JSUConvertOffsetToPtr(i_block, i_block->mpTextureRes); - ResTIMG* texture_res = func_803366EC(i_block, i_block->mpTextureRes); + ResTIMG* texture_res = JSUConvertOffsetToPtr(i_block, i_block->mpTextureRes); if (i_block->mpNameTable != NULL) { mpMaterialTable->mTextureName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { mpMaterialTable->mTextureName = NULL; } mpMaterialTable->mTexture = new J3DTexture(texture_num, texture_res); } -#else -void J3DModelLoader::readTextureTable(J3DTextureBlock const* param_0) { - // NONMATCHING -} -#endif /* 80336028-80336168 330968 0140+00 1/1 0/0 0/0 .text * readPatchedMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl */ @@ -890,8 +572,7 @@ void J3DModelLoader::readPatchedMaterial(J3DMaterialBlock const* i_block, u32 i_ mpMaterialTable->mUniqueMatNum = factory.countUniqueMaterials(); if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { mpMaterialTable->mMaterialName = NULL; } @@ -916,8 +597,7 @@ void J3DModelLoader::readMaterialDL(J3DMaterialDLBlock const* i_block, u32 i_fla mpMaterialTable->mUniqueMatNum = i_block->mMaterialNum; if (i_block->mpNameTable != NULL) { mpMaterialTable->mMaterialName = - // new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); - new JUTNameTab(func_8030A530(i_block, i_block->mpNameTable)); + new JUTNameTab(JSUConvertOffsetToPtr(i_block, i_block->mpNameTable)); } else { mpMaterialTable->mMaterialName = NULL; } @@ -951,148 +631,3 @@ void J3DModelLoader::modifyMaterial(u32 i_flags) { } } } - -/* 80336398-803363F4 330CD8 005C+00 1/0 0/0 0/0 .text __dt__18J3DModelLoader_v26Fv */ -// J3DModelLoader_v26::~J3DModelLoader_v26() { -extern "C" void __dt__18J3DModelLoader_v26Fv() { - // NONMATCHING -} - -/* 803363F4-80336450 330D34 005C+00 1/0 0/0 0/0 .text __dt__18J3DModelLoader_v21Fv */ -// J3DModelLoader_v21::~J3DModelLoader_v21() { -extern "C" void __dt__18J3DModelLoader_v21Fv() { - // NONMATCHING -} - -/* 80336450-80336498 330D90 0048+00 1/0 0/0 0/0 .text __dt__14J3DModelLoaderFv */ -J3DModelLoader::~J3DModelLoader() { - // NONMATCHING -} - -/* 80336498-8033649C 330DD8 0004+00 2/0 0/0 0/0 .text - * readMaterial_v21__14J3DModelLoaderFPC20J3DMaterialBlock_v21Ul */ -void J3DModelLoader::readMaterial_v21(J3DMaterialBlock_v21 const* param_0, u32 param_1) { - /* empty function */ -} - -/* 8033649C-803364A0 330DDC 0004+00 2/0 0/0 0/0 .text - * readMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl */ -void J3DModelLoader::readMaterial(J3DMaterialBlock const* param_0, u32 param_1) { - /* empty function */ -} - -/* 803364A0-803364A4 330DE0 0004+00 2/0 0/0 0/0 .text - * readMaterialTable_v21__14J3DModelLoaderFPC20J3DMaterialBlock_v21Ul */ -void J3DModelLoader::readMaterialTable_v21(J3DMaterialBlock_v21 const* param_0, u32 param_1) { - /* empty function */ -} - -/* 803364A4-803364A8 330DE4 0004+00 2/0 0/0 0/0 .text - * readMaterialTable__14J3DModelLoaderFPC16J3DMaterialBlockUl */ -void J3DModelLoader::readMaterialTable(J3DMaterialBlock const* param_0, u32 param_1) { - /* empty function */ -} - -/* 803364A8-803364B0 330DE8 0008+00 2/0 0/0 0/0 .text - * calcSizeMaterial__14J3DModelLoaderFPC16J3DMaterialBlockUl */ -u32 J3DModelLoader::calcSizeMaterial(J3DMaterialBlock const* param_0, u32 param_1) { - return false; -} - -/* 803364B0-803364B8 330DF0 0008+00 2/0 0/0 0/0 .text - * calcSizeMaterialTable__14J3DModelLoaderFPC16J3DMaterialBlockUl */ -u32 J3DModelLoader::calcSizeMaterialTable(J3DMaterialBlock const* param_0, u32 param_1) { - return false; -} - -/* 803364B8-80336524 330DF8 006C+00 1/0 0/0 0/0 .text - * __dt__83J3DMtxCalcNoAnm<32J3DMtxCalcCalcTransformSoftimage,29J3DMtxCalcJ3DSysInitSoftimage>Fv */ -extern "C" void func_803364B8(void* _this) { - // NONMATCHING -} - -/* 80336524-8033656C 330E64 0048+00 1/0 0/0 0/0 .text - * init__83J3DMtxCalcNoAnm<32J3DMtxCalcCalcTransformSoftimage,29J3DMtxCalcJ3DSysInitSoftimage>FRC3VecRA3_A4_Cf - */ -extern "C" void func_80336524(void* _this, Vec const& param_0, f32 const (¶m_1)[3][4]) { - // NONMATCHING -} - -/* 8033656C-80336594 330EAC 0028+00 1/0 0/0 0/0 .text - * calc__83J3DMtxCalcNoAnm<32J3DMtxCalcCalcTransformSoftimage,29J3DMtxCalcJ3DSysInitSoftimage>Fv */ -extern "C" void func_8033656C(void* _this) { - // NONMATCHING -} - -/* 80336594-80336600 330ED4 006C+00 1/0 0/0 0/0 .text - * __dt__75J3DMtxCalcNoAnm<28J3DMtxCalcCalcTransformBasic,25J3DMtxCalcJ3DSysInitBasic>Fv */ -extern "C" void func_80336594(void* _this) { - // NONMATCHING -} - -/* 80336600-80336628 330F40 0028+00 1/0 0/0 0/0 .text - * init__75J3DMtxCalcNoAnm<28J3DMtxCalcCalcTransformBasic,25J3DMtxCalcJ3DSysInitBasic>FRC3VecRA3_A4_Cf - */ -extern "C" void func_80336600(void* _this, Vec const& param_0, f32 const (¶m_1)[3][4]) { - // NONMATCHING -} - -/* 80336628-80336650 330F68 0028+00 1/0 0/0 0/0 .text - * calc__75J3DMtxCalcNoAnm<28J3DMtxCalcCalcTransformBasic,25J3DMtxCalcJ3DSysInitBasic>Fv */ -extern "C" void func_80336628(void* _this) { - // NONMATCHING -} - -/* 80336650-803366A4 330F90 0054+00 2/2 0/0 0/0 .text __ct__11J3DMaterialFv */ -// J3DMaterial::J3DMaterial() { -extern "C" void __ct__11J3DMaterialFv() { - // NONMATCHING -} - -/* 803366A4-803366EC 330FE4 0048+00 1/0 0/0 0/0 .text __dt__10J3DTextureFv */ -// J3DTexture::~J3DTexture() { -extern "C" void __dt__10J3DTextureFv() { - // NONMATCHING -} - -/* 803366EC-80336704 33102C 0018+00 2/2 0/0 0/0 .text JSUConvertOffsetToPtr<7ResTIMG>__FPCvPCv */ -extern "C" ResTIMG* func_803366EC(void const* param_0, void const* param_1) { - // NONMATCHING -} - -/* 80336704-8033671C 331044 0018+00 1/1 0/0 0/0 .text JSUConvertOffsetToPtr__FPCvPCv */ -extern "C" Mtx* func_80336704(void const* param_0, void const* param_1) { - // NONMATCHING -} - -/* 8033671C-80336734 33105C 0018+00 1/1 0/0 0/0 .text JSUConvertOffsetToPtr__FPCvPCv - */ -extern "C" void* func_8033671C(void const* param_0, void const* param_1) { - // NONMATCHING -} - -/* 80336734-8033674C 331074 0018+00 1/1 0/0 0/0 .text - * JSUConvertOffsetToPtr<17_GXVtxAttrFmtList>__FPCvPCv */ -extern "C" _GXVtxAttrFmtList* func_80336734(void const* param_0, void const* param_1) { - // NONMATCHING -} - -/* 8033674C-80336764 33108C 0018+00 1/1 1/1 0/0 .text - * JSUConvertOffsetToPtr<17J3DModelHierarchy>__FPCvPCv */ -extern "C" J3DModelHierarchy* func_8033674C(void const* param_0, void const* param_1) { - // NONMATCHING -} - -/* 80336764-8033677C 3310A4 0018+00 1/1 1/1 0/0 .text - * JSUConvertOffsetToPtr<16J3DShapeInitData>__FPCvUl */ -extern "C" J3DShapeInitData* func_80336764(void const* param_0, void const* param_1) { - // NONMATCHING -} - -/* 8033677C-80336794 3310BC 0018+00 1/1 2/2 0/0 .text JSUConvertOffsetToPtr__FPCvUl - */ -extern "C" u16* func_8033677C(void const* param_0, void const* param_1) { - // NONMATCHING -} - -/* 803A20B0-803A20B0 02E710 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index 0418b140eb9..310817cc93b 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -1414,11 +1414,6 @@ J3DMtxCalcAnmBase::~J3DMtxCalcAnmBase() { // NONMATCHING } -/* 8000D948-8000D990 008288 0048+00 1/0 0/0 0/0 .text __dt__10J3DMtxCalcFv */ -J3DMtxCalc::~J3DMtxCalc() { - // NONMATCHING -} - /* 8000D990-8000D9CC 0082D0 003C+00 0/0 5/5 31/31 .text * changeBckOnly__13mDoExt_bckAnmFP15J3DAnmTransform */ void mDoExt_bckAnm::changeBckOnly(J3DAnmTransform* i_bck) {