mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-20 04:26:03 +08:00
69 lines
1.6 KiB
C
69 lines
1.6 KiB
C
![]() |
#ifndef NETWORKSERIALIZER_H
|
||
|
#define NETWORKSERIALIZER_H
|
||
|
|
||
|
#ifdef _WIN32
|
||
|
#pragma once
|
||
|
#endif
|
||
|
|
||
|
#include <platform.h>
|
||
|
|
||
|
#include <networksystem/iprotobufbinding.h>
|
||
|
#include <tier1/utlstring.h>
|
||
|
#include <tier1/bitbuf.h>
|
||
|
#include "Color.h"
|
||
|
|
||
|
enum NetworkValidationMode_t;
|
||
|
enum NetworkSerializationMode_t;
|
||
|
|
||
|
typedef uint16 NetworkMessageId;
|
||
|
typedef uint8 NetworkGroupId;
|
||
|
typedef uint NetworkCategoryId;
|
||
|
|
||
|
struct NetMessageInfo_t
|
||
|
{
|
||
|
int m_nCategories;
|
||
|
IProtobufBinding *m_pBinding;
|
||
|
CUtlString m_szGroup;
|
||
|
NetworkMessageId m_MessageId;
|
||
|
NetworkGroupId m_GroupId;
|
||
|
|
||
|
// (1 << 0) - FLAG_RELIABLE
|
||
|
// (1 << 6) - FLAG_AUTOASSIGNEDID
|
||
|
// (1 << 7) - FLAG_UNK002
|
||
|
uint8 m_nFlags;
|
||
|
|
||
|
int m_unk001;
|
||
|
int m_unk002;
|
||
|
bool m_bOkayToRedispatch;
|
||
|
};
|
||
|
|
||
|
abstract_class INetworkSerializable
|
||
|
{
|
||
|
public:
|
||
|
virtual ~INetworkSerializable() = 0;
|
||
|
|
||
|
virtual const char *GetUnscopedName() = 0;
|
||
|
virtual NetMessageInfo_t *GetNetMessageInfo() = 0;
|
||
|
|
||
|
virtual void SetMessageId(unsigned short nMessageId) = 0;
|
||
|
|
||
|
virtual void AddCategoryMask(int nMask, bool) = 0;
|
||
|
|
||
|
virtual void SwitchMode(NetworkValidationMode_t nMode) = 0;
|
||
|
|
||
|
virtual void *AllocateMessage() = 0;
|
||
|
virtual void DeallocateMessage(void *pMsg) = 0;
|
||
|
virtual void *AllocateAndCopyConstructNetMessage(void const *pOther) = 0;
|
||
|
|
||
|
virtual bool Serialize(bf_write &pBuf, void const *pData, NetworkSerializationMode_t unused) = 0;
|
||
|
virtual bool Unserialize(bf_read &pBuf, void *pData, NetworkSerializationMode_t unused) = 0;
|
||
|
};
|
||
|
|
||
|
class CNetworkSerializerPB : public INetworkSerializable
|
||
|
{
|
||
|
private:
|
||
|
const char *m_szUnscopedName;
|
||
|
NetMessageInfo_t m_MessageInfo;
|
||
|
};
|
||
|
|
||
|
#endif /* NETWORKSERIALIZER_H */
|