Merge pull request #531 from Bigbossbro08/master

Defined all asserts
This commit is contained in:
aap 2020-05-10 19:42:04 +02:00 committed by GitHub
commit 05021ed1e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
72 changed files with 157 additions and 119 deletions

View File

@ -84,4 +84,5 @@ public:
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link)); return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));
} }
}; };
static_assert(sizeof(CAnimBlendAssociation) == 0x40, "CAnimBlendAssociation: error");
VALIDATE_SIZE(CAnimBlendAssociation, 0x40);

View File

@ -26,7 +26,7 @@ struct AnimBlendFrameData
#endif #endif
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(AnimBlendFrameData) == 0x14, "AnimBlendFrameData: error"); VALIDATE_SIZE(AnimBlendFrameData, 0x14);
#endif #endif
@ -51,5 +51,5 @@ public:
void ForAllFrames(void (*cb)(AnimBlendFrameData*, void*), void *arg); void ForAllFrames(void (*cb)(AnimBlendFrameData*, void*), void *arg);
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(CAnimBlendClumpData) == 0x14, "CAnimBlendClumpData: error"); VALIDATE_SIZE(CAnimBlendClumpData, 0x14);
#endif #endif

View File

@ -24,4 +24,5 @@ public:
void Uncompress(void); void Uncompress(void);
void RemoveUncompressedData(void); void RemoveUncompressedData(void);
}; };
static_assert(sizeof(CAnimBlendHierarchy) == 0x28, "CAnimBlendHierarchy: error");
VALIDATE_SIZE(CAnimBlendHierarchy, 0x28);

View File

@ -26,4 +26,6 @@ public:
void GetCurrentTranslation(CVector &trans, float weight); void GetCurrentTranslation(CVector &trans, float weight);
void GetEndTranslation(CVector &trans, float weight); void GetEndTranslation(CVector &trans, float weight);
}; };
static_assert(sizeof(CAnimBlendNode) == 0x1C, "CAnimBlendNode: error");
VALIDATE_SIZE(CAnimBlendNode, 0x1C);

View File

@ -51,5 +51,5 @@ public:
#endif #endif
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(CAnimBlendSequence) == 0x2C, "CAnimBlendSequence: error"); VALIDATE_SIZE(CAnimBlendSequence, 0x2C);
#endif #endif

View File

@ -20,7 +20,7 @@ public:
// no methods // no methods
}; };
static_assert(sizeof(cAudioCollision) == 40, "cAudioCollision: error"); VALIDATE_SIZE(cAudioCollision, 40);
class cAudioCollisionManager class cAudioCollisionManager
{ {
@ -35,4 +35,4 @@ public:
void AddCollisionToRequestedQueue(); void AddCollisionToRequestedQueue();
}; };
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error"); VALIDATE_SIZE(cAudioCollisionManager, 852);

View File

@ -35,7 +35,7 @@ public:
int8 m_nVolumeChange; int8 m_nVolumeChange;
}; };
static_assert(sizeof(tSound) == 92, "tSound: error"); VALIDATE_SIZE(tSound, 92);
class CPhysical; class CPhysical;
class CAutomobile; class CAutomobile;
@ -52,7 +52,7 @@ public:
uint8 m_AudioEvents; uint8 m_AudioEvents;
}; };
static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error"); VALIDATE_SIZE(tAudioEntity, 40);
class tPedComment class tPedComment
{ {
@ -65,7 +65,7 @@ public:
int8 m_nProcess; int8 m_nProcess;
}; };
static_assert(sizeof(tPedComment) == 28, "tPedComment: error"); VALIDATE_SIZE(tPedComment, 28);
class cPedComments class cPedComments
{ {
@ -80,7 +80,7 @@ public:
void Process(); void Process();
}; };
static_assert(sizeof(cPedComments) == 1164, "cPedComments: error"); VALIDATE_SIZE(cPedComments, 1164);
class CEntity; class CEntity;
@ -96,8 +96,7 @@ public:
int32 m_nMissionAudioCounter; int32 m_nMissionAudioCounter;
bool m_bIsPlayed; bool m_bIsPlayed;
}; };
VALIDATE_SIZE(cMissionAudio, 32);
static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
// name made up // name made up
class cAudioScriptObjectManager class cAudioScriptObjectManager
@ -135,7 +134,7 @@ public:
float m_fVelocityChange; float m_fVelocityChange;
}; };
static_assert(sizeof(cVehicleParams) == 0x18, "cVehicleParams: error"); VALIDATE_SIZE(cVehicleParams, 0x18);
enum { enum {
/* /*

View File

@ -148,6 +148,6 @@ public:
static void SaveAllAudioScriptObjects(uint8 *buf, uint32 *size); static void SaveAllAudioScriptObjects(uint8 *buf, uint32 *size);
}; };
static_assert(sizeof(cAudioScriptObject) == 20, "cAudioScriptObject: error"); VALIDATE_SIZE(cAudioScriptObject, 20);
extern void PlayOneShotScriptObject(uint8 id, CVector const &pos); extern void PlayOneShotScriptObject(uint8 id, CVector const &pos);

View File

@ -84,6 +84,6 @@ public:
bool ChangeRadioChannel(); bool ChangeRadioChannel();
}; };
static_assert(sizeof(cMusicManager) == 0x95C, "cMusicManager: error"); VALIDATE_SIZE(cMusicManager, 0x95C);
extern cMusicManager MusicManager; extern cMusicManager MusicManager;

View File

@ -15,7 +15,7 @@ struct cAMCrime {
} }
}; };
static_assert(sizeof(cAMCrime) == 20, "cAMCrime: error "); VALIDATE_SIZE(cAMCrime, 20);
class cPoliceRadioQueue class cPoliceRadioQueue
{ {
@ -43,4 +43,4 @@ public:
} }
}; };
static_assert(sizeof(cPoliceRadioQueue) == 444, "cPoliceRadioQueue: error "); VALIDATE_SIZE(cPoliceRadioQueue, 444);

View File

@ -119,4 +119,5 @@ public:
#endif #endif
}; };
static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error");
VALIDATE_SIZE(CAutoPilot, 0x70);

View File

@ -75,7 +75,7 @@ public:
CVehicle* RestoreCar(); CVehicle* RestoreCar();
}; };
static_assert(sizeof(CStoredCar) == 0x28, "CStoredCar"); VALIDATE_SIZE(CStoredCar, 0x28);
#define SWITCH_GARAGE_DISTANCE_CLOSE 40.0f #define SWITCH_GARAGE_DISTANCE_CLOSE 40.0f
@ -172,7 +172,7 @@ class CGarage
friend class CCamera; friend class CCamera;
}; };
static_assert(sizeof(CGarage) == 140, "CGarage"); VALIDATE_SIZE(CGarage, 140);
class CGarages class CGarages
{ {

View File

@ -26,7 +26,7 @@ public:
void ProcessForDisplayCounter(); void ProcessForDisplayCounter();
}; };
static_assert(sizeof(COnscreenTimerEntry) == 0x74, "COnscreenTimerEntry: error"); VALIDATE_SIZE(COnscreenTimerEntry, 0x74);
class COnscreenTimer class COnscreenTimer
{ {
@ -46,4 +46,4 @@ public:
void AddClock(uint32 offset, char* text); void AddClock(uint32 offset, char* text);
}; };
static_assert(sizeof(COnscreenTimer) == 0x78, "COnscreenTimer: error"); VALIDATE_SIZE(COnscreenTimer, 0x78);

View File

@ -41,7 +41,8 @@ struct CPedPathNode
CPedPathNode* prev; CPedPathNode* prev;
CPedPathNode* next; CPedPathNode* next;
}; };
static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error");
VALIDATE_SIZE(CPedPathNode, 0x10);
class CPedPath { class CPedPath {
public: public:
@ -221,7 +222,8 @@ public:
void DisplayPathData(void); void DisplayPathData(void);
}; };
static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
VALIDATE_SIZE(CPathFind, 0x49bf4);
extern CPathFind ThePaths; extern CPathFind ThePaths;

View File

@ -32,7 +32,7 @@ public:
~CPhone() { } ~CPhone() { }
}; };
static_assert(sizeof(CPhone) == 0x34, "CPhone: error"); VALIDATE_SIZE(CPhone, 0x34);
class CPhoneInfo { class CPhoneInfo {
public: public:

View File

@ -47,7 +47,7 @@ private:
void Remove(); void Remove();
}; };
static_assert(sizeof(CPickup) == 0x1C, "CPickup: error"); VALIDATE_SIZE(CPickup, 0x1C);
struct tPickupMessage struct tPickupMessage
{ {

View File

@ -108,7 +108,8 @@ class CReplay
CMatrix camera_pos; CMatrix camera_pos;
CVector player_pos; CVector player_pos;
}; };
static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error");
VALIDATE_SIZE(tGeneralPacket, 88);
struct tClockPacket struct tClockPacket
{ {
@ -118,7 +119,7 @@ class CReplay
private: private:
uint8 __align; uint8 __align;
}; };
static_assert(sizeof(tClockPacket) == 4, "tClockPacket: error"); VALIDATE_SIZE(tClockPacket, 4);
struct tWeatherPacket struct tWeatherPacket
{ {
@ -127,14 +128,14 @@ class CReplay
uint8 new_weather; uint8 new_weather;
float interpolation; float interpolation;
}; };
static_assert(sizeof(tWeatherPacket) == 8, "tWeatherPacket: error"); VALIDATE_SIZE(tWeatherPacket, 8);
struct tTimerPacket struct tTimerPacket
{ {
uint8 type; uint8 type;
uint32 timer; uint32 timer;
}; };
static_assert(sizeof(tTimerPacket) == 8, "tTimerPacket: error"); VALIDATE_SIZE(tTimerPacket, 8);
struct tPedHeaderPacket struct tPedHeaderPacket
{ {
@ -145,7 +146,7 @@ class CReplay
private: private:
uint8 __align[3]; uint8 __align[3];
}; };
static_assert(sizeof(tPedHeaderPacket) == 8, "tPedHeaderPacket: error"); VALIDATE_SIZE(tPedHeaderPacket, 8);
struct tBulletTracePacket struct tBulletTracePacket
{ {
@ -156,7 +157,7 @@ class CReplay
CVector inf; CVector inf;
CVector sup; CVector sup;
}; };
static_assert(sizeof(tBulletTracePacket) == 28, "tBulletTracePacket: error"); VALIDATE_SIZE(tBulletTracePacket, 28);
struct tEndOfFramePacket struct tEndOfFramePacket
{ {
@ -164,7 +165,7 @@ class CReplay
private: private:
uint8 __align[3]; uint8 __align[3];
}; };
static_assert(sizeof(tEndOfFramePacket) == 4, "tEndOfFramePacket: error"); VALIDATE_SIZE(tEndOfFramePacket, 4);
struct tPedUpdatePacket struct tPedUpdatePacket
{ {
@ -177,7 +178,7 @@ class CReplay
int8 assoc_group_id; int8 assoc_group_id;
uint8 weapon_model; uint8 weapon_model;
}; };
static_assert(sizeof(tPedUpdatePacket) == 40, "tPedUpdatePacket: error"); VALIDATE_SIZE(tPedUpdatePacket, 40);
struct tVehicleUpdatePacket struct tVehicleUpdatePacket
{ {
@ -202,7 +203,7 @@ class CReplay
uint8 primary_color; uint8 primary_color;
uint8 secondary_color; uint8 secondary_color;
}; };
static_assert(sizeof(tVehicleUpdatePacket) == 48, "tVehicleUpdatePacket: error"); VALIDATE_SIZE(tVehicleUpdatePacket, 48);
private: private:
static uint8 Mode; static uint8 Mode;

View File

@ -68,7 +68,9 @@ static const char* pCommandStrings[] = {
"Save Movie", "Load Movie", "Play Movie", "END" "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"); static_assert(ARRAY_SIZE(pCommandStrings) == CSceneEdit::MOVIE_TOTAL_COMMANDS, "Scene edit: not all commands have names");
#endif
static int32 NextValidModelId(int32 mi, int32 step) static int32 NextValidModelId(int32 mi, int32 step)
{ {

View File

@ -11205,7 +11205,9 @@ INITSAVEBUF
WriteSaveBuf(buf, varSpace); WriteSaveBuf(buf, varSpace);
for (uint32 i = 0; i < varSpace; i++) for (uint32 i = 0; i < varSpace; i++)
WriteSaveBuf(buf, ScriptSpace[i]); WriteSaveBuf(buf, ScriptSpace[i]);
#ifdef CHECK_STRUCT_SIZES
static_assert(SCRIPT_DATA_SIZE == 968, "CTheScripts::SaveAllScripts"); static_assert(SCRIPT_DATA_SIZE == 968, "CTheScripts::SaveAllScripts");
#endif
uint32 script_data_size = SCRIPT_DATA_SIZE; uint32 script_data_size = SCRIPT_DATA_SIZE;
WriteSaveBuf(buf, script_data_size); WriteSaveBuf(buf, script_data_size);
WriteSaveBuf(buf, OnAMissionFlag); WriteSaveBuf(buf, OnAMissionFlag);
@ -11631,12 +11633,16 @@ void CRunningScript::Save(uint8*& buf)
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
WriteSaveBuf<char>(buf, m_abScriptName[i]); WriteSaveBuf<char>(buf, m_abScriptName[i]);
WriteSaveBuf<uint32>(buf, m_nIp); WriteSaveBuf<uint32>(buf, m_nIp);
#ifdef CHECK_STRUCT_SIZES
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6"); static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
#endif
for (int i = 0; i < MAX_STACK_DEPTH; i++) for (int i = 0; i < MAX_STACK_DEPTH; i++)
WriteSaveBuf<uint32>(buf, m_anStack[i]); WriteSaveBuf<uint32>(buf, m_anStack[i]);
WriteSaveBuf<uint16>(buf, m_nStackPointer); WriteSaveBuf<uint16>(buf, m_nStackPointer);
SkipSaveBuf(buf, 2); SkipSaveBuf(buf, 2);
#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18"); 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++) for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]); WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
WriteSaveBuf<bool>(buf, m_bCondResult); WriteSaveBuf<bool>(buf, m_bCondResult);
@ -11662,12 +11668,16 @@ void CRunningScript::Load(uint8*& buf)
for (int i = 0; i < 8; i++) for (int i = 0; i < 8; i++)
m_abScriptName[i] = ReadSaveBuf<char>(buf); m_abScriptName[i] = ReadSaveBuf<char>(buf);
m_nIp = ReadSaveBuf<uint32>(buf); m_nIp = ReadSaveBuf<uint32>(buf);
#ifdef CHECK_STRUCT_SIZES
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6"); static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
#endif
for (int i = 0; i < MAX_STACK_DEPTH; i++) for (int i = 0; i < MAX_STACK_DEPTH; i++)
m_anStack[i] = ReadSaveBuf<uint32>(buf); m_anStack[i] = ReadSaveBuf<uint32>(buf);
m_nStackPointer = ReadSaveBuf<uint16>(buf); m_nStackPointer = ReadSaveBuf<uint16>(buf);
SkipSaveBuf(buf, 2); SkipSaveBuf(buf, 2);
#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18"); 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++) for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf); m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
m_bCondResult = ReadSaveBuf<bool>(buf); m_bCondResult = ReadSaveBuf<bool>(buf);

View File

@ -27,7 +27,7 @@ struct intro_script_rectangle
~intro_script_rectangle() { } ~intro_script_rectangle() { }
}; };
static_assert(sizeof(intro_script_rectangle) == 0x18, "Script.h: error"); VALIDATE_SIZE(intro_script_rectangle, 0x18);
enum { enum {
SCRIPT_TEXT_MAX_LENGTH = 500 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 struct script_sphere_struct
{ {

View File

@ -260,9 +260,8 @@ public:
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
void Process_FollowCar_SA(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"); VALIDATE_SIZE(CCam, 0x1A4);
static_assert(offsetof(CCam, Front) == 0x140, "CCam: error");
class CCamPathSplines class CCamPathSplines
{ {
@ -637,19 +636,8 @@ uint32 unknown; // some counter having to do with music
bool IsSphereVisible(const CVector &center, float radius); bool IsSphereVisible(const CVector &center, float radius);
bool IsBoxVisible(RwV3d *box, const CMatrix *mat); bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
}; };
static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error");
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error"); VALIDATE_SIZE(CCamera, 0xE9D8);
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");
extern CCamera TheCamera; extern CCamera TheCamera;

View File

@ -22,6 +22,7 @@ struct CdReadInfo
HANDLE hFile; HANDLE hFile;
OVERLAPPED Overlapped; OVERLAPPED Overlapped;
}; };
VALIDATE_SIZE(CdReadInfo, 0x30); VALIDATE_SIZE(CdReadInfo, 0x30);
char gCdImageNames[MAX_CDIMAGES+1][64]; char gCdImageNames[MAX_CDIMAGES+1][64];

View File

@ -27,7 +27,6 @@ struct Queue
VALIDATE_SIZE(Queue, 0x10); VALIDATE_SIZE(Queue, 0x10);
void CdStreamInitThread(void); void CdStreamInitThread(void);
void CdStreamInit(int32 numChannels); void CdStreamInit(int32 numChannels);
uint32 GetGTA3ImgSize(void); uint32 GetGTA3ImgSize(void);

View File

@ -658,7 +658,7 @@ public:
}; };
#ifndef IMPROVED_VIDEOMODE #ifndef IMPROVED_VIDEOMODE
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error"); VALIDATE_SIZE(CMenuManager, 0x564);
#endif #endif
extern CMenuManager FrontEndMenuManager; extern CMenuManager FrontEndMenuManager;

View File

@ -31,4 +31,5 @@ public:
bool IsWithinArea(float x1, float y1, float x2, float y2); bool IsWithinArea(float x1, float y1, float x2, float y2);
bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2); bool IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2);
}; };
static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error");
VALIDATE_SIZE(CPlaceable, 0x4C);

View File

@ -80,4 +80,5 @@ public:
~CPlayerInfo() { }; ~CPlayerInfo() { };
}; };
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
VALIDATE_SIZE(CPlayerInfo, 0x13C);

View File

@ -71,7 +71,7 @@ struct sRadarTrace
uint16 m_eBlipDisplay; // eBlipDisplay uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite uint16 m_eRadarSprite; // eRadarSprite
}; };
static_assert(sizeof(sRadarTrace) == 0x30, "sRadarTrace: error"); VALIDATE_SIZE(sRadarTrace, 0x30);
// Values for screen space // Values for screen space
#define RADAR_LEFT (40.0f) #define RADAR_LEFT (40.0f)

View File

@ -54,4 +54,4 @@ public:
static void SetMaximumWantedLevel(int32 level); static void SetMaximumWantedLevel(int32 level);
}; };
static_assert(sizeof(CWanted) == 0x204, "CWanted: error"); VALIDATE_SIZE(CWanted, 0x204);

View File

@ -45,7 +45,8 @@ class CSector
public: public:
CPtrList m_lists[NUMSECTORENTITYLISTS]; CPtrList m_lists[NUMSECTORENTITYLISTS];
}; };
static_assert(sizeof(CSector) == 0x28, "CSector: error");
VALIDATE_SIZE(CSector, 0x28);
class CEntity; class CEntity;
struct CColPoint; struct CColPoint;

View File

@ -226,7 +226,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
#define _TODO(x) #define _TODO(x)
#define _TODOCONST(x) (x) #define _TODOCONST(x) (x)
#ifdef CHECK_STRUCT_SIZES
#define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc) #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 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))) #define PERCENT(x, p) ((float(x) * (float(p) / 100.0f)))

View File

@ -16,4 +16,6 @@ public:
virtual bool GetIsATreadable(void) { return false; } virtual bool GetIsATreadable(void) { return false; }
}; };
static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error");
VALIDATE_SIZE(CBuilding, 0x64);

View File

@ -15,4 +15,6 @@ public:
static void *operator new(size_t); static void *operator new(size_t);
static void operator delete(void*, size_t); static void operator delete(void*, size_t);
}; };
static_assert(sizeof(CDummy) == 0x68, "CDummy: error");
VALIDATE_SIZE(CDummy, 0x68);

View File

@ -172,4 +172,5 @@ public:
static void AddSteamsFromGround(CPtrList& list); static void AddSteamsFromGround(CPtrList& list);
}; };
static_assert(sizeof(CEntity) == 0x64, "CEntity: error");
VALIDATE_SIZE(CEntity, 0x64);

View File

@ -160,4 +160,5 @@ public:
bool CheckCollision(void); bool CheckCollision(void);
bool CheckCollision_SimpleCar(void); bool CheckCollision_SimpleCar(void);
}; };
static_assert(sizeof(CPhysical) == 0x128, "CPhysical: error");
VALIDATE_SIZE(CPhysical, 0x128);

View File

@ -12,4 +12,6 @@ public:
bool GetIsATreadable(void) { return true; } bool GetIsATreadable(void) { return true; }
}; };
static_assert(sizeof(CTreadable) == 0x94, "CTreadable: error");
VALIDATE_SIZE(CTreadable, 0x94);

View File

@ -15,7 +15,7 @@ enum ModelInfoType : uint8
MITYPE_PED = 6, MITYPE_PED = 6,
MITYPE_XTRACOMPS = 7, MITYPE_XTRACOMPS = 7,
}; };
static_assert(sizeof(ModelInfoType) == 1, "ModeInfoType: error"); VALIDATE_SIZE(ModelInfoType, 1);
class C2dEffect; class C2dEffect;
@ -70,4 +70,4 @@ public:
uint16 GetNumRefs() const { return m_refCount; } uint16 GetNumRefs() const { return m_refCount; }
}; };
static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error"); VALIDATE_SIZE(CBaseModelInfo, 0x30);

View File

@ -50,4 +50,5 @@ public:
static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data); static RwFrame *FillFrameArrayCB(RwFrame *frame, void *data);
static RwFrame *GetFrameFromId(RpClump *clump, int32 id); static RwFrame *GetFrameFromId(RpClump *clump, int32 id);
}; };
static_assert(sizeof(CClumpModelInfo) == 0x34, "CClumpModelInfo: error");
VALIDATE_SIZE(CClumpModelInfo, 0x34);

View File

@ -56,5 +56,5 @@ public:
#endif #endif
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(CPedModelInfo) == 0x48, "CPedModelInfo: error"); VALIDATE_SIZE(CPedModelInfo, 0x48);
#endif #endif

View File

@ -49,4 +49,5 @@ public:
void SetRelatedModel(CSimpleModelInfo *m){ void SetRelatedModel(CSimpleModelInfo *m){
m_atomics[2] = (RpAtomic*)m; } m_atomics[2] = (RpAtomic*)m; }
}; };
static_assert(sizeof(CSimpleModelInfo) == 0x4C, "CSimpleModelInfo: error");
VALIDATE_SIZE(CSimpleModelInfo, 0x4C);

View File

@ -17,4 +17,5 @@ public:
void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; } void SetOtherTimeModel(int32 other) { m_otherTimeModelID = other; }
CTimeModelInfo *FindOtherTimeModel(void); CTimeModelInfo *FindOtherTimeModel(void);
}; };
static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error");
VALIDATE_SIZE(CTimeModelInfo, 0x58);

View File

@ -123,4 +123,5 @@ public:
static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id); static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id);
static void SetComponentsToUse(int8 c1, int8 c2) { ms_compsToUse[0] = c1; ms_compsToUse[1] = c2; } static void SetComponentsToUse(int8 c1, int8 c2) { ms_compsToUse[0] = c1; ms_compsToUse[1] = c2; }
}; };
static_assert(sizeof(CVehicleModelInfo) == 0x1F8, "CVehicleModelInfo: error");
VALIDATE_SIZE(CVehicleModelInfo, 0x1F8);

View File

@ -24,5 +24,5 @@ public:
void PlayAnimation(const char *animName); void PlayAnimation(const char *animName);
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(CCutsceneHead) == 0x19C, "CCutsceneHead: error"); VALIDATE_SIZE(CCutsceneHead, 0x19C);
#endif #endif

View File

@ -29,5 +29,5 @@ public:
void RemoveLighting(bool reset); void RemoveLighting(bool reset);
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(CCutsceneObject) == 0x198, "CCutsceneObject: error"); VALIDATE_SIZE(CCutsceneObject, 0x198);
#endif #endif

View File

@ -10,4 +10,5 @@ public:
CDummyObject(void) {} CDummyObject(void) {}
CDummyObject(CObject *obj); CDummyObject(CObject *obj);
}; };
static_assert(sizeof(CDummyObject) == 0x68, "CDummyObject: error");
VALIDATE_SIZE(CDummyObject, 0x68);

View File

@ -97,4 +97,5 @@ public:
static void DeleteAllTempObjects(); static void DeleteAllTempObjects();
static void DeleteAllTempObjectsInArea(CVector point, float fRadius); static void DeleteAllTempObjectsInArea(CVector point, float fRadius);
}; };
static_assert(sizeof(CObject) == 0x198, "CObject: error");
VALIDATE_SIZE(CObject, 0x198);

View File

@ -16,7 +16,7 @@ public:
uint8 m_nSpecialCollisionResponseCases; uint8 m_nSpecialCollisionResponseCases;
bool m_bCameraToAvoidThisObject; bool m_bCameraToAvoidThisObject;
}; };
static_assert(sizeof(CObjectInfo) == 0x20, "CObjectInfo: error"); VALIDATE_SIZE(CObjectInfo, 0x20);
class CObjectData class CObjectData
{ {

View File

@ -12,5 +12,5 @@ public:
void ProcessControl(void); void ProcessControl(void);
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(CCivilianPed) == 0x53C, "CCivilianPed: error"); VALIDATE_SIZE(CCivilianPed, 0x53C);
#endif #endif

View File

@ -37,5 +37,5 @@ public:
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(CCopPed) == 0x558, "CCopPed: error"); VALIDATE_SIZE(CCopPed, 0x558);
#endif #endif

View File

@ -8,4 +8,5 @@ class CDummyPed : CDummy
int32 pedType; int32 pedType;
int32 unknown; int32 unknown;
}; };
static_assert(sizeof(CDummyPed) == 0x70, "CDummyPed: error");
VALIDATE_SIZE(CDummyPed, 0x70);

View File

@ -37,5 +37,5 @@ public:
void MedicAI(void); void MedicAI(void);
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error"); VALIDATE_SIZE(CEmergencyPed, 0x554);
#endif #endif

View File

@ -10,7 +10,7 @@ struct CGangInfo
CGangInfo(); CGangInfo();
}; };
static_assert(sizeof(CGangInfo) == 0x10, "CGangInfo: error"); VALIDATE_SIZE(CGangInfo, 0x10);
enum { enum {
GANG_MAFIA = 0, GANG_MAFIA = 0,

View File

@ -82,7 +82,7 @@ struct FightMove
uint8 damage; uint8 damage;
uint8 flags; uint8 flags;
}; };
static_assert(sizeof(FightMove) == 0x18, "FightMove: error"); VALIDATE_SIZE(FightMove, 0x18);
// TODO: This is eFightState on mobile. // TODO: This is eFightState on mobile.
enum PedFightMoves enum PedFightMoves
@ -896,16 +896,5 @@ public:
void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg); void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg);
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(offsetof(CPed, m_nPedState) == 0x224, "CPed: error"); VALIDATE_SIZE(CPed, 0x53C);
static_assert(offsetof(CPed, m_pCurSurface) == 0x2FC, "CPed: error");
static_assert(offsetof(CPed, m_pMyVehicle) == 0x310, "CPed: error");
static_assert(offsetof(CPed, m_nPedType) == 0x32C, "CPed: error");
static_assert(offsetof(CPed, m_pCollidingEntity) == 0x34C, "CPed: error");
static_assert(offsetof(CPed, m_weapons) == 0x35C, "CPed: error");
static_assert(offsetof(CPed, m_currentWeapon) == 0x498, "CPed: error");
static_assert(offsetof(CPed, m_lookTimer) == 0x4CC, "CPed: error");
static_assert(offsetof(CPed, m_bodyPartBleeding) == 0x4F2, "CPed: error");
static_assert(offsetof(CPed, m_pedInObjective) == 0x16C, "CPed: error");
static_assert(offsetof(CPed, m_pEventEntity) == 0x19C, "CPed: error");
static_assert(sizeof(CPed) == 0x53C, "CPed: error");
#endif #endif

View File

@ -64,4 +64,5 @@ public:
bool LookAtPosition(CVector const& pos); bool LookAtPosition(CVector const& pos);
bool RestoreLookAt(void); bool RestoreLookAt(void);
}; };
static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error");
VALIDATE_SIZE(CPedIK, 0x28);

View File

@ -76,4 +76,5 @@ public:
static void LoadPedStats(void); static void LoadPedStats(void);
static ePedStats GetPedStatType(char *name); static ePedStats GetPedStatType(char *name);
}; };
static_assert(sizeof(CPedStats) == 0x34, "CPedStats: error");
VALIDATE_SIZE(CPedStats, 0x34);

View File

@ -91,4 +91,4 @@ public:
static bool IsThreat(int type, int threat) { return ms_apPedType[type]->m_threats & threat; } static bool IsThreat(int type, int threat) { return ms_apPedType[type]->m_threats & threat; }
}; };
static_assert(sizeof(CPedType) == 0x20, "CPedType: error"); VALIDATE_SIZE(CPedType, 0x20);

View File

@ -85,5 +85,5 @@ public:
}; };
#ifndef PED_SKIN #ifndef PED_SKIN
static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error"); VALIDATE_SIZE(CPlayerPed, 0x5F0);
#endif #endif

View File

@ -89,4 +89,5 @@ public:
} }
} }
}; };
static_assert(sizeof(C2dEffect) == 0x34, "C2dEffect: error");
VALIDATE_SIZE(C2dEffect, 0x34);

View File

@ -38,7 +38,8 @@ struct CRegisteredCorona
void Update(void); void Update(void);
}; };
static_assert(sizeof(CRegisteredCorona) == 0x80, "CRegisteredCorona: error");
VALIDATE_SIZE(CRegisteredCorona, 0x80);
class CCoronas class CCoronas
{ {

View File

@ -91,4 +91,4 @@ public:
static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix); static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix);
}; };
VALIDATE_SIZE(CParticle, 0x68); VALIDATE_SIZE(CParticle, 0x68);

View File

@ -64,8 +64,10 @@ struct tParticleSystemData
RwRaster **m_ppRaster; RwRaster **m_ppRaster;
CParticle *m_pParticles; CParticle *m_pParticles;
}; };
VALIDATE_SIZE(tParticleSystemData, 0x88);
#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(tParticleSystemData, 0x88);
#endif
class cParticleSystemMgr class cParticleSystemMgr
{ {
@ -125,6 +127,8 @@ public:
void RangeCheck(tParticleSystemData *pData) { } void RangeCheck(tParticleSystemData *pData) { }
}; };
#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(cParticleSystemMgr, 0x2420); VALIDATE_SIZE(cParticleSystemMgr, 0x2420);
#endif
extern cParticleSystemMgr mod_ParticleSystemManager; extern cParticleSystemMgr mod_ParticleSystemManager;

View File

@ -13,7 +13,7 @@ public:
int8 fogType; int8 fogType;
bool castExtraShadows; bool castExtraShadows;
}; };
static_assert(sizeof(CRegisteredPointLight) == 0x2C, "CRegisteredPointLight: error"); VALIDATE_SIZE(CRegisteredPointLight, 0x2C);
class CPointLights class CPointLights
{ {

View File

@ -51,7 +51,10 @@ public:
CStoredShadow() CStoredShadow()
{ } { }
}; };
#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(CStoredShadow, 0x30); VALIDATE_SIZE(CStoredShadow, 0x30);
#endif
class CPolyBunch class CPolyBunch
{ {
@ -65,7 +68,10 @@ public:
CPolyBunch() CPolyBunch()
{ } { }
}; };
#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(CPolyBunch, 0x6C); VALIDATE_SIZE(CPolyBunch, 0x6C);
#endif
class CStaticShadow class CStaticShadow
{ {
@ -93,7 +99,10 @@ public:
void Free(); void Free();
}; };
#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(CStaticShadow, 0x40); VALIDATE_SIZE(CStaticShadow, 0x40);
#endif
class CPermanentShadow class CPermanentShadow
{ {
@ -115,6 +124,7 @@ public:
CPermanentShadow() CPermanentShadow()
{ } { }
}; };
VALIDATE_SIZE(CPermanentShadow, 0x38); VALIDATE_SIZE(CPermanentShadow, 0x38);
class CPtrList; class CPtrList;

View File

@ -25,7 +25,7 @@ public:
void PushPeds(void); void PushPeds(void);
}; };
static_assert(sizeof(CWaterCannon) == 412, "CWaterCannon: error"); VALIDATE_SIZE(CWaterCannon, 412);
class CWaterCannons class CWaterCannons
{ {

View File

@ -12,8 +12,9 @@ struct CKeyEntry
wchar *value; wchar *value;
char key[8]; char key[8];
}; };
// If this fails, CKeyArray::Load will have to be fixed // If this fails, CKeyArray::Load will have to be fixed
static_assert(sizeof(CKeyEntry) == 12, "CKeyEntry: error"); VALIDATE_SIZE(CKeyEntry, 12);
class CKeyArray class CKeyArray
{ {

View File

@ -197,7 +197,7 @@ public:
static void SetAllTaxiLights(bool set); static void SetAllTaxiLights(bool set);
}; };
static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error"); VALIDATE_SIZE(CAutomobile, 0x5A8);
inline uint8 GetCarDoorFlag(int32 carnode) { inline uint8 GetCarDoorFlag(int32 carnode) {
switch (carnode) { switch (carnode) {

View File

@ -72,7 +72,7 @@ public:
}; };
static_assert(sizeof(CBoat) == 0x484, "CBoat: error"); VALIDATE_SIZE(CBoat, 0x484);
extern float MAX_WAKE_LENGTH; extern float MAX_WAKE_LENGTH;
extern float MIN_WAKE_INTERVAL; extern float MIN_WAKE_INTERVAL;

View File

@ -72,7 +72,7 @@ public:
float GetHeightToDropoffHeight() { return m_fDropoffHeight + (m_bIsCrusher ? 7.0f : 2.0f); } float GetHeightToDropoffHeight() { return m_fDropoffHeight + (m_bIsCrusher ? 7.0f : 2.0f); }
}; };
static_assert(sizeof(CCrane) == 128, "CCrane: error"); VALIDATE_SIZE(CCrane, 128);
class CCranes class CCranes
{ {

View File

@ -95,4 +95,6 @@ public:
static void ActivateHeli(bool activate); static void ActivateHeli(bool activate);
}; };
static_assert(sizeof(CHeli) == 0x33C, "CHeli: error");
VALIDATE_SIZE(CHeli, 0x33C);

View File

@ -63,7 +63,8 @@ public:
static bool HasCesnaBeenDestroyed(void); static bool HasCesnaBeenDestroyed(void);
static bool HasDropOffCesnaBeenShotDown(void); static bool HasDropOffCesnaBeenShotDown(void);
}; };
static_assert(sizeof(CPlane) == 0x29C, "CPlane: error");
VALIDATE_SIZE(CPlane, 0x29C);
extern float LandingPoint; extern float LandingPoint;
extern float TakeOffPoint; extern float TakeOffPoint;

View File

@ -91,4 +91,5 @@ public:
float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail); float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail);
static void UpdateTrains(void); static void UpdateTrains(void);
}; };
static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error");
VALIDATE_SIZE(CTrain, 0x2E4);

View File

@ -291,9 +291,6 @@ public:
static bool m_bDisableMouseSteering; static bool m_bDisableMouseSteering;
}; };
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error"); VALIDATE_SIZE(CVehicle, 0x288);
static_assert(offsetof(CVehicle, m_pCurGroundEntity) == 0x1E0, "CVehicle: error");
static_assert(offsetof(CVehicle, m_nAlarmState) == 0x1A0, "CVehicle: error");
static_assert(offsetof(CVehicle, m_nLastWeaponDamage) == 0x228, "CVehicle: error");
void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle); void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle);

View File

@ -46,4 +46,4 @@ public:
static void Shutdown(void); static void Shutdown(void);
}; };
static_assert(sizeof(CWeaponInfo) == 0x54, "CWeaponInfo: error"); VALIDATE_SIZE(CWeaponInfo, 0x54);