pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/games/doomlegacy



Module Name:    pkgsrc
Committed By:   micha
Date:           Tue May 19 11:20:16 UTC 2020

Modified Files:
        pkgsrc/games/doomlegacy: Makefile PLIST distinfo
        pkgsrc/games/doomlegacy/patches: patch-src_Makefile
Added Files:
        pkgsrc/games/doomlegacy/files: INSTALL.pkgsrc doomlegacy.6.in
            doomlegacy.sh p_blockmap.c p_blockmap.h p_extnodes.c p_extnodes.h
        pkgsrc/games/doomlegacy/patches: patch-src_doomdata.h
            patch-src_dstrings.c patch-src_p__local.h patch-src_p__setup.c
            patch-src_r__defs.h
Removed Files:
        pkgsrc/games/doomlegacy: MESSAGE.doomlegacy
        pkgsrc/games/doomlegacy/files: doomlegacy.in1
        pkgsrc/games/doomlegacy/patches: patch-Makefile patch-src_d__main.c
            patch-src_doomtype.h patch-src_i__tcp.c patch-src_sdl_i__system.c

Log Message:
games/doomlegacy: Update to 1.48.4

pkgsrc changes:
- Patches for NetBSD support removed (merged upstream)
- Define "SOLARIS" for SunOS based operating systems
- MESSAGE replaced by file "share/doc/doomlegacy/INSTALL.pkgsrc"
- Man page is now installed in section 6
- Patch to disable launcher replaced by startscript
  (upstream suggested to use an unsupported option for this purpose)
- Patch for extended node support added (Feature request #95)
  Supported formats: DeeP V4, ZDoom uncompressed, ZDoom compressed
  Without this patch the engine may crash with unsupported node formats
- Patch for local blockmap creation added
  Command line option "-blockmap" added for activation (no automatic mode)

The extended node and blockmap patches allow to play modern PWADs like NOVA III
and Lost Civilization.

Upstream changelog since 1.47.2 is very long, refer to this page:
http://doomlegacy.sourceforge.net/docs/whatsnew.html


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 pkgsrc/games/doomlegacy/MESSAGE.doomlegacy
cvs rdiff -u -r1.3 -r1.4 pkgsrc/games/doomlegacy/Makefile
cvs rdiff -u -r1.1 -r1.2 pkgsrc/games/doomlegacy/PLIST \
    pkgsrc/games/doomlegacy/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/games/doomlegacy/files/INSTALL.pkgsrc \
    pkgsrc/games/doomlegacy/files/doomlegacy.6.in \
    pkgsrc/games/doomlegacy/files/doomlegacy.sh \
    pkgsrc/games/doomlegacy/files/p_blockmap.c \
    pkgsrc/games/doomlegacy/files/p_blockmap.h \
    pkgsrc/games/doomlegacy/files/p_extnodes.c \
    pkgsrc/games/doomlegacy/files/p_extnodes.h
cvs rdiff -u -r1.1 -r0 pkgsrc/games/doomlegacy/files/doomlegacy.in1
cvs rdiff -u -r1.1 -r0 pkgsrc/games/doomlegacy/patches/patch-Makefile \
    pkgsrc/games/doomlegacy/patches/patch-src_d__main.c \
    pkgsrc/games/doomlegacy/patches/patch-src_doomtype.h \
    pkgsrc/games/doomlegacy/patches/patch-src_i__tcp.c \
    pkgsrc/games/doomlegacy/patches/patch-src_sdl_i__system.c
cvs rdiff -u -r1.1 -r1.2 pkgsrc/games/doomlegacy/patches/patch-src_Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/games/doomlegacy/patches/patch-src_doomdata.h \
    pkgsrc/games/doomlegacy/patches/patch-src_dstrings.c \
    pkgsrc/games/doomlegacy/patches/patch-src_p__local.h \
    pkgsrc/games/doomlegacy/patches/patch-src_p__setup.c \
    pkgsrc/games/doomlegacy/patches/patch-src_r__defs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/games/doomlegacy/Makefile
diff -u pkgsrc/games/doomlegacy/Makefile:1.3 pkgsrc/games/doomlegacy/Makefile:1.4
--- pkgsrc/games/doomlegacy/Makefile:1.3        Fri Mar 20 11:57:40 2020
+++ pkgsrc/games/doomlegacy/Makefile    Tue May 19 11:20:16 2020
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.3 2020/03/20 11:57:40 nia Exp $
+# $NetBSD: Makefile,v 1.4 2020/05/19 11:20:16 micha Exp $
 
-VERS=                  1.47.2
+VERS=                  1.48.4
 PKGNAME=               doomlegacy-${VERS}
 CATEGORIES=            games
 MASTER_SITES=          ${MASTER_SITE_SOURCEFORGE:=doomlegacy/}
@@ -19,8 +19,8 @@ ONLY_FOR_PLATFORM=    Darwin-*-* DragonFly-
                        NetBSD-*-* OpenBSD-*-* SunOS-*-*
 
 USE_LANGUAGES+=                c99
-
 USE_TOOLS+=            gmake
+# Dependency generation fails with parallel build
 MAKE_JOBS_SAFE=                no
 
 .include "../../mk/bsd.prefs.mk"
@@ -35,21 +35,28 @@ MAKE_FLAGS+=                OS=MAC
 .else
 # Other Unix (should work for GNU/Linux, OpenBSD and SunOS)
 MAKE_FLAGS+=           OS=LINUX
+CFLAGS.SunOS+=         -DSOLARIS
 .endif
-MAKE_FLAGS+=           HAVE_MIXER=1
 
 .if ${MACHINE_ENDIAN} == "big"
 # Some compilers define this themselves (but maybe not all)
 CFLAGS+=               -D__BIG_ENDIAN__
 .endif
 
+# Required by extended node patch for ZDoom compressed node format
+CFLAGS+=               -DHAVE_ZLIB
+LDFLAGS+=              -lz
+
 # DOOMWADDIR is intentionally shared with other Doom packages
 DOOMWADDIR=            share/doom
-INSTALLATION_DIRS=     bin ${PKGMANDIR}/man1 share/doc/doomlegacy ${DOOMWADDIR}
+INSTALLATION_DIRS=     bin ${PKGMANDIR}/man6 share/doc/doomlegacy ${DOOMWADDIR}
 
-MESSAGE_SRC+=          MESSAGE.doomlegacy
-MESSAGE_SUBST+=                PKGNAME=${PKGNAME:C/-.*//}
-MESSAGE_SUBST+=                DOOMWADDIR_CONF="${PREFIX}/${DOOMWADDIR}"
+# Honor environment
+SUBST_CLASSES+=                makeopt
+SUBST_STAGE.makeopt=   do-configure
+SUBST_MESSAGE.makeopt= Preparing make_options file ...
+SUBST_FILES.makeopt=   make_options
+SUBST_SED.makeopt=     -e 's,\#COMP_ENVIRONMENT,COMP_ENVIRONMENT,'
 
 # Configure defaults for LEGACYWADDIR and DOOMWADDIR
 SUBST_CLASSES+=                doomdef
@@ -59,34 +66,54 @@ SUBST_FILES.doomdef=        src/doomdef.h
 SUBST_SED.doomdef=     -e 's,LEGACYWADDIR  "/usr/local/share/games/doomlegacy",LEGACYWADDIR  "${PREFIX}/${DOOMWADDIR}",g'
 SUBST_SED.doomdef+=    -e 's,DEFWADS01  "~/games/doomlegacy/wads",DEFWADS01  "${PREFIX}/${DOOMWADDIR}",'
 
+# Process INSTALL.pkgsrc
+SUBST_CLASSES+=                install
+SUBST_STAGE.install=   do-configure
+SUBST_MESSAGE.install= Preparing INSTALL.pkgsrc file ...
+SUBST_FILES.install=   ${WRKDIR}/INSTALL.pkgsrc
+SUBST_SED.install=     -e 's,DOOMWADDIR,${PREFIX}/${DOOMWADDIR},'
+
 pre-configure:
-       ${CP} ${FILESDIR}/doomlegacy.in1 ${WRKDIR}
+       ${CP} ${FILESDIR}/INSTALL.pkgsrc ${WRKDIR}
+       ${CP} ${FILESDIR}/doomlegacy.sh ${WRKDIR}
+       ${CP} ${FILESDIR}/doomlegacy.6.in ${WRKDIR}
+       ${CP} ${FILESDIR}/p_blockmap.c ${WRKSRC}/src
+       ${CP} ${FILESDIR}/p_blockmap.h ${WRKSRC}/src
+       ${CP} ${FILESDIR}/p_extnodes.c ${WRKSRC}/src
+       ${CP} ${FILESDIR}/p_extnodes.h ${WRKSRC}/src
+       cd ${WRKSRC} && ${CP} make_options_nix make_options
 
-# Process manpage template
+# Process start script and manpage templates
 do-configure:
        cd ${WRKDIR} &&                                                 \
-               ${SED} -e 's,$$NAME,doomlegacy,g'                       \
+               ${SED} -e 's,$$PREFIX,${PREFIX},'                       \
+                       doomlegacy.sh >doomlegacy
+       cd ${WRKDIR} &&                                                 \
+                ${SED} -e 's,$$NAME,doomlegacy,g'                      \
                        -e 's,$$VERSION,${VERS},g'                      \
                        -e 's,$$WADDIR,${PREFIX}/${DOOMWADDIR},g'       \
-                       doomlegacy.in1 >doomlegacy.1
+                       doomlegacy.6.in >doomlegacy.6
 
 do-install:
+       ${INSTALL_PROGRAM} ${WRKSRC}/bin/doomlegacy                     \
+               ${DESTDIR}${PREFIX}/bin/doomlegacy.bin
+       ${INSTALL_SCRIPT} ${WRKDIR}/doomlegacy                          \
+               ${DESTDIR}${PREFIX}/bin/doomlegacy
+       ${INSTALL_DATA} ${WRKDIR}/doomlegacy_${VERS}/legacy.wad         \
+               ${DESTDIR}${PREFIX}/${DOOMWADDIR}/legacy.wad
        cd ${WRKSRC} &&                                                 \
-               ${INSTALL_PROGRAM} bin/doomlegacy                       \
-                       ${DESTDIR}${PREFIX}/bin;                        \
                ${INSTALL_DATA} docs/legacy.css docs/whatsnew.html      \
-                       ${DESTDIR}${PREFIX}/share/doc/doomlegacy;       \
-       cd ${WRKDIR}/doomlegacy_${VERS} &&                              \
-               ${INSTALL_DATA} legacy.wad                              \
-                       ${DESTDIR}${PREFIX}/${DOOMWADDIR}/legacy.wad;   \
-       cd ${WRKDIR} &&                                                 \
-               ${INSTALL_MAN} ${WRKDIR}/doomlegacy.1                   \
-                       ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+                       ${DESTDIR}${PREFIX}/share/doc/doomlegacy
+       ${INSTALL_DATA} ${WRKDIR}/INSTALL.pkgsrc                        \
+               ${DESTDIR}${PREFIX}/share/doc/doomlegacy/INSTALL.pkgsrc
+       ${INSTALL_MAN} ${WRKDIR}/doomlegacy.6                           \
+               ${DESTDIR}${PREFIX}/${PKGMANDIR}/man6
 
 # Ensure that at least the shareware Episode 1 of Doom is available
-# Note: The demos from games/doom1 are not compatible with the Legacy engine
 DEPENDS+=              doom1-[0-9]*:../../games/doom1
 
+BUILDLINK_API_DEPENDS.zlib+=           zlib>=1.2.3
+.include "../../devel/zlib/buildlink3.mk"
 BUILDLINK_API_DEPENDS.SDL_mixer+=      SDL_mixer>=1.2.7
 .include "../../audio/SDL_mixer/buildlink3.mk"
 BUILDLINK_API_DEPENDS.SDL+=            SDL>=1.2.10

Index: pkgsrc/games/doomlegacy/PLIST
diff -u pkgsrc/games/doomlegacy/PLIST:1.1 pkgsrc/games/doomlegacy/PLIST:1.2
--- pkgsrc/games/doomlegacy/PLIST:1.1   Mon Jun 17 13:53:22 2019
+++ pkgsrc/games/doomlegacy/PLIST       Tue May 19 11:20:16 2020
@@ -1,6 +1,8 @@
-@comment $NetBSD: PLIST,v 1.1 2019/06/17 13:53:22 micha Exp $
+@comment $NetBSD: PLIST,v 1.2 2020/05/19 11:20:16 micha Exp $
 bin/doomlegacy
-man/man1/doomlegacy.1
+bin/doomlegacy.bin
+man/man6/doomlegacy.6
+share/doc/doomlegacy/INSTALL.pkgsrc
 share/doc/doomlegacy/legacy.css
 share/doc/doomlegacy/whatsnew.html
 share/doom/legacy.wad
Index: pkgsrc/games/doomlegacy/distinfo
diff -u pkgsrc/games/doomlegacy/distinfo:1.1 pkgsrc/games/doomlegacy/distinfo:1.2
--- pkgsrc/games/doomlegacy/distinfo:1.1        Mon Jun 17 13:53:22 2019
+++ pkgsrc/games/doomlegacy/distinfo    Tue May 19 11:20:16 2020
@@ -1,17 +1,17 @@
-$NetBSD: distinfo,v 1.1 2019/06/17 13:53:22 micha Exp $
+$NetBSD: distinfo,v 1.2 2020/05/19 11:20:16 micha Exp $
 
-SHA1 (doomlegacy_1.47.2_common.zip) = 9e6faaea797b988565a078a47e80bbe2119d78b9
-RMD160 (doomlegacy_1.47.2_common.zip) = 1ac1f47563ad2c0d7c5c1bea93a2aaeb1c001c10
-SHA512 (doomlegacy_1.47.2_common.zip) = 7c7c2a0cbab5b9b4645a3fe166addd597de533db7ab41f8011c6c526a868bb04c8dd6b0d27b48765406fbab328bf64fc7827770b395e6c0e5d861d99c4d3865a
-Size (doomlegacy_1.47.2_common.zip) = 981654 bytes
-SHA1 (doomlegacy_1.47.2_source.tar.bz2) = afb1213eb8b228d9f131e4c63ead97afed2f599f
-RMD160 (doomlegacy_1.47.2_source.tar.bz2) = 661f0fa2bdc58a2f5f9582f36817ddd9d48df9bc
-SHA512 (doomlegacy_1.47.2_source.tar.bz2) = e2e182c18dd24c14e954f791c58e44119457bb74af4bb079c16219406176536f9fd414afd6c9fa0e956a6062b5a346bbf19ebf4c0d2d300e2e66b2eb01cf53fd
-Size (doomlegacy_1.47.2_source.tar.bz2) = 2276199 bytes
-SHA1 (patch-Makefile) = 03fc2f70c4a91ab6e7e3611f594eeaee4ac78b6b
-SHA1 (patch-src_Makefile) = 15cb6daa92f0d00eaf3b6956ef2813fa8358742c
+SHA1 (doomlegacy_1.48.4_common.zip) = 14aed4c0091e8c61f46a2303f9316659ab6c0483
+RMD160 (doomlegacy_1.48.4_common.zip) = cca61af6bdda1003032ee117129e07596c8bbfcf
+SHA512 (doomlegacy_1.48.4_common.zip) = f41830b6d3ba7f30d020e887193fedf502d9b0b260bb53f78e888ce4985dfc2a8b744b5add86813e135c9a0ed65c9be42da64437976b7a85992bcc45bbeeb462
+Size (doomlegacy_1.48.4_common.zip) = 1004978 bytes
+SHA1 (doomlegacy_1.48.4_source.tar.bz2) = f787c653ac4d097de702c72c9b30aed9b4b308a1
+RMD160 (doomlegacy_1.48.4_source.tar.bz2) = 1e2a435e28f84a1578041feec4b98770774b2287
+SHA512 (doomlegacy_1.48.4_source.tar.bz2) = a63a38135f902b7ddfedfbc117ccf9446dba5b1da918189de560722b4fe2afae5f5a0493f9571b5817f95aed96f52fecd32d46c101da5141596cf062d55cec57
+Size (doomlegacy_1.48.4_source.tar.bz2) = 2410187 bytes
+SHA1 (patch-src_Makefile) = 8ddbc1a86d2573dc1d4334d75638de31f1fecf6b
 SHA1 (patch-src_am__map.c) = 647bcba2374cfa7038646e0c053636b43caaf33a
-SHA1 (patch-src_d__main.c) = 89188e534d486d9cfbf2ad92f63b4eb7ab6c50f8
-SHA1 (patch-src_doomtype.h) = fefe08ca5fbe8d11325e32ca833a73d3acb36ea1
-SHA1 (patch-src_i__tcp.c) = 1c0c6017d24640217e29ed238e210850329d0e75
-SHA1 (patch-src_sdl_i__system.c) = 17524680559b81ae755d781f63f3c5d34e1f14b6
+SHA1 (patch-src_doomdata.h) = 2fd95b5db154b05ba88597b20c45146339db4622
+SHA1 (patch-src_dstrings.c) = e1fc8bdcb83efa18690d95c56e3ea7c94a388a50
+SHA1 (patch-src_p__local.h) = 0340c38a80ba4323e4fe7a8c314575a70a246708
+SHA1 (patch-src_p__setup.c) = 8536297175088112b57e87e179d12181c91a3bbf
+SHA1 (patch-src_r__defs.h) = 9211ae6db72f0288f38449b18c8c252f42686405

Index: pkgsrc/games/doomlegacy/patches/patch-src_Makefile
diff -u pkgsrc/games/doomlegacy/patches/patch-src_Makefile:1.1 pkgsrc/games/doomlegacy/patches/patch-src_Makefile:1.2
--- pkgsrc/games/doomlegacy/patches/patch-src_Makefile:1.1      Mon Jun 17 13:53:22 2019
+++ pkgsrc/games/doomlegacy/patches/patch-src_Makefile  Tue May 19 11:20:16 2020
@@ -1,135 +1,20 @@
-$NetBSD: patch-src_Makefile,v 1.1 2019/06/17 13:53:22 micha Exp $
+$NetBSD: patch-src_Makefile,v 1.2 2020/05/19 11:20:16 micha Exp $
 
-Add NetBSD to OS list.
-Honor environment variables CFLAGS, LDFLAGS and LIBS.
-Silence warnings about common symbol merging.
+Add object file for import of extended nodes.
+Upstream feature request:
+https://sourceforge.net/p/doomlegacy/feature-requests/95/
 
---- src/Makefile.orig  2018-07-16 09:17:06.000000000 +0000
+Add support to internally create blockmap.
+
+--- src/Makefile.orig  2020-05-11 09:40:36.000000000 +0000
 +++ src/Makefile
-@@ -449,13 +449,14 @@ endif
- endif
- 
- 
--OS_LIST:=LINUX FREEBSD WIN32 WIN7 WIN98 OS2 DOS MAC
-+OS_LIST:=LINUX FREEBSD NETBSD WIN32 WIN7 WIN98 OS2 DOS MAC
- 
--OPTS:=
-+# Do not reset OPTS (init to CFLAGS from environment)
-+OPTS:=$(CFLAGS)
- 
- ifeq ($(OS), LINUX)
-   LINUX=1
--  OPTS:=-DLINUX
-+  OPTS+=-DLINUX
-   #Known Compiler symbols
-   # linux  __linux  __linux__
-   # AIX defines: _AIX
-@@ -474,15 +475,23 @@ else
- ifeq ($(OS), FREEBSD)
-   # Has some linking differences from the rest of Linux-like OS.
-   FREEBSD=1
--  OPTS:=-DLINUX -DFREEBSD
-+  OPTS+=-DLINUX -DFREEBSD
-   #Known Compiler symbols
-   # __FreeBSD__  __FreeBSD_kernel__  __DragonFly__
-   # SDL_platform.h for FreeBSD defines: __FREEBSD__
- else
-+ifeq ($(OS), NETBSD)
-+  # Uses statvfs(5).
-+  NETBSD=1
-+  OPTS+=-DLINUX -DNETBSD
-+  #Known Compiler symbols
-+  # __NetBSD__
-+  # SDL_platform.h for FreeBSD defines: __NETBSD__
-+else
- ifeq ($(OS), WIN32)
-   WIN32=1
-   DOSFILE=1
--  OPTS:=-DWIN32
-+  OPTS+=-DWIN32
-   # if have windows > Win98, and want large memory reports
-   ifdef WIN_LARGE_MEM
-     OPTS+=-DWIN_LARGE_MEM
-@@ -500,7 +509,7 @@ ifeq ($(OS), WIN7)
-   # This does  NOT YET  make a version customized to Win7/8.
-   WIN32=1
-   DOSFILE=1
--  OPTS:=-DWIN32
-+  OPTS+=-DWIN32
-   # probably want large memory reports
-   OPTS+=-DWIN_LARGE_MEM
-   #Known Compiler symbols
-@@ -511,12 +520,12 @@ ifeq ($(OS), WIN98)
-   # If Win98 differences occur, this category can isolate them.
-   WIN32=1
-   DOSFILE=1
--  OPTS:=-DWIN32
-+  OPTS+=-DWIN32
- else
- ifeq ($(OS), OS2)
-   OS2=1
-   DOSFILE=1
--  OPTS:=-D__OS2__
-+  OPTS+=-D__OS2__
-   #Known Compiler symbols
-   # __OS2__
- else
-@@ -545,15 +554,19 @@ endif
- endif
- endif
- endif
-+endif
- export DOSFILE
- 
- # all OPTINC need to have -I. because of how includes are written
- # however the order of -I may be important, so it is left to each SMIF.
- OPTINC:=
--LIBS:=
--LDFLAGS:=
-+# Do not reset LIBS
-+#LIBS:=
-+# Do not reset LDFLAGS
-+#LDFLAGS:=
- INSTALL_SUPPL:=
- 
-+# Note: External CFLAGS are now part of OPTS and appended later
- CFLAGS:=
- # Machine architecture.
- ifdef ARCH
-@@ -597,14 +610,14 @@ ifeq ($(SMIF), SDL)
-     ifndef MAC
-       # default is Linux, for all unix SDL
-       EXENAME:=doomlegacy
--      LDFLAGS=-L/usr/X11R6/lib
--      LIBS:=-lGL -lGLU -lm
-+      LDFLAGS +=-L/usr/X11R6/lib
-+      LIBS +=-lGL -lGLU -lm
-       # -L/usr/X11R6/lib is needed by Linux 2.4 and others that still have
-       # the GLU libraries in an X11 directory.
-       # -lm is needed for pow, powf, and other MATH1 functions.
-     else
-       EXENAME:=doomlegacy
--      LDFLAGS=-framework OpenGL
-+      LDFLAGS +=-framework OpenGL
-     endif
- 
-     SDL_CONFIG:=1
-@@ -1010,12 +1023,12 @@ CFLAGS+=-ffast-math -fno-strict-aliasing
- LCFLAGS:=$(CFLAGS)
- CFLAGS+=$(OPTS) $(OPTINC)
- 
--ifdef MAC
--  # MAC linker does not accept these flags.
--else
--  # Flags to the linker.
--  LDFLAGS+=-Xlinker --warn-common
--endif
-+#ifdef MAC
-+#  # MAC linker does not accept these flags.
-+#else
-+#  # Flags to the linker.
-+#  # LDFLAGS+=-Xlinker --warn-common
-+#endif
- 
- SNDSERV_EXTRAFLAGS:=
- ifdef HAVE_ESD
+@@ -1070,7 +1070,8 @@ screen.o v_video.o \
+ r_draw.o r_plane.o r_segs.o r_sky.o r_things.o r_splats.o \
+ r_bsp.o r_data.o r_main.o \
+ z_zone.o \
+-p_sight.o p_mobj.o p_enemy.o p_user.o p_inter.o p_pspr.o \
++p_blockmap.o \
++p_sight.o p_mobj.o p_enemy.o p_extnodes.o p_user.o p_inter.o p_pspr.o \
+ p_lights.o p_ceilng.o p_doors.o p_plats.o p_floor.o p_spec.o \
+ p_switch.o p_genlin.o p_telept.o p_tick.o p_fab.o p_info.o p_setup.o \
+ p_map.o p_maputl.o \

Added files:

Index: pkgsrc/games/doomlegacy/files/INSTALL.pkgsrc
diff -u /dev/null pkgsrc/games/doomlegacy/files/INSTALL.pkgsrc:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/files/INSTALL.pkgsrc        Tue May 19 11:20:16 2020
@@ -0,0 +1,6 @@
+The location of the doomlegacy WAD directory has been set to:
+
+   DOOMWADDIR
+
+This is the pkgsrc standard Doom WAD directory location (shared with other
+Doom packages).
Index: pkgsrc/games/doomlegacy/files/doomlegacy.6.in
diff -u /dev/null pkgsrc/games/doomlegacy/files/doomlegacy.6.in:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/files/doomlegacy.6.in       Tue May 19 11:20:16 2020
@@ -0,0 +1,286 @@
+.\"=============================================================================
+.\" Header
+.\"
+.\" Copyright (c) 2019-2020 by Michael Baeuerle.
+.\" License: GNU Free Documentation License (GFDL)
+.\"
+.TH $NAME 6 2020-05-14 Unix "$NAME $VERSION manual"
+.\"
+.\"
+.\"=============================================================================
+.\" NAME section
+.\"
+.SH NAME
+Doom Legacy
+.\"
+.\"
+.\"=============================================================================
+.\" SYNOPSIS section
+.\"
+.SH SYNOPSIS
+.B $NAME
+[-opengl] [-iwad xxx.wad] [-file pwad1.wad [pwad2.wad ...]]
+.PP
+.B $NAME
+[-h [g|m|c|s|d|D] | --version]
+.\"
+.\"
+.\"=============================================================================
+.\" DESCRIPTION section
+.\"
+.SH DESCRIPTION
+
+The following information is quoted from Reference Manual:
+.PP
+.B http://doomlegacy.sourceforge.net/docs/legacy.html
+.PP
+
+Doom Legacy can play Doom, Boom, Marine's Best Friend (MBF), and Heretic maps.
+In addition to the original games by id Software and Raven Software, there are
+hundreds of free, fan-made maps available on the Internet. These maps are
+typically distributed as PWAD files, which are not fully self-contained.
+For each game you will also need the corresponding IWAD data file, which
+contains all the graphics, wall and floor textures, sounds, and music for that
+game. For example, if you want to play Doom II maps, you'll need the IWAD file
+doom2.wad, or one of the free replacements.
+
+Legacy has implemented the fundamental and de-facto-standard Boom extensions,
+and the Marine's Best Friend (MBF) extensions. Legacy also has implemented
+among other things 3D floors, swimmable water and other special effects using
+extended linedef codes, and supports the FraggleScript scripting language.
+
+Legacy includes two different graphics engines, the old Doom software renderer
+(with many improvements) and an OpenGL-based hardware renderer.
+The OpenGL renderer is shinier and has fancier effects than the software one,
+but it does not do everything that the software renderer does. It does have
+coronas, explosion light, and other light effects that the software renderer
+does not do.
+Some wads rely upon violating wad rules to get trick effects. Most rely upon
+tricking the software renderer into not drawing something. Using those wads
+with the OpenGL renderer you will see holes in the floor and ceiling, and
+warning messges about polygons.
+
+The first game console we know of was from id Software's game Quake.
+We have been inspired by it and have tried to implement the same functionality
+for the benefit of Quake/Doom fans.
+
+Since Legacy 1.2, the network part of Doom has been totally rewritten.
+It now uses a better transfer method for the packets, (which is usually faster),
+and also implements a basic Client/Server model, where some critical game
+options are changeable only by the server in multiplayer games. Since the
+network communication is faster, we have upped the maximum number of players to
+32!
+.\"
+.\"
+.\"=============================================================================
+.\" OPTIONS section
+.\"
+.SH OPTIONS
+.TP 25
+.BI -config " file
+Set the configfile to use.
+.br
+Default: config.cfg
+.TP
+.BI -blockmap
+Ignore BLOCKMAP lump in WAD file and create a new blockmap internally.
+.PP
+.RS 25
+Try this option if you encounter problems with collision detection
+(e.g. able to walk through a fence or unable to activate a switch).
+.PP
+Only available with pkgsrc blockmap patch.
+.RE
+.TP 25
+.BI -deh " file [file ...]
+Load one or more DEH (DeHackEd) files or BEX files, which can change monster
+abilities and game text.
+.TP
+.BI -file " file [file ...]
+Set PWAD (Patch WAD) files to use.
+.TP
+.BI -game " mode
+Forces a particular game mode to be used.
+.br
+Examples for mode: doom, doomu, doom2, heretic
+.br
+(See Reference Manual for complete table)
+.TP
+.BI -h " [section]
+Print help. An optional section can be specified for details.
+.TP
+.BI -home " directory
+Home directory location, where your configfiles and savegames are kept.
+.TP
+.BI -iwad " file
+Set the main IWAD (Internal WAD) file to use.
+This also determines the game mode when -game is not used.
+.TP
+.BI -noendtext
+Suppress the game EndText screen, which could disrupt some terminal emulations
+because of the special character attributes used.
+.PP
+.RS 25
+For encoding of EndText data see config.cfg file entry textout.
+Supported values: Off, Vanilla, UTF8.
+.RE
+.TP 25
+.BI -opengl
+Hardware accelerated rendering using the OpenGL library.
+Will use hardware acceleration for OpenGL if available.
+If the video card does not have OpenGL hardware acceleration then it will use
+the OpenGL emulation in software, which is very slow.
+.TP
+.BI --version
+Print version and build date.
+.TP
+.BI -warp " num
+Select the map, start game immediately.
+.br
+In DoomII, -warp 13 will goto MAP13.
+.br
+In Ultimate Doom, -warp 1 3 will goto E1M3.
+.TP
+See Reference Manual for a complete options list.
+.\"
+.\"
+.\"=============================================================================
+.\" ENVIRONMENT section
+.\"
+.SH ENVIRONMENT
+.TP 25
+.B DISPLAY
+X display to use. More information about X can be found in
+.BR X (7).
+.TP
+.B DOOMWADDIR
+This environment variable defines a path where WAD files are located.
+.br
+The default is $WADDIR.
+.TP
+.B HOME
+This variable indicates your home directory.
+.TP
+.B USER
+This variable contains your username, is used as the default value for your
+player name in multiplayer games.
+.\"
+.\"
+.\"=============================================================================
+.\" FILES section
+.\"
+.SH FILES
+.TP 25
+.B ~/.doomlegacy/config.cfg
+Default configuration file.
+.TP
+.B ~/.doomlegacy/glconfig.cfg
+Default configuration file for OpenGL mode.
+.TP
+.B ~/.doomlegacy/doomsav*.dsg
+Saved game states.
+.\"
+.\"
+.\"=============================================================================
+.\" NOTES section
+.\"
+.SH NOTES
+If you get no MIDI music, ensure that SDL_mixer has a working MIDI synthesizer
+available. If you use timidity, check that instruments are installed (e.g.
+freepats).
+.PP
+Acknowledgments:
+.IP \(bu 3
+Thanks to id Software of course, for creating the greatest game of all time!
+.PP
+.IP \(bu 3
+To Raven Software, for Heretic and Hexen!
+.PP
+.IP \(bu 3
+Chi Hoang for DosDoom which got us started.
+.PP
+.IP \(bu 3
+Bell Kin for porting Doom Legacy to Linux.
+.PP
+.IP \(bu 3
+Stephane Dierickx for the two pictures in the laucher and the help screen of
+Legacy.
+.PP
+.IP \(bu 3
+Sebastien Bacquet for Qmus2mid.
+.PP
+.IP \(bu 3
+Simon Howard for FraggleScript.
+.PP
+.IP \(bu 3
+TeamTNT for Boom.
+.PP
+.IP \(bu 3
+Steven McGranahan and Robert Baeuml for their large contributions.
+.PP
+.IP \(bu 3
+To all of you who send us ideas and bug reports, thank you!
+.RE
+.\"
+.\"
+.\"=============================================================================
+.\" AUTHORS section
+.\"
+.SH AUTHORS
+Original game by id Software.
+.br
+Heretic by Raven Software.
+.br
+Doom Legacy by Fabrice Denis, Boris Pereira and Thierry Van Elsuwe.
+.br
+Maintained by the Doom Legacy Team since 2001.
+.br
+Man page for pkgsrc by Michael Baeuerle.
+.\"
+.\"
+.\"=============================================================================
+.\" BUGS section
+.\"
+.\" .SH BUGS
+.\"
+.\"
+.\"=============================================================================
+.\" EXAMPLES section
+.\"
+.SH EXAMPLES
+Start the shareware Episode 1 of Doom:
+.IP
+$ $NAME
+.PP
+For the following examples you need the original WAD files of the games
+(copy them to $WADDIR or set DOOMWADDIR to the desired location).
+
+Start Doom and use the OpenGL renderer:
+.IP
+$ $NAME -opengl -iwad doom.wad
+.PP
+Start Doom II:
+.IP
+$ $NAME -iwad doom2.wad
+.PP
+Start Sigil (Doom Episode 5) in compatibility mode as Episode 3:
+.IP
+$ $NAME -game doomu -iwad doomu.wad -file SIGIL_COMPAT.wad
+.PP
+Start Heretic:
+.IP
+$ $NAME -iwad heretic.wad
+.PP
+.\"
+.\"
+.\"=============================================================================
+.\" SEE ALSO section
+.\"
+.SH SEE ALSO
+.BR timidity (1),
+.BR X (7)
+.br
+.BR http://doomlegacy.sourceforge.net/docs/legacy.html
+.\"
+.\"
+.\" EOF
Index: pkgsrc/games/doomlegacy/files/doomlegacy.sh
diff -u /dev/null pkgsrc/games/doomlegacy/files/doomlegacy.sh:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/files/doomlegacy.sh Tue May 19 11:20:16 2020
@@ -0,0 +1,12 @@
+#! /bin/sh
+#
+# Start script for doomlegacy
+#
+# The option "-no_launcher" doesn't exist, but disables the launcher
+# (this method was suggested by upstream).
+#
+
+$PREFIX/bin/doomlegacy.bin -no_launcher $@
+
+
+# EOF
Index: pkgsrc/games/doomlegacy/files/p_blockmap.c
diff -u /dev/null pkgsrc/games/doomlegacy/files/p_blockmap.c:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/files/p_blockmap.c  Tue May 19 11:20:16 2020
@@ -0,0 +1,259 @@
+//
+// Copyright(C) 1993-1996 Id Software, Inc.
+// Copyright(C) 1999 id Software, Chi Hoang, Lee Killough, Jim Flynn,
+//                   Rand Phares, Ty Halderman
+// Copyright(C) 2005-2014 Simon Howard
+// Copyright(C) 2017 Fabian Greffrath
+// Copyright(C) 2020 by DooM Legacy Team
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// DESCRIPTION:
+// [crispy] Create Blockmap
+// [MB] 2020-05-13: Description of blockmap lump format:
+//      https://doomwiki.org/wiki/Blockmap
+//
+
+#include <stdint.h>      // [MB] 2020-05-13: Added for C99 integer data types
+#include <stdlib.h>
+#include <string.h>      // [MB] 2020-05-12: Added for memset()
+
+//#include "i_system.h"  // [MB] 2020-05-12: I_Realloc() is now here
+#include "doomincl.h"    // [MB] 2020-05-12: Added for I_Error()
+#include "p_local.h"
+#include "r_state.h"
+#include "z_zone.h"
+
+
+// I_Realloc
+/*
+ * [MB] 2020-05-12: Ported from Crispy Doom 5.8.0 (src/i_system.c)
+ * - Reject zero new size (would be implementation defined behaviour)
+ * - Use (unsigned long) for I_Error() (size is not a pointer)
+ */
+static void *I_Realloc(void *ptr, size_t size)
+{
+    void *new_ptr = NULL;
+
+    if (0 == size)
+        I_Error("I_Realloc: Failed on zero new size");
+    else
+    {
+        new_ptr = realloc(ptr, size);
+        if (NULL == new_ptr)
+            I_Error("I_Realloc: Failed on reallocation of %lu bytes",
+                    (unsigned long) size);
+    }
+
+    return new_ptr;
+}
+
+
+// [crispy] taken from mbfsrc/P_SETUP.C:547-707, slightly adapted
+/*
+ *  [MB] 2020-05-12: Ported from Crispy Doom 5.8.0 (src/doom/p_blockmap.c)
+ *  - Change indentation to 4 SPs (matching DooM Legacy style)
+ *  - Replace blockmap with blockmapindex (int32_t* => uint32_t*)
+ *    Global pointer to header of the blockmap lump
+ *  - Replace blockmaplump with blockmaphead (int32_t* => uint32_t*)
+ *    Global pointer to beginning of the part containing the offsets
+ *  - Added typecasts for unsigned target types
+ */
+void P_CreateBlockMap(void)
+{
+    register int i;
+    fixed_t minx = INT_MAX, miny = INT_MAX;
+    fixed_t maxx = INT_MIN, maxy = INT_MIN;
+
+    // First find limits of map
+    for (i=0 ; i<numvertexes ; i++)
+    {
+        if (vertexes[i].x >> FRACBITS < minx)
+            minx = vertexes[i].x >> FRACBITS;
+        else if (vertexes[i].x >> FRACBITS > maxx)
+            maxx = vertexes[i].x >> FRACBITS;
+        if (vertexes[i].y >> FRACBITS < miny)
+            miny = vertexes[i].y >> FRACBITS;
+        else if (vertexes[i].y >> FRACBITS > maxy)
+            maxy = vertexes[i].y >> FRACBITS;
+    }
+
+    // [crispy] doombsp/DRAWING.M:175-178
+    minx -= 8; miny -= 8;
+    maxx += 8; maxy += 8;
+
+    // Save blockmap parameters
+    bmaporgx = minx << FRACBITS;
+    bmaporgy = miny << FRACBITS;
+    bmapwidth  = ((maxx-minx) >> MAPBTOFRAC) + 1;
+    bmapheight = ((maxy-miny) >> MAPBTOFRAC) + 1;
+
+    // Compute blockmap, which is stored as a 2d array of variable-sized lists
+    //
+    // Pseudocode:
+    //
+    // For each linedef:
+    //
+    //   Map the starting and ending vertices to blocks.
+    //
+    //   Starting in the starting vertex's block, do:
+    //
+    //     Add linedef to current block's list, dynamically resizing it.
+    //
+    //     If current block is the same as the ending vertex's block,
+    //     exit loop.
+    //
+    //     Move to an adjacent block by moving towards the ending block in
+    //     either the x or y direction, to the block which contains the
+    //     linedef.
+    {
+        typedef struct { int n, nalloc, *list; } bmap_t;  // blocklist structure
+        unsigned tot = bmapwidth * bmapheight;            // size of blockmap
+        bmap_t *bmap = calloc(sizeof *bmap, tot);         // array of blocklists
+        int x, y, adx, ady, bend;
+
+        for (i=0; i < numlines; i++)
+        {
+            int dx, dy, diff, b;
+
+            // starting coordinates
+            x = (lines[i].v1->x >> FRACBITS) - minx;
+            y = (lines[i].v1->y >> FRACBITS) - miny;
+
+            // x-y deltas
+            adx = lines[i].dx >> FRACBITS, dx = adx < 0 ? -1 : 1;
+            ady = lines[i].dy >> FRACBITS, dy = ady < 0 ? -1 : 1;
+
+            // difference in preferring to move across y (>0) instead of x (<0)
+            diff = !adx ? 1 : !ady ? -1 :
+                ( ((x >> MAPBTOFRAC) << MAPBTOFRAC) +
+                    (dx > 0 ? MAPBLOCKUNITS-1 : 0) - x ) *
+                    (ady = abs(ady)) * dx -
+                ( ((y >> MAPBTOFRAC) << MAPBTOFRAC) +
+                    (dy > 0 ? MAPBLOCKUNITS-1 : 0) - y ) *
+                    (adx = abs(adx)) * dy;
+
+            // starting block, and pointer to its blocklist structure
+            b = (y >> MAPBTOFRAC)*bmapwidth + (x >> MAPBTOFRAC);
+
+            // ending block
+            bend = (((lines[i].v2->y >> FRACBITS) - miny) >> MAPBTOFRAC) *
+                bmapwidth +
+                    (((lines[i].v2->x >> FRACBITS) - minx) >> MAPBTOFRAC);
+
+            // delta for pointer when moving across y
+            dy *= bmapwidth;
+
+            // deltas for diff inside the loop
+            adx <<= MAPBTOFRAC;
+            ady <<= MAPBTOFRAC;
+
+            // Now we simply iterate block-by-block until we reach the end block
+            while ((unsigned) b < tot)    // failsafe -- should ALWAYS be true
+            {
+                // Increase size of allocated list if necessary
+                if (bmap[b].n >= bmap[b].nalloc)
+                    bmap[b].list = I_Realloc(bmap[b].list,
+                        ( bmap[b].nalloc = bmap[b].nalloc ?
+                            bmap[b].nalloc*2 : 8 ) *
+                            sizeof*bmap->list);
+
+                // Add linedef to end of list
+                bmap[b].list[bmap[b].n++] = i;
+
+                // If we have reached the last block, exit
+                if (b == bend)
+                    break;
+
+                // Move in either the x or y direction to the next block
+                if (diff < 0)
+                    diff += ady, b += dx;
+                else
+                    diff -= adx, b += dy;
+            }
+        }
+
+        // Compute the total size of the blockmap.
+        //
+        // Compression of empty blocks is performed by reserving two offset
+        // words at tot and tot+1.
+        //
+        // 4 words, unused if this routine is called, are reserved at the start.
+        {
+            int count = tot+6;  // we need at least 1 word per block,
+                                // plus reserved's
+
+            for (i = 0; i < tot; i++)
+                if (bmap[i].n)
+                    count += bmap[i].n + 2; // 1 header word + 1 trailer word +
+                                            // blocklist
+
+            // Allocate blockmap lump with computed count
+            blockmaphead = Z_Malloc(sizeof(*blockmaphead) * count, PU_LEVEL, 0);
+        }
+
+        // Now compress the blockmap.
+        {
+            int ndx = tot += 4;       // Advance index to start of linedef lists
+            bmap_t *bp = bmap;        // Start of uncompressed blockmap
+
+            blockmaphead[ndx++] = 0;  // Store an empty blockmap list at start
+            blockmaphead[ndx++] = (uint32_t)INT32_C(-1); // (For compression)
+
+            for (i = 4; i < tot; i++, bp++)
+                if (bp->n)                               // Non-empty blocklist
+                {
+                                                         // Store index & header
+                    blockmaphead[blockmaphead[i] = ndx++] = 0;
+                    do
+                                                         // Copy linedef list
+                        blockmaphead[ndx++] = (uint32_t)(unsigned int)
+                                              bp->list[--bp->n];
+                    while (bp->n);
+                                                         // Store trailer
+                    blockmaphead[ndx++] = (uint32_t)INT32_C(-1);
+                    free(bp->list);                      // Free linedef list
+                }
+                else       // Empty blocklist: point to reserved empty blocklist
+                    blockmaphead[i] = tot;
+
+        }
+
+        // [MB] 2020-05-13: Moved outside of last nested block to make it more
+        //                  obvious that the free() is always executed
+        free(bmap);  // Free uncompressed blockmap
+    }
+
+#if 1
+    // [MB] 2020-05-13: Populate blockmap lump header
+    /*
+     * Currently DooM Legacy 1.48 does not use this header. Maybe useful for
+     * debugging.
+     */
+    {
+        blockmaphead[0] = bmaporgx>>FRACBITS;  // x coordinate of grid origin
+        blockmaphead[1] = bmaporgy>>FRACBITS;  // y coordinate of grid origin
+        blockmaphead[2] = bmapwidth;           // Number of columns
+        blockmaphead[3] = bmapheight;          // Number of rows
+    }
+#endif
+
+    // [crispy] copied over from P_LoadBlockMap()
+    // [MB] 2020-05-13: Modified to match "clear out mobj chains" of DooM Legacy
+    {
+        int count = sizeof(*blocklinks) * bmapwidth * bmapheight;
+
+        blocklinks = Z_Malloc(count, PU_LEVEL, 0);
+        memset(blocklinks, 0, count);
+        //blockmapindex = blockmaphead+4;
+        blockmapindex = & blockmaphead[4];
+    }
+}
Index: pkgsrc/games/doomlegacy/files/p_blockmap.h
diff -u /dev/null pkgsrc/games/doomlegacy/files/p_blockmap.h:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/files/p_blockmap.h  Tue May 19 11:20:16 2020
@@ -0,0 +1,32 @@
+// Emacs style mode select   -*- C++ -*- 
+//-----------------------------------------------------------------------------
+//
+//  Copyright(C) 2020 by DooM Legacy Team
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
+//  02111-1307, USA.
+//
+//  DESCRIPTION:
+//  Header file created for blockmap creation code from Crispy Doom.
+//
+//-----------------------------------------------------------------------------
+
+
+#ifndef __P_BLOCKMAP__
+#define __P_BLOCKMAP__
+
+void P_CreateBlockMap (void);
+
+#endif
Index: pkgsrc/games/doomlegacy/files/p_extnodes.c
diff -u /dev/null pkgsrc/games/doomlegacy/files/p_extnodes.c:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/files/p_extnodes.c  Tue May 19 11:20:16 2020
@@ -0,0 +1,585 @@
+// Emacs style mode select   -*- C++ -*- 
+//-----------------------------------------------------------------------------
+//
+// $Id: p_extnodes.c,v 1.1 2020/05/19 11:20:16 micha Exp $
+//
+//  Copyright (C) 1999 by
+//  id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
+//  Copyright(C) 2015-2020 Fabian Greffrath
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
+//  02111-1307, USA.
+//
+//  DESCRIPTION:
+//  Support maps with NODES in compressed or uncompressed ZDBSP format or
+//  DeePBSP format.
+//
+//-----------------------------------------------------------------------------
+
+// [MB] 2020-04-21: Support for ZDoom extended nodes based on woof 1.2.0
+//      Modified to use C99 fixed width data types
+//      Added some checks taken from DooM Legacy code for regular nodes
+//      Fixed endianess and use LE_SWAP* macros
+//      Added #ifdef switches for all code that requires zlib
+
+// [FG] support maps with NODES in compressed ZDBSP format
+#ifdef HAVE_ZLIB
+#include <string.h>  // [MB] 2020-05-19: For memcpy()
+#include <zlib.h>
+#endif  // HAVE_ZLIB
+
+#include "doomincl.h"
+
+#include "m_swap.h"
+#include "r_main.h"
+#include "r_splats.h"  // [MB] 2020-04-21: Added for hardware renderer
+#include "w_wad.h"
+#include "z_zone.h"
+
+#include "p_extnodes.h"
+
+// [crispy] support maps with NODES in DeePBSP format
+
+typedef PACKED_STRUCT (
+{
+    int32_t v1;
+    int32_t v2;
+    uint16_t angle;
+    uint16_t linedef;
+    int16_t side;
+    uint16_t offset;
+}) mapseg_deepbsp_t;
+
+typedef PACKED_STRUCT (
+{
+    int16_t x;
+    int16_t y;
+    int16_t dx;
+    int16_t dy;
+    int16_t bbox[2][4];
+    int32_t children[2];
+}) mapnode_deepbsp_t;
+
+typedef PACKED_STRUCT (
+{
+    uint16_t numsegs;
+    int32_t firstseg;
+}) mapsubsector_deepbsp_t;
+
+// [crispy] support maps with NODES in ZDBSP format
+
+typedef PACKED_STRUCT (
+{
+    int32_t v1, v2;
+    uint16_t linedef;
+    unsigned char side;
+}) mapseg_zdbsp_t;
+
+typedef PACKED_STRUCT (
+{
+    int16_t x;
+    int16_t y;
+    int16_t dx;
+    int16_t dy;
+    int16_t bbox[2][4];
+    int32_t children[2];
+}) mapnode_zdbsp_t;
+
+typedef PACKED_STRUCT (
+{
+    uint32_t numsegs;
+}) mapsubsector_zdbsp_t;
+
+// [FG] support maps with NODES in compressed or uncompressed ZDBSP format
+//      or DeePBSP format
+
+mapformat_t P_CheckMapFormat (int lumpnum)
+{
+    mapformat_t format = MFMT_DOOMBSP;
+    byte *nodes = NULL;
+    int b;
+
+#if 0  // [MB] 2020-04-21: Hexen format was already checked in p_setup.c
+    if ((b = lumpnum+ML_BLOCKMAP+1) < numlumps &&
+        !strcasecmp(lumpinfo[b].name, "BEHAVIOR"))
+        I_Error("P_CheckMapFormat: Hexen map format not supported in %s.\n",
+                lumpinfo[lumpnum-ML_NODES].name);
+#endif
+
+    // [MB] 2020-04-21: Check for <numlumps removed (numlumps not available)
+    b = lumpnum+ML_NODES;
+    if ((nodes = W_CacheLumpNum(b, PU_STATIC)) && W_LumpLength(b) > 8)
+    {
+        if (!memcmp(nodes, "xNd4\0\0\0\0", 8))
+            format = MFMT_DEEPBSP;
+        else if (!memcmp(nodes, "XNOD", 4))
+            format = MFMT_ZDBSPX;
+        else if (!memcmp(nodes, "ZNOD", 4))
+            format = MFMT_ZDBSPZ;
+    }
+
+    if (nodes)
+        Z_Free(nodes);
+
+    return format;
+}
+
+// [FG] recalculate seg offsets
+
+static fixed_t GetOffset(vertex_t *v1, vertex_t *v2)
+{
+    fixed_t dx, dy;
+    fixed_t r;
+
+    dx = (v1->x - v2->x)>>FRACBITS;
+    dy = (v1->y - v2->y)>>FRACBITS;
+    r = (fixed_t)(sqrt(dx*dx + dy*dy))<<FRACBITS;
+
+    return r;
+}
+
+// [FG] support maps with DeePBSP nodes
+
+void P_LoadSegs_DeePBSP (int lump)
+{
+    int  i;
+    byte *data;
+    int32_t vn1, vn2;
+
+    numsegs = W_LumpLength(lump) / sizeof(mapseg_deepbsp_t);
+    segs = Z_Malloc(numsegs*sizeof(seg_t),PU_LEVEL,0);
+    memset(segs, 0, numsegs*sizeof(seg_t));
+    data = W_CacheLumpNum(lump,PU_STATIC);
+
+    for (i=0; i<numsegs; i++)
+    {
+        seg_t *li = segs+i;
+        mapseg_deepbsp_t *ml = (mapseg_deepbsp_t *) data + i;
+
+        int side, linedef;
+        line_t *ldef;
+
+        vn1 = LE_SWAP32(ml->v1);
+        vn2 = LE_SWAP32(ml->v2);
+        // [MB] 2020-04-21: Detect buggy wad (same as for normal nodes)
+        if( vn1 > numvertexes || vn2 > numvertexes )
+        {
+            I_SoftError("P_LoadSegs_DeePBSP: Seg vertex bad %i,%i\n",
+                        (int) vn1, (int) vn2 );
+            // zero both out together, make seg safer
+            // (otherwise will cross another line)
+            vn1 = vn2 = 0;
+        }
+        li->v1 = &vertexes[vn1];
+        li->v2 = &vertexes[vn2];
+
+#ifdef HWRENDER
+        // [MB] 2020-04-21: Added (same as for normal nodes)
+        li->pv1 = li->pv2 = NULL;
+        li->length = P_SegLength (li);
+        li->lightmaps = NULL; // list of static lightmap for this seg
+#endif
+
+        li->angle = ((uint16_t)( LE_SWAP16(ml->angle) ))<<16;
+        li->offset = (LE_SWAP16(ml->offset))<<16;
+        linedef = (uint16_t)( LE_SWAP16(ml->linedef) );
+
+        // [MB] 2020-04-21: Detect buggy wad (same as for normal nodes)
+        if( linedef > numlines )
+        {
+            I_SoftError( "P_LoadSegs_DeePBSP: linedef #%i > numlines %i\n",
+                         linedef, numlines );
+            linedef = 0; // default
+        }
+
+        ldef = &lines[linedef];
+        li->linedef = ldef;
+        side = LE_SWAP16(ml->side);
+
+        // [MB] 2020-04-21: Detect buggy wad (same as for normal nodes)
+        if( side != 0 && side != 1 )
+        {
+            I_SoftError( "P_LoadSegs_DeePBSP: bad side index\n");
+            side = 0;  // assume was using wrong side
+        }
+        // side1 required to have sidenum != NULL_INDEX
+        if( ldef->sidenum[side] == NULL_INDEX )
+        {
+            I_SoftError( "P_LoadSegs_DeePBSP: using missing sidedef\n");
+            side = 0;  // assume was using wrong side
+        }
+
+        li->side = side;
+        li->sidedef = &sides[ldef->sidenum[side]];
+        li->frontsector = sides[ldef->sidenum[side]].sector;
+
+        // killough 5/3/98: ignore 2s flag if second sidedef missing:
+        if (ldef->flags & ML_TWOSIDED && ldef->sidenum[side^1]!=NULL_INDEX)
+            li->backsector = sides[ldef->sidenum[side^1]].sector;
+        else
+            li->backsector = 0;
+
+        // [MB] 2020-04-21: Added (same as for normal nodes)
+        li->numlights = 0;
+        li->rlights = NULL;
+    }
+
+    Z_Free (data);
+}
+
+void P_LoadSubsectors_DeePBSP (int lump)
+{
+    mapsubsector_deepbsp_t *data;
+    int  i;
+
+    numsubsectors = W_LumpLength (lump) / sizeof(mapsubsector_deepbsp_t);
+    subsectors = Z_Malloc(numsubsectors*sizeof(subsector_t),PU_LEVEL,0);
+    data = (mapsubsector_deepbsp_t *)W_CacheLumpNum(lump, PU_STATIC);
+
+    memset(subsectors, 0, numsubsectors*sizeof(subsector_t));
+
+    for (i=0; i<numsubsectors; i++)
+    {
+        subsectors[i].numlines = (uint16_t)( LE_SWAP16(data[i].numsegs) );
+        subsectors[i].firstline = (uint32_t)( LE_SWAP32(data[i].firstseg) );
+    }
+
+    Z_Free (data);
+}
+
+void P_LoadNodes_DeePBSP (int lump)
+{
+    byte *data;
+    int  i;
+
+    numnodes = W_LumpLength (lump) / sizeof(mapnode_deepbsp_t);
+    nodes = Z_Malloc (numnodes*sizeof(node_t),PU_LEVEL,0);
+    data = W_CacheLumpNum (lump, PU_STATIC);
+
+    // [FG] skip header
+    data += 8;
+
+    // [MB] 2020-04-21: Added similar check as for normal nodes
+    // No nodes and one subsector is a trivial but legal map.
+    if( (numnodes < 1) && (numsubsectors > 1) )
+    {
+        I_SoftError("P_LoadNodes_DeePBSP: Bad node data\n");
+        return;
+    }
+
+    for (i=0; i<numnodes; i++)
+    {
+        node_t *no = nodes + i;
+        mapnode_deepbsp_t *mn = (mapnode_deepbsp_t *) data + i;
+        int j;
+
+        no->x = LE_SWAP16(mn->x)<<FRACBITS;
+        no->y = LE_SWAP16(mn->y)<<FRACBITS;
+        no->dx = LE_SWAP16(mn->dx)<<FRACBITS;
+        no->dy = LE_SWAP16(mn->dy)<<FRACBITS;
+
+        for (j=0 ; j<2 ; j++)
+        {
+            int k;
+            no->children[j] = LE_SWAP32(mn->children[j]);
+
+            for (k=0 ; k<4 ; k++)
+                no->bbox[j][k] = LE_SWAP16(mn->bbox[j][k])<<FRACBITS;
+        }
+    }
+
+    W_CacheLumpNum(lump, PU_CACHE);
+}
+
+// [FG] support maps with compressed or uncompressed ZDBSP nodes
+// adapted from prboom-plus/src/p_setup.c:1040-1331
+// heavily modified, condensed and simplyfied
+// - removed most paranoid checks, brought in line with Vanilla P_LoadNodes()
+// - removed const type punning pointers
+// - inlined P_LoadZSegs()
+// - added support for compressed ZDBSP nodes
+// - added support for flipped levels
+
+void P_LoadNodes_ZDBSP (int lump, boolean compressed)
+{
+    byte *data;
+    uint32_t i;
+#ifdef HAVE_ZLIB
+    byte *output;
+#endif  // HAVE_ZLIB
+
+    uint32_t orgVerts, newVerts;
+    uint32_t numSubs, currSeg;
+    uint32_t numSegs;
+    uint32_t numNodes;
+    vertex_t *newvertarray = NULL;
+
+    data = W_CacheLumpNum(lump, PU_LEVEL);
+
+    // 0. Uncompress nodes lump (or simply skip header)
+
+    if (compressed)
+    {
+#ifdef HAVE_ZLIB
+        const int len =  W_LumpLength(lump);
+        int outlen, err;
+        z_stream *zstream;
+
+        // first estimate for compression rate:
+        // output buffer size == 2.5 * input size
+        outlen = 2.5 * len;
+        output = Z_Malloc(outlen, PU_STATIC, 0);
+
+        // initialize stream state for decompression
+        zstream = malloc(sizeof(*zstream));
+        if (NULL == zstream)
+            I_Error("P_LoadNodes: "
+                    "Out of memory during ZDBSP nodes decrompression!");
+        memset(zstream, 0, sizeof(*zstream));
+        zstream->next_in = data + 4;
+        zstream->avail_in = len - 4;
+        zstream->next_out = output;
+        zstream->avail_out = outlen;
+
+        if (inflateInit(zstream) != Z_OK)
+            I_Error("P_LoadNodes: "
+                    "Error during ZDBSP nodes decompression initialization!");
+
+        // resize if output buffer runs full
+        while ((err = inflate(zstream, Z_SYNC_FLUSH)) == Z_OK)
+        {
+            int outlen_old = outlen;
+            outlen = 2 * outlen_old;
+#   if 0
+            output = Z_Realloc(output, outlen, PU_STATIC, 0);
+#   else
+            // DooM Legacy has no Z_Realloc()
+            byte *output_new;
+
+            output_new = Z_Malloc(outlen, PU_STATIC, 0);
+            memcpy( (void*)output_new, (void*)output, (size_t)outlen_old);
+            Z_Free(output);
+            output = output_new;
+#   endif
+            zstream->next_out = output + outlen_old;
+            zstream->avail_out = outlen - outlen_old;
+        }
+
+        if (err != Z_STREAM_END)
+            I_Error("P_LoadNodes: Error during ZDBSP nodes decompression!");
+
+        GenPrintf(EMSG_info,
+                  "P_LoadNodes: ZDBSP nodes compression ratio %.3f\n",
+                  (float)zstream->total_out/zstream->total_in);
+
+        data = output;
+
+        if (inflateEnd(zstream) != Z_OK)
+            I_Error("P_LoadNodes: "
+                    "Error during ZDBSP nodes decompression shut-down!");
+
+        // release the original data lump
+        W_CacheLumpNum(lump, PU_CACHE);
+        free(zstream);
+#else  // HAVE_ZLIB
+        I_Error("P_LoadNodes: ZDBSP nodes decompression requires zlib!");
+#endif  // HAVE_ZLIB
+    }
+    else
+    {
+        // skip header
+        data += 4;
+    }
+
+    // 1. Load new vertices added during node building
+
+    orgVerts = (uint32_t)LE_SWAP32(*((uint32_t*)data));
+    data += sizeof(orgVerts);
+
+    newVerts = (uint32_t)LE_SWAP32(*((uint32_t*)data));
+    data += sizeof(newVerts);
+
+    if (orgVerts + newVerts == (unsigned int)numvertexes)
+    {
+        newvertarray = vertexes;
+    }
+    else
+    {
+        newvertarray = Z_Malloc((orgVerts + newVerts) * sizeof(vertex_t),
+                                 PU_LEVEL, 0);
+        memcpy(newvertarray, vertexes, orgVerts * sizeof(vertex_t));
+        memset(newvertarray + orgVerts, 0, newVerts * sizeof(vertex_t));
+    }
+
+    for (i = 0; i < newVerts; i++)
+    {
+#if 0  // [MB] 2020-04-21: DooM Legacy has no separate renderer coordinates
+        newvertarray[i + orgVerts].r_x =
+#endif
+            newvertarray[i + orgVerts].x = LE_SWAP32(*((uint32_t*)data));
+        data += sizeof(newvertarray[0].x);
+
+#if 0  // [MB] 2020-04-21: DooM Legacy has no separate renderer coordinates
+        newvertarray[i + orgVerts].r_y =
+#endif
+            newvertarray[i + orgVerts].y = LE_SWAP32(*((uint32_t*)data));
+        data += sizeof(newvertarray[0].y);
+    }
+
+    if (vertexes != newvertarray)
+    {
+        for (i = 0; i < (uint32_t)numlines; i++)
+        {
+            lines[i].v1 = lines[i].v1 - vertexes + newvertarray;
+            lines[i].v2 = lines[i].v2 - vertexes + newvertarray;
+        }
+
+        Z_Free(vertexes);
+        vertexes = newvertarray;
+        numvertexes = (int)(orgVerts + newVerts);
+    }
+
+    // 2. Load subsectors
+
+    numSubs = (uint32_t)LE_SWAP32(*((uint32_t*)data));
+    data += sizeof(numSubs);
+
+    if (0 == numSubs)
+        I_Error("P_LoadNodes_ZDBSP: No subsectors in map!");
+
+    numsubsectors = (int)numSubs;
+    subsectors = Z_Malloc(numsubsectors * sizeof(subsector_t), PU_LEVEL, 0);
+
+    for (i = currSeg = 0; i < numsubsectors; i++)
+    {
+        mapsubsector_zdbsp_t *mseg = (mapsubsector_zdbsp_t*) data + i;
+
+        subsectors[i].firstline = currSeg;
+        subsectors[i].numlines = (uint32_t)LE_SWAP32(mseg->numsegs);
+        currSeg += (uint32_t)LE_SWAP32(mseg->numsegs);
+    }
+
+    data += numsubsectors * sizeof(mapsubsector_zdbsp_t);
+
+    // 3. Load segs
+
+    numSegs = (uint32_t)LE_SWAP32(*((uint32_t*)data));
+    data += sizeof(numSegs);
+
+    // The number of stored segs should match the number of segs used by
+    // subsectors
+    if (numSegs != currSeg)
+    {
+        I_Error("P_LoadNodes_ZDBSP: Incorrect number of segs in ZDBSP nodes!");
+    }
+
+    numsegs = (int)numSegs;
+    segs = Z_Malloc(numsegs * sizeof(seg_t), PU_LEVEL, 0);
+
+    for (i = 0; i < (uint32_t)numsegs; i++)
+    {
+        line_t *ldef;
+        unsigned int linedef;
+        unsigned char side;
+        seg_t *li = segs + i;
+        mapseg_zdbsp_t *ml = (mapseg_zdbsp_t *) data + i;
+        int32_t vn1, vn2;
+
+        vn1 = LE_SWAP32(ml->v1);
+        vn2 = LE_SWAP32(ml->v2);
+        // [MB] 2020-04-21: Detect buggy wad (same as for normal nodes)
+        if( vn1 > numvertexes || vn2 > numvertexes )
+        {
+            I_SoftError("P_LoadSegs_ZDBSP: Seg vertex bad %i,%i\n",
+                        (int) vn1, (int) vn2 );
+            // zero both out together, make seg safer
+            // (otherwise will cross another line)
+            vn1 = vn2 = 0;
+        }
+        li->v1 = &vertexes[vn1];
+        li->v2 = &vertexes[vn2];
+
+#ifdef HWRENDER
+        // [MB] 2020-04-22: Added (same as for normal nodes)
+        li->pv1 = li->pv2 = NULL;
+        li->length = P_SegLength (li);
+        li->lightmaps = NULL; // list of static lightmap for this seg
+#endif
+
+        linedef = (uint16_t)( LE_SWAP16(ml->linedef) );
+        ldef = &lines[linedef];
+        li->linedef = ldef;
+        side = ml->side;
+
+        // e6y: check for wrong indexes
+        if ((unsigned)ldef->sidenum[side] >= (unsigned)numsides)
+        {
+            I_Error("P_LoadSegs_ZDBSP: linedef %u for seg %u "
+                    "references a non-existent sidedef %u",
+                    linedef, (unsigned) i, (unsigned)ldef->sidenum[side]);
+        }
+
+        li->sidedef = &sides[ldef->sidenum[side]];
+        li->frontsector = sides[ldef->sidenum[side]].sector;
+
+        // seg angle and offset are not included
+        li->angle = R_PointToAngle2(segs[i].v1->x, segs[i].v1->y,
+                                    segs[i].v2->x, segs[i].v2->y);
+        li->offset = GetOffset(li->v1, (ml->side ? ldef->v2 : ldef->v1));
+
+        // killough 5/3/98: ignore 2s flag if second sidedef missing:
+        if (ldef->flags & ML_TWOSIDED && ldef->sidenum[side^1]!=NULL_INDEX)
+            li->backsector = sides[ldef->sidenum[side^1]].sector;
+        else
+            li->backsector = 0;
+    }
+
+    data += numsegs * sizeof(mapseg_zdbsp_t);
+
+    // 4. Load nodes
+
+    numNodes = (uint32_t)LE_SWAP32(*((uint32_t*)data));
+    data += sizeof(numNodes);
+
+    numnodes = (int)numNodes;
+    nodes = Z_Malloc(numnodes * sizeof(node_t), PU_LEVEL, 0);
+
+    for (i = 0; i < numnodes; i++)
+    {
+        int j, k;
+        node_t *no = nodes + i;
+        mapnode_zdbsp_t *mn = (mapnode_zdbsp_t *) data + i;
+
+        no->x = LE_SWAP16(mn->x)<<FRACBITS;
+        no->y = LE_SWAP16(mn->y)<<FRACBITS;
+        no->dx = LE_SWAP16(mn->dx)<<FRACBITS;
+        no->dy = LE_SWAP16(mn->dy)<<FRACBITS;
+
+        for (j = 0; j < 2; j++)
+        {
+            no->children[j] = (uint32_t)LE_SWAP32(mn->children[j]);
+
+            for (k = 0; k < 4; k++)
+                no->bbox[j][k] = LE_SWAP16(mn->bbox[j][k])<<FRACBITS;
+        }
+    }
+
+#ifdef HAVE_ZLIB
+    if (compressed)
+        Z_Free(output);
+    else
+#endif  // HAVE_ZLIB
+        W_CacheLumpNum(lump, PU_CACHE);
+}
Index: pkgsrc/games/doomlegacy/files/p_extnodes.h
diff -u /dev/null pkgsrc/games/doomlegacy/files/p_extnodes.h:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/files/p_extnodes.h  Tue May 19 11:20:16 2020
@@ -0,0 +1,92 @@
+// Emacs style mode select   -*- C++ -*- 
+//-----------------------------------------------------------------------------
+//
+// $Id: p_extnodes.h,v 1.1 2020/05/19 11:20:16 micha Exp $
+//
+//  Copyright (C) 1999 by
+//  id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
+//  Copyright(C) 2015-2020 Fabian Greffrath
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
+//  02111-1307, USA.
+//
+//  DESCRIPTION:
+//  Support maps with NODES in compressed or uncompressed ZDBSP format or
+//  DeePBSP format.
+//
+//-----------------------------------------------------------------------------
+
+
+#ifndef __P_EXTNODES__
+#define __P_EXTNODES__
+
+// [MB] 2020-04-21: Support for ZDoom extended nodes based on woof 1.2.0
+
+// [MB] 2020-04-21: Moved from woof doomtype.h to this header
+// The packed attribute forces structures to be packed into the minimum
+// space necessary.  If this is not done, the compiler may align structure
+// fields differently to optimize memory access, inflating the overall
+// structure size.  It is important to use the packed attribute on certain
+// structures where alignment is important, particularly data read/written
+// to disk.
+
+#ifdef __GNUC__
+ #if defined(_WIN32) && !defined(__clang__)
+  #define PACKEDATTR __attribute__((packed,gcc_struct))
+ #else
+  #define PACKEDATTR __attribute__((packed))
+ #endif
+
+ #define PRINTF_ATTR(fmt, first) __attribute__((format(printf, fmt, first)))
+ #define PRINTF_ARG_ATTR(x) __attribute__((format_arg(x)))
+ #define NORETURN __attribute__((noreturn))
+#else
+ #if defined(_MSC_VER)
+  #define PACKEDATTR __pragma(pack(pop))
+ #else
+  #define PACKEDATTR
+ #endif
+
+ #define PRINTF_ATTR(fmt, first)
+ #define PRINTF_ARG_ATTR(x)
+ #define NORETURN
+#endif
+
+#ifdef __WATCOMC__
+ #define PACKEDPREFIX _Packed
+#elif defined(_MSC_VER)
+ #define PACKEDPREFIX __pragma(pack(push,1))
+#else
+ #define PACKEDPREFIX
+#endif
+
+#define PACKED_STRUCT(...) PACKEDPREFIX struct __VA_ARGS__ PACKEDATTR
+
+typedef enum
+{
+    MFMT_DOOMBSP = 0x000,
+    MFMT_DEEPBSP = 0x001,
+    MFMT_ZDBSPX  = 0x002,
+    MFMT_ZDBSPZ  = 0x004,
+} mapformat_t;
+
+extern mapformat_t P_CheckMapFormat (int lumpnum);
+
+extern void P_LoadSegs_DeePBSP (int lump);
+extern void P_LoadSubsectors_DeePBSP (int lump);
+extern void P_LoadNodes_DeePBSP (int lump);
+extern void P_LoadNodes_ZDBSP (int lump, boolean compressed);
+
+#endif

Index: pkgsrc/games/doomlegacy/patches/patch-src_doomdata.h
diff -u /dev/null pkgsrc/games/doomlegacy/patches/patch-src_doomdata.h:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/patches/patch-src_doomdata.h        Tue May 19 11:20:16 2020
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_doomdata.h,v 1.1 2020/05/19 11:20:16 micha Exp $
+
+Refer to subsectors with 32-Bit values (required for extended nodes).
+Upstream feature request:
+https://sourceforge.net/p/doomlegacy/feature-requests/95/
+
+--- src/doomdata.h.orig        2020-04-20 10:32:30.000000000 +0000
++++ src/doomdata.h
+@@ -203,7 +203,8 @@ typedef struct
+ // BSP node structure.
+ 
+ // Indicate a leaf.
+-#define NF_SUBSECTOR    0x8000
++// [MB] 2020-04-22: Changed to 32-Bit for extended nodes
++#define NF_SUBSECTOR    0x80000000
+ 
+ // WAD lump structure
+ typedef struct
+@@ -218,7 +219,8 @@ typedef struct
+   // clip against view frustum.
+   int16_t       bbox[2][4];
+ 
+-  // If NF_SUBSECTOR its a subsector,
++  // [MB] 2020-04-22: NF_SUBSECTOR no longer matches here!
++  // If MSB is set it's a subsector,
+   // else it's a node of another subtree.
+   uint16_t      children[2];
+ 
Index: pkgsrc/games/doomlegacy/patches/patch-src_dstrings.c
diff -u /dev/null pkgsrc/games/doomlegacy/patches/patch-src_dstrings.c:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/patches/patch-src_dstrings.c        Tue May 19 11:20:16 2020
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_dstrings.c,v 1.1 2020/05/19 11:20:16 micha Exp $
+
+Print note that this is a patched version to terminal.
+
+--- src/dstrings.c.orig        2020-05-15 09:47:31.000000000 +0000
++++ src/dstrings.c
+@@ -542,6 +542,11 @@ char *text[NUMTEXT] = {
+     "get a copy of the original game, call 1-800-IDGAMES or see the readme file.\n"
+     "        You will not receive technical support for modified games.\n"
+     "                      press enter to continue\n"
++    "===========================================================================\n"
++    "===========================================================================\n"
++    "Note for pkgsrc: This version uses patches for additional features:\n"
++    "- Support for extended nodes (DeeP V4 and ZDoom, Feature request #95)\n"
++    "- Support for \"-blockmap\" command line option (create blockmap internally)\n"
+     "===========================================================================\n",
+ 
+   // SHAREWARE
Index: pkgsrc/games/doomlegacy/patches/patch-src_p__local.h
diff -u /dev/null pkgsrc/games/doomlegacy/patches/patch-src_p__local.h:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/patches/patch-src_p__local.h        Tue May 19 11:20:16 2020
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_p__local.h,v 1.1 2020/05/19 11:20:16 micha Exp $
+
+Add support to internally create blockmap.
+
+--- src/p_local.h.orig 2020-05-11 09:40:33.000000000 +0000
++++ src/p_local.h
+@@ -379,8 +379,9 @@ void P_ApplyTorque(mobj_t *mo);
+ extern byte*            rejectmatrix;   // for fast sight rejection
+ // Read wad blockmap using int16_t wadblockmaplump[].
+ // Expand from 16bit wad to internal 32bit blockmap.
+-extern uint32_t*        blockmaphead;   // offsets in blockmap are from here
+-extern uint32_t*        blockmapindex;  // Big blockmap, SSNTails
++// [MB] 2020-05-13: Fix comments (blockmapindex points to offset part of lump)
++extern uint32_t*        blockmaphead;   // Big blockmap, SSNTails
++extern uint32_t*        blockmapindex;  // offsets in blockmap are from here
+ extern int              bmapwidth;
+ extern int              bmapheight;     // in mapblocks
+ extern fixed_t          bmaporgx;
Index: pkgsrc/games/doomlegacy/patches/patch-src_p__setup.c
diff -u /dev/null pkgsrc/games/doomlegacy/patches/patch-src_p__setup.c:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/patches/patch-src_p__setup.c        Tue May 19 11:20:16 2020
@@ -0,0 +1,161 @@
+$NetBSD: patch-src_p__setup.c,v 1.1 2020/05/19 11:20:16 micha Exp $
+
+Add support for DeeP and ZDoom extended nodes.
+Upstream feature request:
+https://sourceforge.net/p/doomlegacy/feature-requests/95/
+
+Add support to internally create blockmap.
+
+--- src/p_setup.c.orig 2020-05-11 09:40:34.000000000 +0000
++++ src/p_setup.c
+@@ -150,6 +150,9 @@
+ //-----------------------------------------------------------------------------
+ 
+ #include "doomincl.h"
++#include "m_argv.h"      // [MB] 2020-05-13: To check for "-blockmap" option
++#include "p_blockmap.h"  // [MB] 2020-05-13: For internal blockmap creation
++#include "p_extnodes.h"  // [MB] 2020-04-21: For import of extended nodes
+ #include "p_local.h"
+ #include "p_tick.h"
+   // think
+@@ -251,14 +254,15 @@ typedef struct mapdata_s {
+ // Created from axis aligned bounding box of the map, a rectangular array of
+ // blocks of size ...
+ // Used to speed up collision detection by spatial subdivision in 2D.
++// [MB] 2020-05-13: Fix comments (blockmapindex points to offset part of lump)
+ //
+ // Blockmap size.
+ int             bmapwidth;
+ int             bmapheight;     // size in mapblocks
+ 
+-uint32_t *      blockmapindex;       // for large maps, wad is 16bit
+-// offsets in blockmap are from here
+-uint32_t *      blockmaphead; // Big blockmap, SSNTails
++uint32_t *      blockmaphead;   // Big blockmap, SSNTails
++uint32_t *      blockmapindex;  // For large maps, wad is 16bit
++                                // (offsets in blockmap are from here)
+ 
+ // origin of block map
+ fixed_t         bmaporgx;
+@@ -282,6 +286,7 @@ mapthing_t  *   playerstarts[MAXPLAYERS]
+ 
+ #if 0
+ // [WDJ] Checks from PrBoom.
++// [MB] 2020-04-21: Used the woof code from p_extnodes.c instead
+ 
+ // figgi 08/21/00 -- constants and globals for glBsp support
+ #define gNd2  0x32644E67
+@@ -793,7 +798,22 @@ void P_LoadNodes (int lump)
+         no->dy = LE_SWAP16(mn->dy)<<FRACBITS;
+         for (j=0 ; j<2 ; j++)
+         {
+-            no->children[j] = (uint16_t)( LE_SWAP16(mn->children[j]) );
++            no->children[j] = (uint16_t) ( LE_SWAP16(mn->children[j]) );
++
++            // [MB] 2020-04-21: Changed for extended nodes
++            if (no->children[j] == 0xFFFF)
++                no->children[j] = -1;
++            else
++            if (no->children[j] & 0x8000)
++            {
++                no->children[j] &= ~0x8000;
++
++                 if (no->children[j] >= numsubsectors)
++                    no->children[j] = 0;
++
++                 no->children[j] |= NF_SUBSECTOR;
++            }
++
+             for (k=0 ; k<4 ; k++)
+                 no->bbox[j][k] = LE_SWAP16(mn->bbox[j][k])<<FRACBITS;
+         }
+@@ -1840,6 +1860,7 @@ boolean P_SetupLevel (int      to_episod
+     const char  *errstr;
+     char  *sl_mapname = NULL;
+     int   i;
++    mapformat_t mapformat;
+ 
+     GenPrintf( (verbose? (EMSG_ver|EMSG_now) : (EMSG_console|EMSG_now)),
+                "Setup Level\n" );
+@@ -1985,18 +2006,69 @@ boolean P_SetupLevel (int      to_episod
+         goto load_reject;
+     }
+ 
+-    // note: most of this ordering is important
+-    P_LoadBlockMap (level_lumpnum+ML_BLOCKMAP);
+-    P_LoadVertexes (level_lumpnum+ML_VERTEXES);
+-    P_LoadSectors  (level_lumpnum+ML_SECTORS);
+-    P_LoadSideDefs (level_lumpnum+ML_SIDEDEFS);
+-
+-    P_LoadLineDefs (level_lumpnum+ML_LINEDEFS);
+-    P_LoadSideDefs2(level_lumpnum+ML_SIDEDEFS);
+-    P_LoadLineDefs2();
+-    P_LoadSubsectors (level_lumpnum+ML_SSECTORS);
+-    P_LoadNodes (level_lumpnum+ML_NODES);
+-    P_LoadSegs (level_lumpnum+ML_SEGS);
++    // [MB] 2020-04-21: Node format check from woof (p_extnodes.c)
++    mapformat = P_CheckMapFormat(level_lumpnum);
++    switch (mapformat)
++    {
++    case MFMT_DOOMBSP:
++        GenPrintf(EMSG_info, "Node format: Regular\n" );
++        break;
++    case MFMT_DEEPBSP:
++        GenPrintf(EMSG_info, "Node format: DeeP V4 extended\n" );
++        break;
++    case MFMT_ZDBSPX:
++        GenPrintf(EMSG_info, "Node format: ZDoom extended\n" );
++        break;
++#if HAVE_ZLIB
++    case MFMT_ZDBSPZ:
++        GenPrintf(EMSG_info, "Node format: ZDoom extended (compressed)\n" );
++        break;
++#endif  // HAVE_ZLIB
++    default:
++        I_Error( "P_SetupLevel: Node format not supported\n" );
++        break;
++    }
++
++    {
++        // [MB] 2020-05-13: Added option to internally create blockmap
++        boolean create_blockmap = M_CheckParm("-blockmap");
++
++        // note: most of this ordering is important
++        if (!create_blockmap)
++            P_LoadBlockMap (level_lumpnum+ML_BLOCKMAP);
++        P_LoadVertexes (level_lumpnum+ML_VERTEXES);
++        P_LoadSectors  (level_lumpnum+ML_SECTORS);
++        P_LoadSideDefs (level_lumpnum+ML_SIDEDEFS);
++        P_LoadLineDefs (level_lumpnum+ML_LINEDEFS);
++        P_LoadSideDefs2(level_lumpnum+ML_SIDEDEFS);
++        P_LoadLineDefs2();
++        // [MB] 2020-05-13: Internally create blockmap on request
++        if (create_blockmap)
++        {
++            GenPrintf(EMSG_info, "Ignore BLOCKMAP lump, create blockmap\n" );
++            P_CreateBlockMap ();
++        }
++    }
++
++    // [MB] 2020-04-21: Hook in code imported from woof 1.2.0 (p_extnodes.c)
++    if (mapformat == MFMT_ZDBSPX || mapformat == MFMT_ZDBSPZ)
++    {
++        P_LoadNodes_ZDBSP (level_lumpnum+ML_NODES, mapformat == MFMT_ZDBSPZ);
++    }
++    else if (mapformat == MFMT_DEEPBSP)
++    {
++        P_LoadSubsectors_DeePBSP (level_lumpnum+ML_SSECTORS);
++        P_LoadNodes_DeePBSP (level_lumpnum+ML_NODES);
++        P_LoadSegs_DeePBSP (level_lumpnum+ML_SEGS);
++    }
++    // [MB] 2020-04-21: This is the former DooM Legacy code
++    else
++    {
++        P_LoadSubsectors (level_lumpnum+ML_SSECTORS);
++        P_LoadNodes (level_lumpnum+ML_NODES);
++        P_LoadSegs (level_lumpnum+ML_SEGS);
++    }
++
+     rejectmatrix = W_CacheLumpNum (level_lumpnum+ML_REJECT,PU_LEVEL);
+     P_GroupLines ();
+ 
Index: pkgsrc/games/doomlegacy/patches/patch-src_r__defs.h
diff -u /dev/null pkgsrc/games/doomlegacy/patches/patch-src_r__defs.h:1.1
--- /dev/null   Tue May 19 11:20:17 2020
+++ pkgsrc/games/doomlegacy/patches/patch-src_r__defs.h Tue May 19 11:20:16 2020
@@ -0,0 +1,42 @@
+$NetBSD: patch-src_r__defs.h,v 1.1 2020/05/19 11:20:16 micha Exp $
+
+Refer to segments and subsectors with 32-Bit values.
+Upstream feature request:
+https://sourceforge.net/p/doomlegacy/feature-requests/95/
+
+--- src/r_defs.h.orig  2020-04-20 10:32:32.000000000 +0000
++++ src/r_defs.h
+@@ -130,8 +130,7 @@
+ 
+ 
+ // Max index (or -1). Used in line_t::sidenum and maplinedef_t::sidenum.
+-#define NULL_INDEX   0xFFFF
+-
++#define NULL_INDEX   UINT16_C(0xFFFF)
+ 
+ // Silhouette, needed for clipping Segs (mainly)
+ // and sprites representing things.
+@@ -566,9 +565,9 @@ typedef struct subsector_s
+ {
+     sector_t*   sector;   // (ref) part of this sector, from segs->sector of firstline
+     // numlines and firstline are from the subsectors lump (nodebuilder)
+-    // [WDJ] some wad may be large enough to overflow signed short.
+-    unsigned short  numlines;   // number of segs in this subsector
+-    unsigned short  firstline;  // index into segs lump (loaded from wad)
++    // [MB] 2020-04-22: Changed to 32-Bit for extended nodes
++    uint32_t  numlines;   // number of segs in this subsector
++    uint32_t  firstline;  // index into segs lump (loaded from wad)
+     // floorsplat_t list
+     void*       splats;
+     //Hurdler: added for optimized mlook in hw mode
+@@ -790,7 +789,9 @@ typedef struct
+ 
+     // If NF_SUBSECTOR is set then rest of it is a subsector index,
+     // otherwise it is another node index.
+-    uint16_t    children[2];
++    // [MB] 2020-04-22: Changed to 32-Bit for extended nodes
++    //      Use int to match rest of the code (should be uint32_t)
++    int         children[2];
+         // children[0]= right
+         // children[1]= left
+ } node_t;



Home | Main Index | Thread Index | Old Index