From 6c945a4e29c567960fd77320cf6f72387811eb33 Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Fri, 14 Jul 2023 11:30:07 +0300 Subject: Work on J3DSkinDeform --- include/JSystem/J3DGraphAnimator/J3DJointTree.h | 3 +- include/JSystem/J3DGraphAnimator/J3DModel.h | 1 + include/JSystem/J3DGraphAnimator/J3DModelData.h | 7 + include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h | 5 +- include/JSystem/J3DGraphAnimator/J3DSkinDeform.h | 45 ++++-- include/JSystem/J3DGraphBase/J3DShape.h | 1 + include/JSystem/J3DGraphBase/J3DShapeDraw.h | 1 + include/JSystem/J3DGraphBase/J3DTransform.h | 193 +++++++++++++++++++++++ include/JSystem/J3DGraphBase/J3DVertex.h | 24 +++ include/dolphin/mtx/mtx.h | 1 + 10 files changed, 266 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/JSystem/J3DGraphAnimator/J3DJointTree.h b/include/JSystem/J3DGraphAnimator/J3DJointTree.h index dc74089af3..3697cdb62b 100644 --- a/include/JSystem/J3DGraphAnimator/J3DJointTree.h +++ b/include/JSystem/J3DGraphAnimator/J3DJointTree.h @@ -45,13 +45,14 @@ public: u16 getJointNum() const { return mJointNum; } u16 getDrawMtxNum() const { return mDrawMtxData.mEntryNum; } u8 getDrawMtxFlag(u16 idx) const { return mDrawMtxData.mDrawMtxFlag[idx]; } - u8 getDrawMtxIndex(u16 idx) const { return mDrawMtxData.mDrawMtxIndex[idx]; } + u16 getDrawMtxIndex(u16 idx) const { return mDrawMtxData.mDrawMtxIndex[idx]; } JUTNameTab* getJointName() const { return mJointName; } J3DJoint* getRootNode() { return mRootNode; } J3DJoint* getJointNodePointer(u16 idx) const { return mJointNodePointer[idx]; } J3DMtxCalc* getBasicMtxCalc() const { return mBasicMtxCalc; } Mtx& getInvJointMtx(s32 idx) const { return mInvJointMtx[idx]; } u32 getModelDataType() const { return mModelDataType; } + bool checkFlag(u32 flag) { return mFlags & flag; } private: /* 0x04 */ J3DModelHierarchy* mHierarchy; diff --git a/include/JSystem/J3DGraphAnimator/J3DModel.h b/include/JSystem/J3DGraphAnimator/J3DModel.h index 80176968f8..d5610fc11b 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModel.h +++ b/include/JSystem/J3DGraphAnimator/J3DModel.h @@ -79,6 +79,7 @@ public: J3DVertexBuffer* getVertexBuffer() const { return (J3DVertexBuffer*)&mVertexBuffer; } J3DMatPacket* getMatPacket(u16 idx) const { return &mMatPacket[idx]; } J3DShapePacket* getShapePacket(u16 idx) const { return &mShapePacket[idx]; } + J3DMtxBuffer* getMtxBuffer() const { return mMtxBuffer; } Mtx33* getBumpMtxPtr(int idx) const { return mMtxBuffer->getBumpMtxPtr(idx); } Mtx33* getNrmMtxPtr() const { return mMtxBuffer->getNrmMtxPtr(); } Mtx* getDrawMtxPtr() const { return mMtxBuffer->getDrawMtxPtr(); } diff --git a/include/JSystem/J3DGraphAnimator/J3DModelData.h b/include/JSystem/J3DGraphAnimator/J3DModelData.h index 441b2fdebd..ca2d8ee971 100644 --- a/include/JSystem/J3DGraphAnimator/J3DModelData.h +++ b/include/JSystem/J3DGraphAnimator/J3DModelData.h @@ -34,6 +34,10 @@ public: J3DMaterial* getMaterialNodePointer(u16 idx) const { return mMaterialTable.getMaterialNodePointer(idx); } + u32 getVtxNum() const { return mVertexData.getVtxNum(); } + u32 getNrmNum() const { return mVertexData.getNrmNum(); } + u8 getDrawMtxFlag(u16 idx) const { return mJointTree.getDrawMtxFlag(idx); } + u16 getDrawMtxIndex(u16 idx) const { return mJointTree.getDrawMtxIndex(idx); } J3DShape* getShapeNodePointer(u16 idx) const { return mShapeTable.getShapeNodePointer(idx); } J3DJoint* getJointNodePointer(u16 idx) const { return mJointTree.getJointNodePointer(idx); } J3DJointTree& getJointTree() { return mJointTree; } @@ -42,6 +46,9 @@ public: J3DTexture* getTexture() const { return mMaterialTable.getTexture(); } JUTNameTab* getTextureName() const { return mMaterialTable.getTextureName(); } u16 getWEvlpMtxNum() const { return mJointTree.getWEvlpMtxNum(); } + u16* getWEvlpMixMtxIndex() const { return mJointTree.getWEvlpMixIndex(); } + f32* getWEvlpMixWeight() const { return mJointTree.getWEvlpMixWeight(); } + u8 getWEvlpMixMtxNum(u16 idx) const { return mJointTree.getWEvlpMixMtxNum(idx); } u32 getModelDataType() const { return mJointTree.getModelDataType(); } void* getVtxPosArray() const { return mVertexData.getVtxPosArray(); } void* getVtxNrmArray() const { return mVertexData.getVtxNrmArray(); } diff --git a/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h b/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h index c709985d7c..4aece3b46d 100644 --- a/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h +++ b/include/JSystem/J3DGraphAnimator/J3DMtxBuffer.h @@ -26,11 +26,13 @@ public: MtxP getAnmMtx(int idx) const { return mpAnmMtx[idx]; } void setAnmMtx(int i, Mtx m) { PSMTXCopy(m, (MtxP)mpAnmMtx[i]); } + MtxP getWeightAnmMtx(int idx) const { return mpWeightEvlpMtx[idx]; } void setScaleFlag(int idx, u8 flag) { mpScaleFlagArr[idx] = flag; } u32* getCurrentViewNoPtr() { return &mCurrentViewNo; } u8* getScaleFlagArray() const { return mpScaleFlagArr; } - u8 getScaleFlag(u16 idx) const { return mpScaleFlagArr[idx]; } + u8 getScaleFlag(int idx) const { return mpScaleFlagArr[idx]; } + 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]; } @@ -39,6 +41,7 @@ public: Mtx33* getNrmMtx(u16 idx) const { return &mpNrmMtxArr[1][mCurrentViewNo][idx]; } Mtx33*** getBumpMtxPtrPtr() const { return mpBumpMtxArr[1]; } Mtx33* getBumpMtxPtr(int idx) const { return mpBumpMtxArr[1][idx][mCurrentViewNo]; } + J3DJointTree* getJointTree() const { return mJointTree; } void swapDrawMtx() { Mtx* tmp = mpDrawMtxArr[0][mCurrentViewNo]; diff --git a/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h b/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h index 63d138b1c2..520e0f67fd 100644 --- a/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h +++ b/include/JSystem/J3DGraphAnimator/J3DSkinDeform.h @@ -5,6 +5,7 @@ #include "JSystem/J3DGraphAnimator/J3DModelData.h" #include "JSystem/J3DGraphAnimator/J3DMtxBuffer.h" #include "JSystem/J3DGraphBase/J3DVertex.h" +#include "JSystem/J3DGraphBase/J3DTransform.h" #include "dolphin/types.h" class J3DModel; @@ -38,10 +39,10 @@ struct J3DSkinNList { /* 8032C85C */ void calcSkin_VtxPosF32(f32 (*)[4], void*, void*); /* 8032C8E4 */ void calcSkin_VtxNrmF32(f32 (*)[4], void*, void*); - /* 0x00 */ int field_0x0; - /* 0x04 */ int field_0x4; - /* 0x08 */ int field_0x8; - /* 0x0C */ int field_0xc; + /* 0x00 */ u16* field_0x0; + /* 0x04 */ u16* field_0x4; + /* 0x08 */ f32* field_0x8; + /* 0x0C */ f32* field_0xc; /* 0x10 */ u16 field_0x10; /* 0x12 */ u16 field_0x12; }; // Size: 0x14 @@ -50,7 +51,7 @@ class J3DSkinDeform { public: /* 8032C96C */ J3DSkinDeform(); /* 8032C9B0 */ void initSkinInfo(J3DModelData*); - /* 8032CF44 */ void initMtxIndexArray(J3DModelData*); + /* 8032CF44 */ int initMtxIndexArray(J3DModelData*); /* 8032D378 */ void changeFastSkinDL(J3DModelData*); /* 8032D5C4 */ void calcNrmMtx(J3DMtxBuffer*); /* 8032D738 */ void transformVtxPosNrm(J3DModelData*); @@ -62,25 +63,32 @@ public: /* 8032DDB8 */ void deformVtxNrm_F32(J3DVertexBuffer*) const; /* 8032DEBC */ void deformVtxNrm_S16(J3DVertexBuffer*) const; /* 8032DFDC */ void deform(J3DModel*); + void setNrmMtx(int i, MtxP mtx) { + J3DPSMtx33CopyFrom34(mtx, (Mtx3P)mNrmMtx[i]); + } + Mtx3P getNrmMtx(int i) { return mNrmMtx[i]; } + void onFlag(u32 flag) { mFlags |= flag; } + void offFlag(u32 flag) { mFlags &= ~flag; } + bool checkFlag(u32 flag) { return mFlags & flag; } /* 8032E064 */ virtual void deform(J3DVertexBuffer*, J3DMtxBuffer*); /* 8032E1B0 */ virtual ~J3DSkinDeform(); - static u8 sWorkArea_WEvlpMixMtx[4096]; - static u8 sWorkArea_WEvlpMixWeight[4096]; - static u8 sWorkArea_MtxReg[2048 + 8 /* padding */]; + static u16* sWorkArea_WEvlpMixMtx[1024]; + static f32* sWorkArea_WEvlpMixWeight[1024]; + static u16 sWorkArea_MtxReg[1024 + 4 /* padding */]; private: - /* 0x04 */ void** mPosData; - /* 0x08 */ void** field_0x8; - /* 0x0C */ void** field_0xc; - /* 0x10 */ Mtx** mNrmMtx; + /* 0x04 */ u16* mPosData; + /* 0x08 */ u16* mNrmData; + /* 0x0C */ Mtx* mPosMtx; + /* 0x10 */ Mtx33* mNrmMtx; /* 0x14 */ u32 mFlags; /* 0x18 */ u8 field_0x18; /* 0x19 */ u8 field_0x19; /* 0x1C */ int field_0x1c; /* 0x20 */ int field_0x20; - /* 0x24 */ J3DSkinNList** mSkinNList; + /* 0x24 */ J3DSkinNList* mSkinNList; }; class J3DDeformer { @@ -100,4 +108,15 @@ private: /* 0x10 */ u32 mFlags; }; // Size: 0x14 +inline void J3DFillZero32B(register void* param_0, register u32 param_1) { + asm { + srwi param_1, param_1, 5 + mtctr param_1 + lbl_8032D948: + dcbz 0, param_0 + addi param_0, param_0, 0x20 + bdnz lbl_8032D948 + } +} + #endif /* J3DSKINDEFORM_H */ diff --git a/include/JSystem/J3DGraphBase/J3DShape.h b/include/JSystem/J3DGraphBase/J3DShape.h index 8ceaf59661..102fb430da 100644 --- a/include/JSystem/J3DGraphBase/J3DShape.h +++ b/include/JSystem/J3DGraphBase/J3DShape.h @@ -107,6 +107,7 @@ public: void setTexMtxLoadType(u32 type) { mFlags = (mFlags & 0xFFFF0FFF) | type; } bool getNBTFlag() const { return mHasNBT; } u32 getBumpMtxOffset() const { return mBumpMtxOffset; } + GXVtxDescList* getVtxDesc() const { return mVtxDesc; } J3DMaterial* getMaterial() const { return mMaterial; } u32 getIndex() const { return mIndex; } diff --git a/include/JSystem/J3DGraphBase/J3DShapeDraw.h b/include/JSystem/J3DGraphBase/J3DShapeDraw.h index 8ad82a0c3d..2293fd6337 100644 --- a/include/JSystem/J3DGraphBase/J3DShapeDraw.h +++ b/include/JSystem/J3DGraphBase/J3DShapeDraw.h @@ -14,6 +14,7 @@ public: u8* getDisplayList() const { return (u8*)mDisplayList; } u32 getDisplayListSize() const { return mDisplayListSize; } + void setDisplayListSize(u32 size) { mDisplayListSize = size; } private: /* 0x04 */ u32 mDisplayListSize; diff --git a/include/JSystem/J3DGraphBase/J3DTransform.h b/include/JSystem/J3DGraphBase/J3DTransform.h index a162bd5b7c..884506ce42 100644 --- a/include/JSystem/J3DGraphBase/J3DTransform.h +++ b/include/JSystem/J3DGraphBase/J3DTransform.h @@ -14,8 +14,201 @@ struct J3DTransformInfo { extern J3DTransformInfo const j3dDefaultTransformInfo; extern Vec const j3dDefaultScale; extern Mtx const j3dDefaultMtx; +extern f32 PSMulUnit01[2]; void J3DGetTranslateRotateMtx(J3DTransformInfo const&, Mtx); void J3DGetTranslateRotateMtx(s16, s16, s16, f32, f32, f32, Mtx); +void J3DPSCalcInverseTranspose(f32 (*param_0)[4], f32 (*param_1)[3]); +void J3DGQRSetup7(u32 param_0, u32 param_1, u32 param_2, u32 param_3); + +inline void J3DPSMtx33CopyFrom34(register MtxP src, register Mtx3P dst) { + register f32 x_y1; + register f32 z1; + register f32 x_y2; + register f32 z2; + register f32 x_y3; + register f32 z3; + asm { + psq_l x_y1, 0(src), 0, 0 + lfs z1, 8(src) + psq_l x_y2, 16(src), 0, 0 + lfs z2, 0x18(src) + psq_l x_y3, 32(src), 0, 0 + lfs z3, 0x28(src) + psq_st x_y1, 0(dst), 0, 0 + stfs z1, 8(dst) + psq_st x_y2, 12(dst), 0, 0 + stfs z2, 0x14(dst) + psq_st x_y3, 24(dst), 0, 0 + stfs z3, 0x20(dst) + } +} + +// regalloc issues +inline void J3DPSMulMtxVec(register MtxP mtx, register Vec* vec, register Vec* dst) { + register f32 fr12; + register f32 fr11; + register f32 fr10; + register f32 fr9; + register f32 fr8; + register f32 fr6; + register f32 fra6; + register f32 fr5; + register f32 fra5; + register f32 fra4; + register f32 fr4; + register f32 fr3; + register f32 fr2; + register f32 fra2; + register f32 fr01; + register f32 fr00; + asm { + psq_l fr00, 0(vec), 0, 0 + psq_l fr2, 0(mtx), 0, 0 + psq_l fr01, 8(vec), 1, 0 + ps_mul fr4, fr2, fr00 + psq_l fr3, 8(mtx), 0, 0 + ps_madd fr5, fr3, fr01, fr4 + psq_l fr8, 16(mtx), 0, 0 + ps_sum0 fr6, fr5, fr6, fr5 + psq_l fr9, 24(mtx), 0, 0 + ps_mul fr10, fr8, fr00 + psq_st fr6, 0(dst), 1, 0 + ps_madd fr11, fr9, fr01, fr10 + psq_l fra2, 32(mtx), 0, 0 + ps_sum0 fr12, fr11, fr12, fr11 + psq_l fr3, 40(mtx), 0, 0 + ps_mul fra4, fra2, fr00 + psq_st fr12, 4(dst), 1, 0 + ps_madd fra5, fr3, fr01, fra4 + ps_sum0 fra6, fra5, fra6, fra5 + psq_st fra6, 8(dst), 1, 0 + } +} + +// regalloc issues +inline void J3DPSMulMtxVec(register MtxP mtx, register SVec* vec, register SVec* dst) { + register f32 fr12; + register f32 fr11; + register f32 fr10; + register f32 fr9; + register f32 fr8; + register f32 fr6; + register f32 fra6; + register f32 fr5; + register f32 fra5; + register f32 fra4; + register f32 fr4; + register f32 fr3; + register f32 fr2; + register f32 fra2; + register f32 fr01; + register f32 fr00; + asm { + psq_l fr00, 0(vec), 0, 7 + psq_l fr2, 0(mtx), 0, 0 + psq_l fr01, 4(vec), 1, 7 + ps_mul fr4, fr2, fr00 + psq_l fr3, 8(mtx), 0, 0 + ps_madd fr5, fr3, fr01, fr4 + psq_l fr8, 16(mtx), 0, 0 + ps_sum0 fr6, fr5, fr6, fr5 + psq_l fr9, 24(mtx), 0, 0 + ps_mul fr10, fr8, fr00 + psq_st fr6, 0(dst), 1, 7 + ps_madd fr11, fr9, fr01, fr10 + psq_l fra2, 32(mtx), 0, 0 + ps_sum0 fr12, fr11, fr12, fr11 + psq_l fr3, 40(mtx), 0, 0 + ps_mul fra4, fra2, fr00 + psq_st fr12, 2(dst), 1, 7 + ps_madd fra5, fr3, fr01, fra4 + ps_sum0 fra6, fra5, fra6, fra5 + psq_st fra6, 4(dst), 1, 7 + } +} + +// regalloc issues +inline void J3DPSMulMtxVec(register Mtx3P mtx, register Vec* vec, register Vec* dst) { + register f32* punit; + register f32 unit; + register f32 fr12; + register f32 fr11; + register f32 fr10; + register f32 fr9; + register f32 fr8; + register f32 fr6; + register f32 fr5; + register f32 fr4; + register f32 fr3; + register f32 fr2; + register f32 fr01; + register f32 fr00; + asm { + lis punit, PSMulUnit01@ha + psq_l fr00, 0(vec), 0, 0 + addi punit, punit, PSMulUnit01@l + psq_l fr2, 0(mtx), 0, 0 + psq_l unit, 0(punit), 0, 0 + psq_l fr01, 8(vec), 1, 0 + ps_add fr01, unit, fr01 + psq_l fr3, 8(mtx), 1, 0 + ps_mul fr4, fr2, fr00 + psq_l fr8, 12(mtx), 0, 0 + ps_madd fr5, fr3, fr01, fr4 + ps_sum0 fr6, fr5, fr6, fr5 + psq_l fr9, 20(mtx), 1, 0 + ps_mul fr10, fr8, fr00 + psq_st fr6, 0(dst), 1, 0 + ps_madd fr11, fr9, fr01, fr10 + psq_l fr2, 24(mtx), 0, 0 + ps_sum0 fr12, fr11, fr12, fr11 + psq_l fr3, 32(mtx), 1, 0 + ps_mul fr4, fr2, fr00 + psq_st fr12, 4(dst), 1, 0 + ps_madd fr5, fr3, fr01, fr4 + ps_sum0 fr6, fr5, fr6, fr5 + psq_st fr6, 8(dst), 1, 0 + } +} + +// regalloc issues +inline void J3DPSMulMtxVec(register Mtx3P mtx, register SVec* vec, register SVec* dst) { + register f32* punit; + register f32 unit; + register f32 fr6; + register f32 fr5; + register f32 fr4; + register f32 fr3; + register f32 fr2; + register f32 fr01; + register f32 fr00; + asm { + lis punit, PSMulUnit01@ha + psq_l fr00, 0(vec), 0, 7 + addi punit, punit, PSMulUnit01@l + psq_l fr2, 0(mtx), 0, 0 + psq_l unit, 0(punit), 0, 0 + psq_l fr01, 4(vec), 1, 7 + ps_add fr01, unit, fr01 + psq_l fr3, 8(mtx), 1, 0 + ps_mul fr4, fr2, fr00 + psq_l fr2, 12(mtx), 0, 0 + ps_madd fr5, fr3, fr01, fr4 + ps_sum0 fr6, fr5, fr6, fr5 + psq_l fr3, 20(mtx), 1, 0 + ps_mul fr4, fr2, fr00 + psq_st fr6, 0(dst), 1, 7 + ps_madd fr5, fr3, fr01, fr4 + psq_l fr2, 24(mtx), 0, 0 + ps_sum0 fr6, fr5, fr6, fr5 + psq_l fr3, 32(mtx), 1, 0 + ps_mul fr4, fr2, fr00 + psq_st fr6, 2(dst), 1, 7 + ps_madd fr5, fr3, fr01, fr4 + ps_sum0 fr6, fr5, fr6, fr5 + psq_st fr6, 4(dst), 1, 7 + } +} #endif /* J3DTRANSFORM_H */ diff --git a/include/JSystem/J3DGraphBase/J3DVertex.h b/include/JSystem/J3DGraphBase/J3DVertex.h index a601987c1d..2803c7838a 100644 --- a/include/JSystem/J3DGraphBase/J3DVertex.h +++ b/include/JSystem/J3DGraphBase/J3DVertex.h @@ -9,9 +9,11 @@ typedef struct _GXColor GXColor; class J3DModel; struct J3DAnmVtxColor; +struct J3DVertexBuffer; struct J3DVtxColorCalc { /* 8032E180 */ void calc(J3DModel*); + virtual void calc(J3DVertexBuffer*); /* 0x0 */ void* vtable; // inlined vtable? /* 0x4 */ u32 mFlags; @@ -30,6 +32,10 @@ public: u32 getNrmNum() const { return mNrmNum; } u32 getVtxNum() const { return mVtxNum; } GXVtxAttrFmtList* getVtxAttrFmtList() { return mVtxAttrFmtList; } + u8 getVtxPosFrac() { return mVtxPosFrac; } + u8 getVtxNrmFrac() { return mVtxNrmFrac; } + int getVtxPosType() { return mVtxPosType; } + int getVtxNrmType() { return mVtxNrmType; } void setVtxPosFrac(u8 frac) { mVtxPosFrac = frac; } void setVtxPosType(GXCompType type) { mVtxPosType = type; } @@ -69,8 +75,10 @@ public: /* 8031152C */ s32 allocTransformedVtxNrmArray(); void setCurrentVtxPos(void* pVtxPos) { mCurrentVtxPos = pVtxPos; } + void* getCurrentVtxPos() { return mCurrentVtxPos; } void setCurrentVtxNrm(void* pVtxNrm) { mCurrentVtxNrm = pVtxNrm; } + void* getCurrentVtxNrm() { return mCurrentVtxNrm; } void setCurrentVtxCol(GXColor* pVtxCol) { mCurrentVtxCol = pVtxCol; } @@ -80,6 +88,22 @@ public: setCurrentVtxCol(mVtxColArray[0]); } + void* getTransformedVtxPos(int idx) { return mTransformedVtxPosArray[idx]; } + void* getTransformedVtxNrm(int idx) { return mTransformedVtxNrmArray[idx]; } + J3DVertexData* getVertexData() { return mVtxData; } + + void swapTransformedVtxPos() { + void* tmp = mTransformedVtxPosArray[0]; + mTransformedVtxPosArray[0] = mTransformedVtxPosArray[1]; + mTransformedVtxPosArray[1] = tmp; + } + + void swapTransformedVtxNrm() { + void* tmp = mTransformedVtxNrmArray[0]; + mTransformedVtxNrmArray[0] = mTransformedVtxNrmArray[1]; + mTransformedVtxNrmArray[1] = tmp; + } + private: /* 0x00 */ J3DVertexData* mVtxData; /* 0x04 */ void* mVtxPosArray[2]; diff --git a/include/dolphin/mtx/mtx.h b/include/dolphin/mtx/mtx.h index edd5dab9f6..3b9b75299f 100644 --- a/include/dolphin/mtx/mtx.h +++ b/include/dolphin/mtx/mtx.h @@ -14,6 +14,7 @@ typedef f32 Mtx[3][4]; typedef f32 Mtx33[3][3]; typedef f32 Mtx23[2][3]; typedef f32 (*MtxP)[4]; +typedef f32 (*Mtx3P)[3]; typedef const f32 (*CMtxP)[4]; // Change name later? void PSMTXIdentity(Mtx m); -- cgit v1.2.3 From 66b3dc12ae1dfea56956dd8560a68d8fb078e4d9 Mon Sep 17 00:00:00 2001 From: Jcw87 Date: Sun, 9 Jul 2023 22:34:43 -0700 Subject: J2DGrafContext: Use inlines from debug, improved parameter names --- include/JSystem/J2DGraph/J2DGrafContext.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/JSystem/J2DGraph/J2DGrafContext.h b/include/JSystem/J2DGraph/J2DGrafContext.h index be64fcc38f..ea04368671 100644 --- a/include/JSystem/J2DGraph/J2DGrafContext.h +++ b/include/JSystem/J2DGraph/J2DGrafContext.h @@ -9,23 +9,23 @@ class J2DGrafContext { public: - /* 802E8B08 */ J2DGrafContext(f32, f32, f32, f32); - /* 802E90C0 */ void scissor(JGeometry::TBox2 const&); + /* 802E8B08 */ J2DGrafContext(f32 x, f32 y, f32 width, f32 height); + /* 802E90C0 */ void scissor(JGeometry::TBox2 const& bounds); void setColor(JUtility::TColor c) { this->setColor(c, c, c, c); } - /* 802E9118 */ void setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor, - JUtility::TColor); + /* 802E9118 */ void setColor(JUtility::TColor colorTL, JUtility::TColor colorTR, + JUtility::TColor colorBR, JUtility::TColor colorBL); /* 802E9234 */ void setLineWidth(u8); - /* 802E9260 */ void fillBox(JGeometry::TBox2 const&); - /* 802E9368 */ void drawFrame(JGeometry::TBox2 const&); - /* 802E9488 */ void line(JGeometry::TVec2, JGeometry::TVec2); - /* 802E9564 */ void lineTo(JGeometry::TVec2); + /* 802E9260 */ void fillBox(JGeometry::TBox2 const& box); + /* 802E9368 */ void drawFrame(JGeometry::TBox2 const& box); + /* 802E9488 */ void line(JGeometry::TVec2 start, JGeometry::TVec2 end); + /* 802E9564 */ void lineTo(JGeometry::TVec2 pos); void lineTo(f32 x, f32 y) { this->lineTo(JGeometry::TVec2(x, y)); } void moveTo(f32 x, f32 y) { this->moveTo(JGeometry::TVec2(x, y)); } void moveTo(JGeometry::TVec2 pos) { mPrevPos = pos; } /* 802E95D4 */ virtual ~J2DGrafContext() {} - /* 802E90E4 */ virtual void place(JGeometry::TBox2 const&); + /* 802E90E4 */ virtual void place(JGeometry::TBox2 const& bounds); /* 802E961C */ virtual void place(f32 x, f32 y, f32 width, f32 height) { JGeometry::TBox2 box(x, y, x + width, y + height); this->place(box); -- cgit v1.2.3 From ec4df7f8dba7541528cf8585ce5741959baabfb9 Mon Sep 17 00:00:00 2001 From: Jcw87 Date: Sun, 9 Jul 2023 22:35:49 -0700 Subject: J2DOrthoGraph: improved parameter names --- include/JSystem/J2DGraph/J2DOrthoGraph.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/JSystem/J2DGraph/J2DOrthoGraph.h b/include/JSystem/J2DGraph/J2DOrthoGraph.h index f17459296c..8c31b878a1 100644 --- a/include/JSystem/J2DGraph/J2DOrthoGraph.h +++ b/include/JSystem/J2DGraph/J2DOrthoGraph.h @@ -7,8 +7,8 @@ class J2DOrthoGraph : public J2DGrafContext { public: /* 802E9670 */ J2DOrthoGraph(); - /* 802E96D0 */ J2DOrthoGraph(f32, f32, f32, f32, f32, f32); - /* 802E980C */ void setOrtho(JGeometry::TBox2 const&, f32, f32); + /* 802E96D0 */ J2DOrthoGraph(f32 x, f32 y, f32 width, f32 height, f32 far, f32 near); + /* 802E980C */ void setOrtho(JGeometry::TBox2 const& bounds, f32 far, f32 near); /* 802E987C */ void scissorBounds(JGeometry::TBox2*, JGeometry::TBox2 const*); /* 8000B118 */ virtual ~J2DOrthoGraph() {} @@ -19,9 +19,9 @@ public: f32 getWidthPower() const { return mBounds.getWidth() / mOrtho.getWidth(); } f32 getHeightPower() const { return mBounds.getHeight() / mOrtho.getHeight(); } - void setOrtho(f32 param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, f32 param_5) { - JGeometry::TBox2 ortho(param_0, param_1, param_0 + param_2, param_1 + param_3); - setOrtho(ortho, param_4, param_5); + void setOrtho(f32 x, f32 y, f32 width, f32 height, f32 far, f32 near) { + JGeometry::TBox2 ortho(x, y, x + width, y + height); + setOrtho(ortho, far, near); } private: @@ -30,12 +30,11 @@ private: /* 0xD0 */ f32 mFar; }; -void J2DDrawLine(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor color, +void J2DDrawLine(f32 x1, f32 y1, f32 x2, f32 y2, JUtility::TColor color, int line_width); -void J2DFillBox(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor color); -void J2DFillBox(JGeometry::TBox2 const& param_0, JUtility::TColor param_1); -void J2DDrawFrame(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor param_4, - u8 param_5); -void J2DDrawFrame(JGeometry::TBox2 const& param_0, JUtility::TColor param_1, u8 param_2); +void J2DFillBox(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color); +void J2DFillBox(JGeometry::TBox2 const& box, JUtility::TColor color); +void J2DDrawFrame(f32 x, f32 y, f32 width, f32 height, JUtility::TColor color, u8 line_width); +void J2DDrawFrame(JGeometry::TBox2 const& box, JUtility::TColor color, u8 line_width); #endif /* J2DORTHOGRAPH_H */ -- cgit v1.2.3 From 42e8d29fde6d944719c76faaa5cb065bab9dc3fc Mon Sep 17 00:00:00 2001 From: Jcw87 Date: Sat, 15 Jul 2023 13:01:28 -0700 Subject: J2DMatBlock --- include/JSystem/J2DGraph/J2DGrafContext.h | 13 ++- include/JSystem/J2DGraph/J2DMatBlock.h | 26 ++++-- include/JSystem/J2DGraph/J2DTevs.h | 138 +++++++++++++++++++++++++++++- 3 files changed, 166 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/JSystem/J2DGraph/J2DGrafContext.h b/include/JSystem/J2DGraph/J2DGrafContext.h index ea04368671..47b6cdaabc 100644 --- a/include/JSystem/J2DGraph/J2DGrafContext.h +++ b/include/JSystem/J2DGraph/J2DGrafContext.h @@ -9,6 +9,13 @@ class J2DGrafContext { public: + struct Blend { + /* 0x0 */ u8 mType; + /* 0x1 */ u8 mSrcFactor; + /* 0x2 */ u8 mDstFactor; + }; + + /* 802E8B08 */ J2DGrafContext(f32 x, f32 y, f32 width, f32 height); /* 802E90C0 */ void scissor(JGeometry::TBox2 const& bounds); void setColor(JUtility::TColor c) { this->setColor(c, c, c, c); } @@ -47,9 +54,9 @@ public: /* 0x38 */ JGeometry::TVec2 mPrevPos; /* 0x40 */ Mtx44 mMtx44; /* 0x80 */ Mtx mPosMtx; - /* 0xB0 */ J2DBlendInfo field_0xb0; - /* 0xB3 */ J2DBlendInfo mLinePart; - /* 0xB6 */ J2DBlendInfo mBoxPart; + /* 0xB0 */ Blend field_0xb0; + /* 0xB3 */ Blend mLinePart; + /* 0xB6 */ Blend mBoxPart; }; #endif /* J2DGRAFCONTEXT_H */ diff --git a/include/JSystem/J2DGraph/J2DMatBlock.h b/include/JSystem/J2DGraph/J2DMatBlock.h index 5b4466de38..1a036dc072 100644 --- a/include/JSystem/J2DGraph/J2DMatBlock.h +++ b/include/JSystem/J2DGraph/J2DMatBlock.h @@ -422,6 +422,11 @@ struct J2DAlphaComp { mRef0 = 0; mRef1 = 0; } + u8 getComp0() { return mAlphaCmp >> 5 & 7; } + u8 getRef0() { return mRef0; } + u8 getOp() { return mAlphaCmp >> 3 & 3; } + u8 getComp1() { return mAlphaCmp & 7; } + u8 getRef1() { return mRef1; } /* 0x0 */ u16 mAlphaCmp; /* 0x2 */ u8 mRef0; @@ -433,21 +438,26 @@ struct J2DBlendInfo { mType = other.mType; mSrcFactor = other.mSrcFactor; mDstFactor = other.mDstFactor; - // mOp = other.mOp; + mOp = other.mOp; } /* 0x0 */ u8 mType; /* 0x1 */ u8 mSrcFactor; /* 0x2 */ u8 mDstFactor; + /* 0x3 */ u8 mOp; }; extern J2DBlendInfo j2dDefaultBlendInfo; struct J2DBlend { J2DBlend() { mBlendInfo = j2dDefaultBlendInfo; } + void setBlendInfo(const J2DBlendInfo& info) { mBlendInfo = info; } + u8 getType() { return mBlendInfo.mType; } + u8 getSrcFactor() { return mBlendInfo.mSrcFactor; } + u8 getDstFactor() { return mBlendInfo.mDstFactor; } + u8 getOp() { return mBlendInfo.mOp; } /* 0x0 */ J2DBlendInfo mBlendInfo; - /* 0x3 */ u8 mOp; }; class J2DPEBlock { @@ -532,17 +542,23 @@ public: }; // Size: 0x48 struct J2DColorChanInfo { - /* 0x0 */ u16 field_0x0; + /* 0x0 */ u8 field_0x0; + /* 0x0 */ u8 field_0x1; }; +inline u8 J2DCalcColorChanID(u8 param_1) { return param_1; } + class J2DColorChan { public: /* 802EB280 */ J2DColorChan(); - u16 getMatSrc() const { return mColorChanInfo.field_0x0 & 1; } + void setColorChanInfo(const J2DColorChanInfo& info) { + mColorChan = J2DCalcColorChanID(info.field_0x1); + } + u16 getMatSrc() const { return mColorChan & 1; } private: - /* 0x0 */ J2DColorChanInfo mColorChanInfo; + /* 0x0 */ u16 mColorChan; }; class J2DColorBlock { diff --git a/include/JSystem/J2DGraph/J2DTevs.h b/include/JSystem/J2DGraph/J2DTevs.h index 63e0201b9c..6a561e9557 100644 --- a/include/JSystem/J2DGraph/J2DTevs.h +++ b/include/JSystem/J2DGraph/J2DTevs.h @@ -27,14 +27,25 @@ struct J2DTexMtxInfo { /* 0x10 */ J2DTextureSRTInfo mTexSRTInfo; GXTexMtxType getTexMtxType() const { return (GXTexMtxType)mTexMtxType; } + J2DTexMtxInfo& operator=(const J2DTexMtxInfo& other) { + mCenter = other.mCenter; + mTexMtxType = other.mTexMtxType; + mTexMtxDCC = other.mTexMtxDCC; + mTexSRTInfo = other.mTexSRTInfo; + return *this; + } + }; // Size: 0x24 class J2DTexMtx { public: + J2DTexMtx(const J2DTexMtxInfo& info) { mInfo = info; } /* 802E9C90 */ void load(u32); /* 802E9CC4 */ void calc(); /* 802E9D2C */ void getTextureMtx(J2DTextureSRTInfo const&, Vec, f32 (*)[4]); /* 802E9EBC */ void getTextureMtxMaya(J2DTextureSRTInfo const&, f32 (*)[4]); + J2DTexMtxInfo& getTexMtxInfo() { return mInfo; } + void setTexMtxInfo(J2DTexMtxInfo info) { mInfo = info; } private: /* 0x00 */ J2DTexMtxInfo mInfo; @@ -45,6 +56,11 @@ struct J2DIndTexOrderInfo { /* 0x0 */ u8 mTexCoordID; /* 0x1 */ u8 mTexMapID; + J2DIndTexOrderInfo& operator=(const J2DIndTexOrderInfo& other) { + mTexCoordID = other.mTexCoordID; + mTexMapID = other.mTexMapID; + return *this; + } GXTexCoordID getTexCoordID() const { return (GXTexCoordID)mTexCoordID; } GXTexMapID getTexMapID() const { return (GXTexMapID)mTexMapID; } }; @@ -61,6 +77,16 @@ private: struct J2DIndTexMtxInfo { /* 0x00 */ Mtx23 mMtx; /* 0x18 */ s8 mScaleExp; + + J2DIndTexMtxInfo& operator=(const J2DIndTexMtxInfo& other) { + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 3; j++) { + mMtx[i][j] = other.mMtx[i][j]; + } + } + mScaleExp = other.mScaleExp; + return *this; + } }; class J2DIndTexMtx { @@ -77,8 +103,13 @@ private: struct J2DIndTexCoordScaleInfo { /* 0x0 */ u8 mScaleS; - /* 0x0 */ u8 mScaleT; + /* 0x1 */ u8 mScaleT; + J2DIndTexCoordScaleInfo& operator=(const J2DIndTexCoordScaleInfo& other) { + mScaleS = other.mScaleS; + mScaleT = other.mScaleT; + return *this; + } GXIndTexScale getScaleS() const { return (GXIndTexScale)mScaleS; } GXIndTexScale getScaleT() const { return (GXIndTexScale)mScaleT; } }; @@ -135,11 +166,22 @@ struct J2DTexCoordInfo { /* 0x1 */ u8 mTexGenSrc; /* 0x2 */ u8 mTexGenMtx; u8 padding; // ? + + J2DTexCoordInfo& operator=(const J2DTexCoordInfo& other) { + this->mTexGenType = other.mTexGenType; + this->mTexGenSrc = other.mTexGenSrc; + this->mTexGenMtx = other.mTexGenMtx; + return *this; + } }; class J2DTexCoord { public: /* 802EB260 */ J2DTexCoord(); + void setTexCoordInfo(const J2DTexCoordInfo& info) { mTexCoordInfo = info; } + s32 getTexGenType() { return mTexCoordInfo.mTexGenType; } + s32 getTexGenSrc() { return mTexCoordInfo.mTexGenSrc; } + s32 getTexGenMtx() { return mTexCoordInfo.mTexGenMtx; } private: /* 0x0 */ J2DTexCoordInfo mTexCoordInfo; @@ -204,13 +246,98 @@ public: } void setTexSel(u8 param_0) { - field_0x7 = (field_0x7 & ~12) | (param_0 * 4); + field_0x7 = (field_0x7 & ~0x0c) | (param_0 * 4); } void setRasSel(u8 param_0) { - field_0x7 = (field_0x7 & ~3) | param_0; + field_0x7 = (field_0x7 & ~0x03) | param_0; + } + + void setColorABCD(u8 param_0, u8 param_1, u8 param_2, u8 param_3) { + setTevColorAB(param_0, param_1); + setTevColorCD(param_2, param_3); + } + + void setTevColorAB(u8 param_0, u8 param_1) { field_0x2 = param_0 << 4 | param_1; } + void setTevColorCD(u8 param_0, u8 param_1) { field_0x3 = param_0 << 4 | param_1; } + + void setTevColorOp(u8 param_0, u8 param_1, u8 param_2, u8 param_3, u8 param_4) { + field_0x1 = field_0x1 & ~0x04 | param_0 << 2; + if (param_0 <= 1) { + field_0x1 = field_0x1 & ~0x30 | param_2 << 4; + field_0x1 = field_0x1 & ~0x03 | param_1; + } else { + field_0x1 = field_0x1 & ~0x30 | (param_0 >> 1 & 3) << 4; + field_0x1 = field_0x1 & ~0x03 | 3; + } + field_0x1 = field_0x1 & ~0x08 | param_3 << 3; + field_0x1 = field_0x1 & ~0xc0 | param_4 << 6; } + void setAlphaABCD(u8 param_0, u8 param_1, u8 param_2, u8 param_3) { + setAlphaA(param_0); + setAlphaB(param_1); + setAlphaC(param_2); + setAlphaD(param_3); + } + + void setAlphaA(u8 param_0) { + field_0x6 = field_0x6 & ~0xe0 | param_0 << 5; + } + void setAlphaB(u8 param_0) { + field_0x6 = field_0x6 & ~0x1c | param_0 << 2; + } + void setAlphaC(u8 param_0) { + field_0x6 = field_0x6 & ~0x03 | param_0 >> 1; + field_0x7 = field_0x7 & ~0x80 | param_0 << 7; + } + void setAlphaD(u8 param_0) { + field_0x7 = field_0x7 & ~0x70 | param_0 << 4; + } + void setTevAlphaOp(u8 param_0, u8 param_1, u8 param_2, u8 param_3, u8 param_4) { + field_0x5 = field_0x5 & ~0x04 | param_0 << 2; + if (param_0 <= 1) { + field_0x5 = field_0x5 & ~0x03 | param_1; + field_0x5 = field_0x5 & ~0x30 | param_2 << 4; + } else { + field_0x5 = field_0x5 & ~0x30 | (param_0 >> 1 & 3) << 4; + field_0x5 = field_0x5 & ~0x03 | 3; + } + field_0x5 = field_0x5 & ~0x08 | param_3 << 3; + field_0x5 = field_0x5 & ~0xc0 | param_4 << 6; + } + + u8 getColorA() { return (field_0x2 & 0xf0) >> 4; } + u8 getColorB() { return field_0x2 & 0x0f; } + u8 getColorC() { return (field_0x3 & 0xf0) >> 4; } + u8 getColorD() { return field_0x3 & 0x0f; } + u8 getAlphaA() { return (field_0x6 & 0xe0) >> 5; } + u8 getAlphaB() { return (field_0x6 & 0x1c) >> 2; } + u8 getAlphaC() { return (field_0x6 & 0x03) << 1 | (field_0x7 & 0x80) >> 7; } + u8 getAlphaD() { return (field_0x7 & 0x70) >> 4; } + u8 getCOp() { + if (getCBias() != 3) { + return (field_0x1 & 4) >> 2; + } + return ((field_0x1 & 4) >> 2) + 8 + ((field_0x1 & 0x30) >> 3); + } + u8 getCBias() { return field_0x1 & 0x03; } + u8 getCScale() { return (field_0x1 & 0x30) >> 4; } + u8 getCClamp() { return (field_0x1 & 0x08) >> 3; } + u8 getCReg() { return (field_0x1 & 0xc0) >> 6; } + u8 getAOp() { + if (getABias() != 3) { + return (field_0x5 & 4) >> 2; + } + return ((field_0x5 & 4) >> 2) + 8 + ((field_0x5 & 0x30) >> 3); + } + u8 getABias() { return field_0x5 & 0x03; } + u8 getAScale() { return (field_0x5 & 0x30) >> 4; } + u8 getAClamp() { return (field_0x5 & 0x08) >> 3; } + u8 getAReg() { return (field_0x5 & 0xc0) >> 6; } + u8 getRasSel() { return field_0x7 & 3; } + u8 getTexSel() { return (field_0x7 & 0x0c) >> 2; } + void operator=(J2DTevStage const& other) { field_0x1 = other.field_0x1; field_0x2 = other.field_0x2; @@ -235,6 +362,11 @@ class J2DTevSwapModeTable { public: /* 802F1934 */ J2DTevSwapModeTable(); + u8 getR() { return field_0x0 >> 6 & 3; } + u8 getG() { return field_0x0 >> 4 & 3; } + u8 getB() { return field_0x0 >> 2 & 3; } + u8 getA() { return field_0x0 & 3; } + private: /* 0x0 */ u8 field_0x0; }; -- cgit v1.2.3 From 0b12611fea47ac9aa298fec779a57d9e86eb9751 Mon Sep 17 00:00:00 2001 From: hatal175 Date: Sun, 16 Jul 2023 22:09:21 +0300 Subject: dMsgScrnTree_c OK, Some JGeometry work (#370) * Minor work on c_damagereaction and JGeomtry * dMsgScrnTree_c OK * dMsgScrnExplain_c OK --- include/JSystem/JGeometry.h | 32 ++++++++++++++++++++++++++------ include/JSystem/JParticle/JPAParticle.h | 4 +++- include/Z2AudioLib/Z2SpeechMgr2.h | 4 ++++ include/c/c_damagereaction.h | 2 +- include/d/com/d_com_inf_game.h | 5 +++++ include/d/meter/d_meter2_info.h | 9 +++++++++ include/d/msg/d_msg_object.h | 14 ++++++++++++-- include/d/msg/d_msg_string.h | 4 ++++ include/dolphin/mtx/vec.h | 18 ++++++++++++++++++ include/msg/scrn/d_msg_scrn_3select.h | 31 +++++++++++++++++++++++++++++++ include/msg/scrn/d_msg_scrn_base.h | 2 +- include/msg/scrn/d_msg_scrn_explain.h | 8 +++++--- include/msg/scrn/d_msg_scrn_tree.h | 24 ++++++++++++++++++++++++ 13 files changed, 143 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 8f37b01fc9..34a243ee68 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -59,11 +59,15 @@ struct TVec3 { f32 y; f32 z; - /* TVec3(const Vec& i_vec) { - setTVec3f(&i_vec.x, &x); - } */ + // inline TVec3(const Vec& i_vec) { + // setTVec3f(&i_vec.x, &x); + // } - /* TVec3() {} */ + // inline TVec3(const TVec3& i_vec) { + // setTVec3f(&i_vec.x, &x); + // } + + // TVec3() {} operator Vec*() { return (Vec*)&x; } operator const Vec*() const { return (Vec*)&x; } @@ -80,6 +84,10 @@ struct TVec3 { z = z_; } + inline void add(const TVec3& b) { + C_VECAdd((Vec*)&x, (Vec*)&b.x, (Vec*)&x); + } + void zero() { x = y = z = 0.0f; } void mul(const TVec3& a, const TVec3& b) { @@ -104,6 +112,17 @@ struct TVec3 { }; } + inline TVec3& operator+=(const TVec3& b) { + add(b); + return *this; + } + + // inline TVec3 operator+(const TVec3& b) { + // TVec3 res(*(Vec*)this); + // res += b; + // return res; + // } + inline TVec3& operator=(const TVec3& b) { register f32* dst = &x; const register f32* src = &b.x; @@ -140,13 +159,14 @@ struct TVec3 { register f32 z; register f32 x_y; register f32* dst = &x; + register f32 zres; asm { psq_l x_y, 0(dst), 0, 0 psq_l z, 8(dst), 1, 0 ps_muls0 x_y, x_y, sc psq_st x_y, 0(dst), 0, 0 - ps_muls0 x_y, z, sc - psq_st x_y, 8(dst), 1, 0 + ps_muls0 zres, z, sc + psq_st zres, 8(dst), 1, 0 }; } }; diff --git a/include/JSystem/JParticle/JPAParticle.h b/include/JSystem/JParticle/JPAParticle.h index 3d27dca8e4..c43cc89a51 100644 --- a/include/JSystem/JParticle/JPAParticle.h +++ b/include/JSystem/JParticle/JPAParticle.h @@ -357,11 +357,13 @@ public: /* 80280548 */ f32 getWidth(JPABaseEmitter const*) const; /* 80280568 */ f32 getHeight(JPABaseEmitter const*) const; int getAge() { return mAge; } + void setOffsetPosition(const JGeometry::TVec3& pos) { mOffsetPosition.set(pos); } + void getOffsetPosition(JGeometry::TVec3& pos) { pos.set(mOffsetPosition); } public: /* 0x00 */ Vec mPosition; /* 0x0C */ Vec mLocalPosition; - /* 0x18 */ Vec mOffsetPosition; + /* 0x18 */ JGeometry::TVec3 mOffsetPosition; /* 0x24 */ Vec mVelocity; /* 0x30 */ Vec mVelType1; /* 0x3C */ Vec mVelType0; diff --git a/include/Z2AudioLib/Z2SpeechMgr2.h b/include/Z2AudioLib/Z2SpeechMgr2.h index a262c768bf..d1e956bbcd 100644 --- a/include/Z2AudioLib/Z2SpeechMgr2.h +++ b/include/Z2AudioLib/Z2SpeechMgr2.h @@ -46,4 +46,8 @@ struct Z2SpeechMgr2 : public JASGlobalInstance { STATIC_ASSERT(sizeof(Z2SpeechMgr2) == 0x444); +inline Z2SpeechMgr2* Z2GetSpeechMgr2() { + return Z2SpeechMgr2::getInstance(); +} + #endif /* Z2SPEECHMGR2_H */ diff --git a/include/c/c_damagereaction.h b/include/c/c_damagereaction.h index 1f6b2871a3..f68bbd2e03 100644 --- a/include/c/c_damagereaction.h +++ b/include/c/c_damagereaction.h @@ -4,7 +4,7 @@ #include "dolphin/types.h" #include "JSystem/JParticle/JPAParticle.h" -class JPTraceParticleCallBack4 { +class JPTraceParticleCallBack4 /* : JPAParticleCallBack */ { public: /* 8001817C */ void execute(JPABaseEmitter*, JPABaseParticle*); /* 800182A4 */ void draw(JPABaseEmitter*, JPABaseParticle*); diff --git a/include/d/com/d_com_inf_game.h b/include/d/com/d_com_inf_game.h index 08c464b260..d28b2f3090 100644 --- a/include/d/com/d_com_inf_game.h +++ b/include/d/com/d_com_inf_game.h @@ -413,6 +413,7 @@ public: JKRArchive* getMsgDtArchive(int idx) { return mMsgDtArchive[idx]; } JKRArchive* getMsgArchive(int idx) { return mMsgArchive[idx]; } + JKRArchive* getMsgCommonArchive() { return mMsgCommonArchive; } JKRArchive* getMain2DArchive() { return mMain2DArchive; } JKRArchive* getAnmArchive() { return mAnmArchive; } JKRArchive* getCollectResArchive() { return mCollectResArchive; } @@ -1843,6 +1844,10 @@ inline JKRArchive* dComIfGp_getMsgArchive(int idx) { return g_dComIfG_gameInfo.play.getMsgArchive(idx); } +inline JKRArchive* dComIfGp_getMsgCommonArchive() { + return g_dComIfG_gameInfo.play.getMsgCommonArchive(); +} + inline void dComIfGp_setFieldMapArchive2(JKRArchive* arc) { g_dComIfG_gameInfo.play.setFieldMapArchive2(arc); } diff --git a/include/d/meter/d_meter2_info.h b/include/d/meter/d_meter2_info.h index 2b1a57c796..a055b1b6f0 100644 --- a/include/d/meter/d_meter2_info.h +++ b/include/d/meter/d_meter2_info.h @@ -97,6 +97,7 @@ public: void offUseButton(int pButton) { mUseButton &= ~(u16)pButton; } u16 getOilGaugeBackUp() { return mOilGaugeBackUp; } u8 getWarpStatus() { return mWarpStatus; } + void setWarpStatus(u8 status) { mWarpStatus = status; } u8 getWarpRoomNo() { return mWarpInfo.mRoomNo; } u8 getWarpPlayerNo() { return mWarpInfo.mWarpPlayerNo; } cXyz& getWarpPos() { return mWarpInfo.mPosition; } @@ -274,6 +275,10 @@ inline void dMeter2Info_getStringKanji(u32 param_0, char* param_1, JMSMesgEntry_ g_meter2_info.getStringKanji(param_0, param_1, param_2); } +inline f32 dMeter2Info_getStringLength(JUTFont* param_0, f32 param_1, f32 param_2, char* param_3) { + return g_meter2_info.getStringLength(param_0, param_1, param_2, param_3); +} + inline void dMeter2Info_setHotSpringTimer(u8 time) { g_meter2_info.setHotSpringTimer(time); } @@ -290,6 +295,10 @@ inline u8 dMeter2Info_getWarpStatus() { return g_meter2_info.getWarpStatus(); } +inline void dMeter2Info_setWarpStatus(u8 status) { + return g_meter2_info.setWarpStatus(status); +} + inline u8 dMeter2Info_getWarpRoomNo() { return g_meter2_info.getWarpRoomNo(); } diff --git a/include/d/msg/d_msg_object.h b/include/d/msg/d_msg_object.h index ace935de8b..a9b4603e02 100644 --- a/include/d/msg/d_msg_object.h +++ b/include/d/msg/d_msg_object.h @@ -118,7 +118,7 @@ public: /* 802380C4 */ static void changeGroup(s16); /* 8023806C */ static void demoMessageGroup(); /* 80238098 */ void endFlowGroup(); - /* 802380F4 */ void getString(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, char*, + /* 802380F4 */ static bool getString(u32, J2DTextBox*, J2DTextBox*, JUTFont*, COutFont_c*, char*, char*, char*, s16*); /* 80238174 */ static u8* getMsgDtPtr(); /* 80238188 */ static void setProcessID(unsigned int); @@ -322,6 +322,16 @@ inline void dMsgObject_setTalkActor(fopAc_ac_c* actor) { } } +inline bool dMsgObject_getString(u32 param_0, J2DTextBox* param_1, J2DTextBox* param_2, + JUTFont* param_3, COutFont_c* param_4, char* param_5, + char* param_6, char* param_7, s16* param_8) { + return dMsgObject_c::getString( + param_0, param_1, param_2, param_3, + param_4, param_5, param_6, param_7, + param_8 + ); +} + inline void dMsgObject_onKillMessageFlag() { dMsgObject_c::onKillMessageFlag(); } @@ -508,7 +518,7 @@ public: /* 0x2F2 */ u8 mStageTitleDisplayType; /* 0x2F4 */ s16 mMsgIndex; /* 0x2F6 */ s16 mFlowIndex; - /* 0x2F8 */ u16 mSaveSeqMsgIndex; + /* 0x2F8 */ s16 mSaveSeqMsgIndex; /* 0x2FA */ u16 mSelWeightFrame; /* 0x2FC */ u16 mBoxAppearBound; /* 0x2FE */ u16 mBoxAppearFrame; diff --git a/include/d/msg/d_msg_string.h b/include/d/msg/d_msg_string.h index 09ea58b379..708d25cc95 100644 --- a/include/d/msg/d_msg_string.h +++ b/include/d/msg/d_msg_string.h @@ -19,6 +19,10 @@ public: /* 80249DE4 */ virtual void drawOutFontLocal(J2DTextBox*, f32); /* 80249ED0 */ virtual void drawFontLocal(J2DTextBox*, u8, f32, f32, f32, f32, u32, u8); + void drawOutFont(J2DTextBox* param_0, f32 param_1) { + drawOutFontLocal(param_0, param_1); + } + private: /* 0x24 */ COutFont_c* mpOutFont; /* 0x28 */ u8 field_0x28; diff --git a/include/dolphin/mtx/vec.h b/include/dolphin/mtx/vec.h index 0167c0aad7..9f78769cc6 100644 --- a/include/dolphin/mtx/vec.h +++ b/include/dolphin/mtx/vec.h @@ -33,6 +33,24 @@ f32 PSVECDistance(const Vec* a, const Vec* b); void C_VECHalfAngle(const Vec* a, const Vec* b, Vec* half); void C_VECReflect(const Vec* src, const Vec* normal, Vec* dst); +inline void C_VECAdd(register const Vec* a, register const Vec* b, register Vec* ab) { + register f32 axy; + register f32 bxy; + register f32 az; + register f32 sumz; + register f32 bz; + asm { + psq_l axy, 0(a), 0, 0 + psq_l bxy, 0(b), 0, 0 + ps_add axy, axy, bxy + psq_st axy, 0(ab), 0, 0 + psq_l az, 8(a), 1, 0 + psq_l bz, 8(b), 1, 0 + ps_add sumz, az, bz + psq_st sumz, 8(ab), 1, 0 + } +} + inline f32 C_VECSquareMag(const Vec* v) { register f32 x_y; register f32 z; diff --git a/include/msg/scrn/d_msg_scrn_3select.h b/include/msg/scrn/d_msg_scrn_3select.h index 6128418e6a..7af3604da4 100644 --- a/include/msg/scrn/d_msg_scrn_3select.h +++ b/include/msg/scrn/d_msg_scrn_3select.h @@ -3,4 +3,35 @@ #include "dolphin/types.h" +struct dMsgScrn3Select_c { + /* 802390B4 */ dMsgScrn3Select_c(); + /* 802398CC */ virtual ~dMsgScrn3Select_c(); + /* 80239C64 */ bool isSelect(); + /* 80239C78 */ void setString(char*, char*, char*); + /* 80239D08 */ void setRubyString(char*, char*, char*); + /* 80239D98 */ void translate(f32, f32); + /* 80239DD4 */ void draw(f32, f32); + /* 8023A094 */ void selAnimeInit(u8, u8, u8, f32, u8); + /* 8023A398 */ void selAnimeMove(u8, u8, bool); + /* 8023A680 */ bool selAnimeEnd(); + /* 8023A934 */ f32 getTextBoxWidth(); + /* 8023A94C */ f32 getFontSize(); + /* 8023A95C */ void getRubyFontSize(); + /* 8023A97C */ f32 getCharSpace(); + /* 8023A98C */ void getRubyCharSpace(); + /* 8023A9AC */ void getTextBoxGlobalPosX(int); + /* 8023A9D8 */ void getTextBoxGlobalPosY(int); + /* 8023AA04 */ void open1Proc(); + /* 8023AAF4 */ void open2Proc(); + /* 8023AC14 */ void waitProc(); + /* 8023AC44 */ void selectProc(); + /* 8023AE68 */ void changeProc(); + /* 8023B148 */ void closeProc(); + /* 8023B228 */ void selectScale(); + /* 8023B4AC */ void selectTrans(); + /* 8023B870 */ void selectAnimeTransform(int); + + u8 field_0x0[0x114]; +}; + #endif /* MSG_SCRN_D_MSG_SCRN_3SELECT_H */ diff --git a/include/msg/scrn/d_msg_scrn_base.h b/include/msg/scrn/d_msg_scrn_base.h index 9081f33fea..26ac093523 100644 --- a/include/msg/scrn/d_msg_scrn_base.h +++ b/include/msg/scrn/d_msg_scrn_base.h @@ -46,7 +46,7 @@ public: /* 0x48 */ dDlst_base_c* field_0x48; /* 0x4C */ u32 field_0x4c; /* 0x50 */ CharInfo_c* mCharInfoPtr; - /* 0x54 */ u32 field_0x54; + /* 0x54 */ JUTFont* field_0x54; /* 0x58 */ J2DTextBox::TFontSize mFontSize; /* 0x60 */ f32 mRubySize; /* 0x64 */ f32 mTextBoxPosX; diff --git a/include/msg/scrn/d_msg_scrn_explain.h b/include/msg/scrn/d_msg_scrn_explain.h index 216e7004af..8743716643 100644 --- a/include/msg/scrn/d_msg_scrn_explain.h +++ b/include/msg/scrn/d_msg_scrn_explain.h @@ -27,9 +27,11 @@ public: /* 8023E43C */ void close_init(); /* 8023E448 */ void close_proc(); /* 8023E558 */ bool openExplain(u32, u8, u8, u8, bool); - /* 8023E5CC */ void getAlphaRatio(); - /* 8023E640 */ void checkTriggerA(); - /* 8023E654 */ void checkTriggerB(); + /* 8023E5CC */ f32 getAlphaRatio(); + /* 8023E640 */ bool checkTriggerA(); + /* 8023E654 */ bool checkTriggerB(); + + typedef void (dMsgScrnExplain_c::*ProcFunc)(); /* 8023D538 */ virtual ~dMsgScrnExplain_c(); diff --git a/include/msg/scrn/d_msg_scrn_tree.h b/include/msg/scrn/d_msg_scrn_tree.h index bbf67cf25f..dd3ddeebda 100644 --- a/include/msg/scrn/d_msg_scrn_tree.h +++ b/include/msg/scrn/d_msg_scrn_tree.h @@ -2,5 +2,29 @@ #define MSG_SCRN_D_MSG_SCRN_TREE_H #include "dolphin/types.h" +#include "msg/scrn/d_msg_scrn_base.h" + +struct JUTFont; +struct JKRExpHeap; + +struct dMsgScrnTree_c : public dMsgScrnBase_c { + /* 80248954 */ dMsgScrnTree_c(JUTFont*, JKRExpHeap*); + /* 80248F14 */ virtual ~dMsgScrnTree_c(); + /* 80249118 */ void exec(); + /* 80249270 */ void draw(); + /* 802492F8 */ void fukiAlpha(f32); + /* 802493AC */ void fukiScale(f32); + /* 802493B0 */ void fukiTrans(f32, f32); + + /* 0xC4 */ CPaneMgr* field_0xc4; + /* 0xC8 */ CPaneMgr* field_0xc8; + /* 0xCC */ J2DAnmTransform* field_0xcc; + /* 0xD0 */ J2DAnmTextureSRTKey* field_0xd0; + /* 0xD4 */ J2DAnmTextureSRTKey* field_0xd4; + /* 0xD8 */ JKRExpHeap* field_0xd8; + /* 0xDC */ f32 field_0xdc; + /* 0xDC */ f32 field_0xe0; + +}; #endif /* MSG_SCRN_D_MSG_SCRN_TREE_H */ -- cgit v1.2.3