shithub: qk1

Download patch

ref: afcca882c808ee92cdc600a2917c4a768706652d
parent: a2185958c18ae585825b27d3d237b3562d71a919
author: Konstantinn Bonnet <qu7uux@gmail.com>
date: Thu Feb 19 06:48:26 EST 2015

proper plan9 install

install binary as $home/bin/$objtype/quake
install game data in $home/lib/quake/

--- a/.hgignore
+++ b/.hgignore
@@ -1,6 +1,4 @@
 syntax:glob
 *.[1-9qv]
-*qk1
 *.out
 *.acid
-id1/
--- a/README
+++ b/README
@@ -2,9 +2,12 @@
 ===============
 	- setup:
 		. mk install
-		. mkdir id1
+	- to install quake (shareware or registered):
+		. mkdir $home/lib/quake/id1
 		. cp /n/quakecd/id1/*.pak id1/
-		. run from same dir...
+	- to install an expansion or compatible mod (zB rogue):
+		. mkdir $home/lib/quake/rogue
+		. cp /n/quakecd/rogue/*.pak $home/lib/quake/rogue
 	- sound works, but is glitchy and reduces FPS quite a bit, esp. high resolutions
 	- cdaudio, networking: PORTME
 	- high resolutions work up to 4096x4096 (arbitrary limit in r_shared.h)
@@ -18,7 +21,6 @@
 		. open console (~)
 		. type m_windowed 1 (can autocomplete w/ tab)
 		. setting saved on exit in id1/config.cfg
-	- official expansions (rogue and hipnotic) work fine, mods could too
 	- tested on 386 and amd64 only (works ok on a pentium 4)
 
 
@@ -60,7 +62,7 @@
 	- net_9p.c
 	- cd_9.c,net_udp.c,net_dgrm.c: actuallyport
 	- snd_9.c, vid_9.c: lousy
-	- plan9-like install (lib/quake rather than cwd), manpages
+	- manpages
 	- caps lock == Kctl (← kbdfs, notanissue?)
 	- ungrab mouse when entering console or menus a la games/doom (IN_Grabm())
 	- cleanse *_9.c from linux legacy
--- a/mkfile
+++ b/mkfile
@@ -1,7 +1,7 @@
 </$objtype/mkfile
 
-BIN=.
-TARG=qk1
+BIN=$home/bin/$objtype
+TARG=quake
 
 OFILES=\
 	cl_demo.$O\
--- a/sys_9.c
+++ b/sys_9.c
@@ -5,7 +5,6 @@
 
 qboolean isDedicated;
 int nostdout = 0;
-char *basedir = ".";
 char *cachedir = "/tmp";
 cvar_t sys_linerefresh = {"sys_linerefresh","0"};	// set for entity display
 
@@ -163,32 +162,36 @@
 {
 }
 
-int main (int c, char **v)
+void main (int c, char **v)
 {
-	double	time, oldtime, newtime;
-	quakeparms_t	parms;
-	extern int	vcrFile;
-	extern int	recording;
-	int	j;
+	static char basedir[1024];
+	int j;
+	char *home;
+	double time, oldtime, newtime;
+	quakeparms_t parms;
+	extern int vcrFile;
+	extern int recording;
 
-	argv0 = *v;
-
 	memset(&parms, 0, sizeof(parms));
 
 	COM_InitArgv(c, v);
 	parms.argc = com_argc;
 	parms.argv = com_argv;
-	parms.memsize = 8*1024*1024;
+	argv0 = *v;
 
-	j = COM_CheckParm("-mem");
-	if(j)
+	parms.memsize = 8*1024*1024;
+	if(j = COM_CheckParm("-mem"))
 		parms.memsize = (int)(Q_atof(com_argv[j+1]) * 1024*1024);
-
 	parms.membase = malloc(parms.memsize);
-	parms.basedir = basedir;
 
-	//fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
+	if(home = getenv("home")){
+		snprintf(basedir, sizeof basedir, "%s/lib/quake", home);
+		free(home);
+	}else
+		snprintf(basedir, sizeof basedir, "/sys/lib/quake");
 
+	parms.basedir = basedir;
+
 	/* ignore fp exceptions (bad), rendering shit assumes they are */
 	setfcr(getfcr() & ~(FPOVFL|FPUNFL|FPINVAL|FPZDIV));	/* FIXME */
 
@@ -196,15 +199,13 @@
 
 	if(COM_CheckParm("-nostdout"))
 		nostdout = 1;
-	else{
-		//fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
+	else
 		print("(9)quake %4.2f\n", (float)VERSION);
-	}
 
-	oldtime = Sys_FloatTime () - 0.1;
+	oldtime = Sys_FloatTime() - 0.1;
 	for(;;){
 		// find time spent rendering last frame
-		newtime = Sys_FloatTime ();
+		newtime = Sys_FloatTime();
 		time = newtime - oldtime;
 
 		if(cls.state == ca_dedicated){   // play vcrfiles at max speed