summaryrefslogtreecommitdiffstats
path: root/src/control
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/control
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/control')
-rw-r--r--src/control/AutoPilot.h3
-rw-r--r--src/control/Garages.h4
-rw-r--r--src/control/OnscreenTimer.h4
-rw-r--r--src/control/PathFind.h6
-rw-r--r--src/control/Phones.h2
-rw-r--r--src/control/Pickups.h2
-rw-r--r--src/control/Replay.h19
-rw-r--r--src/control/SceneEdit.cpp2
-rw-r--r--src/control/Script.cpp10
-rw-r--r--src/control/Script.h4
10 files changed, 36 insertions, 20 deletions
diff --git a/src/control/AutoPilot.h b/src/control/AutoPilot.h
index 345f4cb4..337a93c1 100644
--- a/src/control/AutoPilot.h
+++ b/src/control/AutoPilot.h
@@ -119,4 +119,5 @@ public:
#endif
};
-static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error"); \ No newline at end of file
+
+VALIDATE_SIZE(CAutoPilot, 0x70);
diff --git a/src/control/Garages.h b/src/control/Garages.h
index 3105f72d..00020eb3 100644
--- a/src/control/Garages.h
+++ b/src/control/Garages.h
@@ -75,7 +75,7 @@ public:
CVehicle* RestoreCar();
};
-static_assert(sizeof(CStoredCar) == 0x28, "CStoredCar");
+VALIDATE_SIZE(CStoredCar, 0x28);
#define SWITCH_GARAGE_DISTANCE_CLOSE 40.0f
@@ -172,7 +172,7 @@ class CGarage
friend class CCamera;
};
-static_assert(sizeof(CGarage) == 140, "CGarage");
+VALIDATE_SIZE(CGarage, 140);
class CGarages
{
diff --git a/src/control/OnscreenTimer.h b/src/control/OnscreenTimer.h
index fb139266..3ef7764a 100644
--- a/src/control/OnscreenTimer.h
+++ b/src/control/OnscreenTimer.h
@@ -26,7 +26,7 @@ public:
void ProcessForDisplayCounter();
};
-static_assert(sizeof(COnscreenTimerEntry) == 0x74, "COnscreenTimerEntry: error");
+VALIDATE_SIZE(COnscreenTimerEntry, 0x74);
class COnscreenTimer
{
@@ -46,4 +46,4 @@ public:
void AddClock(uint32 offset, char* text);
};
-static_assert(sizeof(COnscreenTimer) == 0x78, "COnscreenTimer: error"); \ No newline at end of file
+VALIDATE_SIZE(COnscreenTimer, 0x78);
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index 8049ea52..bbfdf7b7 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -41,7 +41,8 @@ struct CPedPathNode
CPedPathNode* prev;
CPedPathNode* next;
};
-static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error");
+
+VALIDATE_SIZE(CPedPathNode, 0x10);
class CPedPath {
public:
@@ -221,7 +222,8 @@ public:
void DisplayPathData(void);
};
-static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
+
+VALIDATE_SIZE(CPathFind, 0x49bf4);
extern CPathFind ThePaths;
diff --git a/src/control/Phones.h b/src/control/Phones.h
index 7fbf403f..14d47ed1 100644
--- a/src/control/Phones.h
+++ b/src/control/Phones.h
@@ -32,7 +32,7 @@ public:
~CPhone() { }
};
-static_assert(sizeof(CPhone) == 0x34, "CPhone: error");
+VALIDATE_SIZE(CPhone, 0x34);
class CPhoneInfo {
public:
diff --git a/src/control/Pickups.h b/src/control/Pickups.h
index 11da5f54..b05f5db7 100644
--- a/src/control/Pickups.h
+++ b/src/control/Pickups.h
@@ -47,7 +47,7 @@ private:
void Remove();
};
-static_assert(sizeof(CPickup) == 0x1C, "CPickup: error");
+VALIDATE_SIZE(CPickup, 0x1C);
struct tPickupMessage
{
diff --git a/src/control/Replay.h b/src/control/Replay.h
index bf70a28a..66bee3bf 100644
--- a/src/control/Replay.h
+++ b/src/control/Replay.h
@@ -108,7 +108,8 @@ class CReplay
CMatrix camera_pos;
CVector player_pos;
};
- static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error");
+
+ VALIDATE_SIZE(tGeneralPacket, 88);
struct tClockPacket
{
@@ -118,7 +119,7 @@ class CReplay
private:
uint8 __align;
};
- static_assert(sizeof(tClockPacket) == 4, "tClockPacket: error");
+ VALIDATE_SIZE(tClockPacket, 4);
struct tWeatherPacket
{
@@ -127,14 +128,14 @@ class CReplay
uint8 new_weather;
float interpolation;
};
- static_assert(sizeof(tWeatherPacket) == 8, "tWeatherPacket: error");
+ VALIDATE_SIZE(tWeatherPacket, 8);
struct tTimerPacket
{
uint8 type;
uint32 timer;
};
- static_assert(sizeof(tTimerPacket) == 8, "tTimerPacket: error");
+ VALIDATE_SIZE(tTimerPacket, 8);
struct tPedHeaderPacket
{
@@ -145,7 +146,7 @@ class CReplay
private:
uint8 __align[3];
};
- static_assert(sizeof(tPedHeaderPacket) == 8, "tPedHeaderPacket: error");
+ VALIDATE_SIZE(tPedHeaderPacket, 8);
struct tBulletTracePacket
{
@@ -156,7 +157,7 @@ class CReplay
CVector inf;
CVector sup;
};
- static_assert(sizeof(tBulletTracePacket) == 28, "tBulletTracePacket: error");
+ VALIDATE_SIZE(tBulletTracePacket, 28);
struct tEndOfFramePacket
{
@@ -164,7 +165,7 @@ class CReplay
private:
uint8 __align[3];
};
- static_assert(sizeof(tEndOfFramePacket) == 4, "tEndOfFramePacket: error");
+ VALIDATE_SIZE(tEndOfFramePacket, 4);
struct tPedUpdatePacket
{
@@ -177,7 +178,7 @@ class CReplay
int8 assoc_group_id;
uint8 weapon_model;
};
- static_assert(sizeof(tPedUpdatePacket) == 40, "tPedUpdatePacket: error");
+ VALIDATE_SIZE(tPedUpdatePacket, 40);
struct tVehicleUpdatePacket
{
@@ -202,7 +203,7 @@ class CReplay
uint8 primary_color;
uint8 secondary_color;
};
- static_assert(sizeof(tVehicleUpdatePacket) == 48, "tVehicleUpdatePacket: error");
+ VALIDATE_SIZE(tVehicleUpdatePacket, 48);
private:
static uint8 Mode;
diff --git a/src/control/SceneEdit.cpp b/src/control/SceneEdit.cpp
index 632ec94a..6aa64a3c 100644
--- a/src/control/SceneEdit.cpp
+++ b/src/control/SceneEdit.cpp
@@ -68,7 +68,9 @@ static const char* pCommandStrings[] = {
"Save Movie", "Load Movie", "Play Movie", "END"
};
+#ifdef CHECK_STRUCT_SIZES
static_assert(ARRAY_SIZE(pCommandStrings) == CSceneEdit::MOVIE_TOTAL_COMMANDS, "Scene edit: not all commands have names");
+#endif
static int32 NextValidModelId(int32 mi, int32 step)
{
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index a274c289..df3a489a 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -11205,7 +11205,9 @@ INITSAVEBUF
WriteSaveBuf(buf, varSpace);
for (uint32 i = 0; i < varSpace; i++)
WriteSaveBuf(buf, ScriptSpace[i]);
+#ifdef CHECK_STRUCT_SIZES
static_assert(SCRIPT_DATA_SIZE == 968, "CTheScripts::SaveAllScripts");
+#endif
uint32 script_data_size = SCRIPT_DATA_SIZE;
WriteSaveBuf(buf, script_data_size);
WriteSaveBuf(buf, OnAMissionFlag);
@@ -11631,12 +11633,16 @@ void CRunningScript::Save(uint8*& buf)
for (int i = 0; i < 8; i++)
WriteSaveBuf<char>(buf, m_abScriptName[i]);
WriteSaveBuf<uint32>(buf, m_nIp);
+#ifdef CHECK_STRUCT_SIZES
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
+#endif
for (int i = 0; i < MAX_STACK_DEPTH; i++)
WriteSaveBuf<uint32>(buf, m_anStack[i]);
WriteSaveBuf<uint16>(buf, m_nStackPointer);
SkipSaveBuf(buf, 2);
+#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
+#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
WriteSaveBuf<bool>(buf, m_bCondResult);
@@ -11662,12 +11668,16 @@ void CRunningScript::Load(uint8*& buf)
for (int i = 0; i < 8; i++)
m_abScriptName[i] = ReadSaveBuf<char>(buf);
m_nIp = ReadSaveBuf<uint32>(buf);
+#ifdef CHECK_STRUCT_SIZES
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
+#endif
for (int i = 0; i < MAX_STACK_DEPTH; i++)
m_anStack[i] = ReadSaveBuf<uint32>(buf);
m_nStackPointer = ReadSaveBuf<uint16>(buf);
SkipSaveBuf(buf, 2);
+#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
+#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
m_bCondResult = ReadSaveBuf<bool>(buf);
diff --git a/src/control/Script.h b/src/control/Script.h
index 01cad269..acab66cc 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -27,7 +27,7 @@ struct intro_script_rectangle
~intro_script_rectangle() { }
};
-static_assert(sizeof(intro_script_rectangle) == 0x18, "Script.h: error");
+VALIDATE_SIZE(intro_script_rectangle, 0x18);
enum {
SCRIPT_TEXT_MAX_LENGTH = 500
@@ -78,7 +78,7 @@ struct intro_text_line
}
};
-static_assert(sizeof(intro_text_line) == 0x414, "Script.h: error");
+VALIDATE_SIZE(intro_text_line, 0x414);
struct script_sphere_struct
{