summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-10 19:42:04 +0200
committerGitHub <noreply@github.com>2020-05-10 19:42:04 +0200
commit05021ed1e1e5374b38f9ce2912c310c04d358f6d (patch)
treeb9d849f3fc61246f0038e5bec53ef8f61b040b83 /src/core
parentsome fixes and cosmetic changes (diff)
parentMerge remote-tracking branch 'upstream/master' (diff)
downloadre3-05021ed1e1e5374b38f9ce2912c310c04d358f6d.tar
re3-05021ed1e1e5374b38f9ce2912c310c04d358f6d.tar.gz
re3-05021ed1e1e5374b38f9ce2912c310c04d358f6d.tar.bz2
re3-05021ed1e1e5374b38f9ce2912c310c04d358f6d.tar.lz
re3-05021ed1e1e5374b38f9ce2912c310c04d358f6d.tar.xz
re3-05021ed1e1e5374b38f9ce2912c310c04d358f6d.tar.zst
re3-05021ed1e1e5374b38f9ce2912c310c04d358f6d.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/Camera.h20
-rw-r--r--src/core/CdStream.cpp1
-rw-r--r--src/core/CdStream.h1
-rw-r--r--src/core/Frontend.h2
-rw-r--r--src/core/Placeable.h3
-rw-r--r--src/core/PlayerInfo.h3
-rw-r--r--src/core/Radar.h2
-rw-r--r--src/core/Wanted.h2
-rw-r--r--src/core/World.h3
-rw-r--r--src/core/common.h4
10 files changed, 18 insertions, 23 deletions
diff --git a/src/core/Camera.h b/src/core/Camera.h
index 51138f99..94bcbd23 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -260,9 +260,8 @@ public:
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowCar_SA(const CVector &CameraTarget, float TargetOrientation, float, float);
};
-static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size");
-static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error");
-static_assert(offsetof(CCam, Front) == 0x140, "CCam: error");
+
+VALIDATE_SIZE(CCam, 0x1A4);
class CCamPathSplines
{
@@ -637,19 +636,8 @@ uint32 unknown; // some counter having to do with music
bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
};
-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");
-static_assert(offsetof(CCamera, m_uiNumberOfTrainCamNodes) == 0x84, "CCamera: error");
-static_assert(offsetof(CCamera, m_uiTransitionState) == 0x89, "CCamera: error");
-static_assert(offsetof(CCamera, m_uiTimeTransitionStart) == 0x94, "CCamera: error");
-static_assert(offsetof(CCamera, m_BlurBlue) == 0x9C, "CCamera: error");
-static_assert(offsetof(CCamera, Cams) == 0x1A4, "CCamera: error");
-static_assert(offsetof(CCamera, pToGarageWeAreIn) == 0x690, "CCamera: error");
-static_assert(offsetof(CCamera, m_PreviousCameraPosition) == 0x6B0, "CCamera: error");
-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");
+
+VALIDATE_SIZE(CCamera, 0xE9D8);
extern CCamera TheCamera;
diff --git a/src/core/CdStream.cpp b/src/core/CdStream.cpp
index ea79fb9a..666041e1 100644
--- a/src/core/CdStream.cpp
+++ b/src/core/CdStream.cpp
@@ -22,6 +22,7 @@ struct CdReadInfo
HANDLE hFile;
OVERLAPPED Overlapped;
};
+
VALIDATE_SIZE(CdReadInfo, 0x30);
char gCdImageNames[MAX_CDIMAGES+1][64];
diff --git a/src/core/CdStream.h b/src/core/CdStream.h
index 9ef71b65..ba6c63a3 100644
--- a/src/core/CdStream.h
+++ b/src/core/CdStream.h
@@ -27,7 +27,6 @@ struct Queue
VALIDATE_SIZE(Queue, 0x10);
-
void CdStreamInitThread(void);
void CdStreamInit(int32 numChannels);
uint32 GetGTA3ImgSize(void);
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 3286f275..e496f9c0 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -658,7 +658,7 @@ public:
};
#ifndef IMPROVED_VIDEOMODE
-static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");
+VALIDATE_SIZE(CMenuManager, 0x564);
#endif
extern CMenuManager FrontEndMenuManager;
diff --git a/src/core/Placeable.h b/src/core/Placeable.h
index 7e858283..970c0d48 100644
--- a/src/core/Placeable.h
+++ b/src/core/Placeable.h
@@ -31,4 +31,5 @@ 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
+
+VALIDATE_SIZE(CPlaceable, 0x4C);
diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h
index e970e42d..94410753 100644
--- a/src/core/PlayerInfo.h
+++ b/src/core/PlayerInfo.h
@@ -80,4 +80,5 @@ public:
~CPlayerInfo() { };
};
-static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
+
+VALIDATE_SIZE(CPlayerInfo, 0x13C);
diff --git a/src/core/Radar.h b/src/core/Radar.h
index e39a17f0..7d07671d 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -71,7 +71,7 @@ struct sRadarTrace
uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite
};
-static_assert(sizeof(sRadarTrace) == 0x30, "sRadarTrace: error");
+VALIDATE_SIZE(sRadarTrace, 0x30);
// Values for screen space
#define RADAR_LEFT (40.0f)
diff --git a/src/core/Wanted.h b/src/core/Wanted.h
index e3e407b0..de36c442 100644
--- a/src/core/Wanted.h
+++ b/src/core/Wanted.h
@@ -54,4 +54,4 @@ public:
static void SetMaximumWantedLevel(int32 level);
};
-static_assert(sizeof(CWanted) == 0x204, "CWanted: error");
+VALIDATE_SIZE(CWanted, 0x204);
diff --git a/src/core/World.h b/src/core/World.h
index ab3f0192..2bcc4e43 100644
--- a/src/core/World.h
+++ b/src/core/World.h
@@ -45,7 +45,8 @@ class CSector
public:
CPtrList m_lists[NUMSECTORENTITYLISTS];
};
-static_assert(sizeof(CSector) == 0x28, "CSector: error");
+
+VALIDATE_SIZE(CSector, 0x28);
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)))