mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
add tuning to demo. Closes #899
This commit is contained in:
parent
7d2df3a386
commit
4fde2cf7f2
|
@ -65,6 +65,7 @@ public:
|
|||
virtual void Kick(int ClientID, const char *pReason) = 0;
|
||||
|
||||
virtual void DemoRecorder_HandleAutoStart() = 0;
|
||||
virtual bool DemoRecorder_IsRecording() = 0;
|
||||
};
|
||||
|
||||
class IGameServer : public IInterface
|
||||
|
|
|
@ -1500,6 +1500,11 @@ void CServer::DemoRecorder_HandleAutoStart()
|
|||
}
|
||||
}
|
||||
|
||||
bool CServer::DemoRecorder_IsRecording()
|
||||
{
|
||||
return m_DemoRecorder.IsRecording();
|
||||
}
|
||||
|
||||
void CServer::ConRecord(IConsole::IResult *pResult, void *pUser)
|
||||
{
|
||||
CServer* pServer = (CServer *)pUser;
|
||||
|
|
|
@ -170,6 +170,7 @@ public:
|
|||
void Kick(int ClientID, const char *pReason);
|
||||
|
||||
void DemoRecorder_HandleAutoStart();
|
||||
bool DemoRecorder_IsRecording();
|
||||
|
||||
//int Tick()
|
||||
int64 TickStartTime(int Tick);
|
||||
|
|
|
@ -893,6 +893,15 @@ void CGameClient::OnNewSnapshot()
|
|||
m_ServerMode = SERVERMODE_PUREMOD;
|
||||
}
|
||||
|
||||
// add tuning to demo
|
||||
if(DemoRecorder()->IsRecording() && mem_comp(&StandardTuning, &m_Tuning, sizeof(CTuningParams)) != 0)
|
||||
{
|
||||
CMsgPacker Msg(NETMSGTYPE_SV_TUNEPARAMS);
|
||||
int *pParams = (int *)&m_Tuning;
|
||||
for(unsigned i = 0; i < sizeof(m_Tuning)/sizeof(int); i++)
|
||||
Msg.AddInt(pParams[i]);
|
||||
Client()->SendMsg(&Msg, MSGFLAG_RECORD|MSGFLAG_NOSEND);
|
||||
}
|
||||
}
|
||||
|
||||
void CGameClient::OnPredict()
|
||||
|
|
|
@ -1511,6 +1511,17 @@ void CGameContext::OnShutdown()
|
|||
|
||||
void CGameContext::OnSnap(int ClientID)
|
||||
{
|
||||
// add tuning to demo
|
||||
CTuningParams StandardTuning;
|
||||
if(ClientID == -1 && Server()->DemoRecorder_IsRecording() && mem_comp(&StandardTuning, &m_Tuning, sizeof(CTuningParams)) != 0)
|
||||
{
|
||||
CMsgPacker Msg(NETMSGTYPE_SV_TUNEPARAMS);
|
||||
int *pParams = (int *)&m_Tuning;
|
||||
for(unsigned i = 0; i < sizeof(m_Tuning)/sizeof(int); i++)
|
||||
Msg.AddInt(pParams[i]);
|
||||
Server()->SendMsg(&Msg, MSGFLAG_RECORD|MSGFLAG_NOSEND, ClientID);
|
||||
}
|
||||
|
||||
m_World.Snap(ClientID);
|
||||
m_pController->Snap(ClientID);
|
||||
m_Events.Snap(ClientID);
|
||||
|
|
Loading…
Reference in a new issue