Skip to content

Commit

Permalink
Merge pull request #4 from TakaRikka/save
Browse files Browse the repository at this point in the history
d_save mostly done
  • Loading branch information
magcius authored Sep 10, 2023
2 parents f945d95 + fe79d73 commit d00e5b0
Show file tree
Hide file tree
Showing 22 changed files with 3,388 additions and 482 deletions.
3 changes: 3 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ 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"),

# ?
NonMatching("DynamicLink.cpp"),
Expand Down
2 changes: 1 addition & 1 deletion include/JSystem/JUtility/JUTAssert.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"); \
}
Expand Down
50 changes: 8 additions & 42 deletions include/SSystem/SComponent/c_cc_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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; }
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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 */
16 changes: 8 additions & 8 deletions include/SSystem/SComponent/c_cc_s.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 */
2 changes: 1 addition & 1 deletion include/SSystem/SComponent/c_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T>
Expand Down
34 changes: 34 additions & 0 deletions include/SSystem/SComponent/c_m3d_g_cps.h
Original file line number Diff line number Diff line change
@@ -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 */
32 changes: 32 additions & 0 deletions include/SSystem/SComponent/c_m3d_g_lin.h
Original file line number Diff line number Diff line change
@@ -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 */
115 changes: 115 additions & 0 deletions include/d/d_bg_s.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#ifndef D_BG_D_BG_S_H
#define D_BG_D_BG_S_H

#include "global.h"
#include "SSystem/SComponent/c_sxyz.h"
#include "SSystem/SComponent/c_xyz.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 */
Loading

0 comments on commit d00e5b0

Please sign in to comment.