diff options
| author | oy <Tom_Adams@web.de> | 2010-12-12 16:48:13 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-12-12 16:48:13 +0100 |
| commit | c75a75b64ff804e7a14374e17b31377aabff0d63 (patch) | |
| tree | 0b49986e39b44ae0b1f4673753a712779723813d /src/game/client | |
| parent | b4c007778cab749e9d163baec64d22349435ea3f (diff) | |
| download | zcatch-c75a75b64ff804e7a14374e17b31377aabff0d63.tar.gz zcatch-c75a75b64ff804e7a14374e17b31377aabff0d63.zip | |
made it possible to automatically take game over screenshots. Closes #339
Diffstat (limited to 'src/game/client')
| -rw-r--r-- | src/game/client/components/menus_settings.cpp | 21 | ||||
| -rw-r--r-- | src/game/client/gameclient.cpp | 12 | ||||
| -rw-r--r-- | src/game/client/gameclient.h | 1 |
3 files changed, 31 insertions, 3 deletions
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index b12a0c8d..c0ea2b5a 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -729,18 +729,22 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) int OldSelected = s_SelectedLanguage; - CUIRect List, Button, Label, Left; + CUIRect List, Button, Label, Left, Right; MainView.HSplitBottom(10.0f, &MainView, 0); MainView.HSplitBottom(70.0f, &MainView, &Left); - Left.VSplitMid(&Left, 0); - Left.HSplitTop(20.0f, &Button, &Left); + Left.VSplitMid(&Left, &Right); MainView.HSplitBottom(20.0f, &List, &MainView); // auto demo settings { + Left.HSplitTop(20.0f, &Button, &Left); if(DoButton_CheckBox(&g_Config.m_ClAutoDemoRecord, Localize("Automatically record demos"), g_Config.m_ClAutoDemoRecord, &Button)) g_Config.m_ClAutoDemoRecord ^= 1; + Right.HSplitTop(20.0f, &Button, &Right); + if(DoButton_CheckBox(&g_Config.m_ClAutoScreenshot, Localize("Automatically take game over screenshot"), g_Config.m_ClAutoScreenshot, &Button)) + g_Config.m_ClAutoScreenshot ^= 1; + Left.HSplitTop(10.0f, 0, &Left); Left.VSplitLeft(20.0f, 0, &Left); Left.HSplitTop(20.0f, &Label, &Button); @@ -752,6 +756,17 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView) str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max demos"), Localize("no limit")); UI()->DoLabel(&Label, aBuf, 13.0f, -1); g_Config.m_ClAutoDemoMax = static_cast<int>(DoScrollbarH(&g_Config.m_ClAutoDemoMax, &Button, g_Config.m_ClAutoDemoMax/1000.0f)*1000.0f+0.1f); + + Right.HSplitTop(10.0f, 0, &Right); + Right.VSplitLeft(20.0f, 0, &Right); + Right.HSplitTop(20.0f, &Label, &Button); + Button.VSplitRight(20.0f, &Button, 0); + if(g_Config.m_ClAutoScreenshotMax) + str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Max Screenshots"), g_Config.m_ClAutoScreenshotMax); + else + str_format(aBuf, sizeof(aBuf), "%s: %s", Localize("Max Screenshots"), Localize("no limit")); + UI()->DoLabel(&Label, aBuf, 13.0f, -1); + g_Config.m_ClAutoScreenshotMax = static_cast<int>(DoScrollbarH(&g_Config.m_ClAutoScreenshotMax, &Button, g_Config.m_ClAutoScreenshotMax/1000.0f)*1000.0f+0.1f); } UiDoListboxStart(&s_LanguageList , &List, 24.0f, Localize("Language"), "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue); 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; } diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index d60fef2a..2f8e21ea 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -180,6 +180,7 @@ public: virtual void OnShutdown(); virtual void OnEnterGame(); virtual void OnRconLine(const char *pLine); + virtual void OnGameOver(); virtual const char *GetItemName(int Type); virtual const char *Version(); |