summaryrefslogtreecommitdiff
path: root/games-fps/quake2-icculus
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /games-fps/quake2-icculus
reinit the tree, so we can have metadata
Diffstat (limited to 'games-fps/quake2-icculus')
-rw-r--r--games-fps/quake2-icculus/Manifest22
-rw-r--r--games-fps/quake2-icculus/files/0.16-rogue-armor.patch12
-rw-r--r--games-fps/quake2-icculus/files/0.16-rogue-nan.patch7
-rw-r--r--games-fps/quake2-icculus/files/README-postinstall79
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch172
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch18
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch14
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch213
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch12
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch97
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch56
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch25
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch13
-rw-r--r--games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch45
-rw-r--r--games-fps/quake2-icculus/files/quake2.xpm37
-rw-r--r--games-fps/quake2-icculus/metadata.xml14
-rw-r--r--games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild195
17 files changed, 1031 insertions, 0 deletions
diff --git a/games-fps/quake2-icculus/Manifest b/games-fps/quake2-icculus/Manifest
new file mode 100644
index 000000000000..ecd90f64597f
--- /dev/null
+++ b/games-fps/quake2-icculus/Manifest
@@ -0,0 +1,22 @@
+AUX 0.16-rogue-armor.patch 240 SHA256 b3e4932c1b3a40ca8e235d29d73263a06c7ed7aa4a757a613ff061a384c7ebe9 SHA512 591fccd0cbc1225982b6d95d4818a4d0ff409717de8799b1d49f424633169d8a8187206220c24b60a341337aec2e297dfd8517dd478223e7d557ee85f6ecc453 WHIRLPOOL 9cd537bdd2e62a066e0d20b513458eb97b77bfd47b7eebc520d6dab4bd8c01d5b46da53798890f7880eac7611ef829cdb109a5f135429427fc05d9a295f0b77e
+AUX 0.16-rogue-nan.patch 170 SHA256 58052b59e897789aec3c02267890689e7a0efbaa9bc5e3c78e612ce2de0f32e0 SHA512 3d9b3a95a85a6fa39f2c6f7ad5e49b313b723bfb0fa88392f8690df27c16a7d6ad7617043b6fd66dc87cbbac9b01b941b8cbc8ecf4e045b908e844832c80d26a WHIRLPOOL 956681196820db3f51e7320a93d1b510fd82b469b7410c8d321eba689427a5911d1c0d967eeace573d1409f72f4a114556e6f06fd74b7edeb35b5f20d546608b
+AUX README-postinstall 3083 SHA256 90f8cce0737adf8a95afac11ca30911a59801659cb5ebf29943792586eed1a45 SHA512 cc7441ce14117ea765a7df98b3de0370b251f444289fd8aaa03c97ea5b383d626088977bc30dfc7a30124dedce4796b5d6392dad7e3d203ee2257d71a9b49bfe WHIRLPOOL 32b83ba760f6cb4929ccdda6b2e68e68ed9decf71fb96e562451d79ba6218fa3a48ecbbe1a648e773a17b923f9c3b14e74e2d75e17e89e0ac6a40b7788560835
+AUX quake2-icculus-0.16.1-alsa.patch 4386 SHA256 acae335903b33e1d4274db167dd57961569f34e0a26142f5bfa809f754993bbd SHA512 8bb9e4d6f551ebe3e6715e044453affd7edd749650791fca32b5286038e75a59685c7d47efce8ac7b9dff488e6c2952dfdc68807f3365d276afb4b7387ad5dbc WHIRLPOOL c953f67764a4edd2316a729301c42c7bae6541f8863a12b03f3eb0f9b69d56aad8feb7d65178849e26a7787319ff4f832238bf155ea3931f9e93d9c9e1083d15
+AUX quake2-icculus-0.16.1-amd64.patch 534 SHA256 e95aeace865f089b6c1c9e0c362da407d1bd603147fb6886b9c13b37218c3a37 SHA512 03faf4b85aa176a267847196fb56204b6d02bde0ebef858a34edb3c87cb41e57636d9b6e5b3be44163e918cb4b3ff38299b2db9de90690179108ee77146b942d WHIRLPOOL 23093e8624751afb7a4ec7b524745853cafa5394bcc97acde170f7b8aa946747ffc7d97f4f55bf0c5776056b55c5d30cfef8b67102c7acbc4cca2ee742cb9d96
+AUX quake2-icculus-0.16.1-gcc41.patch 292 SHA256 bce6396cf2871ae102089a932666be6ce3a5974483a21610b135d39f95db0f59 SHA512 87193f69670e7cd6573bd4ff550202fda2702a5d7dfadb3af31f673b8910958ec3718e0d7ae558666c6a6921c43d543626dc8eaa0e3822345f33aecdbdf7ee50 WHIRLPOOL b868ba28f8bda9f454cdc80f89ad286fb25bbd27e07dbdacf0af7811b3b9b61d9ebe58aed7c7bef0c31b617046c1a31ebe7636a26291b0881db6df0fe7a430ba
+AUX quake2-icculus-0.16.1-gentoo-paths.patch 6419 SHA256 e290602dea3e13f5a2b8f5ae041957f0f0bc5b46a6ad037a17e3ca5659d32ab5 SHA512 91a83f82b013245256db386a212c044bfbd637e1685e532d2ca75959e6870e65f3763f6d83c85db184d46a0ed77b5d4a53c4f7421b55b82a4709bdfc70d0f307 WHIRLPOOL dde1c56a6daf256e8c861419b5bf54e41ff897c7c0397bb423e7fa131c19ae444b38591b0b22e408dd2c5cedc354653608ad55b993d57b218358ac58c45acf7e
+AUX quake2-icculus-0.16.1-gnusource.patch 316 SHA256 2217f9e8ed131967f018d8b0b64aa9dc317cc14b18c837da7c58450126cf5731 SHA512 0e1bed0bfd7ab31ad574a17534a49e89b44ef99308b90d9a30726f7d39ec4606514643e064968a5d9e53dd7a20394d5a27162fba06f37713ee3bc1e65f31b76b WHIRLPOOL b63d75b344e3353b828fbc2ebca1145b8400ebddd71e1e780a75a32decd825b0296386e03f500ab069805660d7a578f340d778f1c24b8088be1336bb598f682a
+AUX quake2-icculus-0.16.1-ia64.patch 2399 SHA256 5ed84452f0e2414cd668d3a12f30366c2ed188dcc7d8eb17d2725340873a4db9 SHA512 fce5f699ecabe8ca9f215507172be537c8850fc91ed44224a588780bf76901d60486c220d5bf821b70fe9d2687f6ec9d966b78008de1f6cf4f1ac3644bb66844 WHIRLPOOL 89e9958904eb2e5f598ff9652164435a650c56b0d66f9169f1f63e822d064b94d5c52442630bd4ce9fd176154f2c6acd2bcbc0c6c507a8e05a07d635a5a3dcc9
+AUX quake2-icculus-0.16.1-ldflags.patch 1537 SHA256 fa9404c4852f6b2e0cafee6407135e8445f4fc3dd899ae773d86ad4d7fa8facc SHA512 c4a1dc06b02c227e0cbb8e289b2eab864f5f599f0f92cb376d2a6be7d746774b89fddba21c003c91908a9a140fe639e1588dcff28cccc1a531a6eff8e8f4ccf0 WHIRLPOOL 559ae777b960d5934d49d9b4a2c9fd77395c23b0e5b72b3c89281d20c4a0cc1d6adbf57edade4d7c6bab1f169b9247fd8fa4ce50722a4c49c9764d9514bfcc03
+AUX quake2-icculus-0.16.1-no-asm-io.patch 513 SHA256 05a648b32ce0c260046706ee2f4c6f49a0e7049ed07cd02fd895f6fd83556012 SHA512 ad2d62ce9c69f10683bd5a0970339c82acdf9543b802a0ed070fb025efab6b3aad6e352cc29de5e3120449a3b679823feb920dc175f33b00d230cb9082be3f16 WHIRLPOOL b81a56274664edfcdeeda97e4ef7a648cbe1fb9f15334914252aa38400fe549b537365793be2fedb0141f0105dddc764b8e7260169baecad5e968afb70a8b3e5
+AUX quake2-icculus-0.16.1-x11_mouse.patch 330 SHA256 828baf64ded015bc5e0c77b5354d0ff3ebacd8964745d36d89422c7cf7f90fa2 SHA512 4387615cab034dd37fb502e7f7411a9cf5ac9370ef474e123c1ea550d79fb06c838ac1de6e443d3e9aeea73ec905bd7464f57f9a561d4eca90852abace20eea0 WHIRLPOOL bcfbf7f03b26c588c119bab4ad860ec3ec3a6a9b87a24e04beedd0a0a76776171fabbbb456ecd5da289307a1335087f5cf298dde8ab7f24deff99de59ebfb36a
+AUX quake2-icculus-0.16.1-x11_soft.patch 1128 SHA256 dba3c805e599f055ad43656e38c2a67d9288d758a87dc9d092db144a1a6cd0c1 SHA512 c8d479919fd4440041d1f2e3a020c45cfb6522d6ff675845bd646c0b736d6ce4b400bcdf99b7f4d456938e8e946e02e40ebab4d574779fb86cff49e4213abc1f WHIRLPOOL a287ca704b83fd6f506f2ac8451645efcd3ebcb835f3e86adefc1ea663545983b79b49ebf3c0d99a92e43b36a120e4ead59bd4793b297145c79749b35fc81b47
+AUX quake2.xpm 1234 SHA256 0a5232384c56ccead145345a30e4ed7004bf36fe7656d43c46f1bed34d8fc2a9 SHA512 e7ed561123c2919a514ba7e4bcd32214bb368764cb53ad314b2816abefa0368247c0a9d463d9e96217c3583aa30f0f79b80bb5f798f6af857f4a0b069ab57e80 WHIRLPOOL b3237e526b0261d68a0682823b3841043c1bcc80987ad820519defe733beeee626b01955e9d1e3b1647c8dde8b32ed9b6bd3898a78168452ec234481f6e02176
+DIST maxpak.pak 3282742 SHA256 653569fe880f1ed5f7529483ac961b22078482e6ff0e83f4d9d1bc503c866770 SHA512 49eef504190323add8bbe6fd007ee51a17dc843898a2199a44a0b214a14da90202070f9eb025503c58b64d6306832bdb6c0d04efe927ea651eb83b0517a59782 WHIRLPOOL 4f372e574d337834661992a6ac17f249c4df42603dd023962644db792f58d3a58f1f328c198d2cf4a666a60cce5c0eb56e0f6c495cef405db8a6d46ba0127980
+DIST quake2-r0.16.1.tar.gz 1525384 SHA256 49f4d3d53772b6ffd7733506f5d121c7893bfd8884133bfc36a28039c0744642 SHA512 63e8fa10446698b1f1cbd20b4bbfeec75d7620cb6454bb90b853cd2a3d6cd9040041a164666a5e015c3a8289423127f9164b500f57793505f6e4671dec932cf2 WHIRLPOOL 017d0c6add0302fa2f74bc4b2603fff36589417ac7fd150429f8e83be846bef53695ac4edaa22ec5a8b38cf2aaf73ea733e1e142d8e8a0cc778826753dc96b14
+DIST roguesrc320.shar.Z 626769 SHA256 ceefb2fd748961cb0bc3244220f3eb09d8f7b8ca2eb32cdf9b284727a2fdc919 SHA512 330db4966b758b8e363eb8d699b30ce5ec7d9fa581936288e7267000d0815996388adebc0206a8903734cdc1c5658616b15518a2bf888ad9e6059f8155960141 WHIRLPOOL 84430a1596179086cc440196974f83e13edff52378c8418d84e46bcd78f5e6856aa1a8b6a9e1a9e5496c1845ca19b3af6be346661580601e6581920529109dbd
+DIST xatrixsrc320.shar.Z 455917 SHA256 94bf596cd85d38ea294b99ccb0ebb5e4b9776cca335001b3803e2d8407395589 SHA512 6723440d3cfdaf7f9b260d5777d9823937a4c3ee800c8c204e8a5c3d29f2b37f6bdc7c0786025a19d040b5692aa54b99b9db2dc121bc0ca2b53c8763b4ab4dfa WHIRLPOOL d5254a11f49ecd0cc341d6b51cc31bd6d43597e0341df09662849e235a07452eef80fc881983ed34bcfd47fca575e8592aa306f53a3b82d1464167b16cee4fed
+EBUILD quake2-icculus-0.16.1-r1.ebuild 5276 SHA256 a7877dc25580ebcebbb8bc4c2b2159ecee6ec1d0105d28a1d5e2febdad9ae6bd SHA512 22ee401b15e2b00d11a5928bc2fa3c2ae736172112dab4f44a4405def49c89bf55f4d6e2a96ec27dd7e354bd4929aae7afde7194dfa3b80415ab66ede7b423b3 WHIRLPOOL c8560ae3dfdac5746b4586989252f6901a233e643913df6a21837d323d6c04fca33ac9c25d90297f51fad2de5c6d50da4ccb14b7acf1caf289aa1bca8d5a7a48
+MISC ChangeLog 3027 SHA256 7170affc3be054748121067ea715373bc889c824f209201899ca3d7adcdc9d04 SHA512 111d8dcfc17c5acb05a4c7fd7d4223b310b37ba02132bec8e6f1967ca4e89c7630fe282be7a36d7b8fd23d31861c1dcd9eaf6218b63276527fba931830b084b7 WHIRLPOOL 23d0b219476dae4ef99cceec67259c74bb0e102eeb19c319790a59e2d2a63101fc67529e0a4b7c26e886e4547ccecdca23b77b60e25494dc1a1dab6a4c89b118
+MISC ChangeLog-2015 9286 SHA256 f117d03093ad70310b2abacdcb3c04c98ae0233ff5369bf84b610714d900973d SHA512 5d22192ebbbda8888cc809f5beeac494c911bd9d0e4f20f8c7d06ff9ff45a513be29687f17f6d0046bf9aabb08b610e6060ff567c46ca6dd578802ca8b5b6c17 WHIRLPOOL 728243e35cb2fb89803691637ccd9f066a30dc2d8236126909df7b3711e96f60419262ea61349ceb9fbca1ef30c2af12fd768bf1d3817b55efae0409f2068d04
+MISC metadata.xml 612 SHA256 ae7296fad2e85f7e73f1884bc4ce9a23a366c87324309dbb50a37cc0d6c90cf6 SHA512 0c143ca3470f6b33b35d660e3ad55678356e7139cab94589d18947617988f63f8c69485167d9d8c3e21ef231b0521f993a5063df26ae3e5e5cf4c64bee30d45b WHIRLPOOL 0d84ccc23144f737ed934d3f98a357b9e03c1a9b6c594197430bd476a85f459f8ef8f2b3caee2f3df1bc30577ed16283168604f3a33e99bda28130bdd4619759
diff --git a/games-fps/quake2-icculus/files/0.16-rogue-armor.patch b/games-fps/quake2-icculus/files/0.16-rogue-armor.patch
new file mode 100644
index 000000000000..194f965a0501
--- /dev/null
+++ b/games-fps/quake2-icculus/files/0.16-rogue-armor.patch
@@ -0,0 +1,12 @@
+--- src/rogue/g_local.h.orig
++++ src/rogue/g_local.h
+@@ -545,9 +545,6 @@
+ extern int sm_meat_index;
+ extern int snd_fry;
+
+-extern int jacket_armor_index;
+-extern int combat_armor_index;
+-extern int body_armor_index;
+
+
+ // means of death
diff --git a/games-fps/quake2-icculus/files/0.16-rogue-nan.patch b/games-fps/quake2-icculus/files/0.16-rogue-nan.patch
new file mode 100644
index 000000000000..0961fa68a985
--- /dev/null
+++ b/games-fps/quake2-icculus/files/0.16-rogue-nan.patch
@@ -0,0 +1,7 @@
+--- src/rogue/g_local.h.orig
++++ src/rogue/g_local.h
+@@ -24,3 +24,3 @@
+ #ifndef _WIN32
+-#include <nan.h>
++#include <bits/nan.h>
+ #define min(a,b) ((a) < (b) ? (a) : (b))
diff --git a/games-fps/quake2-icculus/files/README-postinstall b/games-fps/quake2-icculus/files/README-postinstall
new file mode 100644
index 000000000000..3e2245f3bb0a
--- /dev/null
+++ b/games-fps/quake2-icculus/files/README-postinstall
@@ -0,0 +1,79 @@
+This was taken from the README file in the source distribution
+and cleaned up a bit. Read all of this, or at least skim it. Please?
+
+Note:
+1. If you install a new compile of quake2, you'll lose your savegames. I'm
+sorry. Don't upgrade in the middle of a single-player game.
+
+===============================================================================
+
+To emerge the Quake2 data:
+--------------------------
+1. emerge quake2-data
+
+That was easy huh ? :) Note: this requires the Quake2 CD and/or the data files
+from an installed copy of the game (like for windows).
+
+===============================================================================
+
+To install the Quake2 demo data:
+--------------------------------
+1. download ftp://ftp.idsoftware.com/idstuff/quake2/q2-314-demo-x86.exe
+2. unzip -L q2-314-demo-x86.exe into a temp directory
+3. cp baseq2/pak0.pak to /usr/share/games/quake2-data/baseq2/pak0.pak
+
+===============================================================================
+
+To install the Quake2 gamedata from game CD:
+--------------------------------------------
+(assuming the cdrom is mounted at /cdrom)
+
+1. cp /cdrom/Install/Data/baseq2/pak0.pak /usr/share/games/quake2-data/baseq2/
+
+2. cp /cdrom/Install/Data/baseq2/video/ /usr/share/games/quake2-data/baseq2/
+ (optional)
+
+3. Download ftp://ftp.idsoftware.com/idstuff/quake2/q2-3.20-x86-full.exe
+ and extract the contents to a temporary directory (use unzip -L, as this
+ is a standard zip file).
+
+4. cp <temp directory>/baseq2/pak1.pak /usr/share/games/quake2-data/baseq2/
+5. cp <temp directory>/baseq2/pak2.pak /usr/share/games/quake2-data/baseq2/
+6. cp <temp directory>/baseq2/players/ /usr/share/games/quake2-data/baseq2/
+
+7. if you really want to use the crakhor model, you can find the
+ skins/sounds on websites like http://www.mike-d.com/games/modskins.html
+ (optional)
+
+===============================================================================
+
+Capture The Flag:
+-----------
+To run Capture The Flag, you need to do the following:
+
+1. Download ftp://ftp.idsoftware.com/idstuff/quake2/q2-3.20-x86-full-ctf.exe
+2. unzip that file (using unzip -L) into a temp directory
+3. cp <temp directory>/ctf /usr/share/games/quake2-data/
+
+Execute quake2 with:
+
+quake2 +set game ctf +set dedicated 1
+ -- or --
+q2ded +set game ctf
+===============================================================================
+
+Joystick Support:
+-----------------
+Joystick should function on all compatible SDL platforms using the sdlquake2
+binary as well as on linux using the linux kernel joystick API.
+
+Joystick obeys the same free-look/strafe rules as mouse. You can set these in
+the options menu.
+
+There are four command line settings for joystick:
+1. j_invert_y [1],0 if set to zero pulling back on the joystick points down
+2. j_lr_axis [0] set the axis which controls left right movement
+3. j_ud_axis [1] set the axis which controls up down (in free-look) or
+ forward back (freelock off)
+4. j_throttle [3] set the axis which controls the players forward backward
+ throttle (if free-look is true)
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch
new file mode 100644
index 000000000000..185359373c4b
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-alsa.patch
@@ -0,0 +1,172 @@
+--- src/linux/snd_alsa.c.old
++++ src/linux/snd_alsa.c
+@@ -22,13 +22,22 @@
+ $Id: quake2-icculus-0.16.1-alsa.patch,v 1.2 2015/03/27 06:40:34 mr_bones_ Exp $
+ */
+
+-#define BUFFER_SIZE 4096
++// quake2-r0.16.1/src/linux/snd_alsa.c 2010-08-29 09:58:50
++// Alsa Redux Patch
++#define BUFFER_SIZE 16384
+
+ #include <alsa/asoundlib.h>
+
+ #include "../client/client.h"
+ #include "../client/snd_loc.h"
+
++#define AFSize 4
++static int snd_inited=0;
++static snd_pcm_t *playback_handle;
++static int AlsaFrames;
++static int AlsaPos;
++
++/*
+ #define snd_buf BUFFER_SIZE
+
+ static int snd_inited;
+@@ -43,17 +52,58 @@
+ cvar_t *snddevice;
+
+ static int tryrates[] = { 44100, 22051, 11025, 8000 };
+-
++*/
+ qboolean SNDDMA_Init (void)
+ {
+- int i;
+- int err;
+- int buffersize;
+- int framesize;
+- int format;
++ int confirm;
++ int latency;
++ Com_Printf("Setting up ALSA driver .....\n");
+
+ if (snd_inited) { return 1; }
+-
++ int s_khz=(Cvar_Get("s_khz", "22", CVAR_ARCHIVE))->value;
++ if (s_khz <22 ){
++ Com_Printf("Low Performance 11KHz.\n");
++ Cvar_Set("s_mixahead","0.2");
++ dma.speed=11025;
++ AlsaFrames=2048;
++ latency=200000;
++ }else{
++ Com_Printf("High Quality 48KHz.\n");
++ Cvar_Set("s_mixahead","0.1");
++ dma.speed=48000;
++ AlsaFrames=4800;
++ latency=110000;}
++
++ dma.channels = 2;
++ dma.samplebits = 16;
++ AlsaPos = 0;
++ playback_handle = NULL;
++ confirm =
++snd_pcm_open(&playback_handle,"default",SND_PCM_STREAM_PLAYBACK,SND_PCM_NONBLOCK);
++ if (confirm < 0) {
++ Com_Printf("ALSA sound error: cannot open device \n");
++ return 0;}
++ confirm = snd_pcm_set_params(playback_handle,
++ SND_PCM_FORMAT_S16_LE,
++ SND_PCM_ACCESS_RW_INTERLEAVED,
++ dma.channels,
++ dma.speed,
++ 1,//soft resample
++ latency);
++ if (confirm < 0){
++ Com_Printf("Alsa error: %s\n", snd_strerror(confirm));
++ return 0;}
++ confirm = snd_pcm_prepare(playback_handle);
++ if (confirm < 0) {
++ Com_Printf("...failed.\n");
++ return 0;}
++
++ int rambuffer = (BUFFER_SIZE+AlsaFrames)*AFSize;
++ dma.buffer=malloc(rambuffer);
++ dma.samplepos = 0;
++ dma.samples = BUFFER_SIZE*dma.channels;
++ dma.submission_chunk = 16;
++ /*
+ sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE);
+ sndspeed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE);
+ sndchannels = Cvar_Get("sndchannels", "2", CVAR_ARCHIVE);
+@@ -159,7 +209,6 @@
+ return 0;
+ }
+
+- /*
+ buffer_size = snd_pcm_hw_params_get_buffer_size(hw_params);
+ frame_size = (snd_pcm_format_physical_width(format)*dma.channels)/8;
+
+@@ -172,7 +221,6 @@
+ }
+
+ snd_buf = buffer_size*frame_size;
+- */
+
+ //snd_buf = BUFFER_SIZE;
+
+@@ -183,7 +231,7 @@
+ dma.samples = snd_buf / (dma.samplebits/8);
+ dma.submission_chunk = 1;
+ dma.buffer = (char *)buffer;
+-
++ */
+ snd_inited = 1;
+ return 1;
+ }
+@@ -191,11 +239,25 @@
+ int
+ SNDDMA_GetDMAPos (void)
+ {
+- if(snd_inited)
+- return dma.samplepos;
+- else
+- Com_Printf ("Sound not inizialized\n");
+- return 0;
++ int timerpos;
++ int send;
++ int taken;
++ timerpos = snd_pcm_avail(playback_handle);
++ if (timerpos<0){// likely buffer underrun.
++ timerpos = snd_pcm_prepare(playback_handle);
++ timerpos=0;}
++
++ send=AlsaFrames-timerpos;
++ if ( (send+AlsaPos)>BUFFER_SIZE )
++ { memcpy (dma.buffer+BUFFER_SIZE*AFSize,
++ dma.buffer,AlsaFrames*AFSize);}
++ taken = snd_pcm_writei(playback_handle, dma.buffer+AlsaPos*AFSize, send);
++ if (taken<0) {taken=0;}
++
++ AlsaPos+=taken;
++ if (BUFFER_SIZE<=AlsaPos){AlsaPos -= BUFFER_SIZE;}
++ return AlsaPos*dma.channels;
++
+ }
+
+ void
+@@ -205,8 +267,8 @@
+ snd_pcm_drop(playback_handle);
+ snd_pcm_close(playback_handle);
+ snd_inited = 0;
++ free(dma.buffer);
+ }
+- free(dma.buffer);
+ dma.buffer = NULL;
+ }
+
+@@ -217,13 +279,6 @@
+ void
+ SNDDMA_Submit (void)
+ {
+- int written;
+-
+- if ((written = snd_pcm_writei(playback_handle, dma.buffer, snd_buf)) < 0) {
+- snd_pcm_prepare(playback_handle);
+- Com_Printf("alsa: buffer underrun\n");
+- }
+- dma.samplepos += written/(dma.samplebits/8);
+ }
+
+
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch
new file mode 100644
index 000000000000..b3291827996c
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-amd64.patch
@@ -0,0 +1,18 @@
+The default video renderers (softx / soft) currently do not work
+on amd64. So for now we add a little hack which will select the
+glx renderer by default.
+
+http://bugs.gentoo.org/show_bug.cgi?id=86552
+
+--- src/linux/vid_so.c
++++ src/linux/vid_so.c
+@@ -435,6 +440,9 @@ VID_Init
+ */
+ void VID_Init (void)
+ {
++#if defined __x86_64__
++ vid_ref = Cvar_Get ("vid_ref", "glx", CVAR_ARCHIVE);
++#endif
+ /* Create the video variables so we know how to start the graphics drivers */
+ // if DISPLAY is defined, try X
+ if (getenv("DISPLAY"))
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch
new file mode 100644
index 000000000000..626cf5a1b64d
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gcc41.patch
@@ -0,0 +1,14 @@
+--- src/xatrix/g_local.h.old
++++ src/xatrix/g_local.h
+@@ -446,11 +446,6 @@
+ extern int sm_meat_index;
+ extern int snd_fry;
+
+-extern int jacket_armor_index;
+-extern int combat_armor_index;
+-extern int body_armor_index;
+-
+-
+ // means of death
+ #define MOD_UNKNOWN 0
+ #define MOD_BLASTER 1
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch
new file mode 100644
index 000000000000..61f0bb2286e5
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gentoo-paths.patch
@@ -0,0 +1,213 @@
+--- Makefile
++++ Makefile
+@@ -74,35 +74,46 @@ endif
+
+ CC=gcc
+
++ifndef OPT_CFLAGS
+ ifeq ($(ARCH),axp)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
++OPT_CFLAGS=-ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations
+ endif
+
+ ifeq ($(ARCH),ppc)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
++OPT_CFLAGS=-O2 -ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations
+ endif
+
+ ifeq ($(ARCH),sparc)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -ffast-math -funroll-loops \
++OPT_CFLAGS=-ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations
+ endif
+
+ ifeq ($(ARCH),i386)
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops -falign-loops=2 \
++OPT_CFLAGS=-O2 -ffast-math -funroll-loops -falign-loops=2 \
+ -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing
+ # 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 \
++#OPT_CFLAGS=-O6 -m486 -ffast-math -funroll-loops \
+ # -fomit-frame-pointer -fexpensive-optimizations -malign-loops=2 \
+ # -malign-jumps=2 -malign-functions=2
+ endif
+
+ ifeq ($(ARCH),x86_64)
+ _LIB := 64
+-RELEASE_CFLAGS=$(BASE_CFLAGS) -O2 -ffast-math -funroll-loops \
++OPT_CFLAGS=-O2 -ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations -fno-strict-aliasing
+ endif
++endif
++RELEASE_CFLAGS=$(BASE_CFLAGS) $(OPT_CFLAGS)
++
++ifeq ($(ADDCFLAGS),debug)
++CFLAGS=$(DEBUG_CFLAGS) -DLINUX_VERSION=\"$(VERSION) Debug\"
++endif
++
++ifeq ($(ADDCFLAGS),release)
++CFLAGS=$(RELEASE_CFLAGS) -DLINUX_VERSION=\"$(VERSION)\"
++endif
+
+ VERSION=3.21+r0.16
+
+@@ -133,6 +136,13 @@ else
+ NET_UDP=net_udp
+ endif
+
++ifdef DEFAULT_BASEDIR
++BASE_CFLAGS += -DDEFAULT_BASEDIR=\"$(DEFAULT_BASEDIR)\"
++endif
++ifdef DEFAULT_LIBDIR
++BASE_CFLAGS += -DDEFAULT_LIBDIR=\"$(DEFAULT_LIBDIR)\"
++endif
++
+ ifeq ($(strip $(BUILD_QMAX)),YES)
+ BASE_CFLAGS+=-DQMAX
+ endif
+@@ -406,7 +424,7 @@
+ $(BUILD_DEBUG_DIR)/ctf \
+ $(BUILD_DEBUG_DIR)/xatrix \
+ $(BUILD_DEBUG_DIR)/rogue
+- $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) CFLAGS="$(DEBUG_CFLAGS) -DLINUX_VERSION='\"$(VERSION) Debug\"'"
++ $(MAKE) targets BUILDDIR=$(BUILD_DEBUG_DIR) ADDCFLAGS=debug
+
+ build_release:
+ @-mkdir -p $(BUILD_RELEASE_DIR) \
+@@ -418,7 +436,7 @@
+ $(BUILD_RELEASE_DIR)/ctf \
+ $(BUILD_RELEASE_DIR)/xatrix \
+ $(BUILD_RELEASE_DIR)/rogue
+- $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) CFLAGS="$(RELEASE_CFLAGS) -DLINUX_VERSION='\"$(VERSION)\"'"
++ $(MAKE) targets BUILDDIR=$(BUILD_RELEASE_DIR) ADDCFLAGS=release
+
+ targets: $(TARGETS)
+
+--- src/linux/qgl_linux.c
++++ src/linux/qgl_linux.c
+@@ -3006,13 +3006,17 @@ qboolean QGL_Init( const char *dllname )
+ // dllname, dlerror());
+
+ // try basedir next
+- path = ri.Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
++ path = ri.Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET)->string;
+
+ snprintf (fn, MAX_OSPATH, "%s/%s", path, dllname );
+
+ if ( ( glw_state.OpenGLLib = dlopen( fn, RTLD_LAZY ) ) == 0 ) {
+- ri.Con_Printf( PRINT_ALL, "%s\n", dlerror() );
+- return false;
++ path = ri.Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET)->string;
++ snprintf (fn, MAX_OSPATH, "%s/%s", path, dllname );
++ if ( ( glw_state.OpenGLLib = dlopen( fn, RTLD_LAZY ) ) == 0 ) {
++ ri.Con_Printf( PRINT_ALL, "%s\n", dlerror() );
++ return false;
++ }
+ }
+ Com_Printf ("Using %s for OpenGL...", fn);
+ } else {
+--- src/linux/vid_so.c
++++ src/linux/vid_so.c
+@@ -237,13 +237,17 @@ qboolean VID_LoadRefresh( char *name )
+ //regain root
+ seteuid(saved_euid);
+
+- path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
++ path = Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET)->string;
+
+ snprintf (fn, MAX_OSPATH, "%s/%s", path, name );
+
+ if (stat(fn, &st) == -1) {
+- Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name, strerror(errno));
+- return false;
++ path = Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET)->string;
++ snprintf (fn, MAX_OSPATH, "%s/%s", path, name );
++ if (stat(fn, &st) == -1) {
++ Com_Printf( "LoadLibrary(\"%s\") failed: %s\n", name, strerror(errno));
++ return false;
++ }
+ }
+
+ // permission checking
+@@ -493,13 +497,19 @@ qboolean VID_CheckRefExists (const char
+ char *path;
+ struct stat st;
+
+- path = Cvar_Get ("basedir", ".", CVAR_NOSET)->string;
++ path = Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET)->string;
+ snprintf (fn, MAX_OSPATH, "%s/ref_%s.so", path, ref );
+
+ if (stat(fn, &st) == 0)
+ return true;
+- else
+- return false;
++ else {
++ path = Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET)->string;
++ snprintf (fn, MAX_OSPATH, "%s/ref_%s.so", path, ref );
++ if (stat(fn, &st) == 0)
++ return true;
++ else
++ return false;
++ }
+ }
+
+ /*****************************************************************************/
+--- src/qcommon/files.c
++++ src/qcommon/files.c
+@@ -60,6 +60,7 @@ typedef struct pack_s
+
+ char fs_gamedir[MAX_OSPATH];
+ cvar_t *fs_basedir;
++cvar_t *fs_libdir;
+ cvar_t *fs_cddir;
+ cvar_t *fs_gamedirvar;
+
+@@ -681,6 +682,7 @@ void FS_SetGamedir (char *dir)
+ if (fs_cddir->string[0])
+ FS_AddGameDirectory (va("%s/%s", fs_cddir->string, dir) );
+ FS_AddGameDirectory (va("%s/%s", fs_basedir->string, dir) );
++ FS_AddGameDirectory (va("%s/%s", fs_libdir->string, dir) );
+ FS_AddHomeAsGameDirectory(dir);
+ }
+ }
+@@ -898,7 +900,13 @@ void FS_InitFilesystem (void)
+ // basedir <path>
+ // allows the game to run from outside the data tree
+ //
+- fs_basedir = Cvar_Get ("basedir", ".", CVAR_NOSET);
++ fs_basedir = Cvar_Get ("basedir", DEFAULT_BASEDIR, CVAR_NOSET);
++
++ //
++ // libdir <path>
++ // allows the game to store binary files (not data) in a sep tree
++ //
++ fs_libdir = Cvar_Get ("libdir", DEFAULT_LIBDIR, CVAR_NOSET);
+
+ //
+ // cddir <path>
+@@ -913,6 +921,7 @@ void FS_InitFilesystem (void)
+ // add baseq2 to search path
+ //
+ FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_basedir->string) );
++ FS_AddGameDirectory (va("%s/"BASEDIRNAME, fs_libdir->string) );
+
+ //
+ // then add a '.quake2/baseq2' directory in home directory by default
+--- src/qcommon/qcommon.h
++++ src/qcommon/qcommon.h
+@@ -74,6 +74,13 @@ Foundation, Inc., 59 Temple Place - Suit
+
+ #endif
+
++#ifndef DEFAULT_BASEDIR
++# define DEFAULT_BASEDIR "."
++#endif
++#ifndef DEFAULT_LIBDIR
++# define DEFAULT_LIBDIR DEFAULT_BASEDIR
++#endif
++
+ //============================================================================
+
+ typedef struct sizebuf_s
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch
new file mode 100644
index 000000000000..ad1f37309c30
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-gnusource.patch
@@ -0,0 +1,12 @@
+--- quake2-r0.16.1/src/linux/q_shlinux.c
++++ quake2-r0.16.1-modified/src/linux/q_shlinux.c
+@@ -17,6 +17,9 @@
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ */
++#if !defined(_GNU_SOURCE)
++ #define _GNU_SOURCE
++#endif
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <errno.h>
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch
new file mode 100644
index 000000000000..ae1aa2e4068c
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ia64.patch
@@ -0,0 +1,97 @@
+--- quake2-r0.16.1.orig/Makefile
++++ quake2-r0.16.1/Makefile
+@@ -54,24 +54,26 @@ endif
+
+
+ # 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/)
+
+ ifneq ($(ARCH),x86_64)
+ ifneq ($(ARCH),i386)
+ ifneq ($(ARCH),axp)
++ifneq ($(ARCH),ia64)
+ ifneq ($(ARCH),ppc)
+ ifneq ($(ARCH),sparc)
+ $(error arch $(ARCH) is currently not supported)
+ endif
+ endif
+ endif
+ endif
+ endif
++endif
+
+ CC=gcc
+
+ ifndef OPT_CFLAGS
+ ifeq ($(ARCH),axp)
+ OPT_CFLAGS=-ffast-math -funroll-loops \
+ -fomit-frame-pointer -fexpensive-optimizations
+ endif
+@@ -283,16 +285,46 @@ ifeq ($(ARCH),axp)
+ $(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),ia64)
++ 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 ia64
++
+ 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
+--- quake2-r0.16.1.orig/src/linux/sys_linux.c
++++ quake2-r0.16.1/src/linux/sys_linux.c
+@@ -216,16 +216,18 @@ void *Sys_GetGameAPI (void *parms)
+ char *path;
+ char *str_p;
+ #if defined __i386__
+ const char *gamename = "gamei386.so";
+ #elif defined __x86_64__
+ const char *gamename = "gamex86_64.so";
+ #elif defined __alpha__
+ const char *gamename = "gameaxp.so";
++#elif defined __ia64__
++ const char *gamename = "gameia64.so";
+ #elif defined __powerpc__
+ const char *gamename = "gameppc.so";
+ #elif defined __sparc__
+ const char *gamename = "gamesparc.so";
+ #else
+ #error Unknown arch
+ #endif
+
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch
new file mode 100644
index 000000000000..978c9c9820ea
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-ldflags.patch
@@ -0,0 +1,56 @@
+--- Makefile.old
++++ Makefile
+@@ -169,18 +169,18 @@
+ DEBUG_CFLAGS=$(BASE_CFLAGS) -g
+
+ ifeq ($(OSTYPE),FreeBSD)
+-LDFLAGS=-lm
++LDLIBS=-lm
+ endif
+ ifeq ($(OSTYPE),Linux)
+-LDFLAGS=-lm -ldl
++LDLIBS=-lm -ldl
+ endif
+
+ ifeq ($(strip $(BUILD_ARTS)),YES)
+-LDFLAGS+=$(shell artsc-config --libs)
++LDLIBS+=$(shell artsc-config --libs)
+ endif
+
+ ifeq ($(strip $(BUILD_ALSA)),YES)
+-LDFLAGS+=-lasound
++LDLIBS+=-lasound
+ endif
+
+
+@@ -226,7 +226,7 @@
+ SHLIBEXT=so
+
+ SHLIBCFLAGS=-fPIC
+-SHLIBLDFLAGS=-shared
++SHLIBLDFLAGS=$(LDFLAGS) -shared
+
+ DO_CC=$(CC) $(CFLAGS) -o $@ -c $<
+ DO_DED_CC=$(CC) $(CFLAGS) -DDEDICATED_ONLY -o $@ -c $<
+@@ -518,10 +518,10 @@
+ endif
+
+ $(BUILDDIR)/quake2 : $(QUAKE2_OBJS) $(QUAKE2_LNX_OBJS) $(QUAKE2_AS_OBJS)
+- $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_LNX_OBJS) $(QUAKE2_AS_OBJS) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_LNX_OBJS) $(QUAKE2_AS_OBJS) $(LDLIBS)
+
+ $(BUILDDIR)/sdlquake2 : $(QUAKE2_OBJS) $(QUAKE2_SDL_OBJS) $(QUAKE2_AS_OBJS)
+- $(CC) $(CFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_SDL_OBJS) $(QUAKE2_AS_OBJS) $(LDFLAGS) $(SDLLDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(QUAKE2_OBJS) $(QUAKE2_SDL_OBJS) $(QUAKE2_AS_OBJS) $(LDLIBS) $(SDLLDFLAGS)
+
+ $(BUILDDIR)/client/cl_cin.o : $(CLIENT_DIR)/cl_cin.c
+ $(DO_CC)
+@@ -710,7 +710,7 @@
+ $(BUILDDIR)/ded/cd_null.o
+
+ $(BUILDDIR)/q2ded : $(Q2DED_OBJS)
+- $(CC) $(CFLAGS) -o $@ $(Q2DED_OBJS) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(Q2DED_OBJS) $(LDLIBS)
+
+ $(BUILDDIR)/ded/cmd.o : $(COMMON_DIR)/cmd.c
+ $(DO_DED_CC)
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch
new file mode 100644
index 000000000000..d94925b83e4b
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-no-asm-io.patch
@@ -0,0 +1,25 @@
+http://bugs.gentoo.org/193107
+
+asm/io.h does not exist with sanitized kernel headers, nor do these source
+files actually need the header, so punt it
+
+--- src/linux/rw_in_aa.c
++++ src/linux/rw_in_aa.c
+@@ -46,7 +46,6 @@
+ #include <sys/mman.h>
+
+ #if defined (__linux__)
+-#include <asm/io.h>
+ #include <sys/vt.h>
+ #endif
+
+--- src/linux/rw_aa.c
++++ src/linux/rw_aa.c
+@@ -63,7 +63,6 @@
+ #include <dlfcn.h>
+ #if defined (__linux__)
+ #include <sys/vt.h>
+-#include <asm/io.h>
+ #endif
+ #include <aalib.h>
+
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch
new file mode 100644
index 000000000000..6dc6f0f1ddfb
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_mouse.patch
@@ -0,0 +1,13 @@
+--- src/linux/rw_x11.c.old
++++ src/linux/rw_x11.c
+@@ -989,8 +989,8 @@
+ }
+ else
+ {
+- mx -= ((int)event.xmotion.x + mwx)*2;
+- my -= ((int)event.xmotion.y + mwy)*2;
++ mx += ((int)event.xmotion.x - mwx)*2;
++ my += ((int)event.xmotion.y - mwy)*2;
+ mwx = event.xmotion.x;
+ mwy = event.xmotion.y;
+
diff --git a/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch
new file mode 100644
index 000000000000..e23caf9db09f
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2-icculus-0.16.1-x11_soft.patch
@@ -0,0 +1,45 @@
+
+the x11 software renderer just needs some tweaks to get working
+
+--- Makefile.old
++++ Makefile
+@@ -358,7 +358,7 @@
+ endif
+
+ ifeq ($(strip $(BUILD_X11)),YES)
+- $(warning Warning: Software X Renderer not supported for $(ARCH))
++ TARGETS += $(BUILDDIR)/ref_softx.$(SHLIBEXT)
+ endif
+
+ ifeq ($(strip $(BUILD_GLX)),YES)
+--- src/linux/rw_x11.c.old
++++ src/linux/rw_x11.c
+@@ -53,7 +53,7 @@
+ #include <X11/Xatom.h>
+ #include <X11/keysym.h>
+ #include <X11/extensions/XShm.h>
+-#include <X11/extensions/xf86dga.h>
++#include <X11/extensions/Xxf86dga.h>
+ #ifdef OPENGL
+ #include <X11/extensions/xf86vmode.h>
+ #endif
+@@ -151,7 +151,7 @@
+ int config_notify_height;
+
+ typedef unsigned short PIXEL16;
+-typedef unsigned long PIXEL24;
++typedef unsigned int PIXEL24;
+ #ifdef REDBLUE
+ static PIXEL16 st2d_8to16table_s[2][256];
+ static PIXEL24 st2d_8to24table_s[2][256];
+--- src/ref_soft/r_poly.c.old
++++ src/ref_soft/r_poly.c
+@@ -994,7 +994,7 @@
+ scale = yscale * pout->zi;
+ pout->v = (ycenter - scale * transformed[1]);
+
+- pv += sizeof (vec5_t) / sizeof (pv);
++ pv += sizeof (vec5_t) / sizeof (float);
+ }
+
+ // draw it
diff --git a/games-fps/quake2-icculus/files/quake2.xpm b/games-fps/quake2-icculus/files/quake2.xpm
new file mode 100644
index 000000000000..bbbcbb8f064f
--- /dev/null
+++ b/games-fps/quake2-icculus/files/quake2.xpm
@@ -0,0 +1,37 @@
+/* XPM */
+static char * quake2_xpm[] = {
+"32 32 2 1",
+" c None",
+". c #000000",
+" ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" ... ... ",
+" ... ........ ... ",
+" ... ...... ... ",
+" .... .. .. .... ",
+" .... .. .. .... ",
+" ........ ........ ",
+" ................ ",
+" .............. ",
+" .......... ",
+" ...... ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. ",
+" .. .. "};
diff --git a/games-fps/quake2-icculus/metadata.xml b/games-fps/quake2-icculus/metadata.xml
new file mode 100644
index 000000000000..62d0273c2558
--- /dev/null
+++ b/games-fps/quake2-icculus/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>games@gentoo.org</email>
+ <name>Gentoo Games Project</name>
+ </maintainer>
+ <use>
+ <flag name="demo">Install the demo files (quake2-demodata) and configure for use</flag>
+ <flag name="qmax">Build the pretty version (quake max)</flag>
+ <flag name="rogue">Build support for the 'Ground Zero' Mission Pack (rogue)</flag>
+ <flag name="xatrix">Build support for the 'The Reckoning' Mission Pack (xatrix)</flag>
+ </use>
+</pkgmetadata>
diff --git a/games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild b/games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild
new file mode 100644
index 000000000000..04bd7037c7f1
--- /dev/null
+++ b/games-fps/quake2-icculus/quake2-icculus-0.16.1-r1.ebuild
@@ -0,0 +1,195 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit eutils toolchain-funcs games
+
+MY_P="quake2-r${PV}"
+DESCRIPTION="The icculus.org Linux port of iD's Quake 2 engine"
+HOMEPAGE="http://icculus.org/quake2/"
+SRC_URI="http://icculus.org/quake2/files/${MY_P}.tar.gz
+ qmax? ( http://icculus.org/quake2/files/maxpak.pak )
+ rogue? ( mirror://idsoftware/quake2/source/roguesrc320.shar.Z )
+ xatrix? ( mirror://idsoftware/quake2/source/xatrixsrc320.shar.Z )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 x86 ~x86-fbsd"
+IUSE="aalib alsa cdinstall dedicated demo ipv6 joystick opengl qmax rogue sdl X xatrix"
+
+UIDEPEND="aalib? ( media-libs/aalib )
+ alsa? ( media-libs/alsa-lib )
+ opengl? ( virtual/opengl )
+ sdl? ( media-libs/libsdl[sound,joystick?,video] )
+ X? (
+ x11-libs/libXxf86dga
+ x11-libs/libXxf86vm
+ )"
+RDEPEND="${UIDEPEND}
+ cdinstall? ( games-fps/quake2-data )
+ demo? ( games-fps/quake2-demodata )"
+DEPEND="${UIDEPEND}
+ X? ( x11-proto/xf86dgaproto )
+ rogue? ( || ( sys-freebsd/freebsd-ubin app-arch/sharutils ) )
+ xatrix? ( || ( sys-freebsd/freebsd-ubin app-arch/sharutils ) )"
+
+S=${WORKDIR}/${MY_P}
+
+pkg_setup() {
+ games_pkg_setup
+
+ if ! use qmax && $( use opengl || use sdl ) ; then
+ elog "The 'qmax' graphical improvements are recommended."
+ echo
+ fi
+}
+
+src_prepare() {
+ # Now we deal with the silly rogue / xatrix addons ... this is ugly :/
+ ln -s $(type -P echo) "${T}"/more
+ for g in rogue xatrix ; do
+ use ${g} || continue
+ mkdir -p src/${g}
+ pushd src/${g}
+ local shar=../../../${g}src320.shar
+ sed -i -e 's:^read ans:ans=yes :' ${shar} || die
+ echo ">>> Unpacking ${shar} to ${PWD}"
+ env PATH="${T}:${PATH}" unshar ${shar} || die
+ popd
+ done
+ sed -i -e 's:jpeg_mem_src:_&:' src/ref_candygl/gl_image.c || die
+
+ sed -i -e 's:BUILD_SOFTX:BUILD_X11:' Makefile || die
+ # -amd64.patch # make sure this is still needed in future versions
+ epatch \
+ "${FILESDIR}"/${P}-amd64.patch \
+ "${FILESDIR}"/${P}-gentoo-paths.patch \
+ "${FILESDIR}"/${P}-ldflags.patch \
+ "${FILESDIR}"/${P}-no-asm-io.patch \
+ "${FILESDIR}"/${P}-gnusource.patch \
+ "${FILESDIR}"/${P}-x11_soft.patch \
+ "${FILESDIR}"/${P}-x11_mouse.patch \
+ "${FILESDIR}"/${P}-alsa.patch \
+ "${FILESDIR}"/${P}-ia64.patch
+
+ if use xatrix ; then
+ epatch "${FILESDIR}/${P}"-gcc41.patch
+ fi
+ if use rogue ; then
+ cd src
+ epatch \
+ "${FILESDIR}"/0.16-rogue-nan.patch \
+ "${FILESDIR}"/0.16-rogue-armor.patch
+ fi
+}
+
+yesno() {
+ for f in "$@" ; do
+ if ! use $f ; then
+ echo NO
+ return 1
+ fi
+ done
+ echo YES
+ return 0
+}
+
+src_compile() {
+ # xatrix fails to build
+ # rogue fails to build
+ local libsuffix
+ for BUILD_QMAX in YES NO ; do
+ ! use qmax && [[ ${BUILD_QMAX} == "YES" ]] && continue
+ [[ ${BUILD_QMAX} == "YES" ]] \
+ && libsuffix=-qmax \
+ || libsuffix=
+ emake -j1 clean
+ emake -j1 build_release \
+ BUILD_SDLQUAKE2=$(yesno sdl) \
+ BUILD_SVGA=NO \
+ BUILD_X11=$(yesno X) \
+ BUILD_GLX=$(yesno opengl) \
+ BUILD_SDL=$(yesno sdl) \
+ BUILD_SDLGL=$(yesno sdl opengl) \
+ BUILD_CTFDLL=YES \
+ BUILD_XATRIX=$(yesno xatrix) \
+ BUILD_ROGUE=$(yesno rogue) \
+ BUILD_JOYSTICK=$(yesno joystick) \
+ BUILD_DEDICATED=$(yesno dedicated) \
+ BUILD_AA=$(yesno aalib) \
+ BUILD_QMAX=${BUILD_QMAX} \
+ HAVE_IPV6=$(yesno ipv6) \
+ BUILD_ARTS=NO \
+ BUILD_ALSA=$(yesno alsa) \
+ SDLDIR=/usr/lib \
+ DEFAULT_BASEDIR="${GAMES_DATADIR}/quake2" \
+ DEFAULT_LIBDIR="$(games_get_libdir)/${PN}${libsuffix}" \
+ OPT_CFLAGS="${CFLAGS}" \
+ CC="$(tc-getCC)"
+ # now we save the build dir ... except for the object files ...
+ rm release*/*/*.o
+ mv release* my-rel-${BUILD_QMAX}
+ cd my-rel-${BUILD_QMAX}
+ rm -rf ref_{gl,soft} ded game client ctf/*.o
+ mkdir baseq2
+ mv game*.so baseq2/
+ cd ..
+ done
+}
+
+src_install() {
+ local q2dir=$(games_get_libdir)/${PN}
+ local q2maxdir=$(games_get_libdir)/${PN}-qmax
+
+ dodoc readme.txt README TODO "${FILESDIR}"/README-postinstall
+
+ # regular q2 files
+ dodir "${q2dir}"
+ cp -rf my-rel-NO/* "${D}/${q2dir}"/
+ dogamesbin "${D}/${q2dir}"/quake2
+ rm "${D}/${q2dir}"/quake2
+ use dedicated \
+ && dogamesbin "${D}/${q2dir}"/q2ded \
+ && rm "${D}/${q2dir}"/q2ded
+ use sdl \
+ && dogamesbin "${D}/${q2dir}"/sdlquake2 \
+ && rm "${D}/${q2dir}"/sdlquake2
+
+ doicon "${FILESDIR}"/quake2.xpm
+ make_desktop_entry quake2 "Quake 2" quake2
+
+ # q2max files
+ if use qmax ; then
+ dodir "${q2maxdir}"
+ cp -rf my-rel-YES/* "${D}/${q2maxdir}"/ || die
+ newgamesbin "${D}/${q2maxdir}"/quake2 quake2-qmax
+ rm "${D}/${q2maxdir}"/quake2
+ use dedicated \
+ && newgamesbin "${D}/${q2maxdir}"/q2ded q2ded-qmax \
+ && rm "${D}/${q2maxdir}"/q2ded
+ use sdl \
+ && newgamesbin "${D}/${q2maxdir}"/sdlquake2 sdlquake2-qmax \
+ && rm "${D}/${q2maxdir}"/sdlquake2
+
+ insinto "${q2maxdir}"/baseq2
+ doins "${DISTDIR}"/maxpak.pak
+
+ make_desktop_entry quake2-qmax Quake2-qmax quake2
+ fi
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+
+ elog "Go read README-postinstall in /usr/share/doc/${PF}"
+ elog "right now! It's important - This install is just the engine, you still need"
+ elog "the data paks. Go read."
+
+ if use demo && ! has_version "games-fps/quake2-demodata[symlink]" ; then
+ ewarn "To play the Quake 2 demo,"
+ ewarn "emerge games-fps/quake2-demodata with the 'symlink' USE flag."
+ echo
+ fi
+}