aboutsummaryrefslogtreecommitdiff
path: root/games/quake2lnx/files
diff options
context:
space:
mode:
authorMax Khon <fjoe@FreeBSD.org>2003-06-18 09:21:21 +0000
committerMax Khon <fjoe@FreeBSD.org>2003-06-18 09:21:21 +0000
commit5dfaba8ea1e84f0b981ac1ea14dbf2ebcf6c4cff (patch)
tree94263949a16f153327d82eb0e15dc57c28ad5254 /games/quake2lnx/files
parenta1ac4c1a825f6f9b9f572312a9734934303a0c7f (diff)
downloadports-5dfaba8ea1e84f0b981ac1ea14dbf2ebcf6c4cff.tar.gz
ports-5dfaba8ea1e84f0b981ac1ea14dbf2ebcf6c4cff.zip
Notes
Diffstat (limited to 'games/quake2lnx/files')
-rw-r--r--games/quake2lnx/files/patch-Makefile428
-rw-r--r--games/quake2lnx/files/patch-src::client::cl_fx.c11
-rw-r--r--games/quake2lnx/files/patch-src::client::cl_fxmax.c43
-rw-r--r--games/quake2lnx/files/patch-src::client::cl_newfx.c85
-rw-r--r--games/quake2lnx/files/patch-src::client::cl_view.c12
-rw-r--r--games/quake2lnx/files/patch-src::client::snd_mix.c20
-rw-r--r--games/quake2lnx/files/patch-src::linux::gl_glx.c183
-rw-r--r--games/quake2lnx/files/patch-src::linux::rw_aa.c30
-rw-r--r--games/quake2lnx/files/patch-src::linux::rw_in_aa.c19
-rw-r--r--games/quake2lnx/files/patch-src::linux::rw_in_svgalib.c273
-rw-r--r--games/quake2lnx/files/patch-src::linux::rw_sdl.c14
-rw-r--r--games/quake2lnx/files/patch-src::linux::rw_svgalib.c12
-rw-r--r--games/quake2lnx/files/patch-src::linux::rw_x11.c171
-rw-r--r--games/quake2lnx/files/patch-src::ref_candygl::gl_rmisc.c12
14 files changed, 1313 insertions, 0 deletions
diff --git a/games/quake2lnx/files/patch-Makefile b/games/quake2lnx/files/patch-Makefile
new file mode 100644
index 000000000000..d7d30abd19f8
--- /dev/null
+++ b/games/quake2lnx/files/patch-Makefile
@@ -0,0 +1,428 @@
+--- Makefile.orig Thu Oct 10 01:08:21 2002
++++ Makefile Tue Jun 17 22:23:11 2003
+@@ -12,28 +12,28 @@
+ # (Note: not all options are available for all platforms).
+ # quake2 (uses OSS for sound, cdrom ioctls for cd audio) is automatically built.
+ # game$(ARCH).so is automatically built.
+-BUILD_SDLQUAKE2=YES # sdlquake2 executable (uses SDL for cdrom and sound)
+-BUILD_SVGA=NO # SVGAlib driver. Seems to work fine.
+-BUILD_X11=YES # X11 software driver. Works somewhat ok.
+-BUILD_GLX=YES # X11 GLX driver. Works somewhat ok.
+-BUILD_FXGL=NO # FXMesa driver. Not tested. (used only for V1 and V2).
+-BUILD_SDL=YES # SDL software driver. Works fine for some people.
+-BUILD_SDLGL=YES # SDL OpenGL driver. Works fine for some people.
+-BUILD_CTFDLL=YES # game$(ARCH).so for ctf
+-BUILD_XATRIX=NO # game$(ARCH).so for xatrix (see README.r for details)
+-BUILD_ROGUE=NO # game$(ARCH).so for rogue (see README.r for details)
+-BUILD_JOYSTICK=YES # build in joystick support
+-BUILD_ARTS=NO # build in support for libaRts sound.
+-BUILD_DEDICATED=NO # build a dedicated quake2 server
+-BUILD_AA=YES # build the ascii soft renderer.
+-BUILD_QMAX=YES # build the fancier GL graphics
++#BUILD_SDLQUAKE2=YES # sdlquake2 executable (uses SDL for cdrom and sound)
++#BUILD_SVGA=NO # SVGAlib driver. Seems to work fine.
++#BUILD_X11=YES # X11 software driver. Works somewhat ok.
++#BUILD_GLX=YES # X11 GLX driver. Works somewhat ok.
++#BUILD_FXGL=NO # FXMesa driver. Not tested. (used only for V1 and V2).
++#BUILD_SDL=YES # SDL software driver. Works fine for some people.
++#BUILD_SDLGL=YES # SDL OpenGL driver. Works fine for some people.
++#BUILD_CTFDLL=YES # game$(ARCH).so for ctf
++#BUILD_XATRIX=NO # game$(ARCH).so for xatrix (see README.r for details)
++#BUILD_ROGUE=NO # game$(ARCH).so for rogue (see README.r for details)
++#BUILD_JOYSTICK=YES # build in joystick support
++#BUILD_ARTS=NO # build in support for libaRts sound.
++#BUILD_DEDICATED=NO # build a dedicated quake2 server
++#BUILD_AA=YES # build the ascii soft renderer.
++#BUILD_QMAX=YES # build the fancier GL graphics
+
+ STATICSDL=NO
+-SDLDIR=/usr/local/lib
++SDLDIR=${PREFIX}/lib
+
+ # Other compile-time options:
+ # Compile with IPv6 (protocol independent API). Tested on FreeBSD
+-HAVE_IPV6=NO
++#HAVE_IPV6=NO
+
+ # (hopefully) end of configurable options
+
+@@ -50,47 +50,11 @@
+ endif
+ endif
+
++CC?=gcc
+
+-# this nice line comes from the linux kernel makefile
+-ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/alpha/axp/)
++RELEASE_CFLAGS= $(BASE_CFLAGS) $(OPTIMIZED_CFLAGS)
+
+-ifneq ($(ARCH),i386)
+-ifneq ($(ARCH),axp)
+-ifneq ($(ARCH),ppc)
+-ifneq ($(ARCH),sparc)
+-$(error arch $(ARCH) is currently not supported)
+-endif
+-endif
+-endif
+-endif
+-
+-CC=gcc
+-
+-ifeq ($(ARCH),axp)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
+- -fomit-frame-pointer -fexpensive-optimizations
+-endif
+-
+-ifeq ($(ARCH),ppc)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
+- -fomit-frame-pointer -fexpensive-optimizations
+-endif
+-
+-ifeq ($(ARCH),sparc)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
+- -fomit-frame-pointer -fexpensive-optimizations
+-endif
+-
+-ifeq ($(ARCH),i386)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -malign-loops=2 \
+- -malign-jumps=2 -malign-functions=2 -g
+-# compiler bugs with gcc 2.96 and 3.0.1 can cause bad builds with heavy opts.
+-#RELEASE_CFLAGS=$(BASE_CFLAGS) -O6 -m486 -ffast-math -funroll-loops \
+-# -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
+-# -malign-jumps=2 -malign-functions=2
+-endif
+-
+-VERSION=3.21+rCVS
++VERSION=3.21+r0.15
+
+ MOUNT_DIR=src
+
+@@ -108,7 +72,7 @@
+ ROGUE_DIR=$(MOUNT_DIR)/rogue
+ NULL_DIR=$(MOUNT_DIR)/null
+
+-BASE_CFLAGS=-Wall -pipe -Dstricmp=strcasecmp
++BASE_CFLAGS=-Wall -pipe -Dstricmp=strcasecmp $(CFLAGS)
+ ifeq ($(HAVE_IPV6),YES)
+ BASE_CFLAGS+= -DHAVE_IPV6 -DHAVE_SIN6_LEN
+ NET_UDP=net_udp6
+@@ -127,7 +91,13 @@
+ BASE_CFLAGS+=$(shell artsc-config --cflags)
+ endif
+
+-ifneq ($(ARCH),i386)
++ifeq ($(ARCH),i386)
++ifneq ($(strip $(NO_X86_ASM)),YES)
++ BASE_CFLAGS+=-Did386
++else
++ BASE_CFLAGS+=-DC_ONLY
++endif
++else
+ BASE_CFLAGS+=-DC_ONLY
+ endif
+
+@@ -144,20 +114,22 @@
+ LDFLAGS+=$(shell artsc-config --libs)
+ endif
+
+-SVGALDFLAGS=-lvga
++SVGALDFLAGS=-L${PREFIX}/lib -lvga
++SVGACFLAGS=-I${PREFIX}/include
+
+-XCFLAGS=-I/usr/X11R6/include
+-XLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm
+-AALDFLAGS=-lm -laa
++XCFLAGS=-I${X11BASE}/include
++XLDFLAGS=-L${X11BASE}/lib -lX11 -lXext -lXxf86dga -lXxf86vm
++AACFLAGS=-I${PREFIX}/include
++AALDFLAGS=-L${PREFIX}/lib -laa
+
+-SDLCFLAGS=$(shell sdl-config --cflags)
++SDLCFLAGS=$(shell sdl11-config --cflags)
+ ifeq ($(strip $(STATICSDL)),YES)
+- SDLLDFLAGS += -L/usr/X11R6/lib -Wl,-Bstatic $(SDLDIR)/libSDL.a
++ SDLLDFLAGS += -L${X11BASE}/lib -Wl,-Bstatic $(SDLDIR)/libSDL.a
+ SDLLDFLAGS += $(SDLDIR)/libesd.a $(SDLDIR)/libartsc.a -Wl,-Bdynamic
+ SDLLDFLAGS += -lpthread -lX11 -lXext -lXxf86dga -lXxf86vm -lXv \
+ -lXinerama
+ else
+- SDLLDFLAGS=$(shell sdl-config --libs)
++ SDLLDFLAGS=$(shell sdl11-config --libs)
+ endif
+
+ ifeq ($(strip $(BUILD_JOYSTICK)),YES)
+@@ -168,15 +140,16 @@
+ FXGLLDFLAGS=-L/usr/local/glide/lib -L/usr/X11/lib -L/usr/local/lib \
+ -L/usr/X11R6/lib -lX11 -lXext -lGL -lvga
+
+-GLXCFLAGS=-I/usr/X11R6/include -DOPENGL
+-GLXLDFLAGS=-L/usr/X11R6/lib -lX11 -lXext -lXxf86dga -lXxf86vm
++GLXCFLAGS=-I${X11BASE}/include -DOPENGL
++GLXLDFLAGS=-L${X11BASE}/lib -lX11 -lXext -lXxf86dga -lXxf86vm
+
+ SDLGLCFLAGS=$(SDLCFLAGS) -DOPENGL
+ SDLGLLDFLAGS=$(SDLLDFLAGS)
+
+ ifeq ($(strip $(BUILD_QMAX)),YES)
+-GLXLDFLAGS+=-ljpeg
+-SDLGLLDFLAGS+=-ljpeg
++GLXCFLAGS+=-I${PREFIX}/include
++GLXLDFLAGS+=-L${PREFIX}/lib -ljpeg
++SDLGLLDFLAGS+=-L${PREFIX}/lib -ljpeg
+ REF_GL_DIR = $(MOUNT_DIR)/ref_candygl
+ CL_FX = cl_fxmax.c
+ else
+@@ -192,7 +165,7 @@
+ DO_DED_CC=$(CC) $(CFLAGS) -DDEDICATED_ONLY -o $@ -c $<
+ DO_DED_DEBUG_CC=$(CC) $(DEBUG_CFLAGS) -DDEDICATED_ONLY -o $@ -c $<
+ DO_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
+-DO_GL_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) $(GLCFLAGS) -o $@ -c $<
++DO_GL_SHLIB_CC=$(CC) $(CFLAGS) $(SHLIBCFLAGS) $(GLCFLAGS) $(GLXCFLAGS) -o $@ -c $<
+ DO_AS=$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+ DO_SHLIB_AS=$(CC) $(CFLAGS) $(SHLIBCFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
+
+@@ -202,10 +175,42 @@
+
+ .PHONY : targets build_debug build_release clean clean-debug clean-release clean2
+
+-TARGETS=$(BUILDDIR)/quake2 $(BUILDDIR)/game$(ARCH).$(SHLIBEXT)
++ifeq ($(strip $(BUILD_CLIENT)),YES)
++ TARGETS += $(BUILDDIR)/quake2
++endif
++
++ifeq ($(strip $(BUILD_SDLQUAKE2)),YES)
++ TARGETS += $(BUILDDIR)/sdlquake2
++endif
++
++ifeq ($(strip $(BUILD_SVGA)),YES)
++ TARGETS += $(BUILDDIR)/ref_soft.$(SHLIBEXT)
++endif
++
++ifeq ($(strip $(BUILD_X11)),YES)
++ TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT)
++endif
++
++ifeq ($(strip $(BUILD_GLX)),YES)
++ TARGETS += $(BUILDDIR)/ref_glx.$(SHLIBEXT)
++endif
++
++ifeq ($(strip $(BUILD_SDL)),YES)
++ TARGETS += $(BUILDDIR)/ref_softsdl.$(SHLIBEXT)
++endif
++
++ifeq ($(strip $(BUILD_SDLGL)),YES)
++ TARGETS += $(BUILDDIR)/ref_sdlgl.$(SHLIBEXT)
++endif
++
+ ifeq ($(strip $(BUILD_DEDICATED)),YES)
+ TARGETS += $(BUILDDIR)/q2ded
+ endif
++
++ifeq ($(strip $(BUILD_GAME)),YES)
++ TARGETS += $(BUILDDIR)/game$(ARCH).$(SHLIBEXT)
++endif
++
+ ifeq ($(strip $(BUILD_CTFDLL)),YES)
+ TARGETS += $(BUILDDIR)/ctf/game$(ARCH).$(SHLIBEXT)
+ endif
+@@ -218,126 +223,6 @@
+ TARGETS += $(BUILDDIR)/rogue/game$(ARCH).$(SHLIBEXT)
+ endif
+
+-ifeq ($(ARCH),axp)
+- ifeq ($(strip $(BUILD_SDLQUAKE2)),YES)
+- $(warning Warning: SDLQuake2 not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_SVGA)),YES)
+- $(warning Warning: SVGAlib support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_X11)),YES)
+- $(warning Warning: X11 support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_GLX)),YES)
+- $(warning Warning: support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_FXGL)),YES)
+- $(warning Warning: FXGL support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_SDL)),YES)
+- $(warning Warning: SDL support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_SDLGL)),YES)
+- $(warning Warning: SDLGL support not supported for $(ARCH))
+- endif
+-endif # ARCH axp
+-
+-ifeq ($(ARCH),ppc)
+- ifeq ($(strip $(BUILD_SDLQUAKE2)),YES)
+- TARGETS += $(BUILDDIR)/sdlquake2
+- endif
+-
+- ifeq ($(strip $(BUILD_SVGA)),YES)
+- $(warning Warning: SVGAlib support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_X11)),YES)
+- TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_GLX)),YES)
+- TARGETS += $(BUILDDIR)/ref_glx.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_FXGL)),YES)
+- $(warning Warning: FXGL support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_SDL)),YES)
+- TARGETS += $(BUILDDIR)/ref_softsdl.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_SDLGL)),YES)
+- TARGETS += $(BUILDDIR)/ref_sdlgl.$(SHLIBEXT)
+- endif
+-endif # ARCH ppc
+-
+-ifeq ($(ARCH),sparc)
+- ifeq ($(strip $(BUILD_SDLQUAKE2)),YES)
+- TARGETS += $(BUILDDIR)/sdlquake2
+- endif
+-
+- ifeq ($(strip $(BUILD_SVGA)),YES)
+- $(warning Warning: SVGAlib support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_X11)),YES)
+- TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_GLX)),YES)
+- $(warning Warning: GLX support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_FXGL)),YES)
+- $(warning Warning: FXGL support not supported for $(ARCH))
+- endif
+-
+- ifeq ($(strip $(BUILD_SDL)),YES)
+- TARGETS += $(BUILDDIR)/ref_softsdl.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_SDLGL)),YES)
+- $(warning Warning: SDLGL support not supported for $(ARCH))
+- endif
+-endif # ARCH sparc
+-
+-ifeq ($(ARCH),i386)
+- ifeq ($(strip $(BUILD_SDLQUAKE2)),YES)
+- TARGETS += $(BUILDDIR)/sdlquake2
+- endif
+-
+- ifeq ($(strip $(BUILD_SVGA)),YES)
+- TARGETS += $(BUILDDIR)/ref_soft.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_X11)),YES)
+- TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_GLX)),YES)
+- TARGETS += $(BUILDDIR)/ref_glx.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_FXGL)),YES)
+- TARGETS += $(BUILDDIR)/ref_gl.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_SDL)),YES)
+- TARGETS += $(BUILDDIR)/ref_softsdl.$(SHLIBEXT)
+- endif
+-
+- ifeq ($(strip $(BUILD_SDLGL)),YES)
+- TARGETS += $(BUILDDIR)/ref_sdlgl.$(SHLIBEXT)
+- endif
+-endif # ARCH i386
+-
+ ifeq ($(strip $(BUILD_AA)),YES)
+ TARGETS += $(BUILDDIR)/ref_softaa.$(SHLIBEXT)
+ endif
+@@ -437,10 +322,11 @@
+ $(BUILDDIR)/client/snd_sdl.o
+
+ ifeq ($(ARCH),i386)
++ifneq ($(strip $(NO_X86_ASM)),YES)
+ QUAKE2_AS_OBJS = \
+ $(BUILDDIR)/client/snd_mixa.o
+ else
+-QUAKE2_AS_OBJS = #blank
++endif
+ endif
+
+ $(BUILDDIR)/quake2 : $(QUAKE2_OBJS) $(QUAKE2_LNX_OBJS) $(QUAKE2_AS_OBJS)
+@@ -626,7 +512,7 @@
+ $(BUILDDIR)/ded/q_shlinux.o \
+ $(BUILDDIR)/ded/sys_linux.o \
+ $(BUILDDIR)/ded/glob.o \
+- $(BUILDDIR)/ded/net_udp.o \
++ $(BUILDDIR)/ded/$(NET_UDP).o \
+ $(BUILDDIR)/ded/q_shared.o \
+ $(BUILDDIR)/ded/pmove.o \
+ $(BUILDDIR)/ded/cl_null.o \
+@@ -701,6 +587,9 @@
+ $(BUILDDIR)/ded/net_udp.o : $(LINUX_DIR)/net_udp.c
+ $(DO_DED_CC)
+
++$(BUILDDIR)/ded/net_udp6.o : $(LINUX_DIR)/net_udp6.c
++ $(DO_DED_CC)
++
+ $(BUILDDIR)/ded/cd_null.o : $(NULL_DIR)/cd_null.c
+ $(DO_DED_CC)
+
+@@ -1525,6 +1414,7 @@
+ $(BUILDDIR)/ref_soft/glob.o
+
+ ifeq ($(ARCH),i386)
++ifneq ($(strip $(NO_X86_ASM)),YES)
+ REF_SOFT_OBJS += \
+ $(BUILDDIR)/ref_soft/r_aclipa.o \
+ $(BUILDDIR)/ref_soft/r_draw16.o \
+@@ -1538,6 +1428,7 @@
+ $(BUILDDIR)/ref_soft/r_varsa.o \
+ $(BUILDDIR)/ref_soft/sys_dosa.o
+ endif
++endif
+
+ REF_SOFT_SVGA_OBJS = \
+ $(BUILDDIR)/ref_soft/rw_svgalib.o \
+@@ -1667,10 +1558,10 @@
+ $(DO_SHLIB_AS)
+
+ $(BUILDDIR)/ref_soft/rw_svgalib.o : $(LINUX_DIR)/rw_svgalib.c
+- $(DO_SHLIB_CC)
++ $(DO_SHLIB_CC) $(SVGACFLAGS)
+
+ $(BUILDDIR)/ref_soft/rw_in_svgalib.o : $(LINUX_DIR)/rw_in_svgalib.c
+- $(DO_SHLIB_CC)
++ $(DO_SHLIB_CC) $(SVGACFLAGS)
+
+ $(BUILDDIR)/ref_soft/rw_x11.o : $(LINUX_DIR)/rw_x11.c
+ $(DO_SHLIB_CC) $(XCFLAGS)
+@@ -1679,10 +1570,10 @@
+ $(DO_SHLIB_CC) $(SDLCFLAGS)
+
+ $(BUILDDIR)/ref_soft/rw_aa.o : $(LINUX_DIR)/rw_aa.c
+- $(DO_SHLIB_CC)
++ $(DO_SHLIB_CC) $(AACFLAGS)
+
+ $(BUILDDIR)/ref_soft/rw_in_aa.o : $(LINUX_DIR)/rw_in_aa.c
+- $(DO_SHLIB_CC)
++ $(DO_SHLIB_CC) $(AACFLAGS)
+
+ #############################################################################
+ # REF_GL
diff --git a/games/quake2lnx/files/patch-src::client::cl_fx.c b/games/quake2lnx/files/patch-src::client::cl_fx.c
new file mode 100644
index 000000000000..a1da485a1ecc
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::client::cl_fx.c
@@ -0,0 +1,11 @@
+--- src/client/cl_fx.c.orig Thu Jun 12 14:24:20 2003
++++ src/client/cl_fx.c Thu Jun 12 14:24:42 2003
+@@ -1507,7 +1507,7 @@
+ */
+ #ifdef QMAX
+ void CL_FlagTrail (vec3_t start, vec3_t end, boolean isred)
+-#else)
++#else
+ void CL_FlagTrail (vec3_t start, vec3_t end, float color)
+ #endif
+ {
diff --git a/games/quake2lnx/files/patch-src::client::cl_fxmax.c b/games/quake2lnx/files/patch-src::client::cl_fxmax.c
new file mode 100644
index 000000000000..574c30595f03
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::client::cl_fxmax.c
@@ -0,0 +1,43 @@
+--- src/client/cl_fxmax.c.orig Thu Jun 12 14:32:17 2003
++++ src/client/cl_fxmax.c Thu Jun 12 14:34:33 2003
+@@ -1733,7 +1733,6 @@
+
+ void CL_Disruptor_Explosion_Particle (vec3_t org, float size)
+ {
+- int i;
+ float alphastart = 1,
+ alphadecel = -5;
+ cparticle_t *p;
+@@ -1817,7 +1816,7 @@
+ {
+ float length;
+ int i;
+- vec3_t len, ang;
++ vec3_t len;
+
+ VectorSubtract(p->angle, org, len);
+ {
+@@ -2194,7 +2193,6 @@
+
+ void pSparksThink (cparticle_t *p, vec3_t org, vec3_t angle, float *alpha, float *size, int *image, float *time)
+ {
+- vec3_t dir;
+ int i;
+
+ //setting up angle for sparks
+@@ -2523,7 +2521,6 @@
+ #define pBlasterMaxSize 5
+ void pBlasterThink (cparticle_t *p, vec3_t org, vec3_t angle, float *alpha, float *size, int *image, float *time)
+ {
+- int i;
+ vec3_t len;
+ VectorSubtract(p->angle, org, len);
+
+@@ -3038,7 +3035,6 @@
+ vec3_t vec, point;
+ int i;
+ float len;
+- float dec;
+ vec3_t right, up;
+ qboolean colored = (cl_railtype->value!=1);
+
diff --git a/games/quake2lnx/files/patch-src::client::cl_newfx.c b/games/quake2lnx/files/patch-src::client::cl_newfx.c
new file mode 100644
index 000000000000..d5628a3837c1
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::client::cl_newfx.c
@@ -0,0 +1,85 @@
+--- src/client/cl_newfx.c.orig Thu Jun 12 14:36:30 2003
++++ src/client/cl_newfx.c Thu Jun 12 14:58:25 2003
+@@ -143,7 +143,9 @@
+ vec3_t vec;
+ float len;
+ // int j;
++#ifndef QMAX
+ cparticle_t *p;
++#endif
+ float dec;
+ vec3_t right, up;
+ // int i;
+@@ -266,11 +268,12 @@
+ vec3_t vec;
+ #ifdef QMAX
+ vec3_t color = { color8red(color8), color8green(color8), color8blue(color8)};
++#else
++ int j;
++ cparticle_t *p;
+ #endif
+
+ float len;
+- int j;
+- cparticle_t *p;
+
+ VectorCopy (start, move);
+ VectorSubtract (end, start, vec);
+@@ -448,8 +451,11 @@
+ vec3_t move;
+ vec3_t vec;
+ float len;
+- int i, j;
++ int i;
++#ifndef QMAX
++ int j;
+ cparticle_t *p;
++#endif
+ float dec;
+
+ VectorCopy (start, move);
+@@ -1062,7 +1068,9 @@
+ vec3_t dir;
+ int i;
+ cparticle_t *p;
++#ifndef QMAX
+ static int colortable[4] = {2*8,13*8,21*8,18*8};
++#endif
+ float ratio;
+
+ ratio = 1.0 - (((float)self->endtime - (float)cl.time)/2100.0);
+@@ -1099,7 +1107,9 @@
+ vec3_t dir;
+ int i;
+ cparticle_t *p;
++#ifndef QMAX
+ static int colortable[4] = {110, 112, 114, 116};
++#endif
+ float ratio;
+
+ ratio = 1.0 - (((float)self->endtime - (float)cl.time)/1000.0);
+@@ -1133,7 +1143,9 @@
+
+ void CL_WidowSplash (vec3_t org)
+ {
++#ifndef QMAX
+ static int colortable[4] = {2*8,13*8,21*8,18*8};
++#endif
+ int i;
+ cparticle_t *p;
+ vec3_t dir;
+@@ -1260,10 +1272,12 @@
+ */
+ void CL_ColorExplosionParticles (vec3_t org, int color8, int run)
+ {
+- int i, j;
+- cparticle_t *p;
++ int i;
+ #ifdef QMAX
+ vec3_t color = { color8red(color8), color8green(color8), color8blue(color8)};
++#else
++ int j;
++ cparticle_t *p;
+ #endif
+ for (i=0 ; i<128 ; i++)
+ {
diff --git a/games/quake2lnx/files/patch-src::client::cl_view.c b/games/quake2lnx/files/patch-src::client::cl_view.c
new file mode 100644
index 000000000000..937fff2d4cef
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::client::cl_view.c
@@ -0,0 +1,12 @@
+--- src/client/cl_view.c.orig Thu Jun 12 14:25:46 2003
++++ src/client/cl_view.c Thu Jun 12 14:26:07 2003
+@@ -470,7 +470,9 @@
+ */
+ void SCR_DrawCrosshair (void)
+ {
++#ifdef QMAX
+ float scale;
++#endif
+ if (!crosshair->value)
+ return;
+
diff --git a/games/quake2lnx/files/patch-src::client::snd_mix.c b/games/quake2lnx/files/patch-src::client::snd_mix.c
new file mode 100644
index 000000000000..c295644afe3a
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::client::snd_mix.c
@@ -0,0 +1,20 @@
+--- src/client/snd_mix.c.orig Wed Oct 9 03:54:25 2002
++++ src/client/snd_mix.c Thu Jun 12 15:16:54 2003
+@@ -30,7 +30,7 @@
+
+ void S_WriteLinearBlastStereo16 (void);
+
+-#if !((defined __linux__ || defined __FreeBSD__) && defined __i386__)
++#if !((defined __linux__ || defined __FreeBSD__) && defined __i386__) || defined C_ONLY
+ #if !id386
+
+ void S_WriteLinearBlastStereo16 (void)
+@@ -362,7 +362,7 @@
+ }
+
+
+-#if !((defined __linux__ || __FreeBSD__) && defined __i386__)
++#if !((defined __linux__ || __FreeBSD__) && defined __i386__) || defined C_ONLY
+ #if !id386
+
+ void S_PaintChannelFrom8 (channel_t *ch, sfxcache_t *sc, int count, int offset)
diff --git a/games/quake2lnx/files/patch-src::linux::gl_glx.c b/games/quake2lnx/files/patch-src::linux::gl_glx.c
new file mode 100644
index 000000000000..fbbfbea08fb9
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::linux::gl_glx.c
@@ -0,0 +1,183 @@
+--- src/linux/gl_glx.c.orig Thu Oct 10 01:29:47 2002
++++ src/linux/gl_glx.c Mon Jun 16 23:19:21 2003
+@@ -40,7 +40,6 @@
+ #include <signal.h>
+ #include <dlfcn.h>
+ #ifdef Joystick
+-#include <sys/stat.h>
+ #include <fcntl.h>
+ #endif
+ #include "../ref_gl/gl_local.h"
+@@ -58,7 +57,11 @@
+ #include <X11/extensions/xf86dga.h>
+ #include <X11/extensions/xf86vmode.h>
+ #ifdef Joystick
+-#include <linux/joystick.h>
++# if defined(__linux__)
++# include <linux/joystick.h>
++# elif defined(__FreeBSD__)
++# include <sys/joystick.h>
++# endif
+ #include <glob.h>
+ #endif
+ #include <GL/glx.h>
+@@ -87,18 +90,19 @@
+ #ifdef Joystick
+ static cvar_t *in_joystick;
+ static qboolean joystick_avail = false;
+-static int joy_fd, jx, jy, jt;
++static int joy_fd, jx, jy, center_jx, center_jy;
+ static cvar_t *j_invert_y;
++static cvar_t *j_sensitivity;
+ #endif
+
+ #ifdef Joystick
+ void InitJoystick() {
+ int i, err;
+ glob_t pglob;
+- struct js_event e;
++ struct joystick j;
+
+ joystick_avail = false;
+- err = glob("/dev/js*", 0, NULL, &pglob);
++ err = glob("/dev/joy*", 0, NULL, &pglob);
+
+ if (err) {
+ switch (err) {
+@@ -111,7 +115,7 @@
+ default:
+ ri.Con_Printf(PRINT_ALL, "Error #%d while looking for joysticks\n",err);
+ }
+- return;
++ goto out;
+ }
+
+ for (i=0;i<pglob.gl_pathc;i++) {
+@@ -121,15 +125,14 @@
+ ri.Con_Printf(PRINT_ALL, "Error opening joystick dev %s\n",
+ pglob.gl_pathv[i]);
+ }
+- else {
+- while (read(joy_fd, &e, sizeof(struct js_event))!=-1 &&
+- (e.type & JS_EVENT_INIT))
+- ri.Con_Printf(PRINT_ALL, "Read init event\n");
+- ri.Con_Printf(PRINT_ALL, "Using joystick dev %s\n", pglob.gl_pathv[i]);
++ else if (read(joy_fd, &j, sizeof(struct joystick)) != -1) {
++ ri.Con_Printf(PRINT_ALL, "Using joystick dev %s\n", pglob.gl_pathv[i]);
+ joystick_avail = true;
+- return;
++ center_jx = j.x; center_jy = j.y;
++ break;
+ }
+ }
++out:
+ globfree(&pglob);
+ }
+ #endif
+@@ -288,6 +291,7 @@
+ #ifdef Joystick
+ in_joystick = ri.Cvar_Get ("in_joystick", "1", CVAR_ARCHIVE);
+ j_invert_y = ri.Cvar_Get ("j_invert_y", "1", CVAR_ARCHIVE);
++ j_sensitivity = ri.Cvar_Get ("j_sensitivity", "3", 0);
+ #endif
+
+ // mouse variables
+@@ -342,8 +346,7 @@
+ {
+ int i;
+ #ifdef Joystick
+- struct js_event e;
+- int key_index;
++ struct joystick j;
+ #endif
+ if (mouse_avail) {
+ for (i=0 ; i<3 ; i++) {
+@@ -356,31 +359,18 @@
+ mouse_oldbuttonstate = mouse_buttonstate;
+ }
+ #ifdef Joystick
++ /* FreeBSD does not fully support multi-buttoned joysticks */
+ if (joystick_avail) {
+- while (read(joy_fd, &e, sizeof(struct js_event))!=-1) {
+- if (JS_EVENT_BUTTON & e.type) {
+- key_index = (e.number < 4) ? K_JOY1 : K_AUX1;
+- if (e.value) {
+- in_state->Key_Event_fp (key_index + e.number, true);
+- }
+- else {
+- in_state->Key_Event_fp (key_index + e.number, false);
+- }
+- //joy_oldbuttonstate = e.number;
+- }
+- else if (JS_EVENT_AXIS & e.type) {
+- switch (e.number) {
+- case 0:
+- jx = e.value;
+- break;
+- case 1:
+- jy = e.value;
+- break;
+- case 3:
+- jt = e.value;
+- break;
+- }
+- }
++ if (read(joy_fd, &j, sizeof(struct joystick)) != -1) {
++ if (j.b1)
++ in_state->Key_Event_fp (K_JOY1, true);
++ else
++ in_state->Key_Event_fp (K_JOY1, false);
++ if (j.b2)
++ in_state->Key_Event_fp (K_JOY2, true);
++ else
++ in_state->Key_Event_fp (K_JOY2, false);
++ jx = j.x; jy = j.y;
+ }
+ }
+ #endif
+@@ -393,7 +383,11 @@
+ */
+ void RW_IN_Move (usercmd_t *cmd)
+ {
+- if (!mouse_avail)
++ if (!mouse_avail
++#ifdef Joystick
++ && !joystick_avail
++#endif
++ )
+ return;
+
+ if (m_filter->value)
+@@ -429,25 +423,26 @@
+
+ #ifdef Joystick
+ if (joystick_avail) {
++ int djx = (jx - center_jx) * j_sensitivity->value / 10,
++ djy = (jy - center_jy) * j_sensitivity->value / 10;
+ // add joy X/Y movement to cmd
+ if ( (*in_state->in_strafe_state & 1) ||
+ (lookstrafe->value && mlooking ))
+- cmd->sidemove += m_side->value * (jx/100);
++ cmd->sidemove += m_side->value * djx;
+ else
+- in_state->viewangles[YAW] -= m_yaw->value * (jx/100);
++ in_state->viewangles[YAW] -= m_yaw->value * djx;
+
+ if ( (mlooking || freelook->value) &&
+ !(*in_state->in_strafe_state & 1))
+ {
+ if (j_invert_y)
+- in_state->viewangles[PITCH] -= m_pitch->value * (jy/100);
++ in_state->viewangles[PITCH] -= m_pitch->value * djy;
+ else
+- in_state->viewangles[PITCH] += m_pitch->value * (jy/100);
+- cmd->forwardmove -= m_forward->value * (jt/100);
++ in_state->viewangles[PITCH] += m_pitch->value * djy;
+ }
+ else
+ {
+- cmd->forwardmove -= m_forward->value * (jy/100);
++ cmd->forwardmove -= m_forward->value * djy;
+ }
+ }
+ #endif
diff --git a/games/quake2lnx/files/patch-src::linux::rw_aa.c b/games/quake2lnx/files/patch-src::linux::rw_aa.c
new file mode 100644
index 000000000000..9e3db53af38d
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::linux::rw_aa.c
@@ -0,0 +1,30 @@
+--- src/linux/rw_aa.c.orig Thu Jun 12 18:26:51 2003
++++ src/linux/rw_aa.c Thu Jun 12 18:30:59 2003
+@@ -53,15 +53,18 @@
+ */
+
+ #include <termios.h>
++#include <unistd.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+-#include <sys/vt.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <signal.h>
+ #include <sys/mman.h>
+ #include <dlfcn.h>
++#ifdef __linux__
++#include <sys/vt.h>
+ #include <asm/io.h>
++#endif
+
+ #include <aalib.h>
+
+@@ -240,7 +243,6 @@
+ */
+ void SWimp_SetPalette( const unsigned char *palette )
+ {
+- static int tmppal[256*3];
+ const unsigned char *pal;
+ int i;
+
diff --git a/games/quake2lnx/files/patch-src::linux::rw_in_aa.c b/games/quake2lnx/files/patch-src::linux::rw_in_aa.c
new file mode 100644
index 000000000000..dfc466519b5c
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::linux::rw_in_aa.c
@@ -0,0 +1,19 @@
+--- src/linux/rw_in_aa.c.orig Thu Jun 12 18:31:47 2003
++++ src/linux/rw_in_aa.c Thu Jun 12 18:32:19 2003
+@@ -40,13 +40,14 @@
+ #include <termios.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
+-#include <sys/vt.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <signal.h>
+ #include <sys/mman.h>
+-
++#ifdef __linux__
++#include <sys/vt.h>
+ #include <asm/io.h>
++#endif
+
+ #include <aalib.h>
+
diff --git a/games/quake2lnx/files/patch-src::linux::rw_in_svgalib.c b/games/quake2lnx/files/patch-src::linux::rw_in_svgalib.c
new file mode 100644
index 000000000000..255532e3b1d6
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::linux::rw_in_svgalib.c
@@ -0,0 +1,273 @@
+--- src/linux/rw_in_svgalib.c.orig Wed Oct 9 03:54:25 2002
++++ src/linux/rw_in_svgalib.c Mon Jun 16 23:00:10 2003
+@@ -20,11 +20,23 @@
+ #include <termios.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
++#ifdef __linux__
+ #include <sys/vt.h>
++#endif
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <signal.h>
+ #include <sys/mman.h>
++#ifdef Joystick
++# if defined(__linux__)
++# include <linux/joystick.h>
++# elif defined(__FreeBSD__)
++# include <sys/joystick.h>
++# endif
++#include <fcntl.h>
++#include <glob.h>
++#include <unistd.h>
++#endif
+
+ #include "vga.h"
+ #include "vgakeyboard.h"
+@@ -145,26 +157,22 @@
+ // 84 to 86 not used
+ scantokey[ 87] = K_F11;
+ scantokey[ 88] = K_F12;
+- // 89 to 95 not used
+- scantokey[ 96] = K_KP_ENTER; //keypad enter
+- scantokey[ 97] = K_CTRL; //right
+- scantokey[ 98] = K_KP_SLASH;
+- scantokey[ 99] = K_F12; // print screen, bind to screenshot by default
+- scantokey[100] = K_ALT; // right
+-
+- scantokey[101] = K_PAUSE; // break
+- scantokey[102] = K_HOME;
+- scantokey[103] = K_UPARROW;
+- scantokey[104] = K_PGUP;
+- scantokey[105] = K_LEFTARROW;
+- scantokey[106] = K_RIGHTARROW;
+- scantokey[107] = K_END;
+- scantokey[108] = K_DOWNARROW;
+- scantokey[109] = K_PGDN;
+- scantokey[110] = K_INS;
+- scantokey[111] = K_DEL;
+-
+- scantokey[119] = K_PAUSE;
++ scantokey[ 89] = K_KP_ENTER; //keypad enter
++ scantokey[ 90] = K_CTRL; //right
++ scantokey[ 91] = K_KP_SLASH;
++ scantokey[ 92] = K_F12; // print screen, bind to screenshot by default
++ scantokey[ 93] = K_ALT; // right
++ scantokey[ 94] = K_HOME;
++ scantokey[ 95] = K_UPARROW;
++ scantokey[ 96] = K_PGUP;
++ scantokey[ 97] = K_LEFTARROW;
++ scantokey[ 98] = K_RIGHTARROW;
++ scantokey[ 99] = K_END;
++ scantokey[100] = K_DOWNARROW;
++ scantokey[101] = K_PGDN;
++ scantokey[102] = K_INS;
++ scantokey[103] = K_DEL;
++ scantokey[104] = K_PAUSE;
+
+ if (keyboard_init())
+ Sys_Error("keyboard_init() failed");
+@@ -184,7 +192,7 @@
+ }
+
+ /*****************************************************************************/
+-/* MOUSE */
++/* MOUSE AND JOYSTICK */
+ /*****************************************************************************/
+
+ // this is inside the renderer shared lib, so these are called from vid_so
+@@ -207,6 +215,14 @@
+ static cvar_t *mdev;
+ static cvar_t *mrate;
+
++#ifdef Joystick
++static cvar_t *in_joystick;
++static qboolean joystick_avail = false;
++static int joy_fd, jx, jy, center_jx, center_jy;
++static cvar_t *j_invert_y;
++static cvar_t *j_sensitivity;
++#endif
++
+ static qboolean mlooking;
+
+ // state struct passed in Init
+@@ -254,6 +270,49 @@
+ }
+ #endif
+
++#ifdef Joystick
++void
++InitJoystick()
++{
++ int i, err;
++ glob_t pglob;
++ struct joystick j;
++
++ err = glob("/dev/joy*", 0, NULL, &pglob);
++
++ if (err) {
++ switch (err) {
++ case GLOB_NOSPACE:
++ ri.Con_Printf(PRINT_ALL, "Error, out of memory while looking for joysticks\n");
++ break;
++ case GLOB_NOMATCH:
++ ri.Con_Printf(PRINT_ALL, "No joysticks found\n");
++ break;
++ default:
++ ri.Con_Printf(PRINT_ALL, "Error #%d while looking for joysticks\n", err);
++ }
++ goto out;
++ }
++
++ for (i = 0; i < pglob.gl_pathc; i++) {
++ ri.Con_Printf(PRINT_ALL, "Trying joystick dev %s\n", pglob.gl_pathv[i]);
++ joy_fd = open(pglob.gl_pathv[i], O_RDONLY | O_NONBLOCK);
++ if (joy_fd == -1) {
++ ri.Con_Printf(PRINT_ALL, "Error opening joystick dev %s\n",
++ pglob.gl_pathv[i]);
++ }
++ else if (read(joy_fd, &j, sizeof(struct joystick)) != -1) {
++ ri.Con_Printf(PRINT_ALL, "Using joystick dev %s\n", pglob.gl_pathv[i]);
++ joystick_avail = true;
++ center_jx = j.x; center_jy = j.y;
++ break;
++ }
++ }
++out:
++ globfree(&pglob);
++}
++#endif
++
+ void RW_IN_Init(in_state_t *in_state_p)
+ {
+ int mtype;
+@@ -262,7 +321,12 @@
+
+ // mouse variables
+ m_filter = ri.Cvar_Get ("m_filter", "0", 0);
+- in_mouse = ri.Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
++ in_mouse = ri.Cvar_Get ("in_mouse", "1", CVAR_ARCHIVE);
++#ifdef Joystick
++ in_joystick = ri.Cvar_Get ("in_joystick", "1", CVAR_ARCHIVE);
++ j_invert_y = ri.Cvar_Get ("j_invert_y", "1", CVAR_ARCHIVE);
++ j_sensitivity = ri.Cvar_Get ("j_sensitivity", "3", 0);
++#endif
+ freelook = ri.Cvar_Get( "freelook", "0", 0 );
+ lookstrafe = ri.Cvar_Get ("lookstrafe", "0", 0);
+ sensitivity = ri.Cvar_Get ("sensitivity", "3", 0);
+@@ -293,11 +357,20 @@
+ }
+ else
+ mouse_seteventhandler(mousehandler);
++#ifdef Joystick
++ if (in_joystick)
++ InitJoystick();
++#endif
+ }
+
+ void RW_IN_Shutdown(void)
+ {
+ mouse_close();
++#ifdef Joystick
++ if (joystick_avail)
++ if (close(joy_fd))
++ ri.Con_Printf(PRINT_ALL, "Error, problem closing joystick\n");
++#endif
+ }
+
+ /*
+@@ -307,7 +380,14 @@
+ */
+ void RW_IN_Commands (void)
+ {
+- if (!UseMouse)
++#ifdef Joystick
++ struct joystick j;
++#endif
++ if (!UseMouse
++#ifdef Joystick
++ && !joystick_avail
++#endif
++ )
+ return;
+
+ // poll mouse values
+@@ -346,6 +426,23 @@
+ in_state->Key_Event_fp (K_MWHEELDOWN, false);
+ }
+ mwheel = 0;
++
++#ifdef Joystick
++ /* FreeBSD does not fully support multi-buttoned joysticks */
++ if (joystick_avail) {
++ if (read(joy_fd, &j, sizeof(struct joystick)) != -1) {
++ if (j.b1)
++ in_state->Key_Event_fp (K_JOY1, true);
++ else
++ in_state->Key_Event_fp (K_JOY1, false);
++ if (j.b2)
++ in_state->Key_Event_fp (K_JOY2, true);
++ else
++ in_state->Key_Event_fp (K_JOY2, false);
++ jx = j.x; jy = j.y;
++ }
++ }
++#endif
+ }
+
+ /*
+@@ -355,7 +452,11 @@
+ */
+ void RW_IN_Move (usercmd_t *cmd)
+ {
+- if (!UseMouse)
++ if (!UseMouse
++#ifdef Joystick
++ && !joystick_avail
++#endif
++ )
+ return;
+
+ // poll mouse values
+@@ -374,7 +475,11 @@
+ old_mouse_x = mx;
+ old_mouse_y = my;
+
+- if (!mx && !my)
++ if (!mx && !my
++#ifdef Joystick
++ && !joystick_avail
++#endif
++ )
+ return;
+
+ mx = my = 0; // clear for next update
+@@ -398,6 +503,28 @@
+ {
+ cmd->forwardmove -= m_forward->value * mouse_y;
+ }
++
++#ifdef Joystick
++ if (joystick_avail) {
++ int djx = (jx - center_jx) * j_sensitivity->value / 10,
++ djy = (jy - center_jy) * j_sensitivity->value / 10;
++// add joy X/Y movement to cmd
++ if ((*in_state->in_strafe_state & 1) ||
++ (lookstrafe->value && mlooking))
++ cmd->sidemove += m_side->value * djx;
++ else
++ in_state->viewangles[YAW] -= m_yaw->value * djx;
++
++ if ((mlooking || freelook->value) &&
++ !(*in_state->in_strafe_state & 1)) {
++ if (j_invert_y)
++ in_state->viewangles[PITCH] -= m_pitch->value * djy;
++ else
++ in_state->viewangles[PITCH] += m_pitch->value * djy;
++ }
++ else cmd->forwardmove -= m_forward->value * djy;
++ }
++#endif
+ }
+
+ void RW_IN_Frame (void)
diff --git a/games/quake2lnx/files/patch-src::linux::rw_sdl.c b/games/quake2lnx/files/patch-src::linux::rw_sdl.c
new file mode 100644
index 000000000000..7b3989bd2da8
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::linux::rw_sdl.c
@@ -0,0 +1,14 @@
+--- src/linux/rw_sdl.c.orig Wed Jun 18 08:01:40 2003
++++ src/linux/rw_sdl.c Wed Jun 18 08:02:13 2003
+@@ -190,7 +190,10 @@
+ */
+ void RW_IN_Commands (void)
+ {
+- int i, key_index;
++ int i;
++#ifdef Joystick
++ int key_index;
++#endif
+
+ if (mouse_avail) {
+ for (i=0 ; i<3 ; i++) {
diff --git a/games/quake2lnx/files/patch-src::linux::rw_svgalib.c b/games/quake2lnx/files/patch-src::linux::rw_svgalib.c
new file mode 100644
index 000000000000..a9937ff476b3
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::linux::rw_svgalib.c
@@ -0,0 +1,12 @@
+--- src/linux/rw_svgalib.c.orig Thu Jun 12 18:41:01 2003
++++ src/linux/rw_svgalib.c Thu Jun 12 18:41:41 2003
+@@ -36,7 +36,9 @@
+ #include <termios.h>
+ #include <sys/ioctl.h>
+ #include <sys/stat.h>
++#ifdef __linux__
+ #include <sys/vt.h>
++#endif
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <signal.h>
diff --git a/games/quake2lnx/files/patch-src::linux::rw_x11.c b/games/quake2lnx/files/patch-src::linux::rw_x11.c
new file mode 100644
index 000000000000..3472cb66844e
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::linux::rw_x11.c
@@ -0,0 +1,171 @@
+--- src/linux/rw_x11.c.orig Wed Oct 9 03:54:25 2002
++++ src/linux/rw_x11.c Mon Jun 16 23:19:40 2003
+@@ -36,7 +36,6 @@
+ #include <sys/time.h>
+ #include <sys/types.h>
+ #ifdef Joystick
+-#include <sys/stat.h>
+ #include <fcntl.h>
+ #endif
+ #include <unistd.h>
+@@ -58,7 +57,11 @@
+ #include <X11/extensions/xf86vmode.h>
+ #endif
+ #ifdef Joystick
+-#include <linux/joystick.h>
++# if defined(__linux__)
++# include <linux/joystick.h>
++# elif defined(__FreeBSD__)
++# include <sys/joystick.h>
++# endif
+ #include <glob.h>
+ #endif
+
+@@ -317,8 +320,9 @@
+ #ifdef Joystick
+ static cvar_t *in_joystick;
+ static qboolean joystick_avail = false;
+-static int joy_fd, jx, jy, jt;
++static int joy_fd, jx, jy, center_jx, center_jy;
+ static cvar_t *j_invert_y;
++static cvar_t *j_sensitivity;
+ #endif
+
+ static qboolean mlooking;
+@@ -357,10 +361,10 @@
+ void InitJoystick() {
+ int i, err;
+ glob_t pglob;
+- struct js_event e;
++ struct joystick j;
+
+ joystick_avail = false;
+- err = glob("/dev/js*", 0, NULL, &pglob);
++ err = glob("/dev/joy*", 0, NULL, &pglob);
+
+ if (err) {
+ switch (err) {
+@@ -373,7 +377,7 @@
+ default:
+ ri.Con_Printf(PRINT_ALL, "Error #%d while looking for joysticks\n",err);
+ }
+- return;
++ goto out;
+ }
+
+ for (i=0;i<pglob.gl_pathc;i++) {
+@@ -383,15 +387,14 @@
+ ri.Con_Printf(PRINT_ALL, "Error opening joystick dev %s\n",
+ pglob.gl_pathv[i]);
+ }
+- else {
+- while (read(joy_fd, &e, sizeof(struct js_event))!=-1 &&
+- (e.type & JS_EVENT_INIT))
+- ri.Con_Printf(PRINT_ALL, "Read init event\n");
+- ri.Con_Printf(PRINT_ALL, "Using joystick dev %s\n", pglob.gl_pathv[i]);
++ else if (read(joy_fd, &j, sizeof(struct joystick)) != -1) {
++ ri.Con_Printf(PRINT_ALL, "Using joystick dev %s\n", pglob.gl_pathv[i]);
+ joystick_avail = true;
+- return;
++ center_jx = j.x; center_jy = j.y;
++ break;
+ }
+ }
++out:
+ globfree(&pglob);
+ }
+ #endif
+@@ -407,6 +410,7 @@
+ #ifdef Joystick
+ in_joystick = ri.Cvar_Get ("in_joystick", "1", CVAR_ARCHIVE);
+ j_invert_y = ri.Cvar_Get ("j_invert_y", "1", CVAR_ARCHIVE);
++ j_sensitivity = ri.Cvar_Get ("j_sensitivity", "3", 0);
+ #endif
+ freelook = ri.Cvar_Get( "freelook", "0", 0 );
+ lookstrafe = ri.Cvar_Get ("lookstrafe", "0", 0);
+@@ -442,8 +446,7 @@
+ {
+ int i;
+ #ifdef Joystick
+- struct js_event e;
+- int key_index;
++ struct joystick j;
+ #endif
+ if (mouse_avail) {
+ for (i=0 ; i<3 ; i++) {
+@@ -456,31 +459,18 @@
+ mouse_oldbuttonstate = mouse_buttonstate;
+ }
+ #ifdef Joystick
++ /* FreeBSD does not fully support multi-buttoned joysticks */
+ if (joystick_avail) {
+- while (read(joy_fd, &e, sizeof(struct js_event))!=-1) {
+- if (JS_EVENT_BUTTON & e.type) {
+- key_index = (e.number < 4) ? K_JOY1 : K_AUX1;
+- if (e.value) {
+- in_state->Key_Event_fp (key_index + e.number, true);
+- }
+- else {
+- in_state->Key_Event_fp (key_index + e.number, false);
+- }
+- //joy_oldbuttonstate = e.number;
+- }
+- else if (JS_EVENT_AXIS & e.type) {
+- switch (e.number) {
+- case 0:
+- jx = e.value;
+- break;
+- case 1:
+- jy = e.value;
+- break;
+- case 3:
+- jt = e.value;
+- break;
+- }
+- }
++ if (read(joy_fd, &j, sizeof(struct joystick)) != -1) {
++ if (j.b1)
++ in_state->Key_Event_fp (K_JOY1, true);
++ else
++ in_state->Key_Event_fp (K_JOY1, false);
++ if (j.b2)
++ in_state->Key_Event_fp (K_JOY2, true);
++ else
++ in_state->Key_Event_fp (K_JOY2, false);
++ jx = j.x; jy = j.y;
+ }
+ }
+ #endif
+@@ -542,25 +532,26 @@
+ }
+ #ifdef Joystick
+ if (joystick_avail) {
++ int djx = (jx - center_jx) * j_sensitivity->value / 10,
++ djy = (jy - center_jy) * j_sensitivity->value / 10;
+ // add joy X/Y movement to cmd
+ if ( (*in_state->in_strafe_state & 1) ||
+ (lookstrafe->value && mlooking ))
+- cmd->sidemove += m_side->value * (jx/100);
++ cmd->sidemove += m_side->value * djx;
+ else
+- in_state->viewangles[YAW] -= m_yaw->value * (jx/100);
++ in_state->viewangles[YAW] -= m_yaw->value * djx;
+
+ if ( (mlooking || freelook->value) &&
+ !(*in_state->in_strafe_state & 1))
+ {
+ if (j_invert_y)
+- in_state->viewangles[PITCH] -= m_pitch->value * (jy/100);
++ in_state->viewangles[PITCH] -= m_pitch->value * djy;
+ else
+- in_state->viewangles[PITCH] += m_pitch->value * (jy/100);
+- cmd->forwardmove -= m_forward->value * (jt/100);
++ in_state->viewangles[PITCH] += m_pitch->value * djy;
+ }
+ else
+ {
+- cmd->forwardmove -= m_forward->value * (jy/100);
++ cmd->forwardmove -= m_forward->value * djy;
+ }
+ }
+ #endif
diff --git a/games/quake2lnx/files/patch-src::ref_candygl::gl_rmisc.c b/games/quake2lnx/files/patch-src::ref_candygl::gl_rmisc.c
new file mode 100644
index 000000000000..5579805c15ac
--- /dev/null
+++ b/games/quake2lnx/files/patch-src::ref_candygl::gl_rmisc.c
@@ -0,0 +1,12 @@
+--- src/ref_candygl/gl_rmisc.c.orig Thu Jun 12 18:05:46 2003
++++ src/ref_candygl/gl_rmisc.c Thu Jun 12 18:08:56 2003
+@@ -100,9 +100,6 @@
+ int x,y;
+ byte data[8][8][4];
+
+- byte *pic, *palette;
+- int width, height;
+-
+ partscale = (float)((int)gl_partscale->value)*0.01;
+ if (partscale>1)
+ partscale=1;