[iortcw] 443/497: MP: Add client cvar cl_showPing

Simon McVittie smcv at debian.org
Fri Sep 8 10:37:46 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 811adce695919fa413ef4446217135694940ca65
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Tue Nov 24 19:16:52 2015 -0500

    MP: Add client cvar cl_showPing
---
 MP/code/client/cl_main.c |  4 ++++
 MP/code/client/cl_scrn.c | 28 ++++++++++++++++++++++++++++
 MP/code/client/client.h  |  2 ++
 3 files changed, 34 insertions(+)

diff --git a/MP/code/client/cl_main.c b/MP/code/client/cl_main.c
index cbf98d5..215f103 100644
--- a/MP/code/client/cl_main.c
+++ b/MP/code/client/cl_main.c
@@ -83,6 +83,8 @@ cvar_t  *cl_timeNudge;
 cvar_t  *cl_showTimeDelta;
 cvar_t  *cl_freezeDemo;
 
+cvar_t  *cl_showPing;
+
 cvar_t  *cl_shownet = NULL;     // NERVE - SMF - This is referenced in msg.c and we need to make sure it is NULL
 cvar_t  *cl_shownuments;        // DHM - Nerve
 cvar_t  *cl_visibleClients;     // DHM - Nerve
@@ -4022,6 +4024,8 @@ void CL_Init( void ) {
 	cl_maxpackets = Cvar_Get( "cl_maxpackets", "38", CVAR_ARCHIVE );
 	cl_packetdup = Cvar_Get( "cl_packetdup", "1", CVAR_ARCHIVE );
 
+	cl_showPing = Cvar_Get( "cl_showPing", "0", CVAR_ARCHIVE );
+
 	cl_run = Cvar_Get( "cl_run", "1", CVAR_ARCHIVE );
 	cl_sensitivity = Cvar_Get( "sensitivity", "5", CVAR_ARCHIVE );
 	cl_mouseAccel = Cvar_Get( "cl_mouseAccel", "0", CVAR_ARCHIVE );
diff --git a/MP/code/client/cl_scrn.c b/MP/code/client/cl_scrn.c
index 331b83f..5f62c73 100644
--- a/MP/code/client/cl_scrn.c
+++ b/MP/code/client/cl_scrn.c
@@ -391,6 +391,33 @@ void SCR_DrawVoipMeter( void ) {
 }
 #endif
 
+/*
+=================
+SCR_ShowPing
+=================
+*/
+void SCR_ShowPing( void ) {
+	char	string[11];
+	int	ping, w, x;
+
+	if (!cl_showPing->integer)
+		return;
+
+	if ( Cvar_VariableIntegerValue( "ui_limboMode" ) )
+		return;
+
+	ping = cl.snap.ping;
+
+	Com_sprintf( string, sizeof( string ), "ping: %i", ping );
+
+	w = strlen( string ) * TINYCHAR_WIDTH;
+	x = 320 - ( w * 0.5 );
+
+	if ( ping < 999 )
+		SCR_DrawStringExt( x, 386, TINYCHAR_HEIGHT, string, g_color_table[7], qtrue, qfalse );
+	else
+		return;
+}
 
 /*
 ===============================================================================
@@ -534,6 +561,7 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
 		case CA_ACTIVE:
 			// always supply STEREO_CENTER as vieworg offset is now done by the engine.
 			CL_CGameRendering( stereoFrame );
+			SCR_ShowPing();
 			SCR_DrawDemoRecording();
 #ifdef USE_VOIP
 			SCR_DrawVoipMeter();
diff --git a/MP/code/client/client.h b/MP/code/client/client.h
index a0d6228..d3ce3ff 100644
--- a/MP/code/client/client.h
+++ b/MP/code/client/client.h
@@ -429,6 +429,8 @@ extern cvar_t  *cl_timeNudge;
 extern cvar_t  *cl_showTimeDelta;
 extern cvar_t  *cl_freezeDemo;
 
+extern cvar_t  *cl_showPing;
+
 extern cvar_t  *cl_yawspeed;
 extern cvar_t  *cl_pitchspeed;
 extern cvar_t  *cl_run;

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