Added Com_DPrintf2 and Com_DebugPrintf

This commit is contained in:
smallmodel 2023-09-17 19:33:17 +02:00
parent 128c8f3c06
commit e95d71da0d
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
2 changed files with 56 additions and 1 deletions

View file

@ -37,8 +37,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tiki.h"
#ifndef DEDICATED
# include "../uilib/ui_public.h"
#endif
qboolean CL_FinishedIntro(void);
void UI_PrintConsole(const char* msg);
#ifdef __cplusplus
extern "C" {
@ -301,6 +304,56 @@ void QDECL Com_DPrintf( const char *fmt, ...) {
Com_Printf ("%s", msg);
}
/*
================
Com_DPrintf2
A Com_Printf that only shows up if the "developer" cvar is set
================
*/
void QDECL Com_DPrintf2( const char *fmt, ...) {
va_list argptr;
char msg[MAXPRINTMSG];
if ( !developer || !developer->integer ) {
return; // don't confuse non-developers with techie stuff...
}
va_start (argptr,fmt);
Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
va_end (argptr);
Com_Printf ("%s", msg);
#ifndef DEDICATED
if (com_dedicated && !com_dedicated->integer) {
UI_PrintDeveloperConsole(msg);
}
#endif
}
/*
================
Com_DebugPrintf
A Com_Printf that only shows up if the "developer" cvar is set
================
*/
void QDECL Com_DebugPrintf( const char *fmt, ...) {
va_list argptr;
char msg[MAXPRINTMSG];
if ( !developer || !developer->integer ) {
return; // don't confuse non-developers with techie stuff...
}
va_start (argptr,fmt);
Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
va_end (argptr);
Sys_DebugPrint (msg);
}
#endif
/*

View file

@ -1262,6 +1262,8 @@ void Info_NextPair( const char **s, char *key, char *value );
void QDECL Com_Error( int level, const char *error, ... ) __attribute__ ((format (printf, 2, 3)));
void QDECL Com_Printf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
void QDECL Com_DPrintf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
void QDECL Com_DPrintf2( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
void QDECL Com_DebugPrintf( const char *msg, ... ) __attribute__ ((format (printf, 1, 2)));
/*