defined out asserts.

This commit is contained in:
bigbossbro08 2020-05-10 19:54:37 +06:00
parent d9a3533438
commit af6e132b37
48 changed files with 156 additions and 6 deletions

View File

@ -84,4 +84,7 @@ public:
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));
}
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CAnimBlendAssociation) == 0x40, "CAnimBlendAssociation: error");
#endif

View File

@ -24,4 +24,7 @@ public:
void Uncompress(void);
void RemoveUncompressedData(void);
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CAnimBlendHierarchy) == 0x28, "CAnimBlendHierarchy: error");
#endif

View File

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

View File

@ -20,7 +20,9 @@ public:
// no methods
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(cAudioCollision) == 40, "cAudioCollision: error");
#endif
class cAudioCollisionManager
{
@ -35,4 +37,6 @@ public:
void AddCollisionToRequestedQueue();
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error");
#endif

View File

@ -52,7 +52,9 @@ public:
uint8 m_AudioEvents;
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error");
#endif
class tPedComment
{
@ -135,7 +137,9 @@ public:
float m_fVelocityChange;
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(cVehicleParams) == 0x18, "cVehicleParams: error");
#endif
enum {
/*

View File

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

View File

@ -172,7 +172,9 @@ class CGarage
friend class CCamera;
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CGarage) == 140, "CGarage");
#endif
class CGarages
{

View File

@ -41,7 +41,10 @@ struct CPedPathNode
CPedPathNode* prev;
CPedPathNode* next;
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error");
#endif
class CPedPath {
public:
@ -221,7 +224,11 @@ public:
void DisplayPathData(void);
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
#endif
extern CPathFind ThePaths;

View File

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

View File

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

View File

@ -108,7 +108,10 @@ class CReplay
CMatrix camera_pos;
CVector player_pos;
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error");
#endif
struct tClockPacket
{

View File

@ -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;

View File

@ -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;

View File

@ -25,8 +25,9 @@ struct Queue
int32 size;
};
#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(Queue, 0x10);
#endif
void CdStreamInitThread(void);
void CdStreamInit(int32 numChannels);

View File

@ -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);
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error");
#endif

View File

@ -80,4 +80,7 @@ public:
~CPlayerInfo() { };
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");
#endif

View File

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

View File

@ -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;

View File

@ -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)))

View File

@ -16,4 +16,7 @@ public:
virtual bool GetIsATreadable(void) { return false; }
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error");
#endif

View File

@ -15,4 +15,7 @@ public:
static void *operator new(size_t);
static void operator delete(void*, size_t);
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CDummy) == 0x68, "CDummy: error");
#endif

View File

@ -172,4 +172,7 @@ public:
static void AddSteamsFromGround(CPtrList& list);
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CEntity) == 0x64, "CEntity: error");
#endif

View File

@ -160,4 +160,7 @@ public:
bool CheckCollision(void);
bool CheckCollision_SimpleCar(void);
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPhysical) == 0x128, "CPhysical: error");
#endif

View File

@ -12,4 +12,7 @@ public:
bool GetIsATreadable(void) { return true; }
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CTreadable) == 0x94, "CTreadable: error");
#endif

View File

@ -70,4 +70,6 @@ public:
uint16 GetNumRefs() const { return m_refCount; }
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");
#endif

View File

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

View File

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

View File

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

View File

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

View File

@ -10,4 +10,7 @@ public:
CDummyObject(void) {}
CDummyObject(CObject *obj);
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CDummyObject) == 0x68, "CDummyObject: error");
#endif

View File

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

View File

@ -8,4 +8,7 @@ class CDummyPed : CDummy
int32 pedType;
int32 unknown;
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CDummyPed) == 0x70, "CDummyPed: error");
#endif

View File

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

View File

@ -89,4 +89,7 @@ public:
}
}
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(C2dEffect) == 0x34, "C2dEffect: error");
#endif

View File

@ -38,7 +38,10 @@ struct CRegisteredCorona
void Update(void);
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CRegisteredCorona) == 0x80, "CRegisteredCorona: error");
#endif
class CCoronas
{

View File

@ -21,7 +21,9 @@ public:
void Render(void);
};
#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(CFallingGlassPane, 0x70);
#endif
enum
{

View File

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

View File

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

View File

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

View File

@ -90,7 +90,9 @@ static psGlobalType PsGlobal;
#include "Sprite2d.h"
#include "AnimViewer.h"
#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(psGlobalType, 0x28);
#endif
// DirectShow interfaces
IGraphBuilder *pGB = nil;

View File

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

View File

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

View File

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

View File

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

View File

@ -95,4 +95,7 @@ public:
static void ActivateHeli(bool activate);
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CHeli) == 0x33C, "CHeli: error");
#endif

View File

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

View File

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

View File

@ -291,9 +291,11 @@ public:
static bool m_bDisableMouseSteering;
};
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");
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");
#endif
void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle);