[iortcw] 58/95: All: Don't spam screen updates when using r_swapinterval (VSync)

Simon McVittie smcv at debian.org
Fri Sep 8 10:42:13 UTC 2017


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

smcv pushed a commit to tag 1.51
in repository iortcw.

commit 6bf0ccfec6585ce90f9bcef9e4f00db0dcbbbc9c
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Fri May 5 12:01:21 2017 -0400

    All: Don't spam screen updates when using r_swapinterval (VSync)
---
 MP/code/client/cl_cgame.c | 19 ++++++++++++++-----
 SP/code/client/cl_cgame.c | 19 ++++++++++++++-----
 2 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/MP/code/client/cl_cgame.c b/MP/code/client/cl_cgame.c
index 6f554db..683f9a3 100644
--- a/MP/code/client/cl_cgame.c
+++ b/MP/code/client/cl_cgame.c
@@ -560,11 +560,20 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
 		return 0;
 	case CG_UPDATESCREEN:
 		// this is used during lengthy level loading, so pump message loop
-//		Com_EventLoop();	// FIXME: if a server restarts here, BAD THINGS HAPPEN!
-// We can't call Com_EventLoop here, a restart will crash and this _does_ happen
-// if there is a map change while we are downloading at pk3.
-// ZOID
-		SCR_UpdateScreen();
+		//Com_EventLoop();	// FIXME: if a server restarts here, BAD THINGS HAPPEN!
+		// We can't call Com_EventLoop here, a restart will crash and this _does_ happen
+		// if there is a map change while we are downloading at pk3.
+		// ZOID
+		// Don't spam screen updates if we're vsynced
+		if ( Cvar_VariableIntegerValue( "r_swapInterval" ) )
+		{
+			static int lastUpdate = 0;
+
+			if ( lastUpdate == 0 || Sys_Milliseconds() - lastUpdate > 16 )
+				SCR_UpdateScreen();
+
+			lastUpdate = Sys_Milliseconds();
+		}
 		return 0;
 	case CG_CM_LOADMAP:
 		CL_CM_LoadMap( VMA( 1 ) );
diff --git a/SP/code/client/cl_cgame.c b/SP/code/client/cl_cgame.c
index 9763593..16fb94a 100644
--- a/SP/code/client/cl_cgame.c
+++ b/SP/code/client/cl_cgame.c
@@ -479,11 +479,20 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
 		return 0;
 	case CG_UPDATESCREEN:
 		// this is used during lengthy level loading, so pump message loop
-//		Com_EventLoop();	// FIXME: if a server restarts here, BAD THINGS HAPPEN!
-// We can't call Com_EventLoop here, a restart will crash and this _does_ happen
-// if there is a map change while we are downloading at pk3.
-// ZOID
-		SCR_UpdateScreen();
+		//Com_EventLoop();	// FIXME: if a server restarts here, BAD THINGS HAPPEN!
+		// We can't call Com_EventLoop here, a restart will crash and this _does_ happen
+		// if there is a map change while we are downloading at pk3.
+		// ZOID
+		// Don't spam screen updates if we're vsynced
+		if ( Cvar_VariableIntegerValue( "r_swapInterval" ) )
+		{
+			static int lastUpdate = 0;
+
+			if ( lastUpdate == 0 || Sys_Milliseconds() - lastUpdate > 16 )
+				SCR_UpdateScreen();
+
+			lastUpdate = Sys_Milliseconds();
+		}
 		return 0;
 	case CG_CM_LOADMAP:
 		CL_CM_LoadMap( VMA( 1 ) );

-- 
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