about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-12-08 01:55:13 +0100
committeroy <Tom_Adams@web.de>2010-12-08 01:55:13 +0100
commit4756c031c5bfd931009d16ff4bb84be912508422 (patch)
treedb4e13e5fbc0ebdf5872814430b584dc4edf91be
parent0fe8cabe78da649187c8cf11d5d2746ab4bb20ac (diff)
downloadzcatch-4756c031c5bfd931009d16ff4bb84be912508422.tar.gz
zcatch-4756c031c5bfd931009d16ff4bb84be912508422.zip
save auto recorded demos in a separate folder and added an option to enable/disable it in the settings menu
-rw-r--r--src/engine/client/client.cpp10
-rw-r--r--src/engine/client/client.h1
-rw-r--r--src/game/client/components/menus_settings.cpp49
3 files changed, 38 insertions, 22 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index 26cd5795..7420f094 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -1630,6 +1630,8 @@ void CClient::Run()
 	if(!LoadData())
 		return;
 
+	DemoRecorder_Init();
+
 	GameClient()->OnInit();
 	char aBuf[256];
 	str_format(aBuf, sizeof(aBuf), "version %s", GameClient()->NetVersion());
@@ -1927,6 +1929,12 @@ void CClient::Con_Play(IConsole::IResult *pResult, void *pUserData)
 	pSelf->DemoPlayer_Play(pResult->GetString(0), IStorage::TYPE_ALL);
 }
 
+void CClient::DemoRecorder_Init()
+{
+	if(!Storage()->CreateFolder("demos/auto", IStorage::TYPE_SAVE))
+		m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demorec/record", "unable to create auto record folder");
+}
+
 void CClient::DemoRecorder_Start(const char *pFilename, bool WithTimestamp)
 {
 	if(State() != IClient::STATE_ONLINE)
@@ -1949,7 +1957,7 @@ void CClient::DemoRecorder_Start(const char *pFilename, bool WithTimestamp)
 void CClient::DemoRecorder_HandleAutoStart()
 {
 	if(g_Config.m_ClAutoDemoRecord)
-		DemoRecorder_Start("autorecord", true);
+		DemoRecorder_Start("auto/autorecord", true);
 }
 
 void CClient::DemoRecorder_Stop()
diff --git a/src/engine/client/client.h b/src/engine/client/client.h
index 9299df05..1a35788b 100644
--- a/src/engine/client/client.h
+++ b/src/engine/client/client.h
@@ -284,6 +284,7 @@ public:
 	void RegisterCommands();
 
 	const char *DemoPlayer_Play(const char *pFilename, int StorageType);
+	void DemoRecorder_Init();
 	void DemoRecorder_Start(const char *pFilename, bool WithTimestamp);
 	void DemoRecorder_HandleAutoStart();
 	void DemoRecorder_Stop();
diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp
index 119dc2f5..0a3ceca5 100644
--- a/src/game/client/components/menus_settings.cpp
+++ b/src/game/client/components/menus_settings.cpp
@@ -468,10 +468,10 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
 	static int s_GfxScreenWidth = g_Config.m_GfxScreenWidth;
 	static int s_GfxScreenHeight = g_Config.m_GfxScreenHeight;
 	static int s_GfxColorDepth = g_Config.m_GfxColorDepth;
-	static int s_GfxFullscreen = g_Config.m_GfxFullscreen;

-	static int s_GfxVsync = g_Config.m_GfxVsync;

-	static int s_GfxFsaaSamples = g_Config.m_GfxFsaaSamples;

-	static int s_GfxTextureQuality = g_Config.m_GfxTextureQuality;

+	static int s_GfxFullscreen = g_Config.m_GfxFullscreen;
+	static int s_GfxVsync = g_Config.m_GfxVsync;
+	static int s_GfxFsaaSamples = g_Config.m_GfxFsaaSamples;
+	static int s_GfxTextureQuality = g_Config.m_GfxTextureQuality;
 	static int s_GfxTextureCompression = g_Config.m_GfxTextureCompression;
 
 	CUIRect ModeList;
@@ -560,20 +560,20 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
 	if(DoButton_CheckBox(&g_Config.m_GfxHighDetail, Localize("High Detail"), g_Config.m_GfxHighDetail, &Button))
 		g_Config.m_GfxHighDetail ^= 1;
 
-	// check if the new settings require a restart

-	if(CheckSettings)

-	{

-		if(s_GfxScreenWidth == g_Config.m_GfxScreenWidth &&

-			s_GfxScreenHeight == g_Config.m_GfxScreenHeight &&

-			s_GfxColorDepth == g_Config.m_GfxColorDepth &&

-			s_GfxFullscreen == g_Config.m_GfxFullscreen &&

-			s_GfxVsync == g_Config.m_GfxVsync &&

-			s_GfxFsaaSamples == g_Config.m_GfxFsaaSamples &&

-			s_GfxTextureQuality == g_Config.m_GfxTextureQuality &&

-			s_GfxTextureCompression == g_Config.m_GfxTextureCompression)

-			m_NeedRestartGraphics = false;

-		else

-			m_NeedRestartGraphics = true;

+	// check if the new settings require a restart
+	if(CheckSettings)
+	{
+		if(s_GfxScreenWidth == g_Config.m_GfxScreenWidth &&
+			s_GfxScreenHeight == g_Config.m_GfxScreenHeight &&
+			s_GfxColorDepth == g_Config.m_GfxColorDepth &&
+			s_GfxFullscreen == g_Config.m_GfxFullscreen &&
+			s_GfxVsync == g_Config.m_GfxVsync &&
+			s_GfxFsaaSamples == g_Config.m_GfxFsaaSamples &&
+			s_GfxTextureQuality == g_Config.m_GfxTextureQuality &&
+			s_GfxTextureCompression == g_Config.m_GfxTextureCompression)
+			m_NeedRestartGraphics = false;
+		else
+			m_NeedRestartGraphics = true;
 	}
 
 	//
@@ -610,7 +610,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
 {
 	CUIRect Button;
 	MainView.VSplitLeft(300.0f, &MainView, 0);
-	static int s_SndEnable = g_Config.m_SndEnable;

+	static int s_SndEnable = g_Config.m_SndEnable;
 	static int s_SndRate = g_Config.m_SndRate;
 
 	MainView.HSplitTop(20.0f, &Button, &MainView);
@@ -640,7 +640,7 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
 		int Before = g_Config.m_SndRate;
 		g_Config.m_SndRate = max(1, str_toint(aBuf));
 
-		if(g_Config.m_SndRate != Before)

+		if(g_Config.m_SndRate != Before)
 			m_NeedRestartSound = s_SndEnable == g_Config.m_SndEnable && s_SndRate == g_Config.m_SndRate ? false : true;
 	}
 
@@ -729,7 +729,14 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
 
 	int OldSelected = s_SelectedLanguage;
 
-	CUIRect List = MainView;
+	CUIRect List, Button;
+	MainView.HSplitBottom(10.0f, &MainView, 0);
+	MainView.HSplitBottom(20.0f, &MainView, &Button);
+	MainView.HSplitBottom(20.0f, &List, &MainView);
+
+	if(DoButton_CheckBox(&g_Config.m_ClAutoDemoRecord, Localize("Automatically record demos"), g_Config.m_ClAutoDemoRecord, &Button))
+		g_Config.m_ClAutoDemoRecord ^= 1;
+
 	UiDoListboxStart(&s_LanguageList , &List, 24.0f, Localize("Language"), "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue);
 
 	for(sorted_array<CLanguage>::range r = s_Languages.all(); !r.empty(); r.pop_front())