From c65210d22ff774f8c43b2caf0d9999be31b7d52c Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Mon, 11 Sep 2023 03:45:33 -0700 Subject: [PATCH] most of d_com_inf_game.cpp done --- include/JSystem/J3DGraphBase/J3DPacket.h | 1 + include/JSystem/JParticle/JPAParticle.h | 78 +++ include/SSystem/SComponent/c_bg_s_poly_info.h | 8 +- include/d/d_bg_s.h | 21 +- include/d/d_com_inf_game.h | 103 ++- include/d/d_drawlist.h | 12 +- include/d/d_flower.h | 82 +++ include/d/d_grass.h | 82 +++ include/d/d_item_data.h | 2 +- include/d/d_magma.h | 60 ++ include/d/d_particle.h | 87 +++ include/d/d_save.h | 36 +- include/d/d_stage.h | 62 +- include/d/d_tree.h | 87 +++ include/d/d_wood.h | 102 +++ include/m_Do/m_Do_hostIO.h | 13 +- src/d/d_com_inf_game.cpp | 618 ++++++++++++++---- src/d/d_save.cpp | 12 +- src/d/d_stage.cpp | 2 +- 19 files changed, 1310 insertions(+), 158 deletions(-) create mode 100644 include/JSystem/JParticle/JPAParticle.h create mode 100644 include/d/d_flower.h create mode 100644 include/d/d_grass.h create mode 100644 include/d/d_magma.h create mode 100644 include/d/d_particle.h create mode 100644 include/d/d_tree.h create mode 100644 include/d/d_wood.h diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h index 00827b896..07b970329 100644 --- a/include/JSystem/J3DGraphBase/J3DPacket.h +++ b/include/JSystem/J3DGraphBase/J3DPacket.h @@ -110,6 +110,7 @@ class J3DPacket { void setUserArea(u32 area) { mpUserData = (void*)area; } + virtual bool isSame(J3DMatPacket*) const; virtual int entry(J3DDrawBuffer*); virtual void draw(); virtual ~J3DPacket() {} diff --git a/include/JSystem/JParticle/JPAParticle.h b/include/JSystem/JParticle/JPAParticle.h new file mode 100644 index 000000000..b06450367 --- /dev/null +++ b/include/JSystem/JParticle/JPAParticle.h @@ -0,0 +1,78 @@ +#ifndef JPAPARTICLE_H +#define JPAPARTICLE_H + +#include "JSystem/JSupport/JSUList.h" +#include "SSystem/SComponent/c_xyz.h" +#include "dolphin/gx/GXStruct.h" + +class JKRHeap; +class JPABaseEmitter; +class JPABaseParticle; +class JPAEmitterCallBack; +class JPAEmitterManager; +class JPAParticleCallBack; +class JPAResourceManager; +struct JPAEmitterWorkData; +struct JPACallBackBase2; + +class JPABaseParticle { +public: + void initParticle(); + void initChild(JPABaseParticle*); + void incFrame(); + void calcVelocity(); + void calcPosition(); + void checkCreateChild(); + + ~JPABaseParticle(); + JPABaseParticle(); + +public: + /* 0x00 */ JSUPtrLink mLink; + /* 0x10 */ cXyz mGlobalPosition; + /* 0x1C */ cXyz mLocalPosition; + /* 0x28 */ cXyz mPosition; + /* 0x34 */ cXyz mVelocity; + /* 0x40 */ cXyz mBaseVel; + /* 0x4C */ cXyz mAccel; + /* 0x58 */ cXyz mFieldVel; + /* 0x64 */ cXyz mFieldAccel; + /* 0x70 */ f32 mAirResist; + /* 0x74 */ f32 mMoment; + /* 0x78 */ f32 mCurFrame; + /* 0x7C */ f32 mLifeTime; + /* 0x80 */ f32 mCurNormTime; + /* 0x84 */ f32 mFieldDrag; + /* 0x88 */ f32 mDrag; + /* 0x8C */ cXyz mAxis; + /* 0x98 */ f32 mScaleOut; + /* 0x9C */ f32 mScaleX; + /* 0xA0 */ f32 mScaleY; + /* 0xA4 */ u8 field_0xA4[0xAC - 0xA4]; + /* 0xAC */ f32 mAlphaOut; + /* 0xB0 */ f32 mAlphaWaveRandom; + /* 0xB4 */ int mLoopOffset; + /* 0xB8 */ GXColor mPrmColor; + /* 0xBC */ GXColor mEnvColor; + /* 0xC0 */ s16 mRotateAngle; + /* 0xC2 */ s16 mRotateSpeed; + /* 0xC4 */ u8 field_0xC4[0xC6 - 0xC4]; + /* 0xC6 */ u16 mTexIdx; + /* 0xC8 */ JPACallBackBase2* mpCallBack2; + /* 0xCC */ u32 mFlags; +}; + +class JPAParticleCallBack { +public: + JPAParticleCallBack() {} + virtual ~JPAParticleCallBack(); + virtual void execute(JPABaseEmitter*, JPABaseParticle*); + virtual void draw(JPABaseEmitter*, JPABaseParticle*); +}; + +// not sure where this belongs +static inline u32 COLOR_MULTI(u32 a, u32 b) { + return ((a * (b + 1)) * 0x10000) >> 24; +} + +#endif /* JPAPARTICLE_H */ \ No newline at end of file diff --git a/include/SSystem/SComponent/c_bg_s_poly_info.h b/include/SSystem/SComponent/c_bg_s_poly_info.h index a3b5e915b..2ac1d58e4 100644 --- a/include/SSystem/SComponent/c_bg_s_poly_info.h +++ b/include/SSystem/SComponent/c_bg_s_poly_info.h @@ -12,7 +12,6 @@ class cBgS_PolyInfo { public: cBgS_PolyInfo(); - bool ChkSetInfo() const; void ClearPi(); void SetPolyInfo(const cBgS_PolyInfo&); void SetActorInfo(int, void*, unsigned int); @@ -24,6 +23,13 @@ class cBgS_PolyInfo { u16 GetPolyIndex() const { return mPolyIndex; } u16 GetBgIndex() const { return mBgIndex; } + bool ChkSetInfo() const { + if (mPolyIndex == 0xFFFF || mBgIndex == 0x100) { + return false; + } + + return true; + } }; // Size: 0x10 #endif /* C_BG_S_POLY_INFO_H */ diff --git a/include/d/d_bg_s.h b/include/d/d_bg_s.h index 05977488a..d18675807 100644 --- a/include/d/d_bg_s.h +++ b/include/d/d_bg_s.h @@ -39,6 +39,7 @@ class cBgS_ChkElm { STATIC_ASSERT(sizeof(cBgS_ChkElm) == 0x14); +class cBgW; class cBgS { public: /* 0x0000 */ cBgS_ChkElm m_chk_element[256]; @@ -46,19 +47,23 @@ class cBgS { public: cBgS() {} - bool Regist(dBgW_Base*, unsigned int, void*); - int Release(dBgW_Base*); + + bool GetTriPla(cBgS_PolyInfo&) const; + bool Regist(cBgW*, u32, void*); + int Release(cBgW*); bool LineCross(cBgS_LinChk*); f32 GroundCross(cBgS_GndChk*); static void* ConvDzb(void*); fopAc_ac_c* GetActorPointer(int) const; - dBgW_Base* GetBgWBasePointer(cBgS_PolyInfo const&) const; - bool ChkPolySafe(cBgS_PolyInfo const&); - s32 GetGrpRoomId(cBgS_PolyInfo const&) const; - bool GetTriPla(cBgS_PolyInfo const&, cM3dGPla*) const; - bool GetTriPnt(cBgS_PolyInfo const&, cXyz*, cXyz*, cXyz*) const; + dBgW_Base* GetBgWPointer(cBgS_PolyInfo&) const; + bool ChkPolySafe(cBgS_PolyInfo&); + void GetTriGrp(int, int) const; + void GetGrpToRoomId(int, int) const; + cM3dGPla* GetTriPla(int, int) const; + bool GetTriPnt(cBgS_PolyInfo&, cXyz*, cXyz*, cXyz*) const; + void Move(void); void ShdwDraw(cBgS_ShdwDraw*); - u32 GetGrpInf(cBgS_PolyInfo const&) const; + u32 GetGrpInf(cBgS_PolyInfo&, int) const; virtual ~cBgS() {} virtual void Ct(); diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index e85ad0665..7c8046008 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -12,6 +12,7 @@ #include "d/d_save.h" #include "d/d_stage.h" #include "d/d_vibration.h" +#include "d/d_wood.h" class JKRArchive; class JKRExpHeap; @@ -90,29 +91,33 @@ class dComIfG_play_c { void createDemo(); void removeDemo(); void executeEvtManager(); - void createMagma(); + dMagma_packet_c* createMagma(); void removeMagma(); void executeMagma(); void drawMagma(); - void createGrass(); + dGrass_packet_c* createGrass(); void removeGrass(); void executeGrass(); void drawGrass(); - void createFlower(); + dFlower_packet_c* createFlower(); void removeFlower(); void executeFlower(); void drawFlower(); - void createTree(); + dTree_packet_c* createTree(); void removeTree(); void executeTree(); void drawTree(); - void createWood(); + dWood::Packet_c* createWood(); void removeWood(); void executeWood(); void drawWood(); ~dComIfG_play_c(); + dStage_roomControl_c* getRoomControl() { return &mRoomCtrl; } + dStage_stageDt_c& getStage() { return mStageData; } + dEvt_control_c& getEvent() { return mEvtCtrl; } + const char* getStartStageName() { return mCurStage.getName(); } s8 getStartStageRoomNo() { return mCurStage.getRoomNo(); } s8 getStartStageLayer() { return mCurStage.getLayer(); } @@ -180,7 +185,7 @@ class dComIfG_play_c { /* 0x482C */ dMagma_packet_c* mpMagmaPacket; /* 0x4830 */ dGrass_packet_c* mpGrassPacket; /* 0x4834 */ dTree_packet_c* mpTreePacket; - /* 0x4838 */ Packet_c* mpWoodPacket; + /* 0x4838 */ dWood::Packet_c* mpWoodPacket; /* 0x483C */ dFlower_packet_c* mpFlowerPacket; /* 0x4840 */ s8 mLkDArcIdx; /* 0x4841 */ u8 field_0x4841; @@ -192,7 +197,7 @@ class dComIfG_play_c { /* 0x48A9 */ u8 field_0x48A9[0x48AC - 0x48A9]; /* 0x48AC */ fopAc_ac_c* mpPlayerPtr[3]; // 0: Link, 1: Partner, 2: Ship /* 0x48B8 */ f32 field_0x48b8; - /* 0x48BC */ int mItemLifeCount; + /* 0x48BC */ f32 mItemLifeCount; /* 0x48C0 */ int mItemRupeeCount; /* 0x48C4 */ int mAirMeter; /* 0x48C8 */ int field_0x48c8; @@ -322,6 +327,8 @@ extern dComIfG_inf_c g_dComIfG_gameInfo; * === SAVE === */ +u8 dComIfGs_checkGetItem(u8); + inline u8 dComIfGs_getSelectEquip(int param_0) { return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().getSelectEquip(param_0); } @@ -350,6 +357,58 @@ inline int dComIfGs_getTriforceNum() { return g_dComIfG_gameInfo.info.getPlayer().getCollect().getTriforceNum(); } +inline u8 dComIfGs_getOptVibration() { + return g_dComIfG_gameInfo.info.getPlayer().getConfig().getVibration(); +} + +inline BOOL dComIfGs_isTbox(int i_no) { + return g_dComIfG_gameInfo.info.getMemory().getBit().isTbox(i_no); +} + +inline BOOL dComIfGs_isSaveTbox(int i_stageNo, int i_no) { + return g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().isTbox(i_no); +} + +inline void dComIfGs_onTbox(int i_no) { + g_dComIfG_gameInfo.info.getMemory().getBit().onTbox(i_no); +} + +inline void dComIfGs_onSaveTbox(int i_stageNo, int i_no) { + g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().onTbox(i_no); +} + +inline BOOL dComIfGs_isStageBossEnemy() { + return g_dComIfG_gameInfo.info.getMemory().getBit().isStageBossEnemy(); +} + +inline void dComIfGs_onStageLife() { + g_dComIfG_gameInfo.info.getMemory().getBit().onStageLife(); +} + +inline BOOL dComIfGs_isStageLife() { + return g_dComIfG_gameInfo.info.getMemory().getBit().isStageLife(); +} + +inline BOOL dComIfGs_isCollect(int i_idx, u8 i_item) { + return g_dComIfG_gameInfo.info.getPlayer().getCollect().isCollect(i_idx, i_item); +} + +inline void dComIfGs_onCollect(int i_idx, u8 i_item) { + g_dComIfG_gameInfo.info.getPlayer().getCollect().onCollect(i_idx, i_item); +} + +inline BOOL dComIfGs_isTact(u8 i_no) { + return g_dComIfG_gameInfo.info.getPlayer().getCollect().isTact(i_no); +} + +inline BOOL dComIfGs_isTriforce(u8 i_no) { + return g_dComIfG_gameInfo.info.getPlayer().getCollect().isTriforce(i_no); +} + +inline BOOL dComIfGs_isSymbol(u8 i_no) { + return g_dComIfG_gameInfo.info.getPlayer().getCollect().isSymbol(i_no); +} + /** * === PLAY === */ @@ -409,10 +468,40 @@ inline fopAc_ac_c* dComIfGp_getPlayer(int idx) { return g_dComIfG_gameInfo.play.getPlayer(idx); } +inline roomRead_class* dComIfGp_getStageRoom() { + return g_dComIfG_gameInfo.play.getStage().getRoom(); +} + +inline dStage_Multi_c* dComIfGp_getMulti() { + return g_dComIfG_gameInfo.play.getStage().getMulti(); +} + +inline stage_stag_info_class* dComIfGp_getStageStagInfo() { + return g_dComIfG_gameInfo.play.getStage().getStagInfo(); +} + +inline dStage_roomStatus_c* dComIfGp_roomControl_getStatusRoomDt(int room_no) { + return g_dComIfG_gameInfo.play.getRoomControl()->getStatusRoomDt(room_no); +} + +inline dBgS* dComIfG_Bgsp() { + return &g_dComIfG_gameInfo.play.mBgS; +} + inline daPy_lk_c* daPy_getPlayerLinkActorClass() { return (daPy_lk_c*)g_dComIfG_gameInfo.play.getPlayerPtr(0); } +/** + * === DRAWLIST === + */ + +inline int dComIfGd_setSimpleShadow(cXyz* pos, f32 param_1, f32 param_2, cXyz* param_3, s16 angle, + f32 param_5, _GXTexObj* tex) { + return g_dComIfG_gameInfo.drawlist.setSimpleShadow(pos, param_1, param_2, param_3, angle, + param_5, tex); +} + /** * === RESOURCE === */ diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index 24aaeba5b..f6abe35fe 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -70,9 +70,7 @@ class dDlst_shadowTri_c { class dDlst_shadowPoly_c { public: - dDlst_shadowPoly_c() { - reset(); - } + dDlst_shadowPoly_c() { reset(); } void reset() { mCount = 0; } @@ -173,7 +171,7 @@ class dDlst_list_c { dDlst_list_c(); ~dDlst_list_c(); - void init(); + void init(); void reset(); void entryZSortXluDrawList(J3DDrawBuffer*, J3DPacket*, cXyz&); void set(dDlst_base_c**&, dDlst_base_c**&, dDlst_base_c*); @@ -183,6 +181,12 @@ class dDlst_list_c { void calcWipe(); void set2DOpa(dDlst_base_c*); + int setSimpleShadow(cXyz* param_0, f32 param_1, f32 param_2, cXyz* param_3, s16 param_4, + f32 param_5, _GXTexObj* param_6) { + return mShadowControl.setSimple(param_0, param_1, param_2, param_3, param_4, param_5, + param_6); + } + private: /* 0x00000 */ J3DDrawBuffer* mpBufSkyOpa; /* 0x00004 */ J3DDrawBuffer* mpBufSkyXlu; diff --git a/include/d/d_flower.h b/include/d/d_flower.h new file mode 100644 index 000000000..bbf4388df --- /dev/null +++ b/include/d/d_flower.h @@ -0,0 +1,82 @@ +#ifndef D_FLOWER_H +#define D_FLOWER_H + +#include "JSystem/J3DGraphBase/J3DPacket.h" +#include "SSystem/SComponent/c_xyz.h" +#include "dolphin/mtx/mtx.h" + +class dCcMassS_HitInf; +class cCcD_Obj; +class fopAc_ac_c; + +class dFlower_data_c { +public: + dFlower_data_c(); + ~dFlower_data_c(); + + void WorkCo(fopAc_ac_c*, u32, int); + void WorkAt_NoCutAnim(fopAc_ac_c*, u32, int, dCcMassS_HitInf*, cCcD_Obj*); + void WorkAt(fopAc_ac_c*, u32, int, dCcMassS_HitInf*); + void hitCheck(fopAc_ac_c*, int); + + /* 0x00 */ u8 field_0x00[0x04 - 0x00]; + /* 0x04 */ cXyz field_0x04; + /* 0x10 */ u8 field_0x10[0x44 - 0x10]; +}; + +class dFlower_anm_c { +public: + dFlower_anm_c(); + + /* 0x00 */ u8 field_0x00; + /* 0x02 */ s16 field_0x02; + /* 0x04 */ s16 field_0x04; + /* 0x06 */ u8 field_0x6[0x38 - 0x6]; +}; + +class dFlower_room_c { +public: + void newData(dFlower_data_c*); + void deleteData(); + + dFlower_room_c(); + + /* 0x0 */ dFlower_data_c* field_0x0; +}; + +class dFlower_packet_c : public J3DPacket { +public: + dFlower_packet_c(); + + void calc(); + void update(); + void setData(dFlower_data_c*, int, s8, cXyz&, int, s8); + void newData(s8, cXyz&, int, s8); + void newAnm(); + void setAnm(int, s16); + + virtual void draw(); + virtual ~dFlower_packet_c(); + + /* 0x0010 */ s16 field_0x0010; + /* 0x0012 */ u8 field_0x0012[0x0014 - 0x0012]; + /* 0x0014 */ dFlower_data_c mData[200]; + /* 0x3534 */ dFlower_anm_c mAnm[72]; + /* 0x44F4 */ dFlower_room_c mRoom[64]; + /* 0x45F4 */ u8 field_0x45f4; + /* 0x45F5 */ u8 field_0x45F5[0x45F8 - 0x45F5]; + /* 0x45F8 */ s16 field_0x45f8; + /* 0x45FA */ u8 field_0x45FA[0x45FC - 0x45FA]; + /* 0x45FC */ cXyz field_0x45fc; + /* 0x4608 */ f32* field_0x4608; + /* 0x460C */ GXColor* field_0x460c; + /* 0x4610 */ f32* field_0x4610; + /* 0x4614 */ void* field_0x4614; + /* 0x4618 */ void* field_0x4618; + /* 0x461C */ void* field_0x461c; + /* 0x4620 */ void* field_0x4620; + /* 0x4624 */ void* field_0x4624; + /* 0x4628 */ void* field_0x4628; +}; + +#endif /* D_FLOWER_H */ \ No newline at end of file diff --git a/include/d/d_grass.h b/include/d/d_grass.h new file mode 100644 index 000000000..cc614a28c --- /dev/null +++ b/include/d/d_grass.h @@ -0,0 +1,82 @@ +#ifndef D_GRASS_H +#define D_GRASS_H + +#include "SSystem/SComponent/c_xyz.h" +#include "dolphin/mtx/mtx.h" +#include "JSystem/J3DGraphBase/J3DPacket.h" + +class dCcMassS_HitInf; +class cCcD_Obj; +class fopAc_ac_c; + +class dGrass_data_c { +public: + dGrass_data_c(); + ~dGrass_data_c(); + + void WorkCo(fopAc_ac_c*, u32, int); + void WorkAt_NoCutAnim(fopAc_ac_c*, u32, int, dCcMassS_HitInf*, cCcD_Obj*); + void WorkAt(fopAc_ac_c*, u32, int, dCcMassS_HitInf*); + void hitCheck(int); + + /* 0x00 */ u8 mState; + /* 0x01 */ u8 mInitFlags; + /* 0x02 */ u8 mAnimIdx; + /* 0x03 */ u8 mItemIdx; + /* 0x04 */ cXyz mPos; + /* 0x10 */ Mtx mModelMtx; + /* 0x40 */ dGrass_data_c* mpNextData; +}; + +class dGrass_anm_c { +public: + dGrass_anm_c(); + + /* 0x00 */ u8 mState; + /* 0x02 */ s16 mRotY; + /* 0x04 */ s16 mRotX; + /* 0x08 */ Mtx mAnimMtx; +}; + +class dGrass_room_c { +public: + void newData(dGrass_data_c*); + void deleteData(); + dGrass_room_c(); + + /* 0x0 */ dGrass_data_c* mpData; +}; + +class dGrass_packet_c : public J3DPacket { +public: + dGrass_packet_c(); + + void calc(); + void update(); + void setData(dGrass_data_c*, int, cXyz&, int, s8); + void newData(cXyz&, int, s8); + void newAnm(); + void setAnm(int, s16); + + virtual void draw(); + virtual ~dGrass_packet_c(); + + /* 0x00010 */ s16 mRndm; + /* 0x00012 */ u8 field_0x00012[0x00014 - 0x00012]; + /* 0x00014 */ dGrass_data_c mGrassData[1500]; + /* 0x18E84 */ dGrass_anm_c mGrassAnm[104]; + /* 0x1A544 */ dGrass_room_c mGrassRoom[64]; + /* 0x1A644 */ f32* mpPosArr; + /* 0x1A648 */ GXColor* mpColorArr; + /* 0x1A64C */ f32* mpTexCoordArr; + /* 0x1A650 */ void* mpMatDL; + /* 0x1A654 */ u32 mMatDLSize; + /* 0x1A658 */ void* mpDL; + /* 0x1A65C */ u32 mDLSize; + /* 0x1A660 */ void* mpDLCut; + /* 0x1A664 */ u32 mDLCutSize; + /* 0x1A668 */ u16 mCoParticle; + /* 0x1A66A */ u16 field_0x1a66a; +}; + +#endif /* D_GRASS_H */ \ No newline at end of file diff --git a/include/d/d_item_data.h b/include/d/d_item_data.h index 382981ae0..077af275f 100644 --- a/include/d/d_item_data.h +++ b/include/d/d_item_data.h @@ -64,7 +64,7 @@ enum ItemTable { /* 0x39 */ MASTER_SWORD, /* 0x3A */ LV3_SWORD, /* 0x3B */ SHIELD, - /* 0x3C */ MIRROW_SHIELD, + /* 0x3C */ MIRROR_SHIELD, /* 0x3D */ DROPPED_SWORD, /* 0x3E */ MASTER_SWORD_EX, /* 0x3F */ KAKERA_HEART2, diff --git a/include/d/d_magma.h b/include/d/d_magma.h new file mode 100644 index 000000000..47b3eb542 --- /dev/null +++ b/include/d/d_magma.h @@ -0,0 +1,60 @@ +#ifndef D_MAGMA_H +#define D_MAGMA_H + +#include "SSystem/SComponent/c_xyz.h" +#include "dolphin/mtx/mtx.h" +#include "JSystem/J3DGraphBase/J3DPacket.h" + +class dMagma_ball_c; +class dMagma_floor_c { +public: + void draw(); + void calc(int); + void update(); + void create(cXyz&, cXyz&, s16, u8, int); + void remove(); + + ~dMagma_floor_c(); + dMagma_floor_c(); + + /* 0x00 */ dMagma_ball_c** mpBalls; + /* 0x04 */ u8 mBallNum; + /* 0x05 */ u8 mPathNo; + /* 0x06 */ u8 field_0x06[0x08 - 0x06]; + /* 0x08 */ cXyz mBallPos; + /* 0x14 */ f32 field_0x14; + /* 0x18 */ f32 field_0x18; + /* 0x1C */ Mtx mPosMtx; + /* 0x4C */ Mtx mTexMtx0; + /* 0x7C */ Mtx mBallPostMtx0; + /* 0xAC */ dMagma_floor_c* mpNext; +}; + +class dMagma_room_c{ +public: + void newFloor(dMagma_floor_c*); + void deleteFloor(); + + dMagma_room_c(); + + /* 0x0 */ dMagma_floor_c* mpFirst; +}; + +class dMagma_packet_c : public J3DPacket { +public: + dMagma_packet_c(); + void calc(); + void update(); + void checkYpos(cXyz&); + void newFloor(cXyz&, cXyz&, int, s16); + + virtual void draw(); + virtual ~dMagma_packet_c(); + + /* 0x010 */ dMagma_floor_c mFloor[8]; + /* 0x590 */ dMagma_room_c mRoom[64]; + /* 0x690 */ GXColor mColor1; + /* 0x694 */ f32 mTimer; +}; + +#endif /* D_MAGMA_H */ \ No newline at end of file diff --git a/include/d/d_particle.h b/include/d/d_particle.h new file mode 100644 index 000000000..d198ded57 --- /dev/null +++ b/include/d/d_particle.h @@ -0,0 +1,87 @@ +#ifndef D_PARTICLE +#define D_PARTICLE + +#include "JSystem/JParticle/JPAParticle.h" + +class mDoDvdThd_toMainRam_c; +class dPa_levelEcallBack; +class dKy_tevstr_c; +class cBgS_PolyInfo; +class JPADrawInfo; +class dPa_modelControl_c; +class JKRHeap; +class JPABaseEmitter; +class JPAEmitterManager; + +class dPa_simpleData_c { +public: + ~dPa_simpleData_c(); + dPa_simpleData_c(); + + /* 0x00 */ Vec mPos; + /* 0x0C */ GXColor mPrmColor; + /* 0x10 */ u8 mEnvColor[3]; + /* 0x13 */ u8 mbAffectedByWind; +}; + +class dPa_simpleEcallBack { +public: + dPa_simpleEcallBack(); + ~dPa_simpleEcallBack(); + + void executeAfter(JPABaseEmitter*); + void draw(JPABaseEmitter*); + void create(JPAEmitterManager*, u16, u8); + void createEmitter(JPAEmitterManager*); + void set(cXyz const*, u8, GXColor const&, GXColor const&, int); + + /* 0x000 */ void* vtbl; + /* 0x004 */ JPABaseEmitter* mpBaseEmitter; + /* 0x008 */ u16 mResID; + /* 0x00A */ u8 mGrpID; + /* 0x00B */ u8 mbIsSmoke; + /* 0x00C */ s16 mCount; + /* 0x00E */ u8 field_0x00E[0x010 - 0x00E]; + /* 0x010 */ dPa_simpleData_c mSimpleData[32]; +}; + +class dPa_control_c { +public: + dPa_control_c(); + + void getRM_ID(u16); + void swapFrameBufferTexture(); + void createCommon(void const*); + void createRoomScene(void const*); + void readScene(u8, mDoDvdThd_toMainRam_c**); + void createScene(void const*); + void removeRoomScene(); + void removeScene(); + void calc3D(); + void calc2D(); + void calcMenu(); + void draw(JPADrawInfo*, u8); + void set(u8, u16, cXyz const*, csXyz const*, cXyz const*, u8, dPa_levelEcallBack*, s8, GXColor const*, GXColor const*, cXyz const*); + void setBombSmoke(u16, cXyz const*, csXyz const*, cXyz const*, u8); + void setSimpleLand(int, cXyz const*, csXyz const*, f32, f32, f32, dKy_tevstr_c*, int*, int); + void setSimpleLand(cBgS_PolyInfo&, cXyz const*, csXyz const*, f32, f32, f32, dKy_tevstr_c*, int*, int); + void checkAtrCodeEffect(int); + void setNormalStripes(u16, cXyz const*, csXyz const*, cXyz const*, u8, u16); + void newSimple(u16, u8); + void setSimple(u16, cXyz const*, u8, GXColor const&, GXColor const&, int); + void getSimple(u16); + + /* 0x0000 */ JKRHeap* mpHeap; + /* 0x0004 */ JPAResourceManager* mpCommonResMgr; + /* 0x0008 */ dPa_modelControl_c* mModelCtrl; + /* 0x000C */ JKRHeap* mpSceneHeap; + /* 0x0010 */ void* mpData; + /* 0x0014 */ JPAResourceManager* mpSceneResMgr; + /* 0x0018 */ u8 mSceneNo; + /* 0x0019 */ u8 mCount; + /* 0x001A */ u8 mNumSimple; + /* 0x001B */ u8 mNumSimpleCommon; + /* 0x001C */ dPa_simpleEcallBack mSimpleCallbacks[25]; +}; + +#endif /* D_PARTICLE */ \ No newline at end of file diff --git a/include/d/d_save.h b/include/d/d_save.h index 0d0c8ac4f..1a1b6407f 100644 --- a/include/d/d_save.h +++ b/include/d/d_save.h @@ -182,13 +182,13 @@ class dSv_player_collect_c { /* 8005ACA8 */ void init(); /* 8005ACE0 */ void onCollect(int, u8); /* 8005AD78 */ void offCollect(int, u8); - /* 8005AE10 */ bool isCollect(int, u8); + /* 8005AE10 */ BOOL isCollect(int, u8); /* 8005AEAC */ void onTact(u8); - /* 8005AF40 */ bool isTact(u8); + /* 8005AF40 */ BOOL isTact(u8); /* 8005AFD8 */ void onTriforce(u8); /* 8005B06C */ BOOL isTriforce(u8); /* 8005B104 */ void onSymbol(u8); - /* 8005B198 */ bool isSymbol(u8); + /* 8005B198 */ BOOL isSymbol(u8); /* 8005B230 */ int getTriforceNum(); /* 0x0 */ u8 field_0x0[8]; @@ -255,6 +255,8 @@ class dSv_player_config_c { /* 8005BF2C */ void init(); /* 8005BFA4 */ void checkVibration(); + u8 getVibration() const { return mVibration; } + /* 0x0 */ u8 field_0x0; /* 0x1 */ u8 mSoundMode; /* 0x2 */ u8 mAttentionType; @@ -365,6 +367,16 @@ STATIC_ASSERT(sizeof(dSv_player_c) == 0x380); class dSv_memBit_c { public: + enum { + /* 0x0 */ MAP, + /* 0x1 */ COMPASS, + /* 0x2 */ BOSS_KEY, + /* 0x3 */ STAGE_BOSS_ENEMY, + /* 0x4 */ STAGE_LIFE, + /* 0x5 */ STAGE_BOSS_DEMO, + /* 0x7 */ STAGE_BOSS_ENEMY_2 = 7 + }; + /* 8005C094 */ void init(); /* 8005C0EC */ void onTbox(int); /* 8005C188 */ BOOL isTbox(int); @@ -379,11 +391,25 @@ class dSv_memBit_c { /* 8005C7A4 */ void onDungeonItem(int); /* 8005C844 */ BOOL isDungeonItem(int); + u8 getKeyNum() { return mKeyNum; } + void setKeyNum(u8 i_keyNum) { mKeyNum = i_keyNum; } + void onDungeonItemMap() { onDungeonItem(MAP); } + BOOL isDungeonItemMap() { return isDungeonItem(MAP); } + void onDungeonItemCompass() { onDungeonItem(COMPASS); } + BOOL isDungeonItemCompass() { return isDungeonItem(COMPASS); } + void onDungeonItemBossKey() { onDungeonItem(BOSS_KEY); } + BOOL isDungeonItemBossKey() { return isDungeonItem(BOSS_KEY); } + void onStageBossEnemy() { onDungeonItem(STAGE_BOSS_ENEMY); } + BOOL isStageBossEnemy() { return isDungeonItem(STAGE_BOSS_ENEMY); } + BOOL isStageBossEnemy2() { return isDungeonItem(STAGE_BOSS_ENEMY_2); } + void onStageLife() { onDungeonItem(STAGE_LIFE); } + BOOL isStageLife() { isDungeonItem(STAGE_LIFE); } + /* 0x00 */ u32 mTbox; /* 0x04 */ u32 mSwitch[4]; /* 0x14 */ u32 mItem[1]; /* 0x18 */ u32 mVisitedRoom[2]; - /* 0x20 */ u8 field_0x20; + /* 0x20 */ u8 mKeyNum; /* 0x21 */ u8 mDungeonItem; }; // Size: 0x24 @@ -562,9 +588,11 @@ class dSv_info_c { /* 8005EA24 */ void card_to_memory(char*, int); /* 8005ED00 */ int initdata_to_card(char*, int); + dSv_save_c& getSavedata() { return mSavedata; } dSv_player_c& getPlayer() { return mSavedata.getPlayer(); } dSv_event_c& getEvent() { return mSavedata.getEvent(); } dSv_restart_c& getRestart() { return mRestart; } + dSv_memory_c& getMemory() { return mMemory; } static const int MEMORY_SWITCH = 0x80; static const int DAN_SWITCH = 0x40; diff --git a/include/d/d_stage.h b/include/d/d_stage.h index 6376fa04b..4d287fe43 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -11,7 +11,18 @@ struct stage_vrbox_info_class {}; class stage_tresure_class {}; -struct stage_stag_info_class {}; +struct stage_stag_info_class { + /* 0x00 */ f32 field_0x0; + /* 0x04 */ f32 field_0x4; + /* 0x08 */ u8 mCameraType; + /* 0x09 */ u8 field_0x09; + /* 0x0A */ u16 field_0x0a; + /* 0x0C */ u32 field_0x0c; + /* 0x10 */ u32 field_0x10; + /* 0x14 */ u32 field_0x14; + /* 0x18 */ u32 field_0x18; + /* 0x1C */ u32 field_0x1c; +}; struct stage_scls_info_class {}; @@ -51,7 +62,18 @@ struct dStage_MemoryMap_c {}; struct dStage_dPath_c {}; -class dStage_Multi_c {}; +struct dStage_Mult_info { + /* 0x0 */ f32 mTransX; + /* 0x4 */ f32 mTransY; + /* 0x8 */ s16 mAngle; + /* 0xA */ u8 mRoomNo; +}; // Size: 0xC + +class dStage_Multi_c { +public: + /* 0x0 */ int m_num; + /* 0x4 */ dStage_Mult_info* m_entries; +}; struct dStage_SoundInfo_c {}; @@ -69,7 +91,17 @@ struct dStage_DMap_c {}; struct dStage_EventInfo_c {}; -struct dStage_Ship_c {}; +struct dStage_Ship_data { + /* 0x0 */ u8 field_0x0[0xE]; + /* 0xE */ u8 field_0xe; + /* 0xF */ u8 field_0xf; +}; + +class dStage_Ship_c { +public: + /* 0x0 */ int m_num; + /* 0x4 */ dStage_Ship_data* m_entries; +}; class dStage_dt_c { public: @@ -399,6 +431,24 @@ STATIC_ASSERT(sizeof(dStage_roomStatus_c) == 0x114); class dStage_roomControl_c { public: dStage_roomControl_c() {} + + void init(); + dStage_roomStatus_c* getStatusRoomDt(int); + bool checkRoomDisp(int) const; + int loadRoom(int, u8*); + void zoneCountCheck(int) const; + void checkDrawArea() const; + void getDarkStatus(); + void getDarkMode(); + void getBgW(int); + + static void createMemoryBlock(int, u32); + static void destroyMemoryBlock(void); + static void SetTimePass(int); + static JKRExpHeap* getMemoryBlock(int); + static void setStayNo(int); + static s8 GetTimePass(); + static void setZoneNo(int, int); static int getZoneNo(int); static s8 getStayNo() { return mStayNo; } @@ -473,4 +523,10 @@ class dStage_nextStage_c : public dStage_startStage_c { /* 0xD */ s8 mWipe; }; // Size: 0xE +s8 dStage_roomRead_dt_c_GetReverbStage(roomRead_class&, int); + +inline s32 dStage_stagInfo_GetSaveTbl(stage_stag_info_class* i_stagInfo) { + return (i_stagInfo->field_0x09 >> 1) & 0x7F; +} + #endif /* D_D_STAGE_H */ \ No newline at end of file diff --git a/include/d/d_tree.h b/include/d/d_tree.h new file mode 100644 index 000000000..d609ec8b6 --- /dev/null +++ b/include/d/d_tree.h @@ -0,0 +1,87 @@ +#ifndef D_TREE_H +#define D_TREE_H + +#include "SSystem/SComponent/c_xyz.h" +#include "dolphin/mtx/mtx.h" +#include "JSystem/J3DGraphBase/J3DPacket.h" + +class dTree_data_c { +public: + ~dTree_data_c(); + dTree_data_c(); + + void WorkCo(fopAc_ac_c*, u32, int); + void WorkAt_NoCutAnim(fopAc_ac_c*, u32, int, dCcMassS_HitInf*, cCcD_Obj*); + void WorkAt(fopAc_ac_c*, u32, int, dCcMassS_HitInf*); + void hitCheck(fopAc_ac_c*, int); + void animation(int); + + /* 0x000 */ u8 field_0x000; + /* 0x001 */ u8 field_0x001; + /* 0x002 */ u8 mAnimIdx; + /* 0x003 */ s8 field_0x003; + /* 0x004 */ cXyz mPos; + /* 0x010 */ Mtx field_0x010; + /* 0x040 */ Mtx field_0x040; + /* 0x070 */ Mtx field_0x070; + /* 0x0A0 */ Mtx mShadowMtx; + /* 0x0D0 */ u8 field_0x0D0[0x100 - 0x0D0]; + /* 0x100 */ dTree_data_c* mpNext; +}; + +class dTree_anm_c { +public: + ~dTree_anm_c(); + dTree_anm_c(); + + /* 0x00 */ u8 field_0x00[0x02 - 0x00]; + /* 0x02 */ s16 field_0x02; + /* 0x04 */ s16 field_0x04; + /* 0x06 */ u8 field_0x06[0x08 - 0x06]; + /* 0x08 */ s16 field_0x08; + /* 0x0A */ s16 field_0x0a; + /* 0x0C */ f32 mAnimTimer; + /* 0x10 */ f32 field_0x10; + /* 0x14 */ f32 field_0x14; + /* 0x18 */ f32 field_0x18; + /* 0x1C */ f32 field_0x1c; + /* 0x20 */ f32 field_0x20; + /* 0x24 */ Mtx field_0x24; + /* 0x54 */ u8 field_0x54[0x84 - 0x54]; +}; + +class dTree_room_c { +public: + dTree_room_c(); + + void newData(dTree_data_c*); + void deleteData(); + + /* 0x0 */ dTree_data_c* mpHead; +}; + +class dTree_packet_c : public J3DPacket { +public: + dTree_packet_c(); + + void calc(); + void update(); + void setData(dTree_data_c*, int, cXyz&, u8, int); + void newData(cXyz&, u8, int); + void newAnm(s16); + void setAnm(int, s16); + + virtual void draw(); + virtual ~dTree_packet_c(); + + /* 0x0010 */ s16 field_0x0010; + /* 0x0014 */ dTree_data_c mData[64]; + /* 0x4114 */ dTree_anm_c mAnm[72]; + /* 0x6634 */ dTree_room_c mRoom[64]; + /* 0x6734 */ u8 field_0x6734; + /* 0x6736 */ s16 field_0x6736; + /* 0x6738 */ s16 field_0x6738; + /* 0x673C */ cXyz field_0x673c; +}; + +#endif /* D_TREE_H */ \ No newline at end of file diff --git a/include/d/d_wood.h b/include/d/d_wood.h new file mode 100644 index 000000000..6e51fc54d --- /dev/null +++ b/include/d/d_wood.h @@ -0,0 +1,102 @@ +#ifndef D_WOOD_H +#define D_WOOD_H + +#include "JSystem/J3DGraphBase/J3DPacket.h" +#include "SSystem/SComponent/c_xyz.h" +#include "dolphin/mtx/mtx.h" + +class dCcMassS_HitInf; +class cCcD_Obj; +class fopAc_ac_c; + +namespace dWood { +class Anm_c; +class Packet_c; +class Unit_c { +public: + Unit_c(); + + void set_ground(); + void set_mtx(Anm_c*); + void clear(); + void cc_hit_before_cut(Packet_c*); + void cc_hit_after_cut(Packet_c*); + void proc(Packet_c*); + + /* 0x000 */ cXyz mPos; + /* 0x00C */ u8 field_0x00C[0x010 - 0x00C]; + /* 0x010 */ u32 mFlags; + /* 0x014 */ int mAnmIdx; + /* 0x018 */ Mtx field_0x018; + /* 0x048 */ Mtx field_0x048; + /* 0x078 */ Mtx field_0x078; + /* 0x0A8 */ Mtx field_0x0a8; + /* 0x0D8 */ Unit_c* mpNext; + /* 0x0DC */ u8 field_0xdc[0x18C - 0xDC]; +}; + +STATIC_ASSERT(sizeof(Unit_c) == 0x18C); + +class Anm_c { +public: + enum Mode_e {}; + enum AnmID_e {}; + + Anm_c(); + void play(Packet_c*); + void copy_angamp(const Anm_c*); + void mode_cut_init(const Anm_c*, short); + void mode_cut(Packet_c*); + void mode_push_into_init(const Anm_c*, short); + void mode_push_into(Packet_c*); + void mode_push_back_init(); + void mode_push_back(Packet_c*); + void mode_fan(Packet_c*); + void mode_norm_init(); + void mode_norm(Packet_c*); + void mode_norm_set_wind(float, short); + void mode_to_norm_init(AnmID_e); + void mode_to_norm(Packet_c*); + + /* 0x00 */ u8 field_0x00[0x60 - 0x00]; + /* 0x60 */ int field_0x60; + /* 0x64 */ s16 field_0x64; + /* 0x66 */ u8 field_0x66[0x8A - 0x66]; + /* 0x8A */ u8 field_0x8a; +}; + +STATIC_ASSERT(sizeof(Anm_c) == 0x8C); + +class Room_c { +public: + Room_c(); + void entry_unit(Unit_c*); + void delete_all_unit(); + + /* 0x0 */ Unit_c* mpUnit; +}; + +class Packet_c : public J3DPacket { +public: + Packet_c(); + + void delete_room(int); + void put_unit(const cXyz&, int); + void calc_cc(); + void calc(); + void update(); + void search_empty_UnitID() const; + void search_anm(Anm_c::Mode_e); + + virtual void draw(); + virtual ~Packet_c(); + + /* 0x00010 */ Unit_c mUnit[200]; + /* 0x13570 */ Anm_c mAnm[72]; + /* 0x15CD0 */ Room_c mRoom[64]; +}; + +STATIC_ASSERT(sizeof(Packet_c) == 0x15DD0); +}; // namespace dWood + +#endif /* D_WOOD_H */ \ No newline at end of file diff --git a/include/m_Do/m_Do_hostIO.h b/include/m_Do/m_Do_hostIO.h index f06020ff9..ecabcf759 100644 --- a/include/m_Do/m_Do_hostIO.h +++ b/include/m_Do/m_Do_hostIO.h @@ -3,7 +3,16 @@ #include "dolphin/types.h" -struct JORReflexible; +// move JOR stuff later +class JOREventListener { +public: + +}; + +class JORReflexible : public JOREventListener { +public: + virtual ~JORReflexible() {} +}; class mDoHIO_child_c { public: @@ -39,7 +48,7 @@ class mDoHIO_root_c { /* 0x0 */ mDoHIO_subRoot_c m_subroot; }; -class mDoHIO_entry_c { +class mDoHIO_entry_c : public JORReflexible { public: virtual ~mDoHIO_entry_c() {} }; diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index a14eb803d..2550c796d 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -9,59 +9,21 @@ #include "SSystem/SComponent/c_phase.h" #include "d/actor/d_a_player.h" #include "d/d_com_lib_game.h" +#include "d/d_flower.h" +#include "d/d_grass.h" +#include "d/d_item_data.h" +#include "d/d_magma.h" +#include "d/d_particle.h" +#include "d/d_tree.h" #include "f_op/f_op_scene_mng.h" #include "m_Do/m_Do_audio.h" class J3DModel; - -class dGrass_data_c { -public: - ~dGrass_data_c(); - dGrass_data_c(); -}; - -class dGrass_packet_c { -public: - ~dGrass_packet_c(); - dGrass_packet_c(); - void draw(); - void calc(); - void update(); - void setData(dGrass_data_c*, int, cXyz*, int, u8); - void newData(cXyz*, int, u8); - void newAnm(); - void setAnm(int, s16); -}; - -class dFlower_data_c { -public: - ~dFlower_data_c(); - dFlower_data_c(); -}; - -class dFlower_packet_c { +class daArrow_c { public: - ~dFlower_packet_c(); + static void setKeepType(u8); }; -class dTree_data_c { -public: - ~dTree_data_c(); - dTree_data_c(); -}; - -class dTree_packet_c { -public: - ~dTree_packet_c(); -}; - -class dTree_anm_c { -public: - ~dTree_anm_c(); -}; - -class scene_class; - dComIfG_inf_c g_dComIfG_gameInfo; /* 80052134-800521A4 .text ct__14dComIfG_play_cFv */ @@ -98,11 +60,119 @@ void dComIfG_play_c::init() { /* 800521D4-80052400 .text itemInit__14dComIfG_play_cFv */ void dComIfG_play_c::itemInit() { - /* Nonmatching */ + field_0x48b8 = 0.0f; + mItemLifeCount = 0.0f; + mItemRupeeCount = 0; + mAirMeter = 0; + field_0x48c8 = 0; + mNpcNameMessageID = 0; + mItemNameMessageID = 0; + mItemKeyNumCount = 0; + mItemMaxLifeCount = 0; + mItemMagicCount = 0; + field_0x48da = 0; + field_0x48dc = 0; + field_0x48de = 0; + mItemArrowNumCount = 0; + field_0x48e2 = 0; + mItemBombNumCount = 0; + field_0x48e6 = 0; + + for (int i = 0; i < 4; i++) { + } + + mCurrAuctionItemNameMsgID = 0; + field_0x491a = 0; + field_0x491c = 0; + field_0x491e = 0; + field_0x4920 = 0; + field_0x4922 = 0; + mCurrHP = 0; + mRupyCountDisplay = 0; + field_0x4928 = 0; + field_0x4929 = 0; + field_0x492a = 0; + mbCamOverrideFarPlane = 0; + field_0x492c = 0; + field_0x492d = 0; + mCurrButtonBAction = 0; + mCurrButtonAAction = 0; + field_0x4930 = 0; + field_0x4931 = 0; + field_0x4932 = 0; + + for (int i = 0; i < 4; i++) { + mEquippedItems[i] = 0; + field_0x4937[i] = 0; + } + + mMesgAnime = 0; + mMesgAnimeTagInfo = 0; + field_0x493d = 0; + field_0x493e = 0; + field_0x493f = 0; + field_0x4940 = 0; + field_0x4941 = 0; + field_0x4942 = 0; + + if (dComIfGs_checkGetItem(TELESCOPE)) { + field_0x4943 = 0; + } else { + field_0x4943 = 0x15; + } + + field_0x4944 = 7; + field_0x4945 = 0; + field_0x4946 = 0; + field_0x4947 = 0; + field_0x4948 = 0; + field_0x4949 = 0; + + for (int i = 0; i < 6; i++) { + field_0x494a[i] = 0; + } + + mTactMode = 0; + field_0x4951 = 0; + field_0x4952 = 0; + field_0x4953 = 0; + field_0x4954 = 0; + field_0x4955 = 0; + field_0x4956 = 0; + mPlacenameIndex = 0; + field_0x4958 = 0; + field_0x4959 = 0; + field_0x495a = 0; + field_0x495b = 0; + field_0x495c = 0; + field_0x495d = 0; + field_0x495e = 0; + field_0x495f = 0; + field_0x4960 = 0; + field_0x4961 = 0; + field_0x4962 = 0; + field_0x4965 = 0; + + strcpy(field_0x4966, ""); + + field_0x4977 = 0; + field_0x4978 = 0; + field_0x4979 = 0; + field_0x497a = 0; + field_0x4963 = dComIfGs_getOptVibration(); + daArrow_c::setKeepType(0); + mMesgCameraTagInfo = 0; + field_0x4984 = 0; + + for (int i = 0; i < 10; i++) { + field_0x4988[i] = 0; + } + + return; } /* 80052400-8005286C .text getLayerNo__14dComIfG_play_cFi */ -// almost +// NONMATCHING - almost int dComIfG_play_c::getLayerNo(int i_roomNo) { int layer = dComIfGp_getStartStageLayer(); @@ -184,7 +254,9 @@ int dComIfG_play_c::getLayerNo(int i_roomNo) { /* 8005286C-800528F4 .text createParticle__14dComIfG_play_cFv */ void dComIfG_play_c::createParticle() { - /* Nonmatching */ + mParticle = new dPa_control_c(); + + JUT_ASSERT(360, mParticle != 0); } /* 800528F4-8005297C .text createDemo__14dComIfG_play_cFv */ @@ -203,138 +275,179 @@ void dComIfG_play_c::executeEvtManager() { } /* 800529DC-80052A30 .text createMagma__14dComIfG_play_cFv */ -void dComIfG_play_c::createMagma() { - /* Nonmatching */ +dMagma_packet_c* dComIfG_play_c::createMagma() { + if (mpMagmaPacket == NULL) { + mpMagmaPacket = new dMagma_packet_c(); + } + + return mpMagmaPacket; } /* 80052A30-80052A84 .text removeMagma__14dComIfG_play_cFv */ void dComIfG_play_c::removeMagma() { - /* Nonmatching */ + if (mpMagmaPacket != NULL) { + delete mpMagmaPacket; + mpMagmaPacket = NULL; + } } /* 80052A84-80052AB0 .text executeMagma__14dComIfG_play_cFv */ void dComIfG_play_c::executeMagma() { - /* Nonmatching */ + if (mpMagmaPacket != NULL) { + mpMagmaPacket->calc(); + } } /* 80052AB0-80052ADC .text drawMagma__14dComIfG_play_cFv */ void dComIfG_play_c::drawMagma() { - /* Nonmatching */ + if (mpMagmaPacket != NULL) { + mpMagmaPacket->update(); + } } /* 80052ADC-80052B34 .text createGrass__14dComIfG_play_cFv */ -void dComIfG_play_c::createGrass() { - /* Nonmatching */ +dGrass_packet_c* dComIfG_play_c::createGrass() { + if (mpGrassPacket == NULL) { + mpGrassPacket = new dGrass_packet_c(); + } + + return mpGrassPacket; } /* 80052B34-80052B88 .text removeGrass__14dComIfG_play_cFv */ void dComIfG_play_c::removeGrass() { - /* Nonmatching */ + if (mpGrassPacket != NULL) { + delete mpGrassPacket; + mpGrassPacket = NULL; + } } /* 80052B88-80052C0C .text __dt__15dGrass_packet_cFv */ -dGrass_packet_c::~dGrass_packet_c() { - /* Nonmatching */ -} +dGrass_packet_c::~dGrass_packet_c() {} /* 80052C0C-80052C48 .text __dt__13dGrass_data_cFv */ -dGrass_data_c::~dGrass_data_c() { - /* Nonmatching */ -} +dGrass_data_c::~dGrass_data_c() {} /* 80052C48-80052C74 .text executeGrass__14dComIfG_play_cFv */ void dComIfG_play_c::executeGrass() { - /* Nonmatching */ + if (mpGrassPacket != NULL) { + mpGrassPacket->calc(); + } } /* 80052C74-80052CA0 .text drawGrass__14dComIfG_play_cFv */ void dComIfG_play_c::drawGrass() { - /* Nonmatching */ + if (mpGrassPacket != NULL) { + mpGrassPacket->update(); + } } /* 80052CA0-80052CF4 .text createFlower__14dComIfG_play_cFv */ -void dComIfG_play_c::createFlower() { - /* Nonmatching */ +dFlower_packet_c* dComIfG_play_c::createFlower() { + if (mpFlowerPacket == NULL) { + mpFlowerPacket = new dFlower_packet_c(); + } + + return mpFlowerPacket; } /* 80052CF4-80052D48 .text removeFlower__14dComIfG_play_cFv */ void dComIfG_play_c::removeFlower() { - /* Nonmatching */ + if (mpFlowerPacket != NULL) { + delete mpFlowerPacket; + mpFlowerPacket = NULL; + } } /* 80052D48-80052DCC .text __dt__16dFlower_packet_cFv */ -dFlower_packet_c::~dFlower_packet_c() { - /* Nonmatching */ -} +dFlower_packet_c::~dFlower_packet_c() {} /* 80052DCC-80052E08 .text __dt__14dFlower_data_cFv */ -dFlower_data_c::~dFlower_data_c() { - /* Nonmatching */ -} +dFlower_data_c::~dFlower_data_c() {} /* 80052E08-80052E34 .text executeFlower__14dComIfG_play_cFv */ void dComIfG_play_c::executeFlower() { - /* Nonmatching */ + if (mpFlowerPacket != NULL) { + mpFlowerPacket->calc(); + } } /* 80052E34-80052E60 .text drawFlower__14dComIfG_play_cFv */ void dComIfG_play_c::drawFlower() { - /* Nonmatching */ + if (mpFlowerPacket != NULL) { + mpFlowerPacket->update(); + } } /* 80052E60-80052EB4 .text createTree__14dComIfG_play_cFv */ -void dComIfG_play_c::createTree() { - /* Nonmatching */ +dTree_packet_c* dComIfG_play_c::createTree() { + if (mpTreePacket == NULL) { + mpTreePacket = new dTree_packet_c(); + } + + return mpTreePacket; } /* 80052EB4-80052F08 .text removeTree__14dComIfG_play_cFv */ void dComIfG_play_c::removeTree() { - /* Nonmatching */ + if (mpTreePacket != NULL) { + delete mpTreePacket; + mpTreePacket = NULL; + } } /* 80052F08-80052FA4 .text __dt__14dTree_packet_cFv */ -dTree_packet_c::~dTree_packet_c() { - /* Nonmatching */ -} +dTree_packet_c::~dTree_packet_c() {} /* 80052FA4-80052FE0 .text __dt__12dTree_data_cFv */ -dTree_data_c::~dTree_data_c() { - /* Nonmatching */ -} +dTree_data_c::~dTree_data_c() {} /* 80052FE0-8005301C .text __dt__11dTree_anm_cFv */ -dTree_anm_c::~dTree_anm_c() { - /* Nonmatching */ -} +dTree_anm_c::~dTree_anm_c() {} /* 8005301C-80053048 .text executeTree__14dComIfG_play_cFv */ void dComIfG_play_c::executeTree() { - /* Nonmatching */ + if (mpTreePacket != NULL) { + mpTreePacket->calc(); + } } /* 80053048-80053074 .text drawTree__14dComIfG_play_cFv */ void dComIfG_play_c::drawTree() { - /* Nonmatching */ + if (mpTreePacket != NULL) { + mpTreePacket->update(); + } } /* 80053074-800530CC .text createWood__14dComIfG_play_cFv */ -void dComIfG_play_c::createWood() { - /* Nonmatching */ +dWood::Packet_c* dComIfG_play_c::createWood() { + if (mpWoodPacket == NULL) { + mpWoodPacket = new dWood::Packet_c(); + } + + return mpWoodPacket; } /* 800530CC-80053120 .text removeWood__14dComIfG_play_cFv */ void dComIfG_play_c::removeWood() { - /* Nonmatching */ + if (mpWoodPacket != NULL) { + delete mpWoodPacket; + mpWoodPacket = NULL; + } } /* 80053120-8005314C .text executeWood__14dComIfG_play_cFv */ void dComIfG_play_c::executeWood() { - /* Nonmatching */ + if (mpWoodPacket != NULL) { + mpWoodPacket->calc(); + } } /* 8005314C-80053178 .text drawWood__14dComIfG_play_cFv */ void dComIfG_play_c::drawWood() { - /* Nonmatching */ + if (mpWoodPacket != NULL) { + mpWoodPacket->update(); + } } /* 80053178-800531A8 .text ct__13dComIfG_inf_cFv */ @@ -411,34 +524,94 @@ int dComIfG_resDelete(request_of_phase_process_class* i_phase, const char* i_res } /* 8005347C-800534C4 .text dComIfGp_getReverb__Fi */ -s8 dComIfGp_getReverb(int) { - /* Nonmatching */ +s8 dComIfGp_getReverb(int param_0) { + return dStage_roomRead_dt_c_GetReverbStage(*dComIfGp_getStageRoom(), param_0); } /* 800534C4-800535B8 .text dComIfGd_setSimpleShadow2__FP4cXyzffR13cBgS_PolyInfosfP9_GXTexObj */ -void dComIfGd_setSimpleShadow2(cXyz*, f32, f32, cBgS_PolyInfo&, s16, f32, _GXTexObj*) { - /* Nonmatching */ +int dComIfGd_setSimpleShadow2(cXyz* i_pos, f32 param_1, f32 param_2, cBgS_PolyInfo& i_floorPoly, + s16 i_angle, f32 param_5, GXTexObj* i_tex) { + if (i_floorPoly.ChkSetInfo() && -1000000000.0f != param_1) { + cM3dGPla* plane_p = + dComIfG_Bgsp()->GetTriPla(i_floorPoly.GetBgIndex(), i_floorPoly.GetPolyIndex()); + + return dComIfGd_setSimpleShadow(i_pos, param_1, param_2, &plane_p->mNormal, i_angle, + param_5, i_tex); + } else { + return 0; + } } /* 800535B8-80053678 .text dComIfGp_getShip__Fii */ -void dComIfGp_getShip(int, int) { - /* Nonmatching */ +dStage_Ship_data* dComIfGp_getShip(int i_roomNo, int param_1) { + dStage_roomStatus_c* roomSt_p = dComIfGp_roomControl_getStatusRoomDt(i_roomNo); + if (roomSt_p == NULL) { + return NULL; + } + + dStage_Ship_c* ship_p = roomSt_p->mRoomDt.getShip(); + if (ship_p == NULL || ship_p->m_num <= 0 || param_1 == 0xFF) { + return NULL; + } + + dStage_Ship_data* data_p = ship_p->m_entries; + if (data_p == NULL) { + return NULL; + } + + for (int i = 0; i < ship_p->m_num; i++) { + if (param_1 == data_p->field_0xe) { + return data_p; + } + + data_p++; + } + + return NULL; } /* 80053678-80053728 .text dComIfGp_getMapTrans__FiPfPfPs */ -void dComIfGp_getMapTrans(int, f32*, f32*, s16*) { - /* Nonmatching */ +bool dComIfGp_getMapTrans(int i_roomNo, f32* o_transX, f32* o_transY, s16* o_angle) { + dStage_Multi_c* multi_p = dComIfGp_getMulti(); + if (multi_p == NULL) { + return false; + } + + dStage_Mult_info* data_p = multi_p->m_entries; + for (int i = 0; i < multi_p->m_num; i++) { + if (i_roomNo == data_p->mRoomNo) { + *o_transX = data_p->mTransX; + *o_transY = data_p->mTransY; + *o_angle = data_p->mAngle; + return true; + } + data_p++; + } + + return false; } /* 80053728-80053778 .text dComIfGp_getRoomCamera__Fi */ -void dComIfGp_getRoomCamera(int) { - /* Nonmatching */ +stage_camera_class* dComIfGp_getRoomCamera(int i_roomNo) { + dStage_roomStatus_c* status = dComIfGp_roomControl_getStatusRoomDt(i_roomNo); + + if (status == NULL) { + return NULL; + } + + return status->mRoomDt.getCamera(); } /* 80053778-800537C8 .text dComIfGp_getRoomArrow__Fi */ -void dComIfGp_getRoomArrow(int) { - /* Nonmatching */ +stage_arrow_class* dComIfGp_getRoomArrow(int i_roomNo) { + dStage_roomStatus_c* status = dComIfGp_roomControl_getStatusRoomDt(i_roomNo); + + if (status == NULL) { + return NULL; + } + + return status->mRoomDt.getArrow(); } /* 800537C8-8005388C .text dComIfGp_setNextStage__FPCcsScScfUliSc */ @@ -467,33 +640,202 @@ void dComIfGp_setNextStage(const char* i_stageName, s16 i_point, s8 i_roomNo, s8 } /* 8005388C-80053918 .text dComIfGs_onStageTbox__Fii */ -void dComIfGs_onStageTbox(int, int) { - /* Nonmatching */ +void dComIfGs_onStageTbox(int i_stageNo, int i_no) { + stage_stag_info_class* stag_info = dComIfGp_getStageStagInfo(); + + if (i_stageNo == dStage_stagInfo_GetSaveTbl(stag_info)) { + dComIfGs_onTbox(i_no); + } + + dComIfGs_onSaveTbox(i_stageNo, i_no); } /* 80053918-800539A8 .text dComIfGs_isStageTbox__Fii */ -void dComIfGs_isStageTbox(int, int) { - /* Nonmatching */ +BOOL dComIfGs_isStageTbox(int i_stageNo, int i_no) { + stage_stag_info_class* stag_info = dComIfGp_getStageStagInfo(); + + if (i_stageNo == dStage_stagInfo_GetSaveTbl(stag_info)) { + return dComIfGs_isTbox(i_no); + } else { + return dComIfGs_isSaveTbox(i_stageNo, i_no); + } } /* 800539A8-80053A2C .text dComIfGs_isStageBossEnemy__Fi */ -void dComIfGs_isStageBossEnemy(int) { - /* Nonmatching */ +BOOL dComIfGs_isStageBossEnemy(int i_stageNo) { + stage_stag_info_class* stag_info = dComIfGp_getStageStagInfo(); + + if (i_stageNo == dStage_stagInfo_GetSaveTbl(stag_info)) { + return dComIfGs_isStageBossEnemy(); + } else { + return g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().isStageBossEnemy(); + } } /* 80053A2C-80053AAC .text dComIfGs_onStageLife__Fi */ -void dComIfGs_onStageLife(int) { - /* Nonmatching */ +void dComIfGs_onStageLife(int i_stageNo) { + stage_stag_info_class* stag_info = dComIfGp_getStageStagInfo(); + + if (i_stageNo == dStage_stagInfo_GetSaveTbl(stag_info)) { + dComIfGs_onStageLife(); + } + + g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().onStageLife(); } /* 80053AAC-80053B30 .text dComIfGs_isStageLife__Fi */ -void dComIfGs_isStageLife(int) { - /* Nonmatching */ +BOOL dComIfGs_isStageLife(int i_stageNo) { + stage_stag_info_class* stag_info = dComIfGp_getStageStagInfo(); + + if (i_stageNo == dStage_stagInfo_GetSaveTbl(stag_info)) { + return dComIfGs_isStageLife(); + } else { + return g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().isStageLife(); + } } /* 80053B30-80053F70 .text dComIfGs_checkGetItem__FUc */ -void dComIfGs_checkGetItem(u8) { - /* Nonmatching */ +// NONMATCHING - almost, just a couple small things +u8 dComIfGs_checkGetItem(u8 i_itemNo) { + u8 get_item = 0; + + switch (i_itemNo) { + case TACT_SONG1: + if (dComIfGs_isTact(0)) { + get_item = 1; + } + break; + case TACT_SONG2: + if (dComIfGs_isTact(1)) { + get_item = 1; + } + break; + case TACT_SONG3: + if (dComIfGs_isTact(2)) { + get_item = 1; + } + break; + case TACT_SONG4: + if (dComIfGs_isTact(3)) { + get_item = 1; + } + break; + case TACT_SONG5: + if (dComIfGs_isTact(4)) { + get_item = 1; + } + break; + case TACT_SONG6: + if (dComIfGs_isTact(5)) { + get_item = 1; + } + break; + case TRIFORCE1: + if (dComIfGs_isTriforce(0)) { + get_item = 1; + } + break; + case TRIFORCE2: + if (dComIfGs_isTriforce(1)) { + get_item = 1; + } + break; + case TRIFORCE3: + if (dComIfGs_isTriforce(2)) { + get_item = 1; + } + break; + case TRIFORCE4: + if (dComIfGs_isTriforce(3)) { + get_item = 1; + } + break; + case TRIFORCE5: + if (dComIfGs_isTriforce(4)) { + get_item = 1; + } + break; + case TRIFORCE6: + if (dComIfGs_isTriforce(5)) { + get_item = 1; + } + break; + case TRIFORCE7: + if (dComIfGs_isTriforce(6)) { + get_item = 1; + } + break; + case TRIFORCE8: + if (dComIfGs_isTriforce(7)) { + get_item = 1; + } + break; + case PEARL1: + if (dComIfGs_isSymbol(0)) { + get_item = 1; + } + break; + case PEARL2: + if (dComIfGs_isSymbol(1)) { + get_item = 1; + } + break; + case PEARL3: + if (dComIfGs_isSymbol(2)) { + get_item = 1; + } + break; + case PIRATES_OMAMORI: + if (dComIfGs_isCollect(3, 0)) { + get_item = 1; + } + break; + case HEROS_OMAMORI: + if (dComIfGs_isCollect(4, 0)) { + get_item = 1; + } + break; + default: + u8 item = 0; + for (int i = 0; i < 60; i++) { + if (i < 21) { + item = dComIfGs_getItem(i); + } else if (i < 24) { + item = NO_ITEM; + } else if (i < 32) { + item = g_dComIfG_gameInfo.info.getPlayer().getGetItem().mItemFlags[i - 0x18]; + } else if (i < 36) { + item = NO_ITEM; + } else if (i < 44) { + item = g_dComIfG_gameInfo.info.getPlayer().getGetItem().mItemFlags[i - 0x1C]; + } else if (i < 48) { + item = NO_ITEM; + } else if (i < 56) { + item = g_dComIfG_gameInfo.info.getPlayer().getGetItem().mItemFlags[i - 0x20]; + } else { + item = NO_ITEM; + } + + if (i_itemNo == item) { + get_item++; + } + } + + for (int i = 0; i < 3; i++) { + if (i_itemNo == dComIfGs_getSelectEquip(i)) { + get_item++; + } + } + + if (i_itemNo >= 0xBF && i_itemNo <= 0xFE && + g_dComIfG_gameInfo.info.getPlayer().getMap().isGetMap(i_itemNo - 1)) + { + get_item++; + } + break; + } + + return get_item; } /* 80053F70-80054578 .text dComIfGs_checkGetItemNum__FUc */ @@ -559,6 +901,40 @@ void dComIfGs_exchangePlayerRecollectionData() { } /* 8005586C-800559E8 .text dComIfGs_setSelectEquip__FiUc */ -void dComIfGs_setSelectEquip(int, u8) { - /* Nonmatching */ +void dComIfGs_setSelectEquip(int i_type, u8 i_itemNo) { + switch (i_type) { + case 0: + switch (i_itemNo) { + case SWORD: + dComIfGs_onCollect(i_type, 0); + break; + case MASTER_SWORD: + dComIfGs_onCollect(i_type, 1); + break; + case LV3_SWORD: + dComIfGs_onCollect(i_type, 2); + break; + case MASTER_SWORD_EX: + dComIfGs_onCollect(i_type, 3); + break; + } + break; + case 1: + switch (i_itemNo) { + case SHIELD: + dComIfGs_onCollect(i_type, 0); + break; + case MIRROR_SHIELD: + dComIfGs_onCollect(i_type, 1); + break; + } + break; + case 2: + if (i_itemNo == PWR_GROOVE) { + dComIfGs_onCollect(i_type, 0); + } + break; + } + + g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().mSelectEquip[i_type] = i_itemNo; } diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index 5384555c3..b1803a770 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -596,9 +596,9 @@ void dSv_player_collect_c::offCollect(int i_idx, u8 i_item) { } /* 8005AE10-8005AEAC .text isCollect__20dSv_player_collect_cFiUc */ -bool dSv_player_collect_c::isCollect(int i_idx, u8 i_item) { +BOOL dSv_player_collect_c::isCollect(int i_idx, u8 i_item) { JUT_ASSERT(1442, 0 <= i_item && i_item < 8); - return field_0x0[i_idx] & (u8)(1 << i_item) ? true : false; + return field_0x0[i_idx] & (u8)(1 << i_item) ? TRUE : FALSE; } /* 8005AEAC-8005AF40 .text onTact__20dSv_player_collect_cFUc */ @@ -608,9 +608,9 @@ void dSv_player_collect_c::onTact(u8 i_no) { } /* 8005AF40-8005AFD8 .text isTact__20dSv_player_collect_cFUc */ -bool dSv_player_collect_c::isTact(u8 i_no) { +BOOL dSv_player_collect_c::isTact(u8 i_no) { JUT_ASSERT(1532, 0 <= i_no && i_no < 8); - return mTact & (u8)(1 << i_no) ? true : false; + return mTact & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005AFD8-8005B06C .text onTriforce__20dSv_player_collect_cFUc */ @@ -632,9 +632,9 @@ void dSv_player_collect_c::onSymbol(u8 i_no) { } /* 8005B198-8005B230 .text isSymbol__20dSv_player_collect_cFUc */ -bool dSv_player_collect_c::isSymbol(u8 i_no) { +BOOL dSv_player_collect_c::isSymbol(u8 i_no) { JUT_ASSERT(1622, 0 <= i_no && i_no < 8); - return mSymbol & (u8)(1 << i_no) ? true : false; + return mSymbol & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005B230-8005B290 .text getTriforceNum__20dSv_player_collect_cFv */ diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index 38dac3557..4ba7775a5 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -292,7 +292,7 @@ void dStage_roomReadInit(dStage_dt_c*, void*, int, void*) { } /* 80042628-80042658 .text dStage_roomRead_dt_c_GetReverbStage__FR14roomRead_classi */ -void dStage_roomRead_dt_c_GetReverbStage(roomRead_class&, int) { +s8 dStage_roomRead_dt_c_GetReverbStage(roomRead_class&, int) { /* Nonmatching */ }