Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
defined out asserts.
  • Loading branch information
Bigbossbro08 committed May 10, 2020
1 parent d9a3533 commit af6e132b37e8b7e89e4c0c7a52e5bb81e4b1b9a8
Showing with 156 additions and 6 deletions.
  1. +3 −0 src/animation/AnimBlendAssociation.h
  2. +3 −0 src/animation/AnimBlendHierarchy.h
  3. +3 −0 src/animation/AnimBlendNode.h
  4. +5 −1 src/audio/AudioCollision.h
  5. +4 −0 src/audio/AudioManager.h
  6. +4 −1 src/control/AutoPilot.h
  7. +2 −0 src/control/Garages.h
  8. +7 −0 src/control/PathFind.h
  9. +2 −0 src/control/Phones.h
  10. +2 −0 src/control/Pickups.h
  11. +3 −0 src/control/Replay.h
  12. +6 −0 src/core/Camera.h
  13. +3 −0 src/core/CdStream.cpp
  14. +2 −1 src/core/CdStream.h
  15. +4 −1 src/core/Placeable.h
  16. +3 −0 src/core/PlayerInfo.h
  17. +2 −0 src/core/Wanted.h
  18. +4 −0 src/core/World.h
  19. +4 −0 src/core/common.h
  20. +3 −0 src/entities/Building.h
  21. +3 −0 src/entities/Dummy.h
  22. +3 −0 src/entities/Entity.h
  23. +3 −0 src/entities/Physical.h
  24. +3 −0 src/entities/Treadable.h
  25. +2 −0 src/modelinfo/BaseModelInfo.h
  26. +3 −0 src/modelinfo/ClumpModelInfo.h
  27. +3 −0 src/modelinfo/SimpleModelInfo.h
  28. +3 −0 src/modelinfo/TimeModelInfo.h
  29. +3 −0 src/modelinfo/VehicleModelInfo.h
  30. +3 −0 src/objects/DummyObject.h
  31. +3 −0 src/objects/Object.h
  32. +3 −0 src/peds/DummyPed.h
  33. +3 −0 src/peds/PedIK.h
  34. +3 −0 src/render/2dEffect.h
  35. +3 −0 src/render/Coronas.h
  36. +2 −0 src/render/Glass.h
  37. +3 −1 src/render/Particle.h
  38. +5 −1 src/render/ParticleMgr.h
  39. +11 −0 src/render/Shadows.h
  40. +2 −0 src/skel/win/win.cpp
  41. +3 −0 src/text/Text.h
  42. +2 −0 src/vehicles/Automobile.h
  43. +2 −0 src/vehicles/Boat.h
  44. +2 −0 src/vehicles/Cranes.h
  45. +3 −0 src/vehicles/Heli.h
  46. +3 −0 src/vehicles/Plane.h
  47. +3 −0 src/vehicles/Train.h
  48. +2 −0 src/vehicles/Vehicle.h
@@ -84,4 +84,7 @@ class CAnimBlendAssociation
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link)); return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));
} }
}; };

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

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

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CAnimBlendNode) == 0x1C, "CAnimBlendNode: error"); static_assert(sizeof(CAnimBlendNode) == 0x1C, "CAnimBlendNode: error");
#endif
@@ -20,7 +20,9 @@ class cAudioCollision
// no methods // no methods
}; };


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(cAudioCollision) == 40, "cAudioCollision: error"); static_assert(sizeof(cAudioCollision) == 40, "cAudioCollision: error");
#endif


class cAudioCollisionManager class cAudioCollisionManager
{ {
@@ -35,4 +37,6 @@ class cAudioCollisionManager
void AddCollisionToRequestedQueue(); void AddCollisionToRequestedQueue();
}; };


static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error"); #ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error");
#endif
@@ -52,7 +52,9 @@ class tAudioEntity
uint8 m_AudioEvents; uint8 m_AudioEvents;
}; };


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error"); static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error");
#endif


class tPedComment class tPedComment
{ {
@@ -135,7 +137,9 @@ class cVehicleParams
float m_fVelocityChange; float m_fVelocityChange;
}; };


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(cVehicleParams) == 0x18, "cVehicleParams: error"); static_assert(sizeof(cVehicleParams) == 0x18, "cVehicleParams: error");
#endif


enum { enum {
/* /*
@@ -119,4 +119,7 @@ class CAutoPilot {
#endif #endif


}; };
static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error");
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CAutoPilot) == 0x70, "CAutoPilot: error");
#endif
@@ -172,7 +172,9 @@ class CGarage
friend class CCamera; friend class CCamera;
}; };


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CGarage) == 140, "CGarage"); static_assert(sizeof(CGarage) == 140, "CGarage");
#endif


class CGarages class CGarages
{ {
@@ -41,7 +41,10 @@ struct CPedPathNode
CPedPathNode* prev; CPedPathNode* prev;
CPedPathNode* next; CPedPathNode* next;
}; };

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error"); static_assert(sizeof(CPedPathNode) == 0x10, "CPedPathNode: error");
#endif


class CPedPath { class CPedPath {
public: public:
@@ -221,7 +224,11 @@ class CPathFind


void DisplayPathData(void); void DisplayPathData(void);
}; };


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error"); static_assert(sizeof(CPathFind) == 0x49bf4, "CPathFind: error");
#endif


extern CPathFind ThePaths; extern CPathFind ThePaths;


@@ -32,7 +32,9 @@ class CPhone
~CPhone() { } ~CPhone() { }
}; };


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPhone) == 0x34, "CPhone: error"); static_assert(sizeof(CPhone) == 0x34, "CPhone: error");
#endif


class CPhoneInfo { class CPhoneInfo {
public: public:
@@ -47,7 +47,9 @@ class CPickup
void Remove(); void Remove();
}; };


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPickup) == 0x1C, "CPickup: error"); static_assert(sizeof(CPickup) == 0x1C, "CPickup: error");
#endif


struct tPickupMessage struct tPickupMessage
{ {
@@ -108,7 +108,10 @@ class CReplay
CMatrix camera_pos; CMatrix camera_pos;
CVector player_pos; CVector player_pos;
}; };

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error"); static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error");
#endif


struct tClockPacket struct tClockPacket
{ {
@@ -260,9 +260,12 @@ class CCam
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);
}; };

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size"); static_assert(sizeof(CCam) == 0x1A4, "CCam: wrong size");
static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error"); static_assert(offsetof(CCam, Alpha) == 0xA8, "CCam: error");
static_assert(offsetof(CCam, Front) == 0x140, "CCam: error"); static_assert(offsetof(CCam, Front) == 0x140, "CCam: error");
#endif


class CCamPathSplines class CCamPathSplines
{ {
@@ -637,6 +640,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);
}; };

#ifdef CHECK_STRUCT_SIZES
static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error"); static_assert(offsetof(CCamera, DistanceToWater) == 0xe4, "CCamera: error");
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error"); static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
static_assert(offsetof(CCamera, WorldViewerBeingUsed) == 0x75, "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_vecCutSceneOffset) == 0x6F8, "CCamera: error");
static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error"); static_assert(offsetof(CCamera, m_arrPathArray) == 0x7a8, "CCamera: error");
static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size"); static_assert(sizeof(CCamera) == 0xE9D8, "CCamera: wrong size");
#endif


extern CCamera TheCamera; extern CCamera TheCamera;


@@ -22,7 +22,10 @@ struct CdReadInfo
HANDLE hFile; HANDLE hFile;
OVERLAPPED Overlapped; OVERLAPPED Overlapped;
}; };

#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(CdReadInfo, 0x30); VALIDATE_SIZE(CdReadInfo, 0x30);
#endif


char gCdImageNames[MAX_CDIMAGES+1][64]; char gCdImageNames[MAX_CDIMAGES+1][64];
int32 gNumImages; int32 gNumImages;
@@ -25,8 +25,9 @@ struct Queue
int32 size; int32 size;
}; };


#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(Queue, 0x10); VALIDATE_SIZE(Queue, 0x10);

#endif


void CdStreamInitThread(void); void CdStreamInitThread(void);
void CdStreamInit(int32 numChannels); void CdStreamInit(int32 numChannels);
@@ -31,4 +31,7 @@ class CPlaceable
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");
#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPlaceable) == 0x4C, "CPlaceable: error");
#endif
@@ -80,4 +80,7 @@ class CPlayerInfo


~CPlayerInfo() { }; ~CPlayerInfo() { };
}; };

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


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CWanted) == 0x204, "CWanted: error"); static_assert(sizeof(CWanted) == 0x204, "CWanted: error");
#endif
@@ -45,7 +45,11 @@ class CSector
public: public:
CPtrList m_lists[NUMSECTORENTITYLISTS]; CPtrList m_lists[NUMSECTORENTITYLISTS];
}; };


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CSector) == 0x28, "CSector: error"); static_assert(sizeof(CSector) == 0x28, "CSector: error");
#endif


class CEntity; class CEntity;
struct CColPoint; struct CColPoint;
@@ -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)))
@@ -16,4 +16,7 @@ class CBuilding : public CEntity


virtual bool GetIsATreadable(void) { return false; } virtual bool GetIsATreadable(void) { return false; }
}; };

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error"); static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error");
#endif
@@ -15,4 +15,7 @@ class CDummy : public CEntity
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);
}; };

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CDummy) == 0x68, "CDummy: error"); static_assert(sizeof(CDummy) == 0x68, "CDummy: error");
#endif
@@ -172,4 +172,7 @@ class CEntity : public CPlaceable


static void AddSteamsFromGround(CPtrList& list); static void AddSteamsFromGround(CPtrList& list);
}; };

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

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CPhysical) == 0x128, "CPhysical: error"); static_assert(sizeof(CPhysical) == 0x128, "CPhysical: error");
#endif
@@ -12,4 +12,7 @@ class CTreadable : public CBuilding


bool GetIsATreadable(void) { return true; } bool GetIsATreadable(void) { return true; }
}; };

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


#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error"); static_assert(sizeof(CBaseModelInfo) == 0x30, "CBaseModelInfo: error");
#endif
@@ -50,4 +50,7 @@ class CClumpModelInfo : public CBaseModelInfo
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);
}; };

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

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

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error"); static_assert(sizeof(CTimeModelInfo) == 0x58, "CTimeModelInfo: error");
#endif
@@ -123,4 +123,7 @@ class CVehicleModelInfo : public CClumpModelInfo
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; }
}; };

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

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

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

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

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

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(C2dEffect) == 0x34, "C2dEffect: error"); static_assert(sizeof(C2dEffect) == 0x34, "C2dEffect: error");
#endif
@@ -38,7 +38,10 @@ struct CRegisteredCorona


void Update(void); void Update(void);
}; };

#ifdef CHECK_STRUCT_SIZES
static_assert(sizeof(CRegisteredCorona) == 0x80, "CRegisteredCorona: error"); static_assert(sizeof(CRegisteredCorona) == 0x80, "CRegisteredCorona: error");
#endif


class CCoronas class CCoronas
{ {
@@ -21,7 +21,9 @@ class CFallingGlassPane : public CMatrix
void Render(void); void Render(void);
}; };


#ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(CFallingGlassPane, 0x70); VALIDATE_SIZE(CFallingGlassPane, 0x70);
#endif


enum enum
{ {
@@ -91,4 +91,6 @@ class CParticle
static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix); static void AddYardieDoorSmoke(CVector const &vecPos, CMatrix const &matMatrix);
}; };


VALIDATE_SIZE(CParticle, 0x68); #ifdef CHECK_STRUCT_SIZES
VALIDATE_SIZE(CParticle, 0x68);
#endif

0 comments on commit af6e132

Please sign in to comment.