shithub: qk1

Download patch

ref: 119a847191fdec2ed1118c5cac0a653e20259aa5
parent: 8723be0d01ab4150ed6ca63649a6ec1ddcc06efb
author: Konstantinn Bonnet <qu7uux@gmail.com>
date: Sun Jan 25 15:22:06 EST 2015

add mkfile, kluge build with p9p

amd64 segfaults eventually (pr_strings, etc).
mix of linux and p9p shit -> ugh.

--- /dev/null
+++ b/Makefile
@@ -1,0 +1,385 @@
+BASEVERSION=1.09
+VERSION=1.09
+ARCH=$(shell uname -m)
+BASE_CFLAGS=-Dstricmp=strcasecmp
+DEBUG_CFLAGS=$(BASE_CFLAGS) -ggdb -O0 -trigraphs -Wall -Wextra -m32
+LDFLAGS=-lm
+XLDFLAGS= -lX11 -lXext -lXxf86dga
+XCFLAGS=-DX11
+DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
+DO_X11_CC=$(CC) $(CFLAGS) $(XCFLAGS) -o $@ -c $<
+DO_O_CC=$(CC) -O $(CFLAGS) -o $@ -c $<
+DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+CFLAGS=$(DEBUG_CFLAGS)
+
+all: qk1
+
+X11_OBJS =\
+	cl_demo.o\
+	cl_input.o\
+	cl_main.o\
+	cl_parse.o\
+	cl_tent.o\
+	chase.o\
+	cmd.o\
+	common.o\
+	console.o\
+	crc.o\
+	cvar.o\
+	draw.o\
+	d_edge.o\
+	d_fill.o\
+	d_init.o\
+	d_modech.o\
+	d_part.o\
+	d_polyse.o\
+	d_scan.o\
+	d_sky.o\
+	d_sprite.o\
+	d_surf.o\
+	d_vars.o\
+	d_zpoint.o\
+	host.o\
+	host_cmd.o\
+	keys.o\
+	menu.o\
+	mathlib.o\
+	model.o\
+	net_dgrm.o\
+	net_loop.o\
+	net_main.o\
+	net_vcr.o\
+	net_udp.o\
+	net_bsd.o\
+	nonintel.o\
+	pr_cmds.o\
+	pr_edict.o\
+	pr_exec.o\
+	r_aclip.o\
+	r_alias.o\
+	r_bsp.o\
+	r_light.o\
+	r_draw.o\
+	r_efrag.o\
+	r_edge.o\
+	r_misc.o\
+	r_main.o\
+	r_sky.o\
+	r_sprite.o\
+	r_surf.o\
+	r_part.o\
+	r_vars.o\
+	screen.o\
+	sbar.o\
+	sv_main.o\
+	sv_phys.o\
+	sv_move.o\
+	sv_user.o\
+	zone.o\
+	view.o\
+	wad.o\
+	world.o\
+	cd_linux.o\
+	sys_linux.o\
+	vid_x.o\
+	snd_dma.o\
+	snd_mem.o\
+	snd_mix.o\
+	snd_linux.o\
+	d_draw.o\
+	d_draw16.o\
+	d_parta.o\
+	d_polysa.o\
+	d_scana.o\
+	d_spr8.o\
+	d_varsa.o\
+	math.o\
+	r_aliasa.o\
+	r_drawa.o\
+	r_edgea.o\
+	r_varsa.o\
+	surf16.o\
+	surf8.o\
+	worlda.o\
+	r_aclipa.o\
+	snd_mixa.o\
+	sys_dosa.o\
+
+qk1: $(X11_OBJS)
+	$(CC) $(CFLAGS) -o $@ $(X11_OBJS) $(XLDFLAGS) $(LDFLAGS)
+
+####
+
+cl_demo.o :  cl_demo.c
+	$(DO_X11_CC)
+
+cl_input.o : cl_input.c
+	$(DO_X11_CC)
+
+cl_main.o :  cl_main.c
+	$(DO_X11_CC)
+
+cl_parse.o : cl_parse.c
+	$(DO_X11_CC)
+
+cl_tent.o :  cl_tent.c
+	$(DO_X11_CC)
+
+chase.o :    chase.c
+	$(DO_X11_CC)
+
+cmd.o :      cmd.c
+	$(DO_X11_CC)
+
+common.o :   common.c
+	$(DO_X11_CC)
+
+console.o :  console.c
+	$(DO_X11_CC)
+
+crc.o :      crc.c
+	$(DO_X11_CC)
+
+cvar.o :     cvar.c
+	$(DO_X11_CC)
+
+draw.o :     draw.c
+	$(DO_X11_CC)
+
+d_edge.o :   d_edge.c
+	$(DO_X11_CC)
+
+d_fill.o :   d_fill.c
+	$(DO_X11_CC)
+
+d_init.o :   d_init.c
+	$(DO_X11_CC)
+
+d_modech.o : d_modech.c
+	$(DO_X11_CC)
+
+d_part.o :   d_part.c
+	$(DO_X11_CC)
+
+d_polyse.o : d_polyse.c
+	$(DO_X11_CC)
+
+d_scan.o :   d_scan.c
+	$(DO_X11_CC)
+
+d_sky.o :    d_sky.c
+	$(DO_X11_CC)
+
+d_sprite.o : d_sprite.c
+	$(DO_X11_CC)
+
+d_surf.o :   d_surf.c
+	$(DO_X11_CC)
+
+d_vars.o :   d_vars.c
+	$(DO_X11_CC)
+
+d_zpoint.o : d_zpoint.c
+	$(DO_X11_CC)
+
+host.o :     host.c
+	$(DO_X11_CC)
+
+host_cmd.o : host_cmd.c
+	$(DO_X11_CC)
+
+keys.o :     keys.c
+	$(DO_X11_CC)
+
+menu.o :     menu.c
+	$(DO_X11_CC)
+
+mathlib.o :  mathlib.c
+	$(DO_X11_CC)
+
+model.o :    model.c
+	$(DO_X11_CC)
+
+net_dgrm.o : net_dgrm.c
+	$(DO_X11_CC)
+
+net_loop.o : net_loop.c
+	$(DO_X11_CC)
+
+net_main.o : net_main.c
+	$(DO_X11_CC)
+
+net_vcr.o :  net_vcr.c
+	$(DO_X11_CC)
+
+net_udp.o :  net_udp.c
+	$(DO_X11_CC)
+
+net_bsd.o :  net_bsd.c
+	$(DO_X11_CC)
+
+nonintel.o : nonintel.c
+	$(DO_X11_CC)
+
+pr_cmds.o :  pr_cmds.c
+	$(DO_X11_CC)
+
+pr_edict.o : pr_edict.c
+	$(DO_X11_CC)
+
+pr_exec.o :  pr_exec.c
+	$(DO_X11_CC)
+
+r_aclip.o :  r_aclip.c
+	$(DO_X11_CC)
+
+r_alias.o :  r_alias.c
+	$(DO_X11_CC)
+
+r_bsp.o :    r_bsp.c
+	$(DO_X11_CC)
+
+r_light.o :  r_light.c
+	$(DO_X11_CC)
+
+r_draw.o :   r_draw.c
+	$(DO_X11_CC)
+
+r_efrag.o :  r_efrag.c
+	$(DO_X11_CC)
+
+r_edge.o :   r_edge.c
+	$(DO_X11_CC)
+
+r_misc.o :   r_misc.c
+	$(DO_X11_CC)
+
+r_main.o :   r_main.c
+	$(DO_X11_CC)
+
+r_sky.o :    r_sky.c
+	$(DO_X11_CC)
+
+r_sprite.o : r_sprite.c
+	$(DO_X11_CC)
+
+r_surf.o :   r_surf.c
+	$(DO_X11_CC)
+
+r_part.o :   r_part.c
+	$(DO_X11_CC)
+
+r_vars.o :   r_vars.c
+	$(DO_X11_CC)
+
+screen.o :   screen.c
+	$(DO_X11_CC)
+
+sbar.o :     sbar.c
+	$(DO_X11_CC)
+
+sv_main.o :  sv_main.c
+	$(DO_X11_CC)
+
+sv_phys.o :  sv_phys.c
+	$(DO_X11_CC)
+
+sv_move.o :  sv_move.c
+	$(DO_X11_CC)
+
+sv_user.o :  sv_user.c
+	$(DO_X11_CC)
+
+zone.o	:   zone.c
+	$(DO_X11_CC)
+
+view.o	:   view.c
+	$(DO_X11_CC)
+
+wad.o :      wad.c
+	$(DO_X11_CC)
+
+world.o :    world.c
+	$(DO_X11_CC)
+
+cd_linux.o : cd_linux.c
+	$(DO_X11_CC)
+
+sys_linux.o :sys_linux.c
+	$(DO_X11_CC)
+
+vid_x.o: vid_x.c
+	$(DO_O_CC)
+
+snd_dma.o :  snd_dma.c
+	$(DO_X11_CC)
+
+snd_mem.o :  snd_mem.c
+	$(DO_X11_CC)
+
+snd_mix.o :  snd_mix.c
+	$(DO_X11_CC)
+
+snd_linux.o :snd_linux.c
+	$(DO_X11_CC)
+
+d_copy.o :   d_copy.s
+	$(DO_AS)
+
+d_draw.o :   d_draw.s
+	$(DO_AS)
+
+d_draw16.o : d_draw16.s
+	$(DO_AS)
+
+d_parta.o :  d_parta.s
+	$(DO_AS)
+
+d_polysa.o : d_polysa.s
+	$(DO_AS)
+
+d_scana.o :  d_scana.s
+	$(DO_AS)
+
+d_spr8.o :   d_spr8.s
+	$(DO_AS)
+
+d_varsa.o :  d_varsa.s
+	$(DO_AS)
+
+math.o :     math.s
+	$(DO_AS)
+
+r_aliasa.o : r_aliasa.s
+	$(DO_AS)
+
+r_drawa.o :  r_drawa.s
+	$(DO_AS)
+
+r_edgea.o :  r_edgea.s
+	$(DO_AS)
+
+r_varsa.o :  r_varsa.s
+	$(DO_AS)
+
+surf16.o :   surf16.s
+	$(DO_AS)
+
+surf8.o :    surf8.s
+	$(DO_AS)
+
+worlda.o :   worlda.s
+	$(DO_AS)
+
+r_aclipa.o : r_aclipa.s
+	$(DO_AS)
+
+snd_mixa.o : snd_mixa.s
+	$(DO_AS)
+
+sys_dosa.o : sys_dosa.s
+	$(DO_AS)
+
+
+clean:
+	rm -f qk1 $(X11_OBJS)
--- /dev/null
+++ b/README
@@ -1,0 +1,12 @@
+qk1 - port of Quake to 9front
+=============================
+Does not work. Nothing to see here, move along.
+
+builds only with p9p on linux/386 and amd64, but amd64 build is buggered
+(pr_strings pointer shit, maybe more).
+plan9 shit missing completely, asm not ungccfied.
+
+
+legal
+-----
+Quake, hence qk1, are licensed under the GPLv2. See COPYING for details.
--- a/adivtab.h
+++ b/adivtab.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // table of quotients and remainders for [-15...16] / [-15...16]
 
 // numerator = -15
--- a/anorms.h
+++ b/anorms.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 {-0.525731, 0.000000, 0.850651}, 
 {-0.442863, 0.238856, 0.864188}, 
 {-0.295242, 0.000000, 0.955423}, 
--- a/asm_draw.h
+++ b/asm_draw.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // asm_draw.h
 //
--- a/asm_i386.h
+++ b/asm_i386.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 #ifndef __ASM_I386__
 #define __ASM_I386__
 
--- a/block16.h
+++ b/block16.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 LEnter16_16:
 	movb	(%esi),%al
 	movb	(%esi,%ebx,),%cl
--- a/bspfile.h
+++ b/bspfile.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
-
 // upper design bounds
 
 #define	MAX_MAP_HULLS		4
--- a/cd_linux.c
+++ b/cd_linux.c
@@ -1,34 +1,17 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // Quake is a trademark of Id Software, Inc., (c) 1996 Id Software, Inc. All
 // rights reserved.
 
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
+#include <u.h>
+#include <libc.h>
+//#include <stdio.h>
+//#include <unistd.h>
+//#include <stdlib.h>
 #include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <string.h>
-#include <time.h>
+//#include <sys/file.h>
+//#include <sys/types.h>
+//#include <fcntl.h>
+//#include <string.h>
+//#include <time.h>
 #include <errno.h>
 
 #include <linux/cdrom.h>
@@ -381,7 +364,7 @@
 		cd_dev[sizeof(cd_dev) - 1] = 0;
 	}
 
-	if ((cdfile = open(cd_dev, O_RDONLY)) == -1) {
+	if ((cdfile = open(cd_dev, OREAD)) == -1) {
 		Con_Printf("CDAudio_Init: open of \"%s\" failed (%i)\n", cd_dev, errno);
 		cdfile = -1;
 		return -1;
--- a/cdaudio.h
+++ b/cdaudio.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 int CDAudio_Init(void);
 void CDAudio_Play(byte track, qboolean looping);
 void CDAudio_Stop(void);
--- a/chase.c
+++ b/chase.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // chase.c -- chase camera code
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 cvar_t	chase_back = {"chase_back", "100"};
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -1,23 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 void CL_FinishTimeDemo (void);
--- a/cl_input.c
+++ b/cl_input.c
@@ -1,27 +1,10 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // cl.input.c  -- builds an intended movement command to send to the server
 
 // Quake is a trademark of Id Software, Inc., (c) 1996 Id Software, Inc. All
 // rights reserved.
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 /*
--- a/cl_main.c
+++ b/cl_main.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // cl_main.c  -- client main loop
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 // we need to declare some mouse variables here, because the menu system
--- a/cl_parse.c
+++ b/cl_parse.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // cl_parse.c  -- parse a message received from the server
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 char *svc_strings[] =
--- a/cl_tent.c
+++ b/cl_tent.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // cl_tent.c -- client side temporary entities
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 int			num_temp_entities;
--- a/client.h
+++ b/client.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// client.h
-
 typedef struct
 {
 	vec3_t	viewangles;
--- a/cmd.c
+++ b/cmd.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // cmd.c -- Quake script command processing module
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 void Cmd_ForwardToServer (void);
--- a/cmd.h
+++ b/cmd.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 // cmd.h -- Command buffer and command execution
 
 //===========================================================================
--- a/common.c
+++ b/common.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // common.c -- misc functions used in client and server
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 #define NUM_SAFE_ARGVS  7
@@ -139,7 +122,7 @@
 {
 	int             i;
 	
-	if ( (((long)dest | count) & 3) == 0)
+	if ( (((intptr)dest | count) & 3) == 0)
 	{
 		count >>= 2;
 		fill = fill | (fill<<8) | (fill<<16) | (fill<<24);
@@ -155,7 +138,7 @@
 {
 	int             i;
 	
-	if (( ( (long)dest | (long)src | count) & 3) == 0 )
+	if (( ( (intptr)dest | (intptr)src | count) & 3) == 0 )
 	{
 		count>>=2;
 		for (i=0 ; i<count ; i++)
--- a/common.h
+++ b/common.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // comndef.h  -- general definitions
 
 #if !defined BYTE_DEFINED
--- a/console.c
+++ b/console.c
@@ -1,31 +1,12 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// console.c
-
 #ifdef NeXT
 #include <libc.h>
 #endif
 #ifndef _MSC_VER
-#include <unistd.h>
+//#include <unistd.h>
 #endif
-#include <fcntl.h>
+//#include <fcntl.h>
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 int 		con_linewidth;
@@ -359,7 +340,8 @@
     va_start(argptr, fmt);
     vsprintf(data, fmt, argptr);
     va_end(argptr);
-    fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666);
+    /*fd = open(file, OWRITE | O_WRONLY | O_CREAT | O_APPEND, 0666);*/
+    fd = open(file, OWRITE|OAPPEND);
     write(fd, data, strlen(data));
     close(fd);
 }
--- a/console.h
+++ b/console.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 //
 // console
 //
--- a/crc.c
+++ b/crc.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-/* crc.c */
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "crc.h"
 
@@ -78,4 +59,4 @@
 unsigned short CRC_Value(unsigned short crcvalue)
 {
 	return crcvalue ^ CRC_XOR_VALUE;
-}
\ No newline at end of file
+}
--- a/crc.h
+++ b/crc.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-/* crc.h */
-
 void CRC_Init(unsigned short *crcvalue);
 void CRC_ProcessByte(unsigned short *crcvalue, byte data);
 unsigned short CRC_Value(unsigned short crcvalue);
--- a/cvar.c
+++ b/cvar.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // cvar.c -- dynamic variable tracking
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 cvar_t	*cvar_vars;
--- a/cvar.h
+++ b/cvar.h
@@ -1,25 +1,4 @@
 /*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// cvar.h
-
-/*
 
 cvar_t variables are used to hold scalar or string variables that can be changed or displayed at the console or prog code as well as accessed directly
 in C code.
--- a/d_draw.s
+++ b/d_draw.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // d_draw.s
 // x86 assembly-language horizontal 8-bpp span-drawing code.
--- a/d_draw16.s
+++ b/d_draw16.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // d_draw16.s
 // x86 assembly-language horizontal 8-bpp span-drawing code, with 16-pixel
--- a/d_edge.c
+++ b/d_edge.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// d_edge.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "d_local.h"
 
--- a/d_fill.c
+++ b/d_fill.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_clear: clears a specified rectangle to the specified color
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 
@@ -58,7 +41,7 @@
 
 	dest = ((byte *)vid.buffer + ry*vid.rowbytes + rx);
 
-	if (((rwidth & 0x03) == 0) && (((long)dest & 0x03) == 0))
+	if (((rwidth & 0x03) == 0) && (((intptr)dest & 0x03) == 0))
 	{
 	// faster aligned dword clear
 		ldest = (unsigned *)dest;
--- a/d_iface.h
+++ b/d_iface.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_iface.h: interface header file for rasterization driver modules
 
 #define WARP_WIDTH		320
--- a/d_ifacea.h
+++ b/d_ifacea.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // d_ifacea.h
 //
--- a/d_init.c
+++ b/d_init.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_init.c: rasterization driver initialization
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "d_local.h"
 
--- a/d_local.h
+++ b/d_local.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_local.h:  private rasterization driver defs
 
 #include "r_shared.h"
--- a/d_modech.c
+++ b/d_modech.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_modech.c: called when mode has just changed
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "d_local.h"
 
--- a/d_part.c
+++ b/d_part.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_part.c: software driver module for drawing particles
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "d_local.h"
 
--- a/d_parta.s
+++ b/d_parta.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // d_parta.s
 // x86 assembly-language 8-bpp particle-drawing code.
--- a/d_polysa.s
+++ b/d_polysa.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // d_polysa.s
 // x86 assembly-language polygon model drawing code
@@ -1091,7 +1072,7 @@
 //						// one extra because of cache line pretouching
 //
 //	a_spans = (spanpackage_t *)
-//			(((long)&spans[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
+//			(((intptr)&spans[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
 	subl	$(SPAN_SIZE),%esp
 	movl	%esp,%eax
 	addl	$(CACHE_SIZE - 1),%eax
--- a/d_polyse.c
+++ b/d_polyse.c
@@ -1,25 +1,8 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_polyset.c: routines for drawing sets of polygons sharing the same
 // texture (used for Alias models)
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 #include "d_local.h"
@@ -129,7 +112,7 @@
 						// one extra because of cache line pretouching
 
 	a_spans = (spanpackage_t *)
-			(((long)&spans[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
+			(((intptr)&spans[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
 
 	if (r_affinetridesc.drawtype)
 	{
--- a/d_scan.c
+++ b/d_scan.c
@@ -1,26 +1,9 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_scan.c
 //
 // Portable C scan-level rasterization code, all pixel depths.
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 #include "d_local.h"
@@ -419,7 +402,7 @@
 	// we count on FP exceptions being turned off to avoid range problems
 		izi = (int)(zi * 0x8000 * 0x10000);
 
-		if ((long)pdest & 0x02)
+		if ((intptr)pdest & 0x02)
 		{
 			*pdest++ = (short)(izi >> 16);
 			izi += izistep;
--- a/d_scana.s
+++ b/d_scana.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // d_scana.s
 // x86 assembly-language turbulent texture mapping code
--- a/d_sky.c
+++ b/d_sky.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_sky.c
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 #include "d_local.h"
--- a/d_spr8.s
+++ b/d_spr8.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // d_spr8.s
 // x86 assembly-language horizontal 8-bpp transparent span-drawing code.
--- a/d_sprite.c
+++ b/d_sprite.c
@@ -1,25 +1,8 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_sprite.c: software top-level rasterization driver module for drawing
 // sprites
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "d_local.h"
 
--- a/d_surf.c
+++ b/d_surf.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_surf.c: rasterization driver surface heap manager
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "d_local.h"
 #include "r_local.h"
--- a/d_vars.c
+++ b/d_vars.c
@@ -1,26 +1,9 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // r_vars.c: global refresh variables
 
 #if	!id386
 
+#include <u.h>
+#include <libc.h>
 #include	"quakedef.h"
 
 // all global and static refresh variables are collected in a contiguous block
--- a/d_varsa.s
+++ b/d_varsa.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // d_varsa.s
 //
--- a/d_zpoint.c
+++ b/d_zpoint.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // d_zpoint.c: software driver module for drawing z-buffered points
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "d_local.h"
 
--- a/draw.c
+++ b/draw.c
@@ -1,26 +1,8 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 // draw.c -- this is the only file outside the refresh that touches the
 // vid buffer
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 typedef struct {
--- a/draw.h
+++ b/draw.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 // draw.h -- these are the only functions outside the refresh allowed
 // to touch the vid buffer
 
--- a/host.c
+++ b/host.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // host.c -- coordinates spawning and killing of local servers
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/host_cmd.c
+++ b/host_cmd.c
@@ -1,23 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 extern cvar_t	pausable;
@@ -936,6 +918,7 @@
 		if (Q_strcmp(host_client->name, newName) != 0)
 			Con_Printf ("%s renamed to %s\n", host_client->name, newName);
 	Q_strcpy (host_client->name, newName);
+	/* FIXME: amd64 */
 	host_client->edict->v.netname = host_client->name - pr_strings;
 	
 // send notification to all clients
@@ -1308,6 +1291,7 @@
 		memset (&ent->v, 0, progs->entityfields * 4);
 		ent->v.colormap = NUM_FOR_EDICT(ent);
 		ent->v.team = (host_client->colors & 15) + 1;
+		/* FIXME: amd64 */
 		ent->v.netname = host_client->name - pr_strings;
 
 		// copy spawn parms out of the client_t
--- a/input.h
+++ b/input.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // input.h -- external (non-keyboard) input devices
 
 void IN_Init (void);
--- a/keys.c
+++ b/keys.c
@@ -1,22 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 /*
--- a/keys.h
+++ b/keys.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 //
 // these are the key numbers that should be passed to Key_Event
 //
--- a/math.s
+++ b/math.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // math.s
 // x86 assembly-language math routines.
--- a/mathlib.c
+++ b/mathlib.c
@@ -1,25 +1,8 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // mathlib.c -- math primitives
 
-#include <math.h>
+#include <u.h>
+#include <libc.h>
+//#include <math.h>
 #include "quakedef.h"
 
 void Sys_Error (char *error, ...);
--- a/mathlib.h
+++ b/mathlib.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // mathlib.h
 
 typedef float vec_t;
--- a/menu.c
+++ b/menu.c
@@ -1,22 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 #ifdef _WIN32
--- /dev/null
+++ b/mkfile
@@ -1,0 +1,156 @@
+<$PLAN9/src/mkhdr
+
+# [words]
+CFLAGS= -D_DEFAULT_SOURCE -Dstricmp=strcasecmp -DX11 -O0 -ggdb -Wall -trigraphs
+LDFLAGS= -lX11 -lXext -lXxf86dga
+AFLAGS= $CFLAGS -DELF -x assembler-with-cpp
+
+BIN=.
+TARG=qk1
+
+OFILES=\
+	cl_demo.o\
+	cl_input.o\
+	cl_main.o\
+	cl_parse.o\
+	cl_tent.o\
+	chase.o\
+	cmd.o\
+	common.o\
+	console.o\
+	crc.o\
+	cvar.o\
+	draw.o\
+	d_edge.o\
+	d_fill.o\
+	d_init.o\
+	d_modech.o\
+	d_part.o\
+	d_polyse.o\
+	d_scan.o\
+	d_sky.o\
+	d_sprite.o\
+	d_surf.o\
+	d_vars.o\
+	d_zpoint.o\
+	host.o\
+	host_cmd.o\
+	keys.o\
+	menu.o\
+	mathlib.o\
+	model.o\
+	net_dgrm.o\
+	net_loop.o\
+	net_main.o\
+	net_vcr.o\
+	net_udp.o\
+	net_bsd.o\
+	nonintel.o\
+	pr_cmds.o\
+	pr_edict.o\
+	pr_exec.o\
+	r_aclip.o\
+	r_alias.o\
+	r_bsp.o\
+	r_light.o\
+	r_draw.o\
+	r_efrag.o\
+	r_edge.o\
+	r_misc.o\
+	r_main.o\
+	r_sky.o\
+	r_sprite.o\
+	r_surf.o\
+	r_part.o\
+	r_vars.o\
+	screen.o\
+	sbar.o\
+	sv_main.o\
+	sv_phys.o\
+	sv_move.o\
+	sv_user.o\
+	zone.o	\
+	view.o	\
+	wad.o\
+	world.o\
+	cd_linux.o\
+	sys_linux.o\
+	vid_x.o\
+	snd_dma.o\
+	snd_mem.o\
+	snd_mix.o\
+	snd_linux.o\
+	d_draw.o\
+	d_draw16.o\
+	d_parta.o\
+	d_polysa.o\
+	d_scana.o\
+	d_spr8.o\
+	d_varsa.o\
+	math.o\
+	r_aliasa.o\
+	r_drawa.o\
+	r_edgea.o\
+	r_varsa.o\
+	surf16.o\
+	surf8.o\
+	worlda.o\
+	r_aclipa.o\
+	snd_mixa.o\
+	#sys_dosa.o\
+
+HFILES=\
+	adivtab.h\
+	anorms.h\
+	asm_draw.h\
+	asm_i386.h\
+	block16.h\
+	bspfile.h\
+	cdaudio.h\
+	client.h\
+	cmd.h\
+	common.h\
+	console.h\
+	crc.h\
+	cvar.h\
+	d_ifacea.h\
+	d_iface.h\
+	d_local.h\
+	draw.h\
+	input.h\
+	keys.h\
+	mathlib.h\
+	modelgen.h\
+	model.h\
+	net_dgrm.h\
+	net.h\
+	net_loop.h\
+	net_udp.h\
+	net_vcr.h\
+	pr_comp.h\
+	progdefs.h\
+	progs.h\
+	protocol.h\
+	quakeasm.h\
+	quakedef.h\
+	render.h\
+	r_local.h\
+	r_shared.h\
+	sbar.h\
+	screen.h\
+	server.h\
+	sound.h\
+	spritegn.h\
+	sys.h\
+	vid.h\
+	view.h\
+	wad.h\
+	world.h\
+	zone.h\
+
+<$PLAN9/src/mkone
+
+AS=gcc
+
+%.$O:	%.s
+	$AS $AFLAGS -o $target -c $stem.s
--- a/model.c
+++ b/model.c
@@ -1,27 +1,10 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // models.c -- model loading and caching
 
 // models are the only shared resource between a client and server running
 // on the same machine.
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/model.h
+++ b/model.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 #ifndef __MODEL__
 #define __MODEL__
 
--- a/modelgen.h
+++ b/modelgen.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // modelgen.h: header file for model generation program
 //
@@ -29,10 +10,12 @@
 
 #ifdef INCLUDELIBS
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
+#include <u.h>
+#include <libc.h>
+//#include <stdlib.h>
+//#include <stdio.h>
+//#include <math.h>
+//#include <string.h>
 
 #include "cmdlib.h"
 #include "scriplib.h"
--- a/net.h
+++ b/net.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // net.h -- quake's interface to the networking layer
 
 struct qsockaddr
@@ -240,13 +221,13 @@
 
 #if !defined(_WIN32 ) && !defined (__linux__) && !defined (__sun__)
 #ifndef htonl
-extern unsigned long htonl (unsigned long hostlong);
+extern u32int htonl (u32int hostlong);
 #endif
 #ifndef htons
 extern unsigned short htons (unsigned short hostshort);
 #endif
 #ifndef ntohl
-extern unsigned long ntohl (unsigned long netlong);
+extern u32int ntohl (u32int netlong);
 #endif
 #ifndef ntohs
 extern unsigned short ntohs (unsigned short netshort);
--- a/net_bsd.c
+++ b/net_bsd.c
@@ -1,22 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 #include "net_loop.h"
--- a/net_dgrm.c
+++ b/net_dgrm.c
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // net_dgrm.c
 
 // This is enables a simple IP banning mechanism
@@ -29,6 +10,8 @@
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #else
+#include <u.h>
+#include <libc.h>
 #define AF_INET 		2	/* internet */
 struct in_addr
 {
@@ -36,7 +19,7 @@
 	{
 		struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b;
 		struct { unsigned short s_w1,s_w2; } S_un_w;
-		unsigned long S_addr;
+		u32int S_addr;
 	} S_un;
 };
 #define	s_addr	S_un.S_addr	/* can be used for most tcp & ip code */
@@ -48,7 +31,7 @@
     char			sin_zero[8];
 };
 char *inet_ntoa(struct in_addr in);
-unsigned long inet_addr(const char *cp);
+u32int inet_addr(const char *cp);
 #endif
 #endif	// BAN_TEST
 
@@ -99,8 +82,8 @@
 
 
 #ifdef BAN_TEST
-unsigned long banAddr = 0x00000000;
-unsigned long banMask = 0xffffffff;
+u32int banAddr = 0x00000000;
+u32int banMask = 0xffffffff;
 
 void NET_Ban_f (void)
 {
@@ -988,7 +971,7 @@
 	// check for a ban
 	if (clientaddr.sa_family == AF_INET)
 	{
-		unsigned long testAddr;
+		u32int testAddr;
 		testAddr = ((struct sockaddr_in *)&clientaddr)->sin_addr.s_addr;
 		if ((testAddr & banMask) == banAddr)
 		{
--- a/net_dgrm.h
+++ b/net_dgrm.h
@@ -1,25 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_dgrm.h
-
-
 int			Datagram_Init (void);
 void		Datagram_Listen (qboolean state);
 void		Datagram_SearchForHosts (qboolean xmit);
--- a/net_loop.c
+++ b/net_loop.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_loop.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "net_loop.h"
 
--- a/net_loop.h
+++ b/net_loop.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_loop.h
-
 int			Loop_Init (void);
 void		Loop_Listen (qboolean state);
 void		Loop_SearchForHosts (qboolean xmit);
--- a/net_main.c
+++ b/net_main.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_main.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "net_vcr.h"
 
@@ -451,7 +432,7 @@
 {
 	double	time;
 	int		op;
-	long	session;
+	intptr	session;
 } vcrConnect;
 
 qsocket_t *NET_CheckNewConnections (void)
@@ -473,7 +454,7 @@
 			{
 				vcrConnect.time = host_time;
 				vcrConnect.op = VCR_OP_CONNECT;
-				vcrConnect.session = (long)ret;
+				vcrConnect.session = (intptr)ret;
 				Sys_FileWrite (vcrFile, &vcrConnect, sizeof(vcrConnect));
 				Sys_FileWrite (vcrFile, ret->address, NET_NAMELEN);
 			}
@@ -530,7 +511,7 @@
 {
 	double	time;
 	int		op;
-	long	session;
+	intptr	session;
 	int		ret;
 	int		len;
 } vcrGetMessage;
@@ -580,7 +561,7 @@
 		{
 			vcrGetMessage.time = host_time;
 			vcrGetMessage.op = VCR_OP_GETMESSAGE;
-			vcrGetMessage.session = (long)sock;
+			vcrGetMessage.session = (intptr)sock;
 			vcrGetMessage.ret = ret;
 			vcrGetMessage.len = net_message.cursize;
 			Sys_FileWrite (vcrFile, &vcrGetMessage, 24);
@@ -593,7 +574,7 @@
 		{
 			vcrGetMessage.time = host_time;
 			vcrGetMessage.op = VCR_OP_GETMESSAGE;
-			vcrGetMessage.session = (long)sock;
+			vcrGetMessage.session = (intptr)sock;
 			vcrGetMessage.ret = ret;
 			Sys_FileWrite (vcrFile, &vcrGetMessage, 20);
 		}
@@ -618,7 +599,7 @@
 {
 	double	time;
 	int		op;
-	long	session;
+	intptr	session;
 	int		r;
 } vcrSendMessage;
 
@@ -644,7 +625,7 @@
 	{
 		vcrSendMessage.time = host_time;
 		vcrSendMessage.op = VCR_OP_SENDMESSAGE;
-		vcrSendMessage.session = (long)sock;
+		vcrSendMessage.session = (intptr)sock;
 		vcrSendMessage.r = r;
 		Sys_FileWrite (vcrFile, &vcrSendMessage, 20);
 	}
@@ -675,7 +656,7 @@
 	{
 		vcrSendMessage.time = host_time;
 		vcrSendMessage.op = VCR_OP_SENDMESSAGE;
-		vcrSendMessage.session = (long)sock;
+		vcrSendMessage.session = (intptr)sock;
 		vcrSendMessage.r = r;
 		Sys_FileWrite (vcrFile, &vcrSendMessage, 20);
 	}
@@ -710,7 +691,7 @@
 	{
 		vcrSendMessage.time = host_time;
 		vcrSendMessage.op = VCR_OP_CANSENDMESSAGE;
-		vcrSendMessage.session = (long)sock;
+		vcrSendMessage.session = (intptr)sock;
 		vcrSendMessage.r = r;
 		Sys_FileWrite (vcrFile, &vcrSendMessage, 20);
 	}
--- a/net_udp.c
+++ b/net_udp.c
@@ -1,29 +1,19 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
+/* FIXME */
+//#include <u.h>
+//#include <libc.h>
+#include <stdint.h>
+#include <string.h>
+#include <setjmp.h>
+typedef uintptr_t uintptr;
+typedef uint32_t u32int;
 
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_udp.c
-
 #include "quakedef.h"
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 #include <netdb.h>
 #include <sys/param.h>
 #include <sys/ioctl.h>
@@ -47,7 +37,7 @@
 static int net_broadcastsocket = 0;
 static struct qsockaddr broadcastaddr;
 
-static unsigned long myAddr;
+static u32int myAddr;
 
 #include "net_udp.h"
 
@@ -228,7 +218,7 @@
 
 int UDP_CheckNewConnections (void)
 {
-	unsigned long	available;
+	u32int	available;
 
 	if (net_acceptsocket == -1)
 		return -1;
--- a/net_udp.h
+++ b/net_udp.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_udp.h
-
 int  UDP_Init (void);
 void UDP_Shutdown (void);
 void UDP_Listen (qboolean state);
--- a/net_vcr.c
+++ b/net_vcr.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_vcr.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "net_vcr.h"
 
@@ -33,7 +14,7 @@
 {
 	double	time;
 	int		op;
-	long	session;
+	intptr	session;
 }	next;
 
 int VCR_Init (void)
@@ -79,7 +60,7 @@
 {
 	int	ret;
 	
-	if (host_time != next.time || next.op != VCR_OP_GETMESSAGE || next.session != *(long *)(&sock->driverdata))
+	if (host_time != next.time || next.op != VCR_OP_GETMESSAGE || next.session != *(s32int *)(&sock->driverdata))
 		Sys_Error ("VCR missmatch");
 
 	Sys_FileRead(vcrFile, &ret, sizeof(int));
@@ -102,7 +83,7 @@
 {
 	int	ret;
 
-	if (host_time != next.time || next.op != VCR_OP_SENDMESSAGE || next.session != *(long *)(&sock->driverdata))
+	if (host_time != next.time || next.op != VCR_OP_SENDMESSAGE || next.session != *(s32int *)(&sock->driverdata))
 		Sys_Error ("VCR missmatch");
 
 	Sys_FileRead(vcrFile, &ret, sizeof(int));
@@ -117,7 +98,7 @@
 {
 	qboolean	ret;
 
-	if (host_time != next.time || next.op != VCR_OP_CANSENDMESSAGE || next.session != *(long *)(&sock->driverdata))
+	if (host_time != next.time || next.op != VCR_OP_CANSENDMESSAGE || next.session != *(s32int *)(&sock->driverdata))
 		Sys_Error ("VCR missmatch");
 
 	Sys_FileRead(vcrFile, &ret, sizeof(int));
@@ -158,7 +139,7 @@
 	}
 
 	sock = NET_NewQSocket ();
-	*(long *)(&sock->driverdata) = next.session;
+	*(s32int *)(&sock->driverdata) = next.session;
 
 	Sys_FileRead (vcrFile, sock->address, NET_NAMELEN);
 	VCR_ReadNext ();
--- a/net_vcr.h
+++ b/net_vcr.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// net_vcr.h
-
 #define VCR_OP_CONNECT					1
 #define VCR_OP_GETMESSAGE				2
 #define VCR_OP_SENDMESSAGE				3
--- a/nonintel.c
+++ b/nonintel.c
@@ -1,26 +1,9 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // nonintel.c: code for non-Intel processors only
 //
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 #include "d_local.h"
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -1,23 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 #define	RETURN_EDICT(e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e))
--- a/pr_comp.h
+++ b/pr_comp.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 // this file is shared by quake and qcc
 
 typedef int	func_t;
--- a/pr_edict.c
+++ b/pr_edict.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // sv_edict.c -- entity dictionary
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 dprograms_t		*progs;
--- a/pr_exec.c
+++ b/pr_exec.c
@@ -1,23 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 
@@ -500,6 +482,7 @@
 					(a->vector[1] == b->vector[1]) &&
 					(a->vector[2] == b->vector[2]);
 		break;
+	/* FIXME: amd64 */
 	case OP_EQ_S:
 		c->_float = !strcmp(pr_strings+a->string,pr_strings+b->string);
 		break;
@@ -519,6 +502,7 @@
 					(a->vector[1] != b->vector[1]) ||
 					(a->vector[2] != b->vector[2]);
 		break;
+	/* FIXME: amd64 */
 	case OP_NE_S:
 		c->_float = strcmp(pr_strings+a->string,pr_strings+b->string);
 		break;
--- a/progdefs.h
+++ b/progdefs.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 #ifdef QUAKE2
 #include "progdefs.q2"
 #else
--- a/progs.h
+++ b/progs.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 #include "pr_comp.h"			// defs shared with qcc
 #include "progdefs.h"			// generated by program cdefs
 
@@ -103,6 +83,7 @@
 #define	G_EDICT(o) ((edict_t *)((byte *)sv.edicts+ *(int *)&pr_globals[o]))
 #define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
 #define	G_VECTOR(o) (&pr_globals[o])
+/* FIXME: amd64 */
 #define	G_STRING(o) (pr_strings + *(string_t *)&pr_globals[o])
 #define	G_FUNCTION(o) (*(func_t *)&pr_globals[o])
 
@@ -109,6 +90,7 @@
 #define	E_FLOAT(e,o) (((float*)&e->v)[o])
 #define	E_INT(e,o) (*(int *)&((float*)&e->v)[o])
 #define	E_VECTOR(e,o) (&((float*)&e->v)[o])
+/* FIXME: amd64 */
 #define	E_STRING(e,o) (pr_strings + *(string_t *)&((float*)&e->v)[o])
 
 extern	int		type_size[8];
--- a/protocol.h
+++ b/protocol.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // protocol.h -- communications protocols
 
 #define	PROTOCOL_VERSION	15
--- a/quakeasm.h
+++ b/quakeasm.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // quakeasm.h: general asm header file
 //
--- a/quakedef.h
+++ b/quakedef.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // quakedef.h -- primary header for client
 
 //#define	GLTEST			// experimental stuff
@@ -38,12 +19,12 @@
 #define	GAMENAME	"id1"
 #endif
 
-#include <math.h>
-#include <string.h>
-#include <stdarg.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <setjmp.h>
+//#include <math.h>
+//#include <string.h>
+//#include <stdarg.h>
+//#include <stdlib.h>
+//#include <setjmp.h>
 
 #if defined(_WIN32) && !defined(WINDED)
 
--- a/r_aclip.c
+++ b/r_aclip.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // r_aclip.c: clip routines for drawing Alias models directly to the screen
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 #include "d_local.h"
--- a/r_aclipa.s
+++ b/r_aclipa.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // r_aliasa.s
 // x86 assembly-language Alias model transform and project code.
--- a/r_alias.c
+++ b/r_alias.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // r_alias.c: routines for setting up to draw alias models
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 #include "d_local.h"	// FIXME: shouldn't be needed (is needed for patch
@@ -710,7 +693,7 @@
 
 // cache align
 	pfinalverts = (finalvert_t *)
-			(((long)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
+			(((intptr)&finalverts[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
 	pauxverts = &auxverts[0];
 
 	paliashdr = (aliashdr_t *)Mod_Extradata (currententity->model);
--- a/r_aliasa.s
+++ b/r_aliasa.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // r_aliasa.s
 // x86 assembly-language Alias model transform and project code.
--- a/r_bsp.c
+++ b/r_bsp.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// r_bsp.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/r_draw.c
+++ b/r_draw.c
@@ -1,25 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
-// r_draw.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 #include "d_local.h"	// FIXME: shouldn't need to include this
@@ -364,7 +344,7 @@
 {
 	edge_t		*pedge_t;
 
-	pedge_t = (edge_t *)((unsigned long)r_edges + r_pedge->cachededgeoffset);
+	pedge_t = (edge_t *)((uintptr)r_edges + r_pedge->cachededgeoffset);
 
 	if (!pedge_t->surfs[0])
 		pedge_t->surfs[0] = surface_p - surfaces;
@@ -451,9 +431,9 @@
 				}
 				else
 				{
-					if ((((unsigned long)edge_p - (unsigned long)r_edges) >
+					if ((((uintptr)edge_p - (uintptr)r_edges) >
 						 r_pedge->cachededgeoffset) &&
-						(((edge_t *)((unsigned long)r_edges +
+						(((edge_t *)((uintptr)r_edges +
 						 r_pedge->cachededgeoffset))->owner == r_pedge))
 					{
 						R_EmitCachedEdge ();
@@ -497,9 +477,9 @@
 				{
 				// it's cached if the cached edge is valid and is owned
 				// by this medge_t
-					if ((((unsigned long)edge_p - (unsigned long)r_edges) >
+					if ((((uintptr)edge_p - (uintptr)r_edges) >
 						 r_pedge->cachededgeoffset) &&
-						(((edge_t *)((unsigned long)r_edges +
+						(((edge_t *)((uintptr)r_edges +
 						 r_pedge->cachededgeoffset))->owner == r_pedge))
 					{
 						R_EmitCachedEdge ();
--- a/r_drawa.s
+++ b/r_drawa.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // r_drawa.s
 // x86 assembly-language edge clipping and emission code
--- a/r_edge.c
+++ b/r_edge.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// r_edge.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
@@ -668,7 +649,7 @@
 	surf_t	*s;
 
 	basespan_p = (espan_t *)
-			((long)(basespans + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
+			((intptr)(basespans + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
 	max_span_p = &basespan_p[MAXSPANS - r_refdef.vrect.width];
 
 	span_p = basespan_p;
--- a/r_edgea.s
+++ b/r_edgea.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // r_edgea.s
 // x86 assembly-language edge-processing code.
--- a/r_efrag.c
+++ b/r_efrag.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// r_efrag.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/r_light.c
+++ b/r_light.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// r_light.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/r_local.h
+++ b/r_local.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // r_local.h -- private refresh defs
 
 #ifndef GLQUAKE
@@ -313,4 +294,4 @@
 void R_SplitEntityOnNode2 (mnode_t *node);
 void R_MarkLights (dlight_t *light, int bit, mnode_t *node);
 
-#endif
\ No newline at end of file
+#endif
--- a/r_main.c
+++ b/r_main.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// r_main.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
@@ -231,8 +212,8 @@
 
 // TODO: collect 386-specific code in one place
 #if	id386
-	Sys_MakeCodeWriteable ((long)R_EdgeCodeStart,
-					     (long)R_EdgeCodeEnd - (long)R_EdgeCodeStart);
+	Sys_MakeCodeWriteable ((uintptr)R_EdgeCodeStart,
+					     (uintptr)R_EdgeCodeEnd - (uintptr)R_EdgeCodeStart);
 #endif	// id386
 
 	D_Init ();
@@ -465,15 +446,15 @@
 #if	id386
 	if (r_pixbytes == 1)
 	{
-		Sys_MakeCodeWriteable ((long)R_Surf8Start,
-						     (long)R_Surf8End - (long)R_Surf8Start);
+		Sys_MakeCodeWriteable ((uintptr)R_Surf8Start,
+						     (uintptr)R_Surf8End - (uintptr)R_Surf8Start);
 		colormap = vid.colormap;
 		R_Surf8Patch ();
 	}
 	else
 	{
-		Sys_MakeCodeWriteable ((long)R_Surf16Start,
-						     (long)R_Surf16End - (long)R_Surf16Start);
+		Sys_MakeCodeWriteable ((uintptr)R_Surf16Start,
+						     (uintptr)R_Surf16End - (uintptr)R_Surf16Start);
 		colormap = vid.colormap16;
 		R_Surf16Patch ();
 	}
@@ -887,13 +868,13 @@
 	else
 	{
 		r_edges =  (edge_t *)
-				(((long)&ledges[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
+				(((intptr)&ledges[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
 	}
 
 	if (r_surfsonstack)
 	{
 		surfaces =  (surf_t *)
-				(((long)&lsurfs[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
+				(((intptr)&lsurfs[0] + CACHE_SIZE - 1) & ~(CACHE_SIZE - 1));
 		surf_max = &surfaces[r_cnumsurfs];
 	// surface 0 doesn't really exist; it's just a dummy because index 0
 	// is used to indicate no edge attached to surface
@@ -1058,10 +1039,10 @@
 	if ( Hunk_LowMark() & 3 )
 		Sys_Error ("Hunk is missaligned");
 
-	if ( (long)(&dummy) & 3 )
+	if ( (intptr)(&dummy) & 3 )
 		Sys_Error ("Stack is missaligned");
 
-	if ( (long)(&r_warpbuffer) & 3 )
+	if ( (intptr)(&r_warpbuffer) & 3 )
 		Sys_Error ("Globals are missaligned");
 
 	R_RenderView_ ();
--- a/r_misc.c
+++ b/r_misc.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// r_misc.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/r_part.c
+++ b/r_part.c
@@ -1,23 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/r_shared.h
+++ b/r_shared.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 #ifndef GLQUAKE
 // r_shared.h: general refresh-related stuff shared between the refresh and the
 // driver
--- a/r_sky.c
+++ b/r_sky.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// r_sky.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 #include "d_local.h"
--- a/r_sprite.c
+++ b/r_sprite.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// r_sprite.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/r_surf.c
+++ b/r_surf.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // r_surf.c: surface-related refresh code
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
@@ -576,7 +559,7 @@
 		pbasesource += sourcetstep;
 		lightright += lightrightstep;
 		lightleft += lightleftstep;
-		prowdest = (unsigned short *)((long)prowdest + surfrowbytes);
+		prowdest = (unsigned short *)((intptr)prowdest + surfrowbytes);
 	}
 
 	prowdestbase = prowdest;
--- a/r_vars.c
+++ b/r_vars.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // r_vars.c: global refresh variables
 
+#include <u.h>
+#include <libc.h>
 #include	"quakedef.h"
 
 #if	!id386
--- a/r_varsa.s
+++ b/r_varsa.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // r_varsa.s
 //
--- a/render.h
+++ b/render.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 // refresh.h -- public interface to refresh functions
 
 #define	MAXCLIPPLANES	11
--- a/sbar.c
+++ b/sbar.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // sbar.c -- status bar code
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 
--- a/sbar.h
+++ b/sbar.h
@@ -1,23 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-
 // the status bar is only redrawn if something has changed, but if anything
 // does, the entire thing will be redrawn for the next vid.numpages frames.
 
--- a/screen.c
+++ b/screen.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // screen.c -- master for refresh, status bar, console, chat, notify, etc
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/screen.h
+++ b/screen.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// screen.h
-
 void SCR_Init (void);
 
 void SCR_UpdateScreen (void);
--- a/server.h
+++ b/server.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// server.h
-
 typedef struct
 {
 	int			maxclients;
--- a/snd_dma.c
+++ b/snd_dma.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // snd_dma.c -- main control for any streaming sound output device
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 #ifdef _WIN32
--- a/snd_linux.c
+++ b/snd_linux.c
@@ -1,32 +1,15 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
+#include <u.h>
+#include <libc.h>
+//#include <unistd.h>
+//#include <fcntl.h>
+//#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/shm.h>
-#include <sys/wait.h>
+//#include <sys/wait.h>
 #include <linux/soundcard.h>
-#include <stdio.h>
+//#include <stdio.h>
 #include "quakedef.h"
 
 int audio_fd;
@@ -49,7 +32,7 @@
 
 // open /dev/dsp, confirm capability to mmap, and get size of dma buffer
 
-    audio_fd = open("/dev/dsp", O_RDWR);
+    audio_fd = open("/dev/dsp", OREAD);
     if (audio_fd < 0)
 	{
 		perror("/dev/dsp");
--- a/snd_mem.c
+++ b/snd_mem.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // snd_mem.c: sound caching
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 int			cache_full_cycle;
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -1,30 +1,13 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // snd_mix.c -- portable code to mix sounds for snd_dma.c
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 #ifdef _WIN32
 #include "winquake.h"
 #else
-#define DWORD	unsigned long
+#define DWORD	u32int
 #endif
 
 #define	PAINTBUFFER_SIZE	512
--- a/snd_mixa.s
+++ b/snd_mixa.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // snd_mixa.s
 // x86 assembly-language sound code
--- a/sound.h
+++ b/sound.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // sound.h -- client sound i/o functions
 
 #ifndef __SOUND__
--- a/spritegn.h
+++ b/spritegn.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // spritegn.h: header file for sprite generation program
 //
--- a/surf16.s
+++ b/surf16.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // surf16.s
 // x86 assembly-language 16 bpp surface block drawing code.
--- a/surf8.s
+++ b/surf8.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // surf8.s
 // x86 assembly-language 8 bpp surface block drawing code.
--- a/sv_main.c
+++ b/sv_main.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // sv_main.c -- server main program
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 server_t		sv;
@@ -953,6 +936,7 @@
 		{
 			svent->baseline.colormap = 0;
 			svent->baseline.modelindex =
+				/* FIXME: amd64 */
 				SV_ModelIndex(pr_strings + svent->v.model);
 		}
 		
@@ -1157,6 +1141,7 @@
 	ent = EDICT_NUM(0);
 	memset (&ent->v, 0, progs->entityfields * 4);
 	ent->free = false;
+	/* FIXME FIXME FIXME: amd64 */
 	ent->v.model = sv.worldmodel->name - pr_strings;
 	ent->v.modelindex = 1;		// world model
 	ent->v.solid = SOLID_BSP;
--- a/sv_move.c
+++ b/sv_move.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // sv_move.c -- monster movement
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 #define	STEPSIZE	18
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// sv_phys.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 /*
--- a/sv_user.c
+++ b/sv_user.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // sv_user.c -- server code for moving users
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 edict_t	*sv_player;
--- a/sys.h
+++ b/sys.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // sys.h -- non-portable functions
 
 //
@@ -39,7 +20,7 @@
 //
 // memory protection
 //
-void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length);
+void Sys_MakeCodeWriteable (uintptr startaddr, uintptr length);
 
 //
 // system IO
--- a/sys_linux.c
+++ b/sys_linux.c
@@ -1,19 +1,21 @@
-#include <unistd.h>
+#include <u.h>
+#include <libc.h>
+//#include <unistd.h>
 #include <signal.h>
-#include <stdlib.h>
-#include <limits.h>
+//#include <stdlib.h>
+//#include <limits.h>
 #include <sys/time.h>
 #include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <stdio.h>
+//#include <unistd.h>
+//#include <fcntl.h>
+//#include <stdarg.h>
+//#include <stdio.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <sys/stat.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/wait.h>
+//#include <string.h>
+//#include <ctype.h>
+//#include <sys/wait.h>
 #include <sys/mman.h>
 #include <errno.h>
 
@@ -194,7 +196,8 @@
 	struct stat	fileinfo;
     
 	
-	h = open (path, O_RDONLY, 0666);
+	/*h = open (path, O_RDONLY, 0666);*/
+	h = open (path, OREAD);
 	*handle = h;
 	if (h == -1)
 		return -1;
@@ -211,8 +214,8 @@
 
 	umask (0);
 	
-	handle = open(path,O_RDWR | O_CREAT | O_TRUNC
-	, 0666);
+	/*handle = open(path,O_RDWR | O_CREAT | O_TRUNC, 0666);*/
+	handle = open(path, OREAD|OAPPEND);
 
 	if (handle == -1)
 		Sys_Error ("Error opening %s: %s", path,strerror(errno));
@@ -250,7 +253,8 @@
     vsprintf(data, fmt, argptr);
     va_end(argptr);
 //    fd = open(file, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, 0666);
-    fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666);
+    /*fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666);*/
+	fd = open(file, OREAD|OAPPEND);
     write(fd, data, strlen(data));
     close(fd);
 }
@@ -436,11 +440,11 @@
 Sys_MakeCodeWriteable
 ================
 */
-void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
+void Sys_MakeCodeWriteable (uintptr startaddr, uintptr length)
 {
 
 	int r;
-	unsigned long addr;
+	uintptr addr;
 	int psize = getpagesize();
 
 	addr = (startaddr & ~(psize-1)) - psize;
--- a/vid.h
+++ b/vid.h
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // vid.h -- video driver defs
 
 #define VID_CBITS	6
--- a/vid_x.c
+++ b/vid_x.c
@@ -1,35 +1,17 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // vid_x.c -- general x video driver
 
 #define _BSD
 
-
-#include <ctype.h>
+#include <u.h>
+#include <libc.h>
+//#include <ctype.h>
 #include <sys/time.h>
 #include <sys/types.h>
-#include <unistd.h>
+//#include <unistd.h>
 #include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
+//#include <stdlib.h>
+//#include <stdio.h>
+//#include <string.h>
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #include <X11/Xlib.h>
@@ -96,8 +78,8 @@
 
 static byte current_palette[768];
 
-static long X11_highhunkmark;
-static long X11_buffersize;
+static s32int X11_highhunkmark;
+static s32int X11_buffersize;
 
 int vid_surfcachesize;
 void *vid_surfcache;
@@ -107,12 +89,12 @@
 void VID_MenuKey (int key);
 
 typedef unsigned short PIXEL16;
-typedef unsigned long PIXEL24;
+typedef u32int PIXEL24;
 static PIXEL16 st2d_8to16table[256];
 static PIXEL24 st2d_8to24table[256];
 static int shiftmask_fl=0;
-static long r_shift,g_shift,b_shift;
-static unsigned long r_mask,g_mask,b_mask;
+static s32int r_shift,g_shift,b_shift;
+static u32int r_mask,g_mask,b_mask;
 
 void shiftmask_init()
 {
@@ -419,8 +401,8 @@
 		x_shminfo[frm].shmaddr =
 			(void *) shmat(x_shminfo[frm].shmid, 0, 0);
 
-		printf("VID: shared memory id=%d, addr=0x%lx\n", x_shminfo[frm].shmid,
-			(long) x_shminfo[frm].shmaddr);
+		printf("VID: shared memory id=%d, addr=0x%p\n", x_shminfo[frm].shmid,
+			x_shminfo[frm].shmaddr);
 
 		x_framebuffer[frm]->data = x_shminfo[frm].shmaddr;
 
--- a/view.c
+++ b/view.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // view.c -- player eye positioning
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 #include "r_local.h"
 
--- a/view.h
+++ b/view.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// view.h
-
 extern	cvar_t		v_gamma;
 
 extern	byte		gammatable[256];	// palette is sent through this
--- a/wad.c
+++ b/wad.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// wad.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 int			wad_numlumps;
--- a/wad.h
+++ b/wad.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// wad.h
-
 //===============
 //   TYPES
 //===============
--- a/world.c
+++ b/world.c
@@ -1,24 +1,7 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 // world.c -- world query functions
 
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 /*
--- a/world.h
+++ b/world.h
@@ -1,24 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// world.h
-
 typedef struct
 {
 	vec3_t	normal;
@@ -63,6 +42,8 @@
 // the non-true version remaps the water current contents to content_water
 
 edict_t	*SV_TestEntityPosition (edict_t *ent);
+qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f,
+vec3_t p1, vec3_t p2, trace_t *trace);
 
 trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, edict_t *passedict);
 // mins and maxs are reletive
--- a/worlda.s
+++ b/worlda.s
@@ -1,22 +1,3 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
 //
 // worlda.s
 // x86 assembly-language server testing stuff
--- a/zone.c
+++ b/zone.c
@@ -1,24 +1,5 @@
-/*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-// Z_zone.c
-
+#include <u.h>
+#include <libc.h>
 #include "quakedef.h"
 
 #define	DYNAMIC_SIZE	0xc000
--- a/zone.h
+++ b/zone.h
@@ -1,23 +1,4 @@
 /*
-Copyright (C) 1996-1997 Id Software, Inc.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
-
-See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-*/
-/*
  memory allocation