Changed NetHandlers bit read/write types to typedefs

This commit is contained in:
Jordan Cristiano 2015-06-18 20:23:26 -04:00
parent 9ad7c54510
commit 778e20803c
34 changed files with 77 additions and 74 deletions

View File

@ -4,13 +4,13 @@
namespace NetHandlers namespace NetHandlers
{ {
bool Net_Disconnect_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::Net_Disconnect* data) bool Net_Disconnect_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::Net_Disconnect* data)
{ {
bitbuf.ReadString(data->message, sizeof(data->message)); bitbuf.ReadString(data->message, sizeof(data->message));
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool Net_Disconnect_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::Net_Disconnect* data) bool Net_Disconnect_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::Net_Disconnect* data)
{ {
bitbuf.WriteString(data->message); bitbuf.WriteString(data->message);
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();

View File

@ -4,7 +4,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool Net_File_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::Net_File* data) bool Net_File_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::Net_File* data)
{ {
data->transferID = bitbuf.ReadUBitLong(32); data->transferID = bitbuf.ReadUBitLong(32);
bitbuf.ReadString(data->filename, sizeof(data->filename)); bitbuf.ReadString(data->filename, sizeof(data->filename));
@ -12,7 +12,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool Net_File_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::Net_File* data) bool Net_File_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::Net_File* data)
{ {
bitbuf.WriteUBitLong(data->transferID, 32); bitbuf.WriteUBitLong(data->transferID, 32);
bitbuf.WriteString(data->filename); bitbuf.WriteString(data->filename);

View File

@ -3,12 +3,12 @@
namespace NetHandlers namespace NetHandlers
{ {
bool Net_NOP_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::Net_NOP* data) bool Net_NOP_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::Net_NOP* data)
{ {
return true; return true;
} }
bool Net_NOP_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::Net_NOP* data) bool Net_NOP_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::Net_NOP* data)
{ {
return true; return true;
} }

View File

@ -6,7 +6,7 @@ namespace NetHandlers
{ {
using cvar_t = NetMsg::Net_SetConVar::cvar_t; using cvar_t = NetMsg::Net_SetConVar::cvar_t;
bool Net_SetConVar_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::Net_SetConVar* data) bool Net_SetConVar_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::Net_SetConVar* data)
{ {
data->cvars.resize(bitbuf.ReadByte()); data->cvars.resize(bitbuf.ReadByte());
for (cvar_t& cvar : data->cvars) for (cvar_t& cvar : data->cvars)
@ -17,7 +17,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool Net_SetConVar_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::Net_SetConVar* data) bool Net_SetConVar_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::Net_SetConVar* data)
{ {
bitbuf.WriteByte(data->cvars.size()); bitbuf.WriteByte(data->cvars.size());
for (cvar_t& cvar : data->cvars) for (cvar_t& cvar : data->cvars)

View File

@ -4,7 +4,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool Net_SignonState_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::Net_SignonState* data) bool Net_SignonState_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::Net_SignonState* data)
{ {
data->signonState = bitbuf.ReadByte(); data->signonState = bitbuf.ReadByte();
data->spawnCount = bitbuf.ReadLong(); data->spawnCount = bitbuf.ReadLong();
@ -12,7 +12,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool Net_SignonState_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::Net_SignonState* data) bool Net_SignonState_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::Net_SignonState* data)
{ {
bitbuf.WriteByte(data->signonState); bitbuf.WriteByte(data->signonState);
bitbuf.WriteLong(data->spawnCount); bitbuf.WriteLong(data->spawnCount);

View File

@ -4,13 +4,13 @@
namespace NetHandlers namespace NetHandlers
{ {
bool Net_StringCmd_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::Net_StringCmd* data) bool Net_StringCmd_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::Net_StringCmd* data)
{ {
bitbuf.ReadString(data->command, sizeof(data->command)); bitbuf.ReadString(data->command, sizeof(data->command));
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool Net_StringCmd_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::Net_StringCmd* data) bool Net_StringCmd_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::Net_StringCmd* data)
{ {
bitbuf.WriteString(data->command); bitbuf.WriteString(data->command);
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();

View File

@ -4,7 +4,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool Net_Tick_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::Net_Tick* data) bool Net_Tick_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::Net_Tick* data)
{ {
data->tick = bitbuf.ReadUBitLong(32); data->tick = bitbuf.ReadUBitLong(32);
data->hostFrameTime = bitbuf.ReadUBitLong(16); data->hostFrameTime = bitbuf.ReadUBitLong(16);
@ -12,7 +12,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool Net_Tick_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::Net_Tick* data) bool Net_Tick_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::Net_Tick* data)
{ {
bitbuf.WriteUBitLong(data->tick, 32); bitbuf.WriteUBitLong(data->tick, 32);
bitbuf.WriteUBitLong(data->hostFrameTime, 16); bitbuf.WriteUBitLong(data->hostFrameTime, 16);

View File

@ -39,13 +39,13 @@
&NetHandlers::SVC_GetCvarValue_##funcname \ &NetHandlers::SVC_GetCvarValue_##funcname \
} }
typedef bool (*NetMsgBitReadFn)(bf_read& bitbuf, SourceGameContext& context, void* data); typedef bool (*NetMsgBitReadFn)(BitRead& bitbuf, SourceGameContext& context, void* data);
typedef bool (*NetMsgBitWriteFn)(bf_write& bitbuf, const SourceGameContext& context, void* data); typedef bool (*NetMsgBitWriteFn)(BitWrite& bitbuf, const SourceGameContext& context, void* data);
typedef bool (*NetMsgJsonReadFn)(JsonRead& jsonbuf, SourceGameContext& context, void* data); typedef bool (*NetMsgJsonReadFn)(JsonRead& jsonbuf, SourceGameContext& context, void* data);
typedef bool (*NetMsgJsonWriteFn)(JsonWrite& jsonbuf, const SourceGameContext& context, void* data); typedef bool (*NetMsgJsonWriteFn)(JsonWrite& jsonbuf, const SourceGameContext& context, void* data);
typedef void (*NetMsgToStringFn)(std::ostringstream& out, void* data); typedef void (*NetMsgToStringFn)(std::ostringstream& out, void* data);
bool NetHandlers::NetMsg_BitRead(uint32_t type, bf_read& bitbuf, SourceGameContext& context, void* data) bool NetHandlers::NetMsg_BitRead(uint32_t type, BitRead& bitbuf, SourceGameContext& context, void* data)
{ {
static const NetMsgBitReadFn netHandlers[] = DECLARE_NET_HANDLER_ARRAY(BitRead); static const NetMsgBitReadFn netHandlers[] = DECLARE_NET_HANDLER_ARRAY(BitRead);
if (type >= (sizeof(netHandlers) / sizeof(NetMsgBitReadFn))) if (type >= (sizeof(netHandlers) / sizeof(NetMsgBitReadFn)))
@ -55,7 +55,7 @@ bool NetHandlers::NetMsg_BitRead(uint32_t type, bf_read& bitbuf, SourceGameConte
return netHandlers[type](bitbuf, context, data); return netHandlers[type](bitbuf, context, data);
} }
bool NetHandlers::NetMsg_BitWrite(uint32_t type, bf_write& bitbuf, const SourceGameContext& context, void* data) bool NetHandlers::NetMsg_BitWrite(uint32_t type, BitWrite& bitbuf, const SourceGameContext& context, void* data)
{ {
static const NetMsgBitWriteFn netHandlers[] = DECLARE_NET_HANDLER_ARRAY(BitWrite); static const NetMsgBitWriteFn netHandlers[] = DECLARE_NET_HANDLER_ARRAY(BitWrite);
if (type >= (sizeof(netHandlers) / sizeof(NetMsgBitWriteFn))) if (type >= (sizeof(netHandlers) / sizeof(NetMsgBitWriteFn)))

View File

@ -6,6 +6,9 @@
class bf_read; class bf_read;
class bf_write; class bf_write;
using BitRead = bf_read;
using BitWrite = bf_write;
class JsonRead; class JsonRead;
class JsonWrite; class JsonWrite;
@ -21,16 +24,16 @@ struct SourceGameContext
#define DECLARE_NET_HANDLERS(msgname) \ #define DECLARE_NET_HANDLERS(msgname) \
namespace NetHandlers \ namespace NetHandlers \
{ \ { \
bool msgname##_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::msgname* data); \ bool msgname##_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::msgname* data); \
bool msgname##_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::msgname* data); \ bool msgname##_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::msgname* data); \
bool msgname##_JsonRead_Internal(JsonRead& jsonbuf, SourceGameContext& context, NetMsg::msgname* data); \ bool msgname##_JsonRead_Internal(JsonRead& jsonbuf, SourceGameContext& context, NetMsg::msgname* data); \
bool msgname##_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::msgname* data); \ bool msgname##_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::msgname* data); \
void msgname##_ToString_Internal(std::ostringstream& out, NetMsg::msgname* data); \ void msgname##_ToString_Internal(std::ostringstream& out, NetMsg::msgname* data); \
inline bool msgname##_BitRead(bf_read& bitbuf, SourceGameContext& context, void* data) \ inline bool msgname##_BitRead(BitRead& bitbuf, SourceGameContext& context, void* data) \
{ \ { \
return msgname##_BitRead_Internal(bitbuf, context, reinterpret_cast<NetMsg::msgname*>(data)); \ return msgname##_BitRead_Internal(bitbuf, context, reinterpret_cast<NetMsg::msgname*>(data)); \
} \ } \
inline bool msgname##_BitWrite(bf_write& bitbuf, const SourceGameContext& context, void* data) \ inline bool msgname##_BitWrite(BitWrite& bitbuf, const SourceGameContext& context, void* data) \
{ \ { \
return msgname##_BitWrite_Internal(bitbuf, context, reinterpret_cast<NetMsg::msgname*>(data)); \ return msgname##_BitWrite_Internal(bitbuf, context, reinterpret_cast<NetMsg::msgname*>(data)); \
} \ } \
@ -50,8 +53,8 @@ struct SourceGameContext
namespace NetHandlers namespace NetHandlers
{ {
bool NetMsg_BitRead(uint32_t type, bf_read& bitbuf, SourceGameContext& context, void* data); bool NetMsg_BitRead(uint32_t type, BitRead& bitbuf, SourceGameContext& context, void* data);
bool NetMsg_BitWrite(uint32_t type, bf_write& bitbuf, const SourceGameContext& context, void* data); bool NetMsg_BitWrite(uint32_t type, BitWrite& bitbuf, const SourceGameContext& context, void* data);
bool NetMsg_JsonRead(uint32_t type, JsonRead& jsonbuf, SourceGameContext& context, void* data); bool NetMsg_JsonRead(uint32_t type, JsonRead& jsonbuf, SourceGameContext& context, void* data);
bool NetMsg_JsonWrite(uint32_t type, JsonWrite& jsonbuf, const SourceGameContext& context, void* data); bool NetMsg_JsonWrite(uint32_t type, JsonWrite& jsonbuf, const SourceGameContext& context, void* data);
void NetMsg_ToString(uint32_t type, std::ostringstream& out, void* data); void NetMsg_ToString(uint32_t type, std::ostringstream& out, void* data);

View File

@ -5,7 +5,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_BSPDecal_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_BSPDecal* data) bool SVC_BSPDecal_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_BSPDecal* data)
{ {
bitbuf.ReadBitVec3Coord(data->position); bitbuf.ReadBitVec3Coord(data->position);
data->decalTextureIndex = bitbuf.ReadUBitLong(MAX_DECAL_INDEX_BITS); data->decalTextureIndex = bitbuf.ReadUBitLong(MAX_DECAL_INDEX_BITS);
@ -23,7 +23,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_BSPDecal_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_BSPDecal* data) bool SVC_BSPDecal_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_BSPDecal* data)
{ {
bitbuf.WriteBitVec3Coord(data->position); bitbuf.WriteBitVec3Coord(data->position);
bitbuf.WriteUBitLong(data->decalTextureIndex, MAX_DECAL_INDEX_BITS); bitbuf.WriteUBitLong(data->decalTextureIndex, MAX_DECAL_INDEX_BITS);

View File

@ -7,7 +7,7 @@ using class_t = NetMsg::SVC_ClassInfo::class_t;
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_ClassInfo_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_ClassInfo* data) bool SVC_ClassInfo_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_ClassInfo* data)
{ {
const int16_t numServerClasses = bitbuf.ReadShort(); const int16_t numServerClasses = bitbuf.ReadShort();
const bool createOnClient = bitbuf.ReadOneBit() != 0; const bool createOnClient = bitbuf.ReadOneBit() != 0;
@ -27,7 +27,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_ClassInfo_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_ClassInfo* data) bool SVC_ClassInfo_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_ClassInfo* data)
{ {
bitbuf.WriteShort(data->numServerClasses); bitbuf.WriteShort(data->numServerClasses);
bitbuf.WriteOneBit(data->createOnClient); bitbuf.WriteOneBit(data->createOnClient);

View File

@ -6,7 +6,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_CreateStringTable_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_CreateStringTable* data) bool SVC_CreateStringTable_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_CreateStringTable* data)
{ {
if (bitbuf.PeekUBitLong(8) == ':') if (bitbuf.PeekUBitLong(8) == ':')
{ {
@ -52,7 +52,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_CreateStringTable_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_CreateStringTable* data) bool SVC_CreateStringTable_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_CreateStringTable* data)
{ {
if (data->isFileNames) if (data->isFileNames)
{ {

View File

@ -5,7 +5,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_CrosshairAngle_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_CrosshairAngle* data) bool SVC_CrosshairAngle_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_CrosshairAngle* data)
{ {
data->x = bitbuf.ReadBitAngle(16); data->x = bitbuf.ReadBitAngle(16);
data->y = bitbuf.ReadBitAngle(16); data->y = bitbuf.ReadBitAngle(16);
@ -13,7 +13,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_CrosshairAngle_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_CrosshairAngle* data) bool SVC_CrosshairAngle_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_CrosshairAngle* data)
{ {
bitbuf.WriteBitAngle(data->x, 16); bitbuf.WriteBitAngle(data->x, 16);
bitbuf.WriteBitAngle(data->y, 16); bitbuf.WriteBitAngle(data->y, 16);

View File

@ -6,7 +6,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_EntityMessage_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_EntityMessage* data) bool SVC_EntityMessage_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_EntityMessage* data)
{ {
data->entIndex = bitbuf.ReadUBitLong(MAX_EDICT_BITS); data->entIndex = bitbuf.ReadUBitLong(MAX_EDICT_BITS);
data->classID = bitbuf.ReadUBitLong(MAX_SERVER_CLASS_BITS); data->classID = bitbuf.ReadUBitLong(MAX_SERVER_CLASS_BITS);
@ -16,7 +16,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_EntityMessage_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_EntityMessage* data) bool SVC_EntityMessage_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_EntityMessage* data)
{ {
bitbuf.WriteUBitLong(data->entIndex, MAX_EDICT_BITS); bitbuf.WriteUBitLong(data->entIndex, MAX_EDICT_BITS);
bitbuf.WriteUBitLong(data->classID, MAX_SERVER_CLASS_BITS); bitbuf.WriteUBitLong(data->classID, MAX_SERVER_CLASS_BITS);

View File

@ -5,7 +5,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_FixAngle_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_FixAngle* data) bool SVC_FixAngle_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_FixAngle* data)
{ {
data->relative = bitbuf.ReadOneBit() != 0; data->relative = bitbuf.ReadOneBit() != 0;
data->x = bitbuf.ReadBitAngle(16); data->x = bitbuf.ReadBitAngle(16);
@ -14,7 +14,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_FixAngle_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_FixAngle* data) bool SVC_FixAngle_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_FixAngle* data)
{ {
bitbuf.WriteOneBit(data->relative); bitbuf.WriteOneBit(data->relative);
bitbuf.WriteBitAngle(data->x, 16); bitbuf.WriteBitAngle(data->x, 16);

View File

@ -6,7 +6,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_GameEvent_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_GameEvent* data) bool SVC_GameEvent_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_GameEvent* data)
{ {
data->dataLengthInBits = bitbuf.ReadUBitLong(11); data->dataLengthInBits = bitbuf.ReadUBitLong(11);
data->data.reset(new uint8_t[math::BitsToBytes(data->dataLengthInBits)]); data->data.reset(new uint8_t[math::BitsToBytes(data->dataLengthInBits)]);
@ -14,7 +14,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_GameEvent_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_GameEvent* data) bool SVC_GameEvent_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_GameEvent* data)
{ {
bitbuf.WriteUBitLong(data->dataLengthInBits, 11); bitbuf.WriteUBitLong(data->dataLengthInBits, 11);
bitbuf.WriteBits(data->data.get(), data->dataLengthInBits); bitbuf.WriteBits(data->data.get(), data->dataLengthInBits);

View File

@ -9,7 +9,7 @@ using EventValue = NetMsg::SVC_GameEventList::EventValue;
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_GameEventList_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_GameEventList* data) bool SVC_GameEventList_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_GameEventList* data)
{ {
data->eventDescriptors.resize(bitbuf.ReadUBitLong(MAX_EVENT_BITS)); data->eventDescriptors.resize(bitbuf.ReadUBitLong(MAX_EVENT_BITS));
data->dataLengthInBits = bitbuf.ReadUBitLong(20); data->dataLengthInBits = bitbuf.ReadUBitLong(20);
@ -28,7 +28,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_GameEventList_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_GameEventList* data) bool SVC_GameEventList_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_GameEventList* data)
{ {
bitbuf.WriteUBitLong(data->eventDescriptors.size(), MAX_EVENT_BITS); bitbuf.WriteUBitLong(data->eventDescriptors.size(), MAX_EVENT_BITS);
bitbuf.WriteUBitLong(data->dataLengthInBits, 20); bitbuf.WriteUBitLong(data->dataLengthInBits, 20);

View File

@ -4,14 +4,14 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_GetCvarValue_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_GetCvarValue* data) bool SVC_GetCvarValue_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_GetCvarValue* data)
{ {
data->cookie = bitbuf.ReadSBitLong(32); data->cookie = bitbuf.ReadSBitLong(32);
bitbuf.ReadString(data->cvarName, sizeof(data->cvarName)); bitbuf.ReadString(data->cvarName, sizeof(data->cvarName));
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_GetCvarValue_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_GetCvarValue* data) bool SVC_GetCvarValue_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_GetCvarValue* data)
{ {
bitbuf.WriteSBitLong(data->cookie, 32); bitbuf.WriteSBitLong(data->cookie, 32);
bitbuf.WriteString(data->cvarName); bitbuf.WriteString(data->cvarName);

View File

@ -4,13 +4,13 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_HLTV_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_HLTV* data) bool SVC_HLTV_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_HLTV* data)
{ {
assert(false); assert(false);
return true; return true;
} }
bool SVC_HLTV_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_HLTV* data) bool SVC_HLTV_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_HLTV* data)
{ {
assert(false); assert(false);
return true; return true;

View File

@ -17,7 +17,7 @@ static const char* KeyValuesBin_GetName(uint8_t* data, size_t dataLength)
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_Menu_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_Menu* data) bool SVC_Menu_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_Menu* data)
{ {
data->type = static_cast<DialogType>(bitbuf.ReadShort()); data->type = static_cast<DialogType>(bitbuf.ReadShort());
data->dataLengthInBytes = bitbuf.ReadWord(); data->dataLengthInBytes = bitbuf.ReadWord();
@ -26,7 +26,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_Menu_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_Menu* data) bool SVC_Menu_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_Menu* data)
{ {
bitbuf.WriteShort(static_cast<uint16_t>(data->type)); bitbuf.WriteShort(static_cast<uint16_t>(data->type));
bitbuf.WriteWord(data->dataLengthInBytes); bitbuf.WriteWord(data->dataLengthInBytes);

View File

@ -6,7 +6,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_PacketEntities_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_PacketEntities* data) bool SVC_PacketEntities_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_PacketEntities* data)
{ {
data->maxEntries = bitbuf.ReadUBitLong(MAX_EDICT_BITS); data->maxEntries = bitbuf.ReadUBitLong(MAX_EDICT_BITS);
data->isDelta = bitbuf.ReadOneBit() != 0; data->isDelta = bitbuf.ReadOneBit() != 0;
@ -27,7 +27,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_PacketEntities_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_PacketEntities* data) bool SVC_PacketEntities_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_PacketEntities* data)
{ {
bitbuf.WriteUBitLong(data->maxEntries, MAX_EDICT_BITS); bitbuf.WriteUBitLong(data->maxEntries, MAX_EDICT_BITS);
if (data->isDelta) if (data->isDelta)

View File

@ -5,7 +5,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_Prefetch_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_Prefetch* data) bool SVC_Prefetch_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_Prefetch* data)
{ {
data->type = NetMsg::SVC_Prefetch::SOUND; data->type = NetMsg::SVC_Prefetch::SOUND;
if (context.protocol > 23) if (context.protocol > 23)
@ -19,7 +19,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_Prefetch_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_Prefetch* data) bool SVC_Prefetch_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_Prefetch* data)
{ {
if (context.protocol > 23) if (context.protocol > 23)
{ {

View File

@ -4,13 +4,13 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_Print_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_Print* data) bool SVC_Print_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_Print* data)
{ {
bitbuf.ReadString(data->text, sizeof(data->text)); bitbuf.ReadString(data->text, sizeof(data->text));
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_Print_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_Print* data) bool SVC_Print_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_Print* data)
{ {
bitbuf.WriteString(data->text); bitbuf.WriteString(data->text);
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();

View File

@ -5,7 +5,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_SendTable_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_SendTable* data) bool SVC_SendTable_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_SendTable* data)
{ {
data->needsDecoder = bitbuf.ReadOneBit() != 0; data->needsDecoder = bitbuf.ReadOneBit() != 0;
data->dataLengthInBits = bitbuf.ReadShort(); data->dataLengthInBits = bitbuf.ReadShort();
@ -14,7 +14,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_SendTable_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_SendTable* data) bool SVC_SendTable_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_SendTable* data)
{ {
bitbuf.WriteOneBit(data->needsDecoder); bitbuf.WriteOneBit(data->needsDecoder);
bitbuf.WriteShort(data->dataLengthInBits); bitbuf.WriteShort(data->dataLengthInBits);

View File

@ -4,7 +4,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_ServerInfo_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_ServerInfo* data) bool SVC_ServerInfo_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_ServerInfo* data)
{ {
data->protocol = bitbuf.ReadShort(); data->protocol = bitbuf.ReadShort();
data->serverCount = bitbuf.ReadLong(); data->serverCount = bitbuf.ReadLong();
@ -35,7 +35,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_ServerInfo_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_ServerInfo* data) bool SVC_ServerInfo_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_ServerInfo* data)
{ {
bitbuf.WriteShort(data->protocol); bitbuf.WriteShort(data->protocol);
bitbuf.WriteLong(data->serverCount); bitbuf.WriteLong(data->serverCount);

View File

@ -4,13 +4,13 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_SetPause_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_SetPause* data) bool SVC_SetPause_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_SetPause* data)
{ {
data->isPaused = bitbuf.ReadOneBit() != 0; data->isPaused = bitbuf.ReadOneBit() != 0;
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_SetPause_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_SetPause* data) bool SVC_SetPause_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_SetPause* data)
{ {
bitbuf.WriteOneBit(data->isPaused); bitbuf.WriteOneBit(data->isPaused);
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();

View File

@ -5,13 +5,13 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_SetView_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_SetView* data) bool SVC_SetView_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_SetView* data)
{ {
data->entIndex = bitbuf.ReadUBitLong(MAX_EDICT_BITS); data->entIndex = bitbuf.ReadUBitLong(MAX_EDICT_BITS);
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_SetView_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_SetView* data) bool SVC_SetView_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_SetView* data)
{ {
bitbuf.WriteUBitLong(data->entIndex, MAX_EDICT_BITS); bitbuf.WriteUBitLong(data->entIndex, MAX_EDICT_BITS);
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();

View File

@ -5,7 +5,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_Sounds_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_Sounds* data) bool SVC_Sounds_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_Sounds* data)
{ {
data->reliableSound = bitbuf.ReadOneBit() != 0; data->reliableSound = bitbuf.ReadOneBit() != 0;
if (data->reliableSound) if (data->reliableSound)
@ -23,7 +23,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_Sounds_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_Sounds* data) bool SVC_Sounds_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_Sounds* data)
{ {
if (data->reliableSound) if (data->reliableSound)
{ {

View File

@ -6,7 +6,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_TempEntities_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_TempEntities* data) bool SVC_TempEntities_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_TempEntities* data)
{ {
data->numEntries = bitbuf.ReadUBitLong(EVENT_INDEX_BITS); data->numEntries = bitbuf.ReadUBitLong(EVENT_INDEX_BITS);
if (context.protocol > 23) if (context.protocol > 23)
@ -22,7 +22,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_TempEntities_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_TempEntities* data) bool SVC_TempEntities_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_TempEntities* data)
{ {
bitbuf.WriteUBitLong(data->numEntries, EVENT_INDEX_BITS); bitbuf.WriteUBitLong(data->numEntries, EVENT_INDEX_BITS);
if (context.protocol > 23) if (context.protocol > 23)

View File

@ -4,13 +4,13 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_TerrainMod_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_TerrainMod* data) bool SVC_TerrainMod_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_TerrainMod* data)
{ {
assert(false); assert(false);
return true; return true;
} }
bool SVC_TerrainMod_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_TerrainMod* data) bool SVC_TerrainMod_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_TerrainMod* data)
{ {
assert(false); assert(false);
return true; return true;

View File

@ -6,7 +6,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_UpdateStringTable_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_UpdateStringTable* data) bool SVC_UpdateStringTable_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_UpdateStringTable* data)
{ {
data->tableID = bitbuf.ReadUBitLong(math::log2(MAX_TABLES)); data->tableID = bitbuf.ReadUBitLong(math::log2(MAX_TABLES));
data->numChangedEntries = (bitbuf.ReadOneBit() != 0) ? bitbuf.ReadWord() : 1; data->numChangedEntries = (bitbuf.ReadOneBit() != 0) ? bitbuf.ReadWord() : 1;
@ -16,7 +16,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_UpdateStringTable_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_UpdateStringTable* data) bool SVC_UpdateStringTable_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_UpdateStringTable* data)
{ {
bitbuf.WriteUBitLong(data->tableID, math::log2(MAX_TABLES)); bitbuf.WriteUBitLong(data->tableID, math::log2(MAX_TABLES));
if (data->numChangedEntries != 1) if (data->numChangedEntries != 1)

View File

@ -7,7 +7,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_UserMessage_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_UserMessage* data) bool SVC_UserMessage_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_UserMessage* data)
{ {
data->msgType = bitbuf.ReadByte(); data->msgType = bitbuf.ReadByte();
data->dataLengthInBits = bitbuf.ReadUBitLong(11); data->dataLengthInBits = bitbuf.ReadUBitLong(11);
@ -17,7 +17,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_UserMessage_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_UserMessage* data) bool SVC_UserMessage_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_UserMessage* data)
{ {
bitbuf.WriteByte(data->msgType); bitbuf.WriteByte(data->msgType);
bitbuf.WriteUBitLong(data->dataLengthInBits, 11); bitbuf.WriteUBitLong(data->dataLengthInBits, 11);

View File

@ -5,7 +5,7 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_VoiceData_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_VoiceData* data) bool SVC_VoiceData_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_VoiceData* data)
{ {
data->fromClientIndex = bitbuf.ReadByte(); data->fromClientIndex = bitbuf.ReadByte();
data->proximity = !!bitbuf.ReadByte(); data->proximity = !!bitbuf.ReadByte();
@ -15,7 +15,7 @@ namespace NetHandlers
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_VoiceData_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_VoiceData* data) bool SVC_VoiceData_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_VoiceData* data)
{ {
bitbuf.WriteByte(data->fromClientIndex); bitbuf.WriteByte(data->fromClientIndex);
bitbuf.WriteByte(data->proximity); bitbuf.WriteByte(data->proximity);

View File

@ -4,14 +4,14 @@
namespace NetHandlers namespace NetHandlers
{ {
bool SVC_VoiceInit_BitRead_Internal(bf_read& bitbuf, SourceGameContext& context, NetMsg::SVC_VoiceInit* data) bool SVC_VoiceInit_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_VoiceInit* data)
{ {
bitbuf.ReadString(data->voiceCodec, sizeof(data->voiceCodec)); bitbuf.ReadString(data->voiceCodec, sizeof(data->voiceCodec));
data->quality = bitbuf.ReadByte(); data->quality = bitbuf.ReadByte();
return !bitbuf.IsOverflowed(); return !bitbuf.IsOverflowed();
} }
bool SVC_VoiceInit_BitWrite_Internal(bf_write& bitbuf, const SourceGameContext& context, NetMsg::SVC_VoiceInit* data) bool SVC_VoiceInit_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_VoiceInit* data)
{ {
bitbuf.WriteString(data->voiceCodec); bitbuf.WriteString(data->voiceCodec);
bitbuf.WriteByte(data->quality); bitbuf.WriteByte(data->quality);