2
0
mirror of https://github.com/rehlds/rehlds.git synced 2025-04-09 11:00:08 +03:00

-Remove delay in recording demos.

-Stop demo after new world is appear.
This commit is contained in:
Garey Akhmetshin 2021-02-14 23:23:28 +05:00
parent a07e88b147
commit 300d03eb85
2 changed files with 12 additions and 13 deletions

View File

@ -157,6 +157,11 @@ void DemoClient::RunFrame(double time)
void DemoClient::SendDatagram()
{
#ifndef HLTV_FIXES
/*
* Delaying frames to demo is wrong.
* Early stopping demo will lost server frames.
*/
if (m_Proxy->GetDelay() > 0)
{
double worldTime = m_Proxy->GetSpectatorTime();
@ -173,7 +178,7 @@ void DemoClient::SendDatagram()
return;
}
#endif
frame_t *frame = m_World->GetLastFrame();
if (frame) {
WriteDatagram(frame->time, frame);

View File

@ -106,6 +106,11 @@ void Proxy::AddNextWorld()
if (m_Server->IsConnected()) {
m_Server->Reconnect();
}
if (m_DemoClient.IsActive())
{
m_DemoClient.Reconnect();
m_DemoClient.SetWorld(nextWorld);
}
}
#endif
bool Proxy::Init(IBaseSystem *system, int serial, char *name)
@ -345,18 +350,7 @@ void Proxy::RunFrame(double time)
// We can't RemoveModule m_World right now because it will fire events to unload us.
// Store it in temp var to unload it after set new world
IWorld* oldWorld = m_World;
m_World = head;
if (m_DemoClient.IsActive())
{
m_DemoClient.Disconnect("End of Record");
m_DemoClient.SetProxy(this);
m_DemoClient.SetWorld(m_World);
if (m_DemoClient.Connect())
{
m_DemoClient.SetUpdateRate(m_MaxUpdateRate);
m_DemoClient.SetRate(m_MaxRate);
}
}
m_World = head;
m_Worlds.RemoveHead();
NewGameStarted();
ReconnectClients();