[iortcw] 138/497: Reimplement cl_avidemo command (screenshot method) for backward compatibility

Simon McVittie smcv at debian.org
Fri Sep 8 10:36:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.42d
in repository iortcw.

commit b55e35ed3935ad3e7db6b04b7c80bb92c5c26f92
Author: M4N4T4RMS at gmail.com <M4N4T4RMS at gmail.com@e65d2741-a53d-b2dc-ae96-bb75fa5e4c4a>
Date:   Tue Jun 10 21:55:29 2014 +0000

    Reimplement cl_avidemo command (screenshot method) for backward compatibility
---
 MP/code/client/cl_main.c | 30 +++++++++++++++++++++---------
 SP/code/client/cl_main.c | 30 +++++++++++++++++++++---------
 2 files changed, 42 insertions(+), 18 deletions(-)

diff --git a/MP/code/client/cl_main.c b/MP/code/client/cl_main.c
index 50b57fb..4f5231a 100644
--- a/MP/code/client/cl_main.c
+++ b/MP/code/client/cl_main.c
@@ -93,6 +93,7 @@ cvar_t	*cl_timedemoLog;
 cvar_t	*cl_autoRecordDemo;
 cvar_t	*cl_aviFrameRate;
 cvar_t	*cl_aviMotionJpeg;
+cvar_t  *cl_avidemo;
 cvar_t  *cl_forceavidemo;
 
 cvar_t  *cl_freelook;
@@ -3168,16 +3169,26 @@ void CL_Frame ( int msec ) {
 	}
 
 	// if recording an avi, lock to a fixed fps
-	if ( CL_VideoRecording( ) && cl_aviFrameRate->integer && msec) {
+	if ( ( CL_VideoRecording( ) && cl_aviFrameRate->integer && msec ) || ( cl_avidemo->integer && msec ) ) {
 		// save the current screen
-		if ( !clc.demoplaying || clc.state == CA_ACTIVE || cl_forceavidemo->integer ) {
-			float fps = MIN(cl_aviFrameRate->value * com_timescale->value, 1000.0f);
-			float frameDuration = MAX(1000.0f / fps, 1.0f) + clc.aviVideoFrameRemainder;
-
-			CL_TakeVideoFrame( );
-
-			msec = (int)frameDuration;
-			clc.aviVideoFrameRemainder = frameDuration - msec;
+		if ( clc.state == CA_ACTIVE || cl_forceavidemo->integer ) {
+			if ( cl_avidemo->integer ) {	// Legacy (screenshot) method
+				Cbuf_ExecuteText( EXEC_NOW, "screenshot silent\n" );
+
+				// fixed time for next frame
+				msec = ( 1000 / cl_avidemo->integer ) * com_timescale->value;
+				if ( msec == 0 ) {
+					msec = 1;
+				}
+			} else {			// ioquake3 method
+				float fps = MIN(cl_aviFrameRate->value * com_timescale->value, 1000.0f);
+				float frameDuration = MAX(1000.0f / fps, 1.0f) + clc.aviVideoFrameRemainder;
+	
+				CL_TakeVideoFrame( );
+	
+				msec = (int)frameDuration;
+				clc.aviVideoFrameRemainder = frameDuration - msec;
+			}
 		}
 	}
 	
@@ -4007,6 +4018,7 @@ void CL_Init( void ) {
 	cl_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
 	cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE);
 	cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", CVAR_ARCHIVE);
+	cl_avidemo = Cvar_Get( "cl_avidemo", "0", 0 );
 	cl_forceavidemo = Cvar_Get( "cl_forceavidemo", "0", 0 );
 
 	rconAddress = Cvar_Get( "rconAddress", "", 0 );
diff --git a/SP/code/client/cl_main.c b/SP/code/client/cl_main.c
index e39dbdd..fe694ff 100644
--- a/SP/code/client/cl_main.c
+++ b/SP/code/client/cl_main.c
@@ -84,6 +84,7 @@ cvar_t	*cl_timedemoLog;
 cvar_t	*cl_autoRecordDemo;
 cvar_t	*cl_aviFrameRate;
 cvar_t	*cl_aviMotionJpeg;
+cvar_t  *cl_avidemo;
 cvar_t  *cl_forceavidemo;
 
 cvar_t  *cl_freelook;
@@ -2970,16 +2971,26 @@ void CL_Frame( int msec ) {
 	}
 
 	// if recording an avi, lock to a fixed fps
-	if ( CL_VideoRecording( ) && cl_aviFrameRate->integer && msec) {
+	if ( ( CL_VideoRecording( ) && cl_aviFrameRate->integer && msec ) || ( cl_avidemo->integer && msec ) ) {
 		// save the current screen
-		if ( !clc.demoplaying || clc.state == CA_ACTIVE || cl_forceavidemo->integer ) {
-			float fps = MIN(cl_aviFrameRate->value * com_timescale->value, 1000.0f);
-			float frameDuration = MAX(1000.0f / fps, 1.0f) + clc.aviVideoFrameRemainder;
-
-			CL_TakeVideoFrame( );
-
-			msec = (int)frameDuration;
-			clc.aviVideoFrameRemainder = frameDuration - msec;
+		if ( clc.state == CA_ACTIVE || cl_forceavidemo->integer ) {
+			if ( cl_avidemo->integer ) {	// Legacy (screenshot) method
+				Cbuf_ExecuteText( EXEC_NOW, "screenshot silent\n" );
+
+				// fixed time for next frame
+				msec = ( 1000 / cl_avidemo->integer ) * com_timescale->value;
+				if ( msec == 0 ) {
+					msec = 1;
+				}
+			} else {			// ioquake3 method
+				float fps = MIN(cl_aviFrameRate->value * com_timescale->value, 1000.0f);
+				float frameDuration = MAX(1000.0f / fps, 1.0f) + clc.aviVideoFrameRemainder;
+	
+				CL_TakeVideoFrame( );
+	
+				msec = (int)frameDuration;
+				clc.aviVideoFrameRemainder = frameDuration - msec;
+			}
 		}
 	}
 
@@ -3673,6 +3684,7 @@ void CL_Init( void ) {
 	cl_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
 	cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE);
 	cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", CVAR_ARCHIVE);
+	cl_avidemo = Cvar_Get( "cl_avidemo", "0", 0 );
 	cl_forceavidemo = Cvar_Get( "cl_forceavidemo", "0", 0 );
 
 	rconAddress = Cvar_Get( "rconAddress", "", 0 );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list