aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPav Lucistnik <pav@FreeBSD.org>2010-12-01 13:27:08 +0000
committerPav Lucistnik <pav@FreeBSD.org>2010-12-01 13:27:08 +0000
commit547ff04a5686166f4ac6c64ceb26870d4b0722cf (patch)
tree1183390ebb633e8f71d8d263ad8c77e34e539be3
parente8d0d5cbbba0bfd92945a23f9df9ebf1f2151bb5 (diff)
downloadports-547ff04a5686166f4ac6c64ceb26870d4b0722cf.tar.gz
ports-547ff04a5686166f4ac6c64ceb26870d4b0722cf.zip
Notes
-rw-r--r--games/ioquake3-devel/Makefile20
-rw-r--r--games/ioquake3-devel/distinfo5
-rw-r--r--games/ioquake3/Makefile23
-rw-r--r--games/ioquake3/distinfo1
-rw-r--r--games/ioquake3/files/patch-code-qcommon-vm_x86.c29
-rw-r--r--games/iourbanterror/Makefile183
-rw-r--r--games/iourbanterror/distinfo5
-rw-r--r--games/iourbanterror/files/extra-patch-cellshading933
-rw-r--r--games/iourbanterror/files/extra-patch-mp3753
-rw-r--r--games/iourbanterror/files/patch-Makefile432
-rw-r--r--games/iourbanterror/files/patch-code-qcommon-q_shared.h19
-rw-r--r--games/iourbanterror/files/patch-code__qcommon__common.c10
-rw-r--r--games/iourbanterror/files/patch-code__qcommon__q_platform.h15
-rw-r--r--games/iourbanterror/files/patch-code__qcommon__vm_x86.c20
-rw-r--r--games/iourbanterror/files/patch-code__qcommon__vm_x86_64.c20
-rw-r--r--games/iourbanterror/files/patch-code__unix__linux_glimp.c19
-rw-r--r--games/iourbanterror/files/patch-code__unix__unix_main.c31
-rw-r--r--games/iourbanterror/files/patch-code_client_snd_openal.c11
-rw-r--r--games/iourbanterror/pkg-descr4
-rw-r--r--games/iourbanterror/pkg-message17
-rw-r--r--games/iourbanterror/pkg-plist15
-rw-r--r--games/openarena-oax/Makefile2
-rw-r--r--games/openarena-oax/distinfo5
-rw-r--r--games/openarena/Makefile8
-rw-r--r--games/openarena/distinfo5
-rw-r--r--games/openarena/files/patch-Makefile125
-rw-r--r--games/openarena/files/patch-code-qcommon-vm_x86.c29
27 files changed, 167 insertions, 2572 deletions
diff --git a/games/ioquake3-devel/Makefile b/games/ioquake3-devel/Makefile
index acf84eb6fa90..baab2eb9be16 100644
--- a/games/ioquake3-devel/Makefile
+++ b/games/ioquake3-devel/Makefile
@@ -5,19 +5,19 @@
# $FreeBSD$
#
-PORTNAME= ioquake3-devel
-DISTVERSION= 1.36_SVN${SVNREVISION}
-PORTREVISION= 0
-MASTER_SITES= ftp://deponie.yamagi.org/freebsd/distfiles/ioquake3/ \
+PORTNAME?= ioquake3-devel
+DISTVERSION?= 1.36_SVN${SVNREVISION}
+PORTREVISION?= 0
+MASTER_SITES?= ftp://deponie.yamagi.org/freebsd/distfiles/ioquake3/ \
http://deponie.yamagi.org/freebsd/distfiles/ioquake3/
-MAINTAINER= kamikaze@bsdforen.de
-COMMENT= Development SVN snapshots of ioquake3
+MAINTAINER?= kamikaze@bsdforen.de
+COMMENT?= Development SVN snapshots of ioquake3
-PLIST= ${.CURDIR}/../ioquake3/pkg-plist
-PATCHDIR= ${WRKDIR}/freebsd-patchset/
+PLIST?= ${.CURDIR}/../ioquake3/pkg-plist
+PATCHDIR?= ${WRKDIR}/freebsd-patchset/
-SVNREVISION= 1784
-BINSUFFIX= -devel
+SVNREVISION?= 1803
+BINSUFFIX?= -devel
.include "${.CURDIR}/../ioquake3/Makefile"
diff --git a/games/ioquake3-devel/distinfo b/games/ioquake3-devel/distinfo
index 7a81fff83e22..4cd4fe5cd6e1 100644
--- a/games/ioquake3-devel/distinfo
+++ b/games/ioquake3-devel/distinfo
@@ -1,3 +1,2 @@
-MD5 (ioquake3-devel-1.36_SVN1784.zip) = 519a106119b64bc388f1c91fd0f51b5b
-SHA256 (ioquake3-devel-1.36_SVN1784.zip) = daf0c428fa119e393b2a595709e4655f61fa3d639419368475411f8e636ad905
-SIZE (ioquake3-devel-1.36_SVN1784.zip) = 4930534
+SHA256 (ioquake3-devel-1.36_SVN1803.zip) = 2d73b8f4818c7f82adc2f28308e7a6bdca7f3b5e9db0fbbfa5c34e2569a386da
+SIZE (ioquake3-devel-1.36_SVN1803.zip) = 4930935
diff --git a/games/ioquake3/Makefile b/games/ioquake3/Makefile
index 890cd87a0e9d..87a2c1745ef3 100644
--- a/games/ioquake3/Makefile
+++ b/games/ioquake3/Makefile
@@ -7,12 +7,12 @@
PORTNAME?= ioquake3
DISTVERSION?= 1.36
-PORTREVISION?= 6
+PORTREVISION?= 7
CATEGORIES= games
MASTER_SITES?= http://ioquake3.org/files/${DISTVERSION}/
MAINTAINER?= kamikaze@bsdforen.de
-COMMENT?= Cleaned-up and enhaced version of Quake 3
+COMMENT?= Cleaned-up and enhanced version of Quake 3
USE_ZIP?= yes
# Allow slave ports to turn off zip.
@@ -31,7 +31,7 @@ OPTIONS+= CLIENT "Build client" on \
MAKE_ARGS+= DEFAULT_BASEDIR="${Q3DIR}" \
DEFAULT_LIBDIR="${LIBDIR}" \
- HOMEPATH="/.${PORTNAME}" \
+ HOMEPATH="${HOMEPATH}" \
VERSION="${DISTVERSION}" \
ARCH="${ARCH}"
PLIST_SUB+= LIBDIR="${LIBDIR:S/${PREFIX}\///}" \
@@ -43,6 +43,7 @@ MAKE_JOBS_SAFE= yes
LIBDIR= ${PREFIX}/lib/${PORTNAME}
BUILDDIR= ${WRKSRC}/build/release-${OPSYS:L}-${ARCH}
BINSUFFIX?=
+HOMEPATH?= /.${PORTNAME}
Q3CLIENT?= ioquake3
Q3SERVER?= ioq3ded
Q3TOOLS?= q3asm \
@@ -51,6 +52,7 @@ Q3TOOLS?= q3asm \
q3rcc
Q3BASE?= baseq3 \
missionpack
+Q3ICON?= ${PREFIX}/share/pixmaps/quake3.xpm
Q3INSTALL?=
ONLY_FOR_ARCHS= amd64 i386
@@ -61,8 +63,21 @@ MACHINE_ARCH= ${ARCH}
.include <bsd.port.options.mk>
+.if !defined(DESKTOP_ENTRIES)
+.if defined(WITH_CLIENT)
+DESKTOP_ENTRIES+= "${Q3CLIENT} ${DISTVERSION}" "${COMMENT}" \
+ "${Q3ICON}" \
+ "${Q3CLIENT}${BINSUFFIX}" "Application;Game;" false
+.endif
+.if defined(WITH_SMP)
+DESKTOP_ENTRIES+= "${Q3CLIENT} ${DISTVERSION} SMP" "${COMMENT}" \
+ "${Q3ICON}" \
+ "${Q3CLIENT}-smp${BINSUFFIX}" "Application;Game;" false
+.endif
+.endif
+
.if defined(WITHOUT_CLIENT) && defined(WITHOUT_DEDICATED) && \
- defined(WITHOUT_SMP)
+ !defined(WITH_SMP)
IGNORE= needs at least one of CLIENT, DEDICATED and SMP options
.endif
diff --git a/games/ioquake3/distinfo b/games/ioquake3/distinfo
index 828f9daa8ebb..1a313351257d 100644
--- a/games/ioquake3/distinfo
+++ b/games/ioquake3/distinfo
@@ -1,3 +1,2 @@
-MD5 (ioquake3-1.36.zip) = 8e48a3957b3e70601d0ea0a450dc6359
SHA256 (ioquake3-1.36.zip) = 3f8fecd81f9af484b9215df4cf58bcc6a378adb6f1504b0bba169c3dbadb4c94
SIZE (ioquake3-1.36.zip) = 4583577
diff --git a/games/ioquake3/files/patch-code-qcommon-vm_x86.c b/games/ioquake3/files/patch-code-qcommon-vm_x86.c
new file mode 100644
index 000000000000..a24661785255
--- /dev/null
+++ b/games/ioquake3/files/patch-code-qcommon-vm_x86.c
@@ -0,0 +1,29 @@
+--- code/qcommon/vm_x86.c.orig 2008-08-18 01:22:06.000000000 +0200
++++ code/qcommon/vm_x86.c 2010-11-27 14:01:33.000000000 +0100
+@@ -36,7 +36,25 @@
+
+ /* need this on NX enabled systems (i386 with PAE kernel or
+ * noexec32=on x86_64) */
+-#ifdef __linux__
++// Rambetter's note: I'm adding the test for __FreeBSD__ in addition to the [already
++// existing] test for __linux__. Here is why. I own a 32 bit FreeBSD 8.0 server with
++// a PAE kernel. Without VM_X86_MMAP, ioq3ded segfaults shortly after starting
++// (this should come as no surprise). With VM_X86_MMAP, ioq3ded runs very smoothly.
++// So, at a very minimum, we need to set VM_X86_MMAP for FreeBSD PAE kernels.
++// Now, I also happen to own a 32 bit FreeBSD 7.1 server with just the standard kernel
++// (non-PAE). I have run ioq3ded successfully on it with and without VM_X86_MMAP for many
++// months. So, in the case of non-PAE FreeBSD, we can go either way - use VM_X86_MMAP or
++// not use it. The absolute safest fix to this problem is to only set VM_X86_MMAP on
++// PAE FreeBSD kernels (in addition to Linux); however, I don't know of a way to detect
++// the PAE kernel easily. Therefore, since using VM_X86_MMAP won't break anything on
++// non-PAE kernels [apparently], we'll just use it all the time on FreeBSD 32 bit.
++// Now, you may ask the question: Why not change the entire test for just __unix__?
++// Unfortunately I cannot say anything about this because I don't have access to every
++// other system that has __unix__ defined, so I cannot possibly test all those cases to
++// make sure things work. We'll just leave it with __linux__ and __FreeBSD__ to be safe.
++// If someone with a different flavor of UNIX running a PAE kernel has this problem too,
++// they can report the bug and we will adjust the line below accordingly.
++#if defined(__linux__) || defined(__FreeBSD__)
+ #define VM_X86_MMAP
+ #endif
+
diff --git a/games/iourbanterror/Makefile b/games/iourbanterror/Makefile
index a6c749a0ef21..ce738ac44056 100644
--- a/games/iourbanterror/Makefile
+++ b/games/iourbanterror/Makefile
@@ -6,173 +6,46 @@
#
PORTNAME= iourbanterror
-DISTVERSION= 2007_12_20
-PORTREVISION= 8
+PORTVERSION= 4.1
+DISTVERSION= 1.36_SVN${SVNREVISION}+${PORTVERSION}
+PORTREVISION= 0
+PORTEPOCH= 1
CATEGORIES= games
-MASTER_SITES= http://ftp.snt.utwente.nl/pub/games/urbanterror/iourbanterror/source/complete/
-DISTNAME= ioUrbanTerrorSource_${DISTVERSION}
+DISTNAME= ioquake3-devel-1.36_SVN${SVNREVISION}
MAINTAINER= kamikaze@bsdforen.de
COMMENT= Quake 3 engine modified for Urban Terror (based on ioquake3)
RUN_DEPENDS= ${Q3DIR}/q3ut4:${PORTSDIR}/games/urbanterror-data
-USE_ZIP= yes
-USE_GMAKE= yes
-ALL_TARGET= release
-WRKSRC= ${WRKDIR}/ioUrbanTerrorClientSource
+PLIST= ${.CURDIR}/pkg-plist
-OPTIONS= CLIENT "Build client" on \
- CELLSHADING "Enable Cell Shading effect" off \
- CURL "Enable curl support" on \
- CURL_DLOPEN "Enable dynamic loading of curl" on \
- GAMELIBS "Build game libraries (when not mandatory)" off \
- DEDICATED "Build dedicated server" on \
- MP3 "Enable MP3 support" off \
- OPENAL "Enable OpenAL (3D sound) support" off \
- OPENAL_DLOPEN "Enable dynamic loading of OpenAL" off \
- OPTIMIZED_CFLAGS "Enable compilation optimizations" on \
- SDL_AUDIO "Use SDL for audio" off \
- SDL_VIDEO "Use SDL for video" off \
- SMP "Build SMP (threaded) client" on \
- VORBIS "Enable Ogg Vorbis codec support" off
+# The docs belong to ioquake3
+NOPORTDOCS= yes
-MAKE_ENV= DEFAULT_BASEDIR="${Q3DIR}" LIBDIR="${LIBDIR}" \
- PTHREAD_LIBS="${PTHREAD_LIBS}"
-PLIST_SUB= LIBDIR="${LIBDIR:S/${PREFIX}\///}"
+Q3TOTALCONV= yes
+Q3DIR= ${PREFIX}/share/quake3
+Q3ICON= ${PREFIX}/share/quake3/q3ut4/q3ut.ico
+Q3CLIENT= ioUrbanTerror
+Q3SERVER= ioUrTded
+Q3TOOLS=
+Q3BASE= q3ut4
+BINSUFFIX=
+HOMEPATH= /.ioUrbanTerror
-LIBDIR= ${PREFIX}/lib/${PORTNAME}
-VM_ARCHS= amd64 i386 powerpc
+MAKE_ARGS+= BUILD_MISSIONPACK=0 \
+ BUILD_STANDALONE=1
-.include <bsd.port.pre.mk>
-
-Q3DIR!= cd ${PORTSDIR}/games/quake3-data && ${MAKE} -V Q3DIR
-
-.if defined(WITHOUT_CLIENT) && defined(WITHOUT_DEDICATED) && \
- defined(WITHOUT_SMP)
-IGNORE= needs at least one of CLIENT, DEDICATED and SMP options
-.endif
-
-.for i in ${ARCH}
-. if ${VM_ARCHS:M${i}} != ""
-HAVE_VM_COMPILED= yes
-. endif
-.endfor
-
-.if defined(HAVE_VM_COMPILED)
-MAKE_ENV+= HAVE_VM_COMPILED=true
-.endif
-
-.if defined(WITH_CELLSHADING)
-EXTRA_PATCHES+= ${FILESDIR}/extra-patch-cellshading
-.endif
-
-.if !defined(WITHOUT_CLIENT) || !defined(WITHOUT_SMP)
-# curl
-. if defined(WITH_CURL)
-LIB_DEPENDS+= curl.6:${PORTSDIR}/ftp/curl
-MAKE_ENV+= USE_CURL=1
-. if defined(WITH_CURL_DLOPEN)
-MAKE_ENV+= USE_CURL_DLOPEN=1
-. endif
-. endif
-# OpenAL
-. if defined(WITH_OPENAL)
-USE_OPENAL= al
-MAKE_ENV+= USE_OPENAL=1
-. if defined(WITH_OPENAL_DLOPEN)
-MAKE_ENV+= USE_OPENAL_DLOPEN=1
-. endif
-. endif
-# SDL
-. if defined(WITH_SDL_AUDIO)
-USE_SDL= sdl
-MAKE_ENV+= USE_SDL_AUDIO=1
-. endif
-. if defined(WITH_SDL_VIDEO)
-USE_SDL= sdl
-MAKE_ENV+= USE_SDL_VIDEO=1
-. else
-USE_GL= yes
-USE_XORG= xxf86dga
-. endif
-# Vorbis
-. if defined(WITH_VORBIS)
-LIB_DEPENDS+= vorbis.4:${PORTSDIR}/audio/libvorbis
-MAKE_ENV+= USE_CODEC_VORBIS=1
-. endif
-.endif
-
-.if !defined(WITHOUT_CLIENT)
-MAKE_ENV+= BUILD_CLIENT=1
-PLIST_SUB+= CLIENT=""
-Q3BIN+= ioUrbanTerror
-.else
-PLIST_SUB+= CLIENT="@comment "
-.endif
-
-.if !defined(WITHOUT_DEDICATED)
-MAKE_ENV+= BUILD_SERVER=1
-PLIST_SUB+= DEDICATED=""
-Q3BIN+= ioUrTded
-.else
-PLIST_SUB+= DEDICATED="@comment "
-.endif
-
-.if defined(WITH_GAMELIBS) || !defined(HAVE_VM_COMPILED)
-MAKE_ENV+= BUILD_GAME_SO=1
-PLIST_SUB+= GAMELIBS=""
-.else
-PLIST_SUB+= GAMELIBS="@comment "
-.endif
-
-.if defined(WITH_MP3)
-EXTRA_PATCHES+= ${FILESDIR}/extra-patch-mp3
-LIB_DEPENDS+= mad.2:${PORTSDIR}/audio/libmad
-MAKE_ENV+= USE_CODEC_MP3=1
-.endif
-
-.if !defined(WITHOUT_OPTIMIZED_CFLAGS)
-MAKE_ENV+= USE_OPTIMIZED_CFLAGS=1
-.endif
-
-.if !defined(WITHOUT_SMP)
-MAKE_ENV+= BUILD_CLIENT_SMP=1
-PLIST_SUB+= SMP=""
-Q3BIN+= ioUrbanTerror-smp
-.else
-PLIST_SUB+= SMP="@comment "
-.endif
+UTPATCHES!= echo ${.CURDIR}/files/*
post-patch:
-# There are new variables in the config files, so keep them in another dir.
- @${REINPLACE_CMD} -E 's|/\.q3a|/.ioUrbanTerror|' \
- ${WRKSRC}/code/unix/unix_shared.c
-# Fix wrong library version (use general case as only one is installed).
-.if defined(WITH_CURL_DLOPEN)
- @${REINPLACE_CMD} -e 's|libcurl\.so\.[[:digit:]]|libcurl.so|' \
- ${WRKSRC}/code/client/cl_curl.h
-.endif
-
-do-install:
-.for bin in ${Q3BIN}
- ${INSTALL_PROGRAM} ${WRKSRC}/build/release/${bin} ${PREFIX}/bin
+.for _file in ${UTPATCHES}
+ @${PATCH} -sd "${WRKSRC}" < ${_file}
.endfor
-.if defined(WITH_GAMELIBS) || !defined(HAVE_VM_COMPILED)
-.for dir in baseq3 missionpack
- ${MKDIR} ${LIBDIR}/${dir}
- ${INSTALL_PROGRAM} ${WRKSRC}/build/release/${dir}/*.so ${LIBDIR}/${dir}
-.endfor
-.endif
-.if !defined(NOPORTDOCS)
- ${MKDIR} ${DOCSDIR}
- ${INSTALL_DATA} ${WRKDIR}/ioUrbanTerror_README.txt \
- ${WRKSRC}/README ${DOCSDIR}
-.endif
-
-post-install:
- @${ECHO_CMD}
- @${CAT} ${PKGMESSAGE}
- @${ECHO_CMD}
+ @${REINPLACE_CMD} \
+ -e 's/ioquake3/${Q3CLIENT}/g' \
+ -e 's/ioq3ded/${Q3SERVER}/g' \
+ -e 's/baseq3/${Q3BASE}/g' \
+ "${WRKSRC}/Makefile"
-.include <bsd.port.post.mk>
+.include "../ioquake3-devel/Makefile"
diff --git a/games/iourbanterror/distinfo b/games/iourbanterror/distinfo
index 5d5c23210bff..4cd4fe5cd6e1 100644
--- a/games/iourbanterror/distinfo
+++ b/games/iourbanterror/distinfo
@@ -1,3 +1,2 @@
-MD5 (ioUrbanTerrorSource_2007_12_20.zip) = 4dbe5a03a10f23138f42b5e0dc39598b
-SHA256 (ioUrbanTerrorSource_2007_12_20.zip) = 96d58662852d31fa6ab03431120328dab7f36bf60010a2cfdc1b427d6ac23ce8
-SIZE (ioUrbanTerrorSource_2007_12_20.zip) = 17284593
+SHA256 (ioquake3-devel-1.36_SVN1803.zip) = 2d73b8f4818c7f82adc2f28308e7a6bdca7f3b5e9db0fbbfa5c34e2569a386da
+SIZE (ioquake3-devel-1.36_SVN1803.zip) = 4930935
diff --git a/games/iourbanterror/files/extra-patch-cellshading b/games/iourbanterror/files/extra-patch-cellshading
deleted file mode 100644
index ce459a17bd45..000000000000
--- a/games/iourbanterror/files/extra-patch-cellshading
+++ /dev/null
@@ -1,933 +0,0 @@
-Index: code/renderer/tr_image.c
-===================================================================
---- code/renderer/tr_image.c (revision 933)
-+++ code/renderer/tr_image.c (working copy)
-@@ -34,7 +34,24 @@
- #define JPEG_INTERNALS
- #include "../jpeg-6/jpeglib.h"
-
-+/**
-+ * Headers for cell shading
-+ * @author Jordi Prats Catala
-+ * @author Guillermo Miranda Alamo
-+ */
-+/*
-+byte getImageR(byte *targa_rgba, int x, int y, int columns, int rows);
-+byte getImageG(byte *targa_rgba, int x, int y, int columns, int rows);
-+byte getImageB(byte *targa_rgba, int x, int y, int columns, int rows);
-+byte getImageA(byte *targa_rgba, int x, int y, int columns, int rows);
-+void setImageR(byte *targa_rgba, int x, int y, int columns, int rows, byte value);
-+void setImageG(byte *targa_rgba, int x, int y, int columns, int rows, byte value);
-+void setImageB(byte *targa_rgba, int x, int y, int columns, int rows, byte value);
-+void setImageA(byte *targa_rgba, int x, int y, int columns, int rows, byte value);
-+*/
-+//void kuwahara(int columns, int rows, byte *targa_rgba);
-
-+
- static void LoadBMP( const char *name, byte **pic, int *width, int *height );
- static void LoadTGA( const char *name, byte **pic, int *width, int *height );
- static void LoadJPG( const char *name, byte **pic, int *width, int *height );
-@@ -799,7 +816,643 @@
- return image;
- }
-
-+/****************************
-+RGB GET/SET
-+****************************/
-
-+//RED
-+static byte getImageR(byte *targa_rgba, int x, int y, int columns, int rows)
-+{
-+ byte *pixbuf;
-+
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+ if(rows<=y)
-+ y=y%rows;
-+ if(columns<=x)
-+ x=x%columns;
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+
-+
-+ pixbuf = targa_rgba + y*columns*4;
-+
-+ pixbuf+=(x*4);
-+
-+ return *pixbuf;
-+}
-+
-+static void setImageR(byte *targa_rgba, int x, int y, int columns, int rows, byte value)
-+{
-+ byte *pixbuf;
-+
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+
-+ pixbuf = targa_rgba + y*columns*4;
-+
-+ pixbuf+=(x*4);
-+
-+ *pixbuf=value;
-+}
-+//GREEN
-+static byte getImageG(byte *targa_rgba, int x, int y, int columns, int rows)
-+{
-+ byte *pixbuf;
-+
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+ if(rows<=y)
-+ y=y%rows;
-+ if(columns<=x)
-+ x=x%columns;
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+
-+ pixbuf = targa_rgba + y*columns*4;
-+
-+ pixbuf+=(x*4);
-+
-+ pixbuf++;
-+ return *pixbuf;
-+}
-+
-+static void setImageG(byte *targa_rgba, int x, int y, int columns, int rows, byte value)
-+{
-+ byte *pixbuf;
-+
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+
-+ pixbuf = targa_rgba + y*columns*4;
-+
-+ pixbuf+=(x*4);
-+ pixbuf++;
-+ *pixbuf=value;
-+}
-+//BLUE
-+static byte getImageB(byte *targa_rgba, int x, int y, int columns, int rows)
-+{
-+ byte *pixbuf;
-+
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+ if(rows<=y)
-+ y=y%rows;
-+ if(columns<=x)
-+ x=x%columns;
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+
-+ pixbuf = targa_rgba + y*columns*4;
-+
-+ pixbuf+=(x*4);
-+ pixbuf+=2;
-+ return *pixbuf;
-+}
-+
-+static void setImageB(byte *targa_rgba, int x, int y, int columns, int rows, byte value)
-+{
-+ byte *pixbuf;
-+
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+
-+ pixbuf = targa_rgba + y*columns*4;
-+
-+ pixbuf+=(x*4);
-+ pixbuf+=2;
-+ *pixbuf=value;
-+}
-+//ALPHA
-+static byte getImageA(byte *targa_rgba, int x, int y, int columns, int rows)
-+{
-+ byte *pixbuf;
-+
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+
-+ pixbuf = targa_rgba + y*columns*4;
-+
-+ pixbuf+=(x*4);
-+ pixbuf+=3;
-+ return *pixbuf;
-+}
-+
-+static void setImageA(byte *targa_rgba, int x, int y, int columns, int rows, byte value)
-+{
-+ byte *pixbuf;
-+
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+
-+ pixbuf = targa_rgba + y*columns*4;
-+
-+ pixbuf+=(x*4);
-+ pixbuf+=3;
-+ *pixbuf=value;
-+}
-+
-+//RGB
-+static void getImageRGB(byte *targa_rgba, int x, int y, int columns, int rows, vec3_t rgb)
-+{
-+ byte *pixbuf;
-+
-+ x*=((x<0)?-1:1);
-+ y*=((y<0)?-1:1);
-+ //if(rows<=y)
-+ y=y%rows;
-+ //if(columns<=x)
-+ x=x%columns;
-+ //x*=((x<0)?-1:1);
-+ //y*=((y<0)?-1:1);
-+
-+ pixbuf = targa_rgba + y*columns*4 + x*4;
-+
-+ rgb[0]=*pixbuf;
-+ rgb[1]=*(pixbuf+1);
-+ rgb[2]=*(pixbuf+2);
-+}
-+
-+static void setImageRGB(byte *targa_rgba, int x, int y, int columns, int rows, vec3_t rgb)
-+{
-+ byte *pixbuf;
-+
-+ //x*=((x<0)?-1:1);
-+ //y*=((y<0)?-1:1);
-+
-+ pixbuf = targa_rgba + y*columns*4 + (x*4);
-+
-+ *pixbuf=(byte)(rgb[0]);
-+ *(pixbuf+1)=(byte)(rgb[1]);
-+ *(pixbuf+2)=(byte)(rgb[2]);
-+}
-+
-+/****************************
-+NO BRAINER'S BLUR
-+****************************/
-+static void blur(int columns, int rows, byte *targa_rgba)
-+{
-+ int row, column;
-+ float sum;
-+
-+
-+ for(row=0; row<rows; row++)
-+ {
-+ //pixbuf = targa_rgba + row*columns*4;
-+ for(column=0; column<columns; column++)
-+ {
-+ sum=0;
-+ sum+=getImageR(targa_rgba,column-1,row-1,columns,rows);
-+ sum+=getImageR(targa_rgba,column,row-1,columns,rows);
-+ sum+=getImageR(targa_rgba,column+1,row-1,columns,rows);
-+ sum+=getImageR(targa_rgba,column-1,row,columns,rows);
-+ sum+=getImageR(targa_rgba,column,row,columns,rows);
-+ sum+=getImageR(targa_rgba,column+1,row,columns,rows);
-+ sum+=getImageR(targa_rgba,column-1,row+1,columns,rows);
-+ sum+=getImageR(targa_rgba,column,row+1,columns,rows);
-+ sum+=getImageR(targa_rgba,column+1,row+1,columns,rows);
-+
-+ sum/=9.0f;
-+
-+ setImageR(targa_rgba, column, row, columns, rows, (byte)sum);
-+ ////////////////////
-+ sum=0;
-+ sum+=getImageG(targa_rgba,column-1,row-1,columns,rows);
-+ sum+=getImageG(targa_rgba,column,row-1,columns,rows);
-+ sum+=getImageG(targa_rgba,column+1,row-1,columns,rows);
-+ sum+=getImageG(targa_rgba,column-1,row,columns,rows);
-+ sum+=getImageG(targa_rgba,column,row,columns,rows);
-+ sum+=getImageG(targa_rgba,column+1,row,columns,rows);
-+ sum+=getImageG(targa_rgba,column-1,row+1,columns,rows);
-+ sum+=getImageG(targa_rgba,column,row+1,columns,rows);
-+ sum+=getImageG(targa_rgba,column+1,row+1,columns,rows);
-+
-+ sum/=9.0f;
-+
-+ setImageG(targa_rgba, column, row, columns, rows, (byte)sum);
-+ ////////////////////////
-+ sum=0;
-+ sum+=getImageB(targa_rgba,column-1,row-1,columns,rows);
-+ sum+=getImageB(targa_rgba,column,row-1,columns,rows);
-+ sum+=getImageB(targa_rgba,column+1,row-1,columns,rows);
-+ sum+=getImageB(targa_rgba,column-1,row,columns,rows);
-+ sum+=getImageB(targa_rgba,column,row,columns,rows);
-+ sum+=getImageB(targa_rgba,column+1,row,columns,rows);
-+ sum+=getImageB(targa_rgba,column-1,row+1,columns,rows);
-+ sum+=getImageB(targa_rgba,column,row+1,columns,rows);
-+ sum+=getImageB(targa_rgba,column+1,row+1,columns,rows);
-+
-+ sum/=9.0f;
-+
-+ setImageB(targa_rgba, column, row, columns, rows, (byte)sum);
-+
-+ // "halftoning"
-+ /*if((row%5==0)&&(column%5==1))
-+ {
-+ gris=0;
-+ gris+=red;
-+ gris+=green;
-+ gris+=blue;
-+ gris/=3;
-+
-+ gris=255-gris;
-+ if(gris<0)
-+ gris=0;
-+
-+ setImageR(targa_rgba, column, row, columns, rows, (byte)gris);
-+ setImageG(targa_rgba, column, row, columns, rows, (byte)gris);
-+ setImageB(targa_rgba, column, row, columns, rows, (byte)gris);
-+
-+ }*/
-+
-+ }
-+ }
-+
-+}
-+
-+
-+/****************************
-+COLORED LIGHTMAP
-+****************************/
-+void whiteTextureOne(int columns, int rows, byte *targa_rgba){
-+ //byte *pixbyf;
-+ int row, column;
-+ long rMean=0, gMean=0, bMean=0;
-+ int pixels=0;
-+
-+ for(row=0;row<rows;row++){
-+ for(column=0;column<columns;column++){
-+ // Don't count fully transparent pixels
-+ if(getImageA(targa_rgba,column,row,columns,rows)==0)
-+ continue;
-+ // Sum pixels values
-+ rMean+=getImageR(targa_rgba,column,row,columns,rows);
-+ gMean+=getImageG(targa_rgba,column,row,columns,rows);
-+ bMean+=getImageB(targa_rgba,column,row,columns,rows);
-+ pixels++;
-+ }
-+ }
-+
-+ // Calculate average
-+ if(pixels>0){
-+ rMean=((float)rMean/(float)pixels);
-+ gMean=((float)gMean/(float)pixels);
-+ bMean=((float)bMean/(float)pixels);
-+ }
-+ else{
-+ return;
-+ }
-+
-+ for(row=0;row<rows;row++){
-+ for(column=0;column<columns;column++){
-+ if(getImageA(targa_rgba,column,row,columns,rows)<32)
-+ continue;
-+ setImageR(targa_rgba,column,row,columns,rows,rMean);
-+ setImageG(targa_rgba,column,row,columns,rows,gMean);
-+ setImageB(targa_rgba,column,row,columns,rows,bMean);
-+ }
-+ }
-+}
-+
-+int diffSquare(int mean, int val){
-+ float variance = (val-mean)/255.0f;
-+ float radius = mean<128?mean:255-mean;
-+ return mean+(radius*variance);
-+}
-+
-+/****************************
-+DECONTRAST
-+****************************/
-+void whiteTextureTwo(int columns, int rows, byte *targa_rgba){
-+ int row, column;
-+ long rMean=0, gMean=0, bMean=0;
-+ int r=0, g=0, b=0;
-+ int pixels=0;
-+
-+
-+ for(row=0;row<rows;row++){
-+ for(column=0;column<columns;column++){
-+ // Don't count fully transparent pixels
-+ if(getImageA(targa_rgba,column,row,columns,rows)<32)
-+ continue;
-+ // Sum pixels values
-+ rMean+=getImageR(targa_rgba,column,row,columns,rows);
-+ gMean+=getImageG(targa_rgba,column,row,columns,rows);
-+ bMean+=getImageB(targa_rgba,column,row,columns,rows);
-+ pixels++;
-+ }
-+ }
-+
-+ // Calculate average
-+ if(pixels>0){
-+ rMean=rMean/pixels;
-+ gMean=gMean/pixels;
-+ bMean=bMean/pixels;
-+ }
-+ else{
-+ return;
-+ }
-+
-+
-+ for(row=0;row<rows;row++){
-+ for(column=0;column<columns;column++){
-+ if(getImageA(targa_rgba,column,row,columns,rows)<32)
-+ continue;
-+ r=getImageR(targa_rgba,column,row,columns,rows);
-+ g=getImageG(targa_rgba,column,row,columns,rows);
-+ b=getImageB(targa_rgba,column,row,columns,rows);
-+
-+ setImageR(targa_rgba,column,row,columns,rows,diffSquare(rMean,r));
-+ setImageG(targa_rgba,column,row,columns,rows,diffSquare(gMean,g));
-+ setImageB(targa_rgba,column,row,columns,rows,diffSquare(bMean,b));
-+
-+ }
-+ }
-+}
-+
-+/****************************
-+KUWAHARA ,FAILS SOMEWHERE
-+****************************/
-+#define KWH_RADIUS 2
-+static void mean_variance(int x0, int y0, int x1, int y1, int columns, int rows, byte *targa_rgba, vec4_t mv )
-+{
-+ short min=255*3, max=0;
-+ unsigned short count= 0;
-+ short row, column;
-+ unsigned short value;
-+ vec3_t rgb;
-+
-+ mv[0]=mv[1]=mv[2]=mv[3]=0;
-+
-+ for(row=y0;row<=y1;row++)
-+ {
-+ for(column=x0;column<=x1;column++)
-+ {
-+ getImageRGB(targa_rgba,column,row,columns,rows,rgb);
-+
-+ VectorAdd(mv,rgb,mv);
-+
-+ count++;
-+ value=rgb[0]+rgb[1]+rgb[2];
-+ if(value<min) min=value;
-+ if(value>max) max=value;
-+ }
-+ }
-+
-+ mv[0]/=count;
-+ mv[1]/=count;
-+ mv[2]/=count;
-+ mv[3]= (max-min)/3.0f;
-+}
-+
-+
-+static void rgb_kuwahara(int x, int y, int columns, int rows, byte *targa_rgba, vec4_t bmv)
-+{
-+ vec4_t mv;
-+ bmv[0]=bmv[1]=bmv[2]=bmv[3]=255;
-+
-+ mean_variance(x-KWH_RADIUS, y-KWH_RADIUS, x, y, columns, rows, targa_rgba, mv);
-+ if( mv[3] < bmv[3] )
-+ {
-+ Vector4Copy(mv,bmv);
-+ }
-+
-+ mean_variance(x, y-KWH_RADIUS, x+KWH_RADIUS, y, columns, rows, targa_rgba, mv);
-+ if( mv[3] < bmv[3] )
-+ {
-+ Vector4Copy(mv,bmv);
-+ }
-+
-+ mean_variance(x, y, x+KWH_RADIUS, y+KWH_RADIUS, columns, rows, targa_rgba, mv);
-+ if( mv[3] < bmv[3] )
-+ {
-+ Vector4Copy(mv,bmv);
-+ }
-+
-+ mean_variance(x-KWH_RADIUS, y, x, y+KWH_RADIUS, columns, rows, targa_rgba, mv);
-+ if( mv[3] < bmv[3] )
-+ {
-+ Vector4Copy(mv,bmv);
-+ }
-+}
-+
-+static void kuwahara(int columns, int rows, byte *targa_rgba){
-+ int row, column;
-+ vec4_t rgbv;
-+
-+ for(row=0;row<rows;row++){
-+ for(column=0;column<columns;column++){
-+ rgb_kuwahara(column, row, columns, rows, targa_rgba, rgbv);
-+ setImageRGB(targa_rgba,column,row,columns,rows,rgbv);
-+ }
-+ }
-+}
-+
-+
-+#define FLT_MAX 3.40282346638528860000e+38
-+static void kuwahara3(int columns, int rows, byte *targa_rgba)
-+{
-+ byte channel;
-+ int size = 10;
-+ int index1,index2;
-+ int width = columns-4;
-+ int height = rows-4;
-+ int size2 = (size+1)/2;
-+ int offset = (size-1)/2;
-+ const int width2 = columns + offset;
-+ const int height2 = rows + offset;
-+ int x1start = 4;
-+ int y1start = 4;
-+ int x2, y2;
-+ int sum, sum2, n, v=0, xbase, ybase;
-+ int y1,x1;
-+ int xbase2=0, ybase2=0;
-+ float var, min;
-+ float** mean, **variance;
-+
-+ //blur(columns, rows, targa_rgba);
-+
-+ // I hate malloc I hate malloc I hate malloc I hate malloc I hate malloc I hate malloc
-+ mean = (float**)malloc(sizeof(float*)*width2);
-+ for(index1=0;index1<width2;index1++)
-+ mean[index1] = (float*)malloc(sizeof(float)*height2);
-+
-+ variance = (float**)malloc(sizeof(float*)*width2);
-+ for(index2=0;index2<width2;index2++)
-+ variance[index2] = (float*)malloc(sizeof(float)*height2);
-+
-+ // For each channel (R,G,B)
-+ // for(channel=0;channel<2;channel++)
-+ // FTL
-+ for(channel=0;channel<3;channel++){
-+ for (y1=y1start-offset; y1<y1start+height; y1++) {
-+
-+ for (x1=x1start-offset; x1<x1start+width; x1++) {
-+ sum=0; sum2=0; n=0;
-+ for (x2=x1; x2<x1+size2; x2++) {
-+ for (y2=y1; y2<y1+size2; y2++) {
-+ //v = i(x2, y2);
-+ switch(channel){
-+ case 0:
-+ v = getImageR(targa_rgba,x2,y2,columns,rows);
-+ break;
-+ case 1:
-+ v = getImageG(targa_rgba,x2,y2,columns,rows);
-+ break;
-+ case 2:
-+ v = getImageB(targa_rgba,x2,y2,columns,rows);
-+ break;
-+ }
-+ //v = *targa_rgba + y2*columns*4+x2*4;
-+ v/=10;
-+ v*=10;
-+ sum += v;
-+ sum2 += v*v;
-+ n++;
-+ }
-+ }
-+ //cerr << "Accedo" << endl;
-+ mean[x1+offset][y1+offset] = (float)(sum/n);
-+ variance[x1+offset][y1+offset] = (float)((n*sum2-sum*sum)/n);
-+ }
-+ }
-+
-+ for (y1=y1start; y1<y1start+height; y1++) {
-+ /*if ((y1%20)==0)
-+ cout << (0.7+0.3*(y1-y1start)/height);*/
-+ for (x1=x1start; x1<x1start+width; x1++) {
-+ min = FLT_MAX;
-+ xbase = x1; ybase=y1;
-+ var = variance[xbase][ybase];
-+ if (var<min){
-+ min= var;
-+ xbase2=xbase;
-+ ybase2=ybase;
-+ }
-+ xbase = x1+offset;
-+ var = variance[xbase][ybase];
-+ if (var<min){
-+ min= var;
-+ xbase2=xbase;
-+ ybase2=ybase;
-+ }
-+ ybase = y1+offset;
-+ var = variance[xbase][ybase];
-+ if (var<min){
-+ min= var;
-+ xbase2=xbase;
-+ ybase2=ybase;
-+ }
-+ xbase = x1;
-+ var = variance[xbase][ybase];
-+ if (var<min){
-+ min= var;
-+ xbase2=xbase;
-+ ybase2=ybase;
-+ }
-+ //i(x1, y1)=(int)(mean[xbase2][ybase2]+0.5);
-+ switch(channel){
-+ case 0:
-+ setImageR(targa_rgba,x1,y1,columns,rows,(byte)(mean[xbase2][ybase2]+0.5));
-+ break;
-+ case 1:
-+ setImageG(targa_rgba,x1,y1,columns,rows,(byte)(mean[xbase2][ybase2]+0.5));
-+ break;
-+ case 2:
-+ setImageB(targa_rgba,x1,y1,columns,rows,(byte)(mean[xbase2][ybase2]+0.5));
-+ break;
-+ }
-+ }
-+ }
-+ }
-+ // Fuck mean & variance, this is hell (!+) Bad Religion
-+ for(index1=0;index1<width2;index1++)
-+ free(mean[index1]);
-+ free(mean);
-+
-+ for(index2=0;index2<width2;index2++)
-+ free(variance[index2]);
-+ free(variance);
-+
-+ //blur(columns, rows, targa_rgba);
-+}
-+
-+/****************************
-+Symmetric Nearest Neighbour
-+****************************/
-+
-+#define SNN_RADIUS 3
-+
-+static int deltaE(int l1,int a1,int b1,int l2,int a2,int b2)
-+{
-+ return (l1-l2)*(l1-l2) + (a1-a2)*(a1-a2) + (b1-b2)*(b1-b2);
-+}
-+
-+static void snn(int columns, int rows, byte *targa_rgba)
-+{
-+
-+ int row, column;
-+ unsigned short sumR, sumG, sumB;
-+ unsigned short count;
-+ short u, v;
-+ byte r, g, b;
-+ byte r1, g1, b1;
-+ byte r2, g2, b2;
-+ for(row=0;row<rows;row++){
-+ for(column=0;column<columns;column++){
-+ sumR=0;
-+ sumG=0;
-+ sumB=0;
-+ count=0;
-+
-+ r=getImageR(targa_rgba,column,row,columns,rows);
-+ g=getImageG(targa_rgba,column,row,columns,rows);
-+ b=getImageB(targa_rgba,column,row,columns,rows);
-+
-+ for(v=-SNN_RADIUS;v<=0;v++)
-+ {
-+ for(u=-SNN_RADIUS;u<=SNN_RADIUS;u++)
-+ {
-+ if(v==0&&u>=0) break;
-+ // Sum pixels values
-+ r1=getImageR(targa_rgba,column+u,row+v,columns,rows);
-+ g1=getImageG(targa_rgba,column+u,row+v,columns,rows);
-+ b1=getImageB(targa_rgba,column+u,row+v,columns,rows);
-+
-+ r2=getImageR(targa_rgba,column-u,row-v,columns,rows);
-+ g2=getImageG(targa_rgba,column-u,row-v,columns,rows);
-+ b2=getImageB(targa_rgba,column-u,row-v,columns,rows);
-+
-+ if ( deltaE(r,g,b,r1,g1,b1) < deltaE(r,g,b,r2,g2,b2))
-+ {
-+ sumR += r1;
-+ sumG += g1;
-+ sumB += b1;
-+ }
-+ else
-+ {
-+ sumR += r2;
-+ sumG += g2;
-+ sumB += b2;
-+ }
-+ count++;
-+ }
-+ }
-+
-+ r=(byte)((int)(2*sumR+r)/(int)(2*count+1));
-+ g=(byte)((int)(2*sumG+g)/(int)(2*count+1));
-+ b=(byte)((int)(2*sumB+b)/(int)(2*count+1));
-+
-+ setImageR(targa_rgba,column,row,columns,rows,r);
-+ setImageG(targa_rgba,column,row,columns,rows,g);
-+ setImageB(targa_rgba,column,row,columns,rows,b);
-+ }
-+ }
-+}
-+
-+
-+
- /*
- =========================================================
-
-@@ -1968,6 +2621,50 @@
- } else if ( !Q_stricmp( name+len-4, ".jpg" ) ) {
- LoadJPG( name, pic, width, height );
- }
-+
-+ switch(r_celshadalgo->integer)
-+ {
-+ case 1:
-+ whiteTextureOne(*width,*height,*pic);
-+ break;
-+ case 2:
-+ whiteTextureTwo(*width,*height,*pic);
-+ break;
-+ case 10:
-+ kuwahara(*width,*height,*pic);
-+ break;
-+ case 11:
-+ blur(*width,*height,*pic);
-+ kuwahara(*width,*height,*pic);
-+ break;
-+ case 12:
-+ kuwahara(*width,*height,*pic);
-+ blur(*width,*height,*pic);
-+ break;
-+ case 13:
-+ blur(*width,*height,*pic);
-+ kuwahara(*width,*height,*pic);
-+ blur(*width,*height,*pic);
-+ break;
-+ case 20:
-+ snn(*width,*height,*pic);
-+ break;
-+ case 21:
-+ blur(*width,*height,*pic);
-+ snn(*width,*height,*pic);
-+ break;
-+ case 22:
-+ snn(*width,*height,*pic);
-+ blur(*width,*height,*pic);
-+ break;
-+ case 23:
-+ blur(*width,*height,*pic);
-+ snn(*width,*height,*pic);
-+ blur(*width,*height,*pic);
-+ break;
-+ default:
-+ break;
-+ }
- }
-
-
-Index: code/renderer/tr_init.c
-===================================================================
---- code/renderer/tr_init.c (revision 933)
-+++ code/renderer/tr_init.c (working copy)
-@@ -111,6 +111,10 @@
- cvar_t *r_roundImagesDown;
- cvar_t *r_colorMipLevels;
- cvar_t *r_picmip;
-+// Next one added for cell shading algorithm selection
-+cvar_t *r_celshadalgo;
-+//. next one for enable/disable cel bordering all together.
-+cvar_t *r_celoutline;
- cvar_t *r_showtris;
- cvar_t *r_showsky;
- cvar_t *r_shownormals;
-@@ -1110,6 +1114,10 @@
- r_debugSurface = ri.Cvar_Get ("r_debugSurface", "0", CVAR_CHEAT);
- r_nobind = ri.Cvar_Get ("r_nobind", "0", CVAR_CHEAT);
- r_showtris = ri.Cvar_Get ("r_showtris", "0", CVAR_CHEAT);
-+ // for cell shading algorithm selection
-+ r_celshadalgo = ri.Cvar_Get ("r_celshadalgo", "1", CVAR_LATCH);
-+ // cel outline option
-+ r_celoutline = ri.Cvar_Get("r_celoutline","1", CVAR_ARCHIVE);
- r_showsky = ri.Cvar_Get ("r_showsky", "0", CVAR_CHEAT);
- r_shownormals = ri.Cvar_Get ("r_shownormals", "0", CVAR_CHEAT);
- r_clear = ri.Cvar_Get ("r_clear", "0", CVAR_CHEAT);
-Index: code/renderer/tr_local.h
-===================================================================
---- code/renderer/tr_local.h (revision 933)
-+++ code/renderer/tr_local.h (working copy)
-@@ -1063,6 +1063,8 @@
- extern cvar_t *r_uiFullScreen; // ui is running fullscreen
-
- extern cvar_t *r_logFile; // number of frames to emit GL logs
-+extern cvar_t *r_celshadalgo; // Cell shading, chooses method: 0 = disabled, 1 = kuwahara, 2 = whiteTexture
-+extern cvar_t *r_celoutline; //. cel outline. 1 on, 0 off. (maybe other options later)
- extern cvar_t *r_showtris; // enables wireframe rendering of the world
- extern cvar_t *r_showsky; // forces sky in front of all surfaces
- extern cvar_t *r_shownormals; // draws wireframe normals
-Index: code/renderer/tr_shade.c
-===================================================================
---- code/renderer/tr_shade.c (revision 933)
-+++ code/renderer/tr_shade.c (working copy)
-@@ -201,6 +201,86 @@
- }
-
-
-+//R_DRAWCEL
-+static void R_DrawCel( int numIndexes, const glIndex_t *indexes ) {
-+ int primitives;
-+
-+ if(
-+ //. ignore the 2d projection. do i smell the HUD?
-+ (backEnd.projection2D == qtrue) ||
-+ //. ignore general entitites that are sprites. SEE NOTE #3.
-+ (backEnd.currentEntity->e.reType == RT_SPRITE) ||
-+ //. ignore these liquids. why? ever see liquid with tris on the surface? exactly. SEE NOTE #4.
-+ (tess.shader->contentFlags & (CONTENTS_WATER | CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_FOG)) ||
-+ //. ignore things that are two sided, meaning mostly things that have transparency. SEE NOTE #1.
-+ (tess.shader->cullType == CT_TWO_SIDED)
-+
-+ ) {
-+ return;
-+ }
-+
-+ primitives = r_primitives->integer;
-+
-+ // default is to use triangles if compiled vertex arrays are present
-+ if ( primitives == 0 ) {
-+ if ( qglLockArraysEXT ) {
-+ primitives = 2;
-+ } else {
-+ primitives = 1;
-+ }
-+ }
-+
-+ //. correction for mirrors. SEE NOTE #2.
-+ if(backEnd.viewParms.isMirror == qtrue) { qglCullFace (GL_FRONT); }
-+ else { qglCullFace (GL_BACK); }
-+
-+ qglEnable (GL_BLEND);
-+ qglBlendFunc (GL_SRC_ALPHA ,GL_ONE_MINUS_SRC_ALPHA);
-+ qglColor3f (0.0f,0.0f,0.0f);
-+ qglLineWidth( (float) r_celoutline->integer );
-+
-+ if(primitives == 2) {
-+ qglDrawElements( GL_TRIANGLES, numIndexes, GL_INDEX_TYPE, indexes );
-+ } else if(primitives == 1) {
-+ R_DrawStripElements( numIndexes, indexes, qglArrayElement );
-+ } else if(primitives == 3) {
-+ R_DrawStripElements( numIndexes, indexes, R_ArrayElementDiscrete );
-+ }
-+
-+ //. correction for mirrors. SEE NOTE #2.
-+ if(backEnd.viewParms.isMirror == qtrue) { qglCullFace (GL_BACK); }
-+ else { qglCullFace (GL_FRONT); }
-+
-+ qglDisable (GL_BLEND);
-+
-+ return;
-+
-+/* Notes
-+
-+1. this is going to be a pain in the arse. it fixes things like light `beams` from being cel'd but it
-+also will ignore any other shader set with no culling. this usually is everything that is translucent.
-+but this is a good hack to clean up the screen untill something more selective comes along. or who knows
-+group desision might actually be that this is liked. if so i take back calling it a `hack`, lol.
-+ = bob.
-+
-+2. mirrors display correctly because the normals of the displayed are inverted of normal space. so to
-+continue to have them display correctly, we must invert them inversely from a normal inversion.
-+ = bob.
-+
-+3. this turns off a lot of space hogging sprite cel outlines. picture if you will five people in a small
-+room all shooting rockets. each smoke puff gets a big black square around it, each explosion gets a big
-+black square around it, and now nobody can see eachother because everyones screen is solid black.
-+ = bob.
-+
-+4. ignoring liquids means you will not get black tris lines all over the top of your liquid. i put this in
-+after seeing the lava on q3dm7 and water on q3ctf2 that had black lines all over the top, making the
-+liquids look solid instead of... liquid.
-+ = bob.
-+
-+*/
-+}
-+
-+
- /*
- =============================================================
-
-@@ -245,6 +325,33 @@
- GL_Bind( bundle->image[ index ] );
- }
-
-+//DRAWCEL
-+static void DrawCel (shaderCommands_t *input) {
-+
-+ GL_Bind( tr.whiteImage );
-+ qglColor3f (1,1,1);
-+
-+ GL_State( GLS_POLYMODE_LINE | GLS_DEPTHMASK_TRUE );
-+
-+ qglDisableClientState (GL_COLOR_ARRAY);
-+ qglDisableClientState (GL_TEXTURE_COORD_ARRAY);
-+
-+ qglVertexPointer (3, GL_FLOAT, 16, input->xyz); // padded for SIMD
-+
-+ if (qglLockArraysEXT) {
-+ qglLockArraysEXT(0, input->numVertexes);
-+ GLimp_LogComment( "glLockArraysEXT\n" );
-+ }
-+
-+ R_DrawCel( input->numIndexes, input->indexes );
-+
-+ if (qglUnlockArraysEXT) {
-+ qglUnlockArraysEXT();
-+ GLimp_LogComment( "glUnlockArraysEXT\n" );
-+ }
-+
-+}
-+
- /*
- ================
- DrawTris
-@@ -1140,6 +1247,12 @@
- qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value );
- }
-
-+ //. show me cel outlines.
-+ //. there has to be a better place to put this.
-+ if(r_celoutline->integer > 0) {
-+ DrawCel(&tess);
-+ }
-+
- //
- // if there is only a single pass then we can enable color
- // and texture arrays before we compile, otherwise we need
-Index: code/renderer/tr_shader.c
-===================================================================
---- code/renderer/tr_shader.c (revision 933)
-+++ code/renderer/tr_shader.c (working copy)
-@@ -2744,7 +2744,17 @@
- */
- qhandle_t RE_RegisterShaderNoMip( const char *name ) {
- shader_t *sh;
-+ // Remember previous value
-+ int old_r_celshadalgo;
-
-+ /*
-+ * This will prevent sprites, like buttons, go through
-+ * cel shading filters, like kuwahara.
-+ * @author gmiranda
-+ */
-+ old_r_celshadalgo = r_celshadalgo->integer;
-+ r_celshadalgo->integer=0;
-+
- if ( strlen( name ) >= MAX_QPATH ) {
- Com_Printf( "Shader name exceeds MAX_QPATH\n" );
- return 0;
-@@ -2752,6 +2762,9 @@
-
- sh = R_FindShader( name, LIGHTMAP_2D, qfalse );
-
-+ // Restore value
-+ r_celshadalgo->integer=old_r_celshadalgo;
-+
- // we want to return 0 if the shader failed to
- // load for some reason, but R_FindShader should
- // still keep a name allocated for it, so if
diff --git a/games/iourbanterror/files/extra-patch-mp3 b/games/iourbanterror/files/extra-patch-mp3
deleted file mode 100644
index b33f2a660571..000000000000
--- a/games/iourbanterror/files/extra-patch-mp3
+++ /dev/null
@@ -1,753 +0,0 @@
-Index: code/client/snd_codec.c
-===================================================================
---- code/client/snd_codec.c (revision 917)
-+++ code/client/snd_codec.c (working copy)
-@@ -105,6 +105,9 @@
- #if USE_CODEC_VORBIS
- S_CodecRegister(&ogg_codec);
- #endif
-+#if USE_CODEC_MP3
-+ S_CodecRegister(&mp3_codec);
-+#endif
- }
-
- /*
-Index: code/client/snd_codec.h
-===================================================================
---- code/client/snd_codec.h (revision 917)
-+++ code/client/snd_codec.h (working copy)
-@@ -95,4 +95,13 @@
- int S_OGG_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer);
- #endif // USE_CODEC_VORBIS
-
-+// MP3 codec
-+#ifdef USE_CODEC_MP3
-+extern snd_codec_t mp3_codec;
-+void *S_MP3_CodecLoad(const char *filename, snd_info_t *info);
-+snd_stream_t *S_MP3_CodecOpenStream(const char *filename);
-+void S_MP3_CodecCloseStream(snd_stream_t *stream);
-+int S_MP3_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer);
-+#endif // USE_CODEC_MP3
-+
- #endif // !_SND_CODEC_H_
-Index: code/client/snd_codec_mp3.c
-===================================================================
---- code/client/snd_codec_mp3.c (revision 0)
-+++ code/client/snd_codec_mp3.c (revision 0)
-@@ -0,0 +1,716 @@
-+/*
-+===========================================================================
-+Copyright (C) 1999-2005 Id Software, Inc.
-+Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
-+Copyright (C) 2005-2006 Joerg Dietrich <dietrich_joerg@gmx.de>
-+Copyright (C) 2006 Thilo Schulz <arny@ats.s.bawue.de>
-+
-+This file is part of Quake III Arena source code.
-+
-+Quake III Arena source code 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.
-+
-+Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
-+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-+===========================================================================
-+*/
-+
-+// MP3 support is enabled by this define
-+#if USE_CODEC_MP3
-+
-+// includes for the Q3 sound system
-+#include "client.h"
-+#include "snd_codec.h"
-+
-+// includes for the MP3 codec
-+#include <mad.h>
-+
-+#define MP3_SAMPLE_WIDTH 2
-+#define MP3_PCMSAMPLES_PERSLICE 32
-+
-+// buffer size used when reading through the mp3
-+#define MP3_DATA_BUFSIZ 128*1024
-+
-+// undefine this if you don't want any dithering.
-+#define MP3_DITHERING
-+
-+// Q3 MP3 codec
-+snd_codec_t mp3_codec =
-+{
-+ ".mp3",
-+ S_MP3_CodecLoad,
-+ S_MP3_CodecOpenStream,
-+ S_MP3_CodecReadStream,
-+ S_MP3_CodecCloseStream,
-+ NULL
-+};
-+
-+// structure used for info purposes
-+struct snd_codec_mp3_info
-+{
-+ byte encbuf[MP3_DATA_BUFSIZ]; // left over bytes not consumed
-+ // by the decoder.
-+ struct mad_stream madstream; // uses encbuf as buffer.
-+ struct mad_frame madframe; // control structures for libmad.
-+ struct mad_synth madsynth;
-+
-+ byte *pcmbuf; // buffer for not-used samples.
-+ int buflen; // length of buffer data.
-+ int pcmbufsize; // amount of allocated memory for
-+ // pcmbuf. This should have at least
-+ // the size of a decoded mp3 frame.
-+
-+ byte *dest; // copy decoded data here.
-+ int destlen; // amount of already copied data.
-+ int destsize; // amount of bytes we must decode.
-+};
-+
-+/*************** MP3 utility functions ***************/
-+
-+/*
-+=================
-+S_MP3_ReadData
-+=================
-+*/
-+
-+// feed libmad with data
-+int S_MP3_ReadData(snd_stream_t *stream, struct mad_stream *madstream, byte *encbuf, int encbufsize)
-+{
-+ int retval;
-+ int leftover;
-+
-+ if(!stream)
-+ return -1;
-+
-+ leftover = madstream->bufend - madstream->next_frame;
-+ if(leftover > 0)
-+ memmove(encbuf, madstream->this_frame, leftover);
-+
-+
-+ // Fill the buffer right to the end
-+
-+ retval = FS_Read(&encbuf[leftover], encbufsize - leftover, stream->file);
-+
-+ if(retval <= 0)
-+ {
-+ // EOF reached, that's ok.
-+ return 0;
-+ }
-+
-+ mad_stream_buffer(madstream, encbuf, retval + leftover);
-+
-+ return retval;
-+}
-+
-+
-+/*
-+=================
-+S_MP3_Scanfile
-+
-+to determine the samplecount, we apparently must get *all* headers :(
-+I basically used the xmms-mad plugin source to see how this stuff works.
-+
-+returns a value < 0 on error.
-+=================
-+*/
-+
-+int S_MP3_Scanfile(snd_stream_t *stream)
-+{
-+ struct mad_stream madstream;
-+ struct mad_header madheader;
-+ int retval;
-+ int samplecount;
-+ byte encbuf[MP3_DATA_BUFSIZ];
-+
-+ // error out on invalid input.
-+ if(!stream)
-+ return -1;
-+
-+ mad_stream_init(&madstream);
-+ mad_header_init(&madheader);
-+
-+ while(1)
-+ {
-+ retval = S_MP3_ReadData(stream, &madstream, encbuf, sizeof(encbuf));
-+ if(retval < 0)
-+ return -1;
-+ else if(retval == 0)
-+ break;
-+
-+ // Start decoding the headers.
-+ while(1)
-+ {
-+ if((retval = mad_header_decode(&madheader, &madstream)) < 0)
-+ {
-+ if(madstream.error == MAD_ERROR_BUFLEN)
-+ {
-+ // We need to read more data
-+ break;
-+ }
-+
-+ if(!MAD_RECOVERABLE (madstream.error))
-+ {
-+ // unrecoverable error... we must bail out.
-+ return retval;
-+ }
-+
-+ mad_stream_skip(&madstream, madstream.skiplen);
-+ continue;
-+ }
-+
-+ // we got a valid header.
-+
-+ if(madheader.layer != MAD_LAYER_III)
-+ {
-+ // we don't support non-mp3s
-+ return -1;
-+ }
-+
-+ if(!stream->info.samples)
-+ {
-+ // This here is the very first frame. Set initial values now,
-+ // that we expect to stay constant throughout the whole mp3.
-+
-+ stream->info.rate = madheader.samplerate;
-+ stream->info.width = MP3_SAMPLE_WIDTH;
-+ stream->info.channels = MAD_NCHANNELS(&madheader);
-+ stream->info.samples = 0;
-+ stream->info.size = 0; // same here.
-+ stream->info.dataofs = 0;
-+ }
-+ else
-+ {
-+ // Check whether something changed that shouldn't.
-+
-+ if(stream->info.rate != madheader.samplerate ||
-+ stream->info.channels != MAD_NCHANNELS(&madheader))
-+ return -1;
-+ }
-+
-+ // Update the counters
-+ samplecount = MAD_NSBSAMPLES(&madheader) * MP3_PCMSAMPLES_PERSLICE;
-+ stream->info.samples += samplecount;
-+ stream->info.size += samplecount * stream->info.channels * stream->info.width;
-+ }
-+ }
-+
-+ // Reset the file pointer so we can do the real decoding.
-+ FS_Seek(stream->file, 0, FS_SEEK_SET);
-+
-+ return 0;
-+}
-+
-+/************************ dithering functions ***************************/
-+
-+#ifdef MP3_DITHERING
-+
-+// All dithering done here is taken from the GPL'ed xmms-mad plugin.
-+
-+/* Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. */
-+/* Any feedback is very welcome. For any question, comments, */
-+/* see http://www.math.keio.ac.jp/matumoto/emt.html or email */
-+/* matumoto@math.keio.ac.jp */
-+
-+/* Period parameters */
-+#define MP3_DITH_N 624
-+#define MP3_DITH_M 397
-+#define MATRIX_A 0x9908b0df /* constant vector a */
-+#define UPPER_MASK 0x80000000 /* most significant w-r bits */
-+#define LOWER_MASK 0x7fffffff /* least significant r bits */
-+
-+/* Tempering parameters */
-+#define TEMPERING_MASK_B 0x9d2c5680
-+#define TEMPERING_MASK_C 0xefc60000
-+#define TEMPERING_SHIFT_U(y) (y >> 11)
-+#define TEMPERING_SHIFT_S(y) (y << 7)
-+#define TEMPERING_SHIFT_T(y) (y << 15)
-+#define TEMPERING_SHIFT_L(y) (y >> 18)
-+
-+static unsigned long mt[MP3_DITH_N]; /* the array for the state vector */
-+static int mti=MP3_DITH_N+1; /* mti==MP3_DITH_N+1 means mt[MP3_DITH_N] is not initialized */
-+
-+/* initializing the array with a NONZERO seed */
-+void sgenrand(unsigned long seed)
-+{
-+ /* setting initial seeds to mt[MP3_DITH_N] using */
-+ /* the generator Line 25 of Table 1 in */
-+ /* [KNUTH 1981, The Art of Computer Programming */
-+ /* Vol. 2 (2nd Ed.), pp102] */
-+ mt[0]= seed & 0xffffffff;
-+ for (mti=1; mti<MP3_DITH_N; mti++)
-+ mt[mti] = (69069 * mt[mti-1]) & 0xffffffff;
-+}
-+
-+unsigned long genrand(void)
-+{
-+ unsigned long y;
-+ static unsigned long mag01[2]={0x0, MATRIX_A};
-+ /* mag01[x] = x * MATRIX_A for x=0,1 */
-+
-+ if (mti >= MP3_DITH_N) { /* generate MP3_DITH_N words at one time */
-+ int kk;
-+
-+ if (mti == MP3_DITH_N+1) /* if sgenrand() has not been called, */
-+ sgenrand(4357); /* a default initial seed is used */
-+
-+ for (kk=0;kk<MP3_DITH_N-MP3_DITH_M;kk++) {
-+ y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
-+ mt[kk] = mt[kk+MP3_DITH_M] ^ (y >> 1) ^ mag01[y & 0x1];
-+ }
-+ for (;kk<MP3_DITH_N-1;kk++) {
-+ y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
-+ mt[kk] = mt[kk+(MP3_DITH_M-MP3_DITH_N)] ^ (y >> 1) ^ mag01[y & 0x1];
-+ }
-+ y = (mt[MP3_DITH_N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
-+ mt[MP3_DITH_N-1] = mt[MP3_DITH_M-1] ^ (y >> 1) ^ mag01[y & 0x1];
-+
-+ mti = 0;
-+ }
-+
-+ y = mt[mti++];
-+ y ^= TEMPERING_SHIFT_U(y);
-+ y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B;
-+ y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C;
-+ y ^= TEMPERING_SHIFT_L(y);
-+
-+ return y;
-+}
-+
-+long triangular_dither_noise(int nbits) {
-+ // parameter nbits : the peak-to-peak amplitude desired (in bits)
-+ // use with nbits set to 2 + nber of bits to be trimmed.
-+ // (because triangular is made from two uniformly distributed processes,
-+ // it starts at 2 bits peak-to-peak amplitude)
-+ // see The Theory of Dithered Quantization by Robert Alexander Wannamaker
-+ // for complete proof of why that's optimal
-+
-+ long v = (genrand()/2 - genrand()/2); // in ]-2^31, 2^31[
-+ //int signe = (v>0) ? 1 : -1;
-+ long P = 1 << (32 - nbits); // the power of 2
-+ v /= P;
-+ // now v in ]-2^(nbits-1), 2^(nbits-1) [
-+
-+ return v;
-+}
-+
-+#endif // MP3_DITHERING
-+
-+/************************ decoder functions ***************************/
-+
-+/*
-+=================
-+S_MP3_Scale
-+
-+Converts the signal to 16 bit LE-PCM data and does dithering.
-+
-+- borrowed from xmms-mad plugin source.
-+=================
-+*/
-+
-+/*
-+ * xmms-mad - mp3 plugin for xmms
-+ * Copyright (C) 2001-2002 Sam Clegg
-+ */
-+
-+signed int S_MP3_Scale(mad_fixed_t sample)
-+{
-+ int n_bits_to_loose = MAD_F_FRACBITS + 1 - 16;
-+#ifdef MP3_DITHERING
-+ int dither;
-+#endif
-+
-+ // round
-+ sample += (1L << (n_bits_to_loose - 1));
-+
-+#ifdef MP3_DITHERING
-+ dither = triangular_dither_noise(n_bits_to_loose + 1);
-+ sample += dither;
-+#endif
-+
-+ /* clip */
-+ if (sample >= MAD_F_ONE)
-+ sample = MAD_F_ONE - 1;
-+ else if (sample < -MAD_F_ONE)
-+ sample = -MAD_F_ONE;
-+
-+ /* quantize */
-+ return sample >> n_bits_to_loose;
-+}
-+
-+
-+
-+/*
-+=================
-+S_MP3_PCMCopy
-+
-+Copy and convert pcm data until bytecount bytes have been written.
-+return the position in pcm->samples.
-+indicate the amount of actually written bytes in wrotecnt.
-+=================
-+*/
-+
-+int S_MP3_PCMCopy(byte *buf, struct mad_pcm *pcm, int bufofs,
-+ int sampleofs, int bytecount, int *wrotecnt)
-+{
-+ int written = 0;
-+ signed int sample;
-+ int framesize = pcm->channels * MP3_SAMPLE_WIDTH;
-+
-+ // add new pcm data.
-+ while(written < bytecount && sampleofs < pcm->length)
-+ {
-+ sample = S_MP3_Scale(pcm->samples[0][sampleofs]);
-+
-+#ifdef Q3_BIG_ENDIAN
-+ // output to 16 bit big endian PCM
-+ buf[bufofs++] = (sample >> 8) & 0xff;
-+ buf[bufofs++] = sample & 0xff;
-+#else
-+ // output to 16 bit little endian PCM
-+ buf[bufofs++] = sample & 0xff;
-+ buf[bufofs++] = (sample >> 8) & 0xff;
-+#endif
-+
-+ if(pcm->channels == 2)
-+ {
-+ sample = S_MP3_Scale(pcm->samples[1][sampleofs]);
-+
-+#ifdef Q3_BIG_ENDIAN
-+ buf[bufofs++] = (sample >> 8) & 0xff;
-+ buf[bufofs++] = sample & 0xff;
-+#else
-+ buf[bufofs++] = sample & 0xff;
-+ buf[bufofs++] = (sample >> 8) & 0xff;
-+#endif
-+ }
-+
-+ sampleofs++;
-+ written += framesize;
-+ }
-+
-+ if(wrotecnt)
-+ *wrotecnt = written;
-+
-+ return sampleofs;
-+}
-+
-+
-+/*
-+=================
-+S_MP3_Decode
-+=================
-+*/
-+
-+// gets executed for every decoded frame.
-+int S_MP3_Decode(snd_stream_t *stream)
-+{
-+ struct snd_codec_mp3_info *mp3info;
-+ struct mad_stream *madstream;
-+ struct mad_frame *madframe;
-+ struct mad_synth *madsynth;
-+ struct mad_pcm *pcm;
-+ int cursize;
-+ int samplecount;
-+ int needcount;
-+ int wrote;
-+ int retval;
-+
-+ if(!stream)
-+ return -1;
-+
-+ mp3info = stream->ptr;
-+ madstream = &mp3info->madstream;
-+ madframe = &mp3info->madframe;
-+
-+ if(mad_frame_decode(madframe, madstream))
-+ {
-+ if(madstream->error == MAD_ERROR_BUFLEN)
-+ {
-+ // we need more data. Read another chunk.
-+ retval = S_MP3_ReadData(stream, madstream, mp3info->encbuf, sizeof(mp3info->encbuf));
-+
-+ // call myself again now that buffer is full.
-+ if(retval > 0)
-+ retval = S_MP3_Decode(stream);
-+ }
-+ else if(MAD_RECOVERABLE(madstream->error))
-+ {
-+ mad_stream_skip(madstream, madstream->skiplen);
-+ return S_MP3_Decode(stream);
-+ }
-+ else
-+ retval = -1;
-+
-+ return retval;
-+ }
-+
-+ // check whether this really is an mp3
-+ if(madframe->header.layer != MAD_LAYER_III)
-+ return -1;
-+
-+ // generate pcm data
-+ madsynth = &mp3info->madsynth;
-+ mad_synth_frame(madsynth, madframe);
-+
-+ pcm = &madsynth->pcm;
-+
-+ // perform a few checks to see whether something changed that shouldn't.
-+
-+ if(stream->info.rate != pcm->samplerate ||
-+ stream->info.channels != pcm->channels)
-+ {
-+ return -1;
-+ }
-+ // see whether we have got enough data now.
-+ cursize = pcm->length * pcm->channels * stream->info.width;
-+ needcount = mp3info->destsize - mp3info->destlen;
-+
-+ // Copy exactly as many samples as required.
-+ samplecount = S_MP3_PCMCopy(mp3info->dest, pcm,
-+ mp3info->destlen, 0, needcount, &wrote);
-+ mp3info->destlen += wrote;
-+
-+ if(samplecount < pcm->length)
-+ {
-+ // Not all samples got copied. Copy the rest into the pcm buffer.
-+ samplecount = S_MP3_PCMCopy(mp3info->pcmbuf, pcm,
-+ mp3info->buflen,
-+ samplecount,
-+ mp3info->pcmbufsize - mp3info->buflen,
-+ &wrote);
-+ mp3info->buflen += wrote;
-+
-+
-+ if(samplecount < pcm->length)
-+ {
-+ // The pcm buffer was not large enough. Make it bigger.
-+ byte *newbuf = Z_Malloc(cursize);
-+
-+ if(mp3info->pcmbuf)
-+ {
-+ memcpy(newbuf, mp3info->pcmbuf, mp3info->buflen);
-+ Z_Free(mp3info->pcmbuf);
-+ }
-+
-+ mp3info->pcmbuf = newbuf;
-+ mp3info->pcmbufsize = cursize;
-+
-+ samplecount = S_MP3_PCMCopy(mp3info->pcmbuf, pcm,
-+ mp3info->buflen,
-+ samplecount,
-+ mp3info->pcmbufsize - mp3info->buflen,
-+ &wrote);
-+ mp3info->buflen += wrote;
-+ }
-+
-+ // we're definitely done.
-+ retval = 0;
-+ }
-+ else if(mp3info->destlen >= mp3info->destsize)
-+ retval = 0;
-+ else
-+ retval = 1;
-+
-+ return retval;
-+}
-+
-+/*************** Callback functions for quake3 ***************/
-+
-+/*
-+=================
-+S_MP3_CodecOpenStream
-+=================
-+*/
-+
-+snd_stream_t *S_MP3_CodecOpenStream(const char *filename)
-+{
-+ snd_stream_t *stream;
-+ struct snd_codec_mp3_info *mp3info;
-+
-+ // Open the stream
-+ stream = S_CodecUtilOpen(filename, &mp3_codec);
-+ if(!stream || stream->length <= 0)
-+ return NULL;
-+
-+ // We have to scan through the MP3 to determine the important mp3 info.
-+ if(S_MP3_Scanfile(stream) < 0)
-+ {
-+ // scanning didn't work out...
-+ S_CodecUtilClose(stream);
-+ return NULL;
-+ }
-+
-+ // Initialize the mp3 info structure we need for streaming
-+ mp3info = Z_Malloc(sizeof(*mp3info));
-+ if(!mp3info)
-+ {
-+ S_CodecUtilClose(stream);
-+ return NULL;
-+ }
-+
-+ stream->ptr = mp3info;
-+
-+ // initialize the libmad control structures.
-+ mad_stream_init(&mp3info->madstream);
-+ mad_frame_init(&mp3info->madframe);
-+ mad_synth_init(&mp3info->madsynth);
-+
-+ if(S_MP3_ReadData(stream, &mp3info->madstream, mp3info->encbuf, sizeof(mp3info->encbuf)) <= 0)
-+ {
-+ // we didnt read anything, that's bad.
-+ S_MP3_CodecCloseStream(stream);
-+ return NULL;
-+ }
-+
-+ return stream;
-+}
-+
-+/*
-+=================
-+S_MP3_CodecCloseStream
-+=================
-+*/
-+
-+// free all memory we allocated.
-+void S_MP3_CodecCloseStream(snd_stream_t *stream)
-+{
-+ struct snd_codec_mp3_info *mp3info;
-+
-+ if(!stream)
-+ return;
-+
-+ // free all data in our mp3info tree
-+
-+ if(stream->ptr)
-+ {
-+ mp3info = stream->ptr;
-+
-+ if(mp3info->pcmbuf)
-+ Z_Free(mp3info->pcmbuf);
-+
-+ mad_synth_finish(&mp3info->madsynth);
-+ mad_frame_finish(&mp3info->madframe);
-+ mad_stream_finish(&mp3info->madstream);
-+
-+ Z_Free(stream->ptr);
-+ }
-+
-+ S_CodecUtilClose(stream);
-+}
-+
-+/*
-+=================
-+S_MP3_CodecReadStream
-+=================
-+*/
-+int S_MP3_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
-+{
-+ struct snd_codec_mp3_info *mp3info;
-+ int retval;
-+
-+ if(!stream)
-+ return -1;
-+
-+ mp3info = stream->ptr;
-+
-+ // Make sure we get complete frames all the way through.
-+ bytes -= bytes % (stream->info.channels * stream->info.width);
-+
-+ if(mp3info->buflen)
-+ {
-+ if(bytes < mp3info->buflen)
-+ {
-+ // we still have enough bytes in our decoded pcm buffer
-+ memcpy(buffer, mp3info->pcmbuf, bytes);
-+
-+ // remove the portion from our buffer.
-+ mp3info->buflen -= bytes;
-+ memmove(mp3info->pcmbuf, &mp3info->pcmbuf[bytes], mp3info->buflen);
-+ return bytes;
-+ }
-+ else
-+ {
-+ // copy over the samples we already have.
-+ memcpy(buffer, mp3info->pcmbuf, mp3info->buflen);
-+ mp3info->destlen = mp3info->buflen;
-+ mp3info->buflen = 0;
-+ }
-+ }
-+ else
-+ mp3info->destlen = 0;
-+
-+ mp3info->dest = buffer;
-+ mp3info->destsize = bytes;
-+
-+ do
-+ {
-+ retval = S_MP3_Decode(stream);
-+ } while(retval > 0);
-+
-+ // if there was an error return nothing.
-+ if(retval < 0)
-+ return 0;
-+
-+ return mp3info->destlen;
-+}
-+
-+/*
-+=====================================================================
-+S_MP3_CodecLoad
-+
-+We handle S_MP3_CodecLoad as a special case of the streaming functions
-+where we read the whole stream at once.
-+======================================================================
-+*/
-+void *S_MP3_CodecLoad(const char *filename, snd_info_t *info)
-+{
-+ snd_stream_t *stream;
-+ byte *pcmbuffer;
-+
-+ // check if input is valid
-+ if(!filename)
-+ return NULL;
-+
-+ stream = S_MP3_CodecOpenStream(filename);
-+
-+ if(!stream)
-+ return NULL;
-+
-+ // copy over the info
-+ info->rate = stream->info.rate;
-+ info->width = stream->info.width;
-+ info->channels = stream->info.channels;
-+ info->samples = stream->info.samples;
-+ info->dataofs = stream->info.dataofs;
-+
-+ // allocate enough buffer for all pcm data
-+ pcmbuffer = Z_Malloc(stream->info.size);
-+ if(!pcmbuffer)
-+ {
-+ S_MP3_CodecCloseStream(stream);
-+ return NULL;
-+ }
-+
-+ info->size = S_MP3_CodecReadStream(stream, stream->info.size, pcmbuffer);
-+
-+ if(info->size <= 0)
-+ {
-+ // we didn't read anything at all. darn.
-+ Z_Free(pcmbuffer);
-+ pcmbuffer = NULL;
-+ }
-+
-+ S_MP3_CodecCloseStream(stream);
-+
-+ return pcmbuffer;
-+}
-+
-+#endif // USE_CODEC_MP3
diff --git a/games/iourbanterror/files/patch-Makefile b/games/iourbanterror/files/patch-Makefile
deleted file mode 100644
index b71f958e684d..000000000000
--- a/games/iourbanterror/files/patch-Makefile
+++ /dev/null
@@ -1,432 +0,0 @@
---- Makefile.orig 2007-12-16 18:09:18.000000000 -0300
-+++ Makefile 2008-02-28 11:39:45.000000000 -0300
-@@ -27,16 +27,22 @@
- endif
- endif
-
--BUILD_CLIENT =1
--BUILD_CLIENT_SMP =0
--BUILD_SERVER =0
--BUILD_GAME_SO =0
--BUILD_GAME_QVM =0
--OPTIMIZE =1
--USE_SDL =1
--USE_OPENAL =0
--USE_CURL =1
--USE_CODEC_VORBIS =0
-+BUILD_CLIENT?=0
-+BUILD_CLIENT_SMP?=0
-+BUILD_GAME_QVM?=0
-+BUILD_GAME_SO?=0
-+BUILD_SERVER?=0
-+HAVE_VM_COMPILED?=false
-+USE_CODEC_MP3?=0
-+USE_CODEC_VORBIS?=0
-+USE_CURL?=0
-+USE_CURL_DLOPEN?=0
-+USE_LOCAL_HEADERS?=0
-+USE_OPENAL?=0
-+USE_OPENAL_DLOPEN?=0
-+USE_OPTIMIZED_CFLAGS?=0
-+USE_SDL_AUDIO?=0
-+USE_SDL_VIDEO?=0
-
- ifeq ($(V),1)
- echo_cmd=@:
-@@ -106,38 +112,10 @@
- USE_SDL=1
- endif
-
--ifndef USE_OPENAL
--USE_OPENAL=1
--endif
--
--ifndef USE_OPENAL_DLOPEN
--USE_OPENAL_DLOPEN=0
--endif
--
--ifndef USE_CURL
--USE_CURL=1
--endif
--
--ifndef USE_CURL_DLOPEN
-- ifeq ($(PLATFORM),mingw32)
-- USE_CURL_DLOPEN=0
-- else
-- USE_CURL_DLOPEN=1
-- endif
--endif
--
--ifndef USE_CODEC_VORBIS
--USE_CODEC_VORBIS=0
--endif
--
--ifndef USE_LOCAL_HEADERS
--USE_LOCAL_HEADERS=1
--endif
--
- #############################################################################
-
--BD=$(BUILD_DIR)/debug-$(PLATFORM)-$(ARCH)
--BR=$(BUILD_DIR)/release-$(PLATFORM)-$(ARCH)
-+BD=$(BUILD_DIR)/debug
-+BR=$(BUILD_DIR)/release
- CDIR=$(MOUNT_DIR)/client
- SDIR=$(MOUNT_DIR)/server
- RDIR=$(MOUNT_DIR)/renderer
-@@ -221,6 +199,10 @@
- BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
- endif
-
-+ ifeq ($(USE_CODEC_MP3),1)
-+ BASE_CFLAGS += -DUSE_CODEC_MP3=1
-+ endif
-+
- ifeq ($(USE_SDL),1)
- BASE_CFLAGS += -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 $(shell sdl-config --cflags)
- else
-@@ -385,6 +367,11 @@
- endif
- endif
-
-+ ifeq ($(USE_CODEC_MP3),1)
-+ BASE_CFLAGS += -DUSE_CODEC_MP3=1
-+ CLIENT_LDFLAGS += -lmad
-+ endif
-+
- ifeq ($(USE_CODEC_VORBIS),1)
- BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
- CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
-@@ -476,6 +463,10 @@
- endif
- endif
-
-+ ifeq ($(USE_CODEC_MP3),1)
-+ CLIENT_LDFLAGS += -lmad
-+ endif
-+
- ifeq ($(USE_CODEC_VORBIS),1)
- CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
- endif
-@@ -497,17 +488,10 @@
-
- ifeq ($(PLATFORM),freebsd)
-
-- ifneq (,$(findstring alpha,$(shell uname -m)))
-- ARCH=axp
-- else #default to i386
-- ARCH=i386
-- endif #alpha test
--
--
-- BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-- -I/usr/X11R6/include
-+ BASE_CFLAGS = -DARCH='\"$(ARCH)\"' -DLIBDIR='\"$(LIBDIR)\"' -I$(LOCALBASE)/include -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes
-
- DEBUG_CFLAGS=$(BASE_CFLAGS) -g
-+ RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -pipe
-
- ifeq ($(USE_OPENAL),1)
- BASE_CFLAGS += -DUSE_OPENAL=1
-@@ -516,49 +500,80 @@
- endif
- endif
-
-+ ifeq ($(USE_CURL),1)
-+ BASE_CFLAGS += -DUSE_CURL=1
-+ ifneq ($(USE_CURL_DLOPEN),1)
-+ CLIENT_LDFLAGS += -lcurl
-+ else
-+ BASE_CFLAGS += -DUSE_CURL_DLOPEN=1
-+ endif
-+ endif
-+
- ifeq ($(USE_CODEC_VORBIS),1)
- BASE_CFLAGS += -DUSE_CODEC_VORBIS=1
- endif
-
-- ifeq ($(USE_SDL),1)
-- BASE_CFLAGS += $(shell sdl-config --cflags) -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1
-+ ifeq ($(USE_SDL_AUDIO),1)
-+ BASE_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
-+ else
-+ ifeq ($(USE_SDL_VIDEO),1)
-+ BASE_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
-+ endif
- endif
-
-- ifeq ($(ARCH),axp)
-- BASE_CFLAGS += -DNO_VM_COMPILED
-- RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -ffast-math -funroll-loops \
-- -fomit-frame-pointer -fexpensive-optimizations
-- else
-- ifeq ($(ARCH),i386)
-- RELEASE_CFLAGS=$(BASE_CFLAGS) -DNDEBUG -O3 -mtune=pentiumpro \
-- -march=pentium -fomit-frame-pointer -pipe -ffast-math \
-- -falign-loops=2 -falign-jumps=2 -falign-functions=2 \
-- -funroll-loops -fstrength-reduce
-- HAVE_VM_COMPILED=true
-- else
-- BASE_CFLAGS += -DNO_VM_COMPILED
-+ ifeq ($(USE_SDL_AUDIO),1)
-+ BASE_CFLAGS += -DUSE_SDL_SOUND=1
- endif
-+
-+ ifeq ($(USE_SDL_VIDEO),1)
-+ BASE_CFLAGS += -DUSE_SDL_VIDEO=1
-+ endif
-+
-+ ifeq ($(USE_OPTIMIZED_CFLAGS),1)
-+ RELEASE_CFLAGS+=-O3 -ffast-math -funroll-loops -fomit-frame-pointer \
-+ -fexpensive-optimizations
-+ ifeq ($(ARCH),i386)
-+ RELEASE_CFLAGS+=-falign-loops=2 -falign-jumps=2 -falign-functions=2 \
-+ -fstrength-reduce
-+ endif
-+ endif
-+
-+ ifneq ($(HAVE_VM_COMPILED),true)
-+ BASE_CFLAGS += -DNO_VM_COMPILED
- endif
-
- SHLIBEXT=so
- SHLIBCFLAGS=-fPIC
- SHLIBLDFLAGS=-shared $(LDFLAGS)
-
-- THREAD_LDFLAGS=-lpthread
-+ THREAD_LDFLAGS=$(PTHREAD_LIBS)
- # don't need -ldl (FreeBSD)
- LDFLAGS=-lm
-
-- CLIENT_LDFLAGS =
-+ CLIENT_LDFLAGS = -L$(LOCALBASE)/lib
-
-- ifeq ($(USE_SDL),1)
-- CLIENT_LDFLAGS += $(shell sdl-config --libs)
-+ ifeq ($(USE_SDL_AUDIO),1)
-+ CLIENT_LDFLAGS += $(shell $(SDL_CONFIG) --libs)
- else
-- CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
-+ ifeq ($(USE_SDL_VIDEO),1)
-+ CLIENT_LDFLAGS += $(shell $(SDL_CONFIG) --libs)
-+ endif
-+ endif
-+
-+ ifneq ($(USE_SDL_VIDEO),1)
-+ CLIENT_LDFLAGS += -L$(LOCALBASE)/lib -lGL -lX11 -lXext -lXxf86dga -lXxf86vm
- endif
-
- ifeq ($(USE_OPENAL),1)
-+ CLIENT_LDFLAGS += $(THREAD_LDFLAGS)
- ifneq ($(USE_OPENAL_DLOPEN),1)
-- CLIENT_LDFLAGS += $(THREAD_LDFLAGS) -lopenal
-+ CLIENT_LDFLAGS += -lopenal
-+ endif
-+ endif
-+
-+ ifeq ($(USE_CURL),1)
-+ ifneq ($(USE_CURL_DLOPEN),1)
-+ CLIENT_LDFLAGS += -lcurl
- endif
- endif
-
-@@ -566,7 +581,6 @@
- CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg
- endif
-
--
- else # ifeq freebsd
-
- #############################################################################
-@@ -717,24 +731,25 @@
- TARGETS =
-
- ifneq ($(BUILD_SERVER),0)
-- TARGETS += $(B)/ioUrTded.$(ARCH)$(BINEXT)
-+ TARGETS += $(B)/ioUrTded$(BINEXT)
- endif
-
- ifneq ($(BUILD_CLIENT),0)
-- TARGETS += $(B)/ioUrbanTerror.$(ARCH)$(BINEXT)
-- ifneq ($(BUILD_CLIENT_SMP),0)
-- TARGETS += $(B)/ioUrbanTerror-smp.$(ARCH)$(BINEXT)
-- endif
-+ TARGETS += $(B)/ioUrbanTerror$(BINEXT)
-+endif
-+
-+ifneq ($(BUILD_CLIENT_SMP),0)
-+ TARGETS += $(B)/ioUrbanTerror-smp$(BINEXT)
- endif
-
- ifneq ($(BUILD_GAME_SO),0)
- TARGETS += \
-- $(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) \
-- $(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) \
-- $(B)/baseq3/ui$(ARCH).$(SHLIBEXT) \
-- $(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) \
-- $(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) \
-- $(B)/missionpack/ui$(ARCH).$(SHLIBEXT)
-+ $(B)/baseq3/cgame.$(SHLIBEXT) \
-+ $(B)/baseq3/qagame.$(SHLIBEXT) \
-+ $(B)/baseq3/ui.$(SHLIBEXT) \
-+ $(B)/missionpack/cgame.$(SHLIBEXT) \
-+ $(B)/missionpack/qagame.$(SHLIBEXT) \
-+ $(B)/missionpack/ui.$(SHLIBEXT)
- endif
-
- ifneq ($(BUILD_GAME_QVM),0)
-@@ -824,10 +839,10 @@
- all: debug release
-
- debug:
-- @$(MAKE) targets B=$(BD) CFLAGS="$(CFLAGS) $(DEBUG_CFLAGS)" V=$(V)
-+ @$(MAKE) targets B=$(BD) CFLAGS+="$(CFLAGS) $(DEBUG_CFLAGS)" V=$(V)
-
- release:
-- @$(MAKE) targets B=$(BR) CFLAGS="$(CFLAGS) $(RELEASE_CFLAGS)" V=$(V)
-+ @$(MAKE) targets B=$(BR) CFLAGS+="$(CFLAGS) $(RELEASE_CFLAGS)" V=$(V)
-
- # Create the build directories and tools, print out
- # an informational message, then start building
-@@ -880,7 +895,7 @@
- Q3LCC=$(TOOLSDIR)/q3lcc$(BINEXT)
- Q3ASM=$(TOOLSDIR)/q3asm$(BINEXT)
-
--ifeq ($(CROSS_COMPILING),1)
-+ifeq ($(BUILD_GAME_QVM),0)
- tools:
- @echo QVM tools not built when cross-compiling
- else
-@@ -943,8 +958,13 @@
- $(B)/client/snd_main.o \
- $(B)/client/snd_codec.o \
- $(B)/client/snd_codec_wav.o \
-- $(B)/client/snd_codec_ogg.o \
-- \
-+ $(B)/client/snd_codec_ogg.o
-+
-+ifeq ($(USE_CODEC_MP3),1)
-+ Q3OBJ += $(B)/client/snd_codec_mp3.o
-+endif
-+
-+Q3OBJ += \
- $(B)/client/qal.o \
- $(B)/client/snd_openal.o \
- \
-@@ -1078,9 +1098,15 @@
- ifeq ($(ARCH),x86)
- Q3OBJ += $(B)/client/vm_x86.o
- endif
-+ ifeq ($(ARCH),amd64)
-+ Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o
-+ endif
- ifeq ($(ARCH),x86_64)
- Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o
- endif
-+ ifeq ($(ARCH),powerpc)
-+ Q3OBJ += $(B)/client/vm_ppc.o
-+ endif
- ifeq ($(ARCH),ppc)
- Q3OBJ += $(B)/client/vm_ppc.o
- endif
-@@ -1113,7 +1139,7 @@
-
- ifeq ($(USE_SDL),1)
- ifneq ($(PLATFORM),darwin)
-- BUILD_CLIENT_SMP = 0
-+ #BUILD_CLIENT_SMP = 0
- endif
- endif
-
-@@ -1126,12 +1152,12 @@
- $(B)/clientsmp/sdl_glimp.o
- endif
-
--$(B)/ioUrbanTerror.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
-+$(B)/ioUrbanTerror$(BINEXT): $(Q3OBJ) $(Q3POBJ) $(LIBSDLMAIN)
- $(echo_cmd) "LD $@"
- $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ) $(CLIENT_LDFLAGS) \
- $(LDFLAGS) $(LIBSDLMAIN)
-
--$(B)/ioUrbanTerror-smp.$(ARCH)$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN)
-+$(B)/ioUrbanTerror-smp$(BINEXT): $(Q3OBJ) $(Q3POBJ_SMP) $(LIBSDLMAIN)
- $(echo_cmd) "LD $@"
- $(Q)$(CC) -o $@ $(Q3OBJ) $(Q3POBJ_SMP) $(CLIENT_LDFLAGS) \
- $(THREAD_LDFLAGS) $(LDFLAGS) $(LIBSDLMAIN)
-@@ -1240,15 +1266,21 @@
- ifeq ($(ARCH),x86)
- Q3DOBJ += $(B)/ded/vm_x86.o
- endif
-+ ifeq ($(ARCH),amd64)
-+ Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o
-+ endif
- ifeq ($(ARCH),x86_64)
- Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o
- endif
-+ ifeq ($(ARCH),powerpc)
-+ Q3DOBJ += $(B)/ded/vm_ppc.o
-+ endif
- ifeq ($(ARCH),ppc)
- Q3DOBJ += $(B)/ded/vm_ppc.o
- endif
- endif
-
--$(B)/ioUrTded.$(ARCH)$(BINEXT): $(Q3DOBJ)
-+$(B)/ioUrTded$(BINEXT): $(Q3DOBJ)
- $(echo_cmd) "LD $@"
- $(Q)$(CC) -o $@ $(Q3DOBJ) $(LDFLAGS)
-
-@@ -1287,7 +1319,7 @@
- Q3CGOBJ = $(Q3CGOBJ_) $(B)/baseq3/cgame/cg_syscalls.o
- Q3CGVMOBJ = $(Q3CGOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
-
--$(B)/baseq3/cgame$(ARCH).$(SHLIBEXT) : $(Q3CGOBJ)
-+$(B)/baseq3/cgame.$(SHLIBEXT) : $(Q3CGOBJ)
- $(echo_cmd) "LD $@"
- $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(Q3CGOBJ)
-
-@@ -1330,7 +1362,7 @@
- MPCGOBJ = $(MPCGOBJ_) $(B)/missionpack/cgame/cg_syscalls.o
- MPCGVMOBJ = $(MPCGOBJ_:%.o=%.asm) $(B)/missionpack/game/bg_lib.asm
-
--$(B)/missionpack/cgame$(ARCH).$(SHLIBEXT) : $(MPCGOBJ)
-+$(B)/missionpack/cgame.$(SHLIBEXT) : $(MPCGOBJ)
- $(echo_cmd) "LD $@"
- $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(MPCGOBJ)
-
-@@ -1382,7 +1414,7 @@
- Q3GOBJ = $(Q3GOBJ_) $(B)/baseq3/game/g_syscalls.o
- Q3GVMOBJ = $(Q3GOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
-
--$(B)/baseq3/qagame$(ARCH).$(SHLIBEXT) : $(Q3GOBJ)
-+$(B)/baseq3/qagame.$(SHLIBEXT) : $(Q3GOBJ)
- $(echo_cmd) "LD $@"
- $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(Q3GOBJ)
-
-@@ -1432,7 +1464,7 @@
- MPGOBJ = $(MPGOBJ_) $(B)/missionpack/game/g_syscalls.o
- MPGVMOBJ = $(MPGOBJ_:%.o=%.asm) $(B)/missionpack/game/bg_lib.asm
-
--$(B)/missionpack/qagame$(ARCH).$(SHLIBEXT) : $(MPGOBJ)
-+$(B)/missionpack/qagame.$(SHLIBEXT) : $(MPGOBJ)
- $(echo_cmd) "LD $@"
- $(Q)$(CC) $(SHLIBLDFLAGS) -o $@ $(MPGOBJ)
-
-@@ -1494,7 +1526,7 @@
- Q3UIOBJ = $(Q3UIOBJ_) $(B)/missionpack/ui/ui_syscalls.o
- Q3UIVMOBJ = $(Q3UIOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
-
--$(B)/baseq3/ui$(ARCH).$(SHLIBEXT) : $(Q3UIOBJ)
-+$(B)/baseq3/ui.$(SHLIBEXT) : $(Q3UIOBJ)
- $(echo_cmd) "LD $@"
- $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(Q3UIOBJ)
-
-@@ -1521,7 +1553,7 @@
- MPUIOBJ = $(MPUIOBJ_) $(B)/missionpack/ui/ui_syscalls.o
- MPUIVMOBJ = $(MPUIOBJ_:%.o=%.asm) $(B)/baseq3/game/bg_lib.asm
-
--$(B)/missionpack/ui$(ARCH).$(SHLIBEXT) : $(MPUIOBJ)
-+$(B)/missionpack/ui.$(SHLIBEXT) : $(MPUIOBJ)
- $(echo_cmd) "LD $@"
- $(Q)$(CC) $(CFLAGS) $(SHLIBLDFLAGS) -o $@ $(MPUIOBJ)
-
diff --git a/games/iourbanterror/files/patch-code-qcommon-q_shared.h b/games/iourbanterror/files/patch-code-qcommon-q_shared.h
new file mode 100644
index 000000000000..f819e5a67e8b
--- /dev/null
+++ b/games/iourbanterror/files/patch-code-qcommon-q_shared.h
@@ -0,0 +1,19 @@
+--- code/qcommon/q_shared.h.orig 2010-08-29 19:32:54.537567000 +0200
++++ code/qcommon/q_shared.h 2010-11-27 16:55:16.000000000 +0100
+@@ -27,11 +27,11 @@
+ // A user mod should never modify this file
+
+ #ifdef STANDALONE
+- #define PRODUCT_NAME "iofoo3"
+- #define BASEGAME "foobar"
+- #define CLIENT_WINDOW_TITLE "changeme"
+- #define CLIENT_WINDOW_MIN_TITLE "changeme2"
+- #define GAMENAME_FOR_MASTER "iofoo3" // must NOT contain whitespaces
++ #define PRODUCT_NAME "ioq3+UT"
++ #define BASEGAME "q3ut4"
++ #define CLIENT_WINDOW_TITLE "ioUrbanTerror"
++ #define CLIENT_WINDOW_MIN_TITLE "ioUT"
++ #define GAMENAME_FOR_MASTER "Quake3Arena" // must NOT contain whitespaces
+ #else
+ #define PRODUCT_NAME "ioq3"
+ #define BASEGAME "baseq3"
diff --git a/games/iourbanterror/files/patch-code__qcommon__common.c b/games/iourbanterror/files/patch-code__qcommon__common.c
deleted file mode 100644
index 6899017952d4..000000000000
--- a/games/iourbanterror/files/patch-code__qcommon__common.c
+++ /dev/null
@@ -1,10 +0,0 @@
---- ./code/qcommon/common.c.orig Wed Apr 26 08:27:12 2006
-+++ ./code/qcommon/common.c Sun Jun 11 17:26:26 2006
-@@ -25,6 +25,7 @@
- #include "qcommon.h"
- #include <setjmp.h>
- #ifndef _WIN32
-+#include <sys/types.h>
- #include <netinet/in.h>
- #include <sys/stat.h> // umask
- #else
diff --git a/games/iourbanterror/files/patch-code__qcommon__q_platform.h b/games/iourbanterror/files/patch-code__qcommon__q_platform.h
deleted file mode 100644
index 543c8d5710ed..000000000000
--- a/games/iourbanterror/files/patch-code__qcommon__q_platform.h
+++ /dev/null
@@ -1,15 +0,0 @@
---- ./code/qcommon/q_platform.h.orig Tue Dec 27 16:46:01 2005
-+++ ./code/qcommon/q_platform.h Sun Jun 11 17:26:26 2006
-@@ -176,11 +176,7 @@
- #define ID_INLINE inline
- #define PATH_SEP '/'
-
--#ifdef __i386__
--#define ARCH_STRING "i386"
--#elif defined __axp__
--#define ARCH_STRING "alpha"
--#endif
-+#define ARCH_STRING ARCH
-
- #if BYTE_ORDER == BIG_ENDIAN
- #define Q3_BIG_ENDIAN
diff --git a/games/iourbanterror/files/patch-code__qcommon__vm_x86.c b/games/iourbanterror/files/patch-code__qcommon__vm_x86.c
deleted file mode 100644
index 0614c97804e1..000000000000
--- a/games/iourbanterror/files/patch-code__qcommon__vm_x86.c
+++ /dev/null
@@ -1,20 +0,0 @@
---- ./code/qcommon/vm_x86.c.orig 2007-10-09 02:47:22.000000000 -0300
-+++ ./code/qcommon/vm_x86.c 2008-03-04 10:45:08.000000000 -0300
-@@ -36,7 +36,7 @@
-
- /* need this on NX enabled systems (i386 with PAE kernel or
- * noexec32=on x86_64) */
--#ifdef __linux__
-+#ifdef __unix__
- #define VM_X86_MMAP
- #endif
-
-@@ -1081,7 +1081,7 @@
- // copy to an exact size buffer on the hunk
- vm->codeLength = compiledOfs;
- #ifdef VM_X86_MMAP
-- vm->codeBase = mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
-+ vm->codeBase = mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
- if(vm->codeBase == (void*)-1)
- Com_Error(ERR_DROP, "VM_CompileX86: can't mmap memory");
- #elif _WIN32
diff --git a/games/iourbanterror/files/patch-code__qcommon__vm_x86_64.c b/games/iourbanterror/files/patch-code__qcommon__vm_x86_64.c
deleted file mode 100644
index e6d19725a746..000000000000
--- a/games/iourbanterror/files/patch-code__qcommon__vm_x86_64.c
+++ /dev/null
@@ -1,20 +0,0 @@
---- ./code/qcommon/vm_x86_64.c.orig 2007-10-09 02:47:22.000000000 -0300
-+++ ./code/qcommon/vm_x86_64.c 2008-03-04 10:45:08.000000000 -0300
-@@ -246,7 +246,7 @@
- #else
- #define JMPIARG \
- emit("movq $%lu, %%rax", vm->codeBase+vm->instructionPointers[iarg]); \
-- emit("jmpq *%rax");
-+ emit("jmpq *%%rax");
- #endif
-
- // integer compare and jump
-@@ -534,7 +534,7 @@
- {
- compiledOfs = assembler_get_code_size();
- vm->codeLength = compiledOfs;
-- vm->codeBase = mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0);
-+ vm->codeBase = mmap(NULL, compiledOfs, PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
- if(vm->codeBase == (void*)-1)
- Com_Error(ERR_DROP, "VM_CompileX86: can't mmap memory");
-
diff --git a/games/iourbanterror/files/patch-code__unix__linux_glimp.c b/games/iourbanterror/files/patch-code__unix__linux_glimp.c
deleted file mode 100644
index 00304f2b5be1..000000000000
--- a/games/iourbanterror/files/patch-code__unix__linux_glimp.c
+++ /dev/null
@@ -1,19 +0,0 @@
---- ./code/unix/linux_glimp.c.orig Sun Apr 30 11:32:56 2006
-+++ ./code/unix/linux_glimp.c Sun Jun 11 17:26:26 2006
-@@ -631,8 +631,14 @@
-
- dx = ((int)event.xmotion.x - mwx);
- dy = ((int)event.xmotion.y - mwy);
-- mx += dx;
-- my += dy;
-+ if (abs(dx) > 1)
-+ mx += dx * 2;
-+ else
-+ mx += dx;
-+ if (abs(dy) > 1)
-+ my += dy * 2;
-+ else
-+ my += dy;
-
- mwx = event.xmotion.x;
- mwy = event.xmotion.y;
diff --git a/games/iourbanterror/files/patch-code__unix__unix_main.c b/games/iourbanterror/files/patch-code__unix__unix_main.c
deleted file mode 100644
index f539c9649a95..000000000000
--- a/games/iourbanterror/files/patch-code__unix__unix_main.c
+++ /dev/null
@@ -1,31 +0,0 @@
---- ./code/unix/unix_main.c.orig Sun Feb 26 18:22:12 2006
-+++ ./code/unix/unix_main.c Sun Jun 11 17:26:26 2006
-@@ -774,6 +774,7 @@
- char curpath[MAX_OSPATH];
- char fname[MAX_OSPATH];
- char *basepath;
-+ char *libpath;
- char *homepath;
- char *pwdpath;
- char *cdpath;
-@@ -789,14 +790,19 @@
- // TODO: use fs_searchpaths from files.c
- pwdpath = Sys_Cwd();
- basepath = Cvar_VariableString( "fs_basepath" );
-+ libpath = LIBDIR;
- homepath = Cvar_VariableString( "fs_homepath" );
- cdpath = Cvar_VariableString( "fs_cdpath" );
- gamedir = Cvar_VariableString( "fs_game" );
-
-- libHandle = try_dlopen(pwdpath, gamedir, fname, fqpath);
-+ if(!libHandle && homepath)
-+ libHandle = try_dlopen(pwdpath, gamedir, fname, fqpath);
-
- if(!libHandle && homepath)
- libHandle = try_dlopen(homepath, gamedir, fname, fqpath);
-+
-+ if(!libHandle && basepath)
-+ libHandle = try_dlopen(libpath, gamedir, fname, fqpath);
-
- if(!libHandle && basepath)
- libHandle = try_dlopen(basepath, gamedir, fname, fqpath);
diff --git a/games/iourbanterror/files/patch-code_client_snd_openal.c b/games/iourbanterror/files/patch-code_client_snd_openal.c
deleted file mode 100644
index e35fc7cbf9ac..000000000000
--- a/games/iourbanterror/files/patch-code_client_snd_openal.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- code/client/snd_openal.c.orig 2009-12-26 18:12:52.000000000 +0100
-+++ code/client/snd_openal.c 2009-12-26 18:13:00.000000000 +0100
-@@ -1676,7 +1676,7 @@
- #elif defined(MACOS_X)
- #define ALDRIVER_DEFAULT "/System/Library/Frameworks/OpenAL.framework/OpenAL"
- #else
--#define ALDRIVER_DEFAULT "libopenal.so.0"
-+#define ALDRIVER_DEFAULT "libopenal.so"
- #endif
-
- /*
diff --git a/games/iourbanterror/pkg-descr b/games/iourbanterror/pkg-descr
index 0adb28e44079..2998ff22860d 100644
--- a/games/iourbanterror/pkg-descr
+++ b/games/iourbanterror/pkg-descr
@@ -6,7 +6,7 @@ and plays much faster, which among other things, is caused by the ability to
strafe jump, which combined with wall jumping can lead to very quick movement
and nice jumps. Urban Terror has 7 game modes, 25 maps and 15 weapons.
-This port installs the modified ioquake3 engine for Urban Terror called
+This port installs a modified ioquake3 engine for Urban Terror called
ioUrbanTerror, and depends on the data, resulting in a playable game.
-WWW: http://ftp.snt.utwente.nl/pub/games/urbanterror/iourbanterror/source/
+WWW: http://www.urbanterror.info/
diff --git a/games/iourbanterror/pkg-message b/games/iourbanterror/pkg-message
index 37847a24d3bc..b7b6cabadc7d 100644
--- a/games/iourbanterror/pkg-message
+++ b/games/iourbanterror/pkg-message
@@ -1,17 +1,8 @@
==============================================================================
-If you have sound problems with SDL try setting the variable "s_sdlSpeed" to
-"44100". It will be saved to the configuration file.
-
-If you have sound problems with OpenAL recompile without it. Also the OPENAL
-option causes the program to omit restoring gamma and mouse sensivity after
-exitting.
-
-The configuration files are saved to ~/.ioUrbanTerror instead of ~/.q3a
-because they have additional variables which would be removed if other engines
-overwrite them. But you can safely copy the original directory to the new one
-for the first time.
-
-If you enabled CELLSHADING, check files/extra-patch-cellshading for variables.
+Note, that the port was switched over to use the original ioquake project
+source code instead of code provided by the UrbanTerror project. The
+UrbanTerror project is switching to a closed source licensing model:
+ http://www.urbanterror.info/news/texts/285/
==============================================================================
diff --git a/games/iourbanterror/pkg-plist b/games/iourbanterror/pkg-plist
index dfd078238ae7..00caee056cc1 100644
--- a/games/iourbanterror/pkg-plist
+++ b/games/iourbanterror/pkg-plist
@@ -1,15 +1,8 @@
%%DEDICATED%%bin/ioUrTded
%%CLIENT%%bin/ioUrbanTerror
%%SMP%%bin/ioUrbanTerror-smp
-%%GAMELIBS%%%%LIBDIR%%/baseq3/cgame.so
-%%GAMELIBS%%%%LIBDIR%%/baseq3/qagame.so
-%%GAMELIBS%%%%LIBDIR%%/baseq3/ui.so
-%%GAMELIBS%%%%LIBDIR%%/missionpack/cgame.so
-%%GAMELIBS%%%%LIBDIR%%/missionpack/qagame.so
-%%GAMELIBS%%%%LIBDIR%%/missionpack/ui.so
-%%PORTDOCS%%%%DOCSDIR%%/README
-%%PORTDOCS%%%%DOCSDIR%%/ioUrbanTerror_README.txt
-%%GAMELIBS%%@dirrm %%LIBDIR%%/missionpack
-%%GAMELIBS%%@dirrm %%LIBDIR%%/baseq3
+%%GAMELIBS%%%%LIBDIR%%/q3ut4/cgameamd64.so
+%%GAMELIBS%%%%LIBDIR%%/q3ut4/qagameamd64.so
+%%GAMELIBS%%%%LIBDIR%%/q3ut4/uiamd64.so
+%%GAMELIBS%%@dirrm %%LIBDIR%%/q3ut4
%%GAMELIBS%%@dirrm %%LIBDIR%%
-%%PORTDOCS%%@dirrm %%DOCSDIR%%
diff --git a/games/openarena-oax/Makefile b/games/openarena-oax/Makefile
index f2f10f822e66..09343e6500e6 100644
--- a/games/openarena-oax/Makefile
+++ b/games/openarena-oax/Makefile
@@ -6,7 +6,7 @@
#
PORTNAME= oax
-PORTVERSION= B45
+PORTVERSION= B47
CATEGORIES= games
MASTER_SITES= http://files.poulsander.com/~poul19/public_files/eliminationSource/
DISTNAME= ${PORTNAME}${PORTVERSION}
diff --git a/games/openarena-oax/distinfo b/games/openarena-oax/distinfo
index ad5798090284..13a125c415ad 100644
--- a/games/openarena-oax/distinfo
+++ b/games/openarena-oax/distinfo
@@ -1,3 +1,2 @@
-MD5 (oaxB45.zip) = 395b29a38184100cea7dc3206979770f
-SHA256 (oaxB45.zip) = 43f21a45329b549b5a0a967269e50cf89803b5e084598d7fbef726fa63e0aa14
-SIZE (oaxB45.zip) = 465245
+SHA256 (oaxB47.zip) = 16f4a199621162a09107d043b8edfc9cda70fa432c9351aaa8fd055e94048952
+SIZE (oaxB47.zip) = 468070
diff --git a/games/openarena/Makefile b/games/openarena/Makefile
index 32c70f1ad858..7561c8c1f86d 100644
--- a/games/openarena/Makefile
+++ b/games/openarena/Makefile
@@ -7,10 +7,10 @@
PORTNAME= openarena
PORTVERSION= 0.8.5
-DISTVERSION= 1.36_SVN1783+${PORTVERSION}
-PORTREVISION= 0
+DISTVERSION= 1.36_SVN1788+${PORTVERSION}
+PORTREVISION= 1
MASTER_SITES= http://files.poulsander.com/~poul19/public_files/oa/dev081/
-DISTNAME= ${PORTNAME}-engine-source-0.8.x-15
+DISTNAME= ${PORTNAME}-engine-source-0.8.x-18
MAINTAINER= kamikaze@bsdforen.de
COMMENT= Quake3 total conversion based on the ioquake3 engine
@@ -28,5 +28,7 @@ Q3SERVER= oa_ded
Q3TOOLS=
Q3BASE= baseoa
Q3DIR= ${DATADIR}
+# No icon included with OpenArena
+Q3ICON=
.include "../ioquake3/Makefile"
diff --git a/games/openarena/distinfo b/games/openarena/distinfo
index 3224bdd8bace..5c3865fcb163 100644
--- a/games/openarena/distinfo
+++ b/games/openarena/distinfo
@@ -1,3 +1,2 @@
-MD5 (openarena-engine-source-0.8.x-15.tar.bz2) = 868a6d0dca1579a0cbc05192b9cdc70d
-SHA256 (openarena-engine-source-0.8.x-15.tar.bz2) = fc274de6cc4a6a880618d38267d4453fdb3125fc8587b08e6ea51dd137a88650
-SIZE (openarena-engine-source-0.8.x-15.tar.bz2) = 8080759
+SHA256 (openarena-engine-source-0.8.x-18.tar.bz2) = 77180d70af00134b3cfbc51a3c1371f99665e2f073b2ec5fdbf08f6c93ae1c24
+SIZE (openarena-engine-source-0.8.x-18.tar.bz2) = 7211834
diff --git a/games/openarena/files/patch-Makefile b/games/openarena/files/patch-Makefile
index 9e052bf5e580..4767cfb2e5dd 100644
--- a/games/openarena/files/patch-Makefile
+++ b/games/openarena/files/patch-Makefile
@@ -1,126 +1,19 @@
---- Makefile.orig 2010-04-24 23:29:15.000000000 +0200
-+++ Makefile 2010-05-22 00:10:08.000000000 +0200
-@@ -561,45 +561,22 @@
+--- Makefile.orig 2010-07-02 21:50:49.000000000 +0200
++++ Makefile 2010-11-27 14:39:09.000000000 +0100
+@@ -561,9 +561,16 @@
ifeq ($(PLATFORM),freebsd)
-- ifneq (,$(findstring alpha,$(shell uname -m)))
-- ARCH=axp
-- else #default to i386
-- ARCH=i386
-- endif #alpha test
+ # system integration
+ ifndef DEFAULT_LIBDIR
+ DEFAULT_LIBDIR = /usr/local/lib/ioquake3
+ endif
-
-- BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-- -DUSE_ICON
-+ # flags
-+ BASE_CFLAGS = $(shell env MACHINE_ARCH=$(ARCH) make -f /dev/null -VCFLAGS) \
-+ -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
++
+ # flags
+ BASE_CFLAGS = $(shell env MACHINE_ARCH=$(ARCH) make -f /dev/null -VCFLAGS) \
+ -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
++ -DHOMEPATH=\\\"$(HOMEPATH)\\\" \
+ -DDEFAULT_LIBDIR=\\\"$(DEFAULT_LIBDIR)\\\" \
-+ -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON
+ -DUSE_ICON -DMAP_ANONYMOUS=MAP_ANON
CLIENT_CFLAGS = $(SDL_CFLAGS)
SERVER_CFLAGS =
-+ HAVE_VM_COMPILED = true
-
-- ifeq ($(USE_OPENAL),1)
-- CLIENT_CFLAGS += -DUSE_OPENAL
-- ifeq ($(USE_OPENAL_DLOPEN),1)
-- CLIENT_CFLAGS += -DUSE_OPENAL_DLOPEN
-- endif
-- endif
--
-- ifeq ($(USE_CODEC_VORBIS),1)
-- CLIENT_CFLAGS += -DUSE_CODEC_VORBIS
-- endif
--
-- OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
--
-- ifeq ($(ARCH),axp)
-- BASE_CFLAGS += -DNO_VM_COMPILED
-- OPTIMIZEVM += -fexpensive-optimizations
-- else
-- ifeq ($(ARCH),i386)
-- OPTIMIZEVM += -mtune=pentiumpro \
-- -march=pentium -pipe -falign-loops=2 -falign-jumps=2 \
-- -falign-functions=2 -funroll-loops -fstrength-reduce
-- HAVE_VM_COMPILED=true
-- else
-- BASE_CFLAGS += -DNO_VM_COMPILED
-- endif
-- endif
--
-- OPTIMIZE = $(OPTIMIZEVM) -ffast-math
-+ OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer -ffast-math
-+ OPTIMIZE = $(OPTIMIZEVM)
-
- SHLIBEXT=so
- SHLIBCFLAGS=-fPIC
-@@ -613,17 +590,40 @@
-
- CLIENT_LIBS += $(SDL_LIBS) -lGL
-
-+ # optional features/libraries
- ifeq ($(USE_OPENAL),1)
-- ifneq ($(USE_OPENAL_DLOPEN),1)
-+ CLIENT_CFLAGS += -DUSE_OPENAL
-+ ifeq ($(USE_OPENAL_DLOPEN),1)
-+ CLIENT_CFLAGS += -DUSE_OPENAL_DLOPEN
- CLIENT_LIBS += $(THREAD_LIBS) -lopenal
- endif
- endif
-
-+ ifeq ($(USE_CURL),1)
-+ CLIENT_CFLAGS += -DUSE_CURL
-+ ifeq ($(USE_CURL_DLOPEN),1)
-+ CLIENT_CFLAGS += -DUSE_CURL_DLOPEN
-+ CLIENT_LIBS += -lcurl
-+ endif
-+ endif
-+
- ifeq ($(USE_CODEC_VORBIS),1)
-- ifeq ($(PLATFORM),mingw32)
-- CLIENT_LIBS += $(LIBSDIR)/win32/libvorbisfile.a $(LIBSDIR)/win32/libvorbis.a $(LIBSDIR)/win32/libogg.a
-- else
-- CLIENT_LIBS += -lvorbisfile -lvorbis -logg
-+ CLIENT_CFLAGS += -DUSE_CODEC_VORBIS
-+ endif
-+
-+ ifeq ($(USE_CODEC_VORBIS),1)
-+ CLIENT_LIBS += -lvorbisfile -lvorbis -logg
-+ endif
-+
-+ # cross-compiling tweaks
-+ ifeq ($(ARCH),i386)
-+ ifeq ($(CROSS_COMPILING),1)
-+ BASE_CFLAGS += -m32
-+ endif
-+ endif
-+ ifeq ($(ARCH),amd64)
-+ ifeq ($(CROSS_COMPILING),1)
-+ BASE_CFLAGS += -m64
- endif
- endif
-
-@@ -1555,6 +1555,9 @@
- ifeq ($(ARCH),x86_64)
- Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o
- endif
-+ ifeq ($(ARCH),amd64)
-+ Q3OBJ += $(B)/client/vm_x86_64.o $(B)/client/vm_x86_64_assembler.o
-+ endif
- ifeq ($(ARCH),ppc)
- Q3OBJ += $(B)/client/vm_powerpc.o $(B)/client/vm_powerpc_asm.o
- endif
-@@ -1720,6 +1723,9 @@
- ifeq ($(ARCH),x86_64)
- Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/ded/vm_x86_64_assembler.o
- endif
-+ ifeq ($(ARCH),amd64)
-+ Q3DOBJ += $(B)/ded/vm_x86_64.o $(B)/ded/vm_x86_64_assembler.o
-+ endif
- ifeq ($(ARCH),ppc)
- Q3DOBJ += $(B)/ded/vm_powerpc.o $(B)/ded/vm_powerpc_asm.o
- endif
diff --git a/games/openarena/files/patch-code-qcommon-vm_x86.c b/games/openarena/files/patch-code-qcommon-vm_x86.c
new file mode 100644
index 000000000000..a24661785255
--- /dev/null
+++ b/games/openarena/files/patch-code-qcommon-vm_x86.c
@@ -0,0 +1,29 @@
+--- code/qcommon/vm_x86.c.orig 2008-08-18 01:22:06.000000000 +0200
++++ code/qcommon/vm_x86.c 2010-11-27 14:01:33.000000000 +0100
+@@ -36,7 +36,25 @@
+
+ /* need this on NX enabled systems (i386 with PAE kernel or
+ * noexec32=on x86_64) */
+-#ifdef __linux__
++// Rambetter's note: I'm adding the test for __FreeBSD__ in addition to the [already
++// existing] test for __linux__. Here is why. I own a 32 bit FreeBSD 8.0 server with
++// a PAE kernel. Without VM_X86_MMAP, ioq3ded segfaults shortly after starting
++// (this should come as no surprise). With VM_X86_MMAP, ioq3ded runs very smoothly.
++// So, at a very minimum, we need to set VM_X86_MMAP for FreeBSD PAE kernels.
++// Now, I also happen to own a 32 bit FreeBSD 7.1 server with just the standard kernel
++// (non-PAE). I have run ioq3ded successfully on it with and without VM_X86_MMAP for many
++// months. So, in the case of non-PAE FreeBSD, we can go either way - use VM_X86_MMAP or
++// not use it. The absolute safest fix to this problem is to only set VM_X86_MMAP on
++// PAE FreeBSD kernels (in addition to Linux); however, I don't know of a way to detect
++// the PAE kernel easily. Therefore, since using VM_X86_MMAP won't break anything on
++// non-PAE kernels [apparently], we'll just use it all the time on FreeBSD 32 bit.
++// Now, you may ask the question: Why not change the entire test for just __unix__?
++// Unfortunately I cannot say anything about this because I don't have access to every
++// other system that has __unix__ defined, so I cannot possibly test all those cases to
++// make sure things work. We'll just leave it with __linux__ and __FreeBSD__ to be safe.
++// If someone with a different flavor of UNIX running a PAE kernel has this problem too,
++// they can report the bug and we will adjust the line below accordingly.
++#if defined(__linux__) || defined(__FreeBSD__)
+ #define VM_X86_MMAP
+ #endif
+