From 4e79a1757d913fee5d81794a8525270f9db0e1d4 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sun, 10 Sep 2023 00:51:02 -0700 Subject: [PATCH 1/4] d_save mostly done --- include/JSystem/JUtility/JUTAssert.h | 2 +- include/SSystem/SComponent/c_cc_d.h | 50 +- include/SSystem/SComponent/c_cc_s.h | 16 +- include/SSystem/SComponent/c_lib.h | 2 +- include/SSystem/SComponent/c_m3d_g_cps.h | 34 + include/SSystem/SComponent/c_m3d_g_lin.h | 32 + include/d/d_bg_s.h | 114 ++ include/d/d_cc_mass_s.h | 83 ++ include/d/d_cc_s.h | 59 + include/d/d_com_inf_game.h | 280 +++++ include/d/d_event.h | 55 + include/d/d_event_data.h | 51 + include/d/d_event_manager.h | 28 + include/d/d_kankyo.h | 37 + include/d/d_resorce.h | 14 +- include/d/d_save.h | 837 ++++++++++++++ include/d/d_stage.h | 476 ++++++++ src/d/d_save.cpp | 1265 +++++++++++++++++----- 18 files changed, 3123 insertions(+), 312 deletions(-) create mode 100644 include/SSystem/SComponent/c_m3d_g_cps.h create mode 100644 include/SSystem/SComponent/c_m3d_g_lin.h create mode 100644 include/d/d_bg_s.h create mode 100644 include/d/d_cc_mass_s.h create mode 100644 include/d/d_cc_s.h create mode 100644 include/d/d_com_inf_game.h create mode 100644 include/d/d_event.h create mode 100644 include/d/d_event_data.h create mode 100644 include/d/d_event_manager.h create mode 100644 include/d/d_kankyo.h create mode 100644 include/d/d_save.h create mode 100644 include/d/d_stage.h diff --git a/include/JSystem/JUtility/JUTAssert.h b/include/JSystem/JUtility/JUTAssert.h index 6fbdf8108..4a2432162 100644 --- a/include/JSystem/JUtility/JUTAssert.h +++ b/include/JSystem/JUtility/JUTAssert.h @@ -5,7 +5,7 @@ #include "dolphin/os/OS.h" #define JUT_ASSERT(LINE, COND) \ - if (!(COND)) { \ + if ((COND) == 0) { \ JUTAssertion::showAssert(JUTAssertion::getSDevice(), __FILE__, LINE, #COND); \ OSPanic(__FILE__, LINE, "Halt"); \ } diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index 8a424e8f2..d9da0cf5b 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -22,35 +22,7 @@ class cCcD_AabAttr; class cCcD_CylAttr; class cCcD_SphAttr; -enum cCcD_ObjAtType { - /* 0x00000002 */ AT_TYPE_NORMAL_SWORD = (1 << 1), // wooden or ordon - /* 0x00000004 */ AT_TYPE_HORSE = (1 << 2), - /* 0x00000008 */ AT_TYPE_THROW_OBJ = (1 << 3), - /* 0x00000010 */ AT_TYPE_SHIELD_ATTACK = (1 << 4), - /* 0x00000020 */ AT_TYPE_BOMB = (1 << 5), - /* 0x00000040 */ AT_TYPE_40 = (1 << 6), - /* 0x00000080 */ AT_TYPE_SLINGSHOT = (1 << 7), - /* 0x00000200 */ AT_TYPE_LANTERN_SWING = (1 << 9), - /* 0x00000400 */ AT_TYPE_CSTATUE_SWING = (1 << 10), - /* 0x00000800 */ AT_TYPE_800 = (1 << 11), - /* 0x00001000 */ AT_TYPE_1000 = (1 << 12), - /* 0x00002000 */ AT_TYPE_ARROW = (1 << 13), - /* 0x00004000 */ AT_TYPE_HOOKSHOT = (1 << 14), - /* 0x00010000 */ AT_TYPE_BOOMERANG = (1 << 16), - /* 0x00040000 */ AT_TYPE_40000 = (1 << 18), - /* 0x00080000 */ AT_TYPE_SPINNER = (1 << 19), - /* 0x00100000 */ AT_TYPE_CSTATUE_BOSS_SWING = (1 << 20), - /* 0x00200000 */ AT_TYPE_HEAVY_BOOTS = (1 << 21), - /* 0x00400000 */ AT_TYPE_IRON_BALL = (1 << 22), - /* 0x00800000 */ AT_TYPE_COPY_ROD = (1 << 23), - /* 0x01000000 */ AT_TYPE_1000000 = (1 << 24), - /* 0x04000000 */ AT_TYPE_MASTER_SWORD = (1 << 26), - /* 0x08000000 */ AT_TYPE_MIDNA_LOCK = (1 << 27), - /* 0x10000000 */ AT_TYPE_10000000 = (1 << 28), - /* 0x40000000 */ AT_TYPE_WOLF_CUT_TURN = (1 << 30), - /* 0x80000000 */ AT_TYPE_WOLF_ATTACK = (1 << 31), - /* 0xD8000000 */ AT_TYPE_UNK = 0xD8000000 -}; +enum cCcD_ObjAtType {}; class cCcD_ShapeAttr { public: @@ -126,7 +98,6 @@ class cCcD_TriAttr : public cCcD_ShapeAttr, public cM3dGTri { virtual bool CrossCo(cCcD_CylAttr const&, f32*) const { return false; } virtual bool CrossCo(cCcD_SphAttr const&, f32*) const { return false; } virtual ~cCcD_TriAttr() {} - cCcD_TriAttr() {} }; struct cCcD_SrcCpsAttr { @@ -175,9 +146,6 @@ struct cCcD_SrcSphAttr { class cCcD_SphAttr : public cCcD_ShapeAttr, public cM3dGSph { public: cCcD_SphAttr() {} - void Set(const cCcD_SrcSphAttr& src) { - cM3dGSph::Set(src.mSph); - } virtual ~cCcD_SphAttr() {} virtual const cXyz& GetCoCP() const { return mCenter; } @@ -242,18 +210,16 @@ STATIC_ASSERT(0x38 == sizeof(cCcD_CylAttr)); class cCcD_DivideInfo { private: - /* 0x00 */ u32 mXDivInfo; - /* 0x04 */ u32 mYDivInfo; - /* 0x08 */ u32 mZDivInfo; - /* 0x0C vtable */ + /* 0x00 */ u32 mRangeBits; + /* 0x04 vtable */ public: cCcD_DivideInfo() {} virtual ~cCcD_DivideInfo() {} void Set(u32, u32, u32); bool Chk(cCcD_DivideInfo const&) const; -}; // Size = 0x10 +}; // Size = 0x8 -STATIC_ASSERT(0x10 == sizeof(cCcD_DivideInfo)); +STATIC_ASSERT(0x8 == sizeof(cCcD_DivideInfo)); class cCcD_DivideArea : public cM3dGAab { private: @@ -544,9 +510,9 @@ class cCcD_Obj : public cCcD_ObjHitInf { /* 0x040 */ int mFlags; /* 0x044 */ cCcD_Stts* mStts; /* 0x048 */ cCcD_DivideInfo mDivideInfo; -}; // Size = 0x58 +}; // Size = 0x50 -STATIC_ASSERT(0x58 == sizeof(cCcD_Obj)); +STATIC_ASSERT(0x50 == sizeof(cCcD_Obj)); class cCcD_GObjInf : public cCcD_Obj { public: @@ -559,6 +525,6 @@ class cCcD_GObjInf : public cCcD_Obj { virtual cCcD_GObjInf* GetGObjInf() { return this; } }; -STATIC_ASSERT(0x58 == sizeof(cCcD_GObjInf)); +STATIC_ASSERT(0x50 == sizeof(cCcD_GObjInf)); #endif /* C_CC_D_H */ diff --git a/include/SSystem/SComponent/c_cc_s.h b/include/SSystem/SComponent/c_cc_s.h index 0954d66fd..dc54cd75c 100644 --- a/include/SSystem/SComponent/c_cc_s.h +++ b/include/SSystem/SComponent/c_cc_s.h @@ -16,12 +16,12 @@ class cCcS { /* 0x0400 */ cCcD_Obj* mpObjTg[0x300]; /* 0x1000 */ cCcD_Obj* mpObjCo[0x100]; /* 0x1400 */ cCcD_Obj* mpObj[0x500]; - /* 0x2800 */ u16 mObjAtCount; - /* 0x2802 */ u16 mObjTgCount; - /* 0x2804 */ u16 mObjCoCount; - /* 0x2806 */ u16 mObjCount; - /* 0x2808 */ cCcD_DivideArea mDivideArea; - /* 0x2848 vtable */ + /* 0x2800 */ int mObjAtCount; + /* 0x2804 */ int mObjTgCount; + /* 0x2808 */ int mObjCoCount; + /* 0x280C */ int mObjCount; + /* 0x2810 */ cCcD_DivideArea mDivideArea; + /* 0x2850 vtable */ cCcS(); void Ct(); @@ -53,8 +53,8 @@ class cCcS { virtual ~cCcS() {} virtual void MoveAfterCheck(); virtual void SetCoGCorrectProc(cCcD_Obj*, cCcD_Obj*); -}; // Size = 0x284C +}; // Size = 0x2850 -STATIC_ASSERT(sizeof(cCcS) == 0x284C); +STATIC_ASSERT(sizeof(cCcS) == 0x2854); #endif /* C_CC_S_H */ diff --git a/include/SSystem/SComponent/c_lib.h b/include/SSystem/SComponent/c_lib.h index 252defbfd..fc17d8bd7 100644 --- a/include/SSystem/SComponent/c_lib.h +++ b/include/SSystem/SComponent/c_lib.h @@ -32,7 +32,7 @@ s16 cLib_targetAngleY(const Vec* lhs, const Vec* rhs); s16 cLib_targetAngleY(const Vec& lhs, const Vec& rhs); s16 cLib_targetAngleX(const cXyz*, const cXyz*); -void cLib_offsetPos(cXyz* pDest, cXyz const* pSrc, s16 angle, cXyz const* vec); +void cLib_offsetPos(cXyz* pDest, cXyz* pSrc, s16 angle, cXyz* vec); s32 cLib_distanceAngleS(s16 x, s16 y); template diff --git a/include/SSystem/SComponent/c_m3d_g_cps.h b/include/SSystem/SComponent/c_m3d_g_cps.h new file mode 100644 index 000000000..e9ab1bbc4 --- /dev/null +++ b/include/SSystem/SComponent/c_m3d_g_cps.h @@ -0,0 +1,34 @@ +#ifndef C_M3D_G_CPS_H +#define C_M3D_G_CPS_H + +#include "SSystem/SComponent/c_m3d.h" +#include "SSystem/SComponent/c_m3d_g_lin.h" +#include "global.h" + +struct cM3dGCpsS { + /* 0x00 */ Vec mStart; + /* 0x0C */ Vec mEnd; + /* 0x18 */ f32 mRadius; +}; // Size: 0x1C + +class cM3dGCps : public cM3dGLin { +public: + /* 0x1C */ f32 mRadius; + + cM3dGCps(void); + virtual ~cM3dGCps(void); + void Set(const cXyz&, const cXyz&, f32); + void Set(const cM3dGCpsS&); + void SetCps(const cM3dGCps&); + bool Cross(cM3dGCps const* other, cXyz* xyz) const { + return cM3d_Cross_CpsCps(*this, *other, xyz); + } + bool Cross(cM3dGCyl const* cyl, cXyz* xyz) const { return cM3d_Cross_CpsCyl(*this, *cyl, xyz); } + bool Cross(cM3dGSph const* sph, cXyz* xyz) const { return cM3d_Cross_CpsSph(*this, *sph, xyz); } + void SetR(f32 r) { mRadius = r; } + +}; // Size = 0x20 + +STATIC_ASSERT(0x20 == sizeof(cM3dGCps)); + +#endif /* C_M3D_G_CPS_H */ \ No newline at end of file diff --git a/include/SSystem/SComponent/c_m3d_g_lin.h b/include/SSystem/SComponent/c_m3d_g_lin.h new file mode 100644 index 000000000..f7ebd875f --- /dev/null +++ b/include/SSystem/SComponent/c_m3d_g_lin.h @@ -0,0 +1,32 @@ +#ifndef C_M3D_G_LIN_H +#define C_M3D_G_LIN_H + +#include "SSystem/SComponent/c_xyz.h" +#include "global.h" + +// Line +class cM3dGLin { + // private: +public: + /* 0x00 */ cXyz mStart; + /* 0x0C */ cXyz mEnd; + /* 0x18 vtable */ + + cM3dGLin() {} + cM3dGLin(const cXyz&, const cXyz&); + virtual ~cM3dGLin() {} + void SetStartEnd(const cXyz&, const cXyz&); + void SetStartEnd(const Vec&, const Vec&); + void CalcPos(Vec*, f32) const; + void CalcVec(Vec* pOut) const { VECSubtract(&this->mEnd, &this->mStart, pOut); } + void SetEnd(const cXyz&); + const cXyz& GetStartP(void) const { return mStart; } + cXyz& GetStartP(void) { return mStart; } + const cXyz& GetEndP(void) const { return mEnd; } + cXyz& GetEndP(void) { return mEnd; } + cXyz& GetEnd() { return mEnd; } +}; // Size = 0x1C + +STATIC_ASSERT(0x1C == sizeof(cM3dGLin)); + +#endif /* C_M3D_G_LIN_H */ \ No newline at end of file diff --git a/include/d/d_bg_s.h b/include/d/d_bg_s.h new file mode 100644 index 000000000..c9ffae1df --- /dev/null +++ b/include/d/d_bg_s.h @@ -0,0 +1,114 @@ +#ifndef D_BG_D_BG_S_H +#define D_BG_D_BG_S_H + +#include "global.h" +#include "SSystem/SComponent/c_sxyz.h" + +class cBgS_LinChk; +class cBgS_GndChk; +class cBgS_PolyInfo; +class cM3dGPla; +class cBgS_ShdwDraw; +class dBgW; +class fopAc_ac_c; +class dBgW_Base; +class dBgS_Acch; +class dBgS_RoofChk; +class dBgS_SplGrpChk; +class dBgS_SphChk; + +class cBgS_ChkElm { +public: + /* 0x00 */ dBgW_Base* m_bgw_base_ptr; + /* 0x04 */ bool m_used; + /* 0x08 */ u32 m_actor_id; + /* 0x0C */ fopAc_ac_c* m_actor_ptr; + /* 0x10 vtable */ + +public: + cBgS_ChkElm() { this->Init(); } + void Init(); + void Release(); + + virtual ~cBgS_ChkElm() {} + virtual void Regist2(dBgW_Base*, unsigned int, void*); + + bool ChkUsed() const { return m_used; } +}; // Size: 0x14 + +STATIC_ASSERT(sizeof(cBgS_ChkElm) == 0x14); + +class cBgS { +public: + /* 0x0000 */ cBgS_ChkElm m_chk_element[256]; + /* 0x1400 vtable */ + +public: + cBgS() {} + bool Regist(dBgW_Base*, unsigned int, void*); + int Release(dBgW_Base*); + 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; + void ShdwDraw(cBgS_ShdwDraw*); + u32 GetGrpInf(cBgS_PolyInfo const&) const; + + virtual ~cBgS() {} + virtual void Ct(); + virtual void Dt(); +}; // Size: 0x1404 + +class dBgS_Acch; + +class dBgS : public cBgS { +public: + dBgS() {} + ~dBgS() {} + void Ct(); + void Dt(); + void ClrMoveFlag(); + void Move(); + bool Regist(dBgW_Base*, fopAc_ac_c*); + bool ChkMoveBG(cBgS_PolyInfo const&); + bool ChkMoveBG_NoDABg(cBgS_PolyInfo const&); + s32 GetExitId(cBgS_PolyInfo const&); + s32 GetPolyColor(cBgS_PolyInfo const&); + BOOL GetHorseNoEntry(cBgS_PolyInfo const&); + int GetSpecialCode(cBgS_PolyInfo const&); + int GetMagnetCode(cBgS_PolyInfo const&); + int GetMonkeyBarsCode(cBgS_PolyInfo const&); + u32 GetUnderwaterRoofCode(cBgS_PolyInfo const&); + s32 GetWallCode(cBgS_PolyInfo const&); + int GetPolyAtt0(cBgS_PolyInfo const&); + int GetPolyAtt1(cBgS_PolyInfo const&); + int GetGroundCode(cBgS_PolyInfo const&); + s32 GetCamMoveBG(cBgS_PolyInfo const&); + s32 GetRoomCamId(cBgS_PolyInfo const&); + s32 GetRoomPathId(cBgS_PolyInfo const&); + s32 GetRoomPathPntNo(cBgS_PolyInfo const&); + u8 GetGrpSoundId(cBgS_PolyInfo const&); + u32 ChkGrpInf(cBgS_PolyInfo const&, u32); + s32 GetRoomId(cBgS_PolyInfo const&); + bool GetPolyAttackThrough(cBgS_PolyInfo const&); + u32 ChkPolyHSStick(cBgS_PolyInfo const&); + void WallCorrect(dBgS_Acch*); + void WallCorrectSort(dBgS_Acch*); + f32 RoofChk(dBgS_RoofChk*); + bool SplGrpChk(dBgS_SplGrpChk*); + bool SphChk(dBgS_SphChk*, void*); + void MoveBgCrrPos(cBgS_PolyInfo const&, bool, cXyz*, csXyz*, csXyz*, bool, bool); + void MoveBgTransPos(cBgS_PolyInfo const&, bool, cXyz*, csXyz*, csXyz*); + void MoveBgMatrixCrrPos(cBgS_PolyInfo const&, bool, cXyz*, csXyz*, csXyz*); + void RideCallBack(cBgS_PolyInfo const&, fopAc_ac_c*); + void ArrowStickCallBack(cBgS_PolyInfo const&, fopAc_ac_c*, cXyz&); + + bool WaterChk(dBgS_SplGrpChk* chk) { return SplGrpChk(chk); } +}; // Size: 0x1404 + +#endif /* D_BG_D_BG_S_H */ \ No newline at end of file diff --git a/include/d/d_cc_mass_s.h b/include/d/d_cc_mass_s.h new file mode 100644 index 000000000..86dabb43d --- /dev/null +++ b/include/d/d_cc_mass_s.h @@ -0,0 +1,83 @@ +#ifndef D_CC_D_CC_MASS_S_H +#define D_CC_D_CC_MASS_S_H + +#include "SSystem/SComponent/c_cc_d.h" +#include "global.h" + +typedef void (*dCcMassS_ObjCallback)(fopAc_ac_c*, cXyz*, u32); + +class dCcMassS_Obj { +private: + /* 0x00 */ cCcD_Obj* mpObj; + /* 0x04 */ u8 mPriority; + /* 0x08 */ dCcMassS_ObjCallback mpCallback; + /* 0x0C */ cCcD_DivideInfo mDivideInfo; + /* 0x14 vtable */ + +public: + dCcMassS_Obj(); + virtual ~dCcMassS_Obj() {} + void Set(cCcD_Obj* p_obj, u8 priority, dCcMassS_ObjCallback callback); + void Clear(); + + cCcD_Obj* GetObj() { return mpObj; } + u8 GetPriority() const { return mPriority; } + dCcMassS_ObjCallback GetCallback() const { return mpCallback; } + cCcD_DivideInfo& GetDivideInfo() { return mDivideInfo; } +}; // Size = 0x18 + +STATIC_ASSERT(0x18 == sizeof(dCcMassS_Obj)); + +class dCcMassS_HitInf { +private: + /* 0x00 */ cCcD_Obj* mpArea; + /* 0x04 */ cCcD_Obj* mpAtObj; + /* 0x08 */ cCcD_Obj* mpCoObj; + /* 0x0C */ f32 mCoHitLen; + +public: + void ClearPointer(); + void SetAreaHitObj(cCcD_Obj* obj) { mpArea = obj; } + void SetCoHitObj(cCcD_Obj* obj) { mpCoObj = obj; } + void SetAtHitObj(cCcD_Obj* obj) { mpAtObj = obj; } + void SetCoHitLen(f32 len) { mCoHitLen = len; } + cCcD_Obj* GetAtHitObj() const { return mpAtObj; } +}; + +class dCcMassS_Mng { +public: + /* 0x0000 */ cCcD_DivideArea mDivideArea; + /* 0x0040 */ s32 mMassObjCount; + /* 0x0044 */ dCcMassS_Obj mMassObjs[5]; + /* 0x00BC */ s32 mMassAreaCount; + /* 0x00C0 */ dCcMassS_Obj mMassAreas[2]; + /* 0x00F0 */ cCcD_CylAttr mCylAttr; + /* 0x0128 */ u8 field_0x200; + /* 0x0129 */ u8 mResultCamBit; + /* 0x012C */ u32 mFlag; + /* 0x0130 */ u32 mResultCam; + /* 0x0134 */ Vec mCamTopPos; + /* 0x0140 */ f32 mCamTopDist; + /* 0x0144 */ Vec mCamBottomPos; + /* 0x0150 */ f32 mCamBottomDist; + /* 0x0154 */ cCcD_CpsAttr mCpsAttr; + /* 0x0194 */ cCcD_DivideInfo mDivideInfo; + /* 0x019C vtable */ + +public: + dCcMassS_Mng(); + virtual ~dCcMassS_Mng() {} + /* 800855E4 */ void Ct(); + /* 80085630 */ void SetAttr(f32 radius, f32 height, u8 param_2, u8 param_3); + /* 80085690 */ void Prepare(); + /* 800858AC */ u32 Chk(cXyz* p_xyz, fopAc_ac_c** p_actor, dCcMassS_HitInf* p_hitInf); + /* 80085CF0 */ void Clear(); + /* 80085D98 */ void Set(cCcD_Obj* p_obj, u8 priority); + /* 80085E6C */ void SetCam(cM3dGCps const& cps); + /* 80085EB0 */ u8 GetResultCam() const; + /* 80085EB8 */ void GetCamTopPos(Vec* p_out); +}; + +STATIC_ASSERT(sizeof(dCcMassS_Mng) == 0x1A0); + +#endif /* D_CC_D_CC_MASS_S_H */ \ No newline at end of file diff --git a/include/d/d_cc_s.h b/include/d/d_cc_s.h new file mode 100644 index 000000000..5b24cd12f --- /dev/null +++ b/include/d/d_cc_s.h @@ -0,0 +1,59 @@ +#ifndef D_CC_D_CC_S_H +#define D_CC_D_CC_S_H + +#include "SSystem/SComponent/c_cc_s.h" +#include "d/d_cc_mass_s.h" +#include "global.h" + +class dCcD_GObjInf; +class dCcD_GStts; + +class dCcS : public cCcS { +public: + dCcS() {} + /* 80085ED4 */ void Ct(); + /* 80085F08 */ void Dt(); + /* 80085F28 */ bool ChkShieldFrontRange(cCcD_Obj*, cCcD_Obj*, int, cXyz const*); + /* 800860F8 */ bool ChkShield(cCcD_Obj*, cCcD_Obj*, dCcD_GObjInf*, dCcD_GObjInf*, cXyz const*); + /* 800861B0 */ void CalcTgPlusDmg(cCcD_Obj*, cCcD_Obj*, cCcD_Stts*, cCcD_Stts*); + /* 80086360 */ int GetRank(u8); + /* 8008685C */ void ProcAtTgHitmark(bool, bool, cCcD_Obj*, cCcD_Obj*, dCcD_GObjInf*, + dCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, dCcD_GStts*, + dCcD_GStts*, cXyz*, bool); + /* 80086D8C */ bool ChkCamera(cXyz&, cXyz&, f32, fopAc_ac_c*, fopAc_ac_c*, fopAc_ac_c*); + /* 80086FBC */ bool chkCameraPoint(cXyz const&, cCcD_ShapeAttr::Shape*, fopAc_ac_c*, + fopAc_ac_c*); + /* 800872AC */ void DrawAfter(); + /* 800872B0 */ void Move(); + /* 800872D0 */ void Draw(); + /* 8008730C */ void MassClear(); + /* 80087330 */ int ChkAtTgMtrlHit(u8, u8); + + /* 8008640C */ virtual void SetPosCorrect(cCcD_Obj*, cXyz*, cCcD_Obj*, cXyz*, f32); + /* 80086240 */ virtual void SetCoGObjInf(bool, bool, cCcD_GObjInf*, cCcD_GObjInf*, cCcD_Stts*, + cCcD_Stts*, cCcD_GStts*, cCcD_GStts*); + /* 80086AC0 */ virtual void SetAtTgGObjInf(bool, bool, cCcD_Obj*, cCcD_Obj*, cCcD_GObjInf*, + cCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, + cCcD_GStts*, cXyz*); + /* 8008734C */ virtual bool ChkNoHitGAtTg(cCcD_GObjInf const*, cCcD_GObjInf const*, cCcD_GStts*, + cCcD_GStts*); + /* 800861B4 */ virtual bool ChkAtTgHitAfterCross(bool, bool, cCcD_GObjInf const*, + cCcD_GObjInf const*, cCcD_Stts*, cCcD_Stts*, + cCcD_GStts*, cCcD_GStts*); + /* 80086404 */ virtual bool ChkNoHitGCo(cCcD_Obj*, cCcD_Obj*); + /* 8002FF40 */ virtual ~dCcS() {} + /* 800872A8 */ virtual void MoveAfterCheck(); + /* 80086754 */ virtual void CalcParticleAngle(dCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, csXyz*); + + void SetMass(cCcD_Obj* i_obj, u8 i_priority) { mMass_Mng.Set(i_obj, i_priority); } + void PrepareMass() { mMass_Mng.Prepare(); } + + static u8 m_mtrl_hit_tbl[64]; + + // /* 0x0000 */ cCcS mCCcS; + /* 0x2854 */ dCcMassS_Mng mMass_Mng; +}; // Size = 0x29F4 + +STATIC_ASSERT(sizeof(dCcS) == 0x29F4); + +#endif /* D_CC_D_CC_S_H */ \ No newline at end of file diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h new file mode 100644 index 000000000..add83040d --- /dev/null +++ b/include/d/d_com_inf_game.h @@ -0,0 +1,280 @@ +#ifndef D_COM_D_COM_INF_GAME_H +#define D_COM_D_COM_INF_GAME_H + +#include "d/d_save.h" +#include "d/d_bg_s.h" +#include "d/d_cc_s.h" +#include "d/d_stage.h" +#include "d/d_event.h" +#include "d/d_event_manager.h" +#include "d/d_resorce.h" + +class JKRArchive; +class JKRExpHeap; +class dPa_control_c; +class dDemo_manager_c; +class dMagma_packet_c; +class dGrass_packet_c; +class dTree_packet_c; +class dFlower_packet_c; +class Packet_c; +class daPy_py_c; +class daPy_lk_c; +class daPy_npc_c; +class daShip_c; +class daAgb_c; +class dTimer_c; +class camera_class; +class J2DOrthoGraph; + +struct dADM { + /* 0x00 */ int mBlockCount; + /* 0x04 */ void* mpData; + /* 0x08 */ u8 mCharTbl[0x90]; + /* 0x98 */ void* vtbl; +}; + +// setup properly later +struct dAttention_c { + u8 temp[0x190]; +}; + +struct dVibration_c { + u8 temp[0x84]; +}; + +struct dDetect_c { + u8 temp[0x14]; +}; + +struct dDlst_list_c { + u8 temp[0x16234]; +}; + +class dDlst_window_c { +public: + /* 0x00 */ f32 mXOrig; + /* 0x04 */ f32 mYOrig; + /* 0x08 */ f32 mWidth; + /* 0x0C */ f32 mHeight; + /* 0x10 */ f32 mNearZ; + /* 0x14 */ f32 mFarZ; + /* 0x18 */ f32 mScissorXOrig; + /* 0x1C */ f32 mScissorYOrig; + /* 0x20 */ f32 mScissorWidth; + /* 0x24 */ f32 mScissorHeight; +}; + +class dComIfG_camera_info_class { +public: + dComIfG_camera_info_class() {} + ~dComIfG_camera_info_class() {} + + /* 0x00 */ camera_class* mpCamera; + /* 0x04 */ u8 mDlstWindowIdx; + /* 0x05 */ u8 mCamIdx; + /* 0x06 */ u8 field_0x06; + /* 0x07 */ u8 field_0x07; + /* 0x08 */ u32 field_0x08; + /* 0x0C */ f32 field_0x0c; + /* 0x10 */ f32 field_0x10; +}; +STATIC_ASSERT(sizeof(dComIfG_camera_info_class) == 0x14); + +class dComIfG_play_c { +public: + /* 0x0000 */ dBgS mBgS; + /* 0x1404 */ dCcS mCcS; + /* 0x3DF8 */ dADM mADM; + /* 0x3E94 */ dStage_startStage_c mCurStage; + /* 0x3EA0 */ dStage_nextStage_c mNextStage; + /* 0x3EAE */ u8 field_0x3EAE[0x3EB0 - 0x3EAE]; + /* 0x3EB0 */ dStage_stageDt_c mStageData; + /* 0x3F34 */ dStage_roomControl_c mRoomCtrl; + /* 0x3F38 */ dEvt_control_c mEvtCtrl; + /* 0x402C */ dEvent_manager_c mEventMgr; + /* 0x4568 */ dAttention_c mAttention; + /* 0x46F8 */ u8 field_0x46F8[0x4700 - 0x46F8]; + /* 0x4700 */ dVibration_c mVibration; + /* 0x4784 */ dDetect_c mDetect; + /* 0x4798 */ JKRArchive* mpMsgArchive; + /* 0x479C */ JKRArchive* mpDmsgArchive; + /* 0x47A0 */ JKRArchive* mpTmsgArchive; + /* 0x47A4 */ JKRArchive* mpMenuArchive; + /* 0x47A8 */ JKRArchive* mpFontArchive; + /* 0x47AC */ u8 field_0x47AC[0x47B0 - 0x47AC]; + /* 0x47B0 */ JKRArchive* mpAnmArchive; + /* 0x47B4 */ JKRArchive* mpLkDArc; + /* 0x47B8 */ JKRArchive* mpFMapArchive; + /* 0x47BC */ JKRArchive* mpItemResArchive; + /* 0x47C0 */ JKRArchive* mpClctResArchive; + /* 0x47C4 */ JKRArchive* mpFMapResArchive; + /* 0x47C8 */ JKRArchive* mpDMapResArchive; + /* 0x47CC */ JKRArchive* mpOptResArchive; + /* 0x47D0 */ JKRArchive* mpClothResArchive; + /* 0x47D4 */ JKRArchive* mpSaveResArchive; + /* 0x47D8 */ JKRArchive* mpItemIconArchive; + /* 0x47DC */ JKRArchive* mpNameResArchive; + /* 0x47E0 */ JKRArchive* mpErrorResArchive; + /* 0x47E4 */ JKRArchive* mpActionIconArchive; + /* 0x47E8 */ JKRArchive* mpScopeResArchive; + /* 0x47EC */ JKRArchive* mpCamResArchive; + /* 0x47F0 */ JKRArchive* mpSwimResArchive; + /* 0x47F4 */ JKRArchive* mpWindResArchive; + /* 0x47F8 */ JKRArchive* mpEnglishTextArchive; + /* 0x47FC */ JKRArchive* mpHyruleTextArchive; + /* 0x4800 */ u8 field_0x4800[0x4824 - 0x4800]; + /* 0x4824 */ dPa_control_c* mParticle; + /* 0x4828 */ dDemo_manager_c* mDemo; + /* 0x482C */ dMagma_packet_c* mpMagmaPacket; + /* 0x4830 */ dGrass_packet_c* mpGrassPacket; + /* 0x4834 */ dTree_packet_c* mpTreePacket; + /* 0x4838 */ Packet_c* mpWoodPacket; + /* 0x483C */ dFlower_packet_c* mpFlowerPacket; + /* 0x4840 */ u8 mLkDArcIdx; + /* 0x4841 */ u8 field_0x4841; + /* 0x4842 */ short mVrboxFlags; + /* 0x4844 */ dDlst_window_c mDlstWindow[1]; + /* 0x486C */ u8 mCurCameraInfo; + /* 0x486D */ u8 field_0x486D[0x4870 - 0x486D]; + /* 0x4870 */ dComIfG_camera_info_class mCameraInfo[1]; + /* 0x48A4 */ daPy_py_c* mpCurPlayerActor[1]; + /* 0x48A8 */ u8 mCurCamera; + /* 0x48A9 */ u8 field_0x48A9[0x48AC - 0x48A9]; + /* 0x48AC */ daPy_lk_c* mpLinkActor; + /* 0x48B0 */ daPy_npc_c* mpPlayerPartnerActor; + /* 0x48B4 */ daShip_c* mpShip; + /* 0x48B8 */ f32 field_0x48b8; + /* 0x48BC */ int mItemLifeCount; + /* 0x48C0 */ int mItemRupeeCount; + /* 0x48C4 */ int mAirMeter; + /* 0x48C8 */ int field_0x48c8; + /* 0x48CC */ int mNpcNameMessageID; + /* 0x48D0 */ int mItemNameMessageID; + /* 0x48D4 */ s16 mItemKeyNumCount; + /* 0x48D6 */ s16 mItemMaxLifeCount; + /* 0x48D8 */ s16 mItemMagicCount; + /* 0x48DA */ s16 field_0x48da; + /* 0x48DC */ s16 field_0x48dc; + /* 0x48DE */ s16 field_0x48de; + /* 0x48E0 */ s16 mItemArrowNumCount; + /* 0x48E2 */ s16 field_0x48e2; + /* 0x48E4 */ s16 mItemBombNumCount; + /* 0x48E6 */ s16 field_0x48e6; + /* 0x48E8 */ u8 field_0x48E8[0x48F6 - 0x48E8]; + /* 0x48F6 */ s16 mItemPendantNumCount; + /* 0x48F8 */ u8 field_0x48F8[0x4918 - 0x48F8]; + /* 0x4918 */ u16 mCurrAuctionItemNameMsgID; + /* 0x491A */ s16 field_0x491a; + /* 0x491C */ s16 field_0x491c; + /* 0x491E */ s16 field_0x491e; + /* 0x4920 */ s16 field_0x4920; + /* 0x4922 */ s16 field_0x4922; + /* 0x4924 */ s16 mCurrHP; + /* 0x4926 */ s16 mRupyCountDisplay; + /* 0x4928 */ u8 field_0x4928; + /* 0x4929 */ u8 field_0x4929; + /* 0x492A */ u8 field_0x492a; + /* 0x492B */ u8 mbCamOverrideFarPlane; + /* 0x492C */ u8 field_0x492c; + /* 0x492D */ u8 field_0x492d; + /* 0x492E */ u8 mCurrButtonBAction; + /* 0x492F */ u8 mCurrButtonAAction; + /* 0x4930 */ u8 field_0x4930; + /* 0x4931 */ u8 field_0x4931; + /* 0x4932 */ u8 field_0x4932; + /* 0x4933 */ u8 mEquippedItems[4]; + /* 0x4937 */ u8 field_0x4937[4]; + /* 0x493B */ u8 mMesgAnime; + /* 0x493C */ u8 mMesgAnimeTagInfo; + /* 0x493D */ u8 field_0x493d; + /* 0x493E */ u8 field_0x493e; + /* 0x493F */ u8 field_0x493f; + /* 0x4940 */ u8 field_0x4940; + /* 0x4941 */ u8 field_0x4941; + /* 0x4942 */ u8 field_0x4942; + /* 0x4943 */ u8 field_0x4943; + /* 0x4944 */ u8 field_0x4944; + /* 0x4945 */ u8 field_0x4945; + /* 0x4946 */ u8 field_0x4946; + /* 0x4947 */ u8 field_0x4947; + /* 0x4948 */ u8 field_0x4948; + /* 0x4949 */ u8 field_0x4949; + /* 0x494A */ u8 field_0x494a[6]; + /* 0x4950 */ u8 mTactMode; + /* 0x4951 */ u8 field_0x4951; + /* 0x4952 */ u8 field_0x4952; + /* 0x4953 */ u8 field_0x4953; + /* 0x4954 */ u8 field_0x4954; + /* 0x4955 */ u8 field_0x4955; + /* 0x4956 */ u8 field_0x4956; + /* 0x4957 */ u8 mPlacenameIndex; + /* 0x4958 */ u8 field_0x4958; + /* 0x4959 */ u8 field_0x4959; + /* 0x495A */ u8 field_0x495a; + /* 0x495B */ u8 field_0x495b; + /* 0x495C */ u8 field_0x495c; + /* 0x495D */ u8 field_0x495d; + /* 0x495E */ u8 field_0x495e; + /* 0x495F */ u8 field_0x495f; + /* 0x4960 */ u8 field_0x4960; + /* 0x4961 */ u8 field_0x4961; + /* 0x4962 */ u8 field_0x4962; + /* 0x4963 */ u8 field_0x4963; + /* 0x4964 */ u8 mGameLanguage; + /* 0x4965 */ u8 field_0x4965; + /* 0x4966 */ char field_0x4966[1]; + /* 0x4967 */ u8 field_0x4967[0x4977 - 0x4967]; + /* 0x4977 */ u8 field_0x4977; + /* 0x4978 */ u8 field_0x4978; + /* 0x4979 */ u8 field_0x4979; + /* 0x497A */ u8 field_0x497a; + /* 0x497B */ u8 field_0x497B[0x497C - 0x497B]; + /* 0x497C */ JKRExpHeap* field_0x497c; + /* 0x4980 */ int mMesgCameraTagInfo; + /* 0x4984 */ int field_0x4984; + /* 0x4988 */ int field_0x4988[10]; + /* 0x49B0 */ u8 field_0x49B0[0x4A24 - 0x49B0]; + /* 0x4A24 */ daAgb_c* mpAgb; + /* 0x4A28 */ u32 mPlayerStatus[2][2]; + /* 0x4A38 */ u8 field_0x4A38[0x4A40 - 0x4A38]; + /* 0x4A40 */ dTimer_c* mpRestartTimer; + /* 0x4A44 */ int field_0x4a44; + /* 0x4A48 */ int field_0x4a48; + /* 0x4A4C */ int field_0x4a4c; + /* 0x4A50 */ u16 field_0x4a50; + /* 0x4A52 */ u8 field_0x4A52[0x4A54 - 0x4A52]; + /* 0x4A54 */ dDlst_window_c* field_0x4a54; + /* 0x4A58 */ camera_class* field_0x4a58; + /* 0x4A5C */ dDlst_window_c* field_0x4a5c; + /* 0x4A60 */ J2DOrthoGraph* mp2DOrthoGraph; + /* 0x4A64 */ u8 field_0x4A64[0x4A66 - 0x4A64]; + /* 0x4A66 */ u8 mLastSeaRoom; + /* 0x4A67 */ u8 field_0x4A67[0x4A68 - 0x4A67]; + /* 0x4A68 */ cXyz mIkadaLinkPos; + /* 0x4A74 */ void* mpItemTableArchive; + /* 0x4A78 */ void* mpFmapDataArchive; +}; + +class dComIfG_inf_c { +public: + /* 0x00000 */ dSv_info_c info; + /* 0x012A0 */ dComIfG_play_c play; + /* 0x05D1C */ dDlst_list_c drawlist; + /* 0x1BF50 */ u8 field_0x1BF50[0x1BFC0 - 0x1BF50]; + /* 0x1BFC0 */ dRes_control_c res_control; + /* 0x1D1C0 */ u8 field_0x1d1c0; + /* 0x1D1C1 */ u8 field_0x1d1c1; +}; + +extern dComIfG_inf_c g_dComIfG_gameInfo; + +inline u8 dComIfGs_getSelectEquip(int param_0) { + return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().getSelectEquip(param_0); +} + +inline u8 dComIfGs_getItem(int param_0) { + return g_dComIfG_gameInfo.info.getPlayer().getItem().getItem(param_0); +} + +#endif /* D_COM_D_COM_INF_GAME_H */ diff --git a/include/d/d_event.h b/include/d/d_event.h new file mode 100644 index 000000000..e5d7e3dd3 --- /dev/null +++ b/include/d/d_event.h @@ -0,0 +1,55 @@ +#ifndef D_EVENT_D_EVENT_H +#define D_EVENT_D_EVENT_H + +#include "global.h" + +class fopAc_ac_c; + +class dEvt_order_c { +public: + ~dEvt_order_c() {} + dEvt_order_c(); + + /* 0x00 */ u16 mEventType; + /* 0x02 */ u16 mFlag; + /* 0x04 */ u16 mHindFlag; + /* 0x08 */ fopAc_ac_c* mActor1; + /* 0x0C */ fopAc_ac_c* mActor2; + /* 0x10 */ s16 mEventId; + /* 0x12 */ u16 mPriority; + /* 0x14 */ s8 mNextOrderIdx; + /* 0x15 */ u8 mEventInfoIdx; +}; // Size = 0x18 + +class dEvt_control_c { +public: + /* 0x00 */ dEvt_order_c mOrder[8]; + /* 0xC0 */ u8 mOrderCount; + /* 0xC1 */ u8 mFirstOrderIdx; + /* 0xC2 */ u8 mMode; + /* 0xC3 */ u8 mbEndProc; + /* 0xC4 */ u32 mPt1; + /* 0xC8 */ u32 mPt2; + /* 0xCC */ int mPtTalk; + /* 0xD0 */ int mPtItem; + /* 0xD4 */ u8 mCurStaffId; + /* 0xD5 */ u8 field_0xD5[0xD6 - 0xD5]; + /* 0xD6 */ s16 field_0xd6; + /* 0xD8 */ s16 mEventId; + /* 0xDA */ u8 mEventEndSound; + /* 0xDB */ u8 field_0xdb; + /* 0xDC */ u8 field_0xdc; + /* 0xDD */ u8 field_0xDD[0xDE - 0xDD]; + /* 0xDE */ u8 field_0xde; + /* 0xDF */ u8 field_0xdf; + /* 0xE0 */ u8 mTalkButton; + /* 0xE1 */ u8 mItemNo; + /* 0xE2 */ u8 mbInPhoto; + /* 0xE3 */ u8 field_0xE3[0xE4 - 0xE3]; + /* 0xE4 */ f32 mCullFarClipRatio; + /* 0xE8 */ s16 mStateFlags; + /* 0xEA */ u8 mTactFreeMStick[4]; + /* 0xEE */ u8 mTactFreeCStick[4]; +}; // Size = 0xF4 + +#endif /* D_EVENT_D_EVENT_H */ \ No newline at end of file diff --git a/include/d/d_event_data.h b/include/d/d_event_data.h new file mode 100644 index 000000000..ed56a30fb --- /dev/null +++ b/include/d/d_event_data.h @@ -0,0 +1,51 @@ +#ifndef D_EVENT_D_EVENT_DATA_H +#define D_EVENT_D_EVENT_DATA_H + +#include "global.h" + +struct event_binary_data_header { + /* 0x00 */ u32 eventTop; // offset to Event chunk + /* 0x04 */ s32 eventNum; + /* 0x08 */ u32 staffTop; // offset to Staff chunk + /* 0x0C */ s32 staffNum; + /* 0x10 */ u32 cutTop; // offset to Cut chunk + /* 0x14 */ s32 cutNum; + /* 0x18 */ u32 dataTop; // offset to Data chunk + /* 0x1C */ s32 dataNum; + /* 0x20 */ u32 fDataTop; // offset to FData chunk + /* 0x24 */ s32 fDataNum; + /* 0x28 */ u32 iDataTop; // offset to IData chunk + /* 0x2C */ s32 iDataNum; + /* 0x30 */ u32 sDataTop; // offset to SData chunk + /* 0x34 */ s32 sDataNum; + /* 0x38 */ u8 unk[8]; +}; // Size: 0x40 + +class dEvDtData_c {}; + +class dEvDtCut_c {}; + +class dEvDtStaff_c {}; + +class dEvDtEvent_c {}; + +class dEvDtFlag_c { +public: + u32 mFlags[320]; +}; // Size = 0x500 + +class dEvDtBase_c { +public: + /* 0x00 */ event_binary_data_header* mHeaderP; + /* 0x04 */ dEvDtEvent_c* mEventP; + /* 0x08 */ dEvDtStaff_c* mStaffP; + /* 0x0C */ dEvDtCut_c* mCutP; + /* 0x10 */ dEvDtData_c* mDataP; + /* 0x14 */ f32* mFDataP; + /* 0x18 */ int* mIDataP; + /* 0x1C */ char* mSDataP; +}; // Size = 0x20 + +STATIC_ASSERT(sizeof(dEvDtBase_c) == 0x20); + +#endif /* D_EVENT_D_EVENT_DATA_H */ \ No newline at end of file diff --git a/include/d/d_event_manager.h b/include/d/d_event_manager.h new file mode 100644 index 000000000..53ee6aa9b --- /dev/null +++ b/include/d/d_event_manager.h @@ -0,0 +1,28 @@ +#ifndef D_EVENT_D_EVENT_MANAGER_H +#define D_EVENT_D_EVENT_MANAGER_H + +#include "SSystem/SComponent/c_xyz.h" +#include "d/d_event_data.h" + +class fopAc_ac_c; + +class dEvent_exception_c { +public: + /* 0x0 */ s32 mEventInfoIdx; + /* 0x4 */ u8 field_0x4; + /* 0x5 */ u8 field_0x5; + /* 0x6 */ u8 field_0x6; + /* 0x7 */ u8 field_0x7; + /* 0x8 */ s32 mState; +}; + +class dEvent_manager_c { +public: + /* 0x000 */ dEvDtBase_c mList; + /* 0x020 */ int mCameraPlay; + /* 0x024 */ dEvent_exception_c mException; + /* 0x030 */ cXyz mGoal; + /* 0x03C */ dEvDtFlag_c mFlag; +}; + +#endif /* D_EVENT_D_EVENT_MANAGER_H */ \ No newline at end of file diff --git a/include/d/d_kankyo.h b/include/d/d_kankyo.h new file mode 100644 index 000000000..0ab43bba4 --- /dev/null +++ b/include/d/d_kankyo.h @@ -0,0 +1,37 @@ +#ifndef D_KANKYO_D_KANKYO_H +#define D_KANKYO_D_KANKYO_H + +#include "global.h" +#include "dolphin/gx/GX.h" +#include "SSystem/SComponent/c_xyz.h" + +// setup properly later +struct J3DLightObj { + u8 temp[0x74]; +}; + +class dKy_tevstr_c { +public: + /* 0x00 */ J3DLightObj mLightObj; + /* 0x74 */ cXyz mLightPosWorld; + /* 0x80 */ GXColorS10 mColorC0; + /* 0x88 */ GXColor mColorK0; + /* 0x8C */ GXColor mColorK1; + /* 0x90 */ GXColorS10 mFogColor; + /* 0x98 */ f32 mFogStartZ; + /* 0x9C */ f32 mFogEndZ; + /* 0xA0 */ f32 mColpatBlend; + /* 0xA4 */ u8 mInitTimer; + /* 0xA5 */ u8 mEnvrIdxCurr; + /* 0xA6 */ u8 mEnvrIdxPrev; + /* 0xA7 */ u8 mColpatCurr; + /* 0xA8 */ u8 mColpatPrev; + /* 0xA9 */ s8 mRoomNo; + /* 0xAA */ u8 mEnvrIdxOverride; + /* 0xAB */ u8 mLightMode; + /* 0xAC */ u8 mInitType; +}; // Size = 0xB0 + +STATIC_ASSERT(sizeof(dKy_tevstr_c) == 0xB0); + +#endif /* D_KANKYO_D_KANKYO_H */ \ No newline at end of file diff --git a/include/d/d_resorce.h b/include/d/d_resorce.h index 43bde5641..6fd5aa469 100644 --- a/include/d/d_resorce.h +++ b/include/d/d_resorce.h @@ -1,12 +1,10 @@ #ifndef D_D_RESORCE_H #define D_D_RESORCE_H -#include "m_Do/m_Do_dvd_thread.h" -#include "m_Do/m_Do_ext.h" - class JKRArchive; class JKRHeap; class JKRSolidHeap; +class mDoDvdThd_mountArchive_c; class dRes_info_c { public: @@ -20,11 +18,11 @@ class dRes_info_c { static void dump_long(dRes_info_c*, int); static void dump(dRes_info_c*, int); - void* getRes(u32 resIdx) { return *(mRes + resIdx); } + void* getRes(u32 resIdx) { return *(mpRes + resIdx); } int getCount() { return mCount; } char* getArchiveName() { return mArchiveName; } - mDoDvdThd_mountArchive_c* getDMCommand() { return mDMCommand; } - JKRArchive* getArchive() { return mArchive; } + mDoDvdThd_mountArchive_c* getDMCommand() { return mpDMCommand; } + JKRArchive* getArchive() { return mpArchive; } void incCount() { mCount++; } u16 decCount() { return --mCount; @@ -108,8 +106,8 @@ class dRes_control_c { return getResInfo(arcName, &mStageInfo[0], ARRAY_SIZE(mStageInfo)); } - /* 0x0000 */ dRes_info_c mObjectInfo[0x80]; - /* 0x1200 */ dRes_info_c mStageInfo[0x40]; + /* 0x0000 */ dRes_info_c mObjectInfo[64]; + /* 0x1200 */ dRes_info_c mStageInfo[64]; }; // Size: 0x1B00 #endif /* D_D_RESORCE_H */ diff --git a/include/d/d_save.h b/include/d/d_save.h new file mode 100644 index 000000000..e3792c79c --- /dev/null +++ b/include/d/d_save.h @@ -0,0 +1,837 @@ +#ifndef D_SAVE_D_SAVE_H +#define D_SAVE_D_SAVE_H + +#include "global.h" +#include "SSystem/SComponent/c_xyz.h" + +enum ItemTable { + /* 0x00 */ HEART, + /* 0x01 */ GREEN_RUPEE, + /* 0x02 */ BLUE_RUPEE, + /* 0x03 */ YELLOW_RUPEE, + /* 0x04 */ RED_RUPEE, + /* 0x05 */ PURPLE_RUPEE, + /* 0x06 */ ORANGE_RUPEE, + /* 0x07 */ KAKERA_HEART, + /* 0x08 */ UTUWA_HEART, + /* 0x09 */ S_MAGIC, + /* 0x0A */ L_MAGIC, + /* 0x0B */ BOMB_5, + /* 0x0C */ BOMB_10, + /* 0x0D */ BOMB_20, + /* 0x0E */ BOMB_30, + /* 0x0F */ SILVER_RUPEE, + /* 0x10 */ ARROW_10, + /* 0x11 */ ARROW_20, + /* 0x12 */ ARROW_30, + /* 0x13 */ noentry19, + /* 0x14 */ noentry20, + /* 0x15 */ SMALL_KEY, + /* 0x16 */ RECOVER_FAIRY, + /* 0x17 */ noentry23, + /* 0x18 */ noentry24, + /* 0x19 */ noentry25, + /* 0x1A */ SUB_DUN_RUPEE, + /* 0x1B */ noentry27, + /* 0x1C */ noentry28, + /* 0x1D */ noentry29, + /* 0x1E */ TRIPLE_HEART, + /* 0x1F */ PENDANT, + /* 0x20 */ TELESCOPE, + /* 0x21 */ TNCL_WHITSL, + /* 0x22 */ WIND_TACT, + /* 0x23 */ CAMERA, + /* 0x24 */ EMONO_BAG, + /* 0x25 */ ROPE, + /* 0x26 */ CAMERA2, + /* 0x27 */ BOW, + /* 0x28 */ PWR_GROOVE, + /* 0x29 */ HVY_BOOTS, + /* 0x2A */ DRGN_SHIELD, + /* 0x2B */ WATER_BOOTS, + /* 0x2C */ ESA_BAG, + /* 0x2D */ BOOMERANG, + /* 0x2E */ BARE_HAND, + /* 0x2F */ HOOKSHOT, + /* 0x30 */ WARASHIBE_BAG, + /* 0x31 */ BOMB_BAG, + /* 0x32 */ FUKU, + /* 0x33 */ HUMMER, + /* 0x34 */ DEKU_LEAF, + /* 0x35 */ MAGIC_ARROW, + /* 0x36 */ LIGHT_ARROW, + /* 0x37 */ noentry55, + /* 0x38 */ SWORD, + /* 0x39 */ MASTER_SWORD, + /* 0x3A */ LV3_SWORD, + /* 0x3B */ SHIELD, + /* 0x3C */ MIRROW_SHIELD, + /* 0x3D */ DROPPED_SWORD, + /* 0x3E */ MASTER_SWORD_EX, + /* 0x3F */ KAKERA_HEART2, + /* 0x40 */ noentry64, + /* 0x41 */ noentry65, + /* 0x42 */ PIRATES_OMAMORI, + /* 0x43 */ HEROS_OMAMORI, + /* 0x44 */ GRASS_BALL, + /* 0x45 */ SKULL_NECKLACE, + /* 0x46 */ BOKOBABA_SEED, + /* 0x47 */ GOLDEN_FEATHER, + /* 0x48 */ BOKO_BELT, + /* 0x49 */ RED_JELLY, + /* 0x4A */ GREEN_JELLY, + /* 0x4B */ BLUE_JELLY, + /* 0x4C */ MAP, + /* 0x4D */ COMPASS, + /* 0x4E */ BOSS_KEY, + /* 0x4F */ EMPTY_BSHIP, + /* 0x50 */ EMPTY_BOTTLE, + /* 0x51 */ RED_BOTTLE, + /* 0x52 */ GREEN_BOTTLE, + /* 0x53 */ BLUE_BOTTLE, + /* 0x54 */ BOTTLESHIP, + /* 0x55 */ SOUP_BOTTLE, + /* 0x56 */ BIN_IN_WATER, + /* 0x57 */ FAIRY_BOTTLE, + /* 0x58 */ FIREFLY_BOTTLE, + /* 0x59 */ FWATER_BOTTLE, + /* 0x5A */ UNK_BOTTLE_5A, + /* 0x5B */ UNK_BOTTLE_5B, + /* 0x5C */ UNK_BOTTLE_5C, + /* 0x5D */ UNK_BOTTLE_5D, + /* 0x5E */ UNK_BOTTLE_5E, + /* 0x5F */ UNK_BOTTLE_5F, + /* 0x60 */ UNK_BOTTLE_60, + /* 0x61 */ TRIFORCE1, + /* 0x62 */ TRIFORCE2, + /* 0x63 */ TRIFORCE3, + /* 0x64 */ TRIFORCE4, + /* 0x65 */ TRIFORCE5, + /* 0x66 */ TRIFORCE6, + /* 0x67 */ TRIFORCE7, + /* 0x68 */ TRIFORCE8, + /* 0x69 */ PEARL1, + /* 0x6A */ PEARL2, + /* 0x6B */ PEARL3, + /* 0x6C */ KNOWLEDGE_TF, + /* 0x6D */ TACT_SONG1, + /* 0x6E */ TACT_SONG2, + /* 0x6F */ TACT_SONG3, + /* 0x70 */ TACT_SONG4, + /* 0x71 */ TACT_SONG5, + /* 0x72 */ TACT_SONG6, + /* 0x73 */ noentry115, + /* 0x74 */ noentry116, + /* 0x75 */ noentry117, + /* 0x76 */ noentry118, + /* 0x77 */ noentry119, + /* 0x78 */ NORMAL_SAIL, + /* 0x79 */ TRIFORCE_MAP1, + /* 0x7A */ TRIFORCE_MAP2, + /* 0x7B */ TRIFORCE_MAP3, + /* 0x7C */ TRIFORCE_MAP4, + /* 0x7D */ TRIFORCE_MAP5, + /* 0x7E */ TRIFORCE_MAP6, + /* 0x7F */ TRIFORCE_MAP7, + /* 0x80 */ TRIFORCE_MAP8, + /* 0x81 */ noentry129, + /* 0x82 */ BIRD_ESA_5, + /* 0x83 */ ANIMAL_ESA, + /* 0x84 */ ESA1, + /* 0x85 */ ESA2, + /* 0x86 */ ESA3, + /* 0x87 */ ESA4, + /* 0x88 */ ESA5, + /* 0x89 */ MAGIC_BEAN, + /* 0x8A */ BIRD_ESA_10, + /* 0x8B */ noentry139, + /* 0x8C */ FLOWER_1, + /* 0x8D */ FLOWER_2, + /* 0x8E */ FLOWER_3, + /* 0x8F */ HEROS_FLAG, + /* 0x90 */ TAIRYO_FLAG, + /* 0x91 */ SALES_FLAG, + /* 0x92 */ WIND_FLAG, + /* 0x93 */ RED_FLAG, + /* 0x94 */ FOSSIL_HEAD, + /* 0x95 */ WATER_STATUE, + /* 0x96 */ POSTMAN_STATUE, + /* 0x97 */ PRESIDENT_STATUE, + /* 0x98 */ LETTER00, + /* 0x99 */ MAGIC_SEED, + /* 0x9A */ MAGYS_LETTER, + /* 0x9B */ MO_LETTER, + /* 0x9C */ COTTAGE_PAPER, + /* 0x9D */ KAISEN_PRESENT1, + /* 0x9E */ KAISEN_PRESENT2, + /* 0x9F */ SALVAGE_ITEM1, + /* 0xA0 */ SALVAGE_ITEM2, + /* 0xA1 */ SALVAGE_ITEM3, + /* 0xA2 */ XXX_039, + /* 0xA3 */ TINGLE_STATUE1, + /* 0xA4 */ TINGLE_STATUE2, + /* 0xA5 */ TINGLE_STATUE3, + /* 0xA6 */ TINGLE_STATUE4, + /* 0xA7 */ TINGLE_STATUE5, + /* 0xA8 */ TINGLE_STATUE6, + /* 0xA9 */ noentry169, + /* 0xAA */ noentry170, + /* 0xAB */ MAX_RUPEE_UP1, + /* 0xAC */ MAX_RUPEE_UP2, + /* 0xAD */ MAX_BOMB_UP1, + /* 0xAE */ MAX_BOMB_UP2, + /* 0xAF */ MAX_ARROW_UP1, + /* 0xB0 */ MAX_ARROW_UP2, + /* 0xB1 */ MAGIC_POWER, + /* 0xB2 */ MAX_MP_UP1, + /* 0xB3 */ TINCLE_RUPEE1, + /* 0xB4 */ TINCLE_RUPEE2, + /* 0xB5 */ TINCLE_RUPEE3, + /* 0xB6 */ TINCLE_RUPEE4, + /* 0xB7 */ TINCLE_RUPEE5, + /* 0xB8 */ TINCLE_RUPEE6, + /* 0xB9 */ LITHOGRAPH1, + /* 0xBA */ LITHOGRAPH2, + /* 0xBB */ LITHOGRAPH3, + /* 0xBC */ LITHOGRAPH4, + /* 0xBD */ LITHOGRAPH5, + /* 0xBE */ LITHOGRAPH6, + /* 0xBF */ COLLECT_MAP_64, + /* 0xC0 */ COLLECT_MAP_63, + /* 0xC1 */ COLLECT_MAP_62, + /* 0xC2 */ COLLECT_MAP_61, + /* 0xC3 */ COLLECT_MAP_60, + /* 0xC4 */ COLLECT_MAP_59, + /* 0xC5 */ COLLECT_MAP_58, + /* 0xC6 */ COLLECT_MAP_57, + /* 0xC7 */ COLLECT_MAP_56, + /* 0xC8 */ COLLECT_MAP_55, + /* 0xC9 */ COLLECT_MAP_54, + /* 0xCA */ COLLECT_MAP_53, + /* 0xCB */ COLLECT_MAP_52, + /* 0xCC */ COLLECT_MAP_51, + /* 0xCD */ COLLECT_MAP_50, + /* 0xCE */ COLLECT_MAP_49, + /* 0xCF */ COLLECT_MAP_48, + /* 0xD0 */ COLLECT_MAP_47, + /* 0xD1 */ COLLECT_MAP_46, + /* 0xD2 */ COLLECT_MAP_45, + /* 0xD3 */ COLLECT_MAP_44, + /* 0xD4 */ COLLECT_MAP_43, + /* 0xD5 */ COLLECT_MAP_42, + /* 0xD6 */ COLLECT_MAP_41, + /* 0xD7 */ COLLECT_MAP_40, + /* 0xD8 */ COLLECT_MAP_39, + /* 0xD9 */ COLLECT_MAP_38, + /* 0xDA */ COLLECT_MAP_37, + /* 0xDB */ COLLECT_MAP_36, + /* 0xDC */ COLLECT_MAP_35, + /* 0xDD */ COLLECT_MAP_34, + /* 0xDE */ COLLECT_MAP_33, + /* 0xDF */ COLLECT_MAP_32, + /* 0xE0 */ COLLECT_MAP_31, + /* 0xE1 */ COLLECT_MAP_30, + /* 0xE2 */ COLLECT_MAP_29, + /* 0xE3 */ COLLECT_MAP_28, + /* 0xE4 */ COLLECT_MAP_27, + /* 0xE5 */ COLLECT_MAP_26, + /* 0xE6 */ COLLECT_MAP_25, + /* 0xE7 */ COLLECT_MAP_24, + /* 0xE8 */ COLLECT_MAP_23, + /* 0xE9 */ COLLECT_MAP_22, + /* 0xEA */ COLLECT_MAP_21, + /* 0xEB */ COLLECT_MAP_20, + /* 0xEC */ COLLECT_MAP_19, + /* 0xED */ COLLECT_MAP_18, + /* 0xEE */ COLLECT_MAP_17, + /* 0xEF */ COLLECT_MAP_16, + /* 0xF0 */ COLLECT_MAP_15, + /* 0xF1 */ COLLECT_MAP_14, + /* 0xF2 */ COLLECT_MAP_13, + /* 0xF3 */ COLLECT_MAP_12, + /* 0xF4 */ COLLECT_MAP_11, + /* 0xF5 */ COLLECT_MAP_10, + /* 0xF6 */ COLLECT_MAP_09, + /* 0xF7 */ COLLECT_MAP_08, + /* 0xF8 */ COLLECT_MAP_07, + /* 0xF9 */ COLLECT_MAP_06, + /* 0xFA */ COLLECT_MAP_05, + /* 0xFB */ COLLECT_MAP_04, + /* 0xFC */ COLLECT_MAP_03, + /* 0xFD */ COLLECT_MAP_02, + /* 0xFE */ COLLECT_MAP_01, + /* 0xFF */ NO_ITEM, +}; + +class dSv_player_status_a_c { +public: + /* 800589A8 */ void init(); + + u8 getSelectItemIndex(int i_no) const { return mSelectItem[i_no]; } + u8 getSelectEquip(int i_no) const { return mSelectEquip[i_no]; } + + /* 0x00 */ u16 mMaxLife; + /* 0x02 */ u16 mLife; + /* 0x04 */ u16 mRupee; + /* 0x06 */ u16 field_0x6; + /* 0x08 */ u8 field_0x8; + /* 0x09 */ u8 mSelectItem[5]; // X, Y, Z button + /* 0x0E */ u8 mSelectEquip[4]; // Sword, Shield, Bracelet, ? + /* 0x12 */ u8 mWalletSize; + /* 0x13 */ u8 mMaxMagic; + /* 0x14 */ u8 mMagic; + /* 0x15 */ u8 field_0x15; + /* 0x16 */ u8 field_0x16; +}; // Size: 0x18 + +STATIC_ASSERT(sizeof(dSv_player_status_a_c) == 0x18); + +class dSv_player_status_b_c { +public: + /* 80058B54 */ void init(); + + /* 0x00 */ u64 mDateIPL; + /* 0x08 */ f32 field_0x8; + /* 0x0C */ f32 mTime; + /* 0x10 */ u16 mDate; + /* 0x12 */ s16 mTactWindAngleX; + /* 0x14 */ s16 mTactWindAngleY; +}; // Size: 0x18 + +STATIC_ASSERT(sizeof(dSv_player_status_b_c) == 0x18); + +class dSv_player_return_place_c { +public: + /* 80058B84 */ void init(); + /* 80058BC8 */ void set(char const*, s8, u8); + + /* 0x00 */ char mName[8]; + /* 0x08 */ s8 mRoomNo; + /* 0x09 */ u8 mPlayerStatus; + /* 0x0A */ u8 unk_0xa; + /* 0x0B */ u8 unk_0xb; +}; // Size: 0xC + +STATIC_ASSERT(sizeof(dSv_player_return_place_c) == 0xC); + +class dSv_player_item_c { +public: + /* 80058C60 */ void init(); + /* 80058C7C */ void setBottleItemIn(u8, u8); + /* 80058E1C */ void setEmptyBottleItemIn(u8); + /* 80058E44 */ void setEmptyBottle(); + /* 800591B0 */ void setEquipBottleItemIn(u8); + /* 80058F74 */ void setEquipBottleItemIn(u8, u8); + /* 80059408 */ void setEquipBottleItemEmpty(); + /* 8005918C */ void setEquipBottleItemEmpty(u8); + /* 8005942C */ u8 checkBottle(u8); + /* 8005946C */ u8 checkEmptyBottle(); + + u8 getItem(int i_idx) const { return mItems[i_idx]; } + + /* 0x00 */ u8 mItems[21]; +}; // Size: 0x15 + +STATIC_ASSERT(sizeof(dSv_player_item_c) == 0x15); + +class dSv_player_get_item_c { +public: + /* 800594A8 */ void init(); + /* 800594C4 */ void onItem(int, u8); + /* 8005955C */ bool isItem(int, u8); + /* 800595F8 */ void onBottleItem(u8); + /* 80059740 */ bool isBottleItem(u8); + + /* 0x0 */ u8 mItemFlags[21]; +}; // Size: 0x15 + +STATIC_ASSERT(sizeof(dSv_player_get_item_c) == 0x15); + +class dSv_player_item_record_c { +public: + /* 80059848 */ void init(); + /* 8005987C */ void resetTimer(u16); + /* 80059894 */ void decTimer(); + /* 800598D0 */ u16 getTimer(); + + /* 0x0 */ u16 mTimer; + /* 0x2 */ u8 field_0x2; + /* 0x3 */ u8 mArrowNum; + /* 0x4 */ u8 mBombNum; + /* 0x5 */ u8 mBottleNum[3]; +}; // Size: 0x8 + +STATIC_ASSERT(sizeof(dSv_player_item_record_c) == 0x8); + +class dSv_player_item_max_c { +public: + /* 800598D8 */ void init(); + + /* 0x0 */ u8 field_0x0; + /* 0x1 */ u8 mArrowNum; + /* 0x2 */ u8 mBombNum; + /* 0x3 */ u8 field_0x3[5]; +}; // Size: 0x8 + +STATIC_ASSERT(sizeof(dSv_player_item_max_c) == 0x8); + +class dSv_player_bag_item_c { +public: + /* 80059908 */ void init(); + /* 80059968 */ void setBeastItem(u8); + /* 800599D8 */ void setBeastItemEmpty(u8); + /* 80059C30 */ bool checkBeastItem(u8); + /* 80059C60 */ void setBaitItemChange(u8); + /* 80059EB0 */ void setBaitItemChange(u8, u8); + /* 8005A1A4 */ void setBaitItemEmpty(u8); + /* 8005A0C8 */ void setBaitItemEmpty(); + /* 8005A248 */ void setBaitItem(u8); + /* 8005A2D0 */ u8 checkBaitItemEmpty(); + /* 8005A2F4 */ u8 checkBaitItem(u8); + /* 8005A584 */ void setReserveItemChange(u8, u8); + /* 8005A334 */ void setReserveItemChange(u8); + /* 8005A7C0 */ void setReserveItemEmpty(u8); + /* 8005A79C */ void setReserveItemEmpty(); + /* 8005A7E4 */ void setReserveItem(u8); + /* 8005A854 */ u8 checkReserveItemEmpty(); + /* 8005A878 */ u8 checkReserveItem(u8); + + /* 0x00 */ u8 field_0x0[8]; + /* 0x08 */ u8 field_0x8[8]; + /* 0x10 */ u8 field_0x10[8]; +}; // Size: 0x18 + +STATIC_ASSERT(sizeof(dSv_player_bag_item_c) == 0x18); + +class dSv_player_get_bag_item_c { +public: + /* 8005A8B8 */ void init(); + /* 8005A8CC */ void onBeast(u8); + /* 8005A960 */ bool isBeast(u8); + /* 8005A9F8 */ void onBait(u8); + /* 8005AA8C */ bool isBait(u8); + /* 8005AB24 */ void onReserve(u8); + /* 8005ABB4 */ bool isReserve(u8); + + /* 0x0 */ u32 mReserveFlags; + /* 0x4 */ u8 mBeastFlags; + /* 0x5 */ u8 mBaitFlags; + /* 0x6 */ u8 unk_0x6[0xC - 0x6]; +}; // Size: 0xC + +STATIC_ASSERT(sizeof(dSv_player_get_bag_item_c) == 0xC); + +class dSv_player_bag_item_record_c { +public: + /* 8005AC48 */ void init(); + + /* 0x00 */ u8 field_0x0[8]; + /* 0x08 */ u8 field_0x8[8]; + /* 0x10 */ u8 field_0x10[8]; +}; // Size: 0x18 + +STATIC_ASSERT(sizeof(dSv_player_bag_item_record_c) == 0x18); + +class dSv_player_collect_c { +public: + /* 8005ACA8 */ void init(); + /* 8005ACE0 */ void onCollect(int, u8); + /* 8005AD78 */ void offCollect(int, u8); + /* 8005AE10 */ bool isCollect(int, u8); + /* 8005AEAC */ void onTact(u8); + /* 8005AF40 */ bool isTact(u8); + /* 8005AFD8 */ void onTriforce(u8); + /* 8005B06C */ BOOL isTriforce(u8); + /* 8005B104 */ void onSymbol(u8); + /* 8005B198 */ bool isSymbol(u8); + /* 8005B230 */ int getTriforceNum(); + + /* 0x0 */ u8 field_0x0[8]; + /* 0x8 */ u8 field_0x8; + /* 0x9 */ u8 mTact; + /* 0xA */ u8 mTriforce; + /* 0xB */ u8 mSymbol; + /* 0xC */ u8 field_0xc; +}; // Size: 0xD + +STATIC_ASSERT(sizeof(dSv_player_collect_c) == 0xD); + +class dSv_player_map_c { +public: + /* 8005B290 */ void init(); + /* 8005B320 */ void onGetMap(int); + /* 8005B3CC */ BOOL isGetMap(int); + /* 8005B47C */ void onOpenMap(int); + /* 8005B528 */ void offOpenMap(int); + /* 8005B5D4 */ BOOL isOpenMap(int); + /* 8005B684 */ void onCompleteMap(int); + /* 8005B730 */ void offCompleteMap(int); + /* 8005B7DC */ BOOL isCompleteMap(int); + /* 8005B88C */ void onTriforce(int); + /* 8005B92C */ void offTriforce(int); + /* 8005B9CC */ BOOL isTriforce(int); + /* 8005BA70 */ int getCollectMapNum(); + /* 8005BAE8 */ void onFmapBit(int, u8); + /* 8005BB84 */ BOOL isFmapBit(int, u8); + /* 8005BC24 */ void onSaveArriveGrid(int); + /* 8005BCBC */ BOOL isSaveArriveGrid(int); + /* 8005BD54 */ void onSaveArriveGridForAgb(int); + /* 8005BDEC */ BOOL isSaveArriveGridForAgb(int); + + /* 0x00 */ u32 field_0x0[4][4]; + /* 0x40 */ u8 field_0x40[49]; + /* 0x71 */ u8 field_0x71[16]; + /* 0x81 */ u8 field_0x81; + /* 0x82 */ u8 field_0x82[0x84 - 0x82]; +}; // Size: 0x84 + +STATIC_ASSERT(sizeof(dSv_player_map_c) == 0x84); + +class dSv_player_info_c { +public: + /* 8005BE84 */ void init(); + + /* 0x00 */ u8 field_0x0[0x10]; + /* 0x10 */ u16 field_0x10; + /* 0x10 */ u16 field_0x12; + /* 0x14 */ char mPlayerName[17]; + /* 0x25 */ char field_0x25[17]; + /* 0x36 */ char field_0x36[17]; + /* 0x47 */ char field_0x47[17]; + /* 0x58 */ u8 mClearCount; + /* 0x59 */ u8 mFmapIdx; + /* 0x5A */ u8 field_0x5a[0x5c - 0x5a]; +}; // Size: 0x5C + +STATIC_ASSERT(sizeof(dSv_player_info_c) == 0x5C); + +class dSv_player_config_c { +public: + /* 8005BF2C */ void init(); + /* 8005BFA4 */ void checkVibration(); + + /* 0x0 */ u8 field_0x0; + /* 0x1 */ u8 mSoundMode; + /* 0x2 */ u8 mAttentionType; + /* 0x3 */ u8 mVibration; + /* 0x4 */ u8 field_0x4; +}; + +STATIC_ASSERT(sizeof(dSv_player_config_c) == 0x5); + +class dSv_player_priest_c { +public: + /* 8005BFC8 */ void init(); + /* 8005BFD4 */ void set(u8, cXyz&, s16, s8); + + /* 0x0 */ cXyz field_0x0; + /* 0xC */ s16 field_0xc; + /* 0xE */ s8 field_0xe; + /* 0xF */ u8 field_0xf; +}; + +STATIC_ASSERT(sizeof(dSv_player_priest_c) == 0x10); + +class dSv_player_status_c_c { +public: + /* 8005BFFC */ void init(); + + /* 0x00 */ dSv_player_status_a_c mRecollectStatusA; + /* 0x18 */ dSv_player_item_c mRecollectItem; + /* 0x2D */ u8 mRecollectItemRecord[3]; + /* 0x30 */ u8 mRecollectItemMax[3]; + /* 0x33 */ dSv_player_bag_item_c mRecollectBagItem; + /* 0x4B */ dSv_player_bag_item_record_c mRecollectBagItemRecord; + /* 0x63 */ u8 mRecollectCollect[13]; +}; // Size: 0x70 + +STATIC_ASSERT(sizeof(dSv_player_status_c_c) == 0x70); + +class dSv_player_c { +public: + /* 8005C000 */ void init(); + + dSv_player_status_a_c& getPlayerStatusA() { return mPlayerStatusA; } + dSv_player_status_a_c* getpPlayerStatusA() { return &mPlayerStatusA; } + + dSv_player_status_b_c& getPlayerStatusB() { return mPlayerStatusB; } + dSv_player_status_b_c* getpPlayerStatusB() { return &mPlayerStatusB; } + + dSv_player_return_place_c& getPlayerReturnPlace() { return mReturnPlace; } + dSv_player_return_place_c* getpPlayerReturnPlace() { return &mReturnPlace; } + + dSv_player_item_c& getItem() { return mPlayerItem; } + dSv_player_item_c* getpItem() { return &mPlayerItem; } + + dSv_player_get_item_c& getGetItem() { return mGetItem; } + dSv_player_get_item_c* getpGetItem() { return &mGetItem; } + + dSv_player_item_record_c& getItemRecord() { return mItemRecord; } + dSv_player_item_record_c* getpItemRecord() { return &mItemRecord; } + + dSv_player_item_max_c& getItemMax() { return mItemMax; } + dSv_player_item_max_c* getpItemMax() { return &mItemMax; } + + dSv_player_bag_item_c& getBagItem() { return mBagItem; } + dSv_player_bag_item_c* getpBagItem() { return &mBagItem; } + + dSv_player_get_bag_item_c& getGetBagItem() { return mGetBagItem; } + dSv_player_get_bag_item_c* getpGetBagItem() { return &mGetBagItem; } + + dSv_player_bag_item_record_c& getBagItemRecord() { return mBagItemRecord; } + dSv_player_bag_item_record_c* getpBagItemRecord() { return &mBagItemRecord; } + + dSv_player_collect_c& getCollect() { return mCollect; } + dSv_player_collect_c* getpCollect() { return &mCollect; } + + dSv_player_map_c& getMap() { return mMap; } + dSv_player_map_c* getpMap() { return &mMap; } + + dSv_player_info_c& getPlayerInfo() { return mInfo; } + dSv_player_info_c* getpPlayerInfo() { return &mInfo; } + + dSv_player_config_c& getConfig() { return mConfig; } + dSv_player_config_c* getpConfig() { return &mConfig; } + + dSv_player_priest_c& getPriest() { return mPriest; } + dSv_player_priest_c* getpPriest() { return &mPriest; } + + dSv_player_status_c_c* getpPlayerStatusC(int i_idx) { return &mStatusC[i_idx]; } + + /* 0x000 */ dSv_player_status_a_c mPlayerStatusA; + /* 0x018 */ dSv_player_status_b_c mPlayerStatusB; + /* 0x030 */ dSv_player_return_place_c mReturnPlace; + /* 0x03C */ dSv_player_item_c mPlayerItem; + /* 0x051 */ dSv_player_get_item_c mGetItem; + /* 0x066 */ dSv_player_item_record_c mItemRecord; + /* 0x06E */ dSv_player_item_max_c mItemMax; + /* 0x076 */ dSv_player_bag_item_c mBagItem; + /* 0x090 */ dSv_player_get_bag_item_c mGetBagItem; + /* 0x09C */ dSv_player_bag_item_record_c mBagItemRecord; + /* 0x0B4 */ dSv_player_collect_c mCollect; + /* 0x0C4 */ dSv_player_map_c mMap; + /* 0x148 */ dSv_player_info_c mInfo; + /* 0x1A4 */ dSv_player_config_c mConfig; + /* 0x1AC */ dSv_player_priest_c mPriest; + /* 0x1BC */ dSv_player_status_c_c mStatusC[4]; +}; // Size: 0x380 ? + +STATIC_ASSERT(sizeof(dSv_player_c) == 0x380); + +class dSv_memBit_c { +public: + /* 8005C094 */ void init(); + /* 8005C0EC */ void onTbox(int); + /* 8005C188 */ BOOL isTbox(int); + /* 8005C228 */ void onSwitch(int); + /* 8005C2D4 */ void offSwitch(int); + /* 8005C380 */ BOOL isSwitch(int); + /* 8005C430 */ BOOL revSwitch(int); + /* 8005C4EC */ void onItem(int); + /* 8005C598 */ BOOL isItem(int); + /* 8005C648 */ void onVisitedRoom(int); + /* 8005C6F4 */ BOOL isVisitedRoom(int); + /* 8005C7A4 */ void onDungeonItem(int); + /* 8005C844 */ BOOL isDungeonItem(int); + + /* 0x00 */ u32 mTbox; + /* 0x04 */ u32 mSwitch[4]; + /* 0x14 */ u32 mItem[1]; + /* 0x18 */ u32 mVisitedRoom[2]; + /* 0x20 */ u8 field_0x20; + /* 0x21 */ u8 mDungeonItem; +}; // Size: 0x24 + +class dSv_ocean_c { +public: + /* 8005C8E8 */ void init(); + /* 8005C908 */ void onOceanSvBit(u8, u16); + /* 8005C9E8 */ BOOL isOceanSvBit(u8, u16); + + /* 0x0 */ u16 field_0x0[50]; +}; + +class dSv_event_c { +public: + /* 8005CACC */ void init(); + /* 8005CB04 */ void onEventBit(u16); + /* 8005CB1C */ void offEventBit(u16); + /* 8005CB34 */ BOOL isEventBit(u16); + /* 8005CB58 */ void setEventReg(u16, u8); + /* 8005CB7C */ u8 getEventReg(u16); + + /* 0x0 */ u8 mFlags[0x100]; +}; // Size: 0x100 + +class dSv_reserve_c { +public: + /* 8005CB94 */ void init(); + + /* 0x0 */ u8 mReserve[0x50]; +}; // Size: 0x50 + +class dSv_memory_c { +public: + /* 8005CBB0 */ void init(); + + dSv_memBit_c& getBit() { return mMembit; } + const dSv_memBit_c& getBit() const { return mMembit; } + + /* 0x0 */ dSv_memBit_c mMembit; +}; // Size: 0x24 + +class dSv_danBit_c { +public: + /* 8005CBD0 */ int init(s8); + /* 8005CC08 */ void onSwitch(int); + /* 8005CCB4 */ void offSwitch(int); + /* 8005CD60 */ BOOL isSwitch(int); + /* 8005CE10 */ BOOL revSwitch(int); + + /* 0x0 */ s8 mStageNo; + /* 0x1 */ u8 field_0x1; + /* 0x4 */ u32 mSwitch[2]; +}; // Size: 0xC + +class dSv_zoneBit_c { +public: + /* 8005CECC */ void init(); + /* 8005CEF4 */ void clearRoomSwitch(); + /* 8005CF00 */ void onSwitch(int); + /* 8005CFAC */ void offSwitch(int); + /* 8005D054 */ BOOL isSwitch(int); + /* 8005D100 */ BOOL revSwitch(int); + /* 8005D1B8 */ void onItem(int); + /* 8005D254 */ BOOL isItem(int); + + static const int SWITCH_MAX = 48; + + /* 0x0 */ u16 mSwitch[3]; + /* 0x6 */ u16 mItem; +}; // Size: 0x8 + +class dSv_zoneActor_c { +public: + /* 8005D2F4 */ void init(); + /* 8005D314 */ void on(int); + /* 8005D3BC */ BOOL is(int); + + static const int ACTOR_MAX = 512; + + /* 0x0 */ u32 mActorFlags[16]; +}; // Size: 0x40 + +class dSv_zone_c { +public: + /* 8005D468 */ void init(int); + + dSv_zoneBit_c& getZoneBit() { return mZoneBit; } + const dSv_zoneBit_c& getBit() const { return mZoneBit; } + dSv_zoneActor_c& getActor() { return mZoneActor; } + const dSv_zoneActor_c& getActor() const { return mZoneActor; } + + /* 0x00 */ s8 mRoomNo; + /* 0x02 */ dSv_zoneBit_c mZoneBit; + /* 0x0C */ dSv_zoneActor_c mZoneActor; +}; // Size: 0x4C + +class dSv_restart_c { +public: + /* 8005D4A4 */ void setRoom(cXyz const&, s16, s8); + /* 8005D4C8 */ void setRestartOption(s8); + /* 8005D584 */ void setRestartOption(s8, cXyz*, s16, s8); + + /* 0x00 */ s8 mRestartRoom; + /* 0x01 */ u8 field_0x1; + /* 0x02 */ s8 mRoomNo; + /* 0x04 */ s16 field_0x4; + /* 0x06 */ s16 mRoomAngleY; + /* 0x08 */ cXyz mRoomPos; + /* 0x14 */ u16 mStartCode; + /* 0x16 */ s16 mRestartAngle; + /* 0x18 */ cXyz mRestartPos; + /* 0x24 */ u32 mRestartParam; +}; // Size: 0x28 + +class dSv_turnRestart_c { +public: + /* 8005D5B4 */ void set(cXyz const&, s16, s8, u32, cXyz const&, s16, int); + + /* 0x00 */ cXyz mPosition; + /* 0x0C */ u32 mParam; + /* 0x10 */ s16 mAngleY; + /* 0x12 */ s8 mRoomNo; + /* 0x13 */ u8 field_0x13; + /* 0x14 */ u8 field_0x14[0x24 - 0x14]; + /* 0x24 */ cXyz field_0x24; + /* 0x30 */ s16 field_0x30; + /* 0x34 */ int field_0x34; +}; // Size: 0x38 + +class dSv_save_c { +public: + /* 8005D860 */ void init(); + + dSv_player_c& getPlayer() { return mPlayer; } + + dSv_memory_c& getSave(int i_stageNo) { return mMemory[i_stageNo]; } + void putSave(int i_stageNo, dSv_memory_c i_mem) { mMemory[i_stageNo] = i_mem; } + + const static int STAGE_MAX = 16; + + /* 0x000 */ dSv_player_c mPlayer; + /* 0x380 */ dSv_memory_c mMemory[STAGE_MAX]; + /* 0x5C0 */ dSv_ocean_c mOcean; + /* 0x624 */ dSv_event_c mEvent; +}; // Size: 0x724 + +class dSv_info_c { +public: + /* 8005D604 */ void init(); + /* 8005D660 */ void reinit(); + /* 8005D8C8 */ void getSave(int); + /* 8005D988 */ void putSave(int); + /* 8005DA70 */ void initZone(); + /* 8005DAC8 */ int createZone(int); + /* 8005DB24 */ void onSwitch(int, int); + /* 8005DCEC */ void offSwitch(int, int); + /* 8005DE98 */ BOOL isSwitch(int, int); + /* 8005DFE0 */ BOOL revSwitch(int, int); + /* 8005E190 */ void onItem(int, int); + /* 8005E324 */ BOOL isItem(int, int); + /* 8005E4BC */ void onActor(int, int); + /* 8005E5F0 */ BOOL isActor(int, int); + /* 8005E780 */ void memory_to_card(char*, int); + /* 8005EA24 */ void card_to_memory(char*, int); + /* 8005ED00 */ int initdata_to_card(char*, int); + + dSv_player_c& getPlayer() { return mSavedata.getPlayer(); } + + static const int MEMORY_SWITCH = 0x80; + static const int DAN_SWITCH = 0x40; + static const int ZONE_SWITCH = 0x30; + + static const int MEMORY_ITEM = 0x40; + static const int ZONE_ITEM = 0x10; + + static const int ZONE_MAX = 0x20; + + /* 0x0000 */ dSv_save_c mSavedata; + /* 0x0724 */ u8 unk_0x724[0x50]; + /* 0x0778 */ dSv_memory_c mMemory; + /* 0x079C */ dSv_danBit_c mDan; + /* 0x07A8 */ dSv_zone_c mZone[ZONE_MAX]; + /* 0x1128 */ dSv_restart_c mRestart; + /* 0x1150 */ f32 field_0x1150; + /* 0x1154 */ int field_0x1154; + /* 0x1158 */ dSv_event_c mTmp; + /* 0x1258 */ dSv_turnRestart_c mTurnRestart; + /* 0x1290 */ u8 field_0x1290; + /* 0x1291 */ u8 field_0x1291; + /* 0x1292 */ u8 field_0x1292; + /* 0x1298 */ s64 field_0x1298; +}; // Size: 0x12A0 + +STATIC_ASSERT(sizeof(dSv_info_c) == 0x12A0); + +#endif /* D_SAVE_D_SAVE_H */ diff --git a/include/d/d_stage.h b/include/d/d_stage.h new file mode 100644 index 000000000..c185efbfe --- /dev/null +++ b/include/d/d_stage.h @@ -0,0 +1,476 @@ +#ifndef D_D_STAGE_H +#define D_D_STAGE_H + +#include "global.h" +#include "d/d_kankyo.h" +#include "SSystem/SComponent/c_lib.h" + +class JKRExpHeap; + +struct stage_vrbox_info_class {}; + +class stage_tresure_class {}; + +struct stage_stag_info_class {}; + +struct stage_scls_info_class {}; + +struct stage_scls_info_dummy_class {}; + +struct stage_lightvec_info_class {}; + +struct stage_pselect_info_class {}; + +struct stage_plight_info_class {}; + +struct stage_palet_info_class {}; + +struct stage_map_info_class {}; + +struct stage_map_info_dummy_class {}; + +struct stage_envr_info_class {}; + +struct stage_camera_class {}; + +struct stage_arrow_class {}; + +class stage_actor_data_class {}; + +class stage_actor_class {}; + +struct stage_tgsc_data_class : public stage_actor_data_class {}; + +class stage_tgsc_class {}; + +struct roomRead_data_class {}; + +struct roomRead_class {}; + +struct dStage_MemoryMap_c {}; + +struct dStage_dPath_c {}; + +class dStage_Multi_c {}; + +struct dStage_SoundInfo_c {}; + +class dStage_FileList_dt_c {}; + +struct dStage_dPnt_c {}; + +struct dStage_FloorInfo_c {}; + +struct dStage_Lbnk_c {}; + +struct dStage_MemoryConfig_c {}; + +struct dStage_DMap_c {}; + +struct dStage_EventInfo_c {}; + +struct dStage_Ship_c {}; + +class dStage_dt_c { +public: + dStage_dt_c() {} + + /* vt[ 2] */ virtual void init(void) = 0; + /* vt[ 3] */ virtual s8 getRoomNo() = 0; + /* vt[ 4] */ virtual void setCamera(stage_camera_class*) = 0; + /* vt[ 5] */ virtual stage_camera_class* getCamera(void) const = 0; + /* vt[ 6] */ virtual void setArrow(stage_arrow_class*) = 0; + /* vt[ 7] */ virtual stage_arrow_class* getArrow(void) const = 0; + /* vt[ 8] */ virtual void setPlayer(stage_actor_class*) = 0; + /* vt[ 9] */ virtual stage_actor_class* getPlayer(void) const = 0; + /* vt[10] */ virtual void setPlayerNum(u16) = 0; + /* vt[11] */ virtual u16 getPlayerNum(void) const = 0; + /* vt[12] */ virtual void setRoom(roomRead_class*) = 0; + /* vt[13] */ virtual roomRead_class* getRoom(void) const = 0; + /* vt[14] */ virtual void setMapInfo(stage_map_info_class*) = 0; + /* vt[15] */ virtual stage_map_info_class* getMapInfo(void) const = 0; + /* vt[16] */ virtual stage_map_info_class* getMapInfo2(int) const = 0; + /* vt[17] */ virtual void setMapInfoBase(stage_map_info_dummy_class*) = 0; + /* vt[18] */ virtual stage_map_info_dummy_class* getMapInfoBase(void) const = 0; + /* vt[19] */ virtual void setPaletInfo(stage_palet_info_class*) = 0; + /* vt[20] */ virtual stage_palet_info_class* getPaletInfo(void) const = 0; + /* vt[21] */ virtual void setPselectInfo(stage_pselect_info_class*) = 0; + /* vt[22] */ virtual stage_pselect_info_class* getPselectInfo(void) const = 0; + /* vt[23] */ virtual void setEnvrInfo(stage_envr_info_class*) = 0; + /* vt[24] */ virtual stage_envr_info_class* getEnvrInfo(void) const = 0; + /* vt[25] */ virtual void setVrboxInfo(stage_vrbox_info_class*) = 0; + /* vt[26] */ virtual stage_vrbox_info_class* getVrboxInfo(void) const = 0; + /* vt[27] */ virtual void setPlightInfo(stage_plight_info_class*) = 0; + /* vt[28] */ virtual stage_plight_info_class* getPlightInfo(void) const = 0; + /* vt[29] */ virtual void setPaletNumInfo(int) = 0; + /* vt[30] */ virtual int getPaletNumInfo(void) const = 0; + /* vt[31] */ virtual void setPselectNumInfo(int) = 0; + /* vt[32] */ virtual int getPselectNumInfo(void) const = 0; + /* vt[33] */ virtual void setEnvrNumInfo(int) = 0; + /* vt[34] */ virtual int getEnvrNumInfo(void) const = 0; + /* vt[35] */ virtual void setVrboxNumInfo(int) = 0; + /* vt[36] */ virtual int getVrboxNumInfo(void) const = 0; + /* vt[37] */ virtual void setPlightNumInfo(int) = 0; + /* vt[38] */ virtual int getPlightNumInfo(void) const = 0; + /* vt[39] */ virtual void setLightVecInfo(stage_lightvec_info_class*) = 0; + /* vt[40] */ virtual stage_lightvec_info_class* getLightVecInfo(void) const = 0; + /* vt[41] */ virtual void setLightVecInfoNum(int) = 0; + /* vt[42] */ virtual int getLightVecInfoNum(void) const = 0; + /* vt[43] */ virtual void setStagInfo(stage_stag_info_class*) = 0; + /* vt[44] */ virtual stage_stag_info_class* getStagInfo(void) const = 0; + /* vt[45] */ virtual void setSclsInfo(stage_scls_info_dummy_class*) = 0; + /* vt[46] */ virtual stage_scls_info_dummy_class* getSclsInfo(void) const = 0; + /* vt[47] */ virtual void setPntInfo(dStage_dPnt_c*) = 0; + /* vt[48] */ virtual dStage_dPnt_c* getPntInf(void) const = 0; + /* vt[49] */ virtual void setPathInfo(dStage_dPath_c*) = 0; + /* vt[50] */ virtual dStage_dPath_c* getPathInf(void) const = 0; + /* vt[51] */ virtual void setPnt2Info(dStage_dPnt_c*) = 0; + /* vt[52] */ virtual dStage_dPnt_c* getPnt2Inf(void) const = 0; + /* vt[53] */ virtual void setPath2Info(dStage_dPath_c*) = 0; + /* vt[54] */ virtual dStage_dPath_c* getPath2Inf(void) const = 0; + /* vt[55] */ virtual void setSoundInf(dStage_SoundInfo_c*) = 0; + /* vt[56] */ virtual dStage_SoundInfo_c* getSoundInf(void) const = 0; + /* vt[57] */ virtual void setEventInfo(dStage_EventInfo_c*) = 0; + /* vt[58] */ virtual dStage_EventInfo_c* getEventInfo(void) const = 0; + /* vt[59] */ virtual void setFileListInfo(dStage_FileList_dt_c*) = 0; + /* vt[60] */ virtual dStage_FileList_dt_c* getFileListInfo(void) const = 0; + /* vt[61] */ virtual void setFloorInfo(dStage_FloorInfo_c*) = 0; + /* vt[62] */ virtual dStage_FloorInfo_c* getFloorInfo(void) const = 0; + /* vt[63] */ virtual void setMemoryConfig(dStage_MemoryConfig_c*) = 0; + /* vt[64] */ virtual dStage_MemoryConfig_c* getMemoryConfig(void) const = 0; + /* vt[65] */ virtual void setMemoryMap(dStage_MemoryMap_c*) = 0; + /* vt[66] */ virtual dStage_MemoryMap_c* getMemoryMap(void) const = 0; + /* vt[67] */ virtual void setShip(dStage_Ship_c*) = 0; + /* vt[68] */ virtual dStage_Ship_c* getShip() const = 0; + /* vt[69] */ virtual void setMulti(dStage_Multi_c*) = 0; + /* vt[70] */ virtual dStage_Multi_c* getMulti(void) const = 0; + /* vt[71] */ virtual void setLbnk(dStage_Lbnk_c*) = 0; + /* vt[72] */ virtual dStage_Lbnk_c* getLbnk(void) const = 0; + /* vt[73] */ virtual void setTresure(stage_tresure_class*) = 0; + /* vt[74] */ virtual stage_tresure_class* getTresure(void) const = 0; + /* vt[75] */ virtual void setDMap(dStage_DMap_c*) = 0; + /* vt[76] */ virtual dStage_DMap_c* getDMap(void) const = 0; + /* vt[77] */ virtual void setDrTg(stage_tgsc_class*) = 0; + /* vt[78] */ virtual stage_tgsc_class* getDrTg(void) const = 0; +}; + +class dStage_stageDt_c : public dStage_dt_c { +public: + dStage_stageDt_c() {} + + /* vt[ 2] */ virtual void init(void); + /* vt[ 3] */ virtual s8 getRoomNo(); + /* vt[ 4] */ virtual void setCamera(stage_camera_class*); + /* vt[ 5] */ virtual stage_camera_class* getCamera(void) const; + /* vt[ 6] */ virtual void setArrow(stage_arrow_class*); + /* vt[ 7] */ virtual stage_arrow_class* getArrow(void) const; + /* vt[ 8] */ virtual void setPlayer(stage_actor_class*); + /* vt[ 9] */ virtual stage_actor_class* getPlayer(void) const; + /* vt[10] */ virtual void setPlayerNum(u16); + /* vt[11] */ virtual u16 getPlayerNum(void) const; + /* vt[12] */ virtual void setRoom(roomRead_class*); + /* vt[13] */ virtual roomRead_class* getRoom(void) const; + /* vt[14] */ virtual void setMapInfo(stage_map_info_class*); + /* vt[15] */ virtual stage_map_info_class* getMapInfo(void) const; + /* vt[16] */ virtual stage_map_info_class* getMapInfo2(int) const; + /* vt[17] */ virtual void setMapInfoBase(stage_map_info_dummy_class*); + /* vt[18] */ virtual stage_map_info_dummy_class* getMapInfoBase(void) const; + /* vt[19] */ virtual void setPaletInfo(stage_palet_info_class*); + /* vt[20] */ virtual stage_palet_info_class* getPaletInfo(void) const; + /* vt[21] */ virtual void setPselectInfo(stage_pselect_info_class*); + /* vt[22] */ virtual stage_pselect_info_class* getPselectInfo(void) const; + /* vt[23] */ virtual void setEnvrInfo(stage_envr_info_class*); + /* vt[24] */ virtual stage_envr_info_class* getEnvrInfo(void) const; + /* vt[25] */ virtual void setVrboxInfo(stage_vrbox_info_class*); + /* vt[26] */ virtual stage_vrbox_info_class* getVrboxInfo(void) const; + /* vt[27] */ virtual void setPlightInfo(stage_plight_info_class*); + /* vt[28] */ virtual stage_plight_info_class* getPlightInfo(void) const; + /* vt[29] */ virtual void setPaletNumInfo(int); + /* vt[30] */ virtual int getPaletNumInfo(void) const; + /* vt[31] */ virtual void setPselectNumInfo(int); + /* vt[32] */ virtual int getPselectNumInfo(void) const; + /* vt[33] */ virtual void setEnvrNumInfo(int); + /* vt[34] */ virtual int getEnvrNumInfo(void) const; + /* vt[35] */ virtual void setVrboxNumInfo(int); + /* vt[36] */ virtual int getVrboxNumInfo(void) const; + /* vt[37] */ virtual void setPlightNumInfo(int); + /* vt[38] */ virtual int getPlightNumInfo(void) const; + /* vt[39] */ virtual void setLightVecInfo(stage_lightvec_info_class*); + /* vt[40] */ virtual stage_lightvec_info_class* getLightVecInfo(void) const; + /* vt[41] */ virtual void setLightVecInfoNum(int); + /* vt[42] */ virtual int getLightVecInfoNum(void) const; + /* vt[43] */ virtual void setStagInfo(stage_stag_info_class*); + /* vt[44] */ virtual stage_stag_info_class* getStagInfo(void) const; + /* vt[45] */ virtual void setSclsInfo(stage_scls_info_dummy_class*); + /* vt[46] */ virtual stage_scls_info_dummy_class* getSclsInfo(void) const; + /* vt[47] */ virtual void setPntInfo(dStage_dPnt_c*); + /* vt[48] */ virtual dStage_dPnt_c* getPntInf(void) const; + /* vt[49] */ virtual void setPathInfo(dStage_dPath_c*); + /* vt[50] */ virtual dStage_dPath_c* getPathInf(void) const; + /* vt[51] */ virtual void setPnt2Info(dStage_dPnt_c*); + /* vt[52] */ virtual dStage_dPnt_c* getPnt2Inf(void) const; + /* vt[53] */ virtual void setPath2Info(dStage_dPath_c*); + /* vt[54] */ virtual dStage_dPath_c* getPath2Inf(void) const; + /* vt[55] */ virtual void setSoundInf(dStage_SoundInfo_c*); + /* vt[56] */ virtual dStage_SoundInfo_c* getSoundInf(void) const; + /* vt[57] */ virtual void setEventInfo(dStage_EventInfo_c*); + /* vt[58] */ virtual dStage_EventInfo_c* getEventInfo(void) const; + /* vt[59] */ virtual void setFileListInfo(dStage_FileList_dt_c*); + /* vt[60] */ virtual dStage_FileList_dt_c* getFileListInfo(void) const; + /* vt[61] */ virtual void setFloorInfo(dStage_FloorInfo_c*); + /* vt[62] */ virtual dStage_FloorInfo_c* getFloorInfo(void) const; + /* vt[63] */ virtual void setMemoryConfig(dStage_MemoryConfig_c*); + /* vt[64] */ virtual dStage_MemoryConfig_c* getMemoryConfig(void) const; + /* vt[65] */ virtual void setMemoryMap(dStage_MemoryMap_c*); + /* vt[66] */ virtual dStage_MemoryMap_c* getMemoryMap(void) const; + /* vt[67] */ virtual void setShip(dStage_Ship_c*); + /* vt[68] */ virtual dStage_Ship_c* getShip() const; + /* vt[69] */ virtual void setMulti(dStage_Multi_c*); + /* vt[70] */ virtual dStage_Multi_c* getMulti(void) const; + /* vt[71] */ virtual void setLbnk(dStage_Lbnk_c*); + /* vt[72] */ virtual dStage_Lbnk_c* getLbnk(void) const; + /* vt[73] */ virtual void setTresure(stage_tresure_class*); + /* vt[74] */ virtual stage_tresure_class* getTresure(void) const; + /* vt[75] */ virtual void setDMap(dStage_DMap_c*); + /* vt[76] */ virtual dStage_DMap_c* getDMap(void) const; + /* vt[77] */ virtual void setDrTg(stage_tgsc_class*); + /* vt[78] */ virtual stage_tgsc_class* getDrTg(void) const; + +public: + /* 0x04 */ stage_camera_class* mpCamera; + /* 0x08 */ stage_arrow_class* mpArrow; + /* 0x0C */ void* field_0x0c; + /* 0x10 */ roomRead_class* mpRoomReads; + /* 0x14 */ stage_map_info_class* mpMapInfo; + /* 0x18 */ stage_map_info_dummy_class* mpMapInfoBase; + /* 0x1C */ stage_palet_info_class* mpPaletInfo; + /* 0x20 */ stage_pselect_info_class* mpPselectInfo; + /* 0x24 */ stage_envr_info_class* mpEnvrInfo; + /* 0x28 */ stage_vrbox_info_class* mpVrboxInfo; + /* 0x2C */ stage_plight_info_class* mpPlightInfo; + /* 0x30 */ void* field_0x30; + /* 0x34 */ void* field_0x34; + /* 0x38 */ void* field_0x38; + /* 0x3C */ int field_0x3c; + /* 0x40 */ int mPlightInfoNum; + /* 0x44 */ void* field_0x44; + /* 0x48 */ stage_stag_info_class* mpStagInfo; + /* 0x4C */ stage_scls_info_dummy_class* mpScls; + /* 0x50 */ dStage_dPnt_c* mpPnt; + /* 0x54 */ dStage_dPath_c* mpPath; + /* 0x58 */ dStage_dPnt_c* mpPnt2; + /* 0x5C */ dStage_dPath_c* mpPath2; + /* 0x60 */ void* field_0x60; + /* 0x64 */ dStage_EventInfo_c* mpEventInfo; + /* 0x68 */ void* field_0x68; + /* 0x6C */ void* field_0x6c; + /* 0x70 */ void* field_0x70; + /* 0x74 */ dStage_Multi_c* mpMulti; + /* 0x78 */ void* field_0x78; + /* 0x7C */ void* field_0x7c; + /* 0x80 */ void* field_0x80; +}; + +class dStage_roomDt_c : public dStage_dt_c { +public: + /* vt[ 2] */ virtual void init(void); + /* vt[ 3] */ virtual s8 getRoomNo(); + /* vt[ 4] */ virtual void setCamera(stage_camera_class*); + /* vt[ 5] */ virtual stage_camera_class* getCamera(void) const; + /* vt[ 6] */ virtual void setArrow(stage_arrow_class*); + /* vt[ 7] */ virtual stage_arrow_class* getArrow(void) const; + /* vt[ 8] */ virtual void setPlayer(stage_actor_class*); + /* vt[ 9] */ virtual stage_actor_class* getPlayer(void) const; + /* vt[10] */ virtual void setPlayerNum(u16); + /* vt[11] */ virtual u16 getPlayerNum(void) const; + /* vt[12] */ virtual void setRoom(roomRead_class*); + /* vt[13] */ virtual roomRead_class* getRoom(void) const; + /* vt[14] */ virtual void setMapInfo(stage_map_info_class*); + /* vt[15] */ virtual stage_map_info_class* getMapInfo(void) const; + /* vt[16] */ virtual stage_map_info_class* getMapInfo2(int) const; + /* vt[17] */ virtual void setMapInfoBase(stage_map_info_dummy_class*); + /* vt[18] */ virtual stage_map_info_dummy_class* getMapInfoBase(void) const; + /* vt[19] */ virtual void setPaletInfo(stage_palet_info_class*); + /* vt[20] */ virtual stage_palet_info_class* getPaletInfo(void) const; + /* vt[21] */ virtual void setPselectInfo(stage_pselect_info_class*); + /* vt[22] */ virtual stage_pselect_info_class* getPselectInfo(void) const; + /* vt[23] */ virtual void setEnvrInfo(stage_envr_info_class*); + /* vt[24] */ virtual stage_envr_info_class* getEnvrInfo(void) const; + /* vt[25] */ virtual void setVrboxInfo(stage_vrbox_info_class*); + /* vt[26] */ virtual stage_vrbox_info_class* getVrboxInfo(void) const; + /* vt[27] */ virtual void setPlightInfo(stage_plight_info_class*); + /* vt[28] */ virtual stage_plight_info_class* getPlightInfo(void) const; + /* vt[29] */ virtual void setPaletNumInfo(int); + /* vt[30] */ virtual int getPaletNumInfo(void) const; + /* vt[31] */ virtual void setPselectNumInfo(int); + /* vt[32] */ virtual int getPselectNumInfo(void) const; + /* vt[33] */ virtual void setEnvrNumInfo(int); + /* vt[34] */ virtual int getEnvrNumInfo(void) const; + /* vt[35] */ virtual void setVrboxNumInfo(int); + /* vt[36] */ virtual int getVrboxNumInfo(void) const; + /* vt[37] */ virtual void setPlightNumInfo(int); + /* vt[38] */ virtual int getPlightNumInfo(void) const; + /* vt[39] */ virtual void setLightVecInfo(stage_lightvec_info_class*); + /* vt[40] */ virtual stage_lightvec_info_class* getLightVecInfo(void) const; + /* vt[41] */ virtual void setLightVecInfoNum(int); + /* vt[42] */ virtual int getLightVecInfoNum(void) const; + /* vt[43] */ virtual void setStagInfo(stage_stag_info_class*); + /* vt[44] */ virtual stage_stag_info_class* getStagInfo(void) const; + /* vt[45] */ virtual void setSclsInfo(stage_scls_info_dummy_class*); + /* vt[46] */ virtual stage_scls_info_dummy_class* getSclsInfo(void) const; + /* vt[47] */ virtual void setPntInfo(dStage_dPnt_c*); + /* vt[48] */ virtual dStage_dPnt_c* getPntInf(void) const; + /* vt[49] */ virtual void setPathInfo(dStage_dPath_c*); + /* vt[50] */ virtual dStage_dPath_c* getPathInf(void) const; + /* vt[51] */ virtual void setPnt2Info(dStage_dPnt_c*); + /* vt[52] */ virtual dStage_dPnt_c* getPnt2Inf(void) const; + /* vt[53] */ virtual void setPath2Info(dStage_dPath_c*); + /* vt[54] */ virtual dStage_dPath_c* getPath2Inf(void) const; + /* vt[55] */ virtual void setSoundInf(dStage_SoundInfo_c*); + /* vt[56] */ virtual dStage_SoundInfo_c* getSoundInf(void) const; + /* vt[57] */ virtual void setEventInfo(dStage_EventInfo_c*); + /* vt[58] */ virtual dStage_EventInfo_c* getEventInfo(void) const; + /* vt[59] */ virtual void setFileListInfo(dStage_FileList_dt_c*); + /* vt[60] */ virtual dStage_FileList_dt_c* getFileListInfo(void) const; + /* vt[61] */ virtual void setFloorInfo(dStage_FloorInfo_c*); + /* vt[62] */ virtual dStage_FloorInfo_c* getFloorInfo(void) const; + /* vt[63] */ virtual void setMemoryConfig(dStage_MemoryConfig_c*); + /* vt[64] */ virtual dStage_MemoryConfig_c* getMemoryConfig(void) const; + /* vt[65] */ virtual void setMemoryMap(dStage_MemoryMap_c*); + /* vt[66] */ virtual dStage_MemoryMap_c* getMemoryMap(void) const; + /* vt[67] */ virtual void setShip(dStage_Ship_c*); + /* vt[68] */ virtual dStage_Ship_c* getShip() const; + /* vt[69] */ virtual void setMulti(dStage_Multi_c*); + /* vt[70] */ virtual dStage_Multi_c* getMulti(void) const; + /* vt[71] */ virtual void setLbnk(dStage_Lbnk_c*); + /* vt[72] */ virtual dStage_Lbnk_c* getLbnk(void) const; + /* vt[73] */ virtual void setTresure(stage_tresure_class*); + /* vt[74] */ virtual stage_tresure_class* getTresure(void) const; + /* vt[75] */ virtual void setDMap(dStage_DMap_c*); + /* vt[76] */ virtual dStage_DMap_c* getDMap(void) const; + /* vt[77] */ virtual void setDrTg(stage_tgsc_class*); + /* vt[78] */ virtual stage_tgsc_class* getDrTg(void) const; + +public: + /* 0x04 */ stage_lightvec_info_class* mpLightVecInfo; + /* 0x08 */ int mLightVecInfoNum; + /* 0x0C */ stage_map_info_class* mpMapInfo; + /* 0x10 */ stage_map_info_dummy_class* mpMapInfoBase; + /* 0x14 */ stage_vrbox_info_class* mpVrbox; + /* 0x18 */ dStage_FileList_dt_c* mpFileList; + /* 0x1C */ dStage_Ship_c* mpShip; + /* 0x20 */ stage_actor_class* mpPlayer; + /* 0x24 */ dStage_dPnt_c* mpPoint2; + /* 0x28 */ dStage_dPath_c* mpPath2; + /* 0x2C */ stage_camera_class* mpCamera; + /* 0x30 */ stage_arrow_class* mpArrow; + /* 0x34 */ dStage_SoundInfo_c* mpSound; + /* 0x38 */ stage_scls_info_dummy_class* mpScls; + /* 0x3C */ dStage_Lbnk_c* mpLbnk; + /* 0x40 */ stage_tresure_class* mpTresure; + /* 0x44 */ stage_tgsc_class* mpDrTg; + /* 0x48 */ dStage_FloorInfo_c* mpFloor; + /* 0x4C */ u8 mRoomNo; + /* 0x4D */ u8 field_0x4D[0x4E - 0x4D]; + /* 0x4E */ short mPlayerNum; + /* 0x50 */ int mVrboxNum; +}; + +class dBgW_base; +class dStage_roomStatus_c { +public: + /* 0x000 */ dStage_roomDt_c mRoomDt; + /* 0x054 */ dKy_tevstr_c mTevStr; + /* 0x104 */ u8 mFlags; + /* 0x105 */ bool mDraw; + /* 0x106 */ s8 mZoneCount; + /* 0x107 */ s8 mZoneNo; + /* 0x108 */ s8 mMemBlockID; + /* 0x10C */ int mProcID; + /* 0x110 */ dBgW_base* mpBgW; + + int getZoneNo() const { return mZoneNo; } + ~dStage_roomStatus_c() {} + dStage_roomStatus_c() {} +}; // Size: 0x114 + +STATIC_ASSERT(sizeof(dStage_roomStatus_c) == 0x114); + +class dStage_roomControl_c { +public: + dStage_roomControl_c() {} + static int getZoneNo(int); + + static s8 getStayNo() { return mStayNo; } + static s8 getMemoryBlockID(int i_roomNo) { return mStatus[i_roomNo].mMemBlockID; } + dKy_tevstr_c* getTevStr(int i_roomNo) { return &mStatus[i_roomNo].mTevStr; } + void setStatusFlag(int i_roomNo, u8 flag) { mStatus[i_roomNo].mFlags = flag; } + static void onStatusDraw(int i_roomNo) { mStatus[i_roomNo].mDraw = true; } + static void setProcID(u32 id) { mProcID = id; } + static u32 getProcID() { return mProcID; } + static void setStatusProcID(int i_roomNo, unsigned int i_id) { mStatus[i_roomNo].mProcID = i_id; } + static int getStatusProcID(int i_roomNo) { return mStatus[i_roomNo].mProcID; } + + static void setMemoryBlockID(int i_roomNo, int i_blockID) { + mStatus[i_roomNo].mMemBlockID = i_blockID; + } + + static void setBgW(int param_0, dBgW_base* i_bgw) { + mStatus[param_0].mpBgW = i_bgw; + } + + BOOL checkStatusFlag(int i_roomNo, u8 flag) const { + return cLib_checkBit(mStatus[i_roomNo].mFlags, flag); + } + + void offStatusFlag(int i_roomNo, u8 flag) { + return cLib_offBit(mStatus[i_roomNo].mFlags, flag); + } + + void onStatusFlag(int i_roomNo, u8 flag) { + return cLib_onBit(mStatus[i_roomNo].mFlags, flag); + } + + static JKRExpHeap* mMemoryBlock[101]; + static dStage_roomStatus_c mStatus[64]; + static u32 mProcID; + static s8 mStayNo; + static s8 mOldStayNo; + static s8 m_time_pass; + +private: + /* 0x0 */ u8 field_0x0[4]; +}; + +class dStage_startStage_c { +public: + void set(const char*, s8, s16, s8); + const char* getName() const { return mName; } + s16 getPoint() const { return mPoint; } + s8 getRoomNo() const { return mRoomNo; } + s8 getLayer() const { return mLayer; } + void setLayer(s8 layer) { mLayer = layer; } + +private: + /* 0x0 */ char mName[8]; + /* 0x8 */ s16 mPoint; + /* 0xA */ s8 mRoomNo; + /* 0xB */ s8 mLayer; +}; + +class dStage_nextStage_c : public dStage_startStage_c { +public: + dStage_nextStage_c() { + mEnable = 0; // TODO: maybe wrong + } + void set(const char*, s8, s16, s8, s8, u8); + void offEnable() { mEnable = 0; } + s8 isEnable() const { return mEnable; } + s8 getWipe() const { return mWipe; } + +private: + /* 0xC */ s8 mEnable; + /* 0xD */ s8 mWipe; +}; // Size: 0xE + +#endif /* D_D_STAGE_H */ \ No newline at end of file diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index 6c961940e..53b2032cb 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -3,42 +3,165 @@ // Translation Unit: d_save.cpp // -#include "d_save.h" -#include "dolphin/types.h" +#include "d/d_save.h" +#include "d/d_com_inf_game.h" +#include "JSystem/JUtility/JUTAssert.h" +#include "MSL_C/string.h" +#include "SSystem/SComponent/c_lib.h" +#include "SSystem/SComponent/c_math.h" +#include "MSL_C/stdio.h" + +extern void setInitEventBit(); + +struct daNpc_Sarace_c { + static int ship_race_rupee; + static int ship_race_result; +}; /* 800589A8-80058B54 .text init__21dSv_player_status_a_cFv */ +// Nonmatching - bunch of issues, probably need to setup more inlines void dSv_player_status_a_c::init() { - /* Nonmatching */ + mMaxLife = 12; + mLife = 12; + field_0x8 = 0; + + for (int i = 0; i < 5; i++) { + int item = 0xFF; + + mSelectItem[i] = 0xFF; + + u32 item_idx = dComIfGs_getSelectEquip(i); + if (item_idx != 0xFF) { + switch (item_idx) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + item = dComIfGs_getItem(item_idx); + break; + case 21: + case 22: + case 23: + break; + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + item = g_dComIfG_gameInfo.info.getPlayer().mGetItem.mItemFlags[item_idx + 13]; + break; + case 32: + case 33: + case 34: + case 35: + break; + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + item = g_dComIfG_gameInfo.info.getPlayer().mGetItem.mItemFlags[item_idx + 9]; + break; + case 44: + case 45: + case 46: + case 47: + break; + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + item = g_dComIfG_gameInfo.info.getPlayer().mGetItem.mItemFlags[item_idx + 5]; + break; + } + + g_dComIfG_gameInfo.play.mEquippedItems[i] = item; + } else { + g_dComIfG_gameInfo.play.mEquippedItems[i] = NO_ITEM; + } + } + + for (int i = 0; i < 4; i++) { + mSelectEquip[i] = 0xFF; + } + + mRupee = 0; + mWalletSize = 0; + mMaxMagic = 0; + mMagic = 0; + field_0x15 = 0; + field_0x6 = 0; + field_0x16 = 0; } /* 80058B54-80058B84 .text init__21dSv_player_status_b_cFv */ void dSv_player_status_b_c::init() { - /* Nonmatching */ + mTactWindAngleX = -1; + mTactWindAngleY = -1; + mTime = 165.0f; + mDate = 0; + mDateIPL = 0; + field_0x8 = 0.0f; } /* 80058B84-80058BC8 .text init__25dSv_player_return_place_cFv */ void dSv_player_return_place_c::init() { - /* Nonmatching */ + strcpy(mName, "sea"); + mRoomNo = 44; + mPlayerStatus = 206; } /* 80058BC8-80058C60 .text set__25dSv_player_return_place_cFPCcScUc */ -void dSv_player_return_place_c::set(const char*, signed char, unsigned char) { - /* Nonmatching */ +void dSv_player_return_place_c::set(const char* i_name, s8 i_roomNo, u8 i_status) { + JUT_ASSERT(179, strlen(i_name) <= 7); + + strcpy(mName, i_name); + mRoomNo = i_roomNo; + mPlayerStatus = i_status; } /* 80058C60-80058C7C .text init__17dSv_player_item_cFv */ void dSv_player_item_c::init() { - /* Nonmatching */ + for (int i = 0; i < 21; i++) { + mItems[i] = 0xFF; + } } /* 80058C7C-80058E1C .text setBottleItemIn__17dSv_player_item_cFUcUc */ -void dSv_player_item_c::setBottleItemIn(unsigned char, unsigned char) { +void dSv_player_item_c::setBottleItemIn(u8, u8) { /* Nonmatching */ } /* 80058E1C-80058E44 .text setEmptyBottleItemIn__17dSv_player_item_cFUc */ -void dSv_player_item_c::setEmptyBottleItemIn(unsigned char) { - /* Nonmatching */ +void dSv_player_item_c::setEmptyBottleItemIn(u8 param_0) { + setBottleItemIn(EMPTY_BOTTLE, param_0); } /* 80058E44-80058F74 .text setEmptyBottle__17dSv_player_item_cFv */ @@ -47,67 +170,190 @@ void dSv_player_item_c::setEmptyBottle() { } /* 80058F74-8005918C .text setEquipBottleItemIn__17dSv_player_item_cFUcUc */ -void dSv_player_item_c::setEquipBottleItemIn(unsigned char, unsigned char) { +void dSv_player_item_c::setEquipBottleItemIn(u8, u8) { /* Nonmatching */ } /* 8005918C-800591B0 .text setEquipBottleItemEmpty__17dSv_player_item_cFUc */ -void dSv_player_item_c::setEquipBottleItemEmpty(unsigned char) { - /* Nonmatching */ +void dSv_player_item_c::setEquipBottleItemEmpty(u8 param_0) { + setEquipBottleItemIn(param_0, EMPTY_BOTTLE); } /* 800591B0-80059408 .text setEquipBottleItemIn__17dSv_player_item_cFUc */ -void dSv_player_item_c::setEquipBottleItemIn(unsigned char) { +void dSv_player_item_c::setEquipBottleItemIn(u8) { /* Nonmatching */ } /* 80059408-8005942C .text setEquipBottleItemEmpty__17dSv_player_item_cFv */ void dSv_player_item_c::setEquipBottleItemEmpty() { - /* Nonmatching */ + setEquipBottleItemIn(EMPTY_BOTTLE); } /* 8005942C-8005946C .text checkBottle__17dSv_player_item_cFUc */ -void dSv_player_item_c::checkBottle(unsigned char) { - /* Nonmatching */ +u8 dSv_player_item_c::checkBottle(u8 i_itemNo) { + u8 ret = 0; + + for (int i = 0; i < 4; i++) { + if (i_itemNo == mItems[i + 14]) { + ret++; + } + } + + return ret; } /* 8005946C-800594A8 .text checkEmptyBottle__17dSv_player_item_cFv */ -void dSv_player_item_c::checkEmptyBottle() { - /* Nonmatching */ +u8 dSv_player_item_c::checkEmptyBottle() { + u8 ret = 0; + + for (int i = 0; i < 4; i++) { + if (mItems[i + 14] == EMPTY_BOTTLE) { + ret++; + } + } + + return ret; } /* 800594A8-800594C4 .text init__21dSv_player_get_item_cFv */ void dSv_player_get_item_c::init() { - /* Nonmatching */ + for (int i = 0; i < 21; i++) { + mItemFlags[i] = 0; + } } /* 800594C4-8005955C .text onItem__21dSv_player_get_item_cFiUc */ -void dSv_player_get_item_c::onItem(int, unsigned char) { - /* Nonmatching */ +void dSv_player_get_item_c::onItem(int i_field, u8 i_item) { + JUT_ASSERT(399, 0 <= i_item && i_item < 8); + + mItemFlags[i_field] |= (u8)(1 << i_item); } /* 8005955C-800595F8 .text isItem__21dSv_player_get_item_cFiUc */ -void dSv_player_get_item_c::isItem(int, unsigned char) { - /* Nonmatching */ +bool dSv_player_get_item_c::isItem(int i_field, u8 i_item) { + JUT_ASSERT(429, 0 <= i_item && i_item < 8); + + return mItemFlags[i_field] & (u8)(1 << i_item) ? true : false; } /* 800595F8-80059740 .text onBottleItem__21dSv_player_get_item_cFUc */ -void dSv_player_get_item_c::onBottleItem(unsigned char) { - /* Nonmatching */ +void dSv_player_get_item_c::onBottleItem(u8 i_item) { + switch (i_item) { + case EMPTY_BSHIP: + mItemFlags[0] |= 0x02; + break; + case EMPTY_BOTTLE: + mItemFlags[0] |= 0x04; + break; + case RED_BOTTLE: + mItemFlags[0] |= 0x08; + break; + case GREEN_BOTTLE: + mItemFlags[0] |= 0x10; + break; + case BLUE_BOTTLE: + mItemFlags[0] |= 0x20; + break; + case BOTTLESHIP: + mItemFlags[0] |= 0x40; + break; + case SOUP_BOTTLE: + mItemFlags[0] |= 0x80; + break; + case BIN_IN_WATER: + mItemFlags[1] |= 0x02; + break; + case FAIRY_BOTTLE: + mItemFlags[1] |= 0x04; + break; + case FIREFLY_BOTTLE: + mItemFlags[1] |= 0x08; + break; + case FWATER_BOTTLE: + mItemFlags[1] |= 0x10; + break; + case UNK_BOTTLE_5A: + mItemFlags[1] |= 0x20; + break; + case UNK_BOTTLE_5B: + mItemFlags[1] |= 0x40; + break; + case UNK_BOTTLE_5C: + mItemFlags[1] |= 0x80; + break; + case UNK_BOTTLE_5D: + mItemFlags[2] |= 0x02; + break; + case UNK_BOTTLE_5E: + mItemFlags[2] |= 0x04; + break; + case UNK_BOTTLE_5F: + mItemFlags[2] |= 0x08; + break; + case UNK_BOTTLE_60: + mItemFlags[2] |= 0x10; + break; + } } /* 80059740-80059848 .text isBottleItem__21dSv_player_get_item_cFUc */ -void dSv_player_get_item_c::isBottleItem(unsigned char) { - /* Nonmatching */ +bool dSv_player_get_item_c::isBottleItem(u8 i_item) { + switch (i_item) { + case EMPTY_BSHIP: + return mItemFlags[0] & 0x02; + case EMPTY_BOTTLE: + return mItemFlags[0] & 0x04; + case RED_BOTTLE: + return mItemFlags[0] & 0x08; + case GREEN_BOTTLE: + return mItemFlags[0] & 0x10; + case BLUE_BOTTLE: + return mItemFlags[0] & 0x20; + case BOTTLESHIP: + return mItemFlags[0] & 0x40; + case SOUP_BOTTLE: + return mItemFlags[0] & 0x80; + case BIN_IN_WATER: + return mItemFlags[1] & 0x02; + case FAIRY_BOTTLE: + return mItemFlags[1] & 0x04; + case FIREFLY_BOTTLE: + return mItemFlags[1] & 0x08; + case FWATER_BOTTLE: + return mItemFlags[1] & 0x10; + case UNK_BOTTLE_5A: + return mItemFlags[1] & 0x20; + case UNK_BOTTLE_5B: + return mItemFlags[1] & 0x40; + case UNK_BOTTLE_5C: + return mItemFlags[1] & 0x80; + case UNK_BOTTLE_5D: + return mItemFlags[2] & 0x02; + case UNK_BOTTLE_5E: + return mItemFlags[2] & 0x04; + case UNK_BOTTLE_5F: + return mItemFlags[2] & 0x08; + case UNK_BOTTLE_60: + return mItemFlags[2] & 0x10; + default: + return false; + } } /* 80059848-8005987C .text init__24dSv_player_item_record_cFv */ void dSv_player_item_record_c::init() { - /* Nonmatching */ + field_0x2 = 0; + mArrowNum = 0; + mBombNum = 0; + mTimer = 0; + + for (int i = 0; i < 3; i++) { + mBottleNum[i] = 0; + } } /* 8005987C-80059894 .text resetTimer__24dSv_player_item_record_cFUs */ -void dSv_player_item_record_c::resetTimer(unsigned short) { +void dSv_player_item_record_c::resetTimer(u16) { /* Nonmatching */ } @@ -117,42 +363,70 @@ void dSv_player_item_record_c::decTimer() { } /* 800598D0-800598D8 .text getTimer__24dSv_player_item_record_cFv */ -void dSv_player_item_record_c::getTimer() { - /* Nonmatching */ +u16 dSv_player_item_record_c::getTimer() { + return mTimer; } /* 800598D8-80059908 .text init__21dSv_player_item_max_cFv */ void dSv_player_item_max_c::init() { - /* Nonmatching */ -} + field_0x0 = 0; + mArrowNum = 0; + mBombNum = 0; + for (int i = 0; i < 5; i++) { + field_0x3[i] = 0; + } +} /* 80059908-80059968 .text init__21dSv_player_bag_item_cFv */ void dSv_player_bag_item_c::init() { - /* Nonmatching */ + for (int i = 0; i < 8; i++) { + field_0x0[i] = 0xFF; + } + + for (int i = 0; i < 8; i++) { + field_0x8[i] = 0xFF; + } + + for (int i = 0; i < 8; i++) { + field_0x10[i] = 0xFF; + } } /* 80059968-800599D8 .text setBeastItem__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::setBeastItem(unsigned char) { - /* Nonmatching */ +void dSv_player_bag_item_c::setBeastItem(u8 param_0) { + if (!checkBeastItem(param_0)) { + for (int i = 0; i < 8; i++) { + if (field_0x0[i] == 0xFF) { + field_0x0[i] = param_0; + return; + } + } + } } /* 800599D8-80059C30 .text setBeastItemEmpty__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::setBeastItemEmpty(unsigned char) { +void dSv_player_bag_item_c::setBeastItemEmpty(u8) { /* Nonmatching */ } /* 80059C30-80059C60 .text checkBeastItem__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::checkBeastItem(unsigned char) { - /* Nonmatching */ +bool dSv_player_bag_item_c::checkBeastItem(u8 param_0) { + for (int i = 0; i < 8; i++) { + if (field_0x0[i] == param_0) { + return true; + } + } + + return false; } /* 80059C60-80059EB0 .text setBaitItemChange__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::setBaitItemChange(unsigned char) { +void dSv_player_bag_item_c::setBaitItemChange(u8) { /* Nonmatching */ } /* 80059EB0-8005A0C8 .text setBaitItemChange__21dSv_player_bag_item_cFUcUc */ -void dSv_player_bag_item_c::setBaitItemChange(unsigned char, unsigned char) { +void dSv_player_bag_item_c::setBaitItemChange(u8, u8) { /* Nonmatching */ } @@ -162,253 +436,378 @@ void dSv_player_bag_item_c::setBaitItemEmpty() { } /* 8005A1A4-8005A248 .text setBaitItemEmpty__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::setBaitItemEmpty(unsigned char) { +void dSv_player_bag_item_c::setBaitItemEmpty(u8) { /* Nonmatching */ } /* 8005A248-8005A2D0 .text setBaitItem__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::setBaitItem(unsigned char) { +void dSv_player_bag_item_c::setBaitItem(u8) { /* Nonmatching */ } /* 8005A2D0-8005A2F4 .text checkBaitItemEmpty__21dSv_player_bag_item_cFv */ -void dSv_player_bag_item_c::checkBaitItemEmpty() { - /* Nonmatching */ +u8 dSv_player_bag_item_c::checkBaitItemEmpty() { + return checkBaitItem(NO_ITEM); } /* 8005A2F4-8005A334 .text checkBaitItem__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::checkBaitItem(unsigned char) { - /* Nonmatching */ +u8 dSv_player_bag_item_c::checkBaitItem(u8 i_itemNo) { + u8 ret = 0; + + for (int i = 0; i < 8; i++) { + if (field_0x8[i] == i_itemNo) { + ret++; + } + } + + return ret; } /* 8005A334-8005A584 .text setReserveItemChange__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::setReserveItemChange(unsigned char) { +void dSv_player_bag_item_c::setReserveItemChange(u8) { /* Nonmatching */ } /* 8005A584-8005A79C .text setReserveItemChange__21dSv_player_bag_item_cFUcUc */ -void dSv_player_bag_item_c::setReserveItemChange(unsigned char, unsigned char) { +void dSv_player_bag_item_c::setReserveItemChange(u8, u8) { /* Nonmatching */ } /* 8005A79C-8005A7C0 .text setReserveItemEmpty__21dSv_player_bag_item_cFv */ void dSv_player_bag_item_c::setReserveItemEmpty() { - /* Nonmatching */ + setReserveItemChange(NO_ITEM); } /* 8005A7C0-8005A7E4 .text setReserveItemEmpty__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::setReserveItemEmpty(unsigned char) { - /* Nonmatching */ +void dSv_player_bag_item_c::setReserveItemEmpty(u8 param_0) { + setReserveItemChange(param_0, NO_ITEM); } /* 8005A7E4-8005A854 .text setReserveItem__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::setReserveItem(unsigned char) { - /* Nonmatching */ +void dSv_player_bag_item_c::setReserveItem(u8 param_0) { + if (checkReserveItemEmpty()) { + for (int i = 0; i < 8; i++) { + if (field_0x10[i] == 0xFF) { + field_0x10[i] = param_0; + return; + } + } + } } /* 8005A854-8005A878 .text checkReserveItemEmpty__21dSv_player_bag_item_cFv */ -void dSv_player_bag_item_c::checkReserveItemEmpty() { - /* Nonmatching */ +u8 dSv_player_bag_item_c::checkReserveItemEmpty() { + return checkReserveItem(NO_ITEM); } /* 8005A878-8005A8B8 .text checkReserveItem__21dSv_player_bag_item_cFUc */ -void dSv_player_bag_item_c::checkReserveItem(unsigned char) { - /* Nonmatching */ +u8 dSv_player_bag_item_c::checkReserveItem(u8 i_itemNo) { + u8 ret = 0; + + for (int i = 0; i < 8; i++) { + if (field_0x10[i] == i_itemNo) { + ret++; + } + } + + return ret; } /* 8005A8B8-8005A8CC .text init__25dSv_player_get_bag_item_cFv */ void dSv_player_get_bag_item_c::init() { - /* Nonmatching */ + mBeastFlags = 0; + mBaitFlags = 0; + mReserveFlags = 0; } /* 8005A8CC-8005A960 .text onBeast__25dSv_player_get_bag_item_cFUc */ -void dSv_player_get_bag_item_c::onBeast(unsigned char) { - /* Nonmatching */ +void dSv_player_get_bag_item_c::onBeast(u8 i_no) { + JUT_ASSERT(1235, 0 <= i_no && i_no < 8); + mBeastFlags |= (u8)(1 << i_no); } /* 8005A960-8005A9F8 .text isBeast__25dSv_player_get_bag_item_cFUc */ -void dSv_player_get_bag_item_c::isBeast(unsigned char) { - /* Nonmatching */ +bool dSv_player_get_bag_item_c::isBeast(u8 i_no) { + JUT_ASSERT(1265, 0 <= i_no && i_no < 8); + return mBeastFlags & (u8)(1 << i_no) ? true : false; } /* 8005A9F8-8005AA8C .text onBait__25dSv_player_get_bag_item_cFUc */ -void dSv_player_get_bag_item_c::onBait(unsigned char) { - /* Nonmatching */ +void dSv_player_get_bag_item_c::onBait(u8 i_no) { + JUT_ASSERT(1280, 0 <= i_no && i_no < 8); + mBaitFlags |= (u8)(1 << i_no); } /* 8005AA8C-8005AB24 .text isBait__25dSv_player_get_bag_item_cFUc */ -void dSv_player_get_bag_item_c::isBait(unsigned char) { - /* Nonmatching */ +bool dSv_player_get_bag_item_c::isBait(u8 i_no) { + JUT_ASSERT(1310, 0 <= i_no && i_no < 8); + return mBaitFlags & (u8)(1 << i_no) ? true : false; } /* 8005AB24-8005ABB4 .text onReserve__25dSv_player_get_bag_item_cFUc */ -void dSv_player_get_bag_item_c::onReserve(unsigned char) { - /* Nonmatching */ +void dSv_player_get_bag_item_c::onReserve(u8 i_no) { + JUT_ASSERT(1325, 0 <= i_no && i_no < 32); + mReserveFlags |= (1 << i_no); } /* 8005ABB4-8005AC48 .text isReserve__25dSv_player_get_bag_item_cFUc */ -void dSv_player_get_bag_item_c::isReserve(unsigned char) { - /* Nonmatching */ +bool dSv_player_get_bag_item_c::isReserve(u8 i_no) { + JUT_ASSERT(1355, 0 <= i_no && i_no < 32); + return mReserveFlags & (1 << i_no) ? true : false; } /* 8005AC48-8005ACA8 .text init__28dSv_player_bag_item_record_cFv */ void dSv_player_bag_item_record_c::init() { - /* Nonmatching */ + for (int i = 0; i < 8; i++) { + field_0x0[i] = 0; + } + + for (int i = 0; i < 8; i++) { + field_0x8[i] = 0; + } + + for (int i = 0; i < 8; i++) { + field_0x10[i] = 0; + } } /* 8005ACA8-8005ACE0 .text init__20dSv_player_collect_cFv */ void dSv_player_collect_c::init() { - /* Nonmatching */ + for (int i = 0; i < 8; i++) { + field_0x0[i] = 0; + } + + field_0x8 = 0; + mTact = 0; + mTriforce = 0; + mSymbol = 0; + field_0xc = 0; } /* 8005ACE0-8005AD78 .text onCollect__20dSv_player_collect_cFiUc */ -void dSv_player_collect_c::onCollect(int, unsigned char) { - /* Nonmatching */ +void dSv_player_collect_c::onCollect(int i_idx, u8 i_item) { + JUT_ASSERT(1412, 0 <= i_item && i_item < 8); + field_0x0[i_idx] |= (u8)(1 << i_item); } /* 8005AD78-8005AE10 .text offCollect__20dSv_player_collect_cFiUc */ -void dSv_player_collect_c::offCollect(int, unsigned char) { - /* Nonmatching */ +void dSv_player_collect_c::offCollect(int i_idx, u8 i_item) { + JUT_ASSERT(1427, 0 <= i_item && i_item < 8); + field_0x0[i_idx] &= ~(u8)(1 << i_item); } /* 8005AE10-8005AEAC .text isCollect__20dSv_player_collect_cFiUc */ -void dSv_player_collect_c::isCollect(int, unsigned char) { - /* Nonmatching */ +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; } /* 8005AEAC-8005AF40 .text onTact__20dSv_player_collect_cFUc */ -void dSv_player_collect_c::onTact(unsigned char) { - /* Nonmatching */ +void dSv_player_collect_c::onTact(u8 i_no) { + JUT_ASSERT(1502, 0 <= i_no && i_no < 8); + mTact |= (u8)(1 << i_no); } /* 8005AF40-8005AFD8 .text isTact__20dSv_player_collect_cFUc */ -void dSv_player_collect_c::isTact(unsigned char) { - /* Nonmatching */ +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; } /* 8005AFD8-8005B06C .text onTriforce__20dSv_player_collect_cFUc */ -void dSv_player_collect_c::onTriforce(unsigned char) { - /* Nonmatching */ +void dSv_player_collect_c::onTriforce(u8 i_no) { + JUT_ASSERT(1547, 0 <= i_no && i_no < 8); + mTriforce |= (u8)(1 << i_no); } /* 8005B06C-8005B104 .text isTriforce__20dSv_player_collect_cFUc */ -void dSv_player_collect_c::isTriforce(unsigned char) { - /* Nonmatching */ +BOOL dSv_player_collect_c::isTriforce(u8 i_no) { + JUT_ASSERT(1577, 0 <= i_no && i_no < 8); + return mTriforce & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005B104-8005B198 .text onSymbol__20dSv_player_collect_cFUc */ -void dSv_player_collect_c::onSymbol(unsigned char) { - /* Nonmatching */ +void dSv_player_collect_c::onSymbol(u8 i_no) { + JUT_ASSERT(1592, 0 <= i_no && i_no < 8); + mSymbol |= (u8)(1 << i_no); } /* 8005B198-8005B230 .text isSymbol__20dSv_player_collect_cFUc */ -void dSv_player_collect_c::isSymbol(unsigned char) { - /* Nonmatching */ +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; } /* 8005B230-8005B290 .text getTriforceNum__20dSv_player_collect_cFv */ -void dSv_player_collect_c::getTriforceNum() { - /* Nonmatching */ +int dSv_player_collect_c::getTriforceNum() { + int num = 0; + + for (int i = 0; i < 8; i++) { + if (isTriforce(i)) { + num++; + } + } + + return num; } /* 8005B290-8005B320 .text init__16dSv_player_map_cFv */ void dSv_player_map_c::init() { - /* Nonmatching */ + for (int i = 0; i < 4; i++) { + field_0x0[0][i] = 0; + field_0x0[1][i] = 0; + field_0x0[2][i] = 0; + field_0x0[3][i] = 0; + } + + for (int i = 0; i < 49; i++) { + field_0x40[i] = 0; + } + + field_0x81 = 0; + field_0x40[0] = 3; + field_0x40[43] = 3; + field_0x40[10] = 3; + + for (int i = 0; i < 16; i++) { + field_0x71[i] = 0; + } } /* 8005B320-8005B3CC .text onGetMap__16dSv_player_map_cFi */ -void dSv_player_map_c::onGetMap(int) { - /* Nonmatching */ +void dSv_player_map_c::onGetMap(int i_no) { + JUT_ASSERT(1690, 0 <= i_no && i_no < 128); + field_0x0[1][i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005B3CC-8005B47C .text isGetMap__16dSv_player_map_cFi */ -void dSv_player_map_c::isGetMap(int) { - /* Nonmatching */ +BOOL dSv_player_map_c::isGetMap(int i_no) { + JUT_ASSERT(1718, 0 <= i_no && i_no < 128); + return field_0x0[1][i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005B47C-8005B528 .text onOpenMap__16dSv_player_map_cFi */ -void dSv_player_map_c::onOpenMap(int) { - /* Nonmatching */ +void dSv_player_map_c::onOpenMap(int i_no) { + JUT_ASSERT(1751, 0 <= i_no && i_no < 128); + field_0x0[2][i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005B528-8005B5D4 .text offOpenMap__16dSv_player_map_cFi */ -void dSv_player_map_c::offOpenMap(int) { - /* Nonmatching */ +void dSv_player_map_c::offOpenMap(int i_no) { + JUT_ASSERT(1765, 0 <= i_no && i_no < 128); + field_0x0[2][i_no >> 5] &= ~(1 << (i_no & 0x1F)); } /* 8005B5D4-8005B684 .text isOpenMap__16dSv_player_map_cFi */ -void dSv_player_map_c::isOpenMap(int) { - /* Nonmatching */ +BOOL dSv_player_map_c::isOpenMap(int i_no) { + JUT_ASSERT(1779, 0 <= i_no && i_no < 128); + return field_0x0[2][i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005B684-8005B730 .text onCompleteMap__16dSv_player_map_cFi */ -void dSv_player_map_c::onCompleteMap(int) { - /* Nonmatching */ +void dSv_player_map_c::onCompleteMap(int i_no) { + JUT_ASSERT(1812, 0 <= i_no && i_no < 128); + field_0x0[3][i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005B730-8005B7DC .text offCompleteMap__16dSv_player_map_cFi */ -void dSv_player_map_c::offCompleteMap(int) { - /* Nonmatching */ +void dSv_player_map_c::offCompleteMap(int i_no) { + JUT_ASSERT(1826, 0 <= i_no && i_no < 128); + field_0x0[3][i_no >> 5] &= ~(1 << (i_no & 0x1F)); } /* 8005B7DC-8005B88C .text isCompleteMap__16dSv_player_map_cFi */ -void dSv_player_map_c::isCompleteMap(int) { - /* Nonmatching */ +BOOL dSv_player_map_c::isCompleteMap(int i_no) { + JUT_ASSERT(1840, 0 <= i_no && i_no < 128); + return field_0x0[3][i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005B88C-8005B92C .text onTriforce__16dSv_player_map_cFi */ -void dSv_player_map_c::onTriforce(int) { - /* Nonmatching */ +void dSv_player_map_c::onTriforce(int i_no) { + JUT_ASSERT(1874, 0 <= i_no && i_no < 8); + field_0x81 |= (u8)(1 << i_no); } /* 8005B92C-8005B9CC .text offTriforce__16dSv_player_map_cFi */ -void dSv_player_map_c::offTriforce(int) { - /* Nonmatching */ +void dSv_player_map_c::offTriforce(int i_no) { + JUT_ASSERT(1888, 0 <= i_no && i_no < 8); + field_0x81 &= ~(u8)(1 << i_no); } /* 8005B9CC-8005BA70 .text isTriforce__16dSv_player_map_cFi */ -void dSv_player_map_c::isTriforce(int) { - /* Nonmatching */ +BOOL dSv_player_map_c::isTriforce(int i_no) { + JUT_ASSERT(1902, 0 <= i_no && i_no < 8); + return field_0x81 & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005BA70-8005BAE8 .text getCollectMapNum__16dSv_player_map_cFv */ -void dSv_player_map_c::getCollectMapNum() { - /* Nonmatching */ +int dSv_player_map_c::getCollectMapNum() { + int num = 0; + for (int i = 1; i <= 61; i++) { + if (i != 35 && i != 36 && i < 52 && isGetMap(i - 1)) { + num++; + } + } + + return num; } /* 8005BAE8-8005BB84 .text onFmapBit__16dSv_player_map_cFiUc */ -void dSv_player_map_c::onFmapBit(int, unsigned char) { - /* Nonmatching */ +void dSv_player_map_c::onFmapBit(int i_idx, u8 i_no) { + JUT_ASSERT(1957, 0 <= i_no && i_no < 8); + field_0x40[i_idx] |= (u8)(1 << i_no); } /* 8005BB84-8005BC24 .text isFmapBit__16dSv_player_map_cFiUc */ -void dSv_player_map_c::isFmapBit(int, unsigned char) { - /* Nonmatching */ +BOOL dSv_player_map_c::isFmapBit(int i_idx, u8 i_no) { + JUT_ASSERT(1987, 0 <= i_no && i_no < 8); + return field_0x40[i_idx] & (u8)(1 << i_no) ? TRUE : FALSE; } /* 8005BC24-8005BCBC .text onSaveArriveGrid__16dSv_player_map_cFi */ -void dSv_player_map_c::onSaveArriveGrid(int) { - /* Nonmatching */ +void dSv_player_map_c::onSaveArriveGrid(int no) { + JUT_ASSERT(1996, (no >= 0) && (no < 49)); + onFmapBit(no, 0); } /* 8005BCBC-8005BD54 .text isSaveArriveGrid__16dSv_player_map_cFi */ -void dSv_player_map_c::isSaveArriveGrid(int) { - /* Nonmatching */ +BOOL dSv_player_map_c::isSaveArriveGrid(int no) { + JUT_ASSERT(2010, (no >= 0) && (no < 49)); + return isFmapBit(no, 0); } /* 8005BD54-8005BDEC .text onSaveArriveGridForAgb__16dSv_player_map_cFi */ -void dSv_player_map_c::onSaveArriveGridForAgb(int) { - /* Nonmatching */ +void dSv_player_map_c::onSaveArriveGridForAgb(int no) { + JUT_ASSERT(2017, (no >= 0) && (no < 49)); + onFmapBit(no, 1); } /* 8005BDEC-8005BE84 .text isSaveArriveGridForAgb__16dSv_player_map_cFi */ -void dSv_player_map_c::isSaveArriveGridForAgb(int) { - /* Nonmatching */ +BOOL dSv_player_map_c::isSaveArriveGridForAgb(int no) { + JUT_ASSERT(2029, (no >= 0) && (no < 49)); + return isFmapBit(no, 1); } /* 8005BE84-8005BF2C .text init__17dSv_player_info_cFv */ void dSv_player_info_c::init() { - /* Nonmatching */ + static char l_defaultName[8] = "Link"; + + strcpy(mPlayerName, l_defaultName); + field_0x10 = 0; + strcpy(field_0x25, l_defaultName); + strcpy(field_0x36, l_defaultName); + + field_0x12 = 0; + mClearCount = 0; + + for (int i = 0; i < 17; i++) { + field_0x47[i] = 0; + } + + mFmapIdx = cM_rndF(3.0f); + if (mFmapIdx >= 3) { + mFmapIdx = 2; + } } /* 8005BF2C-8005BFA4 .text init__19dSv_player_config_cFv */ @@ -423,327 +822,593 @@ void dSv_player_config_c::checkVibration() { /* 8005BFC8-8005BFD4 .text init__19dSv_player_priest_cFv */ void dSv_player_priest_c::init() { - /* Nonmatching */ + field_0xf = 0; } /* 8005BFD4-8005BFFC .text set__19dSv_player_priest_cFUcR4cXyzsSc */ -void dSv_player_priest_c::set(unsigned char, cXyz&, short, signed char) { - /* Nonmatching */ +void dSv_player_priest_c::set(u8 param_0, cXyz& param_1, s16 param_2, s8 param_3) { + field_0xf = param_0; + field_0x0 = param_1; + field_0xc = param_2; + field_0xe = param_3; } /* 8005BFFC-8005C000 .text init__21dSv_player_status_c_cFv */ -void dSv_player_status_c_c::init() { - /* Nonmatching */ -} +void dSv_player_status_c_c::init() {} /* 8005C000-8005C094 .text init__12dSv_player_cFv */ void dSv_player_c::init() { - /* Nonmatching */ + mPlayerStatusA.init(); + mPlayerStatusB.init(); + mReturnPlace.init(); + mPlayerItem.init(); + mGetItem.init(); + mItemRecord.init(); + mItemMax.init(); + mBagItem.init(); + mGetBagItem.init(); + mBagItemRecord.init(); + mCollect.init(); + mMap.init(); + mInfo.init(); + mConfig.init(); } /* 8005C094-8005C0EC .text init__12dSv_memBit_cFv */ void dSv_memBit_c::init() { - /* Nonmatching */ + mTbox = 0; + + for (int i = 0; i < 4; i++) { + mSwitch[i] = 0; + } + + mItem[0] = 0; + + for (int i = 0; i < 2; i++) { + mVisitedRoom[i] = 0; + } + + field_0x20 = 0; + mDungeonItem = 0; } /* 8005C0EC-8005C188 .text onTbox__12dSv_memBit_cFi */ -void dSv_memBit_c::onTbox(int) { - /* Nonmatching */ +void dSv_memBit_c::onTbox(int i_no) { + JUT_ASSERT(2252, 0 <= i_no && i_no < 32); + mTbox |= (1 << i_no); } /* 8005C188-8005C228 .text isTbox__12dSv_memBit_cFi */ -void dSv_memBit_c::isTbox(int) { - /* Nonmatching */ +BOOL dSv_memBit_c::isTbox(int i_no) { + JUT_ASSERT(2280, 0 <= i_no && i_no < 32); + return mTbox & (1 << i_no) ? TRUE : FALSE; } /* 8005C228-8005C2D4 .text onSwitch__12dSv_memBit_cFi */ -void dSv_memBit_c::onSwitch(int) { - /* Nonmatching */ +void dSv_memBit_c::onSwitch(int i_no) { + JUT_ASSERT(2311, 0 <= i_no && i_no < 128); + mSwitch[i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005C2D4-8005C380 .text offSwitch__12dSv_memBit_cFi */ -void dSv_memBit_c::offSwitch(int) { - /* Nonmatching */ +void dSv_memBit_c::offSwitch(int i_no) { + JUT_ASSERT(2325, 0 <= i_no && i_no < 128); + mSwitch[i_no >> 5] &= ~(1 << (i_no & 0x1F)); } /* 8005C380-8005C430 .text isSwitch__12dSv_memBit_cFi */ -void dSv_memBit_c::isSwitch(int) { - /* Nonmatching */ +BOOL dSv_memBit_c::isSwitch(int i_no) { + JUT_ASSERT(2339, 0 <= i_no && i_no < 128); + return mSwitch[i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005C430-8005C4EC .text revSwitch__12dSv_memBit_cFi */ -void dSv_memBit_c::revSwitch(int) { - /* Nonmatching */ +BOOL dSv_memBit_c::revSwitch(int i_no) { + JUT_ASSERT(2353, 0 <= i_no && i_no < 128); + + u32 idx = i_no >> 5; + u32 sw = 1 << (i_no & 0x1F); + mSwitch[idx] ^= sw; + return mSwitch[idx] & sw ? TRUE : FALSE; } /* 8005C4EC-8005C598 .text onItem__12dSv_memBit_cFi */ -void dSv_memBit_c::onItem(int) { - /* Nonmatching */ +void dSv_memBit_c::onItem(int i_no) { + JUT_ASSERT(2372, 0 <= i_no && i_no < 64); + mItem[i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005C598-8005C648 .text isItem__12dSv_memBit_cFi */ -void dSv_memBit_c::isItem(int) { - /* Nonmatching */ +BOOL dSv_memBit_c::isItem(int i_no) { + JUT_ASSERT(2400, 0 <= i_no && i_no < 64); + return mItem[i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005C648-8005C6F4 .text onVisitedRoom__12dSv_memBit_cFi */ -void dSv_memBit_c::onVisitedRoom(int) { - /* Nonmatching */ +void dSv_memBit_c::onVisitedRoom(int i_no) { + JUT_ASSERT(2432, 0 <= i_no && i_no < 64); + mVisitedRoom[i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005C6F4-8005C7A4 .text isVisitedRoom__12dSv_memBit_cFi */ -void dSv_memBit_c::isVisitedRoom(int) { - /* Nonmatching */ +BOOL dSv_memBit_c::isVisitedRoom(int i_no) { + JUT_ASSERT(2460, 0 <= i_no && i_no < 64); + return mVisitedRoom[i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005C7A4-8005C844 .text onDungeonItem__12dSv_memBit_cFi */ -void dSv_memBit_c::onDungeonItem(int) { - /* Nonmatching */ +void dSv_memBit_c::onDungeonItem(int i_no) { + JUT_ASSERT(2492, 0 <= i_no && i_no < 6); + mDungeonItem |= (u8)(1 << i_no); } /* 8005C844-8005C8E8 .text isDungeonItem__12dSv_memBit_cFi */ -void dSv_memBit_c::isDungeonItem(int) { - /* Nonmatching */ +BOOL dSv_memBit_c::isDungeonItem(int i_no) { + JUT_ASSERT(2521, 0 <= i_no && i_no < 6); + return mDungeonItem & (u8)(1 << i_no) ? TRUE : FALSE; } +static const char* unused_8034f88d = "(123 <= i_no) && (i_no <= 132)"; + /* 8005C8E8-8005C908 .text init__11dSv_ocean_cFv */ void dSv_ocean_c::init() { - /* Nonmatching */ + for (int i = 0; i < 50; i++) { + field_0x0[i] = 0; + } } /* 8005C908-8005C9E8 .text onOceanSvBit__11dSv_ocean_cFUcUs */ -void dSv_ocean_c::onOceanSvBit(unsigned char, unsigned short) { - /* Nonmatching */ +void dSv_ocean_c::onOceanSvBit(u8 i_grid, u16 i_bit) { + JUT_ASSERT(2640, (0 <= i_grid) && (i_grid <= 0x31)); + JUT_ASSERT(2641, (0 <= i_bit) && (i_bit < 16)); + field_0x0[i_grid] |= (u16)(1 << i_bit); } /* 8005C9E8-8005CACC .text isOceanSvBit__11dSv_ocean_cFUcUs */ -void dSv_ocean_c::isOceanSvBit(unsigned char, unsigned short) { - /* Nonmatching */ +BOOL dSv_ocean_c::isOceanSvBit(u8 i_grid, u16 i_bit) { + JUT_ASSERT(2672, (0 <= i_grid) && (i_grid <= 0x31)); + JUT_ASSERT(2673, (0 <= i_bit) && (i_bit < 16)); + return field_0x0[i_grid] & (u16)(1 << i_bit) ? TRUE : FALSE; } /* 8005CACC-8005CB04 .text init__11dSv_event_cFv */ void dSv_event_c::init() { - /* Nonmatching */ + for (int i = 0; i < 0x100; i++) { + mFlags[i] = 0; + } + + setInitEventBit(); } /* 8005CB04-8005CB1C .text onEventBit__11dSv_event_cFUs */ -void dSv_event_c::onEventBit(unsigned short) { - /* Nonmatching */ +void dSv_event_c::onEventBit(u16 i_no) { + mFlags[i_no >> 8] |= (i_no & 0xFF); } /* 8005CB1C-8005CB34 .text offEventBit__11dSv_event_cFUs */ -void dSv_event_c::offEventBit(unsigned short) { - /* Nonmatching */ +void dSv_event_c::offEventBit(u16 i_no) { + mFlags[i_no >> 8] &= ~(i_no & 0xFF); } /* 8005CB34-8005CB58 .text isEventBit__11dSv_event_cFUs */ -void dSv_event_c::isEventBit(unsigned short) { - /* Nonmatching */ +BOOL dSv_event_c::isEventBit(u16 i_no) { + return mFlags[i_no >> 8] & (i_no & 0xFF) ? TRUE : FALSE; } /* 8005CB58-8005CB7C .text setEventReg__11dSv_event_cFUsUc */ -void dSv_event_c::setEventReg(unsigned short, unsigned char) { - /* Nonmatching */ +void dSv_event_c::setEventReg(u16 i_reg, u8 i_no) { + mFlags[i_reg >> 8] &= ~(u8)i_reg; + mFlags[i_reg >> 8] |= i_no; } /* 8005CB7C-8005CB94 .text getEventReg__11dSv_event_cFUs */ -void dSv_event_c::getEventReg(unsigned short) { - /* Nonmatching */ +u8 dSv_event_c::getEventReg(u16 i_reg) { + return (u8)i_reg & mFlags[i_reg >> 8]; } /* 8005CB94-8005CBB0 .text init__13dSv_reserve_cFv */ void dSv_reserve_c::init() { - /* Nonmatching */ + for (int i = 0; i < sizeof(dSv_reserve_c); i++) { + mReserve[i] = 0; + } } /* 8005CBB0-8005CBD0 .text init__12dSv_memory_cFv */ void dSv_memory_c::init() { - /* Nonmatching */ + mMembit.init(); } /* 8005CBD0-8005CC08 .text init__12dSv_danBit_cFSc */ -void dSv_danBit_c::init(signed char) { - /* Nonmatching */ +int dSv_danBit_c::init(s8 i_stageNo) { + if (i_stageNo != mStageNo) { + mSwitch[0] = 0; + mSwitch[1] = 0; + mStageNo = i_stageNo; + field_0x1 = 0; + return 1; + } + + return 0; } /* 8005CC08-8005CCB4 .text onSwitch__12dSv_danBit_cFi */ -void dSv_danBit_c::onSwitch(int) { - /* Nonmatching */ +void dSv_danBit_c::onSwitch(int i_no) { + JUT_ASSERT(2817, 0 <= i_no && i_no < 64); + mSwitch[i_no >> 5] |= (1 << (i_no & 0x1F)); } /* 8005CCB4-8005CD60 .text offSwitch__12dSv_danBit_cFi */ -void dSv_danBit_c::offSwitch(int) { - /* Nonmatching */ +void dSv_danBit_c::offSwitch(int i_no) { + JUT_ASSERT(2831, 0 <= i_no && i_no < 64); + mSwitch[i_no >> 5] &= ~(1 << (i_no & 0x1F)); } /* 8005CD60-8005CE10 .text isSwitch__12dSv_danBit_cFi */ -void dSv_danBit_c::isSwitch(int) { - /* Nonmatching */ +BOOL dSv_danBit_c::isSwitch(int i_no) { + JUT_ASSERT(2845, 0 <= i_no && i_no < 64); + return mSwitch[i_no >> 5] & (1 << (i_no & 0x1F)) ? TRUE : FALSE; } /* 8005CE10-8005CECC .text revSwitch__12dSv_danBit_cFi */ -void dSv_danBit_c::revSwitch(int) { - /* Nonmatching */ +BOOL dSv_danBit_c::revSwitch(int i_no) { + JUT_ASSERT(2859, 0 <= i_no && i_no < 64); + + int sw = 1 << (i_no & 0x1F); + mSwitch[i_no >> 5] ^= sw; + return mSwitch[i_no >> 5] & sw ? TRUE : FALSE; } /* 8005CECC-8005CEF4 .text init__13dSv_zoneBit_cFv */ void dSv_zoneBit_c::init() { - /* Nonmatching */ + for (int i = 0; i < 3; i++) { + mSwitch[i] = 0; + } + + mItem = 0; } /* 8005CEF4-8005CF00 .text clearRoomSwitch__13dSv_zoneBit_cFv */ void dSv_zoneBit_c::clearRoomSwitch() { - /* Nonmatching */ + mSwitch[2] = 0; } /* 8005CF00-8005CFAC .text onSwitch__13dSv_zoneBit_cFi */ -void dSv_zoneBit_c::onSwitch(int) { - /* Nonmatching */ +void dSv_zoneBit_c::onSwitch(int i_no) { + JUT_ASSERT(2903, 0 <= i_no && i_no < SWITCH_MAX); + mSwitch[i_no >> 4] |= (u16)(1 << (i_no & 0xF)); } /* 8005CFAC-8005D054 .text offSwitch__13dSv_zoneBit_cFi */ -void dSv_zoneBit_c::offSwitch(int) { - /* Nonmatching */ +void dSv_zoneBit_c::offSwitch(int i_no) { + JUT_ASSERT(2917, 0 <= i_no && i_no < SWITCH_MAX); + mSwitch[i_no >> 4] &= ~(1 << (i_no & 0xF)); } /* 8005D054-8005D100 .text isSwitch__13dSv_zoneBit_cFi */ -void dSv_zoneBit_c::isSwitch(int) { - /* Nonmatching */ +BOOL dSv_zoneBit_c::isSwitch(int i_no) { + JUT_ASSERT(2931, 0 <= i_no && i_no < SWITCH_MAX); + return mSwitch[i_no >> 4] & 1 << (i_no & 0xF) ? TRUE : FALSE; } /* 8005D100-8005D1B8 .text revSwitch__13dSv_zoneBit_cFi */ -void dSv_zoneBit_c::revSwitch(int) { - /* Nonmatching */ +BOOL dSv_zoneBit_c::revSwitch(int i_no) { + JUT_ASSERT(2945, 0 <= i_no && i_no < SWITCH_MAX); + + u32 idx = i_no >> 4; + int sw = 1 << (i_no & 0xF); + mSwitch[idx] ^= sw; + return mSwitch[idx] & sw ? TRUE : FALSE; } /* 8005D1B8-8005D254 .text onItem__13dSv_zoneBit_cFi */ -void dSv_zoneBit_c::onItem(int) { - /* Nonmatching */ +void dSv_zoneBit_c::onItem(int i_no) { + JUT_ASSERT(2964, 0 <= i_no && i_no < 16); + mItem |= (1 << i_no); } /* 8005D254-8005D2F4 .text isItem__13dSv_zoneBit_cFi */ -void dSv_zoneBit_c::isItem(int) { - /* Nonmatching */ +BOOL dSv_zoneBit_c::isItem(int i_no) { + JUT_ASSERT(2992, 0 <= i_no && i_no < 16); + return mItem & (1 << i_no) ? TRUE : FALSE; } /* 8005D2F4-8005D314 .text init__15dSv_zoneActor_cFv */ void dSv_zoneActor_c::init() { - /* Nonmatching */ + for (int i = 0; i < 16; i++) { + mActorFlags[i] = 0; + } } /* 8005D314-8005D3BC .text on__15dSv_zoneActor_cFi */ -void dSv_zoneActor_c::on(int) { - /* Nonmatching */ +void dSv_zoneActor_c::on(int i_id) { + JUT_ASSERT(3037, 0 <= i_id && i_id < ACTOR_MAX); + mActorFlags[i_id >> 5] |= (1 << (i_id & 0x1F)); } /* 8005D3BC-8005D468 .text is__15dSv_zoneActor_cFi */ -void dSv_zoneActor_c::is(int) { - /* Nonmatching */ +BOOL dSv_zoneActor_c::is(int i_id) { + JUT_ASSERT(3065, 0 <= i_id && i_id < ACTOR_MAX); + return mActorFlags[i_id >> 5] & (1 << (i_id & 0x1F)) ? TRUE : FALSE; } /* 8005D468-8005D4A4 .text init__10dSv_zone_cFi */ -void dSv_zone_c::init(int) { - /* Nonmatching */ +void dSv_zone_c::init(int i_roomNo) { + mRoomNo = i_roomNo; + mZoneBit.init(); + mZoneActor.init(); } /* 8005D4A4-8005D4C8 .text setRoom__13dSv_restart_cFRC4cXyzsSc */ -void dSv_restart_c::setRoom(const cXyz&, short, signed char) { - /* Nonmatching */ +void dSv_restart_c::setRoom(const cXyz& i_pos, s16 i_angle, s8 i_roomNo) { + mRestartRoom = i_roomNo; + mRestartPos = i_pos; + mRestartAngle = i_angle; } /* 8005D4C8-8005D584 .text setRestartOption__13dSv_restart_cFSc */ -void dSv_restart_c::setRestartOption(signed char) { - /* Nonmatching */ +void dSv_restart_c::setRestartOption(s8 param_0) { + static cXyz l_offsetPos(100.0, 0.0f, 0.0f); + + cXyz pos = mRestartPos; + cLib_offsetPos(&pos, &pos, mRestartAngle, &l_offsetPos); + setRestartOption(param_0, &pos, mRestartAngle, mRestartRoom); } /* 8005D584-8005D5B4 .text setRestartOption__13dSv_restart_cFScP4cXyzsSc */ -void dSv_restart_c::setRestartOption(signed char, cXyz*, short, signed char) { - /* Nonmatching */ +void dSv_restart_c::setRestartOption(s8 param_0, cXyz* i_pos, s16 i_angle, s8 i_roomNo) { + mRoomPos = *i_pos; + mRoomAngleY = i_angle; + mRoomNo = i_roomNo; + field_0x4 = -1; + field_0x1 = param_0; } /* 8005D5B4-8005D604 .text set__17dSv_turnRestart_cFRC4cXyzsScUlRC4cXyzsi */ -void dSv_turnRestart_c::set(const cXyz&, short, signed char, unsigned long, const cXyz&, short, int) { - /* Nonmatching */ +void dSv_turnRestart_c::set(const cXyz& i_pos, s16 i_angle, s8 i_roomNo, u32 i_param, + const cXyz& param_4, s16 param_5, int param_6) { + mPosition = i_pos; + mAngleY = i_angle; + mRoomNo = i_roomNo; + mParam = i_param; + field_0x13 = 0; + field_0x24 = param_4; + field_0x30 = param_5; + field_0x34 = param_6; } /* 8005D604-8005D660 .text init__10dSv_info_cFv */ void dSv_info_c::init() { - /* Nonmatching */ + mSavedata.init(); + mMemory.init(); + mDan.init(-1); + initZone(); + mTmp.init(); + + daNpc_Sarace_c::ship_race_rupee = 0; + daNpc_Sarace_c::ship_race_result = 0; } /* 8005D660-8005D860 .text reinit__10dSv_info_cFv */ void dSv_info_c::reinit() { - /* Nonmatching */ + static u16 l_holdEventReg[] = {0x95FF, 0x94FF, 0x93FF, 0x92FF, 0x91FF, 0x90FF, + 0x8FFF, 0x8EFF, 0x8DFF, 0x8CFF, 0xB1FF, 0x9CFF, + 0x84FF, 0x83FF, 0x82FF, 0x81FF, 0x80FF}; + + static u16 l_onEventBit[] = {0x2F08, 0x2F04, 0x2F02, 0x3A01, 0x3401}; } /* 8005D860-8005D8C8 .text init__10dSv_save_cFv */ void dSv_save_c::init() { - /* Nonmatching */ + mPlayer.init(); + + for (int i = 0; i < STAGE_MAX; i++) { + mMemory[i].init(); + } + + mOcean.init(); + mEvent.init(); } /* 8005D8C8-8005D988 .text getSave__10dSv_info_cFi */ -void dSv_info_c::getSave(int) { - /* Nonmatching */ +void dSv_info_c::getSave(int i_stageNo) { + JUT_ASSERT(3335, 0 <= i_stageNo && i_stageNo < dSv_save_c::STAGE_MAX); + mMemory = mSavedata.getSave(i_stageNo); } /* 8005D988-8005DA70 .text putSave__10dSv_info_cFi */ -void dSv_info_c::putSave(int) { - /* Nonmatching */ +void dSv_info_c::putSave(int i_stageNo) { + JUT_ASSERT(3351, 0 <= i_stageNo && i_stageNo < dSv_save_c::STAGE_MAX); + mSavedata.putSave(i_stageNo, mMemory); } /* 8005DA70-8005DAC8 .text initZone__10dSv_info_cFv */ void dSv_info_c::initZone() { - /* Nonmatching */ + for (int i = 0; i < 32; i++) { + mZone[i].init(-1); + } } /* 8005DAC8-8005DB24 .text createZone__10dSv_info_cFi */ -void dSv_info_c::createZone(int) { - /* Nonmatching */ +int dSv_info_c::createZone(int i_roomNo) { + dSv_zone_c* zone_p = mZone; + + for (int i = 0; i < ZONE_MAX; i++) { + if (zone_p->mRoomNo < 0) { + zone_p->init(i_roomNo); + return i; + } + zone_p++; + } + + return -1; } /* 8005DB24-8005DCD0 .text onSwitch__10dSv_info_cFii */ -void dSv_info_c::onSwitch(int, int) { - /* Nonmatching */ +void dSv_info_c::onSwitch(int i_no, int i_roomNo) { + JUT_ASSERT(3411, + (0 <= i_no && i_no < (MEMORY_SWITCH+ DAN_SWITCH+ ZONE_SWITCH)) || i_no == -1 || i_no == 255); + + if (i_no == -1 || i_no == 255) { + return; + } + + if (i_no < MEMORY_SWITCH) { + mMemory.getBit().onSwitch(i_no); + } else if (i_no < (MEMORY_SWITCH + DAN_SWITCH)) { + mDan.onSwitch(i_no - MEMORY_SWITCH); + } else { + JUT_ASSERT(3424, 0 <= i_roomNo && i_roomNo < 64); + + int zoneId = dStage_roomControl_c::getZoneNo(i_roomNo); + JUT_ASSERT(3426, 0 <= zoneId && zoneId < ZONE_MAX); + + mZone[zoneId].getZoneBit().onSwitch(i_no - (MEMORY_SWITCH + DAN_SWITCH)); + } } /* 8005DCD0-8005DCEC .text getZoneNo__20dStage_roomControl_cFi */ -void dStage_roomControl_c::getZoneNo(int) { +int dStage_roomControl_c::getZoneNo(int param_0) { /* Nonmatching */ } /* 8005DCEC-8005DE98 .text offSwitch__10dSv_info_cFii */ -void dSv_info_c::offSwitch(int, int) { - /* Nonmatching */ +void dSv_info_c::offSwitch(int i_no, int i_roomNo) { + JUT_ASSERT(3448, + (0 <= i_no && i_no < (MEMORY_SWITCH+ DAN_SWITCH+ ZONE_SWITCH)) || i_no == -1 || i_no == 255); + + if (i_no == -1 || i_no == 255) { + return; + } + + if (i_no < MEMORY_SWITCH) { + mMemory.getBit().offSwitch(i_no); + } else if (i_no < (MEMORY_SWITCH + DAN_SWITCH)) { + mDan.offSwitch(i_no - MEMORY_SWITCH); + } else { + JUT_ASSERT(3461, 0 <= i_roomNo && i_roomNo < 64); + + int zoneNo = dStage_roomControl_c::getZoneNo(i_roomNo); + JUT_ASSERT(3463, 0 <= zoneNo && zoneNo < ZONE_MAX); + + mZone[zoneNo].getZoneBit().offSwitch(i_no - (MEMORY_SWITCH + DAN_SWITCH)); + } } /* 8005DE98-8005DFE0 .text isSwitch__10dSv_info_cFii */ -void dSv_info_c::isSwitch(int, int) { - /* Nonmatching */ +BOOL dSv_info_c::isSwitch(int i_no, int i_roomNo) { + if (i_no == -1 || i_no == 255) { + return FALSE; + } + + if (i_no < MEMORY_SWITCH) { + return mMemory.getBit().isSwitch(i_no); + } else if (i_no < (MEMORY_SWITCH + DAN_SWITCH)) { + return mDan.isSwitch(i_no - MEMORY_SWITCH); + } else { + JUT_ASSERT(3509, 0 <= i_roomNo && i_roomNo < 64); + + int zoneNo = dStage_roomControl_c::getZoneNo(i_roomNo); + JUT_ASSERT(3511, 0 <= zoneNo && zoneNo < ZONE_MAX); + + return mZone[zoneNo].getZoneBit().isSwitch(i_no - (MEMORY_SWITCH + DAN_SWITCH)); + } } /* 8005DFE0-8005E190 .text revSwitch__10dSv_info_cFii */ -void dSv_info_c::revSwitch(int, int) { - /* Nonmatching */ +BOOL dSv_info_c::revSwitch(int i_no, int i_roomNo) { + JUT_ASSERT(3532, + (0 <= i_no && i_no < (MEMORY_SWITCH+ DAN_SWITCH+ ZONE_SWITCH)) || i_no == -1 || i_no == 255); + + if (i_no == -1 || i_no == 255) { + return FALSE; + } + + if (i_no < MEMORY_SWITCH) { + return mMemory.getBit().revSwitch(i_no); + } else if (i_no < (MEMORY_SWITCH + DAN_SWITCH)) { + return mDan.revSwitch(i_no - MEMORY_SWITCH); + } else { + JUT_ASSERT(3544, 0 <= i_roomNo && i_roomNo < 64); + + int zoneNo = dStage_roomControl_c::getZoneNo(i_roomNo); + JUT_ASSERT(3546, 0 <= zoneNo && zoneNo < ZONE_MAX); + + return mZone[zoneNo].getZoneBit().revSwitch(i_no - (MEMORY_SWITCH + DAN_SWITCH)); + } } /* 8005E190-8005E324 .text onItem__10dSv_info_cFii */ -void dSv_info_c::onItem(int, int) { - /* Nonmatching */ +void dSv_info_c::onItem(int i_no, int i_roomNo) { + JUT_ASSERT(3565, + (0 <= i_no && i_no < (MEMORY_ITEM+ZONE_ITEM)) || i_no == -1 || i_no == 127); + + if (i_no == -1 || i_no == 127) { + return; + } + + if (i_no < MEMORY_ITEM) { + mMemory.getBit().onItem(i_no); + } else { + JUT_ASSERT(3575, 0 <= i_roomNo && i_roomNo < 64); + + int zoneNo = dStage_roomControl_c::getZoneNo(i_roomNo); + JUT_ASSERT(3577, 0 <= zoneNo && zoneNo < ZONE_MAX); + + mZone[zoneNo].getZoneBit().onItem(i_no - MEMORY_ITEM); + } } /* 8005E324-8005E4BC .text isItem__10dSv_info_cFii */ -void dSv_info_c::isItem(int, int) { - /* Nonmatching */ +BOOL dSv_info_c::isItem(int i_no, int i_roomNo) { + JUT_ASSERT(3629, + (0 <= i_no && i_no < (MEMORY_ITEM+ZONE_ITEM)) || i_no == -1 || i_no == 127); + + if (i_no == -1 || i_no == 127) { + return FALSE; + } + + if (i_no < MEMORY_ITEM) { + return mMemory.getBit().isItem(i_no); + } else { + JUT_ASSERT(3638, 0 <= i_roomNo && i_roomNo < 64); + + int zoneNo = dStage_roomControl_c::getZoneNo(i_roomNo); + JUT_ASSERT(3640, 0 <= zoneNo && zoneNo < ZONE_MAX); + + return mZone[zoneNo].getZoneBit().isItem(i_no - MEMORY_ITEM); + } } /* 8005E4BC-8005E5F0 .text onActor__10dSv_info_cFii */ -void dSv_info_c::onActor(int, int) { - /* Nonmatching */ +void dSv_info_c::onActor(int i_id, int i_roomNo) { + if (i_id == -1 || i_id == 0xFFFF || i_roomNo == -1) { + return; + } + + JUT_ASSERT(3693, (0 <= i_id && i_id < dSv_zoneActor_c::ACTOR_MAX) && (0 <= i_roomNo && i_roomNo < 64)); + + int zoneNo = dStage_roomControl_c::getZoneNo(i_roomNo); + JUT_ASSERT(3695, 0 <= zoneNo && zoneNo < ZONE_MAX); + + mZone[zoneNo].getActor().on(i_id); } /* 8005E5F0-8005E780 .text isActor__10dSv_info_cFii */ -void dSv_info_c::isActor(int, int) { - /* Nonmatching */ +BOOL dSv_info_c::isActor(int i_id, int i_roomNo) { + if (i_id == -1 || i_id == 0xFFFF || i_roomNo == -1) { + return FALSE; + } + + if (0 > i_id || i_id >= dSv_zoneActor_c::ACTOR_MAX) { + JUT_ASSERT(3744, 0 <= i_id && i_id < dSv_zoneActor_c::ACTOR_MAX); + } + + JUT_ASSERT(3746, 0 <= i_roomNo && i_roomNo < 64); + + int zoneNo = dStage_roomControl_c::getZoneNo(i_roomNo); + JUT_ASSERT(3748, 0 <= zoneNo && zoneNo < ZONE_MAX); + + return mZone[zoneNo].getActor().is(i_id); } /* 8005E780-8005EA24 .text memory_to_card__10dSv_info_cFPci */ @@ -757,7 +1422,103 @@ void dSv_info_c::card_to_memory(char*, int) { } /* 8005ED00-8005EF88 .text initdata_to_card__10dSv_info_cFPci */ -void dSv_info_c::initdata_to_card(char*, int) { - /* Nonmatching */ +// NONMATCHING - out of order instructions, reg alloc etc +int dSv_info_c::initdata_to_card(char* i_cardPtr, int i_dataNum) { + i_cardPtr = i_cardPtr + (i_dataNum * 0x770); + dSv_save_c* save_p = (dSv_save_c*)i_cardPtr; + + dSv_player_status_a_c status_a; + status_a.init(); + memcpy(i_cardPtr, &status_a, sizeof(dSv_player_status_a_c)); + + dSv_player_status_b_c status_b; + status_b.init(); + memcpy(i_cardPtr + 0x18, &status_b, sizeof(dSv_player_status_b_c)); + + dSv_player_return_place_c return_place; + return_place.init(); + memcpy(i_cardPtr + 0x30, &return_place, sizeof(dSv_player_return_place_c)); + + dSv_player_item_c item; + item.init(); + memcpy(i_cardPtr + 0x3C, &item, sizeof(dSv_player_item_c)); + + dSv_player_get_item_c get_item; + get_item.init(); + memcpy(i_cardPtr + 0x51, &get_item, sizeof(dSv_player_get_item_c)); + + dSv_player_item_record_c item_record; + item_record.init(); + memcpy(i_cardPtr + 0x66, &item_record, sizeof(dSv_player_item_record_c)); + + dSv_player_item_max_c item_max; + item_max.init(); + memcpy(i_cardPtr + 0x6E, &item_max, sizeof(dSv_player_item_max_c)); + + dSv_player_bag_item_c bag_item; + bag_item.init(); + memcpy(i_cardPtr + 0x76, &bag_item, sizeof(dSv_player_bag_item_c)); + + dSv_player_get_bag_item_c get_bag_item; + get_bag_item.init(); + memcpy(i_cardPtr + 0x8E, &get_bag_item, sizeof(dSv_player_get_bag_item_c)); + + dSv_player_bag_item_record_c bag_item_record; + bag_item_record.init(); + memcpy(i_cardPtr + 0x9A, &bag_item_record, sizeof(dSv_player_bag_item_record_c)); + + dSv_player_collect_c collect; + collect.init(); + memcpy(i_cardPtr + 0xB2, &collect, sizeof(dSv_player_collect_c)); + + dSv_player_map_c map; + map.init(); + memcpy(save_p->getPlayer().getpMap(), &map, sizeof(dSv_player_map_c)); + + dSv_player_info_c info; + info.init(); + memset(i_cardPtr + 0xBF, 0, sizeof(dSv_player_info_c)); + + dSv_player_config_c config; + config.init(); + memcpy(i_cardPtr + 0x143, &config, sizeof(dSv_player_config_c)); + + dSv_player_priest_c priest; + priest.init(); + memcpy(i_cardPtr + 0x19F, &priest, sizeof(dSv_player_priest_c)); + + dSv_player_status_c_c status_c; + char* var_r31 = i_cardPtr + 0x1B4; + status_c.init(); + + for (int i = 0; i < 4; i++) { + memcpy(var_r31, &status_c, sizeof(dSv_player_status_c_c)); + var_r31 += 0x70; + } + + dSv_memory_c memory; + memory.init(); + memory.init(); + memcpy(var_r31, &memory, sizeof(dSv_memory_c) * 16); + + dSv_ocean_c ocean; + ocean.init(); + memcpy(var_r31 + 0x240, &ocean, sizeof(dSv_ocean_c)); + + dSv_event_c event; + event.init(); + memcpy(var_r31 + 0x2A4, &event, sizeof(dSv_event_c)); + + dSv_reserve_c reserve; + reserve.init(); + memcpy(var_r31 + 0x3A4, &reserve, sizeof(dSv_reserve_c)); + + int temp_r5 = (var_r31 + 0x3F4) - i_cardPtr; + if (temp_r5 > 0x768) { + printf("INIT size over %d/%d\n", 0x768, temp_r5); + return -1; + } + + printf("INIT size:%d\n", temp_r5); + return 0; } - From 1e1dacad72a2b5276cd019707dd443f6fb551577 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sun, 10 Sep 2023 00:58:48 -0700 Subject: [PATCH 2/4] add d_save to configure.py --- configure.py | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.py b/configure.py index 7e9483044..4dda107a0 100644 --- a/configure.py +++ b/configure.py @@ -301,6 +301,7 @@ def NonMatching(obj_path, **kwargs): Matching ("d/d_com_lib_game.cpp"), Matching ("d/d_particle_name.cpp"), NonMatching("d/d_s_title.cpp"), + NonMatching("d/d_save.cpp"), # ? NonMatching("DynamicLink.cpp"), From 5b7dc7986b63073ba0c30ec12b836411ee236897 Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sun, 10 Sep 2023 01:16:37 -0700 Subject: [PATCH 3/4] d_save_init OK --- configure.py | 1 + include/d/d_bg_s.h | 1 + include/d/d_com_inf_game.h | 16 ++++++++++++++-- include/d/d_save.h | 2 ++ include/d/d_save_init.h | 6 ++++++ src/d/d_save.cpp | 3 +-- src/d/d_save_init.cpp | 21 +++++++++++++-------- 7 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 include/d/d_save_init.h diff --git a/configure.py b/configure.py index 4dda107a0..843d64c8d 100644 --- a/configure.py +++ b/configure.py @@ -302,6 +302,7 @@ def NonMatching(obj_path, **kwargs): Matching ("d/d_particle_name.cpp"), NonMatching("d/d_s_title.cpp"), NonMatching("d/d_save.cpp"), + NonMatching("d/d_save_init.cpp"), # ? NonMatching("DynamicLink.cpp"), diff --git a/include/d/d_bg_s.h b/include/d/d_bg_s.h index c9ffae1df..05977488a 100644 --- a/include/d/d_bg_s.h +++ b/include/d/d_bg_s.h @@ -3,6 +3,7 @@ #include "global.h" #include "SSystem/SComponent/c_sxyz.h" +#include "SSystem/SComponent/c_xyz.h" class cBgS_LinChk; class cBgS_GndChk; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index add83040d..7ebce7421 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1,13 +1,13 @@ #ifndef D_COM_D_COM_INF_GAME_H #define D_COM_D_COM_INF_GAME_H -#include "d/d_save.h" #include "d/d_bg_s.h" #include "d/d_cc_s.h" -#include "d/d_stage.h" #include "d/d_event.h" #include "d/d_event_manager.h" #include "d/d_resorce.h" +#include "d/d_save.h" +#include "d/d_stage.h" class JKRArchive; class JKRExpHeap; @@ -269,6 +269,10 @@ class dComIfG_inf_c { extern dComIfG_inf_c g_dComIfG_gameInfo; +/** + * === SAVE === + */ + inline u8 dComIfGs_getSelectEquip(int param_0) { return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().getSelectEquip(param_0); } @@ -277,4 +281,12 @@ inline u8 dComIfGs_getItem(int param_0) { return g_dComIfG_gameInfo.info.getPlayer().getItem().getItem(param_0); } +inline void dComIfGs_setEventReg(u16 i_reg, u8 i_no) { + g_dComIfG_gameInfo.info.getEvent().setEventReg(i_reg, i_no); +} + +/** + * === PLAY === + */ + #endif /* D_COM_D_COM_INF_GAME_H */ diff --git a/include/d/d_save.h b/include/d/d_save.h index e3792c79c..c45198adf 100644 --- a/include/d/d_save.h +++ b/include/d/d_save.h @@ -773,6 +773,7 @@ class dSv_save_c { /* 8005D860 */ void init(); dSv_player_c& getPlayer() { return mPlayer; } + dSv_event_c& getEvent() { return mEvent; } dSv_memory_c& getSave(int i_stageNo) { return mMemory[i_stageNo]; } void putSave(int i_stageNo, dSv_memory_c i_mem) { mMemory[i_stageNo] = i_mem; } @@ -806,6 +807,7 @@ class dSv_info_c { /* 8005ED00 */ int initdata_to_card(char*, int); dSv_player_c& getPlayer() { return mSavedata.getPlayer(); } + dSv_event_c& getEvent() { return mSavedata.getEvent(); } static const int MEMORY_SWITCH = 0x80; static const int DAN_SWITCH = 0x40; diff --git a/include/d/d_save_init.h b/include/d/d_save_init.h new file mode 100644 index 000000000..cc394c658 --- /dev/null +++ b/include/d/d_save_init.h @@ -0,0 +1,6 @@ +#ifndef D_D_SAVE_INIT_H +#define D_D_SAVE_INIT_H + +void setInitEventBit(); + +#endif /* D_D_SAVE_INIT_H */ \ No newline at end of file diff --git a/src/d/d_save.cpp b/src/d/d_save.cpp index 53b2032cb..5384555c3 100644 --- a/src/d/d_save.cpp +++ b/src/d/d_save.cpp @@ -4,6 +4,7 @@ // #include "d/d_save.h" +#include "d/d_save_init.h" #include "d/d_com_inf_game.h" #include "JSystem/JUtility/JUTAssert.h" #include "MSL_C/string.h" @@ -11,8 +12,6 @@ #include "SSystem/SComponent/c_math.h" #include "MSL_C/stdio.h" -extern void setInitEventBit(); - struct daNpc_Sarace_c { static int ship_race_rupee; static int ship_race_result; diff --git a/src/d/d_save_init.cpp b/src/d/d_save_init.cpp index 5f4d501da..15d56a929 100644 --- a/src/d/d_save_init.cpp +++ b/src/d/d_save_init.cpp @@ -1,13 +1,18 @@ -// -// Generated by dtk -// Translation Unit: d_save_init.cpp -// +/** + * d_save_init.cpp + * + */ -#include "d_save_init.h" -#include "dolphin/types.h" +#include "d/d_save_init.h" +#include "d/d_com_inf_game.h" + +// move later +struct daNpc_Kg1_c { + static u8 m_highscore; +}; /* 8005EF88-8005EFDC .text setInitEventBit__Fv */ void setInitEventBit() { - /* Nonmatching */ + dComIfGs_setEventReg(0xBEFF, daNpc_Kg1_c::m_highscore); + dComIfGs_setEventReg(0x7EFF, 0xE); } - From fe79d732bdb884fe16c43f5059743ddd12954dfc Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Sun, 10 Sep 2023 04:50:27 -0700 Subject: [PATCH 4/4] fix some d_com_inf_game stuff --- configure.py | 1 + include/d/d_com_inf_game.h | 68 ++++++++-- include/d/d_event.h | 36 +++++ include/d/d_event_data.h | 9 ++ include/d/d_event_manager.h | 46 +++++++ include/d/d_save.h | 2 + src/d/d_com_inf_game.cpp | 254 +++++++++++++----------------------- 7 files changed, 242 insertions(+), 174 deletions(-) diff --git a/configure.py b/configure.py index 843d64c8d..09306efee 100644 --- a/configure.py +++ b/configure.py @@ -301,6 +301,7 @@ def NonMatching(obj_path, **kwargs): Matching ("d/d_com_lib_game.cpp"), Matching ("d/d_particle_name.cpp"), NonMatching("d/d_s_title.cpp"), + NonMatching("d/d_com_inf_game.cpp"), NonMatching("d/d_save.cpp"), NonMatching("d/d_save_init.cpp"), diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 7ebce7421..8ee0db3a9 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -27,11 +27,18 @@ class dTimer_c; class camera_class; class J2DOrthoGraph; -struct dADM { +class dADM { +public: /* 0x00 */ int mBlockCount; /* 0x04 */ void* mpData; /* 0x08 */ u8 mCharTbl[0x90]; - /* 0x98 */ void* vtbl; + +public: + dADM(); + void FindTag(u32, u32*, u32*); + void SetData(void*); + + virtual ~dADM(); }; // setup properly later @@ -75,14 +82,47 @@ class dComIfG_camera_info_class { /* 0x05 */ u8 mCamIdx; /* 0x06 */ u8 field_0x06; /* 0x07 */ u8 field_0x07; - /* 0x08 */ u32 field_0x08; - /* 0x0C */ f32 field_0x0c; - /* 0x10 */ f32 field_0x10; + /* 0x08 */ u32 mCameraAttentionStatus; + /* 0x0C */ f32 mCameraZoomScale; + /* 0x10 */ f32 mCameraZoomForcus; }; STATIC_ASSERT(sizeof(dComIfG_camera_info_class) == 0x14); class dComIfG_play_c { public: + dComIfG_play_c() { ct(); } + + void ct(); + void init(); + void itemInit(); + void getLayerNo(int); + void createParticle(); + void createDemo(); + void removeDemo(); + void executeEvtManager(); + void createMagma(); + void removeMagma(); + void executeMagma(); + void drawMagma(); + void createGrass(); + void removeGrass(); + void executeGrass(); + void drawGrass(); + void createFlower(); + void removeFlower(); + void executeFlower(); + void drawFlower(); + void createTree(); + void removeTree(); + void executeTree(); + void drawTree(); + void createWood(); + void removeWood(); + void executeWood(); + void drawWood(); + + ~dComIfG_play_c(); + /* 0x0000 */ dBgS mBgS; /* 0x1404 */ dCcS mCcS; /* 0x3DF8 */ dADM mADM; @@ -131,19 +171,18 @@ class dComIfG_play_c { /* 0x4834 */ dTree_packet_c* mpTreePacket; /* 0x4838 */ Packet_c* mpWoodPacket; /* 0x483C */ dFlower_packet_c* mpFlowerPacket; - /* 0x4840 */ u8 mLkDArcIdx; + /* 0x4840 */ s8 mLkDArcIdx; /* 0x4841 */ u8 field_0x4841; - /* 0x4842 */ short mVrboxFlags; + /* 0x4842 */ s16 mVrboxFlags; /* 0x4844 */ dDlst_window_c mDlstWindow[1]; /* 0x486C */ u8 mCurCameraInfo; /* 0x486D */ u8 field_0x486D[0x4870 - 0x486D]; /* 0x4870 */ dComIfG_camera_info_class mCameraInfo[1]; - /* 0x48A4 */ daPy_py_c* mpCurPlayerActor[1]; - /* 0x48A8 */ u8 mCurCamera; + /* 0x4884 */ u8 field_0x4884[0x48A4 - 0x4884]; + /* 0x48A4 */ daPy_py_c* mpPlayer[1]; + /* 0x48A8 */ s8 mCurCamera[1]; /* 0x48A9 */ u8 field_0x48A9[0x48AC - 0x48A9]; - /* 0x48AC */ daPy_lk_c* mpLinkActor; - /* 0x48B0 */ daPy_npc_c* mpPlayerPartnerActor; - /* 0x48B4 */ daShip_c* mpShip; + /* 0x48AC */ fopAc_ac_c* mpPlayerPtr[3]; // 0: Link, 1: Partner, 2: Ship /* 0x48B8 */ f32 field_0x48b8; /* 0x48BC */ int mItemLifeCount; /* 0x48C0 */ int mItemRupeeCount; @@ -258,6 +297,11 @@ class dComIfG_play_c { class dComIfG_inf_c { public: + dComIfG_inf_c() { ct(); } + ~dComIfG_inf_c(); + + void ct(); + /* 0x00000 */ dSv_info_c info; /* 0x012A0 */ dComIfG_play_c play; /* 0x05D1C */ dDlst_list_c drawlist; diff --git a/include/d/d_event.h b/include/d/d_event.h index e5d7e3dd3..2281f342a 100644 --- a/include/d/d_event.h +++ b/include/d/d_event.h @@ -23,6 +23,42 @@ class dEvt_order_c { class dEvt_control_c { public: + dEvt_control_c(); + + void orderOld(u16, u16, u16, u16, void*, void*, const void*); + void order(u16, u16, u16, u16, void*, void*, s16, u8); + void setParam(dEvt_order_c*); + void beforeFlagProc(dEvt_order_c*); + void afterFlagProc(dEvt_order_c*); + void commonCheck(dEvt_order_c*, u16, u16); + void talkCheck(dEvt_order_c*); + void talkXyCheck(dEvt_order_c*); + void photoCheck(dEvt_order_c*); + void catchCheck(dEvt_order_c*); + void talkEnd(); + void demoCheck(dEvt_order_c*); + void demoEnd(); + void potentialCheck(dEvt_order_c*); + void doorCheck(dEvt_order_c*); + void itemCheck(dEvt_order_c*); + void endProc(); + void checkChange(); + void changeProc(); + void checkStart(); + void soundProc(); + void check(); + void photoCheck(); + void moveApproval(void*); + void compulsory(void*, const char*, u16); + void remove(); + void getStageEventDt(); + void nextStageEventDt(void*); + void getPId(void*); + void convPId(unsigned int); + void getTactFreeMStick(int); + void getTactFreeCStick(int); + void giveItemCut(u8); + /* 0x00 */ dEvt_order_c mOrder[8]; /* 0xC0 */ u8 mOrderCount; /* 0xC1 */ u8 mFirstOrderIdx; diff --git a/include/d/d_event_data.h b/include/d/d_event_data.h index ed56a30fb..f3c3ee6af 100644 --- a/include/d/d_event_data.h +++ b/include/d/d_event_data.h @@ -31,11 +31,20 @@ class dEvDtEvent_c {}; class dEvDtFlag_c { public: + dEvDtFlag_c() {} + u32 mFlags[320]; }; // Size = 0x500 class dEvDtBase_c { public: + dEvDtBase_c() { init(); } + ~dEvDtBase_c() {} + + void init(); + void advanceCut(dEvDtEvent_c*); + void advanceCutLocal(dEvDtStaff_c*); + /* 0x00 */ event_binary_data_header* mHeaderP; /* 0x04 */ dEvDtEvent_c* mEventP; /* 0x08 */ dEvDtStaff_c* mStaffP; diff --git a/include/d/d_event_manager.h b/include/d/d_event_manager.h index 53ee6aa9b..b14995d7d 100644 --- a/include/d/d_event_manager.h +++ b/include/d/d_event_manager.h @@ -8,6 +8,8 @@ class fopAc_ac_c; class dEvent_exception_c { public: + dEvent_exception_c() { mEventInfoIdx = -1; } + /* 0x0 */ s32 mEventInfoIdx; /* 0x4 */ u8 field_0x4; /* 0x5 */ u8 field_0x5; @@ -18,6 +20,50 @@ class dEvent_exception_c { class dEvent_manager_c { public: + dEvent_manager_c() {} + ~dEvent_manager_c() {} + + void debugBfProc(); + void getSubstance(dEvDtData_c*, int); + void setData(const char*); + void create(); + void remove(const char*); + void startProc(dEvDtEvent_c*); + void closeProc(dEvDtEvent_c*); + void endProc(s16, int); + void mainProc(); + void runProc(); + void getEventData(s16); + void getEventIdx(const char*, u8); + void order(s16); + void startCheck(s16); + void startCheckOld(const char*); + void endCheck(s16); + void endCheckOld(const char*); + void getMyStaffId(const char*, fopAc_ac_c*, int); + void getIsAddvance(int); + void getMyActIdx(int, const char* const*, int, int, int); + void getMyActName(int); + void getMyNowCutName(int); + void getMyDataP(int, const char*, int); + void getMySubstanceP(int, const char*, int); + void getMySubstanceNum(int, const char*); + void cutEnd(int); + void getEventPrio(s16); + void getEventEndSound(s16); + void exceptionProc(); + void issueStaff(const char*); + void cancelStaff(const char*); + void setGoal(cXyz*); + void getGoal(); + void specialCast_Shutter(s16, int); + void specialCast(const char*, int); + void setPrmStaff(void*, int); + void getToolId(u8, int); + void ChkPresentEnd(); + void CancelPresent(); + void checkStartDemo(); + /* 0x000 */ dEvDtBase_c mList; /* 0x020 */ int mCameraPlay; /* 0x024 */ dEvent_exception_c mException; diff --git a/include/d/d_save.h b/include/d/d_save.h index c45198adf..903e32cd7 100644 --- a/include/d/d_save.h +++ b/include/d/d_save.h @@ -672,6 +672,7 @@ class dSv_reserve_c { class dSv_memory_c { public: + dSv_memory_c() { init(); } /* 8005CBB0 */ void init(); dSv_memBit_c& getBit() { return mMembit; } @@ -723,6 +724,7 @@ class dSv_zoneActor_c { class dSv_zone_c { public: + dSv_zone_c() { mRoomNo = -1; } /* 8005D468 */ void init(int); dSv_zoneBit_c& getZoneBit() { return mZoneBit; } diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp index 7195e30d3..658b5a5cc 100644 --- a/src/d/d_com_inf_game.cpp +++ b/src/d/d_com_inf_game.cpp @@ -3,17 +3,91 @@ // Translation Unit: d_com_inf_game.cpp // -#include "d_com_inf_game.h" -#include "dolphin/types.h" +#include "d/d_com_inf_game.h" +#include "SSystem/SComponent/c_phase.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 { +public: + ~dFlower_packet_c(); +}; + +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 */ void dComIfG_play_c::ct() { - /* Nonmatching */ + field_0x4841 = 0; + mParticle = NULL; + mDemo = NULL; + mpMagmaPacket = NULL; + mpGrassPacket = NULL; + mpTreePacket = NULL; + mpWoodPacket = NULL; + mpFlowerPacket = NULL; + field_0x4A64[0] = 0xFF; + field_0x4A64[1] = 0xFF; + mLastSeaRoom = 0xFF; + field_0x4A67[0] = 0xFF; + mIkadaLinkPos.set(0.0f, 0.0f, 0.0f); + mLkDArcIdx = -1; + + init(); } /* 800521A4-800521D4 .text init__14dComIfG_play_cFv */ void dComIfG_play_c::init() { - /* Nonmatching */ + for (int i = 0; i < 1; i++) { + mpPlayer[i] = NULL; + mCurCamera[i] = -1; + } + + for (int i = 0; i < 3; i++) { + mpPlayerPtr[i] = NULL; + } } /* 800521D4-80052400 .text itemInit__14dComIfG_play_cFv */ @@ -43,7 +117,7 @@ void dComIfG_play_c::removeDemo() { /* 800529B8-800529DC .text executeEvtManager__14dComIfG_play_cFv */ void dComIfG_play_c::executeEvtManager() { - /* Nonmatching */ + mEventMgr.runProc(); } /* 800529DC-80052A30 .text createMagma__14dComIfG_play_cFv */ @@ -183,11 +257,12 @@ void dComIfG_play_c::drawWood() { /* 80053178-800531A8 .text ct__13dComIfG_inf_cFv */ void dComIfG_inf_c::ct() { - /* Nonmatching */ + field_0x1d1c1 = 0xFF; + play.ct(); } /* 800531A8-8005326C .text dComIfG_changeOpeningScene__FP11scene_classs */ -void dComIfG_changeOpeningScene(scene_class*, short) { +void dComIfG_changeOpeningScene(scene_class*, s16) { /* Nonmatching */ } @@ -207,8 +282,8 @@ void phase_2(char*) { } /* 80053388-80053390 .text phase_3__FPc */ -void phase_3(char*) { - /* Nonmatching */ +int phase_3(char*) { + return cPhs_COMPLEATE_e; } /* 80053390-800533D0 .text dComIfG_resLoad__FP30request_of_phase_process_classPCc */ @@ -227,7 +302,7 @@ void dComIfGp_getReverb(int) { } /* 800534C4-800535B8 .text dComIfGd_setSimpleShadow2__FP4cXyzffR13cBgS_PolyInfosfP9_GXTexObj */ -void dComIfGd_setSimpleShadow2(cXyz*, float, float, cBgS_PolyInfo&, short, float, _GXTexObj*) { +void dComIfGd_setSimpleShadow2(cXyz*, f32, f32, cBgS_PolyInfo&, s16, f32, _GXTexObj*) { /* Nonmatching */ } @@ -237,7 +312,7 @@ void dComIfGp_getShip(int, int) { } /* 80053678-80053728 .text dComIfGp_getMapTrans__FiPfPfPs */ -void dComIfGp_getMapTrans(int, float*, float*, short*) { +void dComIfGp_getMapTrans(int, f32*, f32*, s16*) { /* Nonmatching */ } @@ -252,7 +327,7 @@ void dComIfGp_getRoomArrow(int) { } /* 800537C8-8005388C .text dComIfGp_setNextStage__FPCcsScScfUliSc */ -void dComIfGp_setNextStage(const char*, short, signed char, signed char, float, unsigned long, int, signed char) { +void dComIfGp_setNextStage(const char*, s16, s8, s8, f32, u32, int, s8) { /* Nonmatching */ } @@ -282,17 +357,17 @@ void dComIfGs_isStageLife(int) { } /* 80053B30-80053F70 .text dComIfGs_checkGetItem__FUc */ -void dComIfGs_checkGetItem(unsigned char) { +void dComIfGs_checkGetItem(u8) { /* Nonmatching */ } /* 80053F70-80054578 .text dComIfGs_checkGetItemNum__FUc */ -void dComIfGs_checkGetItemNum(unsigned char) { +void dComIfGs_checkGetItemNum(u8) { /* Nonmatching */ } /* 80054578-8005468C .text dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj */ -void dComIfGd_setShadow(unsigned long, signed char, J3DModel*, cXyz*, float, float, float, float, cBgS_PolyInfo&, dKy_tevstr_c*, short, float, _GXTexObj*) { +void dComIfGd_setShadow(u32, s8, J3DModel*, cXyz*, f32, f32, f32, f32, cBgS_PolyInfo&, dKy_tevstr_c*, s16, f32, _GXTexObj*) { /* Nonmatching */ } @@ -307,7 +382,7 @@ void dComIfGd_getMeshSceneList(Vec&) { } /* 80054870-800548FC .text dComIfGs_checkSeaLandingEvent__FSc */ -void dComIfGs_checkSeaLandingEvent(signed char) { +void dComIfGs_checkSeaLandingEvent(s8) { /* Nonmatching */ } @@ -342,152 +417,7 @@ void dComIfGs_exchangePlayerRecollectionData() { } /* 8005586C-800559E8 .text dComIfGs_setSelectEquip__FiUc */ -void dComIfGs_setSelectEquip(int, unsigned char) { - /* Nonmatching */ -} - -/* 80055C08-80055C7C .text __dt__13dComIfG_inf_cFv */ -dComIfG_inf_c::~dComIfG_inf_c() { - /* Nonmatching */ -} - -/* 80055C7C-80055DB8 .text __dt__14dComIfG_play_cFv */ -dComIfG_play_c::~dComIfG_play_c() { - /* Nonmatching */ -} - -/* 80055DB8-80055DF4 .text __dt__12dEvt_order_cFv */ -dEvt_order_c::~dEvt_order_c() { - /* Nonmatching */ -} - -/* 80055DF4-80055E30 .text __dt__25dComIfG_camera_info_classFv */ -dComIfG_camera_info_class::~dComIfG_camera_info_class() { - /* Nonmatching */ -} - -/* 80055E30-80055E34 .text __ct__25dComIfG_camera_info_classFv */ -dComIfG_camera_info_class::dComIfG_camera_info_class() { - /* Nonmatching */ -} - -/* 80055E34-80055E70 .text __dt__14dDlst_window_cFv */ -dDlst_window_c::~dDlst_window_c() { - /* Nonmatching */ -} - -/* 80055E70-80055E74 .text __ct__14dDlst_window_cFv */ -dDlst_window_c::dDlst_window_c() { - /* Nonmatching */ -} - -/* 80055E74-80055ED0 .text __dt__19dAttDraw_CallBack_cFv */ -dAttDraw_CallBack_c::~dAttDraw_CallBack_c() { - /* Nonmatching */ -} - -/* 80055ED0-80055F18 .text __dt__25mDoExt_McaMorfCallBack1_cFv */ -mDoExt_McaMorfCallBack1_c::~mDoExt_McaMorfCallBack1_c() { - /* Nonmatching */ -} - -/* 80055F18-80055FB8 .text __dt__4dCcSFv */ -dCcS::~dCcS() { - /* Nonmatching */ -} - -/* 80055FB8-8005613C .text __dt__12dCcMassS_MngFv */ -dCcMassS_Mng::~dCcMassS_Mng() { - /* Nonmatching */ -} - -/* 8005613C-8005619C .text __dt__12dCcMassS_ObjFv */ -dCcMassS_Obj::~dCcMassS_Obj() { - /* Nonmatching */ -} - -/* 8005619C-80056210 .text __dt__4cCcSFv */ -cCcS::~cCcS() { - /* Nonmatching */ -} - -/* 80056210-8005628C .text __dt__4dBgSFv */ -dBgS::~dBgS() { - /* Nonmatching */ -} - -/* 8005628C-800562F8 .text __dt__4cBgSFv */ -cBgS::~cBgS() { - /* Nonmatching */ -} - -/* 800562F8-80056340 .text __dt__11cBgS_ChkElmFv */ -cBgS_ChkElm::~cBgS_ChkElm() { - /* Nonmatching */ -} - -/* 80056340-8005637C .text __ct__11cBgS_ChkElmFv */ -cBgS_ChkElm::cBgS_ChkElm() { - /* Nonmatching */ -} - -/* 8005637C-80056388 .text __ct__10dSv_zone_cFv */ -dSv_zone_c::dSv_zone_c() { - /* Nonmatching */ -} - -/* 80056388-800563B8 .text __ct__12dSv_memory_cFv */ -dSv_memory_c::dSv_memory_c() { - /* Nonmatching */ -} - -/* 800563B8-80056400 .text __dt__8cM3dGCylFv */ -cM3dGCyl::~cM3dGCyl() { - /* Nonmatching */ -} - -/* 80056400-8005645C .text __dt__14cCcD_ShapeAttrFv */ -cCcD_ShapeAttr::~cCcD_ShapeAttr() { - /* Nonmatching */ -} - -/* 8005645C-80056464 .text CrossAtTg__14cCcD_ShapeAttrCFRC14cCcD_ShapeAttrP4cXyz */ -void cCcD_ShapeAttr::CrossAtTg(const cCcD_ShapeAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 80056464-8005646C .text CrossCo__14cCcD_ShapeAttrCFRC14cCcD_ShapeAttrPf */ -void cCcD_ShapeAttr::CrossCo(const cCcD_ShapeAttr&, float*) const { - /* Nonmatching */ -} - -/* 8005646C-80056478 .text GetCoCP__14cCcD_ShapeAttrFv */ -void cCcD_ShapeAttr::GetCoCP() { - /* Nonmatching */ -} - -/* 80056478-80056484 .text GetCoCP__14cCcD_ShapeAttrCFv */ -void cCcD_ShapeAttr::GetCoCP() const { - /* Nonmatching */ -} - -/* 80056484-800564E0 .text __dt__8cM3dGCpsFv */ -cM3dGCps::~cM3dGCps() { - /* Nonmatching */ -} - -/* 800564E0-80056528 .text __dt__15cCcD_DivideInfoFv */ -cCcD_DivideInfo::~cCcD_DivideInfo() { - /* Nonmatching */ -} - -/* 80056528-80056570 .text __dt__8cM3dGAabFv */ -cM3dGAab::~cM3dGAab() { - /* Nonmatching */ -} - -/* 80056570-800565CC .text __dt__15cCcD_DivideAreaFv */ -cCcD_DivideArea::~cCcD_DivideArea() { +void dComIfGs_setSelectEquip(int, u8) { /* Nonmatching */ }