This commit is contained in:
Nikolay Korolev 2019-06-22 21:35:23 +03:00
parent 666ee73ac8
commit 4e07396076
5 changed files with 111 additions and 111 deletions

View File

@ -4,9 +4,9 @@
struct CBulletTrace struct CBulletTrace
{ {
CVector m_vecInf; CVector m_vecInf;
CVector m_vecSup; CVector m_vecSup;
bool m_bInUse; bool m_bInUse;
uint8 m_bFramesInUse; uint8 m_bFramesInUse;
uint8 m_bLifeTime; uint8 m_bLifeTime;
}; };

View File

@ -5,5 +5,5 @@
class CBulletTraces class CBulletTraces
{ {
public: public:
static CBulletTrace(&aTraces)[16]; static CBulletTrace(&aTraces)[16];
}; };

View File

@ -4,30 +4,30 @@
enum ePickupType enum ePickupType
{ {
PICKUP_NONE = 0, PICKUP_NONE = 0,
PICKUP_IN_SHOP = 1, PICKUP_IN_SHOP = 1,
PICKUP_ON_STREET = 2, PICKUP_ON_STREET = 2,
PICKUP_ONCE = 3, PICKUP_ONCE = 3,
PICKUP_ONCE_TIMEOUT = 4, PICKUP_ONCE_TIMEOUT = 4,
PICKUP_COLLECTABLE1 = 5, PICKUP_COLLECTABLE1 = 5,
PICKUP_IN_SHOP_OUT_OF_STOCK = 6, PICKUP_IN_SHOP_OUT_OF_STOCK = 6,
PICKUP_MONEY = 7, PICKUP_MONEY = 7,
PICKUP_MINE_INACTIVE = 8, PICKUP_MINE_INACTIVE = 8,
PICKUP_MINE_ARMED = 9, PICKUP_MINE_ARMED = 9,
PICKUP_NAUTICAL_MINE_INACTIVE = 10, PICKUP_NAUTICAL_MINE_INACTIVE = 10,
PICKUP_NAUTICAL_MINE_ARMED = 11, PICKUP_NAUTICAL_MINE_ARMED = 11,
PICKUP_FLOATINGPACKAGE = 12, PICKUP_FLOATINGPACKAGE = 12,
PICKUP_FLOATINGPACKAGE_FLOATING = 13, PICKUP_FLOATINGPACKAGE_FLOATING = 13,
PICKUP_ON_STREET_SLOW = 14, PICKUP_ON_STREET_SLOW = 14,
}; };
class CPickup class CPickup
{ {
ePickupType m_eType; ePickupType m_eType;
uint16 m_wQuantity; uint16 m_wQuantity;
CObject *m_pObject; CObject *m_pObject;
uint32 m_nTimer; uint32 m_nTimer;
int16 m_eModelIndex; int16 m_eModelIndex;
int16 m_wIndex; int16 m_wIndex;
CVector m_vecPos; CVector m_vecPos;
}; };

View File

@ -81,70 +81,70 @@ class CReplay
}; };
struct tGeneralPacket struct tGeneralPacket
{ {
uint8 type; uint8 type;
bool in_rcvehicle; bool in_rcvehicle;
CMatrix camera_pos; CMatrix camera_pos;
CVector player_pos; CVector player_pos;
}; };
static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error"); static_assert(sizeof(tGeneralPacket) == 88, "tGeneralPacket: error");
struct tClockPacket struct tClockPacket
{ {
uint8 type; uint8 type;
uint8 hours; uint8 hours;
uint8 minutes; uint8 minutes;
private: private:
uint8 __align; uint8 __align;
}; };
static_assert(sizeof(tClockPacket) == 4, "tClockPacket: error"); static_assert(sizeof(tClockPacket) == 4, "tClockPacket: error");
struct tWeatherPacket struct tWeatherPacket
{ {
uint8 type; uint8 type;
uint8 old_weather; uint8 old_weather;
uint8 new_weather; uint8 new_weather;
float interpolation; float interpolation;
}; };
static_assert(sizeof(tWeatherPacket) == 8, "tWeatherPacket: error"); static_assert(sizeof(tWeatherPacket) == 8, "tWeatherPacket: error");
struct tTimerPacket struct tTimerPacket
{ {
uint8 type; uint8 type;
uint32 timer; uint32 timer;
}; };
static_assert(sizeof(tTimerPacket) == 8, "tTimerPacket: error"); static_assert(sizeof(tTimerPacket) == 8, "tTimerPacket: error");
struct tPedHeaderPacket struct tPedHeaderPacket
{ {
uint8 type; uint8 type;
uint8 index; uint8 index;
uint16 mi; uint16 mi;
uint8 pedtype; uint8 pedtype;
private: private:
uint8 __align[3]; uint8 __align[3];
}; };
static_assert(sizeof(tPedHeaderPacket) == 8, "tPedHeaderPacket: error"); static_assert(sizeof(tPedHeaderPacket) == 8, "tPedHeaderPacket: error");
struct tBulletTracePacket struct tBulletTracePacket
{ {
uint8 type; uint8 type;
uint8 frames; uint8 frames;
uint8 lifetime; uint8 lifetime;
uint8 index; uint8 index;
CVector inf; CVector inf;
CVector sup; CVector sup;
}; };
static_assert(sizeof(tBulletTracePacket) == 28, "tBulletTracePacket: error"); static_assert(sizeof(tBulletTracePacket) == 28, "tBulletTracePacket: error");
struct tEndOfFramePacket struct tEndOfFramePacket
{ {
uint8 type; uint8 type;
private: private:
uint8 __align[3]; uint8 __align[3];
}; };
static_assert(sizeof(tEndOfFramePacket) == 4, "tEndOfFramePacket: error"); static_assert(sizeof(tEndOfFramePacket) == 4, "tEndOfFramePacket: error");
private: private:
static uint8 &Mode; static uint8 &Mode;
@ -179,8 +179,8 @@ private:
public: public:
static void Init(void); static void Init(void);
static void DisableReplays(void); static void DisableReplays(void);
static void EnableReplays(void); static void EnableReplays(void);
static void Update(void); static void Update(void);
static void FinishPlayback(void); static void FinishPlayback(void);
static void Shutdown(void); static void Shutdown(void);
@ -189,8 +189,8 @@ public:
static void StreamAllNecessaryCarsAndPeds(void); static void StreamAllNecessaryCarsAndPeds(void);
static bool ShouldStandardCameraBeProcessed(void); static bool ShouldStandardCameraBeProcessed(void);
inline static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; } inline static bool IsPlayingBack() { return Mode == MODE_PLAYBACK; }
inline static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; } inline static bool IsPlayingBackFromFile() { return bPlayingBackFromFile; }
private: private:
static void RecordThisFrame(void); static void RecordThisFrame(void);

View File

@ -101,27 +101,27 @@ public:
n++; n++;
return n; return n;
} }
void ClearStorage(uint8 **flags, U **entries){ void ClearStorage(uint8 **flags, U **entries){
delete[] flags; delete[] flags;
delete[] entries; delete[] entries;
*flags = nil; *flags = nil;
*entries = nil; *entries = nil;
} }
void CopyBack(uint8 **flags, U **entries){ void CopyBack(uint8 **flags, U **entries){
memcpy(m_flags, *flags, sizeof(Flags)*m_size); memcpy(m_flags, *flags, sizeof(Flags)*m_size);
memcpy(m_entries, *entries, sizeof(U)*m_size); memcpy(m_entries, *entries, sizeof(U)*m_size);
debug("Size copied:%d (%d)", sizeof(U)*m_size, sizeof(Flags)*m_size); debug("Size copied:%d (%d)", sizeof(U)*m_size, sizeof(Flags)*m_size);
m_allocPtr = 0; m_allocPtr = 0;
ClearStorage(flags, entries); ClearStorage(flags, entries);
debug("CopyBack:%d (/%d)", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */ debug("CopyBack:%d (/%d)", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
} }
void Store(uint8 **flags, U** entries){ void Store(uint8 **flags, U** entries){
*flags = (Flags*)malloc(sizeof(Flags)*size); *flags = (Flags*)malloc(sizeof(Flags)*size);
*entries = (U*)malloc(sizeof(U)*size); *entries = (U*)malloc(sizeof(U)*size);
memcpy(*flags, m_flags, sizeof(Flags)*m_size); memcpy(*flags, m_flags, sizeof(Flags)*m_size);
memcpy(*entries, m_entries, sizeof(U)*m_size); memcpy(*entries, m_entries, sizeof(U)*m_size);
debug("Stored:%d (/%d)", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */ debug("Stored:%d (/%d)", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
} }
}; };
template<typename T> template<typename T>