diff options
| author | oy <Tom_Adams@web.de> | 2011-01-06 23:21:51 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-01-06 23:21:51 +0100 |
| commit | 41b8022aa1a941a4b2f3095dd4f8600daf4cd168 (patch) | |
| tree | 5f6a37072c430f280f99de419e8fb1f27c2b496a | |
| parent | eedaf62d97d1100bc4bd3dda50bfcd0c3763e812 (diff) | |
| download | zcatch-41b8022aa1a941a4b2f3095dd4f8600daf4cd168.tar.gz zcatch-41b8022aa1a941a4b2f3095dd4f8600daf4cd168.zip | |
record a new demo when a game ends. Closes #358
| -rw-r--r-- | src/engine/client.h | 1 | ||||
| -rw-r--r-- | src/engine/client/client.cpp | 1 | ||||
| -rw-r--r-- | src/game/client/gameclient.cpp | 8 | ||||
| -rw-r--r-- | src/game/client/gameclient.h | 1 |
4 files changed, 11 insertions, 0 deletions
diff --git a/src/engine/client.h b/src/engine/client.h index ab1f0547..80a0241d 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -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; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index aab6e68f..d67e3332 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -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) { diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 45bd7ae3..2bebf486 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -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) diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 5ee2c989..99e64028 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -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(); |