ref: d6239b6e52077d9fa2bc04af784a276bc98cdd01
parent: 81efcd44e70f5ef130cea76791053e847c51499a
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Oct 12 20:03:19 EDT 2023
remove dprint, replace [df]print with Con_DPrintf
--- a/cd.c
+++ b/cd.c
@@ -22,7 +22,7 @@
double vol;
if((afd = open("/dev/audio", OWRITE)) < 0){
- fprint(2, "cd: open: %r\n");
+ Con_DPrintf("cd: open: %r\n");
return;
}
fd = -1;
@@ -32,7 +32,7 @@
trk = chtrk;
snprint(f, sizeof f, "%s%03ud", cdfile, trk);
if((fd = open(f, OREAD)) < 0)
- fprint(2, "cd: open: %r\n");
+ Con_DPrintf("cd: open: %r\n");
chtrk = 0;
}
if(!cdread || fd < 0){
@@ -177,7 +177,7 @@
initcd(void)
{
if(cdinfo() < 0){
- fprint(2, "cdinfo: %r\n");
+ Con_DPrintf("cdinfo: %r\n");
return -1;
}
if(proccreate(cproc, nil, 16384) < 0)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -78,7 +78,7 @@
if(r != 1 && r != 2)
return r;
if(net_message.cursize == 1 && net_message.data[0] == svc_nop)
- dprint("<-- server to client keepalive\n");
+ Con_DPrintf("<-- server to client keepalive\n");
else
break;
}
@@ -132,7 +132,7 @@
if(c > 2)
Cmd_ExecuteString(va("map %s", Cmd_Argv(2)), src_command);
s = va("%s/%s%s", fsdir, a, ext(a, ".dem"));
- dprint("recdemo: writing to file %s\n", s);
+ Con_DPrintf("recdemo: writing to file %s\n", s);
if(opendm(s, trk) < 0){
Con_Printf(va("recdemo: %r\n"));
return;
@@ -158,7 +158,7 @@
CL_Disconnect();
a = Cmd_Argv(1);
s = va("%s%s", a, ext(a, ".dem"));
- dprint("playdemo: reading file %s\n", s);
+ Con_DPrintf("playdemo: reading file %s\n", s);
if(loaddm(s) < 0){
Con_Printf(va("playdemo: %r\n"));
cls.demonum = -1;
--- a/cl_main.c
+++ b/cl_main.c
@@ -88,7 +88,7 @@
if (cls.demorecording)
stopdemo();
- dprint("CL_Disconnect: sending clc_disconnect...\n");
+ Con_DPrintf("CL_Disconnect: sending clc_disconnect...\n");
SZ_Clear (&cls.message);
MSG_WriteByte (&cls.message, clc_disconnect);
NET_SendUnreliableMessage (cls.netcon, &cls.message);
@@ -134,7 +134,7 @@
cls.netcon = NET_Connect (host);
if (!cls.netcon)
Host_Error ("CL_Connect: connect failed\n");
- dprint("CL_EstablishConnection: connected to %s\n", host);
+ Con_DPrintf("CL_EstablishConnection: connected to %s\n", host);
cls.demonum = -1; // not in the demo loop now
cls.state = ca_connected;
@@ -152,7 +152,7 @@
{
char str[8192];
- dprint("CL_SignonReply: got %d\n", cls.signon);
+ Con_DPrintf("CL_SignonReply: got %d\n", cls.signon);
switch (cls.signon)
{
@@ -648,7 +648,7 @@
if (!NET_CanSendMessage (cls.netcon))
{
- fprint(2, "CL_WriteToServer: can't send\n");
+ Con_DPrintf("CL_WriteToServer: can't send\n");
return;
}
--- a/cl_parse.c
+++ b/cl_parse.c
@@ -189,7 +189,7 @@
static char model_precache[MAX_MODELS][Npath];
static char sound_precache[MAX_SOUNDS][Npath];
- dprint("CL_ParseServerInfo: parsing serverinfo pkt...\n");
+ Con_DPrintf("CL_ParseServerInfo: parsing serverinfo pkt...\n");
//
// wipe the client_state_t struct
//
--- a/cvar.c
+++ b/cvar.c
@@ -145,7 +145,7 @@
cv = Cvar_FindVar(k);
if(cv == nil){
- fprint(2, "setcvar: no such cvar %s\n", k);
+ Con_DPrintf("setcvar: no such cvar %s\n", k);
return;
}
n = strcmp(cv->string, k);
--- a/d_surf.c
+++ b/d_surf.c
@@ -190,8 +190,8 @@
for(s = sc_base; s != nil; s = s->next){
if(s == sc_rover)
- dprint("ROVER:\n");
- dprint("%p : %d bytes %ud width\n", s, s->size, s->width);
+ Con_DPrintf("ROVER:\n");
+ Con_DPrintf("%p : %d bytes %ud width\n", s, s->size, s->width);
}
}
--- a/fns.h
+++ b/fns.h
@@ -47,7 +47,6 @@
int loaddm(char*);
int opendm(char*, int);
void initfs(void);
-void dprint(char*, ...);
void fatal(char*, ...);
void* emalloc(ulong);
vlong flen(int);
@@ -57,5 +56,4 @@
void shutdown(void);
uvlong nanosec(void);
-#pragma varargck argpos dprint 1
#pragma varargck argpos fatal 1
--- a/fs.c
+++ b/fs.c
@@ -287,7 +287,7 @@
if(access(path, AEXIST) == 0)
return 0;
if((d = create(path, OREAD, DMDIR|0777)) < 0){
- fprint(2, "Sys_mkdir:create: %r\n");
+ Con_DPrintf("Sys_mkdir:create: %r\n");
return -1;
}
close(d);
@@ -485,7 +485,7 @@
return;
bf = bopen(va("%s/config.cfg", fsdir), OWRITE, 1);
if(bf == nil){
- fprint(2, "dumpcfg: %r\n");
+ Con_DPrintf("dumpcfg: %r\n");
return;
}
dumpkeys(bf);
@@ -508,12 +508,12 @@
strcpy(*s, "--- UNUSED SLOT ---");
bf = bopen(va("%s/s%d.sav", fsdir, n), OREAD, 1);
if(bf == nil){
- dprint("savnames: %r\n");
+ Con_DPrintf("savnames: %r\n");
continue;
}
if((p = Brdline(bf, '\n'), p == nil) /* discard version */
|| (p = Brdline(bf, '\n'), p == nil)){
- dprint("savnames: short read: %r\n");
+ Con_DPrintf("savnames: short read: %r\n");
continue;
}
strncpy(*s, p, sizeof(*s)-1);
@@ -762,9 +762,9 @@
n = Bread(demobf, net_message.data, net_message.cursize);
demoofs = Bseek(demobf, 0, 1);
if(n < 0)
- dprint("readdm: bad read: %r\n");
+ Con_DPrintf("readdm: bad read: %r\n");
if(n != net_message.cursize){
- dprint("readdm: short read: %r\n");
+ Con_DPrintf("readdm: short read: %r\n");
n = -1;
}
return n;
@@ -782,7 +782,7 @@
s = Brdline(demobf, '\n');
n = Blinelen(demobf) - 1;
if(s == nil || n < 0 || n > 11){
- dprint("loaddm: invalid trk field\n");
+ Con_DPrintf("loaddm: invalid trk field\n");
closelmp(demobf);
return -1;
}
@@ -869,7 +869,7 @@
snprint(f, sizeof f, "%s/pak%d.pak", d, n);
p = pak(f);
if(p == nil){
- dprint("pakdir: %r\n");
+ Con_DPrintf("pakdir: %r\n");
break;
}
pl = Hunk_Alloc(sizeof *pl);
@@ -914,7 +914,7 @@
Cvar_RegisterVariable(®istered);
bf = openlmp("gfx/pop.lmp", nil);
if(bf == nil){
- dprint("chkreg: shareware version\n");
+ Con_DPrintf("chkreg: shareware version\n");
if(notid1)
fatal("chkreg: phase error -- %r");
return;
@@ -925,7 +925,7 @@
fatal("chkreg: corrupted pop lump");
closelmp(bf);
setcvar("registered", "1");
- dprint("chkreg: registered version\n");
+ Con_DPrintf("chkreg: registered version\n");
}
/* TODO: nuke these from orbit */
--- a/host.c
+++ b/host.c
@@ -68,7 +68,7 @@
vsnprint(s, sizeof s, fmt, arg);
va_end(arg);
- dprint("Host_EndGame: %s\n", s);
+ Con_DPrintf("Host_EndGame: %s\n", s);
if(sv.active)
Host_ShutdownServer(false);
@@ -280,7 +280,7 @@
pr_global_struct->self = saveSelf;
}
- dprint("client %s removed\n", host_client->name);
+ Con_DPrintf("client %s removed\n", host_client->name);
}
// break the net connection
@@ -391,7 +391,7 @@
*/
void Host_ClearMemory (void)
{
- dprint("Clearing memory\n");
+ Con_DPrintf("Clearing memory\n");
D_FlushCaches ();
Mod_ClearAll ();
if (host_hunklevel)
@@ -614,9 +614,9 @@
SCR_Init ();
R_Init ();
if(initsnd() < 0)
- fprint(2, "initsnd: %r\n");
+ Con_DPrintf("initsnd: %r\n");
if(initcd() < 0)
- fprint(2, "initcd: %r\n");
+ Con_DPrintf("initcd: %r\n");
Sbar_Init ();
CL_Init ();
}
@@ -645,7 +645,7 @@
if (isdown)
{
- fprint(2, "Host_Shutdown: recursive shutdown\n");
+ Con_DPrintf("Host_Shutdown: recursive shutdown\n");
return;
}
isdown = true;
--- a/host_cmd.c
+++ b/host_cmd.c
@@ -461,7 +461,7 @@
}
host_client = save;
- dprint("%s", &text[1]);
+ Con_DPrintf("%s", &text[1]);
}
@@ -718,7 +718,7 @@
PR_ExecuteProgram (pr_global_struct->ClientConnect);
if ((dtime() - host_client->netconnection->connecttime) <= sv.time)
- dprint("%s entered the game\n", host_client->name);
+ Con_DPrintf("%s entered the game\n", host_client->name);
PR_ExecuteProgram (pr_global_struct->PutClientInServer);
}
@@ -887,7 +887,7 @@
/* Can't call SCR_BeginLoadingPlaque, because too much stack space has
* been used. The menu calls it before stuffing loadgame command */
//SCR_BeginLoadingPlaque();
- dprint("loadgame: reading from %s", s);
+ Con_DPrintf("loadgame: reading from %s", s);
if(loadsav(s) < 0){
Con_Printf(va("loadgame: %r\n"));
return;
--- a/in.c
+++ b/in.c
@@ -81,7 +81,7 @@
while(r = nbrecv(inchan, &ev), r > 0)
Key_Event(ev.key, ev.down);
if(r < 0)
- fprint(2, "Sys_SendKeyEvents: %r\n");
+ Con_DPrintf("Sys_SendKeyEvents: %r\n");
}
void
@@ -267,7 +267,7 @@
if(n = read(fd, buf, sizeof buf), n != 1+4*12){
if(n < 0 || ++nerr > 10)
break;
- fprint(2, "mproc: bad count %d not 49: %r\n", n);
+ Con_DPrintf("mproc: bad count %d not 49: %r\n", n);
continue;
}
nerr = 0;
@@ -312,7 +312,7 @@
if(mouseon = on && m_windowed.value){
fd = open("/dev/cursor", ORDWR|OCEXEC);
if(fd < 0){
- fprint(2, "IN_Grabm:open: %r\n");
+ Con_DPrintf("IN_Grabm:open: %r\n");
return;
}
write(fd, nocurs, sizeof nocurs);
--- a/net_dgrm.c
+++ b/net_dgrm.c
@@ -193,7 +193,7 @@
{
if (sequence < sock->unreliableReceiveSequence)
{
- fprint(2, "Got a stale datagram\n");
+ Con_DPrintf("Got a stale datagram\n");
ret = 0;
break;
}
@@ -201,7 +201,7 @@
{
count = sequence - sock->unreliableReceiveSequence;
droppedDatagrams += count;
- fprint(2, "Dropped %ud datagram(s)\n", count);
+ Con_DPrintf("Dropped %ud datagram(s)\n", count);
}
sock->unreliableReceiveSequence = sequence + 1;
@@ -218,7 +218,7 @@
{
if (sequence != (sock->sendSequence - 1))
{
- fprint(2, "Stale ACK received\n");
+ Con_DPrintf("Stale ACK received\n");
continue;
}
if (sequence == sock->ackSequence)
@@ -225,11 +225,11 @@
{
sock->ackSequence++;
if (sock->ackSequence != sock->sendSequence)
- fprint(2, "ack sequencing error\n");
+ Con_DPrintf("ack sequencing error\n");
}
else
{
- fprint(2, "Duplicate ACK received\n");
+ Con_DPrintf("Duplicate ACK received\n");
continue;
}
sock->sendMessageLength -= MAX_DATAGRAM;
--- a/net_main.c
+++ b/net_main.c
@@ -324,7 +324,7 @@
{
if (net_time - sock->lastMessageTime > net_messagetimeout.value)
{
- fprint(2, "NET_GetMessage: sock %#p timed out\n", sock);
+ Con_DPrintf("NET_GetMessage: sock %#p timed out\n", sock);
NET_Close(sock);
return -1;
}
--- a/net_udp.c
+++ b/net_udp.c
@@ -85,7 +85,7 @@
NetConnInfo *nc;
if((nc = getnetconninfo(nil, a->fd)) == nil){
- fprint(2, "getnetconninfo: %r\n");
+ Con_DPrintf("getnetconninfo: %r\n");
return;
}
strncpy(a->ip, nc->raddr, sizeof(a->ip)-1);
@@ -98,7 +98,7 @@
UDP_Connect(Addr *a)
{
if((a->fd = dial(netmkaddr(a->ip, "udp", a->srv), myip.srv, nil, nil)) < 0){
- fprint(2, "dial: %r\n");
+ Con_DPrintf("dial: %r\n");
return -1;
}
return 0;
@@ -123,7 +123,7 @@
if(flen(a->fd) < 1)
return 0;
if((n = read(a->fd, buf, len)) <= 0){
- fprint(2, "udpread: %r\n");
+ Con_DPrintf("udpread: %r\n");
return -1;
}
return n;
@@ -133,7 +133,7 @@
udpwrite(uchar *buf, int len, Addr *a)
{
if(write(a->fd, buf, len) != len){
- fprint(2, "udpwrite: %r\n");
+ Con_DPrintf("udpwrite: %r\n");
return -1;
}
return len;
@@ -159,11 +159,11 @@
snprint(ip, sizeof ip, "%I", IPv4bcast);
if((fd = dial(netmkaddr(ip, "udp", myip.srv), myip.srv, nil, nil)) < 0){
- fprint(2, "UDP_Broadcast: %r\n");
+ Con_DPrintf("UDP_Broadcast: %r\n");
return -1;
}
if(write(fd, buf, len) != len)
- fprint(2, "write: %r\n");
+ Con_DPrintf("write: %r\n");
close(fd);
return 0;
}
@@ -185,12 +185,12 @@
snprint(buf, sizeof buf, "udp!%s!%s", s, p);
n = strlen(buf);
if(write(fd, buf, n) != n){
- fprint(2, "translating %s: %r\n", s);
+ Con_DPrintf("translating %s: %r\n", s);
return -1;
}
seek(fd, 0, 0);
if((n = read(fd, buf, sizeof(buf)-1)) <= 0){
- fprint(2, "reading cs tables: %r");
+ Con_DPrintf("reading cs tables: %r");
return -1;
}
buf[n] = 0;
@@ -204,7 +204,7 @@
snprint(a->sys, sizeof a->sys, "%s!%s", a->ip, a->srv);
return 0;
err:
- fprint(2, "bad cs entry %s", buf);
+ Con_DPrintf("bad cs entry %s", buf);
return -1;
}
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -1520,7 +1520,7 @@
int i;
G_FLOAT(OFS_RETURN) = false;
- //fprint(2, "checking extension %s\n", ext);
+ Con_DPrintf("checking extension %s\n", ext);
for(i = 0; i < nelem(exts); i++){
if(strcmp(ext, exts[i]) == 0){
G_FLOAT(OFS_RETURN) = true;
--- a/pr_edict.c
+++ b/pr_edict.c
@@ -939,7 +939,7 @@
PR_ExecuteProgram (func - pr_functions);
}
- dprint("%d entities inhibited\n", inhibit);
+ Con_DPrintf("%d entities inhibited\n", inhibit);
}
@@ -974,7 +974,7 @@
progs = loadhunklmp("progs.dat", &n);
if(progs == nil)
fatal("PR_LoadProgs: %r");
- dprint("Programs occupy %dK.\n", n/1024);
+ Con_DPrintf("Programs occupy %dK.\n", n/1024);
for (i=0 ; i<n ; i++)
crc (((byte *)progs)[i]);
--- a/qk1.c
+++ b/qk1.c
@@ -5,24 +5,10 @@
#include "quakedef.h"
#include "fns.h"
-mainstacksize = 1*1024*1024;
+mainstacksize = 32*1024*1024;
char *netmtpt = "/net";
char *game;
int debug;
-
-void
-dprint(char *fmt, ...)
-{
- char s[256];
- va_list arg;
-
- if(!debug)
- return;
- va_start(arg, fmt);
- vseprint(s, s+sizeof s, fmt, arg);
- va_end(arg);
- fprint(2, "%s", s);
-}
/* FIXME: merge dprint/fatal? */
void
--- a/r_alias.c
+++ b/r_alias.c
@@ -92,7 +92,7 @@
// TODO: don't repeat this check when drawing?
if ((frame >= pmdl->numframes) || (frame < 0))
{
- //fprint(2, "No such frame %d %s\n", frame, pmodel->name);
+ //Con_DPrintf("No such frame %d %s\n", frame, pmodel->name);
frame = 0;
}
@@ -544,7 +544,7 @@
skinnum = currententity->skinnum;
if ((skinnum >= pmdl->numskins) || (skinnum < 0))
{
- //fprint(2, "R_AliasSetupSkin: no such skin # %d\n", skinnum);
+ //Con_DPrintf("R_AliasSetupSkin: no such skin # %d\n", skinnum);
skinnum = 0;
}
@@ -634,7 +634,7 @@
frame = currententity->frame;
if ((frame >= pmdl->numframes) || (frame < 0))
{
- //fprint(2, "R_AliasSetupFrame: no such frame %d\n", frame);
+ //Con_DPrintf("R_AliasSetupFrame: no such frame %d\n", frame);
frame = 0;
}
--- a/snd.c
+++ b/snd.c
@@ -302,12 +302,12 @@
return sc;
u = loadstklmp(va("sound/%s", sfx->s), buf, sizeof buf, &len);
if(u == nil){
- fprint(2, "loadsfx: %r\n");
+ Con_DPrintf("loadsfx: %r\n");
return nil;
}
info = GetWavinfo(sfx->s, u, len);
if(info.channels != 1){
- fprint(2, "loadsfx: non mono wave %s\n", sfx->s);
+ Con_DPrintf("loadsfx: non mono wave %s\n", sfx->s);
return nil;
}
stepscale = (float)info.rate / Srate;
@@ -506,7 +506,7 @@
sz = -sz;
}
if(write(afd, m, sz) != sz){
- fprint(2, "sndwrite: %r\n");
+ Con_DPrintf("sndwrite: %r\n");
shutsnd();
break;
}
@@ -696,7 +696,7 @@
if(sc = loadsfx(sfx), sc == nil)
return;
if(sc->loop < 0){
- fprint(2, "staticsfx %s: nonlooped static sound\n", sfx->s);
+ Con_DPrintf("staticsfx %s: nonlooped static sound\n", sfx->s);
return;
}
c->sfx = sfx;
--- a/sv_main.c
+++ b/sv_main.c
@@ -262,7 +262,7 @@
client = svs.clients + clientnum;
- dprint("client %s connected\n", client->netconnection->address);
+ Con_DPrintf("client %s connected\n", client->netconnection->address);
edictnum = clientnum+1;
@@ -1091,7 +1091,7 @@
setcvar ("hostname", "UNNAMED");
scr_centertime_off = 0;
- dprint("SV_SpawnServer: %s\n", server);
+ Con_DPrintf("SV_SpawnServer: %s\n", server);
svs.changelevel_issued = false; // now safe to issue another
//
@@ -1227,6 +1227,6 @@
SV_SendServerinfo (host_client);
IN_Grabm(1);
- dprint("server spawned\n");
+ Con_DPrintf("server spawned\n");
}
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -595,7 +595,7 @@
VectorCopy (ent->v.oldorigin, ent->v.origin);
if (!SV_TestEntityPosition(ent))
{
- fprint(2, "player unstuck\n");
+ Con_DPrintf("player unstuck\n");
SV_LinkEdict (ent, true);
return;
}
@@ -609,7 +609,7 @@
ent->v.origin[2] = org[2] + z;
if (!SV_TestEntityPosition(ent))
{
- fprint(2, "player unstuck\n");
+ Con_DPrintf("player unstuck\n");
SV_LinkEdict (ent, true);
return;
}
@@ -616,7 +616,7 @@
}
VectorCopy (org, ent->v.origin);
- fprint(2, "player is stuck\n");
+ Con_DPrintf("player is stuck\n");
}
--- a/sv_user.c
+++ b/sv_user.c
@@ -469,7 +469,7 @@
ret = NET_GetMessage (host_client->netconnection);
if (ret == -1)
{
- fprint(2, "SV_ReadClientMessage: NET_GetMessage failed\n");
+ Con_DPrintf("SV_ReadClientMessage: NET_GetMessage failed\n");
return false;
}
if (!ret)
@@ -484,7 +484,7 @@
if (msg_badread)
{
- fprint(2, "SV_ReadClientMessage: badread\n");
+ Con_DPrintf("SV_ReadClientMessage: badread\n");
return false;
}
@@ -496,7 +496,7 @@
goto nextmsg; // end of message
default:
- fprint(2, "SV_ReadClientMessage: unknown command char\n");
+ Con_DPrintf("SV_ReadClientMessage: unknown command char\n");
return false;
case clc_nop:
@@ -548,7 +548,7 @@
else if (ret == 1)
Cmd_ExecuteString (s, src_client);
else
- fprint(2, "%s tried to %s\n", host_client->name, s);
+ Con_DPrintf("%s tried to %s\n", host_client->name, s);
break;
case clc_disconnect:
--- a/world.c
+++ b/world.c
@@ -645,7 +645,7 @@
{
trace->fraction = midf;
VectorCopy (mid, trace->endpos);
- fprint(2, "backup past 0\n");
+ Con_DPrintf("backup past 0\n");
return false;
}
midf = p1f + (p2f - p1f)*frac;