From c75a75b64ff804e7a14374e17b31377aabff0d63 Mon Sep 17 00:00:00 2001 From: oy Date: Sun, 12 Dec 2010 16:48:13 +0100 Subject: made it possible to automatically take game over screenshots. Closes #339 --- src/game/client/gameclient.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/game/client/gameclient.cpp') diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 08459abc..4696bdcd 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -584,6 +584,12 @@ void CGameClient::OnStateChange(int NewState, int OldState) void CGameClient::OnShutdown() {} void CGameClient::OnEnterGame() {} +void CGameClient::OnGameOver() +{ + if(Client()->State() != IClient::STATE_DEMOPLAYBACK) + Client()->AutoScreenshot_Start(); +} + void CGameClient::OnRconLine(const char *pLine) { m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine); @@ -769,7 +775,13 @@ void CGameClient::OnNewSnapshot() } } else if(Item.m_Type == NETOBJTYPE_GAME) + { + static int s_GameOver = 0; m_Snap.m_pGameobj = (CNetObj_Game *)pData; + if(s_GameOver == 0 && m_Snap.m_pGameobj->m_GameOver != 0) + OnGameOver(); + s_GameOver = m_Snap.m_pGameobj->m_GameOver; + } else if(Item.m_Type == NETOBJTYPE_FLAG) m_Snap.m_paFlags[Item.m_Id%2] = (const CNetObj_Flag *)pData; } -- cgit 1.4.1