summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2010-02-22 21:58:47 +0000
committerwiz <wiz@pkgsrc.org>2010-02-22 21:58:47 +0000
commit78f5f39085be5dab71310caa6971ddc7d1f0388a (patch)
tree8577c3d87d321f5faa238d6aaf906f0b77d9d1cb
parent3c1dab7861f7ae2f2f908b01c105757f56579a13 (diff)
downloadpkgsrc-78f5f39085be5dab71310caa6971ddc7d1f0388a.tar.gz
Re-add xdoom, requested by drochner.
Address PR 24024 by marking it as not-for-lp64platforms.
-rw-r--r--games/Makefile3
-rw-r--r--games/xdoom/DESCR10
-rw-r--r--games/xdoom/Makefile63
-rw-r--r--games/xdoom/PLIST4
-rw-r--r--games/xdoom/distinfo39
-rw-r--r--games/xdoom/patches/patch-aa20
-rw-r--r--games/xdoom/patches/patch-ab35
-rw-r--r--games/xdoom/patches/patch-ac66
-rw-r--r--games/xdoom/patches/patch-ad13
-rw-r--r--games/xdoom/patches/patch-ae18
-rw-r--r--games/xdoom/patches/patch-af21
-rw-r--r--games/xdoom/patches/patch-ag35
-rw-r--r--games/xdoom/patches/patch-ah55
-rw-r--r--games/xdoom/patches/patch-ai137
-rw-r--r--games/xdoom/patches/patch-aj22
-rw-r--r--games/xdoom/patches/patch-ak14
-rw-r--r--games/xdoom/patches/patch-al13
-rw-r--r--games/xdoom/patches/patch-am13
-rw-r--r--games/xdoom/patches/patch-an51
-rw-r--r--games/xdoom/patches/patch-ao24
-rw-r--r--games/xdoom/patches/patch-ap18
-rw-r--r--games/xdoom/patches/patch-aq13
-rw-r--r--games/xdoom/patches/patch-ar78
-rw-r--r--games/xdoom/patches/patch-as13
-rw-r--r--games/xdoom/patches/patch-at123
-rw-r--r--games/xdoom/patches/patch-au16
-rw-r--r--games/xdoom/patches/patch-av16
-rw-r--r--games/xdoom/patches/patch-aw27
-rw-r--r--games/xdoom/patches/patch-ax16
-rw-r--r--games/xdoom/patches/patch-ay42
-rw-r--r--games/xdoom/patches/patch-az38
-rw-r--r--games/xdoom/patches/patch-ba13
-rw-r--r--games/xdoom/patches/patch-bb27
-rw-r--r--games/xdoom/patches/patch-bc30
-rw-r--r--games/xdoom/patches/patch-bd40
-rw-r--r--games/xdoom/patches/patch-be12
-rw-r--r--licenses/xdoom-license106
37 files changed, 1283 insertions, 1 deletions
diff --git a/games/Makefile b/games/Makefile
index 761eb429556..dbd7712947b 100644
--- a/games/Makefile
+++ b/games/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.330 2010/02/21 16:17:12 wiz Exp $
+# $NetBSD: Makefile,v 1.331 2010/02/22 21:58:47 wiz Exp $
#
COMMENT= Games
@@ -268,6 +268,7 @@ SUBDIR+= xbomber
SUBDIR+= xbreaky
SUBDIR+= xconq
SUBDIR+= xdemineur
+SUBDIR+= xdoom
SUBDIR+= xemeraldia
SUBDIR+= xevil
SUBDIR+= xfreecell
diff --git a/games/xdoom/DESCR b/games/xdoom/DESCR
new file mode 100644
index 00000000000..e590831c90f
--- /dev/null
+++ b/games/xdoom/DESCR
@@ -0,0 +1,10 @@
+DOOM is a lightning-fast virtual reality adventure where you're the
+toughest space trooper ever to suck vacuum. Your mission is to shoot
+your way through a monster-infested holocaust. Living to tell the tale if
+possible.
+
+The gameplay for DOOM is quite simple. This is not a cumbersome
+adventure game, but an action-oriented slugathon. You don't need the
+reflexes of a hyperactive eight-year-old to win, either--using your wits is
+IMPORTANT. To escape DOOM, you need both brains and the killer
+instinct.
diff --git a/games/xdoom/Makefile b/games/xdoom/Makefile
new file mode 100644
index 00000000000..c46ef8dfb25
--- /dev/null
+++ b/games/xdoom/Makefile
@@ -0,0 +1,63 @@
+# $NetBSD: Makefile,v 1.46 2010/02/22 21:58:47 wiz Exp $
+
+DISTNAME= linuxdoom-1.10
+PKGNAME= xdoom-1.10
+PKGREVISION= 3
+CATEGORIES= games x11
+MASTER_SITES= ftp://ftp.idsoftware.com/idstuff/source/
+MASTER_SITES+= ftp://ftp.idsoftware.com/idstuff/doom/
+DISTFILES= doomsrc.zip doom-1.8.wad.gz
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+# HOMEPAGE= http://www.idsoftware.com/archives/doomarc.html
+# AWOL
+COMMENT= 3D shoot-em-up for 8-bit X11 displays
+LICENSE= xdoom-license
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+EXTRACT_ONLY= doomsrc.zip
+
+WRKSRC= ${WRKDIR}
+USE_X11BASE= yes
+USE_TOOLS+= gmake gunzip tar unzip
+MAKE_ENV+= X11BASE=${X11BASE:Q} INSTALL_PREFIX=${PREFIX:Q}
+
+NOT_FOR_PLATFORM= ${LP64PLATFORMS}
+
+INSTALLATION_DIRS= share/doom
+
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "Linux"
+CFLAGS+= -DLINUX
+.endif
+
+.include "../../mk/endian.mk"
+
+.if ${MACHINE_ENDIAN} == "big"
+CFLAGS+= -D__BIG_ENDIAN__=1
+.endif
+
+INSTALLATION_DIRS= bin
+
+post-extract:
+ (cd ${WRKDIR}; ${TAR} xzf linuxdoom-1.10.src.tgz)
+ (cd ${WRKDIR}; ${TAR} xzf sndserv.tgz)
+
+do-build:
+ cd ${WRKSRC}/${DISTNAME} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS}
+ cd ${WRKSRC}/sndserv && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS}
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/${DISTNAME}/linux/linuxxdoom \
+ ${DESTDIR}${PREFIX}/bin/xdoom
+ ${INSTALL_PROGRAM} ${WRKSRC}/sndserv/linux/sndserver \
+ ${DESTDIR}${PREFIX}/bin/sndserver
+ ${GUNZIP_CMD} -c ${DISTDIR}/doom-1.8.wad.gz \
+ > ${DESTDIR}${PREFIX}/share/doom/doom1.wad
+
+.include "../../x11/libXext/buildlink3.mk"
+.include "../../x11/xextproto/buildlink3.mk"
+.include "../../mk/oss.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/games/xdoom/PLIST b/games/xdoom/PLIST
new file mode 100644
index 00000000000..62a737cdd5b
--- /dev/null
+++ b/games/xdoom/PLIST
@@ -0,0 +1,4 @@
+@comment $NetBSD: PLIST,v 1.4 2010/02/22 21:58:47 wiz Exp $
+bin/xdoom
+bin/sndserver
+share/doom/doom1.wad
diff --git a/games/xdoom/distinfo b/games/xdoom/distinfo
new file mode 100644
index 00000000000..4414226e642
--- /dev/null
+++ b/games/xdoom/distinfo
@@ -0,0 +1,39 @@
+$NetBSD: distinfo,v 1.18 2010/02/22 21:58:47 wiz Exp $
+
+SHA1 (doomsrc.zip) = ffd07e0bd95b7c6ba0cd003fb6ff5ebd535d6f99
+RMD160 (doomsrc.zip) = c88e57b3cc72ca8bbfacbe138f8a3c69a13bf2e1
+Size (doomsrc.zip) = 362698 bytes
+SHA1 (doom-1.8.wad.gz) = e43334e5f31d93cadaf8f1ede6cd432f9b0aca68
+RMD160 (doom-1.8.wad.gz) = 5d951d1f685bedd68033a332a6581b5056213c21
+Size (doom-1.8.wad.gz) = 1756050 bytes
+SHA1 (patch-aa) = ff3a5f3acb186c1de4e7e0f542274db8b8c908e7
+SHA1 (patch-ab) = 32d4389a7fc2413d19fe8f66d6da9205effa710a
+SHA1 (patch-ac) = d47c6e1388f3d2d7ea5dbc074c5bec34adf14f1f
+SHA1 (patch-ad) = cb8e892e9fa561960da46c0bfea61bcf65246458
+SHA1 (patch-ae) = 5bba08b0ae36e3a9b9b48b1dba9570035cf1a54d
+SHA1 (patch-af) = 19367ee3112bfd0e5c054749347e642e6d0ff2ee
+SHA1 (patch-ag) = accb03154ee6fcd8771b5cd782bb4f4fb0c96b1b
+SHA1 (patch-ah) = d5ab2fd3f5593876d5c78e2a18ac909ec56ac8cf
+SHA1 (patch-ai) = 05d2abc579d970fec6c0776e953d6ad13946b9b6
+SHA1 (patch-aj) = 23e3b35b8072752a9d3fcaa1913f390cf6bd5146
+SHA1 (patch-ak) = 7ac753f505c5becc2ce26de209723fc464096cdc
+SHA1 (patch-al) = a3c5b2ae0a820010339c06655f53778e5edfd498
+SHA1 (patch-am) = 3b4606d1d040b8c9a9685ef66faf88598d64d3f2
+SHA1 (patch-an) = 2c146291dcacf250986a8a014dd1b0d69bb8f825
+SHA1 (patch-ao) = b2d0ae80d2832c0aac89da1a078afedd7d97362d
+SHA1 (patch-ap) = fe23b3894de0a1c4e32b266377a420e329179beb
+SHA1 (patch-aq) = 83b21a11e8007ea04fbedf10330887469b48dbab
+SHA1 (patch-ar) = 9f7285b05baf484f6546cc6678088e02cd0ff7ea
+SHA1 (patch-as) = 8d56b0a78a6cedb3b1ad63d9418081fb0277cf3d
+SHA1 (patch-at) = 96e5a88b7f250c35b148353d77eb6e598e35c661
+SHA1 (patch-au) = 7782fcbd0bd44f8739c5dbd2a0c3a1c1d3eac9db
+SHA1 (patch-av) = 494568bf3298195523c689125ad664d59d16e901
+SHA1 (patch-aw) = 431b990ad5bcf32fc5152c4b4331ce2bc85aba8b
+SHA1 (patch-ax) = 8aab1f5d3e6f0fc08bd673d37fb19c600aa0f60b
+SHA1 (patch-ay) = 525fe394abcb0833c7595d3bc0559afcc7319f3b
+SHA1 (patch-az) = f9494960fcb2b5c9b42274db4c603205f0556624
+SHA1 (patch-ba) = d8e41ed9d277145cd776ca5dc18e1c82cbefc8b7
+SHA1 (patch-bb) = 28dbedb6209466f5b9ad226e2a5583c3881acae1
+SHA1 (patch-bc) = e55e08d525469b44f96fbd45aeed0bedee0a9d8c
+SHA1 (patch-bd) = 35f01a7d790bb8683a6a4b72581dbe10307c57ed
+SHA1 (patch-be) = 8a6a822136899e09fd3a8dff80d5618d60dd7a3c
diff --git a/games/xdoom/patches/patch-aa b/games/xdoom/patches/patch-aa
new file mode 100644
index 00000000000..dfb0cdf3d57
--- /dev/null
+++ b/games/xdoom/patches/patch-aa
@@ -0,0 +1,20 @@
+$NetBSD: patch-aa,v 1.9 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/Makefile.orig Mon Dec 22 19:55:36 1997
++++ linuxdoom-1.10/Makefile Thu Feb 3 13:22:41 2000
+@@ -6,9 +6,12 @@
+ #
+ CC= gcc # gcc or g++
+
+-CFLAGS=-g -Wall -DNORMALUNIX -DLINUX # -DUSEASM
+-LDFLAGS=-L/usr/X11R6/lib
+-LIBS=-lXext -lX11 -lnsl -lm
++X11BASE?=/usr/X11R6
++
++CFLAGS+= -Wall -DNORMALUNIX -DSNDSRV -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\" #-DUSEASM
++CFLAGS+= -I$(X11BASE)/include
++LDFLAGS=-Wl,-R$(X11BASE)/lib -L$(X11BASE)/lib
++LIBS=-lXext -lX11 -lm
+
+ # subdirectory for objects
+ O=linux
diff --git a/games/xdoom/patches/patch-ab b/games/xdoom/patches/patch-ab
new file mode 100644
index 00000000000..04586ae295e
--- /dev/null
+++ b/games/xdoom/patches/patch-ab
@@ -0,0 +1,35 @@
+$NetBSD: patch-ab,v 1.5 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/am_map.c.orig Mon Dec 22 19:58:32 1997
++++ linuxdoom-1.10/am_map.c Thu Feb 3 01:33:44 2000
+@@ -783,7 +783,7 @@
+ //
+ void AM_updateLightLev(void)
+ {
+- static nexttic = 0;
++ static int nexttic = 0;
+ //static int litelevels[] = { 0, 3, 5, 6, 6, 7, 7, 7 };
+ static int litelevels[] = { 0, 4, 7, 10, 12, 14, 15, 15 };
+ static int litelevelscnt = 0;
+@@ -856,9 +856,9 @@
+ TOP =8
+ };
+
+- register outcode1 = 0;
+- register outcode2 = 0;
+- register outside;
++ register int outcode1 = 0;
++ register int outcode2 = 0;
++ register int outside;
+
+ fpoint_t tmp;
+ int dx;
+@@ -989,7 +989,7 @@
+ register int ay;
+ register int d;
+
+- static fuck = 0;
++ static int fuck = 0;
+
+ // For debugging only
+ if ( fl->a.x < 0 || fl->a.x >= f_w
diff --git a/games/xdoom/patches/patch-ac b/games/xdoom/patches/patch-ac
new file mode 100644
index 00000000000..01b74c1f67d
--- /dev/null
+++ b/games/xdoom/patches/patch-ac
@@ -0,0 +1,66 @@
+$NetBSD: patch-ac,v 1.5 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/d_main.c.orig Mon Dec 22 20:32:03 1997
++++ linuxdoom-1.10/d_main.c Thu Feb 3 13:35:25 2000
+@@ -577,7 +577,11 @@
+ char *doomwaddir;
+ doomwaddir = getenv("DOOMWADDIR");
+ if (!doomwaddir)
++#ifdef INSTALL_PREFIX
++ doomwaddir = INSTALL_PREFIX"/share/doom";
++#else
+ doomwaddir = ".";
++#endif
+
+ // Commercial.
+ doom2wad = malloc(strlen(doomwaddir)+1+9+1);
+@@ -804,7 +808,32 @@
+
+ setbuf (stdout, NULL);
+ modifiedgame = false;
+-
++
++ if (myargc > 1 && strcmp(myargv[1], "-h")==0)
++ {
++ printf(
++"Many options are not explained, and some are just plain broken.\n\
++Some more useful ones are:\n\
++ -2 -3 -4 Scale the window by 2, 3, or 4 times.\n\
++ -config FILE Load/save configuration from FILE.\n\
++ -episode N Set starting expisode to N.\n\
++ -grabmouse Grab the mouse to control movement.\n\
++ -volume N Set volume (default 8).\n\
++ -skill N Set starting skill level to N.\n\
++\n\
++Others are:\n\
++
++-altdeath -debugfile -file -nodraw -respawn -warp \n\
++-avg -devparm -geom -nomonsters -shdev -wart \n\
++-cdrom -disp -loadgame -playdemo -statcopy \n\
++-comdev -dup -maxdemo -port -timedemo \n\
++ -extratic -net -record -timer \n\
++-deathmatch -fast -noblit -regdev -turbo \n\
++
++");
++ exit(0);
++ }
++
+ nomonsters = M_CheckParm ("-nomonsters");
+ respawnparm = M_CheckParm ("-respawn");
+ fastparm = M_CheckParm ("-fast");
+@@ -1013,6 +1042,15 @@
+
+ printf ("M_LoadDefaults: Load system defaults.\n");
+ M_LoadDefaults (); // load before initing other systems
++
++ /* Must be after M_LoadDefaults */
++ p = M_CheckParm ("-volume");
++ if (p && p < myargc-1)
++ {
++ int vol = atoi(myargv[p+1]);
++ S_SetSfxVolume(vol);
++ S_SetMusicVolume(vol);
++ }
+
+ printf ("Z_Init: Init zone memory allocation daemon. \n");
+ Z_Init ();
diff --git a/games/xdoom/patches/patch-ad b/games/xdoom/patches/patch-ad
new file mode 100644
index 00000000000..40778132d9a
--- /dev/null
+++ b/games/xdoom/patches/patch-ad
@@ -0,0 +1,13 @@
+$NetBSD: patch-ad,v 1.5 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/d_net.h.orig Sun Dec 14 11:53:05 1997
++++ linuxdoom-1.10/d_net.h Thu Feb 3 01:33:46 2000
+@@ -79,7 +79,7 @@
+ typedef struct
+ {
+ // Supposed to be DOOMCOM_ID?
+- long id;
++ int id;
+
+ // DOOM executes an int to execute commands.
+ short intnum;
diff --git a/games/xdoom/patches/patch-ae b/games/xdoom/patches/patch-ae
new file mode 100644
index 00000000000..389f177271f
--- /dev/null
+++ b/games/xdoom/patches/patch-ae
@@ -0,0 +1,18 @@
+$NetBSD: patch-ae,v 1.5 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/doomtype.h.orig Mon Dec 22 20:05:27 1997
++++ linuxdoom-1.10/doomtype.h Thu Feb 3 01:33:46 2000
+@@ -46,13 +46,11 @@
+
+ // Max pos 32-bit int.
+ #define MAXINT ((int)0x7fffffff)
+-#define MAXLONG ((long)0x7fffffff)
+ #define MINCHAR ((char)0x80)
+ #define MINSHORT ((short)0x8000)
+
+ // Max negative 32-bit integer.
+ #define MININT ((int)0x80000000)
+-#define MINLONG ((long)0x80000000)
+ #endif
+
+
diff --git a/games/xdoom/patches/patch-af b/games/xdoom/patches/patch-af
new file mode 100644
index 00000000000..9ac5948fdd6
--- /dev/null
+++ b/games/xdoom/patches/patch-af
@@ -0,0 +1,21 @@
+$NetBSD: patch-af,v 1.7 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/g_game.c.orig Mon Dec 22 20:35:29 1997
++++ linuxdoom-1.10/g_game.c Thu Feb 3 01:33:47 2000
+@@ -1586,12 +1586,14 @@
+
+ gameaction = ga_nothing;
+ demobuffer = demo_p = W_CacheLumpName (defdemoname, PU_STATIC);
+- if ( *demo_p++ != VERSION)
++ if ( *demo_p/100 != VERSION/100 || *demo_p%100 > VERSION%100 )
+ {
+- fprintf( stderr, "Demo is from a different game version!\n");
++ fprintf( stderr, "Demo is from a different game version (%.2f / %.2f)!\n",
++ *demo_p/100.0, VERSION/100.0);
+ gameaction = ga_nothing;
+ return;
+ }
++ ++demo_p;
+
+ skill = *demo_p++;
+ episode = *demo_p++;
diff --git a/games/xdoom/patches/patch-ag b/games/xdoom/patches/patch-ag
new file mode 100644
index 00000000000..6f5332aca92
--- /dev/null
+++ b/games/xdoom/patches/patch-ag
@@ -0,0 +1,35 @@
+$NetBSD: patch-ag,v 1.4 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/i_net.c.orig Mon Dec 22 20:37:46 1997
++++ linuxdoom-1.10/i_net.c Thu Feb 3 01:33:48 2000
+@@ -50,21 +50,6 @@
+
+
+
+-
+-// For some odd reason...
+-#define ntohl(x) \
+- ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
+- (((unsigned long int)(x) & 0x0000ff00U) << 8) | \
+- (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
+- (((unsigned long int)(x) & 0xff000000U) >> 24)))
+-
+-#define ntohs(x) \
+- ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
+- (((unsigned short int)(x) & 0xff00) >> 8))) \
+-
+-#define htonl(x) ntohl(x)
+-#define htons(x) ntohs(x)
+-
+ void NetSend (void);
+ boolean NetListen (void);
+
+@@ -73,7 +58,7 @@
+ // NETWORKING
+ //
+
+-int DOOMPORT = (IPPORT_USERRESERVED +0x1d );
++int DOOMPORT = (IPPORT_RESERVED +0x1d );
+
+ int sendsocket;
+ int insocket;
diff --git a/games/xdoom/patches/patch-ah b/games/xdoom/patches/patch-ah
new file mode 100644
index 00000000000..374a313023d
--- /dev/null
+++ b/games/xdoom/patches/patch-ah
@@ -0,0 +1,55 @@
+$NetBSD: patch-ah,v 1.5 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/i_sound.c.orig Mon Dec 22 19:57:15 1997
++++ linuxdoom-1.10/i_sound.c Thu Feb 3 02:56:08 2000
+@@ -26,2 +26,3 @@ rcsid[] = "$Id: i_unix.c,v 1.5 1997/02/0
+
++#include <errno.h>
+ #include <stdio.h>
+@@ -43,4 +44,7 @@ rcsid[] = "$Id: i_unix.c,v 1.5 1997/02/0
+
++#ifdef LINUX
+ // Linux voxware output.
+ #include <linux/soundcard.h>
++#endif
++
+
+@@ -165,3 +169,2 @@ myioctl
+ int rc;
+- extern int errno;
+
+@@ -484,4 +487,8 @@ I_StartSound
+ {
+- fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol, sep);
+- fflush(sndserver);
++ if (fprintf(sndserver, "p%2.2x%2.2x%2.2x%2.2x\n", id, pitch, vol, sep)
++ <= 0 || fflush(sndserver) )
++ {
++ fprintf(stderr, "Unable to write to sndserver - closing\n");
++ sndserver = 0;
++ }
+ }
+@@ -747,6 +754,16 @@ I_InitSound()
+ else
+- sprintf(buffer, "%s", sndserver_filename);
++#ifdef INSTALL_PREFIX
++ {
++ sprintf(buffer, INSTALL_PREFIX"/bin/%s", sndserver_filename);
++ /* sndserver won't find its wadfile if DOMMWADDIR isn't set - HF */
++ if(!getenv("DOOMWADDIR"))
++ setenv("DOOMWADDIR", INSTALL_PREFIX"/share/doom", 1);
++ }
++#else
++ strcpy(buffer, sndserver_filename);
++#endif
++
+
+ // start sound process
+- if ( !access(buffer, X_OK) )
++ if (!access(buffer, X_OK) )
+ {
+@@ -754,2 +771,4 @@ I_InitSound()
+ sndserver = popen(buffer, "w");
++ /* Don't die with SIGPIPE if the sndserver has problems */
++ signal(SIGPIPE, (void (*)(int)) SIG_IGN);
+ }
diff --git a/games/xdoom/patches/patch-ai b/games/xdoom/patches/patch-ai
new file mode 100644
index 00000000000..aa20d6babbc
--- /dev/null
+++ b/games/xdoom/patches/patch-ai
@@ -0,0 +1,137 @@
+$NetBSD: patch-ai,v 1.6 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/i_video.c.orig Mon Dec 22 20:39:01 1997
++++ linuxdoom-1.10/i_video.c Thu Aug 22 04:42:18 2002
+@@ -36,7 +36,7 @@ rcsid[] = "$Id: i_x.c,v 1.6 1997/02/03 2
+ #include <X11/extensions/XShm.h>
+ // Had to dig up XShm.c for this one.
+ // It is in the libXext, but not in the XFree86 headers.
+-#ifdef LINUX
++#if defined(LINUX) || defined (__NetBSD__)
+ int XShmGetEventBase( Display* dpy ); // problems with g++?
+ #endif
+
+@@ -46,13 +46,14 @@ int XShmGetEventBase( Display* dpy ); //
+ #include <sys/socket.h>
+
+ #include <netinet/in.h>
+-#include <errnos.h>
++#include <errno.h>
+ #include <signal.h>
+
+ #include "doomstat.h"
+ #include "i_system.h"
+ #include "v_video.h"
+ #include "m_argv.h"
++#include "m_swap.h" /* For BYTE_ORDER == BIG_ENDIAN */
+ #include "d_main.h"
+
+ #include "doomdef.h"
+@@ -164,15 +165,20 @@ int xlatekey(void)
+ void I_ShutdownGraphics(void)
+ {
+ // Detach from X server
+- if (!XShmDetach(X_display, &X_shminfo))
++ if (X_shminfo.shmid)
++ {
++ if (!XShmDetach(X_display, &X_shminfo))
+ I_Error("XShmDetach() failed in I_ShutdownGraphics()");
+
+- // Release shared memory.
+- shmdt(X_shminfo.shmaddr);
+- shmctl(X_shminfo.shmid, IPC_RMID, 0);
++ // Release shared memory.
++ shmdt(X_shminfo.shmaddr);
++ shmctl(X_shminfo.shmid, IPC_RMID, 0);
++ X_shminfo.shmid = 0;
++ }
+
+ // Paranoia.
+- image->data = NULL;
++ if (image)
++ image->data = NULL;
+ }
+
+
+@@ -666,7 +672,6 @@ void grabsharedmemory(int size)
+ id = shmget((key_t)key, size, IPC_CREAT|0777);
+ if (id==-1)
+ {
+- extern int errno;
+ fprintf(stderr, "errno=%d\n", errno);
+ I_Error("Could not get any shared memory");
+ }
+@@ -685,8 +690,7 @@ void grabsharedmemory(int size)
+ // attach to the shared memory segment
+ image->data = X_shminfo.shmaddr = shmat(id, 0, 0);
+
+- fprintf(stderr, "shared memory id=%d, addr=0x%x\n", id,
+- (int) (image->data));
++ fprintf(stderr, "shared memory id=%d, addr=%p\n", id, image->data);
+ }
+
+ void I_InitGraphics(void)
+@@ -986,13 +990,13 @@ Expand4
+ {
+ fourpixels = lineptr[0];
+
+- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
++ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff0000)>>13) );
+ xline[0] = dpixel;
+ xline[160] = dpixel;
+ xline[320] = dpixel;
+ xline[480] = dpixel;
+
+- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
++ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff)<<3 ) );
+ xline[1] = dpixel;
+ xline[161] = dpixel;
+ xline[321] = dpixel;
+@@ -1000,13 +1004,13 @@ Expand4
+
+ fourpixels = lineptr[1];
+
+- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
++ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff0000)>>13) );
+ xline[2] = dpixel;
+ xline[162] = dpixel;
+ xline[322] = dpixel;
+ xline[482] = dpixel;
+
+- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
++ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff)<<3 ) );
+ xline[3] = dpixel;
+ xline[163] = dpixel;
+ xline[323] = dpixel;
+@@ -1014,13 +1018,13 @@ Expand4
+
+ fourpixels = lineptr[2];
+
+- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
++ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff0000)>>13) );
+ xline[4] = dpixel;
+ xline[164] = dpixel;
+ xline[324] = dpixel;
+ xline[484] = dpixel;
+
+- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
++ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff)<<3 ) );
+ xline[5] = dpixel;
+ xline[165] = dpixel;
+ xline[325] = dpixel;
+@@ -1028,13 +1032,13 @@ Expand4
+
+ fourpixels = lineptr[3];
+
+- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff0000)>>13) );
++ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff0000)>>13) );
+ xline[6] = dpixel;
+ xline[166] = dpixel;
+ xline[326] = dpixel;
+ xline[486] = dpixel;
+
+- dpixel = *(double *)( (int)exp + ( (fourpixels&0xffff)<<3 ) );
++ dpixel = *(double *)( (long)exp + ( (fourpixels&0xffff)<<3 ) );
+ xline[7] = dpixel;
+ xline[167] = dpixel;
+ xline[327] = dpixel;
diff --git a/games/xdoom/patches/patch-aj b/games/xdoom/patches/patch-aj
new file mode 100644
index 00000000000..7e125a455d8
--- /dev/null
+++ b/games/xdoom/patches/patch-aj
@@ -0,0 +1,22 @@
+$NetBSD: patch-aj,v 1.3 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/info.c.orig Mon Dec 22 20:39:32 1997
++++ linuxdoom-1.10/info.c Thu Feb 3 01:33:51 2000
+@@ -37,7 +37,7 @@
+
+ #include "p_mobj.h"
+
+-char *sprnames[NUMSPRITES] = {
++char *sprnames[NUMSPRITES+1] = {
+ "TROO","SHTG","PUNG","PISG","PISF","SHTF","SHT2","CHGG","CHGF","MISG",
+ "MISF","SAWG","PLSG","PLSF","BFGG","BFGF","BLUD","PUFF","BAL1","BAL2",
+ "PLSS","PLSE","MISL","BFS1","BFE1","BFE2","TFOG","IFOG","PLAY","POSS",
+@@ -51,7 +51,7 @@
+ "POL3","POL1","POL6","GOR2","GOR3","GOR4","GOR5","SMIT","COL1","COL2",
+ "COL3","COL4","CAND","CBRA","COL6","TRE1","TRE2","ELEC","CEYE","FSKU",
+ "COL5","TBLU","TGRN","TRED","SMBT","SMGT","SMRT","HDB1","HDB2","HDB3",
+- "HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2"
++ "HDB4","HDB5","HDB6","POB1","POB2","BRS1","TLMP","TLP2", 0
+ };
+
+
diff --git a/games/xdoom/patches/patch-ak b/games/xdoom/patches/patch-ak
new file mode 100644
index 00000000000..0e278c04615
--- /dev/null
+++ b/games/xdoom/patches/patch-ak
@@ -0,0 +1,14 @@
+$NetBSD: patch-ak,v 1.3 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/info.h.orig Mon Dec 22 20:11:18 1997
++++ linuxdoom-1.10/info.h Thu Feb 3 01:33:51 2000
+@@ -1156,7 +1156,8 @@
+ } state_t;
+
+ extern state_t states[NUMSTATES];
+-extern char *sprnames[NUMSPRITES];
++/* R_InitSpriteDefs insists on a NULL terminated list, add one for NULL. (jfw) */
++extern char *sprnames[NUMSPRITES+1];
+
+
+
diff --git a/games/xdoom/patches/patch-al b/games/xdoom/patches/patch-al
new file mode 100644
index 00000000000..7d4316b66a4
--- /dev/null
+++ b/games/xdoom/patches/patch-al
@@ -0,0 +1,13 @@
+$NetBSD: patch-al,v 1.3 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/m_bbox.h.orig Mon Dec 22 20:12:16 1997
++++ linuxdoom-1.10/m_bbox.h Thu Feb 3 01:33:52 2000
+@@ -23,7 +23,7 @@
+ #ifndef __M_BBOX__
+ #define __M_BBOX__
+
+-#include <values.h>
++#include "doomtype.h"
+
+ #include "m_fixed.h"
+
diff --git a/games/xdoom/patches/patch-am b/games/xdoom/patches/patch-am
new file mode 100644
index 00000000000..6a654d90118
--- /dev/null
+++ b/games/xdoom/patches/patch-am
@@ -0,0 +1,13 @@
+$NetBSD: patch-am,v 1.3 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/m_menu.c.orig Mon Dec 22 20:42:21 1997
++++ linuxdoom-1.10/m_menu.c Thu Feb 3 01:33:53 2000
+@@ -529,7 +529,7 @@
+ LoadMenu[i].status = 0;
+ continue;
+ }
+- count = read (handle, &savegamestrings[i], SAVESTRINGSIZE);
++ count = read (handle, savegamestrings[i], SAVESTRINGSIZE);
+ close (handle);
+ LoadMenu[i].status = 1;
+ }
diff --git a/games/xdoom/patches/patch-an b/games/xdoom/patches/patch-an
new file mode 100644
index 00000000000..3a0e091810c
--- /dev/null
+++ b/games/xdoom/patches/patch-an
@@ -0,0 +1,51 @@
+$NetBSD: patch-an,v 1.3 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/m_misc.c.orig Mon Dec 22 20:43:11 1997
++++ linuxdoom-1.10/m_misc.c Thu Feb 3 01:33:54 2000
+@@ -226,7 +226,7 @@
+ {
+ char* name;
+ int* location;
+- int defaultvalue;
++ long defaultvalue;
+ int scantranslate; // PC scan code hack
+ int untranslated; // lousy hack
+ } default_t;
+@@ -254,8 +254,8 @@
+
+ // UNIX hack, to be removed.
+ #ifdef SNDSERV
+- {"sndserver", (int *) &sndserver_filename, (int) "sndserver"},
+- {"mb_used", &mb_used, 2},
++ {"sndserver", (int *) &sndserver_filename, (long) "sndserver"},
++ {"mb_used", &mb_used, 12},
+ #endif
+
+ #endif
+@@ -285,16 +285,16 @@
+
+ {"usegamma",&usegamma, 0},
+
+- {"chatmacro0", (int *) &chat_macros[0], (int) HUSTR_CHATMACRO0 },
+- {"chatmacro1", (int *) &chat_macros[1], (int) HUSTR_CHATMACRO1 },
+- {"chatmacro2", (int *) &chat_macros[2], (int) HUSTR_CHATMACRO2 },
+- {"chatmacro3", (int *) &chat_macros[3], (int) HUSTR_CHATMACRO3 },
+- {"chatmacro4", (int *) &chat_macros[4], (int) HUSTR_CHATMACRO4 },
+- {"chatmacro5", (int *) &chat_macros[5], (int) HUSTR_CHATMACRO5 },
+- {"chatmacro6", (int *) &chat_macros[6], (int) HUSTR_CHATMACRO6 },
+- {"chatmacro7", (int *) &chat_macros[7], (int) HUSTR_CHATMACRO7 },
+- {"chatmacro8", (int *) &chat_macros[8], (int) HUSTR_CHATMACRO8 },
+- {"chatmacro9", (int *) &chat_macros[9], (int) HUSTR_CHATMACRO9 }
++ {"chatmacro0", (int *) &chat_macros[0], (long) HUSTR_CHATMACRO0 },
++ {"chatmacro1", (int *) &chat_macros[1], (long) HUSTR_CHATMACRO1 },
++ {"chatmacro2", (int *) &chat_macros[2], (long) HUSTR_CHATMACRO2 },
++ {"chatmacro3", (int *) &chat_macros[3], (long) HUSTR_CHATMACRO3 },
++ {"chatmacro4", (int *) &chat_macros[4], (long) HUSTR_CHATMACRO4 },
++ {"chatmacro5", (int *) &chat_macros[5], (long) HUSTR_CHATMACRO5 },
++ {"chatmacro6", (int *) &chat_macros[6], (long) HUSTR_CHATMACRO6 },
++ {"chatmacro7", (int *) &chat_macros[7], (long) HUSTR_CHATMACRO7 },
++ {"chatmacro8", (int *) &chat_macros[8], (long) HUSTR_CHATMACRO8 },
++ {"chatmacro9", (int *) &chat_macros[9], (long) HUSTR_CHATMACRO9 }
+
+ };
+
diff --git a/games/xdoom/patches/patch-ao b/games/xdoom/patches/patch-ao
new file mode 100644
index 00000000000..611c6f99164
--- /dev/null
+++ b/games/xdoom/patches/patch-ao
@@ -0,0 +1,24 @@
+$NetBSD: patch-ao,v 1.3 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/m_swap.c.orig Mon Dec 22 20:43:51 1997
++++ linuxdoom-1.10/m_swap.c Thu Feb 3 01:33:55 2000
+@@ -31,8 +31,8 @@
+ #include "m_swap.h"
+
+
+-// Not needed with big endian.
+-#ifndef __BIG_ENDIAN__
++// Only needed with big endian.
++#ifdef __BIG_ENDIAN__
+
+ // Swap 16bit, that is, MSB and LSB byte.
+ unsigned short SwapSHORT(unsigned short x)
+@@ -42,7 +42,7 @@
+ }
+
+ // Swapping 32bit.
+-unsigned long SwapLONG( unsigned long x)
++unsigned int SwapLONG( unsigned int x)
+ {
+ return
+ (x>>24)
diff --git a/games/xdoom/patches/patch-ap b/games/xdoom/patches/patch-ap
new file mode 100644
index 00000000000..a0da9b13bbc
--- /dev/null
+++ b/games/xdoom/patches/patch-ap
@@ -0,0 +1,18 @@
+$NetBSD: patch-ap,v 1.5 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/m_swap.h.orig 1997-12-22 14:14:41.000000000 -0600
++++ linuxdoom-1.10/m_swap.h
+@@ -32,10 +32,10 @@
+ // Endianess handling.
+ // WAD files are stored little endian.
+ #ifdef __BIG_ENDIAN__
+-short SwapSHORT(short);
+-long SwapLONG(long);
++unsigned short SwapSHORT(unsigned short);
++unsigned int SwapLONG(unsigned int);
+ #define SHORT(x) ((short)SwapSHORT((unsigned short) (x)))
+-#define LONG(x) ((long)SwapLONG((unsigned long) (x)))
++#define LONG(x) ((int)SwapLONG((unsigned int) (x)))
+ #else
+ #define SHORT(x) (x)
+ #define LONG(x) (x)
diff --git a/games/xdoom/patches/patch-aq b/games/xdoom/patches/patch-aq
new file mode 100644
index 00000000000..1925d5a2170
--- /dev/null
+++ b/games/xdoom/patches/patch-aq
@@ -0,0 +1,13 @@
+$NetBSD: patch-aq,v 1.3 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/p_setup.c.orig Mon Dec 22 20:52:39 1997
++++ linuxdoom-1.10/p_setup.c Thu Feb 3 01:33:56 2000
+@@ -533,7 +533,7 @@
+ }
+
+ // build line tables for each sector
+- linebuffer = Z_Malloc (total*4, PU_LEVEL, 0);
++ linebuffer = Z_Malloc (total*sizeof(line_t*), PU_LEVEL, 0);
+ sector = sectors;
+ for (i=0 ; i<numsectors ; i++, sector++)
+ {
diff --git a/games/xdoom/patches/patch-ar b/games/xdoom/patches/patch-ar
new file mode 100644
index 00000000000..6b44c9bb6a0
--- /dev/null
+++ b/games/xdoom/patches/patch-ar
@@ -0,0 +1,78 @@
+$NetBSD: patch-ar,v 1.4 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/r_data.c.orig Mon Dec 22 20:57:47 1997
++++ linuxdoom-1.10/r_data.c Mon Aug 22 04:13:08 2022
+@@ -84,10 +84,10 @@
+ typedef struct
+ {
+ char name[8];
+- boolean masked;
++ short masked[2]; // OBSOLETE
+ short width;
+ short height;
+- void **columndirectory; // OBSOLETE
++ short columndirectory[2]; // OBSOLETE
+ short patchcount;
+ mappatch_t patches[1];
+ } maptexture_t;
+@@ -479,13 +479,13 @@
+ }
+ numtextures = numtextures1 + numtextures2;
+
+- textures = Z_Malloc (numtextures*4, PU_STATIC, 0);
+- texturecolumnlump = Z_Malloc (numtextures*4, PU_STATIC, 0);
+- texturecolumnofs = Z_Malloc (numtextures*4, PU_STATIC, 0);
+- texturecomposite = Z_Malloc (numtextures*4, PU_STATIC, 0);
+- texturecompositesize = Z_Malloc (numtextures*4, PU_STATIC, 0);
+- texturewidthmask = Z_Malloc (numtextures*4, PU_STATIC, 0);
+- textureheight = Z_Malloc (numtextures*4, PU_STATIC, 0);
++ textures = Z_Malloc (numtextures*sizeof(*textures), PU_STATIC, 0);
++ texturecolumnlump = Z_Malloc (numtextures*sizeof(*texturecolumnlump), PU_STATIC, 0);
++ texturecolumnofs = Z_Malloc (numtextures*sizeof(*texturecolumnofs), PU_STATIC, 0);
++ texturecomposite = Z_Malloc (numtextures*sizeof(*texturecomposite), PU_STATIC, 0);
++ texturecompositesize = Z_Malloc (numtextures*sizeof(*texturecompositesize), PU_STATIC, 0);
++ texturewidthmask = Z_Malloc (numtextures*sizeof(*texturewidthmask), PU_STATIC, 0);
++ textureheight = Z_Malloc (numtextures*sizeof(*textureheight), PU_STATIC, 0);
+
+ totalwidth = 0;
+
+@@ -567,7 +567,7 @@
+ R_GenerateLookup (i);
+
+ // Create translation table for global animation.
+- texturetranslation = Z_Malloc ((numtextures+1)*4, PU_STATIC, 0);
++ texturetranslation = Z_Malloc ((numtextures+1)*sizeof(*texturetranslation), PU_STATIC, 0);
+
+ for (i=0 ; i<numtextures ; i++)
+ texturetranslation[i] = i;
+@@ -587,7 +587,7 @@
+ numflats = lastflat - firstflat + 1;
+
+ // Create translation table for global animation.
+- flattranslation = Z_Malloc ((numflats+1)*4, PU_STATIC, 0);
++ flattranslation = Z_Malloc ((numflats+1)*sizeof(*flattranslation), PU_STATIC, 0);
+
+ for (i=0 ; i<numflats ; i++)
+ flattranslation[i] = i;
+@@ -609,9 +609,9 @@
+ lastspritelump = W_GetNumForName ("S_END") - 1;
+
+ numspritelumps = lastspritelump - firstspritelump + 1;
+- spritewidth = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
+- spriteoffset = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
+- spritetopoffset = Z_Malloc (numspritelumps*4, PU_STATIC, 0);
++ spritewidth = Z_Malloc (numspritelumps*sizeof(*spritewidth), PU_STATIC, 0);
++ spriteoffset = Z_Malloc (numspritelumps*sizeof(*spriteoffset), PU_STATIC, 0);
++ spritetopoffset = Z_Malloc (numspritelumps*sizeof(*spritetopoffset), PU_STATIC, 0);
+
+ for (i=0 ; i< numspritelumps ; i++)
+ {
+@@ -639,7 +639,7 @@
+ lump = W_GetNumForName("COLORMAP");
+ length = W_LumpLength (lump) + 255;
+ colormaps = Z_Malloc (length, PU_STATIC, 0);
+- colormaps = (byte *)( ((int)colormaps + 255)&~0xff);
++ colormaps = (byte *)( ((long)colormaps + 255)&~0xff);
+ W_ReadLump (lump,colormaps);
+ }
+
diff --git a/games/xdoom/patches/patch-as b/games/xdoom/patches/patch-as
new file mode 100644
index 00000000000..1b29b69c542
--- /dev/null
+++ b/games/xdoom/patches/patch-as
@@ -0,0 +1,13 @@
+$NetBSD: patch-as,v 1.3 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/r_draw.c.orig Mon Dec 22 20:58:20 1997
++++ linuxdoom-1.10/r_draw.c Thu Feb 3 01:34:01 2000
+@@ -461,7 +461,7 @@
+ int i;
+
+ translationtables = Z_Malloc (256*3+255, PU_STATIC, 0);
+- translationtables = (byte *)(( (int)translationtables + 255 )& ~255);
++ translationtables = (byte *)(( (long)translationtables + 255 )& ~255L);
+
+ // translate just the 16 green colors
+ for (i=0 ; i<256 ; i++)
diff --git a/games/xdoom/patches/patch-at b/games/xdoom/patches/patch-at
new file mode 100644
index 00000000000..88e9321c173
--- /dev/null
+++ b/games/xdoom/patches/patch-at
@@ -0,0 +1,123 @@
+$NetBSD: patch-at,v 1.3 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/s_sound.c.orig Thu Feb 3 13:28:09 2000
++++ linuxdoom-1.10/s_sound.c Thu Feb 3 13:37:06 2000
+@@ -115,6 +115,7 @@
+ // Maximum volume of music. Useless so far.
+ int snd_MusicVolume = 15;
+
++static int no_sound = 0;
+
+
+ // whether songs are mus_paused
+@@ -164,6 +165,8 @@
+ {
+ int i;
+
++ if (no_sound)
++ return;
+ fprintf( stderr, "S_Init: default sfx volume %d\n", sfxVolume);
+
+ // Whatever these did with DMX, these are rather dummies now.
+@@ -204,6 +207,8 @@
+ int cnum;
+ int mnum;
+
++ if (no_sound)
++ return;
+ // kill all playing sounds at start of level
+ // (trust me - a good idea)
+ for (cnum=0 ; cnum<numChannels ; cnum++)
+@@ -268,6 +273,8 @@
+ mobj_t* origin = (mobj_t *) origin_p;
+
+
++ if (no_sound)
++ return;
+ // Debug.
+ /*fprintf( stderr,
+ "S_StartSoundAtVolume: playing sound %d (%s)\n",
+@@ -403,6 +410,9 @@
+ // if (sfx_id == sfx_sawful)
+ // sfx_id = sfx_itemup;
+ #endif
++
++ if (no_sound)
++ return;
+
+ S_StartSoundAtVolume(origin, sfx_id, snd_SfxVolume);
+
+@@ -473,6 +483,9 @@
+
+ int cnum;
+
++ if (no_sound)
++ return;
++
+ for (cnum=0 ; cnum<numChannels ; cnum++)
+ {
+ if (channels[cnum].sfxinfo && channels[cnum].origin == origin)
+@@ -496,6 +509,8 @@
+ //
+ void S_PauseSound(void)
+ {
++ if (no_sound)
++ return;
+ if (mus_playing && !mus_paused)
+ {
+ I_PauseSong(mus_playing->handle);
+@@ -505,6 +520,8 @@
+
+ void S_ResumeSound(void)
+ {
++ if (no_sound)
++ return;
+ if (mus_playing && mus_paused)
+ {
+ I_ResumeSong(mus_playing->handle);
+@@ -529,6 +546,8 @@
+ mobj_t* listener = (mobj_t*)listener_p;
+
+
++ if (no_sound)
++ return;
+
+ // Clean up unused data.
+ // This is currently not done for 16bit (sounds cached static).
+@@ -636,6 +655,8 @@
+
+ snd_SfxVolume = volume;
+
++ if (volume == 0)
++ no_sound = ! volume;
+ }
+
+ //
+@@ -711,6 +732,8 @@
+ int i;
+ channel_t* c = &channels[cnum];
+
++ if (no_sound)
++ return;
+ if (c->sfxinfo)
+ {
+ // stop the sound playing
+@@ -762,6 +785,9 @@
+ fixed_t ady;
+ angle_t angle;
+
++ if (no_sound)
++ return(1);
++
+ // calculate the distance to sound origin
+ // and clip it if necessary
+ adx = abs(listener->x - source->x);
+@@ -834,6 +860,8 @@
+
+ channel_t* c;
+
++ if (no_sound)
++ return(-1);
+ // Find an open channel
+ for (cnum=0 ; cnum<numChannels ; cnum++)
+ {
diff --git a/games/xdoom/patches/patch-au b/games/xdoom/patches/patch-au
new file mode 100644
index 00000000000..33179bc25f5
--- /dev/null
+++ b/games/xdoom/patches/patch-au
@@ -0,0 +1,16 @@
+$NetBSD: patch-au,v 1.4 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/w_wad.c.orig 1997-12-22 21:05:36.000000000 +0000
++++ linuxdoom-1.10/w_wad.c
+@@ -31,10 +31,9 @@ rcsid[] = "$Id: w_wad.c,v 1.5 1997/02/03
+ #include <sys/types.h>
+ #include <string.h>
+ #include <unistd.h>
+-#include <malloc.h>
+ #include <fcntl.h>
+ #include <sys/stat.h>
+-#include <alloca.h>
++#include <stdlib.h>
+ #define O_BINARY 0
+ #endif
+
diff --git a/games/xdoom/patches/patch-av b/games/xdoom/patches/patch-av
new file mode 100644
index 00000000000..eecebd3b4f0
--- /dev/null
+++ b/games/xdoom/patches/patch-av
@@ -0,0 +1,16 @@
+$NetBSD: patch-av,v 1.4 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/w_wad.h.orig Mon Dec 22 20:25:32 1997
++++ linuxdoom-1.10/w_wad.h Thu Feb 3 01:34:03 2000
+@@ -36,9 +36,8 @@
+ {
+ // Should be "IWAD" or "PWAD".
+ char identification[4];
+- int numlumps;
+- int infotableofs;
+-
++ int numlumps __attribute__ ((packed));
++ int infotableofs __attribute__ ((packed));
+ } wadinfo_t;
+
+
diff --git a/games/xdoom/patches/patch-aw b/games/xdoom/patches/patch-aw
new file mode 100644
index 00000000000..a9cf2b32657
--- /dev/null
+++ b/games/xdoom/patches/patch-aw
@@ -0,0 +1,27 @@
+$NetBSD: patch-aw,v 1.4 2010/02/22 21:58:47 wiz Exp $
+
+--- linuxdoom-1.10/z_zone.c.orig Mon Dec 22 21:07:09 1997
++++ linuxdoom-1.10/z_zone.c Thu Aug 22 05:00:10 2002
+@@ -192,8 +192,12 @@
+ memblock_t* newblock;
+ memblock_t* base;
+
++#ifdef __alpha
++ size = (size + 7) & ~7;
++#else
+ size = (size + 3) & ~3;
+-
++#endif
++
+ // scan through the block list,
+ // looking for the first free block
+ // of sufficient size,
+@@ -437,7 +441,7 @@
+ if (block->id != ZONEID)
+ I_Error ("Z_ChangeTag: freed a pointer without ZONEID");
+
+- if (tag >= PU_PURGELEVEL && (unsigned)block->user < 0x100)
++ if (tag >= PU_PURGELEVEL && block->user < (void **)0x100)
+ I_Error ("Z_ChangeTag: an owner is required for purgable blocks");
+
+ block->tag = tag;
diff --git a/games/xdoom/patches/patch-ax b/games/xdoom/patches/patch-ax
new file mode 100644
index 00000000000..779ded1e428
--- /dev/null
+++ b/games/xdoom/patches/patch-ax
@@ -0,0 +1,16 @@
+$NetBSD: patch-ax,v 1.5 2010/02/22 21:58:47 wiz Exp $
+
+--- sndserv/Makefile.orig Mon Dec 22 21:17:10 1997
++++ sndserv/Makefile Thu Feb 3 01:34:04 2000
+@@ -7,9 +7,9 @@
+ #
+
+ CC=gcc
+-CFLAGS=-O -DNORMALUNIX -DLINUX
++CFLAGS+= -DNORMALUNIX
+ LDFLAGS=
+-LIBS=-lm
++LIBS=-lm ${LIBOSSAUDIO}
+
+ O=linux
+
diff --git a/games/xdoom/patches/patch-ay b/games/xdoom/patches/patch-ay
new file mode 100644
index 00000000000..09fcd916363
--- /dev/null
+++ b/games/xdoom/patches/patch-ay
@@ -0,0 +1,42 @@
+$NetBSD: patch-ay,v 1.5 2010/02/22 21:58:48 wiz Exp $
+
+--- sndserv/linux.c.orig Sun Jan 26 07:45:01 1997
++++ sndserv/linux.c Thu Feb 3 01:34:05 2000
+@@ -36,13 +36,17 @@ static const char rcsid[] = "$Id: linux.
+
+
++#include <errno.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include <sys/ioctl.h>
+
+-#include <linux/soundcard.h>
++#include <sys/soundcard.h>
+
+ #include "soundsrv.h"
+
++#define SOUND_DEV "/dev/sound"
++
+ int audio_fd;
+
+@@ -54,5 +58,4 @@ myioctl
+ {
+ int rc;
+- extern int errno;
+
+ rc = ioctl(fd, command, arg);
+@@ -77,7 +80,10 @@ I_InitSound
+ int i;
+
+- audio_fd = open("/dev/dsp", O_WRONLY);
++ audio_fd = open(SOUND_DEV, O_WRONLY);
+ if (audio_fd<0)
+- fprintf(stderr, "Could not open /dev/dsp\n");
++ {
++ perror("sndserv: Could not open "SOUND_DEV);
++ exit(-1);
++ }
+
+
diff --git a/games/xdoom/patches/patch-az b/games/xdoom/patches/patch-az
new file mode 100644
index 00000000000..943bbd0c0f3
--- /dev/null
+++ b/games/xdoom/patches/patch-az
@@ -0,0 +1,38 @@
+$NetBSD: patch-az,v 1.4 2010/02/22 21:58:48 wiz Exp $
+
+--- sndserv/wadread.c.orig 1997-01-30 19:54:23.000000000 +0000
++++ sndserv/wadread.c
+@@ -39,7 +39,6 @@ static const char rcsid[] = "$Id: wadrea
+
+
+
+-#include <malloc.h>
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <stdio.h>
+@@ -94,12 +93,7 @@ void** lumpcache;
+ // Something new.
+ // This version of w_wad.c does handle endianess.
+ //
+-#ifndef __BIG_ENDIAN__
+-
+-#define LONG(x) (x)
+-#define SHORT(x) (x)
+-
+-#else
++#if defined(__BIG_ENDIAN__) || (BYTE_ORDER == BIG_ENDIAN)
+
+ #define LONG(x) ((long)SwapLONG((unsigned long) (x)))
+ #define SHORT(x) ((short)SwapSHORT((unsigned short) (x)))
+@@ -119,6 +113,11 @@ unsigned short SwapSHORT(unsigned short
+ (x>>8) | (x<<8);
+ }
+
++#else
++
++#define LONG(x) (x)
++#define SHORT(x) (x)
++
+ #endif
+
+
diff --git a/games/xdoom/patches/patch-ba b/games/xdoom/patches/patch-ba
new file mode 100644
index 00000000000..f41dd859da5
--- /dev/null
+++ b/games/xdoom/patches/patch-ba
@@ -0,0 +1,13 @@
+$NetBSD: patch-ba,v 1.3 2010/02/22 21:58:48 wiz Exp $
+
+--- linuxdoom-1.10/p_saveg.c.orig Sun Dec 21 16:03:15 1997
++++ linuxdoom-1.10/p_saveg.c Thu Aug 22 04:47:28 2002
+@@ -37,7 +37,7 @@
+
+ // Pads save_p to a 4-byte boundary
+ // so that the load/save works on SGI&Gecko.
+-#define PADSAVEP() save_p += (4 - ((int) save_p & 3)) & 3
++#define PADSAVEP() save_p += (4 - ((long) save_p & 3)) & 3
+
+
+
diff --git a/games/xdoom/patches/patch-bb b/games/xdoom/patches/patch-bb
new file mode 100644
index 00000000000..a835b861431
--- /dev/null
+++ b/games/xdoom/patches/patch-bb
@@ -0,0 +1,27 @@
+$NetBSD: patch-bb,v 1.3 2010/02/22 21:58:48 wiz Exp $
+
+--- linuxdoom-1.10/r_things.c.orig Mon Dec 22 21:00:50 1997
++++ linuxdoom-1.10/r_things.c Mon Aug 22 05:26:23 2022
+@@ -179,7 +179,6 @@
+ char** check;
+ int i;
+ int l;
+- int intname;
+ int frame;
+ int rotation;
+ int start;
+@@ -210,13 +209,12 @@
+ memset (sprtemp,-1, sizeof(sprtemp));
+
+ maxframe = -1;
+- intname = *(int *)namelist[i];
+
+ // scan the lumps,
+ // filling in the frames for whatever is found
+ for (l=start+1 ; l<end ; l++)
+ {
+- if (*(int *)lumpinfo[l].name == intname)
++ if (memcmp(lumpinfo[l].name, namelist[i], 4) == 0)
+ {
+ frame = lumpinfo[l].name[4] - 'A';
+ rotation = lumpinfo[l].name[5] - '0';
diff --git a/games/xdoom/patches/patch-bc b/games/xdoom/patches/patch-bc
new file mode 100644
index 00000000000..c00a92fa0c6
--- /dev/null
+++ b/games/xdoom/patches/patch-bc
@@ -0,0 +1,30 @@
+$NetBSD: patch-bc,v 1.3 2010/02/22 21:58:48 wiz Exp $
+
+--- linuxdoom-1.10/d_main.c.orig 2003-09-29 22:25:20.000000000 +0000
++++ linuxdoom-1.10/d_main.c 2003-09-29 23:43:29.000000000 +0000
+@@ -150,7 +150,7 @@
+ void D_PostEvent (event_t* ev)
+ {
+ events[eventhead] = *ev;
+- eventhead = (++eventhead)&(MAXEVENTS-1);
++ eventhead = (1+eventhead)&(MAXEVENTS-1);
+ }
+
+
+@@ -822,14 +822,14 @@
+ -skill N Set starting skill level to N.\n\
+ \n\
+ Others are:\n\
+-
++\n\
+ -altdeath -debugfile -file -nodraw -respawn -warp \n\
+ -avg -devparm -geom -nomonsters -shdev -wart \n\
+ -cdrom -disp -loadgame -playdemo -statcopy \n\
+ -comdev -dup -maxdemo -port -timedemo \n\
+ -extratic -net -record -timer \n\
+ -deathmatch -fast -noblit -regdev -turbo \n\
+-
++\n\
+ ");
+ exit(0);
+ }
diff --git a/games/xdoom/patches/patch-bd b/games/xdoom/patches/patch-bd
new file mode 100644
index 00000000000..847d80e4d02
--- /dev/null
+++ b/games/xdoom/patches/patch-bd
@@ -0,0 +1,40 @@
+$NetBSD: patch-bd,v 1.3 2010/02/22 21:58:48 wiz Exp $
+
+--- linuxdoom-1.10/wi_stuff.c.orig 2006-09-24 15:46:39.000000000 +0000
++++ linuxdoom-1.10/wi_stuff.c
+@@ -373,7 +373,7 @@ static patch_t* items;
+ static patch_t* frags;
+
+ // Time sucks.
+-static patch_t* time;
++static patch_t* my_time;
+ static patch_t* par;
+ static patch_t* sucks;
+
+@@ -1456,7 +1456,7 @@ void WI_drawStats(void)
+ V_DrawPatch(SP_STATSX, SP_STATSY+2*lh, FB, sp_secret);
+ WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0]);
+
+- V_DrawPatch(SP_TIMEX, SP_TIMEY, FB, time);
++ V_DrawPatch(SP_TIMEX, SP_TIMEY, FB, my_time);
+ WI_drawTime(SCREENWIDTH/2 - SP_TIMEX, SP_TIMEY, cnt_time);
+
+ if (wbs->epsd < 3)
+@@ -1669,7 +1669,7 @@ void WI_loadData(void)
+ colon = W_CacheLumpName("WICOLON", PU_STATIC);
+
+ // "time"
+- time = W_CacheLumpName("WITIME", PU_STATIC);
++ my_time = W_CacheLumpName("WITIME", PU_STATIC);
+
+ // "sucks"
+ sucks = W_CacheLumpName("WISUCKS", PU_STATIC);
+@@ -1752,7 +1752,7 @@ void WI_unloadData(void)
+ Z_ChangeTag(sp_secret, PU_CACHE);
+ Z_ChangeTag(items, PU_CACHE);
+ Z_ChangeTag(frags, PU_CACHE);
+- Z_ChangeTag(time, PU_CACHE);
++ Z_ChangeTag(my_time, PU_CACHE);
+ Z_ChangeTag(sucks, PU_CACHE);
+ Z_ChangeTag(par, PU_CACHE);
+
diff --git a/games/xdoom/patches/patch-be b/games/xdoom/patches/patch-be
new file mode 100644
index 00000000000..c9b54c5607f
--- /dev/null
+++ b/games/xdoom/patches/patch-be
@@ -0,0 +1,12 @@
+$NetBSD: patch-be,v 1.3 2010/02/22 21:58:48 wiz Exp $
+
+--- sndserv/soundsrv.c.orig 2007-07-31 09:57:06.000000000 +0000
++++ sndserv/soundsrv.c
+@@ -47,7 +47,6 @@ static const char rcsid[] = "$Id: sounds
+ #include <sys/ioctl.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+-#include <malloc.h>
+ #include <sys/stat.h>
+ #include <sys/time.h>
+
diff --git a/licenses/xdoom-license b/licenses/xdoom-license
new file mode 100644
index 00000000000..65f4aa8e340
--- /dev/null
+++ b/licenses/xdoom-license
@@ -0,0 +1,106 @@
+ LIMITED USE SOFTWARE LICENSE AGREEMENT
+
+ This Limited Use Software License Agreement (the "Agreement")
+is a legal agreement between you, the end-user, and Id Software, Inc.
+("ID"). By downloading or purchasing the software material, which
+includes source code (the "Source Code"), artwork data, music and
+software tools (collectively, the "Software"), you are agreeing to
+be bound by the terms of this Agreement. If you do not agree to the
+terms of this Agreement, promptly destroy the Software you may have
+downloaded or copied.
+
+ID SOFTWARE LICENSE
+
+1. Grant of License. ID grants to you the right to use the
+Software. You have no ownership or proprietary rights in or to the
+Software, or the Trademark. For purposes of this section, "use" means
+loading the Software into RAM, as well as installation on a hard disk
+or other storage device. The Software, together with any archive copy
+thereof, shall be destroyed when no longer used in accordance with
+this Agreement, or when the right to use the Software is terminated.
+You agree that the Software will not be shipped, transferred or
+exported into any country in violation of the U.S. Export
+Administration Act (or any other law governing such matters) and that
+you will not utilize, in any other manner, the Software in violation
+of any applicable law.
+
+2. Permitted Uses. For educational purposes only, you, the
+end-user, may use portions of the Source Code, such as particular
+routines, to develop your own software, but may not duplicate the
+Source Code, except as noted in paragraph 4. The limited right
+referenced in the preceding sentence is hereinafter referred to as
+"Educational Use." By so exercising the Educational Use right you
+shall not obtain any ownership, copyright, proprietary or other
+interest in or to the Source Code, or any portion of the Source
+Code. You may dispose of your own software in your sole discretion.
+With the exception of the Educational Use right, you may not
+otherwise use the Software, or an portion of the Software, which
+includes the Source Code, for commercial gain.
+
+3. Prohibited Uses: Under no circumstances shall you, the
+end-user, be permitted, allowed or authorized to commercially exploit
+the Software. Neither you nor anyone at your direction shall do any
+of the following acts with regard to the Software, or any portion
+thereof:
+
+ Rent;
+
+ Sell;
+
+ Lease;
+
+ Offer on a pay-per-play basis;
+
+ Distribute for money or any other consideration; or
+
+ In any other manner and through any medium whatsoever
+commercially exploit or use for any commercial purpose.
+
+Notwithstanding the foregoing prohibitions, you may commercially
+exploit the software you develop by exercising the Educational Use
+right, referenced in paragraph 2. hereinabove.
+
+4. Copyright. The Software and all copyrights related thereto
+(including all characters and other images generated by the Software
+or depicted in the Software) are owned by ID and is protected by
+United States copyright laws and international treaty provisions.
+Id shall retain exclusive ownership and copyright in and to the
+Software and all portions of the Software and you shall have no
+ownership or other proprietary interest in such materials. You must
+treat the Software like any other copyrighted material. You may not
+otherwise reproduce, copy or disclose to others, in whole or in any
+part, the Software. You may not copy the written materials
+accompanying the Software. You agree to use your best efforts to
+see that any user of the Software licensed hereunder complies with
+this Agreement.
+
+5. NO WARRANTIES. ID DISCLAIMS ALL WARRANTIES, BOTH EXPRESS
+IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT
+TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL
+RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO
+JURISDICTION. ID DOES NOT WARRANT THAT THE OPERATION OF THE SOFTWARE
+WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS.
+THE WARRANTY SET FORTH ABOVE IS IN LIEU OF ALL OTHER EXPRESS
+WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES,
+DISTRIBUTORS, AND DEALERS OF ID ARE NOT AUTHORIZED TO MAKE
+MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF
+OF ID.
+
+ Exclusive Remedies. The Software is being offered to you
+free of any charge. You agree that you have no remedy against ID, its
+affiliates, contractors, suppliers, and agents for loss or damage
+caused by any defect or failure in the Software regardless of the form
+of action, whether in contract, tort, includinegligence, strict
+liability or otherwise, with regard to the Software. This Agreement
+shall be construed in accordance with and governed by the laws of the
+State of Texas. Copyright and other proprietary matters will be
+governed by United States laws and international treaties. IN ANY
+CASE, ID SHALL NOT BE LIABLE FOR LOSS OF DATA, LOSS OF PROFITS, LOST
+SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER
+SIMILAR DAMAGES ARISING FROM BREACH OF WARRANTY, BREACH OF CONTRACT,
+NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF ID OR ITS AGENT HAS BEEN
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY
+OTHER PARTY. Some jurisdictions do not allow the exclusion or
+limitation of incidental or consequential damages, so the above
+limitation or exclusion may not apply to you.