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

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