record a new demo when a game ends. Closes #358

This commit is contained in:
oy 2011-01-06 23:21:51 +01:00
parent eedaf62d97
commit 41b8022aa1
4 changed files with 11 additions and 0 deletions

View file

@ -77,6 +77,7 @@ public:
virtual void Quit() = 0;
virtual const char *DemoPlayer_Play(const char *pFilename, int StorageType) = 0;
virtual void DemoRecorder_Start(const char *pFilename, bool WithTimestamp) = 0;
virtual void DemoRecorder_HandleAutoStart() = 0;
virtual void DemoRecorder_Stop() = 0;
virtual void AutoScreenshot_Start() = 0;

View file

@ -2154,6 +2154,7 @@ void CClient::DemoRecorder_HandleAutoStart()
{
if(g_Config.m_ClAutoDemoRecord)
{
DemoRecorder_Stop();
DemoRecorder_Start("auto/autorecord", true);
if(g_Config.m_ClAutoDemoMax)
{

View file

@ -591,6 +591,12 @@ void CGameClient::OnGameOver()
Client()->AutoScreenshot_Start();
}
void CGameClient::OnStartGame()
{
if(Client()->State() != IClient::STATE_DEMOPLAYBACK)
Client()->DemoRecorder_HandleAutoStart();
}
void CGameClient::OnRconLine(const char *pLine)
{
m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine);
@ -781,6 +787,8 @@ void CGameClient::OnNewSnapshot()
m_Snap.m_pGameobj = (CNetObj_Game *)pData;
if(s_GameOver == 0 && m_Snap.m_pGameobj->m_GameOver != 0)
OnGameOver();
else if(s_GameOver != 0 && m_Snap.m_pGameobj->m_GameOver == 0)
OnStartGame();
s_GameOver = m_Snap.m_pGameobj->m_GameOver;
}
else if(Item.m_Type == NETOBJTYPE_FLAG)

View file

@ -181,6 +181,7 @@ public:
virtual void OnEnterGame();
virtual void OnRconLine(const char *pLine);
virtual void OnGameOver();
virtual void OnStartGame();
virtual const char *GetItemName(int Type);
virtual const char *Version();