ref: e5661fc7dc225f89da46454f2545dd8574fa3073
parent: 4a09c1b22192e4e7a900daff1fd640bd90dff1da
author: qwx <qwx@sciops.net>
date: Tue Aug 24 12:24:32 EDT 2021
don't print debug messages by default
--- a/common.c
+++ b/common.c
@@ -1399,6 +1399,9 @@
// cvar and command buffer management
COM_InitArgv (argc, argv);
+ if(COM_CheckParm("-debug"))
+ debug = true;
+
Swap_Init ();
Cbuf_Init ();
--- a/dat.h
+++ b/dat.h
@@ -198,6 +198,7 @@
BoxOnPlaneSide( (emins), (emaxs), (p)))
extern int curtime; // current time in ms, from Sys_Milliseconds()
+extern qboolean debug;
enum{
CVAR_ARCHIVE = 1<<0, // save to vars.rc
--- a/sys.c
+++ b/sys.c
@@ -9,6 +9,7 @@
void KBD_Update(void);
mainstacksize = 512*1024;
+qboolean debug;
int curtime;
uint sys_frame_time;
Channel *fuckchan, *tchan;
@@ -297,22 +298,23 @@
void
Sys_ConsoleOutput(char *s)
{
- write(1, s, strlen(s));
+ if(!debug)
+ return;
+ fprint(2, "%s", s);
}
void
Sys_Error(char *error, ...)
{
- char buf[1024], *out;
+ char buf[1024];
va_list arg;
CL_Shutdown();
va_start(arg, error);
- out = vseprint(buf, buf+sizeof(buf), error, arg);
+ vseprint(buf, buf+sizeof(buf), error, arg);
va_end(arg);
- write(2, buf, out-buf);
- print("\n");
+ fprint(2, "%s\n", buf);
sysfatal("ending.");
}