shithub: qk1

Download patch

ref: b165d7bb0ccfe03c70e1fc65a0cec5d5d7a27caa
parent: 8ca1692ee9591fdce58c9f501783a4e3bebe53c4
author: qwx <>
date: Sun Dec 23 07:44:03 EST 2018

workaround for console color print

va() uses print(2), use that for %r, %zd, etc.
not ideal, but it does the job.

--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 qk1 - (9) quake
 ===============
 Port of linux/x11 quake and quakeworld to plan9front.
-- Works on amd64 and 386, broken on arm and probably other arches
+- Works on amd64 and 386, broken on zynq
 
 
 Installation
@@ -53,7 +53,7 @@
 Todo/bugs
 ---------
 - don't use #pragma pack and do not read in structs directly
-- fix arm graphics issues
+- fix zynq graphics issues
 - cd: buffer reading from actual cdroms
 - do away with PR_Str shit
 - manpages
@@ -62,7 +62,6 @@
 - infinite loop in SV_TouchLinks
 - (amd64) entities visible through walls right when emerging from/immerging
   into water
-- fix stdio console color print
 - resolutions other than 4:3: some vertical and horizontal strips on the edge
   of the screen aren't drawn
 - #define PARANOID reveals several points of failure that are otherwise ignored
@@ -78,8 +77,7 @@
 - text and code seen as useless for plan9 nuked from orbit (cpp defs, etc.)
 - arbitrary resolution limit (r_shared.h): 2048x2048 (was 1280x1024), which
   inflates e.g. a bunch of arrays in the code
-- removal of stdio stuff probably not really warranted and possibly introduced
-  bugs
+- both stdio and print(2) are used due to the way colored strings are handled
 
 
 Legal
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -134,7 +134,7 @@
 	s = va("%s/%s%s", fsdir, a, ext(a, ".dem"));
 	dprint("recdemo: writing to file %s\n", s);
 	if(opendm(s, trk) < 0){
-		Con_Printf("recdemo: %r\n");
+		Con_Printf(va("recdemo: %r\n"));
 		return;
 	}
 	cls.demorecording = 1;
@@ -160,7 +160,7 @@
 	s = va("%s%s", a, ext(a, ".dem"));
 	dprint("playdemo: reading file %s\n", s);
 	if(loaddm(s) < 0){
-		Con_Printf("playdemo: %r\n");
+		Con_Printf(va("playdemo: %r\n"));
 		cls.demonum = -1;
 		return;
 	}
--- a/cl_parse.c
+++ b/cl_parse.c
@@ -210,7 +210,7 @@
 	cl.maxclients = MSG_ReadByte ();
 	if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD)
 	{
-		Con_Printf("Bad maxclients (%ud) from server\n", cl.maxclients);
+		Con_Printf("Bad maxclients (%d) from server\n", cl.maxclients);
 		return;
 	}
 	cl.scores = Hunk_AllocName(cl.maxclients * sizeof *cl.scores, "scores");
--- a/cmd.c
+++ b/cmd.c
@@ -275,7 +275,7 @@
 	mark = Hunk_LowMark ();
 	f = loadhunklmp(Cmd_Argv(1), nil);
 	if(f == nil){
-		Con_Printf("exec: %r\n");
+		Con_Printf(va("exec: %r\n"));
 		return;
 	}
 	Con_Printf ("execing %s\n",Cmd_Argv(1));
--- a/fs.c
+++ b/fs.c
@@ -154,7 +154,7 @@
 
 	for(pl=pkl; pl!=nil; pl=pl->pl)
 		if(pl->p)
-			Con_Printf("%s (%zd files)\n", pl->p->f, pl->p->e - pl->p->l);
+			Con_Printf(va("%s (%zd files)\n", pl->p->f, pl->p->e - pl->p->l));
 		else
 			Con_Printf("%s\n", pl->f);
 }
@@ -386,7 +386,7 @@
 
 	bf = openlmp(va("maps/%s.pts", sv.name), &n);
 	if(bf == nil){
-		Con_Printf("loadpoints: %r\n");
+		Con_Printf(va("loadpoints: %r\n"));
 		return;
 	}
 	nv = 0;
--- a/host.c
+++ b/host.c
@@ -367,7 +367,7 @@
 	MSG_WriteByte(&buf, svc_disconnect);
 	count = NET_SendToAll(&buf, 5);
 	if (count)
-		Con_Printf("Host_ShutdownServer: NET_SendToAll failed for %ud clients\n", count);
+		Con_Printf("Host_ShutdownServer: NET_SendToAll failed for %d clients\n", count);
 
 	for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
 		if (host_client->active)
--- a/net_dgrm.c
+++ b/net_dgrm.c
@@ -284,9 +284,9 @@
 
 void PrintStats(qsocket_t *s)
 {
-	Con_Printf("canSend = %4ud   \n", s->canSend);
-	Con_Printf("sendSeq = %4ud   ", s->sendSequence);
-	Con_Printf("recvSeq = %4ud   \n", s->receiveSequence);
+	Con_Printf("canSend = %4d   \n", s->canSend);
+	Con_Printf("sendSeq = %4d   ", s->sendSequence);
+	Con_Printf("recvSeq = %4d   \n", s->receiveSequence);
 	Con_Printf("\n");
 }
 
--- a/net_main.c
+++ b/net_main.c
@@ -167,7 +167,7 @@
 
 	if (Cmd_Argc () != 2)
 	{
-		Con_Printf ("\"maxplayers\" is \"%ud\"\n", svs.maxclients);
+		Con_Printf ("\"maxplayers\" is \"%d\"\n", svs.maxclients);
 		return;
 	}
 
@@ -183,7 +183,7 @@
 	if (n > svs.maxclientslimit)
 	{
 		n = svs.maxclientslimit;
-		Con_Printf ("\"maxplayers\" set to \"%ud\"\n", n);
+		Con_Printf ("\"maxplayers\" set to \"%d\"\n", n);
 	}
 
 	svs.maxclients = n;
--- a/r_misc.c
+++ b/r_misc.c
@@ -299,8 +299,8 @@
 		if ((surface_p - surfaces) > r_maxsurfsseen)
 			r_maxsurfsseen = surface_p - surfaces;
 
-		Con_Printf ("Used %zd of %zd surfs; %d max\n", surface_p - surfaces,
-				surf_max - surfaces, r_maxsurfsseen);
+		Con_Printf (va("Used %zd of %zd surfs; %d max\n", surface_p - surfaces,
+				surf_max - surfaces, r_maxsurfsseen));
 	}
 
 	if (r_numedges.value)
--- a/vid.c
+++ b/vid.c
@@ -196,7 +196,7 @@
 	flushimage(display, 1);
 	if(dumpwin){
 		if(writebit() < 0)
-			Con_Printf("writebit: %r\n");
+			Con_Printf(va("writebit: %r\n"));
 		dumpwin = 0;
 	}
 }