The slicing is now done with a new demoeditor each time we save a replay

This commit is contained in:
Corantin H 2019-05-25 15:16:03 +02:00
parent e35951dedc
commit cbcb8d4830
2 changed files with 12 additions and 2 deletions

View file

@ -3325,8 +3325,12 @@ void CClient::SaveReplay()
const int EndTick = GameTick();
const int StartTick = EndTick - g_Config.m_ClReplayLength * GameTickSpeed();
// Create a DemoEditor to do the job
CDemoEditor *DemoEditor = new CDemoEditor();
DemoEditor->Init(m_pGameClient->NetVersion(), &m_SnapshotDelta, m_pConsole, m_pStorage);
// Create a job to do this slicing in background because it can be a bit long depending on the file size
std::shared_ptr<CDemoEdit> pDemoEditTask = std::make_shared<CDemoEdit>(this, m_pConsole, &m_DemoEditor, pSrc, aFilename, StartTick, EndTick);
std::shared_ptr<CDemoEdit> pDemoEditTask = std::make_shared<CDemoEdit>(this, m_pConsole, DemoEditor, pSrc, aFilename, StartTick, EndTick);
Engine()->AddJob(pDemoEditTask);
}
}
@ -3989,6 +3993,11 @@ void CClient::GetSmoothTick(int *pSmoothTick, float *pSmoothIntraTick, float Mix
*pSmoothIntraTick = (SmoothTime - (*pSmoothTick-1)*time_freq()/50) / (float)(time_freq()/50);
}
CDemoEdit::~CDemoEdit()
{
delete m_pDemoEditor;
}
CDemoEdit::CDemoEdit(CClient *pClient, IConsole *pConsole, CDemoEditor *pDemoEditor, const char *pDemo, const char *pDst, int StartTick, int EndTick) :
m_pClient(pClient),
m_pConsole(pConsole),
@ -4019,4 +4028,4 @@ void CDemoEdit::Run()
// And we restart the recorder
m_pClient->DemoRecorder_StartReplayRecorder();
}
}

View file

@ -437,6 +437,7 @@ class CDemoEdit : public IJob
public:
CDemoEdit(CClient *pClient, IConsole *pConsole, CDemoEditor *pDemoEditor, const char *pDemo, const char *pDst, int StartTick, int EndTick);
~CDemoEdit();
void Run();
};