Added SVC_CmdKeyValues and SVC_SetPauseTimed
This commit is contained in:
parent
134c8d0ed0
commit
630351e7e5
@ -40,6 +40,8 @@
|
|||||||
#include "svc_menu.h"
|
#include "svc_menu.h"
|
||||||
#include "svc_gameeventlist.h"
|
#include "svc_gameeventlist.h"
|
||||||
#include "svc_getcvarvalue.h"
|
#include "svc_getcvarvalue.h"
|
||||||
|
#include "svc_cmdkeyvalues.h"
|
||||||
|
#include "svc_setpausetimed.h"
|
||||||
|
|
||||||
void NetHandlers::CreateNetMsgStructs(NetDataStructArray& netDataStructs)
|
void NetHandlers::CreateNetMsgStructs(NetDataStructArray& netDataStructs)
|
||||||
{
|
{
|
||||||
@ -75,6 +77,8 @@ void NetHandlers::CreateNetMsgStructs(NetDataStructArray& netDataStructs)
|
|||||||
netDataStructs[29] = new NetMsg::SVC_Menu();
|
netDataStructs[29] = new NetMsg::SVC_Menu();
|
||||||
netDataStructs[30] = new NetMsg::SVC_GameEventList();
|
netDataStructs[30] = new NetMsg::SVC_GameEventList();
|
||||||
netDataStructs[31] = new NetMsg::SVC_GetCvarValue();
|
netDataStructs[31] = new NetMsg::SVC_GetCvarValue();
|
||||||
|
netDataStructs[32] = new NetMsg::SVC_CmdKeyValues();
|
||||||
|
netDataStructs[33] = new NetMsg::SVC_SetPauseTimed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetHandlers::DestroyNetMsgStructs(NetDataStructArray& netDataStructs)
|
void NetHandlers::DestroyNetMsgStructs(NetDataStructArray& netDataStructs)
|
||||||
@ -111,6 +115,8 @@ void NetHandlers::DestroyNetMsgStructs(NetDataStructArray& netDataStructs)
|
|||||||
delete reinterpret_cast<NetMsg::SVC_Menu*>(netDataStructs[29]);
|
delete reinterpret_cast<NetMsg::SVC_Menu*>(netDataStructs[29]);
|
||||||
delete reinterpret_cast<NetMsg::SVC_GameEventList*>(netDataStructs[30]);
|
delete reinterpret_cast<NetMsg::SVC_GameEventList*>(netDataStructs[30]);
|
||||||
delete reinterpret_cast<NetMsg::SVC_GetCvarValue*>(netDataStructs[31]);
|
delete reinterpret_cast<NetMsg::SVC_GetCvarValue*>(netDataStructs[31]);
|
||||||
|
delete reinterpret_cast<NetMsg::SVC_CmdKeyValues*>(netDataStructs[32]);
|
||||||
|
delete reinterpret_cast<NetMsg::SVC_SetPauseTimed*>(netDataStructs[33]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DECLARE_NET_HANDLER_ARRAY(funcname) \
|
#define DECLARE_NET_HANDLER_ARRAY(funcname) \
|
||||||
@ -146,7 +152,9 @@ void NetHandlers::DestroyNetMsgStructs(NetDataStructArray& netDataStructs)
|
|||||||
&NetHandlers::SVC_Prefetch_##funcname, \
|
&NetHandlers::SVC_Prefetch_##funcname, \
|
||||||
&NetHandlers::SVC_Menu_##funcname, \
|
&NetHandlers::SVC_Menu_##funcname, \
|
||||||
&NetHandlers::SVC_GameEventList_##funcname, \
|
&NetHandlers::SVC_GameEventList_##funcname, \
|
||||||
&NetHandlers::SVC_GetCvarValue_##funcname \
|
&NetHandlers::SVC_GetCvarValue_##funcname, \
|
||||||
|
&NetHandlers::SVC_CmdKeyValues_##funcname, \
|
||||||
|
&NetHandlers::SVC_SetPauseTimed_##funcname \
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef bool (*NetMsgBitReadFn)(NetHandlers::BitRead& bitbuf, SourceGameContext& context, void* data);
|
typedef bool (*NetMsgBitReadFn)(NetHandlers::BitRead& bitbuf, SourceGameContext& context, void* data);
|
||||||
|
@ -61,6 +61,9 @@ namespace NetMsg
|
|||||||
|
|
||||||
svc_GetCvarValue = 31, // Server wants to know the value of a cvar on the client.
|
svc_GetCvarValue = 31, // Server wants to know the value of a cvar on the client.
|
||||||
|
|
||||||
SVC_LASTMSG = 31 // last known server messages
|
svc_CmdKeyValues = 32,
|
||||||
|
svc_SetPauseTimed = 33,
|
||||||
|
|
||||||
|
SVC_LASTMSG = 33 // last known server messages
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
38
demboyz/netmessages/svc_cmdkeyvalues.cpp
Normal file
38
demboyz/netmessages/svc_cmdkeyvalues.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
#include "svc_cmdkeyvalues.h"
|
||||||
|
#include "base/bitfile.h"
|
||||||
|
#include "base/jsonfile.h"
|
||||||
|
|
||||||
|
namespace NetHandlers
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
bool SVC_CmdKeyValues_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_CmdKeyValues* data)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SVC_CmdKeyValues_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_CmdKeyValues* data)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SVC_CmdKeyValues_JsonRead_Internal(JsonRead& jsonbuf, SourceGameContext& context, NetMsg::SVC_CmdKeyValues* data)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SVC_CmdKeyValues_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_CmdKeyValues* data)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SVC_CmdKeyValues_ToString_Internal(std::ostringstream& out, NetMsg::SVC_CmdKeyValues* data)
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
out << "svc_CmdKeyValues";
|
||||||
|
}
|
||||||
|
}
|
13
demboyz/netmessages/svc_cmdkeyvalues.h
Normal file
13
demboyz/netmessages/svc_cmdkeyvalues.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "nethandlers.h"
|
||||||
|
|
||||||
|
namespace NetMsg
|
||||||
|
{
|
||||||
|
struct SVC_CmdKeyValues
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
DECLARE_NET_HANDLERS(SVC_CmdKeyValues);
|
45
demboyz/netmessages/svc_setpausetimed.cpp
Normal file
45
demboyz/netmessages/svc_setpausetimed.cpp
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
|
||||||
|
#include "svc_setpausetimed.h"
|
||||||
|
#include "base/bitfile.h"
|
||||||
|
#include "base/jsonfile.h"
|
||||||
|
|
||||||
|
namespace NetHandlers
|
||||||
|
{
|
||||||
|
bool SVC_SetPauseTimed_BitRead_Internal(BitRead& bitbuf, SourceGameContext& context, NetMsg::SVC_SetPauseTimed* data)
|
||||||
|
{
|
||||||
|
data->isPaused = bitbuf.ReadOneBit() != 0;
|
||||||
|
data->time = bitbuf.ReadFloat();
|
||||||
|
return !bitbuf.IsOverflowed();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SVC_SetPauseTimed_BitWrite_Internal(BitWrite& bitbuf, const SourceGameContext& context, NetMsg::SVC_SetPauseTimed* data)
|
||||||
|
{
|
||||||
|
bitbuf.WriteOneBit(data->isPaused);
|
||||||
|
bitbuf.WriteFloat(data->time);
|
||||||
|
return !bitbuf.IsOverflowed();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SVC_SetPauseTimed_JsonRead_Internal(JsonRead& jsonbuf, SourceGameContext& context, NetMsg::SVC_SetPauseTimed* data)
|
||||||
|
{
|
||||||
|
base::JsonReaderObject reader = jsonbuf.ParseObject();
|
||||||
|
assert(!reader.HasReadError());
|
||||||
|
data->isPaused = reader.ReadBool("isPaused");
|
||||||
|
data->time = reader.ReadFloat("time");
|
||||||
|
return !reader.HasReadError();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SVC_SetPauseTimed_JsonWrite_Internal(JsonWrite& jsonbuf, const SourceGameContext& context, NetMsg::SVC_SetPauseTimed* data)
|
||||||
|
{
|
||||||
|
jsonbuf.Reset();
|
||||||
|
jsonbuf.StartObject();
|
||||||
|
jsonbuf.WriteBool("isPaused", data->isPaused);
|
||||||
|
jsonbuf.WriteFloat("time", data->time);
|
||||||
|
jsonbuf.EndObject();
|
||||||
|
return jsonbuf.IsComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SVC_SetPauseTimed_ToString_Internal(std::ostringstream& out, NetMsg::SVC_SetPauseTimed* data)
|
||||||
|
{
|
||||||
|
out << "svc_SetPauseTimed: " << (data->isPaused ? "paused" : "unpaused");
|
||||||
|
}
|
||||||
|
}
|
15
demboyz/netmessages/svc_setpausetimed.h
Normal file
15
demboyz/netmessages/svc_setpausetimed.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "nethandlers.h"
|
||||||
|
|
||||||
|
namespace NetMsg
|
||||||
|
{
|
||||||
|
struct SVC_SetPauseTimed
|
||||||
|
{
|
||||||
|
bool isPaused;
|
||||||
|
float time;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
DECLARE_NET_HANDLERS(SVC_SetPauseTimed);
|
Loading…
Reference in New Issue
Block a user