about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-12-08 01:42:32 +0100
committeroy <Tom_Adams@web.de>2010-12-08 01:42:32 +0100
commit0fe8cabe78da649187c8cf11d5d2746ab4bb20ac (patch)
treeb89b23da82953d162218b47f0d7c754a5b25e000
parent974a40913d5c0cf9516f62ea88df9ecdff7bc3c9 (diff)
downloadzcatch-0fe8cabe78da649187c8cf11d5d2746ab4bb20ac.tar.gz
zcatch-0fe8cabe78da649187c8cf11d5d2746ab4bb20ac.zip
added auto recording support by Batchyx
-rw-r--r--src/engine/client/client.cpp7
-rw-r--r--src/engine/client/client.h1
-rw-r--r--src/engine/shared/config_variables.h2
3 files changed, 10 insertions, 0 deletions
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index b9ab18af..26cd5795 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -1279,6 +1279,7 @@ void CClient::ProcessPacket(CNetChunk *pPacket)
 							m_aSnapshots[SNAP_CURRENT] = m_SnapshotStorage.m_pLast;
 							m_LocalStartTime = time_get();
 							SetState(IClient::STATE_ONLINE);
+							DemoRecorder_HandleAutoStart();
 						}
 
 						// adjust game time
@@ -1945,6 +1946,12 @@ void CClient::DemoRecorder_Start(const char *pFilename, bool WithTimestamp)
 	}
 }
 
+void CClient::DemoRecorder_HandleAutoStart()
+{
+	if(g_Config.m_ClAutoDemoRecord)
+		DemoRecorder_Start("autorecord", true);
+}
+
 void CClient::DemoRecorder_Stop()
 {
 	m_DemoRecorder.Stop();
diff --git a/src/engine/client/client.h b/src/engine/client/client.h
index 8cfd8c57..9299df05 100644
--- a/src/engine/client/client.h
+++ b/src/engine/client/client.h
@@ -285,6 +285,7 @@ public:
 
 	const char *DemoPlayer_Play(const char *pFilename, int StorageType);
 	void DemoRecorder_Start(const char *pFilename, bool WithTimestamp);
+	void DemoRecorder_HandleAutoStart();
 	void DemoRecorder_Stop();
 
 	virtual class CEngine *Engine() { return &m_Engine; }
diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h
index fdb5a1e2..ce9b1982 100644
--- a/src/engine/shared/config_variables.h
+++ b/src/engine/shared/config_variables.h
@@ -17,6 +17,8 @@ MACRO_CONFIG_INT(ConsoleOutputLevel, console_output_level, 0, 0, 2, CFGFLAG_CLIE
 MACRO_CONFIG_INT(ClCpuThrottle, cl_cpu_throttle, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
 MACRO_CONFIG_INT(ClEditor, cl_editor, 0, 0, 1, CFGFLAG_CLIENT, "")
 
+MACRO_CONFIG_INT(ClAutoDemoRecord, cl_auto_demo_record, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Automatically record demos")
+
 MACRO_CONFIG_INT(ClEventthread, cl_eventthread, 0, 0, 1, CFGFLAG_CLIENT, "Enables the usage of a thread to pump the events")
 
 MACRO_CONFIG_INT(InpGrab, inp_grab, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use forceful input grabbing method")