summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Camera.h6
-rw-r--r--src/core/CdStream.cpp3
-rw-r--r--src/core/CdStream.h3
-rw-r--r--src/core/Placeable.h5
-rw-r--r--src/core/PlayerInfo.h3
-rw-r--r--src/core/Wanted.h2
-rw-r--r--src/core/World.h4
-rw-r--r--src/core/common.h4
8 files changed, 28 insertions, 2 deletions
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 51138f99..d69b1be4 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -260,9 +260,12 @@ public:
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float);
};
+
+#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size");
static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error");
static_assert(offsetof(CCam, Front) == 0x140, "CCam: error");
+#endif
class CCamPathSplines
{
@@ -637,6 +640,8 @@ uint32 unknown; // some counter having to do with music
bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
};
+
+#ifdef CHECK_STRUCT_SIZES
static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error");
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "CCamera: error");
@@ -650,6 +655,7 @@ static_assert(offsetof(CCamera, m_PreviousCameraPosition) == 0x6B0, "CCamera: er
static_assert(offsetof(CCamera, m_vecCutSceneOffset) == 0x6F8, "CCamera: error");
static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error");
static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
+#endif
extern CCamera TheCamera;
diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp
index ea79fb9a..3b9eaac5 100644
--- a/src/core/CdStream.cpp
+++ b/src/core/CdStream.cpp
@@ -22,7 +22,10 @@ struct CdReadInfo
HANDLE hFile;
OVERLAPPED Overlapped;
};
+
+#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(CdReadInfo, 0x30);
+#endif
char gCdImageNames[MAX_CDIMAGES+1][64];
int32 gNumImages;
diff --git a/src/core/CdStream.h b/src/core/CdStream.h
index 9ef71b65..ba74be31 100644
--- a/src/core/CdStream.h
+++ b/src/core/CdStream.h
@@ -25,8 +25,9 @@ struct Queue
int32 size;
};
+#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(Queue, 0x10);
-
+#endif
void CdStreamInitThread(void);
void CdStreamInit(int32 numChannels);
diff --git a/src/core/Placeable.h b/src/core/Placeable.h
index 7e858283..110a1542 100644
--- a/src/core/Placeable.h
+++ b/src/core/Placeable.h
@@ -31,4 +31,7 @@ public:
bool IsWithinArea(float x1, float y1, float x2, float y2);
bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2);
};
-static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error"); \ No newline at end of file
+
+#ifdef CHECK_STRUCT_SIZES
+static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error");
+#endif \ No newline at end of file
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index e970e42d..ae089032 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -80,4 +80,7 @@ public:
~CPlayerInfo() { };
};
+
+#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
+#endif
diff --git a/src/core/Wanted.h b/src/core/Wanted.h
index e3e407b0..802c3673 100644
--- a/src/core/Wanted.h
+++ b/src/core/Wanted.h
@@ -54,4 +54,6 @@ public:
static void SetMaximumWantedLevel(int32 level);
};
+#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CWanted) == 0x204, "CWanted: error");
+#endif
diff --git a/src/core/World.h b/src/core/World.h
index ab3f0192..6fc6681d 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -45,7 +45,11 @@ class CSector
public:
CPtrList m_lists[NUMSECTORENTITYLISTS];
};
+
+
+#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CSector) == 0x28, "CSector: error");
+#endif
class CEntity;
struct CColPoint;
diff --git a/src/core/common.h b/src/core/common.h
index ff8580a1..41773877 100644
--- a/src/core/common.h
+++ b/src/core/common.h
@@ -226,7 +226,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define _TODO(x)
#define _TODOCONST(x) (x)
+#ifdef CHECK_STRUCT_SIZES
#define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc)
+#else
+#define VALIDATE_SIZE(struc, size)
+#endif
#define VALIDATE_OFFSET(struc, member, offset) static_assert(offsetof(struc, member) == offset, "The offset of " #member " in " #struc " is not " #offset "...")
#define PERCENT(x, p) ((float(x) * (float(p) / 100.0f)))