work on world
This commit is contained in:
@@ -98,9 +98,11 @@ struct datamap_t
|
||||
#define _class_offsetof( class, var ) ((size_t)&(((class*)0)->var))
|
||||
|
||||
#define _FIELD( name, fieldtype, count, flags, mapname, tolerance) { #name, mapname, fieldtype, _class_offsetof(ThisClass, name), count, sizeof(((ThisClass*)0)->name), flags },
|
||||
#define DEFINE_FIELD( name, fieldtype ) _FIELD( name, fieldtype, 1, FTYPEDESC_KEY, 0, 0)
|
||||
#define DEFINE_KEYFIELD( name, fieldtype, mapname ) _FIELD( name, fieldtype, 1, FTYPEDESC_KEY, mapname, 0)
|
||||
#define DEFINE_FIELD( name, fieldtype ) _FIELD( name, fieldtype, 1, FTYPEDESC_SAVE, 0, 0)
|
||||
#define DEFINE_KEYFIELD( name, fieldtype, mapname ) _FIELD( name, fieldtype, 1, FTYPEDESC_KEY | FTYPEDESC_SAVE, mapname, 0)
|
||||
|
||||
#define FTYPEDESC_GLOBAL 0x0001
|
||||
#define FTYPEDESC_SAVE 0x0002
|
||||
#define FTYPEDESC_KEY 0x0004
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,13 @@
|
||||
#include "stdint.h"
|
||||
#include "datamap.h"
|
||||
|
||||
template <typename T>
|
||||
class CNetworkVarBase
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct netfield_t
|
||||
{
|
||||
const char *m_szName;
|
||||
@@ -20,6 +27,7 @@ struct netmap_t
|
||||
};
|
||||
|
||||
#define NetPropInt(name) { #name, FIELD_INT, _class_offsetof(ThisClass, name), sizeof(name)}
|
||||
#define NetPropString(name) { #name, FIELD_STRING, _class_offsetof(ThisClass, name), sizeof(name)}
|
||||
#define NetPropFloat(name) { #name, FIELD_FLOAT, _class_offsetof(ThisClass, name), sizeof(name)}
|
||||
#define NetPropFloat3(name) \
|
||||
NetPropFloat(name.x), \
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include "stdint.h"
|
||||
#include "tier0/network.h"
|
||||
|
||||
class CNetworkUInt32
|
||||
class CNetworkProtocolUInt32
|
||||
{
|
||||
public:
|
||||
CNetworkUInt32() : m_uValue(0) {}
|
||||
CNetworkUInt32( uint32_t uValue ) : m_uValue(htonl(uValue)) {}
|
||||
CNetworkProtocolUInt32() : m_uValue(0) {}
|
||||
CNetworkProtocolUInt32( uint32_t uValue ) : m_uValue(htonl(uValue)) {}
|
||||
operator uint32_t() const {
|
||||
return htonl(m_uValue);
|
||||
}
|
||||
@@ -25,6 +25,7 @@ enum EMessageType: uint32_t
|
||||
MESSAGE_ENTITY_DATA_SYNC,
|
||||
|
||||
k_EMessage_PlayerSetLocalEntity,
|
||||
k_EMessage_ResetEntities,
|
||||
};
|
||||
|
||||
struct PlayerJoined_t
|
||||
@@ -36,39 +37,39 @@ struct PlayerJoined_t
|
||||
struct PlayerJoinedCallback_t
|
||||
{
|
||||
EMessageType m_eType;
|
||||
CNetworkUInt32 m_uPlayerIndex;
|
||||
CNetworkProtocolUInt32 m_uPlayerIndex;
|
||||
};
|
||||
|
||||
struct PlayerLeft_t
|
||||
{
|
||||
EMessageType m_eType;
|
||||
CNetworkUInt32 m_uPlayerIndex;
|
||||
CNetworkProtocolUInt32 m_uPlayerIndex;
|
||||
};
|
||||
|
||||
struct EntityClass_t
|
||||
{
|
||||
EMessageType m_eType;
|
||||
CNetworkUInt32 m_uIndex;
|
||||
CNetworkProtocolUInt32 m_uIndex;
|
||||
int8_t m_szEntityName[256];
|
||||
};
|
||||
|
||||
struct EntityDataSync_t
|
||||
{
|
||||
EMessageType m_eType;
|
||||
CNetworkUInt32 m_uIndex;
|
||||
CNetworkUInt32 m_uCount;
|
||||
CNetworkProtocolUInt32 m_uIndex;
|
||||
CNetworkProtocolUInt32 m_uCount;
|
||||
};
|
||||
|
||||
struct EntityDataSyncValue_t
|
||||
{
|
||||
CNetworkUInt32 m_uVariableIndex;
|
||||
CNetworkUInt32 m_uVariableSize;
|
||||
CNetworkProtocolUInt32 m_uVariableIndex;
|
||||
CNetworkProtocolUInt32 m_uVariableSize;
|
||||
};
|
||||
|
||||
struct SetLocalEntity_t
|
||||
{
|
||||
EMessageType m_eType;
|
||||
CNetworkUInt32 m_uIndex;
|
||||
CNetworkProtocolUInt32 m_uIndex;
|
||||
};
|
||||
|
||||
union PlayerPacket_t
|
||||
|
||||
Reference in New Issue
Block a user