aboutsummaryrefslogtreecommitdiffstats
path: root/code/client/cl_main.c
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-01-05 00:15:47 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-01-05 00:15:47 +0000
commitcc20fd0a2d10bf540ab033afb70c5df8e3342844 (patch)
tree5a28299b9b1777c4c0f5e817a1719cd7b19a1269 /code/client/cl_main.c
parent1ed84e9be39af8caaf3f49e4de5735d42efc990a (diff)
downloadioquake3-aero-cc20fd0a2d10bf540ab033afb70c5df8e3342844.tar.gz
ioquake3-aero-cc20fd0a2d10bf540ab033afb70c5df8e3342844.zip
* Added cl_autoRecordDemo, which when enabled automatically records a new demo
on each map change git-svn-id: svn://svn.icculus.org/quake3/trunk@458 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/client/cl_main.c')
-rw-r--r--code/client/cl_main.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/code/client/cl_main.c b/code/client/cl_main.c
index bb83b3d..8871490 100644
--- a/code/client/cl_main.c
+++ b/code/client/cl_main.c
@@ -43,6 +43,7 @@ cvar_t *cl_freezeDemo;
cvar_t *cl_shownet;
cvar_t *cl_showSend;
cvar_t *cl_timedemo;
+cvar_t *cl_autoRecordDemo;
cvar_t *cl_avidemo;
cvar_t *cl_aviMotionJpeg;
cvar_t *cl_forceavidemo;
@@ -2038,6 +2039,44 @@ void CL_Frame ( int msec ) {
}
}
+ if( cl_autoRecordDemo->integer ) {
+ if( cls.state == CA_ACTIVE && !clc.demorecording ) {
+ // If not recording a demo, and we should be, start one
+ qtime_t now;
+ char *nowString;
+ char *p;
+ char mapName[ MAX_QPATH ];
+ char serverName[ MAX_OSPATH ];
+
+ Com_RealTime( &now );
+ nowString = va( "%04d%02d%02d%02d%02d%02d",
+ 1900 + now.tm_year,
+ 1 + now.tm_mon,
+ now.tm_mday,
+ now.tm_hour,
+ now.tm_min,
+ now.tm_sec );
+
+ Q_strncpyz( serverName, cls.servername, MAX_OSPATH );
+ // Replace the ":" in the address as it is not a valid
+ // file name character
+ p = strstr( serverName, ":" );
+ if( p ) {
+ *p = '.';
+ }
+
+ Q_strncpyz( mapName, COM_SkipPath( cl.mapname ), sizeof( cl.mapname ) );
+ COM_StripExtension( mapName, mapName );
+
+ Cbuf_ExecuteText( EXEC_NOW,
+ va( "record %s-%s-%s", nowString, serverName, mapName ) );
+ }
+ else if( cls.state != CA_ACTIVE && clc.demorecording ) {
+ // Recording, but not CA_ACTIVE, so stop recording
+ CL_StopRecord_f( );
+ }
+ }
+
// save the msec before checking pause
cls.realFrametime = msec;
@@ -2374,6 +2413,7 @@ void CL_Init( void ) {
cl_activeAction = Cvar_Get( "activeAction", "", CVAR_TEMP );
cl_timedemo = Cvar_Get ("timedemo", "0", 0);
+ cl_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
cl_avidemo = Cvar_Get ("cl_avidemo", "25", CVAR_ARCHIVE);
cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", CVAR_ARCHIVE);
cl_forceavidemo = Cvar_Get ("cl_forceavidemo", "0", 0);