--- /dev/null
+--- d1x/defines.in.orig Mon Jun 19 23:26:12 2000
++++ d1x/defines.in Sun Jun 2 01:18:27 2002
+@@ -5,7 +5,7 @@
+ #NO_ASM = 1
+
+ # MAKE_EDITOR: build editor into game be sure to comment RELEASE
+-#MAKE_EDITOR = 1
++#MAKE_EDITOR = 1 # not enabled by default - causes SEGVs...
+
+ # DEBUG: enable asserts, int3, etc. and include debugger data
+ #DEBUG = 1
+@@ -35,15 +35,15 @@
+ #SHAREWARE = 1
+
+ # RELEASE: release build. removes debug/editor things
+-RELEASE = 1
++#RELEASE = 1
+
+ # environment
+-ENV_DJGPP = 1
++#ENV_DJGPP = 1
+ #ENV_DJGPP_REALDOS =1
+ #ENV_MINGW32 = 1
+ #ENV_CYGWIN = 1
+ #ENV_MSVC = 1
+-#ENV_LINUX = 1
++ENV_LINUX = 1
+
+ # if compiling with Cygwin, you need extra mingw compatible c++ libraries (see compile.txt)
+ #MINGW_EXTRA = /Cygnus/mingw/
+@@ -79,7 +79,7 @@
+ #GLX_IO = 1
+
+ # linux audio options (chose one)
+-#SDL_AUDIO = 1
++SDL_AUDIO = 1
+ #ALSA_AUDIO = 1
+
+ # secondary compiler options
+@@ -93,7 +93,7 @@
+ #sound options for dos: choose which
+ #MIKMOD = 1 #MikMod digital, can be used with allg_midi
+ #ALLG_MIDI = 1 #Allegro midi, can be used with mikmod
+-ALLEGRO = 1 #Allegro for midi and digi, should be used alone
++#ALLEGRO = 1 #Allegro for midi and digi, should be used alone
+
+ #music options for linux:
+ #HMIPLAY = 1
--- /dev/null
+--- d1x/main/gameseg.h.orig Sun Jun 25 10:34:29 2000
++++ d1x/main/gameseg.h Sun Jun 2 01:25:12 2002
+@@ -170,7 +170,7 @@
+ segmasks get_seg_masks(vms_vector *checkp,int segnum,fix rad, char *calling_file, int calling_linenum);
+
+ //this macro returns true if the segnum for an object is correct
+-#define check_obj_seg(obj) (get_seg_masks(&(obj)->pos,(obj)->segnum,0).centermask == 0)
++#define check_obj_seg(obj) (get_seg_masks(&(obj)->pos,(obj)->segnum,0,__FILE__,__LINE__).centermask == 0)
+
+ //Tries to find a segment for a point, in the following way:
+ // 1. Check the given segment
+--- d1x/main/gamesave.c.orig Thu Sep 2 15:50:13 1999
++++ d1x/main/gamesave.c Sun Jun 2 01:30:58 2002
+@@ -302,6 +302,7 @@
+ #include "inferno.h"
+ #ifdef EDITOR
+ #include "editor/editor.h"
++#include "strutil.h"
+ #endif
+ #include "error.h"
+ #include "object.h"
+--- d1x/editor/med.c.orig Tue Jun 15 00:03:43 1999
++++ d1x/editor/med.c Sun Jun 2 01:33:50 2002
+@@ -765,7 +765,7 @@
+
+ int DosShell()
+ {
+- int ok, w, h;
++ int w, h;
+ grs_bitmap * save_bitmap;
+
+ // Save the current graphics state.
+--- d1x/editor/autosave.c.orig Tue Jun 15 00:02:47 1999
++++ d1x/editor/autosave.c Sun Jun 2 01:35:05 2002
+@@ -130,6 +130,7 @@
+ #include "mono.h"
+ #include "u_mem.h"
+ #include "ui.h"
++#include "strutil.h"
+
+ #define AUTOSAVE_PERIOD 5 // Number of minutes for timed autosave
+
+--- d1x/editor/eobject.c.orig Tue Jun 15 00:03:00 1999
++++ d1x/editor/eobject.c Sun Jun 2 01:36:22 2002
+@@ -569,7 +569,7 @@
+ int segnum;
+
+ for (segnum=0;segnum <= Highest_segment_index; segnum++) {
+- segmasks result = get_seg_masks(&obj->pos,segnum,0);
++ segmasks result = get_seg_masks(&obj->pos,segnum,0,__FILE__,__LINE__);
+ if (result.centermask == 0) {
+ int fate;
+ fvi_info hit_info;
+@@ -604,7 +604,7 @@
+ // Return 0 if object is in expected segment, else return 1
+ int verify_object_seg(object *objp, vms_vector *newpos)
+ {
+- segmasks result = get_seg_masks(newpos, objp->segnum, objp->size);
++ segmasks result = get_seg_masks(newpos, objp->segnum, objp->size, __FILE__, __LINE__);
+
+ if (result.facemask == 0)
+ return 0;
+@@ -974,7 +974,7 @@
+ {
+ object *objp = &Objects[objnum];
+
+- segmasks result = get_seg_masks(newpos, objp->segnum, objp->size);
++ segmasks result = get_seg_masks(newpos, objp->segnum, objp->size, __FILE__, __LINE__);
+
+ if (result.facemask == 0) {
+ //mprintf((0, "Object #%i moved from (%7.3f %7.3f %7.3f) to (%7.3f %7.3f %7.3f)\n", objnum, f2fl(objp->pos.x), f2fl(objp->pos.y), f2fl(objp->pos.z), f2fl(newpos->x), f2fl(newpos->y), f2fl(newpos->z)));
+--- d1x/editor/kgame.c.orig Tue Jun 15 00:03:24 1999
++++ d1x/editor/kgame.c Sun Jun 2 01:37:10 2002
+@@ -177,7 +177,7 @@
+ Perm_player_segnum = -1;
+
+ if (Perm_player_segnum!=-1) {
+- if (get_seg_masks(&Perm_player_position,Perm_player_segnum,0).centermask==0) {
++ if (get_seg_masks(&Perm_player_position,Perm_player_segnum,0,__FILE__,__LINE__).centermask==0) {
+ ConsoleObject->pos = Perm_player_position;
+ obj_relink(ConsoleObject-Objects,Perm_player_segnum);
+ ConsoleObject->orient = Perm_player_orient;
+--- d1x/editor/segment.c.orig Thu Sep 2 15:37:06 1999
++++ d1x/editor/segment.c Sun Jun 2 01:38:12 2002
+@@ -2223,7 +2223,7 @@
+
+ for (i=0;i<=Highest_segment_index; i++) {
+ if (i != segnum) {
+- masks = get_seg_masks(&segcenter, i, 0);
++ masks = get_seg_masks(&segcenter, i, 0, __FILE__, __LINE__);
+ if (masks.centermask == 0) {
+ mprintf((0, "Segment %i center is contained in segment %i\n", segnum, i));
+ continue;
+@@ -2234,7 +2234,7 @@
+
+ vm_vec_sub(&pdel, &Vertices[Segments[segnum].verts[v]], &segcenter);
+ vm_vec_scale_add(&presult, &segcenter, &pdel, (F1_0*15)/16);
+- masks = get_seg_masks(&presult, i, 0);
++ masks = get_seg_masks(&presult, i, 0, __FILE__, __LINE__);
+ if (masks.centermask == 0) {
+ mprintf((0, "Segment %i near vertex %i is contained in segment %i\n", segnum, v, i));
+ break;
+--- d1x/editor/func.c.orig Tue Jun 15 00:03:05 1999
++++ d1x/editor/func.c Sun Jun 2 01:39:06 2002
+@@ -40,6 +40,7 @@
+ #include <string.h>
+
+ #include "func.h"
++#include "strutil.h"
+
+ #define MAX_PARAMS 10
+
+--- d1x/ui/mouse.c.orig Tue Jun 15 00:14:39 1999
++++ d1x/ui/mouse.c Sun Jun 2 01:41:23 2002
+@@ -55,7 +55,7 @@
+
+ #include <stdlib.h>
+ #ifdef __SDL__
+-#include "SDL.h"
++#include <SDL/SDL.h>
+ #endif
+
+ #include "u_mem.h"
+@@ -168,7 +168,7 @@
+ {
+ int buttons,w,h;
+ #ifdef __LINUX__
+- Uint16 new_x, new_y;
++ int new_x, new_y;
+ buttons = SDL_GetMouseState(&new_x,&new_y);
+ Mouse.dx = new_x - Mouse.x;
+ Mouse.dy = new_y - Mouse.y;
--- /dev/null
+--- d1x/rules.mak.orig Thu Nov 2 04:17:27 2000
++++ d1x/rules.mak Sun May 19 01:00:44 2002
+@@ -45,9 +45,9 @@
+ LINKLIBS += -lm
+ endif
+ ifdef DEBUG
+-CFLAGS = -g -c -Wall -O -funsigned-char -I$(TOPDIR)/include
++CFLAGS = -c -Wall $(OPTFLAGS) -funsigned-char -I$(TOPDIR)/include
+ else #!DEBUG
+-CFLAGS = -g -c -Wall -O3 -funsigned-char -I$(TOPDIR)/include -DNDEBUG
++CFLAGS = -c -Wall $(OPTFLAGS) -funsigned-char -I$(TOPDIR)/include -DNDEBUG
+ ifndef DEBUGABLE
+ CFLAGS += -fomit-frame-pointer
+ endif #!DEBUGABLE
--- /dev/null
+--- d1x/main/piggy.c.orig Tue Apr 18 03:17:58 2000
++++ d1x/main/piggy.c Sun Jun 2 02:09:06 2002
+@@ -715,7 +715,7 @@
+ GameBitmapOffset[0] = 0;
+ }
+
+- filename = "descent.pig";
++ filename = D1XDATAPATH "descent.pig";
+
+ if ( FindArg( "-bigpig" ))
+ BigPig = 1;
+@@ -1138,7 +1138,7 @@
+ piggy_close_file();
+
+ mprintf( (0, "Creating DESCENT.PIG..." ));
+- filename = "descent.pig";
++ filename = D1XDATAPATH "descent.pig";
+ if ( (i=FindArg( "-piggy" )) ) {
+ filename = Args[i+1];
+ mprintf( (0, "Dumping alternate pigfile, '%s'\n", filename ));
+--- d1x/cfile/cfile.c.orig Sun Sep 5 13:22:31 1999
++++ d1x/cfile/cfile.c Sun Jun 2 02:09:30 2002
+@@ -277,13 +277,13 @@
+ }
+
+ if ( !Hogfile_initialized ) {
+- cfile_init_hogfile( "descent.hog", HogFiles, &Num_hogfiles );
++ cfile_init_hogfile( D1XDATAPATH "descent.hog", HogFiles, &Num_hogfiles );
+ Hogfile_initialized = 1;
+ }
+
+ for (i=0; i<Num_hogfiles; i++ ) {
+ if ( !stricmp( HogFiles[i].name, name )) {
+- fp = cfile_get_filehandle( "descent.hog", "rb" );
++ fp = cfile_get_filehandle( D1XDATAPATH "descent.hog", "rb" );
+ if ( fp == NULL ) return NULL;
+ fseek( fp, HogFiles[i].offset, SEEK_SET );
+ *length = HogFiles[i].length;
--- /dev/null
+Summary: D1X - modified version of Descent 1
+Summary(pl): D1X - zmodyfikowana wersja Descenta 1
+Name: d1x
+Version: 1.43
+%define sver %(echo %{version} | tr -d .)
+Release: 1
+License: non-commercial use only
+Group: X11/Applications/Games
+Source0: ftp://pyropilots.org/pub/d1x/%{name}%{sver}sc.tar.bz2
+Patch0: %{name}-config.patch
+Patch1: %{name}-opt.patch
+Patch2: %{name}-fix.patch
+Patch3: %{name}-paths.patch
+URL: http://d1x.warpcore.org/
+BuildRequires: OpenGL-devel
+BuildRequires: SDL-devel >= 1.1
+%ifarch %{ix86}
+BuildRequires: nasm
+%endif
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define _prefix /usr/X11R6
+
+%define _noautoreqdep libGL.so.1 libGLU.so.1
+
+%description
+D1X is a modification of the Descent 1 source that was released by
+Parallax. It's mostly compatible with the Descent 1 v1.5, both in
+multiplayer and on the local machine.
+
+%description -l pl
+D1X to modyfikacja ¼róde³ Descenta 1 udostêpnionych przez Parallax.
+Jest w wiêkszo¶ci kompatybilny z Descentem 1 w wersji 1.5, zarówno
+w trybie dla wielu graczy, jak i bez sieci.
+
+%package common
+Summary: D1X - modified version of Descent 1
+Summary(pl): D1X - zmodyfikowana wersja Descenta 1
+Group: X11/Applications/Games
+
+%description common
+D1X is a modification of the Descent 1 source that was released by
+Parallax. It's mostly compatible with the Descent 1 v1.5, both in
+multiplayer and on the local machine.
+
+This package contains only common files for all versions of D1X. You
+will need also one of game binaries (either SDL or GL version)
+appropriate for your versions of game data (shareware or full) and
+actual game data files.
+
+%description common -l pl
+D1X to modyfikacja ¼róde³ Descenta 1 udostêpnionych przez Parallax.
+Jest w wiêkszo¶ci kompatybilny z Descentem 1 w wersji 1.5, zarówno
+w trybie dla wielu graczy, jak i bez sieci.
+
+Ten pakiet zawiera tylko wspólne pliki dla wszystkich wersji D1X.
+Oprócz niego potrzebny jest który¶ z pakietów z binark± gry (w wersji
+SDL lub GL) odpowiedni dla posiadanych danych gry (shareware lub
+pe³nej wersji) oraz w³a¶ciwe pliki z danymi.
+
+%package sdl-full
+Summary: D1X - SDL-based binary for full version of game
+Summary(pl): D1X - u¿ywaj±ca SDL binarka dla pe³nej wersji gry
+Group: X11/Applications/Games
+Provides: d1x-full
+Requires: %{name}-common = %{version}
+
+%description sdl-full
+This package contains D1X binary compiled with SDL support for full
+version of game. You will need to place full (commercial) version of
+game data files in /usr/X11R6/share/d1x.
+
+%description sdl-full -l pl
+Ten pakiet zawiera binarkê D1X skompilowan± z obs³ug± SDL dla pe³nej
+wersji gry. Pliki z danymi z pe³nej (komercyjnej) wersji gry trzeba
+umie¶ciæ w katalogu /usr/X11R6/share/d1x.
+
+%package sdl-shareware
+Summary: D1X - SDL-based binary for shareware version of game
+Summary(pl): D1X - u¿ywaj±ca SDL binarka dla wersji shareware gry
+Group: X11/Applications/Games
+Provides: d1x-shareware
+Requires: %{name}-common = %{version}
+
+%description sdl-shareware
+This package contains D1X binary compiled with SDL support for full
+version of game. You will need to install d1x-data-shareware package
+or place shareware version of game data files in /usr/X11R6/share/d1x.
+
+%description sdl-shareware -l pl
+Ten pakiet zawiera binarkê D1X skompilowan± z obs³ug± SDL dla wersji
+shareware gry. Trzeba do niego doinstalowaæ pakiet d1x-data-shareware
+lub pliki z danymi z wersji shareware umie¶ciæ w /usr/X11R6/share/d1x.
+
+%package gl-full
+Summary: D1X - GL-based binary for full version of game
+Summary(pl): D1X - u¿ywaj±ca GL binarka dla pe³nej wersji gry
+Group: X11/Applications/Games
+Provides: d1x-full
+Requires: %{name}-common = %{version}
+Requires: OpenGL
+
+%description gl-full
+This package contains D1X binary compiled with GL support for full
+version of game. You will need to place full (commercial) version of
+game data files in /usr/X11R6/share/d1x.
+
+%description gl-full -l pl
+Ten pakiet zawiera binarkê D1X skompilowan± z obs³ug± GL dla pe³nej
+wersji gry. Pliki z danymi z pe³nej (komercyjnej) wersji gry trzeba
+umie¶ciæ w katalogu /usr/X11R6/share/d1x.
+
+%package gl-shareware
+Summary: D1X - GL-based binary for shareware version of game
+Summary(pl): D1X - u¿ywaj±ca GL binarka dla wersji shareware gry
+Group: X11/Applications/Games
+Provides: d1x-shareware
+Requires: %{name}-common = %{version}
+Requires: OpenGL
+
+%description gl-shareware
+This package contains D1X binary compiled with GL support for full
+version of game. You will need to install d1x-data-shareware package
+or place shareware version of game data files in /usr/X11R6/share/d1x.
+
+%description gl-shareware -l pl
+Ten pakiet zawiera binarkê D1X skompilowan± z obs³ug± GL dla wersji
+shareware gry. Trzeba do niego doinstalowaæ pakiet d1x-data-shareware
+lub pliki z danymi z wersji shareware umie¶ciæ w /usr/X11R6/share/d1x.
+
+%prep
+%setup -q -n %{name}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+
+%build
+mkdir lib
+%ifnarch %{ix86}
+echo "NO_ASM = 1" >> defines.in
+%endif
+%ifarch sparc sparc64
+echo "BIGENDIAN = 1" >> defines.in
+%endif
+
+cp -f defines.in defines.mak
+echo "SDL_IO = 1" >> defines.mak
+%{__make} \
+ OPTFLAGS="%{rpmcflags} -DD1XDATAPATH=\\\"%{_datadir}/d1x/\\\"" \
+ SDLROOTDIR=/usr/X11R6
+mv -f ?1x143 d1x-sdl-full
+
+%{__make} clean
+echo "SHAREWARE = 1" >> defines.mak
+%{__make} \
+ OPTFLAGS="%{rpmcflags} -DD1XDATAPATH=\\\"%{_datadir}/d1x/\\\"" \
+ SDLROOTDIR=/usr/X11R6
+mv -f ?1x143sh d1x-sdl-share
+
+%{__make} clean
+cp -f defines.in defines.mak
+echo "SDLGL_IO = 1" >> defines.mak
+%{__make} \
+ OPTFLAGS="%{rpmcflags} -DD1XDATAPATH=\\\"%{_datadir}/d1x/\\\"" \
+ SDLROOTDIR=/usr/X11R6
+mv -f ?1x143_ogl d1x-gl-full
+
+%{__make} clean
+echo "SHAREWARE = 1" >> defines.mak
+%{__make} \
+ OPTFLAGS="%{rpmcflags} -DD1XDATAPATH=\\\"%{_datadir}/d1x/\\\"" \
+ SDLROOTDIR=/usr/X11R6
+mv -f ?1x143sh_ogl d1x-gl-share
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_datadir}/d1x}
+
+install d1x-*-* $RPM_BUILD_ROOT%{_bindir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files common
+%defattr(644,root,root,755)
+%doc bugs.txt d1x.faq d1x.ini d1x.txt d1x140.txt license.txt readme.d1x readme.org todo.txt
+%dir %{_datadir}/d1x
+
+%files sdl-full
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/d1x-sdl-full
+
+%files sdl-shareware
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/d1x-sdl-share
+
+%files gl-full
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/d1x-gl-full
+
+%files gl-shareware
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/d1x-sg-share