[iortcw] 49/95: All: Fix/Add developer prints in UI

Simon McVittie smcv at debian.org
Fri Sep 8 10:42:05 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 cee00dd83068cfef9c4b9972221669eb75f3a425
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Mon Mar 27 10:01:55 2017 -0400

    All: Fix/Add developer prints in UI
---
 MP/code/ui/ui_atoms.c  |  2 +-
 MP/code/ui/ui_main.c   |  3 ++-
 MP/code/ui/ui_shared.c |  4 ++--
 MP/code/ui/ui_shared.h |  1 +
 SP/code/ui/ui_atoms.c  | 22 +++++++++++++++++++++-
 SP/code/ui/ui_main.c   |  6 ++++--
 SP/code/ui/ui_shared.c |  2 +-
 SP/code/ui/ui_shared.h |  1 +
 8 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/MP/code/ui/ui_atoms.c b/MP/code/ui/ui_atoms.c
index bbbd87d..6023bab 100644
--- a/MP/code/ui/ui_atoms.c
+++ b/MP/code/ui/ui_atoms.c
@@ -38,7 +38,7 @@ If you have questions concerning this license or the applicable additional terms
 uiStatic_t uis;
 qboolean m_entersound;              // after a frame, so caching won't disrupt the sound
 
-void	QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
+void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ( ( format ( printf, 1, 2 ) ) );
 
 
 // JPW NERVE added Com_DPrintf
diff --git a/MP/code/ui/ui_main.c b/MP/code/ui/ui_main.c
index 558eb02..4472b35 100644
--- a/MP/code/ui/ui_main.c
+++ b/MP/code/ui/ui_main.c
@@ -1282,7 +1282,7 @@ void UI_Report( void ) {
 
 }
 
-void QDECL Com_DPrintf( const char *fmt, ... );
+void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ( ( format ( printf, 1, 2 ) ) );
 qboolean UI_ParseMenu( const char *menuFile ) {
 	int handle;
 	pc_token_t token;
@@ -6984,6 +6984,7 @@ void _UI_Init( qboolean inGameLoad ) {
 	uiInfo.uiDC.executeText = &trap_Cmd_ExecuteText;
 	uiInfo.uiDC.Error = &Com_Error;
 	uiInfo.uiDC.Print = &Com_Printf;
+	uiInfo.uiDC.DPrint = &Com_DPrintf;
 	uiInfo.uiDC.Pause = &UI_Pause;
 	uiInfo.uiDC.ownerDrawWidth = &UI_OwnerDrawWidth;
 	uiInfo.uiDC.registerSound = &trap_S_RegisterSound;
diff --git a/MP/code/ui/ui_shared.c b/MP/code/ui/ui_shared.c
index 9a1ef40..dd65d0b 100644
--- a/MP/code/ui/ui_shared.c
+++ b/MP/code/ui/ui_shared.c
@@ -5948,7 +5948,7 @@ static void Item_ApplyHacks( itemDef_t *item ) {
 
 		// enough to hold an IPv6 address plus null
 		if ( editField->maxChars < 48 ) {
-			Com_Printf( "Extended create favorite address edit field length to hold an IPv6 address\n" );
+			DC->DPrint( "Extended create favorite address edit field length to hold an IPv6 address\n" );
 			editField->maxChars = 48;
 		}
 	}
@@ -5958,7 +5958,7 @@ static void Item_ApplyHacks( itemDef_t *item ) {
 		int i;
 		multiDef_t *multiPtr = (multiDef_t*)item->typeData;;
 
-		Com_Printf( "Found modelist with %d modes, extending list to %d modes\n", multiPtr->count, s_numVidModes );
+		DC->DPrint( "Found modelist with %d modes, extending list to %d modes\n", multiPtr->count, s_numVidModes );
 
 		multiPtr->count = 0;
 		for ( i = 0; i < s_numVidModes; i++ ) {
diff --git a/MP/code/ui/ui_shared.h b/MP/code/ui/ui_shared.h
index 875eff4..f92a067 100644
--- a/MP/code/ui/ui_shared.h
+++ b/MP/code/ui/ui_shared.h
@@ -395,6 +395,7 @@ typedef struct {
 	void ( *executeText )( int exec_when, const char *text );
 	void (*Error)(int level, const char *error, ...) __attribute__ ((noreturn, format (printf, 2, 3)));
 	void (*Print)(const char *msg, ...) __attribute__ ((format (printf, 1, 2)));
+	void (*DPrint)(const char *msg, ...) __attribute__ ((format (printf, 1, 2)));
 	void ( *Pause )( qboolean b );
 	int ( *ownerDrawWidth )( int ownerDraw, float scale );
 //	sfxHandle_t (*registerSound)(const char *name, qboolean compressed);
diff --git a/SP/code/ui/ui_atoms.c b/SP/code/ui/ui_atoms.c
index fda6182..20ebfc8 100644
--- a/SP/code/ui/ui_atoms.c
+++ b/SP/code/ui/ui_atoms.c
@@ -38,7 +38,27 @@ If you have questions concerning this license or the applicable additional terms
 uiStatic_t uis;
 qboolean m_entersound;              // after a frame, so caching won't disrupt the sound
 
-void	QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
+void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ( ( format ( printf, 1, 2 ) ) );
+
+// JPW NERVE added Com_DPrintf
+#define MAXPRINTMSG 4096
+void QDECL Com_DPrintf( const char *fmt, ... ) {
+	va_list argptr;
+	char msg[MAXPRINTMSG];
+	int developer;
+
+	developer = trap_Cvar_VariableValue( "developer" );
+	if ( !developer ) {
+		return;
+	}
+
+	va_start( argptr,fmt );
+	Q_vsnprintf( msg, sizeof( msg ), fmt, argptr );
+	va_end( argptr );
+
+	Com_Printf( "%s", msg );
+}
+// jpw
 
 void QDECL Com_Error( int level, const char *error, ... ) {
 	va_list argptr;
diff --git a/SP/code/ui/ui_main.c b/SP/code/ui/ui_main.c
index 61e6dbb..bb7183d 100644
--- a/SP/code/ui/ui_main.c
+++ b/SP/code/ui/ui_main.c
@@ -941,11 +941,12 @@ void UI_Report( void ) {
 
 }
 
+void QDECL Com_DPrintf( const char *fmt, ... ) __attribute__ ( ( format ( printf, 1, 2 ) ) );
 void UI_ParseMenu( const char *menuFile ) {
 	int handle;
 	pc_token_t token;
 
-	Com_Printf( "Parsing menu file: %s\n", menuFile );
+	Com_DPrintf( "Parsing menu file: %s\n", menuFile );
 
 	handle = trap_PC_LoadSource( menuFile );
 	if ( !handle ) {
@@ -1064,7 +1065,7 @@ void UI_LoadMenus( const char *menuFile, qboolean reset ) {
 		}
 	}
 
-	Com_Printf( "UI menu load time = %d milli seconds\n", trap_Milliseconds() - start );
+	Com_DPrintf( "UI menu load time = %d milli seconds\n", trap_Milliseconds() - start );
 
 	trap_PC_FreeSource( handle );
 }
@@ -6784,6 +6785,7 @@ void _UI_Init( qboolean inGameLoad ) {
 	uiInfo.uiDC.executeText = &trap_Cmd_ExecuteText;
 	uiInfo.uiDC.Error = &Com_Error;
 	uiInfo.uiDC.Print = &Com_Printf;
+	uiInfo.uiDC.DPrint = &Com_DPrintf;
 	uiInfo.uiDC.Pause = &UI_Pause;
 	uiInfo.uiDC.ownerDrawWidth = &UI_OwnerDrawWidth;
 	uiInfo.uiDC.registerSound = &trap_S_RegisterSound;
diff --git a/SP/code/ui/ui_shared.c b/SP/code/ui/ui_shared.c
index bf62666..c7f5545 100644
--- a/SP/code/ui/ui_shared.c
+++ b/SP/code/ui/ui_shared.c
@@ -5872,7 +5872,7 @@ static void Item_ApplyHacks( itemDef_t *item ) {
 		int i;
 		multiDef_t *multiPtr = (multiDef_t*)item->typeData;;
 
-		Com_Printf( "Found modelist with %d modes, extending list to %d modes\n", multiPtr->count, s_numVidModes );
+		DC->DPrint( "Found modelist with %d modes, extending list to %d modes\n", multiPtr->count, s_numVidModes );
 
 		multiPtr->count = 0;
 		for ( i = 0; i < s_numVidModes; i++ ) {
diff --git a/SP/code/ui/ui_shared.h b/SP/code/ui/ui_shared.h
index 719718f..b93857b 100644
--- a/SP/code/ui/ui_shared.h
+++ b/SP/code/ui/ui_shared.h
@@ -393,6 +393,7 @@ typedef struct {
 	void ( *executeText )( int exec_when, const char *text );
 	void (*Error)(int level, const char *error, ...) __attribute__ ((noreturn, format (printf, 2, 3)));
 	void (*Print)(const char *msg, ...) __attribute__ ((format (printf, 1, 2)));
+	void (*DPrint)(const char *msg, ...) __attribute__ ((format (printf, 1, 2)));
 	void ( *Pause )( qboolean b );
 	int ( *ownerDrawWidth )( int ownerDraw, int font, float scale );
 //	sfxHandle_t (*registerSound)(const char *name, qboolean compressed);

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