diff --git a/include/JSystem/J3DGraphAnimator/J3DJoint.h b/include/JSystem/J3DGraphAnimator/J3DJoint.h index 6a67e0a94..b776f24da 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/J3DGraphAnimator/J3DNode.h" class J3DAnmTransform; class J3DJoint; @@ -44,12 +45,8 @@ public: virtual void calc(); }; -class J3DJoint; -typedef int (*J3DJointCallBack)(J3DJoint*, int); - -class J3DJoint { +class J3DJoint : public J3DNode { public: - /* 8032F13C */ void appendChild(J3DJoint*); /* 8032F170 */ J3DJoint(); /* 8032F254 */ void entryIn(); /* 8032F3F8 */ void recursiveCalc(); @@ -57,18 +54,15 @@ public: J3DMaterial* getMesh() { return mMesh; } u16 getJntNo() const { return mJntNo; } u8 getScaleCompensate() const { return mScaleCompensate; } - J3DJoint* getYounger() { return mYounger; } - void setYounger(J3DJoint* pYounger) { mYounger = pYounger; } void setCurrentMtxCalc(J3DMtxCalc* pMtxCalc) { mCurrentMtxCalc = pMtxCalc; } J3DTransformInfo& getTransformInfo() { return mTransformInfo; } Vec* getMax() { return &mMax; } Vec* getMin() { return &mMin; } - void setCallBack(J3DJointCallBack callback) { mCallBack = callback; } - J3DJointCallBack getCallBack() { return mCallBack; } void setMtxCalc(J3DMtxCalc* i_mtxCalc) { mMtxCalc = i_mtxCalc; } J3DMtxCalc* getMtxCalc() { return mMtxCalc; } + void setOldMtxCalc(J3DMtxCalc* i_mtxCalc) { mOldMtxCalc = i_mtxCalc; } + J3DMtxCalc* getOldMtxCalc() { return mOldMtxCalc; } J3DMtxCalc* getCurrentMtxCalc() { return mCurrentMtxCalc; }; - J3DJoint* getChild() { return mChild; } static J3DMtxCalc* mCurrentMtxCalc; @@ -76,21 +70,17 @@ private: friend struct J3DJointFactory; friend class J3DJointTree; - /* 0x00 */ void* mCallBackUserData; - /* 0x04 */ J3DJointCallBack mCallBack; - /* 0x08 */ void* field_0x8; - /* 0x0C */ J3DJoint* mChild; - /* 0x10 */ J3DJoint* mYounger; /* 0x14 */ u16 mJntNo; - /* 0x16 */ u8 mKind; - /* 0x17 */ u8 mScaleCompensate; - /* 0x18 */ J3DTransformInfo mTransformInfo; - /* 0x38 */ f32 mBoundingSphereRadius; - /* 0x3C */ Vec mMin; - /* 0x48 */ Vec mMax; - /* 0x54 */ J3DMtxCalc* mMtxCalc; - /* 0x58 */ J3DMaterial* mMesh; -}; // Size: 0x5C + /* 0x1A */ u8 mKind; + /* 0x1B */ u8 mScaleCompensate; + /* 0x1C */ J3DTransformInfo mTransformInfo; + /* 0x3C */ f32 mBoundingSphereRadius; + /* 0x40 */ Vec mMin; + /* 0x4C */ Vec mMax; + /* 0x58 */ J3DMtxCalc* mMtxCalc; + /* 0x5C */ J3DMtxCalc* mOldMtxCalc; + /* 0x60 */ J3DMaterial* mMesh; +}; // Size: 0x54 struct J3DMtxCalcJ3DSysInitMaya { /* 8032ECAC */ static void init(Vec const&, f32 const (&)[3][4]); diff --git a/include/JSystem/J3DGraphAnimator/J3DJointTree.h b/include/JSystem/J3DGraphAnimator/J3DJointTree.h index 2dd47be9f..5c6edb033 100644 --- a/include/JSystem/J3DGraphAnimator/J3DJointTree.h +++ b/include/JSystem/J3DGraphAnimator/J3DJointTree.h @@ -59,8 +59,8 @@ private: /* 0x0C */ u32 mModelDataType; /* 0x10 */ J3DJoint* mRootNode; /* 0x14 */ J3DMtxCalc* mBasicMtxCalc; - /* 0x18 */ J3DJoint** mJointNodePointer; - /* 0x1C */ u16 mJointNum; + /* 0x18 */ u16 mJointNum; + /* 0x1C */ J3DJoint** mJointNodePointer; /* 0x1E */ u16 mWEvlpMtxNum; /* 0x20 */ u8* mWEvlpMixMtxNum; /* 0x24 */ u16* mWEvlpMixIndex; diff --git a/include/JSystem/J3DGraphAnimator/J3DNode.h b/include/JSystem/J3DGraphAnimator/J3DNode.h new file mode 100644 index 000000000..d5eaadc1c --- /dev/null +++ b/include/JSystem/J3DGraphAnimator/J3DNode.h @@ -0,0 +1,30 @@ +#ifndef J3DNODE_H +#define J3DNODE_H + +class J3DNode; +typedef int (*J3DNodeCallBack)(J3DNode*, int); + +class J3DNode { +public: + virtual void init(Vec const& param_0, Mtx*); + virtual void entryIn(); + virtual void calcIn(); + virtual u32 getType(); + virtual ~J3DNode(); + + void appendChild(J3DNode*); + + J3DNode* getYounger() { return mYounger; } + void setYounger(J3DNode* pYounger) { mYounger = pYounger; } + void setCallBack(J3DNodeCallBack callback) { mCallBack = callback; } + J3DNodeCallBack getCallBack() { return mCallBack; } + J3DNode* getChild() { return mChild; } + + /* 0x00 */ void* mCallBackUserData; + /* 0x04 */ J3DNodeCallBack mCallBack; + /* 0x08 */ void* field_0x8; + /* 0x0C */ J3DNode* mChild; + /* 0x10 */ J3DNode* mYounger; +}; // Size: 0x14 + +#endif /* J3DNODE_H */ diff --git a/include/JSystem/J3DU/J3DUClipper.h b/include/JSystem/J3DU/J3DUClipper.h new file mode 100644 index 000000000..8e41a7ae8 --- /dev/null +++ b/include/JSystem/J3DU/J3DUClipper.h @@ -0,0 +1,35 @@ +#ifndef J3DUCLIPPER_H +#define J3DUCLIPPER_H + +#include "dolphin/mtx/mtxvec.h" +#include "dolphin/types.h" + +class J3DUClipper { +public: + J3DUClipper() { init(); } + virtual ~J3DUClipper() {} + /* 80273778 */ void init(); + /* 8027378C */ void calcViewFrustum(); + /* 802738FC */ u32 clip(f32 const (*)[4], Vec, f32) const; + /* 80273A44 */ u32 clip(f32 const (*)[4], Vec*, Vec*) const; + + void setFovy(f32 fovy) { mFovY = fovy; } + void setAspect(f32 aspect) { mAspect = aspect; } + void setNear(f32 near) { mNear = near; } + void setFar(f32 far) { mFar = far; } + + f32 getFar() { return mFar; } + +private: + /* 0x04 */ Vec _04; + /* 0x10 */ Vec _10; + /* 0x1C */ Vec _1C; + /* 0x28 */ Vec _28; + /* 0x34 */ u8 _34[0x4C - 0x34]; + /* 0x4C */ f32 mFovY; + /* 0x50 */ f32 mAspect; + /* 0x54 */ f32 mNear; + /* 0x58 */ f32 mFar; +}; + +#endif /* J3DUCLIPPER_H */ diff --git a/include/d/actor/d_a_item.h b/include/d/actor/d_a_item.h index 6e1293951..015fff5c7 100644 --- a/include/d/actor/d_a_item.h +++ b/include/d/actor/d_a_item.h @@ -56,6 +56,7 @@ public: s32 checkActionNow(); public: + /* 0x63C */ cXyz mScaleTarget; /* 0x648 */ s32 mSwitchId; /* 0x64C */ s32 mActivationSwitch; /* 0x650 */ f32 field3_0x650; diff --git a/include/d/actor/d_a_itembase.h b/include/d/actor/d_a_itembase.h index adba40c4a..355e5018e 100644 --- a/include/d/actor/d_a_itembase.h +++ b/include/d/actor/d_a_itembase.h @@ -72,7 +72,7 @@ public: /* 0x2B0 */ mDoExt_brkAnm* mBrkAnm1; /* 0x2B4 */ mDoExt_brkAnm* mBrkAnm2; /* 0x2B8 */ mDoExt_bckAnm* mBckAnm; - /* 0x2BC */ dBgS_Acch mAcch; + /* 0x2BC */ dBgS_ObjAcch mAcch; /* 0x480 */ dBgS_AcchCir mAcchCir; /* 0x4C0 */ dCcD_Stts mStts; /* 0x4FC */ dCcD_Cyl mCyl; @@ -82,9 +82,8 @@ public: /* 0x638 */ short field20_0x638; /* 0x63A */ u8 m_itemNo; /* 0x63B */ u8 mDrawFlags; - /* 0x63C */ cXyz mScaleTarget; }; -STATIC_ASSERT(sizeof(daItemBase_c) == 0x648); +STATIC_ASSERT(sizeof(daItemBase_c) == 0x63C); #endif /* D_A_ITEMBASE_H */ \ No newline at end of file diff --git a/include/d/actor/d_a_itembase_static.h b/include/d/actor/d_a_itembase_static.h index b6405befc..b7a663c66 100644 --- a/include/d/actor/d_a_itembase_static.h +++ b/include/d/actor/d_a_itembase_static.h @@ -13,7 +13,7 @@ void chkDraw(); void dead(); void chkDead(); void setLoadError(); -void CheckItemCreateHeap(fopAc_ac_c*); -s32 CheckFieldItemCreateHeap(fopAc_ac_c*); +int CheckItemCreateHeap(fopAc_ac_c*); +int CheckFieldItemCreateHeap(fopAc_ac_c*); #endif /* D_A_ITEMBASE_STATIC_H */ \ No newline at end of file diff --git a/include/d/d_bg_s_acch.h b/include/d/d_bg_s_acch.h index 005bd6cef..645c3f732 100644 --- a/include/d/d_bg_s_acch.h +++ b/include/d/d_bg_s_acch.h @@ -202,7 +202,7 @@ public: class dBgS_ObjAcch : public dBgS_Acch { public: dBgS_ObjAcch() { - /* SetObj(); */ + SetObj(); } /* 80BB336C */ virtual ~dBgS_ObjAcch() {} diff --git a/include/d/d_bg_s_gnd_chk.h b/include/d/d_bg_s_gnd_chk.h index a597bb64f..2123482d9 100644 --- a/include/d/d_bg_s_gnd_chk.h +++ b/include/d/d_bg_s_gnd_chk.h @@ -20,7 +20,7 @@ public: class dBgS_ObjGndChk : public dBgS_GndChk { public: - dBgS_ObjGndChk() { /* SetObj(); */ } + dBgS_ObjGndChk() { SetObj(); } /* 8001E020 */ virtual ~dBgS_ObjGndChk(); }; diff --git a/include/d/d_bg_s_poly_pass_chk.h b/include/d/d_bg_s_poly_pass_chk.h index 99507e5dc..5bdc743ad 100644 --- a/include/d/d_bg_s_poly_pass_chk.h +++ b/include/d/d_bg_s_poly_pass_chk.h @@ -20,6 +20,8 @@ class dBgS_PolyPassChk : public cBgS_PolyPassChk { public: dBgS_PolyPassChk(); virtual ~dBgS_PolyPassChk(); + + void SetObj() { mbObjThrough = 1; } }; STATIC_ASSERT(sizeof(dBgS_PolyPassChk) == 0xC); diff --git a/include/d/d_cloth_packet.h b/include/d/d_cloth_packet.h new file mode 100644 index 000000000..e907d0240 --- /dev/null +++ b/include/d/d_cloth_packet.h @@ -0,0 +1,59 @@ +#ifndef D_CLOTH_PACKET_H +#define D_CLOTH_PACKET_H + +#include "JSystem/J3DGraphBase/J3DPacket.h" +#include "JSystem/J3DGraphAnimator/J3DModel.h" +#include "JSystem/JUtility/JUTTexture.h" + +class dCloth_packet_c : public J3DPacket { + /* 0x10 */ s32 mFlyGridSize; + /* 0x14 */ s32 mHoistGridSize; + /* 0x18 */ f32 mFlyLength; + /* 0x1C */ f32 mHoistLength; + /* 0x20 */ dKy_tevstr_c* mpTevstr; + /* 0x24 */ u32 mpFactorCheckCB; + /* 0x28 */ cXyz* mpPosArr[2]; + /* 0x30 */ cXyz* mpNrmArr[2]; + /* 0x38 */ cXyz* mpNrmArrBack[2]; + /* 0x40 */ cXyz* mpSpeedArr; + /* 0x44 */ cXyz mGlobalWind; + /* 0x50 */ cXyz mScale; + /* 0x5C */ f32 mWindSpeed; + /* 0x60 */ f32 mWindSpeedWave; + /* 0x64 */ u32 field_0x64; + /* 0x68 */ GXTexObj mTexObj; + /* 0x88 */ GXTexObj mToonTex; + /* 0xA8 */ Mtx mMtx; + /* 0xD8 */ f32 mSpring; + /* 0xDC */ f32 mGravity; + /* 0xE0 */ f32 mDrag; + /* 0xE4 */ f32 mFlyFlex; + /* 0xE8 */ f32 mHoistFlex; + /* 0xEC */ s16 mWave; + /* 0xEE */ s16 mWaveSpeed; + /* 0xF0 */ s16 field_0xF0; + /* 0xF2 */ s16 field_0xF2; + /* 0xF4 */ s16 mRipple; + /* 0xF6 */ s16 mRotateY; + /* 0xF8 */ u8 mCurArr; + +public: + void draw(); + ~dCloth_packet_c() {} + virtual void init(); + virtual void cloth_move(); + virtual void cloth_draw(); + virtual void TexObjInit(ResTIMG*); + virtual void TexObjLoad(); + virtual void TevSetting(); + + void setScale(cXyz scale); + void setMtx(Mtx mtx); +}; // Size: 0xFC + +dCloth_packet_c* dClothVobj03_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**); +dCloth_packet_c* dClothVobj04_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**); +dCloth_packet_c* dClothVobj05_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**); +dCloth_packet_c* dClothVobj07_0_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**); + +#endif /* D_A_CLOTH_PACKET_H */ diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index f6abe35fe..00212b530 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -228,4 +228,6 @@ private: STATIC_ASSERT(sizeof(dDlst_list_c) == 0x16234); +void dDlst_texSpecmapST(const cXyz*, const dKy_tevstr_c*, J3DModelData*, float); + #endif /* D_D_DRAWLIST_H */ \ No newline at end of file diff --git a/include/d/d_item.h b/include/d/d_item.h index c68847686..fdd8ecdfa 100644 --- a/include/d/d_item.h +++ b/include/d/d_item.h @@ -377,15 +377,15 @@ void item_getcheck_func_lithograph14(); void item_getcheck_func_lithograph15(); void item_getcheck_func_lithograph16(); void getRotenItemNumInBag(); -void isDaizaItem(unsigned char); -void isBomb(unsigned char); +BOOL isDaizaItem(unsigned char); +BOOL isBomb(unsigned char); void isArrow(unsigned char); void isEmono(unsigned char); void isEsa(unsigned char); void isRupee(unsigned char); void isLimitedItem(unsigned char); void isNonSavedEmono(unsigned char); -void isUseClothPacket(unsigned char); +BOOL isUseClothPacket(unsigned char); void isTriforce(unsigned char); void isHeart(unsigned char); void getItemNoByLife(unsigned char); diff --git a/include/d/d_item_data.h b/include/d/d_item_data.h index bcbac46ca..49bd4e4e9 100644 --- a/include/d/d_item_data.h +++ b/include/d/d_item_data.h @@ -320,6 +320,9 @@ public: static dItem_data_field_item_res field_item_res[0x100]; static dItem_data_item_info item_info[0x100]; + static u32 getHeapSize(u8 itemNo) { return item_resource[itemNo].mMaxHeapSize; } + static u32 getFieldHeapSize(u8 itemNo) { return field_item_res[itemNo].mHeapSize; } + static bool checkAppearEffect(u8 itemNo); static s16 getAppearEffect(u8 itemNo); static bool checkSpecialEffect(u8 itemNo); diff --git a/include/d/d_s_play.h b/include/d/d_s_play.h index cb4884fad..0a5a35202 100644 --- a/include/d/d_s_play.h +++ b/include/d/d_s_play.h @@ -2,6 +2,7 @@ #define D_S_PLAY #include "f_op/f_op_scene.h" +#include "m_Do/m_Do_hostIO.h" class dScnPly_ply_c : public scene_class { public: @@ -16,4 +17,20 @@ public: static s8 nextPauseTimer; }; +class dScnPly_reg_childHIO_c { +public: + virtual ~dScnPly_reg_childHIO_c(); + + f32 mFloats[30]; + s16 mShorts[30]; +}; + +class dScnPly_reg_HIO_c : public mDoHIO_entry_c { +public: + void* field_0x04; + dScnPly_reg_childHIO_c mChild[22]; +}; + +extern dScnPly_reg_HIO_c g_regHIO; + #endif /* D_S_PLAY */ diff --git a/include/m_Do/m_Do_lib.h b/include/m_Do/m_Do_lib.h new file mode 100644 index 000000000..58d25435e --- /dev/null +++ b/include/m_Do/m_Do_lib.h @@ -0,0 +1,51 @@ +#ifndef M_DO_M_DO_LIB_H +#define M_DO_M_DO_LIB_H + +#include "JSystem/J3DU/J3DUClipper.h" + +typedef struct _GXTexObj GXTexObj; +typedef struct _GXTlutObj GXTlutObj; +typedef struct Vec Vec; +struct ResTIMG; + +struct mDoLib_clipper { + /* 8001528C */ void setup(f32, f32, f32, f32); + + static void changeFar(f32 far) { + mClipper.setFar(far); + mClipper.calcViewFrustum(); + } + + static u32 clip(const Mtx m, const Vec* param_1, const Vec* param_2) { + return mClipper.clip(m, (Vec*)param_1, (Vec*)param_2); + } + + static u32 clip(const Mtx m, Vec param_1, f32 param_2) { + return mClipper.clip(m, param_1, param_2); + } + + static f32 getFar() { return mSystemFar; } + static f32 getFovyRate() { return mFovyRate; } + + static void resetFar() { + mClipper.setFar(mSystemFar); + mClipper.calcViewFrustum(); + } + + static void setup(f32, f32, f32, f32); + + static J3DUClipper mClipper; + static f32 mSystemFar; + static f32 mFovyRate; +}; + +void mDoLib_project(Vec* src, Vec* dst); +u8 mDoLib_setResTimgObj(ResTIMG const* res, GXTexObj* o_texObj, u32 tlut_name, + GXTlutObj* o_tlutObj); +void mDoLib_pos2camera(Vec* src, Vec* dst); + +inline u32 calcAlphaCmpID(u32 param_1, u32 param_2, u32 param_3) { + return ((param_1 & 0xff) << 5) + ((param_2 & 0xff) << 3) + (param_3 & 0xff); +} + +#endif /* M_DO_M_DO_LIB_H */ diff --git a/src/d/actor/d_a_shop_item.cpp b/src/d/actor/d_a_shop_item.cpp index 550fd0066..bbe154a0d 100644 --- a/src/d/actor/d_a_shop_item.cpp +++ b/src/d/actor/d_a_shop_item.cpp @@ -3,216 +3,299 @@ // Translation Unit: d_a_shop_item.cpp // -#include "d_a_shop_item.h" -#include "dolphin/types.h" +#include "f_op/f_op_actor_mng.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "d/d_procname.h" +#include "d/d_com_inf_game.h" +#include "d/d_s_play.h" +#include "d/d_item.h" +#include "d/d_item_data.h" +#include "d/actor/d_a_itembase.h" +#include "d/actor/d_a_itembase_static.h" +#include "d/d_cloth_packet.h" +#include "m_Do/m_Do_mtx.h" +#include "m_Do/m_Do_lib.h" -/* 00000078-000000D8 .text getShopArcname__12daShopItem_cFv */ -void daShopItem_c::getShopArcname() { - /* Nonmatching */ +struct daShopItem_c_m_data { + /* 0x00 */ cXyz mScale; + /* 0x0C */ cXyz field_0x0C; + /* 0x18 */ csXyz field_0x18; +}; + +struct daShopItem_c : public daItemBase_c { + char* getShopArcname(); + s16 getShopBmdIdx(); + void CreateInit(); + int _create(); + bool _execute(); + void set_mtx(); + bool _draw(); + + //virtual funcs + void setListStart() {} + void settingBeforeDraw(); + void setTevStr(); + s32 clothCreate(); + + daShopItem_c_m_data* getData() { return mData; } + + static const char m_cloth_arcname[]; + static const f32 m_cullfar_max; + static u8 mModelType[256]; + static daShopItem_c_m_data mData[256]; + + /* 0x63C */ request_of_phase_process_class field_0x63C; + /* 0x644 */ dCloth_packet_c* field_0x644; + /* 0x648 */ u8 field_0x648; + /* 0x64C */ Mtx field_0x64C; + /* 0x67C */ TevType tevType; +}; + +const char daShopItem_c::m_cloth_arcname[] = "Cloth"; +const f32 daShopItem_c::m_cullfar_max = 5000.0f; + +char* daShopItem_c::getShopArcname() { + u8 type = fopAcM_GetParamBit(this, 8, 4); + if(type == 1 || (type == 0 && mModelType[m_itemNo] == 0x01)) { + return dItem_data::field_item_res[m_itemNo].mModelArcName; + } + else { + return dItem_data::item_resource[m_itemNo].mModelArcName; + } } -/* 000000D8-00000140 .text getShopBmdIdx__12daShopItem_cFv */ -void daShopItem_c::getShopBmdIdx() { - /* Nonmatching */ +s16 daShopItem_c::getShopBmdIdx() { + u8 type = fopAcM_GetParamBit(this, 8, 4); + if(type == 1 || (type == 0 && mModelType[m_itemNo] == 0x01)) { + return dItem_data::field_item_res[m_itemNo].mModelFileId; + } + else { + return dItem_data::item_resource[m_itemNo].mModelFileIdx; + } } -/* 00000140-00000240 .text CreateInit__12daShopItem_cFv */ void daShopItem_c::CreateInit() { - /* Nonmatching */ + mCullMtx = field_0x64C; + fopAcM_setCullSizeBox(this, -100.0f, 0.0f, -100.0f, 100.0f, 200.0f, 100.0f); + if(mDoLib_clipper::mSystemFar > 1.0f) { + mCullSizeFar = 5000.0f / mDoLib_clipper::mSystemFar; + } + show(); + + mScale = getData()[m_itemNo].mScale; + orig.pos = current.pos; + set_mtx(); + + if(isDaizaItem(m_itemNo)) { + tevType = TEV_TYPE_ACTOR; + } + else { + tevType = (TevType)0x5C; + } + + mModel->setUserArea(0); } -/* 00000240-000003BC .text clothCreate__12daShopItem_cFv */ -void daShopItem_c::clothCreate() { - /* Nonmatching */ +s32 daShopItem_c::clothCreate() { + if(isUseClothPacket(m_itemNo)) { + dCloth_packet_c* (*clothFunc[4])(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) = {dClothVobj03_create, dClothVobj04_create, dClothVobj05_create, dClothVobj07_0_create}; + u32 clothRes[4] = {0x20, 0x21, 0x22, 0x23}; + + switch(m_itemNo) { + case HEROS_FLAG: + field_0x648 = 0; + break; + case TAIRYO_FLAG: + field_0x648 = 1; + break; + case SALES_FLAG: + field_0x648 = 2; + break; + case RED_FLAG: + default: + field_0x648 = 3; + } + + ResTIMG* shopArc = (ResTIMG*)dComIfG_getObjectRes(getShopArcname(), clothRes[field_0x648]); + ResTIMG* clothArc = (ResTIMG*)dComIfG_getObjectRes(m_cloth_arcname, 3); + + field_0x644 = (*clothFunc[field_0x648])(shopArc, clothArc, &mTevStr, 0); + if (field_0x644 == 0) { + return 0; + } + } + else { + field_0x644 = 0; + } + + return 1; } -/* 000003BC-000005A8 .text set_mtx__12daShopItem_cFv */ void daShopItem_c::set_mtx() { /* Nonmatching */ + mModel->setBaseScale(mScale); + mDoMtx_stack_c::transM(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::XYZrotM(current.angle.x, current.angle.y, current.angle.z); + MTXCopy(mDoMtx_stack_c::get(), field_0x64C); + + cXyz* temp = &getData()[m_itemNo].field_0x0C; + mDoMtx_stack_c::transM(temp->x, temp->y, temp->z); + csXyz* temp2 = &getData()[m_itemNo].field_0x18; + mDoMtx_stack_c::XYZrotM(temp2->x, temp2->y, temp2->z); + MTXCopy(mDoMtx_stack_c::get(), mModel->getBaseTRMtx()); //mDoMtx_stack_c is loading too late + + if(field_0x644 != 0) { + //no clue what is actually happening here, commented stuff is to make .rodata less broken + f32 y1 = g_regHIO.mChild[8].mFloats[7] + 94.0f; + f32 y2 = g_regHIO.mChild[8].mFloats[7] + 97.5f; + //Vec local[4] = { + // {0.0f, y1, 0.0f}, + // {0.0f, y1, 0.0f}, + // {0.0f, y2, 0.0f}, + // {0.0f, y1, 0.0f} + //}; + + //mDoMtx_stack_c::transM(local[field_0x648].x, local[field_0x648].y, local[field_0x648].z); + mDoMtx_stack_c::YrotM(0x4000); + field_0x644->setScale(mScale); + field_0x644->setMtx(mDoMtx_stack_c::get()); + } } -/* 000005A8-000005F8 .text _execute__12daShopItem_cFv */ -void daShopItem_c::_execute() { - /* Nonmatching */ +bool daShopItem_c::_execute() { + animPlay(1.0f, 1.0f, 1.0f, 1.0f, 1.0f); + set_mtx(); + + return true; } -/* 000005F8-00000694 .text _draw__12daShopItem_cFv */ -void daShopItem_c::_draw() { - /* Nonmatching */ +bool daShopItem_c::_draw() { + if(chkDraw() == 0) return 1; + + if(m_itemNo == WATER_STATUE || m_itemNo == POSTMAN_STATUE) { + mModel->getModelData()->getJointTree().getJointNodePointer(0)->setMtxCalc(0); + } + DrawBase(); + + if(field_0x644 != 0) field_0x644->cloth_draw(); + + return true; } -/* 00000694-0000070C .text settingBeforeDraw__12daShopItem_cFv */ void daShopItem_c::settingBeforeDraw() { - /* Nonmatching */ + if(isBomb(m_itemNo) || (m_itemNo == BOMB_BAG) || (m_itemNo == HUMMER) || m_itemNo == SMALL_KEY || m_itemNo == PRESIDENT_STATUE) { + dDlst_texSpecmapST(&mEyePos, &mTevStr, mModel->getModelData(), 1.0f); + } } -/* 0000070C-000007A4 .text setTevStr__12daShopItem_cFv */ void daShopItem_c::setTevStr() { - /* Nonmatching */ + g_env_light.settingTevStruct(tevType, getPositionP(), &mTevStr); + g_env_light.setLightTevColorType(mModel, &mTevStr); + for(int i = 0; i < 2; i++) { + if(mModelArrow[i] != 0) { + g_env_light.setLightTevColorType(mModelArrow[i], &mTevStr); + } + } + } -/* 000007A4-000007C4 .text daShopItem_Create__FPv */ -void daShopItem_Create(void*) { - /* Nonmatching */ +static int daShopItem_Create(void* i_this) { + return static_cast(i_this)->_create(); } -/* 000007C4-00000AA4 .text _create__12daShopItem_cFv */ -void daShopItem_c::_create() { - /* Nonmatching */ +int daShopItem_c::_create() { + fopAcM_SetupActor(this, daShopItem_c); + + m_itemNo = fopAcM_GetParamBit(this, 0, 8); + + const char* arcName = getShopArcname(); + if (getShopBmdIdx() == -1 || arcName == 0) { + m_itemNo = GREEN_RUPEE; + } + + arcName = getShopArcname(); + int result = dComIfG_resLoad(&this->mPhs, arcName); + if(result != cPhs_COMPLEATE_e) { + return result; + } + else { + int result2 = cPhs_COMPLEATE_e; + if(isUseClothPacket(m_itemNo)) { + result2 = dComIfG_resLoad(&field_0x63C, m_cloth_arcname); + } + + if(result2 != cPhs_COMPLEATE_e) { + return result2; + } + else if(result == cPhs_COMPLEATE_e && result2 == cPhs_COMPLEATE_e) { + u8 type = fopAcM_GetParamBit(this, 8, 4); + if(type == 2 || (type == 0 && mModelType[m_itemNo] == 0x02)) { + if(fopAcM_entrySolidHeap(this, &CheckItemCreateHeap, dItem_data::getHeapSize(m_itemNo)) == 0) { + return cPhs_ERROR_e; + } + } + else if(type == 1 || (type == 0 && mModelType[m_itemNo] == 0x01)) { + if(fopAcM_entrySolidHeap(this, &CheckFieldItemCreateHeap, dItem_data::getFieldHeapSize(m_itemNo)) == 0) { + return cPhs_ERROR_e; + } + } + else { + if(fopAcM_entrySolidHeap(this, &CheckItemCreateHeap, dItem_data::getHeapSize(m_itemNo)) == 0) { + return cPhs_ERROR_e; + } + } + + CreateInit(); + } + } + + return result; } -/* 00000AA4-00000B70 .text __dt__8dCcD_CylFv */ -dCcD_Cyl::~dCcD_Cyl() { - /* Nonmatching */ +static int daShopItem_Delete(void* i_this) { + daShopItem_c* inst = static_cast(i_this); + + if(isUseClothPacket(inst->m_itemNo)) { + dComIfG_resDelete(&inst->field_0x63C, daShopItem_c::m_cloth_arcname); + } + inst->DeleteBase(inst->getShopArcname()); + + return 1; } -/* 00000B70-00000BB8 .text __dt__8cM3dGCylFv */ -cM3dGCyl::~cM3dGCyl() { - /* Nonmatching */ +int daShopItem_Draw(void* i_this) { + return static_cast(i_this)->_draw(); } -/* 00000BB8-00000C14 .text __dt__14cCcD_ShapeAttrFv */ -cCcD_ShapeAttr::~cCcD_ShapeAttr() { - /* Nonmatching */ +int daShopItem_Execute(void* i_this) { + return static_cast(i_this)->_execute(); } -/* 00000C14-00000C5C .text __dt__8cM3dGAabFv */ -cM3dGAab::~cM3dGAab() { - /* Nonmatching */ +int daShopItem_IsDelete(void*) { + return 1; } -/* 00000C5C-00000CCC .text __dt__12dBgS_ObjAcchFv */ -dBgS_ObjAcch::~dBgS_ObjAcch() { - /* Nonmatching */ -} - -/* 00000CCC-00000D2C .text daShopItem_Delete__FPv */ -void daShopItem_Delete(void*) { - /* Nonmatching */ -} - -/* 00000D2C-00000D50 .text daShopItem_Draw__FPv */ -void daShopItem_Draw(void*) { - /* Nonmatching */ -} - -/* 00000D50-00000D74 .text daShopItem_Execute__FPv */ -void daShopItem_Execute(void*) { - /* Nonmatching */ -} - -/* 00000D74-00000D7C .text daShopItem_IsDelete__FPv */ -void daShopItem_IsDelete(void*) { - /* Nonmatching */ -} - -/* 00000D7C-00000D8C .text GetShapeAttr__8dCcD_CylFv */ -void dCcD_Cyl::GetShapeAttr() { - /* Nonmatching */ -} - -/* 00000D8C-00000D94 .text GetCoCP__12cCcD_CylAttrFv */ -void cCcD_CylAttr::GetCoCP() { - /* Nonmatching */ -} - -/* 00000D94-00000D9C .text GetCoCP__12cCcD_CylAttrCFv */ -void cCcD_CylAttr::GetCoCP() const { - /* Nonmatching */ -} - -/* 00000D9C-00000DA4 .text CrossAtTg__12cCcD_CylAttrCFRC12cCcD_AabAttrP4cXyz */ -void cCcD_CylAttr::CrossAtTg(const cCcD_AabAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00000DA4-00000DAC .text CrossAtTg__12cCcD_CylAttrCFRC12cCcD_PntAttrP4cXyz */ -void cCcD_CylAttr::CrossAtTg(const cCcD_PntAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00000DAC-00000DE4 .text CrossAtTg__12cCcD_CylAttrCFRC14cCcD_ShapeAttrP4cXyz */ -void cCcD_CylAttr::CrossAtTg(const cCcD_ShapeAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00000DE4-00000DEC .text CrossCo__12cCcD_CylAttrCFRC12cCcD_AabAttrPf */ -void cCcD_CylAttr::CrossCo(const cCcD_AabAttr&, float*) const { - /* Nonmatching */ -} - -/* 00000DEC-00000DF4 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_TriAttrPf */ -void cCcD_CylAttr::CrossCo(const cCcD_TriAttr&, float*) const { - /* Nonmatching */ -} - -/* 00000DF4-00000DFC .text CrossCo__12cCcD_CylAttrCFRC12cCcD_PntAttrPf */ -void cCcD_CylAttr::CrossCo(const cCcD_PntAttr&, float*) const { - /* Nonmatching */ -} - -/* 00000DFC-00000E34 .text CrossCo__12cCcD_CylAttrCFRC14cCcD_ShapeAttrPf */ -void cCcD_CylAttr::CrossCo(const cCcD_ShapeAttr&, float*) const { - /* Nonmatching */ -} - -/* 00000E34-00000E38 .text GetGObjInf__12cCcD_GObjInfCFv */ -void cCcD_GObjInf::GetGObjInf() const { - /* Nonmatching */ -} - -/* 00000E38-00000E40 .text GetShapeAttr__8cCcD_ObjCFv */ -void cCcD_Obj::GetShapeAttr() const { - /* Nonmatching */ -} - -/* 00000E40-00000E48 .text CrossAtTg__14cCcD_ShapeAttrCFRC14cCcD_ShapeAttrP4cXyz */ -void cCcD_ShapeAttr::CrossAtTg(const cCcD_ShapeAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00000E48-00000E50 .text CrossCo__14cCcD_ShapeAttrCFRC14cCcD_ShapeAttrPf */ -void cCcD_ShapeAttr::CrossCo(const cCcD_ShapeAttr&, float*) const { - /* Nonmatching */ -} - -/* 00000E50-00000E5C .text GetCoCP__14cCcD_ShapeAttrFv */ -void cCcD_ShapeAttr::GetCoCP() { - /* Nonmatching */ -} - -/* 00000E5C-00000E68 .text GetCoCP__14cCcD_ShapeAttrCFv */ -void cCcD_ShapeAttr::GetCoCP() const { - /* Nonmatching */ -} - -/* 00000E68-00000E84 .text setScale__15dCloth_packet_cF4cXyz */ -void dCloth_packet_c::setScale(cXyz) { - /* Nonmatching */ -} - -/* 00000E84-00000E88 .text setListStart__12daShopItem_cFv */ -void daShopItem_c::setListStart() { - /* Nonmatching */ -} - -/* 00000E88-00000E90 .text @32@__dt__12dBgS_ObjAcchFv */ -void @32@__dt__12dBgS_ObjAcchFv { - /* Nonmatching */ -} - -/* 00000E90-00000E98 .text @20@__dt__12dBgS_ObjAcchFv */ -void @20@__dt__12dBgS_ObjAcchFv { - /* Nonmatching */ -} - -/* 00000E98-00000EA0 .text @280@__dt__8dCcD_CylFv */ -void @280@__dt__8dCcD_CylFv { - /* Nonmatching */ -} - -/* 00000EA0-00000EA8 .text @248@__dt__8dCcD_CylFv */ -void @248@__dt__8dCcD_CylFv { - /* Nonmatching */ -} +static actor_method_class daShopItemMethodTable = { + (process_method_func)daShopItem_Create, + (process_method_func)daShopItem_Delete, + (process_method_func)daShopItem_Execute, + (process_method_func)daShopItem_IsDelete, + (process_method_func)0, +}; +extern actor_process_profile_definition g_profile_ShopItem = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_ShopItem, + &g_fpcLf_Method.mBase, + sizeof(daShopItem_c), + 0, + 0, + &g_fopAc_Method.base, + 0x00FE, + &daShopItemMethodTable, + 0x00044100, + fopAc_ACTOR_e, + fopAc_CULLBOX_CUSTOM_e, +}; diff --git a/src/d/d_item.cpp b/src/d/d_item.cpp index ef7a27e6e..e731aaf53 100644 --- a/src/d/d_item.cpp +++ b/src/d/d_item.cpp @@ -1882,7 +1882,7 @@ void isDaizaItem(unsigned char) { } /* 800C7B7C-800C7BA8 .text isBomb__FUc */ -void isBomb(unsigned char) { +bool isBomb(unsigned char) { /* Nonmatching */ } diff --git a/src/m_Do/m_Do_lib.cpp b/src/m_Do/m_Do_lib.cpp index 259b73967..94da15fd3 100644 --- a/src/m_Do/m_Do_lib.cpp +++ b/src/m_Do/m_Do_lib.cpp @@ -35,8 +35,3 @@ void mDoLib_cnvind32(unsigned long) { void mDoLib_cnvind16(unsigned short) { /* Nonmatching */ } - -/* 80017A04-80017A4C .text __dt__11J3DUClipperFv */ -J3DUClipper::~J3DUClipper() { - /* Nonmatching */ -}