diff -uNr linux-heretic-1.0/Makefile linux-heretic-1.0.new/Makefile
--- linux-heretic-1.0/Makefile	Fri Aug 20 09:34:13 1999
+++ linux-heretic-1.0.new/Makefile	Thu Oct 14 15:17:31 1999
@@ -32,15 +32,17 @@
 
 COPT.FreeBSD = -m486 -O2 -malign-jumps=2 -malign-functions=2 -D__32BIT__
 
-COPT.arm = -O2 -D__32BIT__ -fsigned-char -fomit_frame_pointer \
-           -DHAVE_ALLOCA_H
+COPT.arm = -O2 -D__32BIT__ -fsigned-char -fomit-frame-pointer \
+           -DHAVE_ALLOCA_H -D__PACKED__=__attribute__\ \(\(packed\)\)
 # _end_
 
+# Change this to change the platform
+COPT.arch = $(COPT.x86)
 
 # If you want IPX-netcode compiled, replace $(CDEFS.udp) with $(CDEFS.ipx)
 
 CFLAGS = -Wall -Wstrict-prototypes $(CDEFS.udp) \
-	 -I. -I.. -I/usr/X11R6/include $(COPT.x86) $(COPT.sound)
+	 -I. -I.. -I/usr/X11R6/include $(COPT.arch) $(COPT.sound)
 
 # Uncomment the line below if you want to use original "[" and "]" keys
 # for inventory access, instead of "k" and "l".
@@ -82,12 +85,7 @@
 	tables.o v_video.o w_wad.o z_zone.o in_lude.o \
 	info.o i_net.o i_system.o i_udp.o i_ipx.o i_main.o $(SOUND_OBJS)
 
-
-# If you want to compile Heretic for the Netwinder, 
-# change '(./parse_arm.sh others;)' to '(./parse_arm.sh arm;)'.
-
 all:	
-#	(./parse_arm.sh others;)
 	@echo "Choose one of following actions:"
 	@echo
 	@echo " make x11       - will build xheretic - runs under X11"
@@ -155,10 +153,10 @@
 	graphics/i_vga.o -o vgaheretic
 
 sndserver:
-	$(MAKE) -C sndserv $@
+	$(MAKE) -C sndserv COPT.arch="$(COPT.arch)" $@
 
 musserver:
-	$(MAKE) -C musserv $@
+	$(MAKE) -C musserv COPT.arch="$(COPT.arch)" $@
 
 %.o:	%.c
 	$(CC) $(CFLAGS) -c $< -o $@
diff -uNr linux-heretic-1.0/doomdata.h linux-heretic-1.0.new/doomdata.h
--- linux-heretic-1.0/doomdata.h	Tue Apr 13 17:02:58 1999
+++ linux-heretic-1.0.new/doomdata.h	Thu Oct 14 15:02:55 1999
@@ -44,9 +44,14 @@
 {
   short		textureoffset;
   short		rowoffset;
-  char		toptexture[8], bottomtexture[8], midtexture[8];
-  short		sector;				/* on viewer's side */
-} mapsidedef_t;
+
+  char          toptexture[8]  __PACKED__ ,
+		bottomtexture[8]  __PACKED__ ,
+		midtexture[8]  __PACKED__ ;
+  
+  short         sector  __PACKED__ ;
+    /* on viewer's side */
+}   __PACKED__ mapsidedef_t;
 
 typedef struct
 {
@@ -54,7 +59,7 @@
   short		flags;
   short		special, tag;
   short		sidenum[2];			/* sidenum[1] will be -1 if one sided */
-} maplinedef_t;
+}  __PACKED__ maplinedef_t;
 
 #define	ML_BLOCKING	        1
 #define	ML_BLOCKMONSTERS	2
@@ -79,10 +84,11 @@
 typedef	struct
 {
   short		floorheight, ceilingheight;
-  char		floorpic[8], ceilingpic[8];
-  short		lightlevel;
-  short		special, tag;
-} mapsector_t;
+
+  char          floorpic[8], ceilingpic[8]  __PACKED__ ;
+  short         lightlevel  __PACKED__ ;
+  short         special  __PACKED__ , tag  __PACKED__ ;
+}  __PACKED__  mapsector_t;
 
 typedef struct
 {
@@ -112,7 +118,7 @@
   short		x,y,dx,dy;		      /* partition line */
   short		bbox[2][4];		      /* bounding box for each child */
   unsigned short    children[2];	      /* if NF_SUBSECTOR its a subsector */
-} mapnode_t;
+}  __PACKED__  mapnode_t;
 
 typedef struct
 {
@@ -120,7 +126,7 @@
   short		angle;
   short		type;
   short		options;
-} mapthing_t;
+}  __PACKED__  mapthing_t;
 
 #define	MTF_EASY		1
 #define	MTF_NORMAL		2
@@ -142,23 +148,22 @@
   short	patch;
   short	stepdir;
   short	colormap;
-} mappatch_t;
+}  __PACKED__  mappatch_t;
 
 typedef struct
 {
   char		name[8];
-  boolean		masked;	
-  short		width;
-  short		height;
+  boolean       masked  __PACKED__ ;
+  short         width  __PACKED__ ;
+  short         height  __PACKED__ ;
 #if 1
-  int32_t	columndirectory;	// OBSOLETE
+  int32_t	columndirectory  __PACKED__ ; /* OBSOLETE */
 #else
-  void		**columndirectory;	// OBSOLETE
-#endif
-
-  short		patchcount;
-  mappatch_t	patches[1];
-} maptexture_t;
+  void          **columndirectory  __PACKED__ ;     /* OBSOLETE */
+#endif 
+  short         patchcount  __PACKED__ ;
+  mappatch_t    patches[1]  __PACKED__ ;
+}  __PACKED__  maptexture_t;
 
 
 /*
@@ -172,10 +177,10 @@
 /* posts are runs of non masked source pixels */
 typedef struct
 {
-  byte		topdelta;		/* -1 is the last post in a column */
-  byte		length;
+  byte        topdelta;      /* -1 is the last post in a column */
+  byte        length  __PACKED__ ;
   /* length data bytes follows */
-} post_t;
+}  __PACKED__  post_t;
 
 /* column_t is a list of 0 or more post_t, (byte)-1 terminated */
 typedef post_t	column_t;
@@ -192,15 +197,14 @@
   short		topoffset;			/* pixels below the origin */
   int		columnofs[8];		        /* only [width] used */
   /* the [0] is &columnofs[width] */
-} patch_t;
+}   __PACKED__  patch_t;
 
 /* a pic is an unmasked block of pixels */
 typedef struct
 {
-  byte		width,height;
-  byte		data;
-} pic_t;
-
+  byte           width,height  __PACKED__ ;
+  byte           data  __PACKED__ ;
+}  __PACKED__  pic_t;
 
 /*
   ===============================================================================
diff -uNr linux-heretic-1.0/doomdata_arm.h linux-heretic-1.0.new/doomdata_arm.h
--- linux-heretic-1.0/doomdata_arm.h	Mon Mar 15 11:12:44 1999
+++ linux-heretic-1.0.new/doomdata_arm.h	Wed Dec 31 19:00:00 1969
@@ -1,213 +0,0 @@
-/* DoomData.h */
-
-/*
- * all external data is defined here
- * most of the data is loaded into different structures at run time.
- */
-
-#ifndef __DOOMDATA__
-#define __DOOMDATA__
-
-#include "doomtype.h"
-#include "doomdef.h"
-
-/*
-  ===============================================================================
-  
-  map level types
-
-  ===============================================================================
-*/
-
-/* lump order in a map wad */
-enum 
-{
-  ML_LABEL, 
-  ML_THINGS, 
-  ML_LINEDEFS, 
-  ML_SIDEDEFS, 
-  ML_VERTEXES, 
-  ML_SEGS,
-  ML_SSECTORS, 
-  ML_NODES, 
-  ML_SECTORS, 
-  ML_REJECT, 
-  ML_BLOCKMAP
-};
-
-typedef struct
-{
-  short		x,y;
-} mapvertex_t;
-
-typedef struct
-{
-  short		textureoffset;
-  short		rowoffset;
-
-  char          toptexture[8] __attribute__ ((packed)),
-		bottomtexture[8] __attribute__ ((packed)),
-		midtexture[8] __attribute__ ((packed));
-  
-  short         sector __attribute__ ((packed));
-    /* on viewer's side */
-}  __attribute__ ((packed))mapsidedef_t;
-
-typedef struct
-{
-  short		v1, v2;
-  short		flags;
-  short		special, tag;
-  short		sidenum[2];			/* sidenum[1] will be -1 if one sided */
-} __attribute__ ((packed))maplinedef_t;
-
-#define	ML_BLOCKING	        1
-#define	ML_BLOCKMONSTERS	2
-#define	ML_TWOSIDED		4		/* backside will not be present at all */
-/* if not two sided */
-
-/*
- * if a texture is pegged, the texture will have the end exposed to air held
- * constant at the top or bottom of the texture (stairs or pulled down things)
- * and will move with a height change of one of the neighbor sectors
- * Unpegged textures allways have the first row of the texture at the top
- * pixel of the line for both top and bottom textures (windows)
- */
-#define	ML_DONTPEGTOP		8
-#define	ML_DONTPEGBOTTOM	16
-
-#define ML_SECRET		32	/* don't map as two sided: IT'S A SECRET! */
-#define ML_SOUNDBLOCK		64	/* don't let sound cross two of these */
-#define	ML_DONTDRAW		128	/* don't draw on the automap */
-#define	ML_MAPPED		256	/* set if allready drawn in automap */
-
-typedef	struct
-{
-  short		floorheight, ceilingheight;
-
-  char          floorpic[8], ceilingpic[8] __attribute__ ((packed));
-  short         lightlevel __attribute__ ((packed));
-  short         special __attribute__ ((packed)), tag __attribute__ ((packed));
-} __attribute__ ((packed)) mapsector_t;
-
-typedef struct
-{
-  short		numsegs;
-  short		firstseg;		/* segs are stored sequentially */
-} mapsubsector_t;
-
-typedef struct
-{
-  short		v1, v2;
-  short		angle;		
-  short		linedef, side;
-  short		offset;
-} mapseg_t;
-
-enum
-{
-  BOXTOP,
-  BOXBOTTOM,
-  BOXLEFT,
-  BOXRIGHT 
-};	/* bbox coordinates */
-
-#define	NF_SUBSECTOR	0x8000
-typedef struct
-{
-  short		x,y,dx,dy;		      /* partition line */
-  short		bbox[2][4];		      /* bounding box for each child */
-  unsigned short    children[2];	      /* if NF_SUBSECTOR its a subsector */
-} __attribute__ ((packed)) mapnode_t;
-
-typedef struct
-{
-  short		x,y;
-  short		angle;
-  short		type;
-  short		options;
-} __attribute__ ((packed)) mapthing_t;
-
-#define	MTF_EASY		1
-#define	MTF_NORMAL		2
-#define	MTF_HARD		4
-#define	MTF_AMBUSH		8
-
-/*
-  ===============================================================================
-  
-  texture definition
-  
-  ===============================================================================
-*/
-
-typedef struct
-{
-  short	originx;
-  short	originy;
-  short	patch;
-  short	stepdir;
-  short	colormap;
-} __attribute__ ((packed)) mappatch_t;
-
-typedef struct
-{
-  char		name[8];
-  boolean       masked __attribute__ ((packed));
-  short         width __attribute__ ((packed));
-  short         height __attribute__ ((packed));
-  void          **columndirectory __attribute__ ((packed));     /* OBSOLETE */
-  short         patchcount __attribute__ ((packed));
-  mappatch_t    patches[1] __attribute__ ((packed));
-} __attribute__ ((packed)) maptexture_t;
-
-
-/*
-  ===============================================================================
-  
-  graphics
-  
-  ===============================================================================
-*/
-
-/* posts are runs of non masked source pixels */
-typedef struct
-{
-  byte        topdelta;      /* -1 is the last post in a column */
-  byte        length __attribute__ ((packed));
-  /* length data bytes follows */
-} __attribute__ ((packed)) post_t;
-
-/* column_t is a list of 0 or more post_t, (byte)-1 terminated */
-typedef post_t	column_t;
-
-/*
- * a patch holds one or more columns
- * patches are used for sprites and all masked pictures
- */
-typedef struct
-{
-  short		width;				/* bounding box size */
-  short		height;
-  short		leftoffset;			/* pixels to the left of origin */
-  short		topoffset;			/* pixels below the origin */
-  int		columnofs[8];		        /* only [width] used */
-  /* the [0] is &columnofs[width] */
-}  __attribute__ ((packed)) patch_t;
-
-/* a pic is an unmasked block of pixels */
-typedef struct
-{
-  byte           width,height __attribute__ ((packed));
-  byte           data __attribute__ ((packed));
-} __attribute__ ((packed)) pic_t;
-
-/*
-  ===============================================================================
-  
-  status
-  
-  ===============================================================================
-*/
-
-#endif   /* __DOOMDATA__ */
diff -uNr linux-heretic-1.0/doomdata_std.h linux-heretic-1.0.new/doomdata_std.h
--- linux-heretic-1.0/doomdata_std.h	Tue Apr 13 17:02:58 1999
+++ linux-heretic-1.0.new/doomdata_std.h	Wed Dec 31 19:00:00 1969
@@ -1,213 +0,0 @@
-/* DoomData.h */
-
-/*
- * all external data is defined here
- * most of the data is loaded into different structures at run time.
- */
-
-#ifndef __DOOMDATA__
-#define __DOOMDATA__
-
-#include "doomtype.h"
-#include "doomdef.h"
-
-/*
-  ===============================================================================
-  
-  map level types
-
-  ===============================================================================
-*/
-
-/* lump order in a map wad */
-enum 
-{
-  ML_LABEL, 
-  ML_THINGS, 
-  ML_LINEDEFS, 
-  ML_SIDEDEFS, 
-  ML_VERTEXES, 
-  ML_SEGS,
-  ML_SSECTORS, 
-  ML_NODES, 
-  ML_SECTORS, 
-  ML_REJECT, 
-  ML_BLOCKMAP
-};
-
-typedef struct
-{
-  short		x,y;
-} mapvertex_t;
-
-typedef struct
-{
-  short		textureoffset;
-  short		rowoffset;
-  char		toptexture[8], bottomtexture[8], midtexture[8];
-  short		sector;				/* on viewer's side */
-} mapsidedef_t;
-
-typedef struct
-{
-  short		v1, v2;
-  short		flags;
-  short		special, tag;
-  short		sidenum[2];			/* sidenum[1] will be -1 if one sided */
-} maplinedef_t;
-
-#define	ML_BLOCKING	        1
-#define	ML_BLOCKMONSTERS	2
-#define	ML_TWOSIDED		4		/* backside will not be present at all */
-/* if not two sided */
-
-/*
- * if a texture is pegged, the texture will have the end exposed to air held
- * constant at the top or bottom of the texture (stairs or pulled down things)
- * and will move with a height change of one of the neighbor sectors
- * Unpegged textures allways have the first row of the texture at the top
- * pixel of the line for both top and bottom textures (windows)
- */
-#define	ML_DONTPEGTOP		8
-#define	ML_DONTPEGBOTTOM	16
-
-#define ML_SECRET		32	/* don't map as two sided: IT'S A SECRET! */
-#define ML_SOUNDBLOCK		64	/* don't let sound cross two of these */
-#define	ML_DONTDRAW		128	/* don't draw on the automap */
-#define	ML_MAPPED		256	/* set if allready drawn in automap */
-
-typedef	struct
-{
-  short		floorheight, ceilingheight;
-  char		floorpic[8], ceilingpic[8];
-  short		lightlevel;
-  short		special, tag;
-} mapsector_t;
-
-typedef struct
-{
-  short		numsegs;
-  short		firstseg;		/* segs are stored sequentially */
-} mapsubsector_t;
-
-typedef struct
-{
-  short		v1, v2;
-  short		angle;		
-  short		linedef, side;
-  short		offset;
-} mapseg_t;
-
-enum
-{
-  BOXTOP,
-  BOXBOTTOM,
-  BOXLEFT,
-  BOXRIGHT 
-};	/* bbox coordinates */
-
-#define	NF_SUBSECTOR	0x8000
-typedef struct
-{
-  short		x,y,dx,dy;		      /* partition line */
-  short		bbox[2][4];		      /* bounding box for each child */
-  unsigned short    children[2];	      /* if NF_SUBSECTOR its a subsector */
-} mapnode_t;
-
-typedef struct
-{
-  short		x,y;
-  short		angle;
-  short		type;
-  short		options;
-} mapthing_t;
-
-#define	MTF_EASY		1
-#define	MTF_NORMAL		2
-#define	MTF_HARD		4
-#define	MTF_AMBUSH		8
-
-/*
-  ===============================================================================
-  
-  texture definition
-  
-  ===============================================================================
-*/
-
-typedef struct
-{
-  short	originx;
-  short	originy;
-  short	patch;
-  short	stepdir;
-  short	colormap;
-} mappatch_t;
-
-typedef struct
-{
-  char		name[8];
-  boolean		masked;	
-  short		width;
-  short		height;
-#if 1
-  int32_t	columndirectory;	// OBSOLETE
-#else
-  void		**columndirectory;	// OBSOLETE
-#endif
-
-  short		patchcount;
-  mappatch_t	patches[1];
-} maptexture_t;
-
-
-/*
-  ===============================================================================
-  
-  graphics
-  
-  ===============================================================================
-*/
-
-/* posts are runs of non masked source pixels */
-typedef struct
-{
-  byte		topdelta;		/* -1 is the last post in a column */
-  byte		length;
-  /* length data bytes follows */
-} post_t;
-
-/* column_t is a list of 0 or more post_t, (byte)-1 terminated */
-typedef post_t	column_t;
-
-/*
- * a patch holds one or more columns
- * patches are used for sprites and all masked pictures
- */
-typedef struct
-{
-  short		width;				/* bounding box size */
-  short		height;
-  short		leftoffset;			/* pixels to the left of origin */
-  short		topoffset;			/* pixels below the origin */
-  int		columnofs[8];		        /* only [width] used */
-  /* the [0] is &columnofs[width] */
-} patch_t;
-
-/* a pic is an unmasked block of pixels */
-typedef struct
-{
-  byte		width,height;
-  byte		data;
-} pic_t;
-
-
-/*
-  ===============================================================================
-  
-  status
-  
-  ===============================================================================
-*/
-
-#endif   /* __DOOMDATA__ */
diff -uNr linux-heretic-1.0/doomdef.h linux-heretic-1.0.new/doomdef.h
--- linux-heretic-1.0/doomdef.h	Wed Apr 21 10:55:53 1999
+++ linux-heretic-1.0.new/doomdef.h	Thu Oct 14 15:02:55 1999
@@ -165,22 +165,22 @@
 typedef struct
 {
   evtype_t	type;
-  int		data1;		/* keys / mouse/joystick buttons */
-  int		data2;		/* mouse/joystick x move */
-  int		data3;		/* mouse/joystick y move */
-} event_t;
+  int		data1  __PACKED__ ;		/* keys / mouse/joystick buttons */
+  int		data2  __PACKED__ ;		/* mouse/joystick x move */
+  int		data3  __PACKED__ ;		/* mouse/joystick y move */
+}  __PACKED__  event_t;
 
 typedef struct
 {
   char		forwardmove;	/* *2048 for move */
-  char		sidemove;       /* *2048 for move */
-  short		angleturn;      /* <<16 for angle delta */
-  short		consistancy;	/* checks for net game */
-  byte		chatchar;
-  byte		buttons;
-  byte		lookfly;	/* look/fly up/down/centering */
-  byte		arti;		/* artitype_t to use */
-} ticcmd_t;
+  char		sidemove  __PACKED__ ;       /* *2048 for move */
+  short		angleturn  __PACKED__ ;      /* <<16 for angle delta */
+  short		consistancy  __PACKED__ ;	/* checks for net game */
+  byte		chatchar  __PACKED__ ;
+  byte		buttons  __PACKED__ ;
+  byte		lookfly  __PACKED__ ;	/* look/fly up/down/centering */
+  byte		arti  __PACKED__ ;		/* artitype_t to use */
+}  __PACKED__  ticcmd_t;
 
 
 /*
@@ -303,13 +303,13 @@
 typedef struct
 {
   ammotype_t ammo;
-  int upstate;
-  int downstate;
-  int readystate;
-  int atkstate;
-  int holdatkstate;
-  int flashstate;
-} weaponinfo_t;
+  int upstate  __PACKED__ ;
+  int downstate  __PACKED__ ;
+  int readystate  __PACKED__ ;
+  int atkstate  __PACKED__ ;
+  int holdatkstate  __PACKED__ ;
+  int flashstate  __PACKED__ ;
+}  __PACKED__  weaponinfo_t;
 
 extern weaponinfo_t wpnlev1info[NUMWEAPONS];
 extern weaponinfo_t wpnlev2info[NUMWEAPONS];
@@ -363,7 +363,7 @@
 {
   int type;
   int count;
-} inventory_t;
+}  __PACKED__  inventory_t;
 
 
 /*
@@ -396,13 +396,13 @@
 typedef struct
 {  
   spritenum_t	        sprite;
-  long			frame;
-  long			tics;
+  long			frame  __PACKED__ ;
+  long			tics  __PACKED__ ;
   
-  actionf_t		action;
-  statenum_t		nextstate;
-  long			misc1, misc2;
-} state_t;
+  actionf_t		action  __PACKED__ ;
+  statenum_t		nextstate  __PACKED__ ;
+  long			misc1  __PACKED__ , misc2  __PACKED__ ;
+}  __PACKED__  state_t;
 
 extern state_t	states[NUMSTATES];
 extern char *sprnames[NUMSPRITES];
@@ -413,9 +413,9 @@
 
 typedef struct thinker_s
 {
-  struct		thinker_s	*prev, *next;
-  think_t		function;
-} thinker_t;
+  struct		thinker_s	*prev, *next  __PACKED__ ;
+  think_t		function  __PACKED__ ;
+}  __PACKED__  thinker_t;
 
 struct player_s;
 
@@ -424,52 +424,52 @@
   thinker_t		thinker;       /* thinker links */
   
   /* info for drawing */
-  fixed_t		x,y,z;
-  struct mobj_s	*snext, *sprev;	       /* links in sector (if needed) */
-  angle_t		angle;
-  spritenum_t		sprite;	       /* used to find patch_t and flip value */
-  int			frame;	       /*  might be ord with FF_FULLBRIGHT */
+  fixed_t		x  __PACKED__ ,y  __PACKED__ ,z  __PACKED__ ;
+  struct mobj_s	*snext  __PACKED__ , *sprev  __PACKED__ ;	       /* links in sector (if needed) */
+  angle_t		angle  __PACKED__ ;
+  spritenum_t		sprite  __PACKED__ ;	       /* used to find patch_t and flip value */
+  int			frame  __PACKED__ ;	       /*  might be ord with FF_FULLBRIGHT */
 
   /* interaction info */
-  struct mobj_s	*bnext, *bprev;		/* links in blocks (if needed) */
-  struct subsector_s	*subsector;
-  fixed_t		floorz, ceilingz; /* closest together of contacted secs */
-  fixed_t		radius, height;	  /* for movement checking */
-  fixed_t		momx, momy, momz; /* momentums */
-  
-  int		        validcount;	  /* if == validcount, already checked */
-  
-  mobjtype_t		type;
-  mobjinfo_t		*info;		  /* &mobjinfo[mobj->type] */
-  int			tics;		  /* state tic counter */
-  state_t		*state;
-  int			damage;		  /* For missiles */
-  int			flags;
-  int			flags2;		  /* Heretic flags */
-  long			special1;	  /* Special info */
-  long			special2;	  /* Special info */
-  int		        health;
-  int			movedir;	  /* 0-7 */
-  int		        movecount;	  /* when 0, select a new dir */
-  struct mobj_s *target;		  /* thing being chased/attacked (or NULL) */
+  struct mobj_s	*bnext  __PACKED__ , *bprev  __PACKED__ ;		/* links in blocks (if needed) */
+  struct subsector_s	*subsector  __PACKED__ ;
+  fixed_t		floorz  __PACKED__ , ceilingz  __PACKED__ ; /* closest together of contacted secs */
+  fixed_t		radius  __PACKED__ , height  __PACKED__ ;	  /* for movement checking */
+  fixed_t		momx  __PACKED__ , momy  __PACKED__ , momz  __PACKED__ ; /* momentums */
+  
+  int		        validcount  __PACKED__ ;	  /* if == validcount, already checked */
+  
+  mobjtype_t		type  __PACKED__ ;
+  mobjinfo_t		*info  __PACKED__ ;		  /* &mobjinfo[mobj->type] */
+  int			tics  __PACKED__ ;		  /* state tic counter */
+  state_t		*state  __PACKED__ ;
+  int			damage  __PACKED__ ;		  /* For missiles */
+  int			flags  __PACKED__ ;
+  int			flags2  __PACKED__ ;		  /* Heretic flags */
+  int			special1  __PACKED__ ;	  /* Special info */
+  int			special2  __PACKED__ ;	  /* Special info */
+  int		        health  __PACKED__ ;
+  int			movedir  __PACKED__ ;	  /* 0-7 */
+  int		        movecount  __PACKED__ ;	  /* when 0, select a new dir */
+  struct mobj_s *target  __PACKED__ ;		  /* thing being chased/attacked (or NULL) */
   /* also the originator for missiles */
-  int			reactiontime;	  /* if non 0, don't attack yet */
+  int			reactiontime  __PACKED__ ;	  /* if non 0, don't attack yet */
   /* used by player to freeze a bit after */
   /* teleporting */
-  int			threshold;	  /* if >0, the target will be chased */
+  int			threshold  __PACKED__ ;	  /* if >0, the target will be chased */
   /* no matter what (even if shot) */
-  struct player_s	*player;	  /* only valid if type == MT_PLAYER */
-  int			lastlook;	  /* player number last looked for */
+  struct player_s	*player  __PACKED__ ;	  /* only valid if type == MT_PLAYER */
+  int			lastlook  __PACKED__ ;	  /* player number last looked for */
   
-  mapthing_t		spawnpoint;	  /* for nightmare respawn */
-} mobj_t;
+  mapthing_t		spawnpoint  __PACKED__ ;	  /* for nightmare respawn */
+}  __PACKED__  mobj_t;
 
 /* each sector has a degenmobj_t in it's center for sound origin purposes */
 typedef struct
 {
   thinker_t		thinker;	  /* not used for anything */
-  fixed_t		x,y,z;
-} degenmobj_t;
+  fixed_t		x  __PACKED__  ,y  __PACKED__ ,z  __PACKED__ ;
+}  __PACKED__  degenmobj_t;
 
 /* Most damage defined using HITDICE */
 #define HITDICE(a) ((1+(P_Random()&7))*a)
@@ -574,10 +574,9 @@
 typedef struct
 {
   state_t	*state;		/* a NULL state means not active */
-  int		tics;
-  fixed_t	sx, sy;
-} pspdef_t;
-
+  int		tics  __PACKED__ ;
+  fixed_t	sx  __PACKED__ , sy  __PACKED__ ;
+}  __PACKED__  pspdef_t;
 
 
 /*
@@ -591,57 +590,57 @@
 typedef struct player_s
 {
   mobj_t *mo;
-  playerstate_t playerstate;
-  ticcmd_t cmd;
+  playerstate_t playerstate  __PACKED__ ;
+  ticcmd_t cmd  __PACKED__ ;
   
-  fixed_t		viewz;		   /* focal origin above r.z */
-  fixed_t		viewheight;	   /* base height above floor for viewz */
-  fixed_t		deltaviewheight;   /* squat speed */
-  fixed_t		bob;		   /* bounded/scaled total momentum */
-
-  int			flyheight;
-  int			lookdir;
-  boolean		centering;
-  int			health;		   /* only used between levels, mo->health */
+  fixed_t		viewz  __PACKED__ ;		   /* focal origin above r.z */
+  fixed_t		viewheight  __PACKED__ ;	   /* base height above floor for viewz */
+  fixed_t		deltaviewheight  __PACKED__ ;   /* squat speed */
+  fixed_t		bob  __PACKED__ ;		   /* bounded/scaled total momentum */
+
+  int			flyheight  __PACKED__ ;
+  int			lookdir  __PACKED__ ;
+  boolean		centering  __PACKED__ ;
+  int			health  __PACKED__ ;		   /* only used between levels, mo->health */
   /* is used during levels */
-  int			armorpoints, armortype;	/* armor type is 0-2 */
+  int			armorpoints  __PACKED__ , armortype  __PACKED__ ;	/* armor type is 0-2 */
   
-  inventory_t	        inventory[NUMINVENTORYSLOTS];
-  artitype_t	        readyArtifact;
-  int			artifactCount;
-  int 		        inventorySlotNum;
-  int			powers[NUMPOWERS];
-  boolean		keys[NUMKEYS];
-  boolean		backpack;
-  signed int		frags[MAXPLAYERS];	  /* kills of other players */
-  weapontype_t	        readyweapon;
-  weapontype_t	        pendingweapon;		  /* wp_nochange if not changing */
-  boolean		weaponowned[NUMWEAPONS];
-  int			ammo[NUMAMMO];
-  int			maxammo[NUMAMMO];
-  int			attackdown, usedown;	  /* true if button down last tic */
-  int			cheats;			  /* bit flags */
-  
-  int			refire;			  /* refired shots are less accurate */
-  
-  int			killcount, 
-                        itemcount, 
-                        secretcount;              /* for intermission */
-  char		        *message;		  /* hint messages */
-  int			messageTics;		  /* counter for showing messages */
-  int			damagecount, bonuscount;  /* for screen flashing */
-  int			flamecount;		  /* for flame thrower duration */
-  mobj_t		*attacker;		  /* who did damage (NULL for floors) */
-  int			extralight;		  /* so gun flashes light up areas */
-  int			fixedcolormap;		  /* can be set to REDCOLORMAP, etc */
-  int			colormap;		  /* 0-3 for which color to draw player */
-  pspdef_t	        psprites[NUMPSPRITES];	  /* view sprites (gun, etc) */
-  boolean		didsecret;		  /* true if secret level has been done */
-  int			chickenTics;		  /* player is a chicken if > 0 */
-  int			chickenPeck;		  /* chicken peck countdown */
-  mobj_t		*rain1;			  /* active rain maker 1 */
-  mobj_t		*rain2;			  /* active rain maker 2 */
-} player_t;
+  inventory_t	        inventory[NUMINVENTORYSLOTS]  __PACKED__ ;
+  artitype_t	        readyArtifact  __PACKED__ ;
+  int			artifactCount  __PACKED__ ;
+  int 		        inventorySlotNum  __PACKED__ ;
+  int			powers[NUMPOWERS]  __PACKED__ ;
+  boolean		keys[NUMKEYS]  __PACKED__ ;
+  boolean		backpack  __PACKED__ ;
+  signed int		frags[MAXPLAYERS]  __PACKED__ ;	  /* kills of other players */
+  weapontype_t	        readyweapon  __PACKED__ ;
+  weapontype_t	        pendingweapon  __PACKED__ ;		  /* wp_nochange if not changing */
+  boolean		weaponowned[NUMWEAPONS]  __PACKED__ ;
+  int			ammo[NUMAMMO]  __PACKED__ ;
+  int			maxammo[NUMAMMO]  __PACKED__ ;
+  int			attackdown  __PACKED__ , usedown  __PACKED__ ;	  /* true if button down last tic */
+  int			cheats  __PACKED__ ;			  /* bit flags */
+  
+  int			refire  __PACKED__ ;			  /* refired shots are less accurate */
+  
+  int			killcount  __PACKED__ , 
+                        itemcount  __PACKED__ , 
+                        secretcount  __PACKED__ ;              /* for intermission */
+  char		        *message  __PACKED__ ;		  /* hint messages */
+  int			messageTics  __PACKED__ ;		  /* counter for showing messages */
+  int			damagecount  __PACKED__ , bonuscount  __PACKED__ ;  /* for screen flashing */
+  int			flamecount  __PACKED__ ;		  /* for flame thrower duration */
+  mobj_t		*attacker  __PACKED__ ;		  /* who did damage (NULL for floors) */
+  int			extralight  __PACKED__ ;		  /* so gun flashes light up areas */
+  int			fixedcolormap  __PACKED__ ;		  /* can be set to REDCOLORMAP, etc */
+  int			colormap  __PACKED__ ;		  /* 0-3 for which color to draw player */
+  pspdef_t	        psprites[NUMPSPRITES]  __PACKED__ ;	  /* view sprites (gun, etc) */
+  boolean		didsecret  __PACKED__ ;		  /* true if secret level has been done */
+  int			chickenTics  __PACKED__ ;		  /* player is a chicken if > 0 */
+  int			chickenPeck  __PACKED__ ;		  /* chicken peck countdown */
+  mobj_t		*rain1  __PACKED__ ;			  /* active rain maker 1 */
+  mobj_t		*rain2  __PACKED__ ;			  /* active rain maker 2 */
+}  __PACKED__  player_t;
 
 #define CF_NOCLIP		1
 #define	CF_GODMODE		2
@@ -652,41 +651,41 @@
 typedef struct
 {
   unsigned	checksum;	     /* high bit is retransmit request */
-  byte		retransmitfrom;	     /* only valid if NCMD_RETRANSMIT */
-  byte		starttic;
-  byte		player, numtics;
-  ticcmd_t	cmds[BACKUPTICS];
-} doomdata_t;
+  byte		retransmitfrom  __PACKED__ ;	     /* only valid if NCMD_RETRANSMIT */
+  byte		starttic  __PACKED__ ;
+  byte		player  __PACKED__ , numtics  __PACKED__ ;
+  ticcmd_t	cmds[BACKUPTICS]  __PACKED__ ;
+}  __PACKED__  doomdata_t;
 
 typedef struct
 {
   long	id;
-  short	intnum;			     /* DOOM executes an int to execute commands */
+  short	intnum  __PACKED__ ;			     /* DOOM executes an int to execute commands */
   
   /* communication between DOOM and the driver */
-  short	command;		     /* CMD_SEND or CMD_GET */
-  short	remotenode;		     /* dest for send, set by get (-1 = no packet) */
-  short	datalength;		     /* bytes in doomdata to be sent */
+  short	command  __PACKED__ ;		     /* CMD_SEND or CMD_GET */
+  short	remotenode  __PACKED__ ;		     /* dest for send, set by get (-1 = no packet) */
+  short	datalength  __PACKED__ ;		     /* bytes in doomdata to be sent */
 
   /* info common to all nodes */
-  short	numnodes;		     /* console is allways node 0 */
-  short	ticdup;			     /* 1 = no duplication, 2-5 = dup for slow nets */
-  short	extratics;		     /* 1 = send a backup tic in every packet */
-  short	deathmatch;		     /* 1 = deathmatch */
-  short	savegame;		     /* -1 = new game, 0-5 = load savegame */
-  short	episode;		     /* 1-3 */
-  short	map;			     /* 1-9 */
-  short	skill;			     /* 1-5 */
+  short	numnodes  __PACKED__ ;		     /* console is allways node 0 */
+  short	ticdup  __PACKED__ ;			     /* 1 = no duplication, 2-5 = dup for slow nets */
+  short	extratics  __PACKED__ ;		     /* 1 = send a backup tic in every packet */
+  short	deathmatch  __PACKED__ ;		     /* 1 = deathmatch */
+  short	savegame  __PACKED__ ;		     /* -1 = new game, 0-5 = load savegame */
+  short	episode  __PACKED__ ;		     /* 1-3 */
+  short	map  __PACKED__ ;			     /* 1-9 */
+  short	skill  __PACKED__ ;			     /* 1-5 */
   
   /* info specific to this node */
-  short	consoleplayer;
-  short	numplayers;
-  short	angleoffset;	             /* 1 = left, 0 = center, -1 = right */
-  short	drone;			     /* 1 = drone */
+  short	consoleplayer  __PACKED__ ;
+  short	numplayers  __PACKED__ ;
+  short	angleoffset  __PACKED__ ;	             /* 1 = left, 0 = center, -1 = right */
+  short	drone  __PACKED__ ;			     /* 1 = drone */
   
   /* packet data to be sent */
-  doomdata_t	data;
-} doomcom_t;
+  doomdata_t	data  __PACKED__ ;
+}  __PACKED__  doomcom_t;
 
 #define	DOOMCOM_ID	0x12345678l
 
@@ -887,11 +886,11 @@
 typedef struct memblock_s
 {
   size_t                  size;         /* including the header and possibly tiny fragments */
-  void                    **user;       /* NULL if a free block */
-  int                     tag;          /* purgelevel */
-  int                     id;           /* should be ZONEID */
-  struct memblock_s       *next, *prev;
-} memblock_t;
+  void                    **user  __PACKED__ ;       /* NULL if a free block */
+  int                     tag  __PACKED__ ;          /* purgelevel */
+  int                     id  __PACKED__ ;           /* should be ZONEID */
+  struct memblock_s       *next  __PACKED__ , *prev  __PACKED__ ;
+}  __PACKED__  memblock_t;
 
 #define Z_ChangeTag(p,t) \
 { \
@@ -908,8 +907,8 @@
 typedef struct
 {
   char		name[8];
-  int		handle,position,size;
-} lumpinfo_t;
+  int		handle  __PACKED__ ,position  __PACKED__ ,size  __PACKED__ ;
+}  __PACKED__  lumpinfo_t;
 
 extern lumpinfo_t *lumpinfo;
 extern	int	numlumps;
diff -uNr linux-heretic-1.0/doomdef_arm.h linux-heretic-1.0.new/doomdef_arm.h
--- linux-heretic-1.0/doomdef_arm.h	Wed Apr 21 10:55:53 1999
+++ linux-heretic-1.0.new/doomdef_arm.h	Wed Dec 31 19:00:00 1969
@@ -1,1382 +0,0 @@
-
-#ifndef __DOOMDEF__
-#define __DOOMDEF__
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "doomtype.h"
-
-/* all external data is defined here */
-#include "doomdata.h"
-
-/* all important printed strings */
-#include "dstrings.h"
-
-/* header generated by multigen utility */
-#include "info.h"
-
-/* PC direct to screen pointers (should be unused!) */
-extern byte *destview, *destscreen;	
-
-/*
- * Global parameters/defines.
- *
- * Heretiv version
- */
-#define VERSION 130
-#define VERSION_TEXT "v1.3"
-
-/*
- * most key data are simple ascii (lowercased)
- */
-#define	KEY_RIGHTARROW		        0xae
-#define	KEY_LEFTARROW		        0xac
-#define	KEY_UPARROW			0xad
-#define	KEY_DOWNARROW		        0xaf
-#define	KEY_ESCAPE			27
-#define	KEY_ENTER			13
-#define KEY_TAB		                9
-#define	KEY_F1				(0x80+0x3b)
-#define	KEY_F2				(0x80+0x3c)
-#define	KEY_F3				(0x80+0x3d)
-#define	KEY_F4				(0x80+0x3e)
-#define	KEY_F5				(0x80+0x3f)
-#define	KEY_F6				(0x80+0x40)
-#define	KEY_F7				(0x80+0x41)
-#define	KEY_F8				(0x80+0x42)
-#define	KEY_F9				(0x80+0x43)
-#define	KEY_F10				(0x80+0x44)
-#define	KEY_F11				(0x80+0x57)
-#define	KEY_F12				(0x80+0x58)
-
-#define KEY_INSERT                      (0x80+0x59) 
-#define KEY_DELETE                      (0x80+0x5a) 
-#define KEY_HOME                        (0x80+0x5b) 
-#define KEY_END                         (0x80+0x5c) 
-#define KEY_PAGEUP                      (0x80+0x5d) 
-#define KEY_PAGEDOWN                    (0x80+0x5f) 
-
-#define	KEY_BACKSPACE		        127
-#define	KEY_PAUSE			0xff
-
-#define KEY_EQUALS			0x3d
-#define KEY_MINUS			0x2d
-
-#define	KEY_RSHIFT			(0x80+0x36)
-#define	KEY_RCTRL			(0x80+0x1d)
-#define	KEY_RALT			(0x80+0x38)
-
-#define	KEY_LALT			KEY_RALT
-
-#define	FINEANGLES			8192
-#define	FINEMASK			(FINEANGLES-1)
-#define	ANGLETOFINESHIFT	        19	/* 0x100000000 to 0x2000 */
-
-#define	SAVEGAMENAME       "hticsav"
-#define SAVEGAMENAMECD     "hticsav.cd"
-
-/* The home-directory of the user */
-
-void I_GetHomeDirectory( void );
-
-/*
- * Mission packs - might be useful for TC stuff?
- */
-typedef enum
-{
-  heretic,		/* Heretic */
-  none
-} GameMission_t;
-
-/*
- * Identify language to use, software localization.
- */
-typedef enum
-{
-  english,
-  french,
-  german,
-  unknown  
-} Language_t;
-
-/*
- * if rangecheck is undefined, most parameter validation debugging code
- * will not be compiled
- *
- */
-#define RANGECHECK
-
-/* Used for centering */
-#define X_DISP ((screenwidth-320)/2)
-#define Y_DISP ((screenheight-200)/2)
-/* Used for bottom align. */
-#define Y_BOTTOM (screenheight-200)
-
-/* The maximum number of players, multiplayer/networking. */
-#define MAXPLAYERS		4
-
-/* State updates, number of tics / second. */
-#define TICRATE		        35
-#define TICSPERSEC	        35
-#define NUMARTIFCTS	        28
-#define MAXPLAYERS	        4
-
-#define	FRACBITS		16
-#define	FRACUNIT		(1<<FRACBITS)
-typedef int fixed_t;
-
-#define ANGLE_1		0x01000000
-#define ANGLE_45	0x20000000
-#define ANGLE_90	0x40000000
-#define ANGLE_180	0x80000000
-#define ANGLE_MAX	0xffffffff
-
-#define	ANG45	0x20000000
-#define	ANG90	0x40000000
-#define	ANG180	0x80000000
-#define	ANG270	0xc0000000
-
-typedef unsigned angle_t;
-
-
-#define	BT_ATTACK		1
-#define	BT_USE			2
-#define	BT_CHANGE		4     /* if true, the next 3 bits hold weapon num */
-#define	BT_WEAPONMASK	        (8+16+32)
-#define	BT_WEAPONSHIFT	        3
-
-#define BT_SPECIAL		128   /* game events, not really buttons */
-#define	BTS_SAVEMASK	        (4+8+16)
-#define	BTS_SAVESHIFT	        2
-#define	BT_SPECIALMASK	        3
-#define	BTS_PAUSE		1     /* pause the game */
-#define	BTS_SAVEGAME	        2     /* save the game at each console */
-/* savegame slot numbers occupy the second byte of buttons */
-
-typedef enum
-{
-  ev_keydown,
-  ev_keyup,
-  ev_mouse,
-  ev_joystick
-} evtype_t;
-
-typedef struct
-{
-  evtype_t	type;
-  int		data1 __attribute__ ((packed));		/* keys / mouse/joystick buttons */
-  int		data2 __attribute__ ((packed));		/* mouse/joystick x move */
-  int		data3 __attribute__ ((packed));		/* mouse/joystick y move */
-} __attribute__ ((packed)) event_t;
-
-typedef struct
-{
-  char		forwardmove;	/* *2048 for move */
-  char		sidemove __attribute__ ((packed));       /* *2048 for move */
-  short		angleturn __attribute__ ((packed));      /* <<16 for angle delta */
-  short		consistancy __attribute__ ((packed));	/* checks for net game */
-  byte		chatchar __attribute__ ((packed));
-  byte		buttons __attribute__ ((packed));
-  byte		lookfly __attribute__ ((packed));	/* look/fly up/down/centering */
-  byte		arti __attribute__ ((packed));		/* artitype_t to use */
-} __attribute__ ((packed)) ticcmd_t;
-
-
-/*
- * The current state of the game: whether we are
- * playing, gazing at the intermission screen,
- * the game final animation, or a demo.
- */
-typedef enum
-{
-  GS_LEVEL,
-  GS_INTERMISSION,
-  GS_FINALE,
-  GS_DEMOSCREEN
-} gamestate_t;
-
-typedef enum
-{
-  ga_nothing,
-  ga_loadlevel,
-  ga_newgame,
-  ga_loadgame,
-  ga_savegame,
-  ga_playdemo,
-  ga_completed,
-  ga_victory,
-  ga_worlddone,
-  ga_screenshot
-} gameaction_t;
-
-typedef enum
-{
-  wipe_0,
-  wipe_1,
-  wipe_2,
-  wipe_3,
-  wipe_4,
-  NUMWIPES,
-  wipe_random
-} wipe_t;
-
-
-/*
- * Difficulty/skill settings/filters.
- */
-
-/* Skill flags. */
-#define	MTF_EASY		1
-#define	MTF_NORMAL		2
-#define	MTF_HARD		4
-
-/* Deaf monsters/do not react to sound. */
-#define	MTF_AMBUSH		8
-
-typedef enum
-{
-  sk_baby,
-  sk_easy,
-  sk_medium,
-  sk_hard,
-  sk_nightmare
-} skill_t;
-
-/*
- * Key cards.
- */
-typedef enum
-{
-  key_yellow,
-  key_green,
-  key_blue,
-  NUMKEYS
-} keytype_t;
-
-/* The defined weapons,
- *  including a marker indicating
- *  user has not changed weapon.
- */
-typedef enum
-{
-  wp_staff,
-  wp_goldwand,
-  wp_crossbow,
-  wp_blaster,
-  wp_skullrod,
-  wp_phoenixrod,
-  wp_mace,
-  wp_gauntlets,
-  wp_beak,
-  NUMWEAPONS,
-  /* No pending weapon change. */
-  wp_nochange
-} weapontype_t;
-
-#define AMMO_GWND_WIMPY 10
-#define AMMO_GWND_HEFTY 50
-#define AMMO_CBOW_WIMPY 5
-#define AMMO_CBOW_HEFTY 20
-#define AMMO_BLSR_WIMPY 10
-#define AMMO_BLSR_HEFTY 25
-#define AMMO_SKRD_WIMPY 20
-#define AMMO_SKRD_HEFTY 100
-#define AMMO_PHRD_WIMPY 1
-#define AMMO_PHRD_HEFTY 10
-#define AMMO_MACE_WIMPY 20
-#define AMMO_MACE_HEFTY 100
-
-/* Ammunition types defined. */
-typedef enum
-{
-  am_goldwand,
-  am_crossbow,
-  am_blaster,
-  am_skullrod,
-  am_phoenixrod,
-  am_mace,
-  NUMAMMO,
-  am_noammo /* staff, gauntlets */
-} ammotype_t;
-
-typedef struct
-{
-  ammotype_t ammo;
-  int upstate __attribute__ ((packed));
-  int downstate __attribute__ ((packed));
-  int readystate __attribute__ ((packed));
-  int atkstate __attribute__ ((packed));
-  int holdatkstate __attribute__ ((packed));
-  int flashstate __attribute__ ((packed));
-} __attribute__ ((packed)) weaponinfo_t;
-
-extern weaponinfo_t wpnlev1info[NUMWEAPONS];
-extern weaponinfo_t wpnlev2info[NUMWEAPONS];
-
-/* Power up artifacts. */
-typedef enum
-{
-  pw_None,
-  pw_invulnerability,
-  pw_invisibility,
-  pw_allmap,
-  pw_infrared,
-  pw_weaponlevel2,
-  pw_flight,
-  pw_shield,
-  pw_health2,
-  NUMPOWERS
-} powertype_t;
-
-typedef enum
-{
-  arti_none,
-  arti_invulnerability,
-  arti_invisibility,
-  arti_health,
-  arti_superhealth,
-  arti_tomeofpower,
-  arti_torch,
-  arti_firebomb,
-  arti_egg,
-  arti_fly,
-  arti_teleport,
-  NUMARTIFACTS
-} artitype_t;
-
-#define	INVULNTICS              (30*35)
-#define	INVISTICS               (60*35)
-#define	INFRATICS               (120*35)
-#define	IRONTICS                (60*35)
-#define WPNLEV2TICS             (40*35)
-#define FLIGHTTICS              (60*35)
-
-#define CHICKENTICS             (40*35)
-
-#define MESSAGETICS             (4*35)
-#define BLINKTHRESHOLD          (4*32)
-
-#define NUMINVENTORYSLOTS	14
-
-typedef struct
-{
-  int type;
-  int count;
-} __attribute__ ((packed)) inventory_t;
-
-
-/*
-  ===============================================================================
-  
-  MAPOBJ DATA
-  
-  ===============================================================================
-*/
-
-/*
- * Experimental stuff.
- * To compile this as "ANSI C with classes"
- *  we will need to handle the various
- *  action functions cleanly.
- */
-typedef  void (*actionf_v) ( void );
-typedef  void (*actionf_p1)( void* );
-typedef  void (*actionf_p2)( void*, void* );
-
-typedef union
-{
-  actionf_p1	acp1;
-  actionf_v	acv;
-  actionf_p2	acp2;
-
-} actionf_t;
-
-
-typedef struct
-{  
-  spritenum_t	        sprite;
-  long			frame __attribute__ ((packed));
-  long			tics __attribute__ ((packed));
-  
-  actionf_t		action __attribute__ ((packed));
-  statenum_t		nextstate __attribute__ ((packed));
-  long			misc1 __attribute__ ((packed)), misc2 __attribute__ ((packed));
-} __attribute__ ((packed)) state_t;
-
-extern state_t	states[NUMSTATES];
-extern char *sprnames[NUMSPRITES];
-
-
-/* think_t is a function pointer to a routine to handle an actor. */
-typedef actionf_t  think_t;
-
-typedef struct thinker_s
-{
-  struct		thinker_s	*prev, *next __attribute__ ((packed));
-  think_t		function __attribute__ ((packed));
-} __attribute__ ((packed)) thinker_t;
-
-struct player_s;
-
-typedef struct mobj_s
-{
-  thinker_t		thinker;       /* thinker links */
-  
-  /* info for drawing */
-  fixed_t		x __attribute__ ((packed)),y __attribute__ ((packed)),z __attribute__ ((packed));
-  struct mobj_s	*snext __attribute__ ((packed)), *sprev __attribute__ ((packed));	       /* links in sector (if needed) */
-  angle_t		angle __attribute__ ((packed));
-  spritenum_t		sprite __attribute__ ((packed));	       /* used to find patch_t and flip value */
-  int			frame __attribute__ ((packed));	       /*  might be ord with FF_FULLBRIGHT */
-
-  /* interaction info */
-  struct mobj_s	*bnext __attribute__ ((packed)), *bprev __attribute__ ((packed));		/* links in blocks (if needed) */
-  struct subsector_s	*subsector __attribute__ ((packed));
-  fixed_t		floorz __attribute__ ((packed)), ceilingz __attribute__ ((packed)); /* closest together of contacted secs */
-  fixed_t		radius __attribute__ ((packed)), height __attribute__ ((packed));	  /* for movement checking */
-  fixed_t		momx __attribute__ ((packed)), momy __attribute__ ((packed)), momz __attribute__ ((packed)); /* momentums */
-  
-  int		        validcount __attribute__ ((packed));	  /* if == validcount, already checked */
-  
-  mobjtype_t		type __attribute__ ((packed));
-  mobjinfo_t		*info __attribute__ ((packed));		  /* &mobjinfo[mobj->type] */
-  int			tics __attribute__ ((packed));		  /* state tic counter */
-  state_t		*state __attribute__ ((packed));
-  int			damage __attribute__ ((packed));		  /* For missiles */
-  int			flags __attribute__ ((packed));
-  int			flags2 __attribute__ ((packed));		  /* Heretic flags */
-  int			special1 __attribute__ ((packed));	  /* Special info */
-  int			special2 __attribute__ ((packed));	  /* Special info */
-  int		        health __attribute__ ((packed));
-  int			movedir __attribute__ ((packed));	  /* 0-7 */
-  int		        movecount __attribute__ ((packed));	  /* when 0, select a new dir */
-  struct mobj_s *target __attribute__ ((packed));		  /* thing being chased/attacked (or NULL) */
-  /* also the originator for missiles */
-  int			reactiontime __attribute__ ((packed));	  /* if non 0, don't attack yet */
-  /* used by player to freeze a bit after */
-  /* teleporting */
-  int			threshold __attribute__ ((packed));	  /* if >0, the target will be chased */
-  /* no matter what (even if shot) */
-  struct player_s	*player __attribute__ ((packed));	  /* only valid if type == MT_PLAYER */
-  int			lastlook __attribute__ ((packed));	  /* player number last looked for */
-  
-  mapthing_t		spawnpoint __attribute__ ((packed));	  /* for nightmare respawn */
-} __attribute__ ((packed)) mobj_t;
-
-/* each sector has a degenmobj_t in it's center for sound origin purposes */
-typedef struct
-{
-  thinker_t		thinker;	  /* not used for anything */
-  fixed_t		x __attribute__ ((packed)) ,y __attribute__ ((packed)),z __attribute__ ((packed));
-} __attribute__ ((packed)) degenmobj_t;
-
-/* Most damage defined using HITDICE */
-#define HITDICE(a) ((1+(P_Random()&7))*a)
-
-/*
- * frame flags
- */
-#define	FF_FULLBRIGHT	0x8000		  /* flag in thing->frame */
-#define FF_FRAMEMASK	0x7fff
-
-/* --- mobj.flags --- */
-
-#define	MF_SPECIAL		1	  /* call P_SpecialThing when touched */
-#define	MF_SOLID		2
-#define	MF_SHOOTABLE	        4
-#define	MF_NOSECTOR		8	  /* don't use the sector links */
-/* (invisible but touchable) */
-#define	MF_NOBLOCKMAP	        16	  /* don't use the blocklinks */
-/* (inert but displayable) */
-#define	MF_AMBUSH		32
-#define	MF_JUSTHIT		64	  /* try to attack right back */
-#define	MF_JUSTATTACKED	        128	  /* take at least one step before attacking */
-#define	MF_SPAWNCEILING	        256	  /* hang from ceiling instead of floor */
-#define	MF_NOGRAVITY	        512	  /* don't apply gravity every tic */
-
-/* movement flags */
-#define	MF_DROPOFF		0x400	  /* allow jumps from high places */
-#define	MF_PICKUP		0x800	  /* for players to pick up items */
-#define	MF_NOCLIP		0x1000	  /* player cheat */
-#define	MF_SLIDE		0x2000	  /* keep info about sliding along walls */
-#define	MF_FLOAT		0x4000	  /* allow moves to any height, no gravity */
-#define	MF_TELEPORT		0x8000	  /* don't cross lines or look at heights */
-#define MF_MISSILE		0x10000	  /* don't hit same species, explode on block */
-
-#define	MF_DROPPED		0x20000	  /* dropped by a demon, not level spawned */
-#define	MF_SHADOW		0x40000	  /* use fuzzy draw (shadow demons / invis) */
-#define	MF_NOBLOOD		0x80000	  /* don't bleed when shot (use puff) */
-#define	MF_CORPSE		0x100000  /* don't stop moving halfway off a step */
-#define	MF_INFLOAT		0x200000  /* floating to a height for a move, don't */
-/* auto float to target's height */
-
-#define	MF_COUNTKILL	        0x400000  /* count towards intermission kill total */
-#define	MF_COUNTITEM	        0x800000  /* count towards intermission item total */
-
-#define	MF_SKULLFLY		0x1000000 /* skull in flight */
-#define	MF_NOTDMATCH	        0x2000000 /* don't spawn in death match (key cards) */
-
-#define	MF_TRANSLATION	        0xc000000 /* if 0x4 0x8 or 0xc, use a translation */
-#define	MF_TRANSSHIFT	        26	  /* table for player colormaps */
-
-/* --- mobj.flags2 --- */
-
-#define MF2_LOGRAV		0x00000001 /* alternate gravity setting */
-#define MF2_WINDTHRUST		0x00000002 /* gets pushed around by the wind */
-/* specials */
-#define MF2_FLOORBOUNCE		0x00000004 /* bounces off the floor */
-#define MF2_THRUGHOST		0x00000008 /* missile will pass through ghosts */
-#define MF2_FLY			0x00000010 /* fly mode is active */
-#define MF2_FOOTCLIP		0x00000020 /* if feet are allowed to be clipped */
-#define MF2_SPAWNFLOAT		0x00000040 /* spawn random float z */
-#define MF2_NOTELEPORT		0x00000080 /* does not teleport */
-#define MF2_RIP			0x00000100 /* missile rips through solid */
-/* targets */
-#define MF2_PUSHABLE		0x00000200 /* can be pushed by other moving */
-/* mobjs */
-#define MF2_SLIDE	        0x00000400 /* slides against walls */
-#define MF2_ONMOBJ		0x00000800 /* mobj is resting on top of another */
-/* mobj */
-#define MF2_PASSMOBJ		0x00001000 /* Enable z block checking.  If on, */
-/* this flag will allow the mobj to */
-/* pass over/under other mobjs. */
-#define MF2_CANNOTPUSH		0x00002000 /* cannot push other pushable mobjs */
-#define MF2_FEETARECLIPPED	0x00004000 /* a mobj's feet are now being cut */
-#define MF2_BOSS		0x00008000 /* mobj is a major boss */
-#define MF2_FIREDAMAGE		0x00010000 /* does fire damage */
-#define MF2_NODMGTHRUST		0x00020000 /* does not thrust target when */
-/* damaging */
-#define MF2_TELESTOMP		0x00040000 /* mobj can stomp another */
-#define MF2_FLOATBOB		0x00080000 /* use float bobbing z movement */
-#define MF2_DONTDRAW		0X00100000 /* don't generate a vissprite */
-
-//=============================================================================
-
-typedef enum
-{
-  PST_LIVE,			/* playing */
-  PST_DEAD,			/* dead on the ground */
-  PST_REBORN			/* ready to restart */
-} playerstate_t;
-
-/*
- * psprites are scaled shapes directly on the view screen
- * coordinates are given for a 320*200 view screen
- */
-typedef enum
-{
-  ps_weapon,
-  ps_flash,
-  NUMPSPRITES
-} psprnum_t;
-
-typedef struct
-{
-  state_t	*state;		/* a NULL state means not active */
-  int		tics __attribute__ ((packed));
-  fixed_t	sx __attribute__ ((packed)), sy __attribute__ ((packed));
-} __attribute__ ((packed)) pspdef_t;
-
-
-/*
-  ================
-  =
-  = player_t
-  =
-  ================
-*/
-
-typedef struct player_s
-{
-  mobj_t *mo;
-  playerstate_t playerstate __attribute__ ((packed));
-  ticcmd_t cmd __attribute__ ((packed));
-  
-  fixed_t		viewz __attribute__ ((packed));		   /* focal origin above r.z */
-  fixed_t		viewheight __attribute__ ((packed));	   /* base height above floor for viewz */
-  fixed_t		deltaviewheight __attribute__ ((packed));   /* squat speed */
-  fixed_t		bob __attribute__ ((packed));		   /* bounded/scaled total momentum */
-
-  int			flyheight __attribute__ ((packed));
-  int			lookdir __attribute__ ((packed));
-  boolean		centering __attribute__ ((packed));
-  int			health __attribute__ ((packed));		   /* only used between levels, mo->health */
-  /* is used during levels */
-  int			armorpoints __attribute__ ((packed)), armortype __attribute__ ((packed));	/* armor type is 0-2 */
-  
-  inventory_t	        inventory[NUMINVENTORYSLOTS] __attribute__ ((packed));
-  artitype_t	        readyArtifact __attribute__ ((packed));
-  int			artifactCount __attribute__ ((packed));
-  int 		        inventorySlotNum __attribute__ ((packed));
-  int			powers[NUMPOWERS] __attribute__ ((packed));
-  boolean		keys[NUMKEYS] __attribute__ ((packed));
-  boolean		backpack __attribute__ ((packed));
-  signed int		frags[MAXPLAYERS] __attribute__ ((packed));	  /* kills of other players */
-  weapontype_t	        readyweapon __attribute__ ((packed));
-  weapontype_t	        pendingweapon __attribute__ ((packed));		  /* wp_nochange if not changing */
-  boolean		weaponowned[NUMWEAPONS] __attribute__ ((packed));
-  int			ammo[NUMAMMO] __attribute__ ((packed));
-  int			maxammo[NUMAMMO] __attribute__ ((packed));
-  int			attackdown __attribute__ ((packed)), usedown __attribute__ ((packed));	  /* true if button down last tic */
-  int			cheats __attribute__ ((packed));			  /* bit flags */
-  
-  int			refire __attribute__ ((packed));			  /* refired shots are less accurate */
-  
-  int			killcount __attribute__ ((packed)), 
-                        itemcount __attribute__ ((packed)), 
-                        secretcount __attribute__ ((packed));              /* for intermission */
-  char		        *message __attribute__ ((packed));		  /* hint messages */
-  int			messageTics __attribute__ ((packed));		  /* counter for showing messages */
-  int			damagecount __attribute__ ((packed)), bonuscount __attribute__ ((packed));  /* for screen flashing */
-  int			flamecount __attribute__ ((packed));		  /* for flame thrower duration */
-  mobj_t		*attacker __attribute__ ((packed));		  /* who did damage (NULL for floors) */
-  int			extralight __attribute__ ((packed));		  /* so gun flashes light up areas */
-  int			fixedcolormap __attribute__ ((packed));		  /* can be set to REDCOLORMAP, etc */
-  int			colormap __attribute__ ((packed));		  /* 0-3 for which color to draw player */
-  pspdef_t	        psprites[NUMPSPRITES] __attribute__ ((packed));	  /* view sprites (gun, etc) */
-  boolean		didsecret __attribute__ ((packed));		  /* true if secret level has been done */
-  int			chickenTics __attribute__ ((packed));		  /* player is a chicken if > 0 */
-  int			chickenPeck __attribute__ ((packed));		  /* chicken peck countdown */
-  mobj_t		*rain1 __attribute__ ((packed));			  /* active rain maker 1 */
-  mobj_t		*rain2 __attribute__ ((packed));			  /* active rain maker 2 */
-} __attribute__ ((packed)) player_t;
-
-#define CF_NOCLIP		1
-#define	CF_GODMODE		2
-#define	CF_NOMOMENTUM	        4    /* not really a cheat, just a debug aid */
-
-#define	BACKUPTICS		12   /* CHANGED FROM 12 !?!? */
-
-typedef struct
-{
-  unsigned	checksum;	     /* high bit is retransmit request */
-  byte		retransmitfrom __attribute__ ((packed));	     /* only valid if NCMD_RETRANSMIT */
-  byte		starttic __attribute__ ((packed));
-  byte		player __attribute__ ((packed)), numtics __attribute__ ((packed));
-  ticcmd_t	cmds[BACKUPTICS] __attribute__ ((packed));
-} __attribute__ ((packed)) doomdata_t;
-
-typedef struct
-{
-  long	id;
-  short	intnum __attribute__ ((packed));			     /* DOOM executes an int to execute commands */
-  
-  /* communication between DOOM and the driver */
-  short	command __attribute__ ((packed));		     /* CMD_SEND or CMD_GET */
-  short	remotenode __attribute__ ((packed));		     /* dest for send, set by get (-1 = no packet) */
-  short	datalength __attribute__ ((packed));		     /* bytes in doomdata to be sent */
-
-  /* info common to all nodes */
-  short	numnodes __attribute__ ((packed));		     /* console is allways node 0 */
-  short	ticdup __attribute__ ((packed));			     /* 1 = no duplication, 2-5 = dup for slow nets */
-  short	extratics __attribute__ ((packed));		     /* 1 = send a backup tic in every packet */
-  short	deathmatch __attribute__ ((packed));		     /* 1 = deathmatch */
-  short	savegame __attribute__ ((packed));		     /* -1 = new game, 0-5 = load savegame */
-  short	episode __attribute__ ((packed));		     /* 1-3 */
-  short	map __attribute__ ((packed));			     /* 1-9 */
-  short	skill __attribute__ ((packed));			     /* 1-5 */
-  
-  /* info specific to this node */
-  short	consoleplayer __attribute__ ((packed));
-  short	numplayers __attribute__ ((packed));
-  short	angleoffset __attribute__ ((packed));	             /* 1 = left, 0 = center, -1 = right */
-  short	drone __attribute__ ((packed));			     /* 1 = drone */
-  
-  /* packet data to be sent */
-  doomdata_t	data __attribute__ ((packed));
-} __attribute__ ((packed)) doomcom_t;
-
-#define	DOOMCOM_ID	0x12345678l
-
-extern	doomcom_t	*doomcom;
-extern	doomdata_t	*netbuffer;  /* points inside doomcom */
-
-#define	MAXNETNODES	8	     /* max computers in a game */
-
-#define	CMD_SEND	1
-#define	CMD_GET		2
-
-#define	SBARHEIGHT	42	     /* status bar height at bottom of screen */
-
-
-
-
-
-/*
-  ===============================================================================
-  
-  GLOBAL VARIABLES
-  
-  ===============================================================================
-*/
-
-#define TELEFOGHEIGHT (32*FRACUNIT)
-
-#define MAXEVENTS 64
-
-extern event_t events[MAXEVENTS];
-extern int eventhead;
-extern int eventtail;
-
-extern fixed_t finesine[5*FINEANGLES/4];
-extern fixed_t *finecosine;
-
-extern gameaction_t gameaction;
-
-extern boolean paused;
-
-extern boolean shareware;   /* true if main WAD is the shareware version */
-extern boolean ExtendedWAD; /* true if main WAD is the extended version */
-
-extern boolean nomonsters;  /* checkparm of -nomonsters */
-
-extern boolean respawnparm; /* checkparm of -respawn */
-
-extern boolean debugmode;   /* checkparm of -debug */
-
-extern boolean usergame;    /* ok to save / end game */
-
-extern boolean ravpic;      /* checkparm of -ravpic */
-
-extern boolean altpal;      /* checkparm to use an alternate palette routine */
-
-extern boolean cdrom;       /* true if cd-rom mode active ("-cdrom") */
-
-extern boolean deathmatch;  /* only if started as net death */
-
-extern boolean netgame;     /* only true if >1 player */
-
-extern boolean playeringame[MAXPLAYERS];
-
-extern int consoleplayer;   /* player taking events and displaying */
-
-extern int displayplayer;
-
-extern int viewangleoffset; /* ANG90 = left side, ANG270 = right */
-
-extern player_t players[MAXPLAYERS];
-
-extern	boolean		singletics;   /* debug flag to cancel adaptiveness */
-
-extern boolean DebugSound;  /* debug flag for displaying sound info */
-
-extern	int		maxammo[NUMAMMO];
-
-extern	boolean		demoplayback;
-extern	int		skytexture;
-
-extern	gamestate_t	gamestate;
-extern	skill_t		gameskill;
-extern	boolean		respawnmonsters;
-extern	int		gameepisode;
-extern	int		gamemap;
-extern 	int 	        prevmap;
-extern	int		totalkills, totalitems, totalsecret;   /* for intermission */
-extern	int		levelstarttic;	  /* gametic at level start */
-extern	int		leveltime;	  /* tics in game play for par */
-
-extern	ticcmd_t	netcmds[MAXPLAYERS][BACKUPTICS];
-extern int ticdup;
-
-#define	MAXNETNODES		8
-extern	ticcmd_t		localcmds[BACKUPTICS];
-extern int rndindex;
-extern int gametic, maketic;
-extern	int        	        nettics[MAXNETNODES];
-
-#define SAVEGAMESIZE 0x30000
-#define SAVESTRINGSIZE 24
-extern byte *savebuffer;
-extern byte *save_p;
-
-extern mapthing_t *deathmatch_p;
-extern mapthing_t deathmatchstarts[10];
-extern mapthing_t playerstarts[MAXPLAYERS];
-
-extern int viewwindowx;
-extern int viewwindowy;
-extern int viewwidth;
-extern int scaledviewwidth;
-extern int viewheight;
-
-/* rhandeev: differentiated mouse X and Y sensitivity */
-extern int mouseXSensitivity;
-extern int mouseYSensitivity;
-
-/* rhandeev: added mouse invert and mouse look features */
-extern boolean mouseInvert;
-extern boolean mouseLook;
-
-extern boolean precache;   /* if true, load all graphics at level load */
-
-extern byte *screen;       /* off screen work buffer, from V_video.c */
-
-extern boolean singledemo; /* quit after playing a demo from cmdline */
-
-extern FILE *debugfile;
-extern int bodyqueslot;
-extern skill_t startskill;
-extern int startepisode;
-extern int startmap;
-extern boolean autostart;
-
-
-/*
-  ===============================================================================
-  
-  GLOBAL FUNCTIONS
-  
-  ===============================================================================
-*/
-
-fixed_t	FixedMul (fixed_t a, fixed_t b);
-fixed_t	FixedDiv (fixed_t a, fixed_t b);
-fixed_t	FixedDiv2 (fixed_t a, fixed_t b);
-
-#ifdef __BIG_ENDIAN__
-
-#define SHORT(x) ((short)(
-(((unsigned short)(x) & (unsigned short)0x00ffU) << 8) 
-|
-(((unsigned short)(x) & (unsigned short)0xff00U) >> 8) ))
-
-#define LONG(x) ((int)(
-(((unsigned int)(x) & (unsigned int)0x000000ffUL) << 24) 
-|
-(((unsigned int)(x) & (unsigned int)0x0000ff00UL) <<  8)
-|
-(((unsigned int)(x) & (unsigned int)0x00ff0000UL) >>  8)
-|
-(((unsigned int)(x) & (unsigned int)0xff000000UL) >> 24) ))
-
-#else
-#define SHORT(x)	(x)
-#define LONG(x)		(x)
-#endif
-
-/*
- * -----------
- * MEMORY ZONE
- * -----------
- * tags < 100 are not overwritten until freed
- */
-#define	PU_STATIC		1		  /* static entire execution time */
-#define	PU_SOUND		2		  /* static while playing */
-#define	PU_MUSIC		3		  /* static while playing */
-#define	PU_DAVE			4		  /* anything else Dave wants static */
-#define	PU_LEVEL		50		  /* static until level exited */
-#define	PU_LEVSPEC		51	          /* a special thinker in a level */
-/* tags >= 100 are purgable whenever needed. */
-#define	PU_PURGELEVEL	        100
-#define	PU_CACHE		101
-
-void	Z_Init (void);
-void 	*Z_Malloc (int size, int tag, void *ptr);
-void 	Z_Free (void *ptr);
-void 	Z_FreeTags (int lowtag, int hightag);
-void 	Z_DumpHeap (int lowtag, int hightag);
-void	Z_FileDumpHeap (FILE *f);
-void	Z_CheckHeap (void);
-void	Z_ChangeTag2 (void *ptr, int tag);
-int 	Z_FreeMemory (void);
-
-extern boolean MallocFailureOk;
-
-typedef struct memblock_s
-{
-  int                     size;         /* including the header and possibly tiny fragments */
-  void                    **user __attribute__ ((packed));       /* NULL if a free block */
-  int                     tag __attribute__ ((packed));          /* purgelevel */
-  int                     id __attribute__ ((packed));           /* should be ZONEID */
-  struct memblock_s       *next __attribute__ ((packed)), *prev __attribute__ ((packed));
-} __attribute__ ((packed)) memblock_t;
-
-#define Z_ChangeTag(p,t) \
-{ \
-if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
-	I_Error("Z_CT at "__FILE__":%i",__LINE__); \
-Z_ChangeTag2(p,t); \
-};
-
-
-
-//-------
-//WADFILE
-//-------
-typedef struct
-{
-  char		name[8];
-  int		handle __attribute__ ((packed)),position __attribute__ ((packed)),size __attribute__ ((packed));
-} __attribute__ ((packed)) lumpinfo_t;
-
-extern lumpinfo_t *lumpinfo;
-extern	int	numlumps;
-
-void	W_InitMultipleFiles (char **filenames);
-
-int	W_CheckNumForName (char *name);
-int	W_GetNumForName (char *name);
-
-int	W_LumpLength (int lump);
-void	W_ReadLump (int lump, void *dest);
-
-void	*W_CacheLumpNum (int lump, int tag);
-void	*W_CacheLumpName (char *name, int tag);
-
-int     wadopen( const char *fileName );
-
-
-/*
- * ----------
- * BASE LEVEL
- * ----------
- */
-void D_DoomMain (void);
-
-/*
-void IncThermo(void);
-void InitThermo(int max);
-void tprintf(char *string, int initflag);
-*/
-
-/*
- * not a globally visible function, just included for source reference
- * calls all startup code
- * parses command line options
- * if not overrided, calls N_AdvanceDemo
- */
-
-void D_DoomLoop (void);
-/*
- * not a globally visible function, just included for source reference
- * called by D_DoomMain, never exits
- * manages timing and IO
- * calls all ?_Responder, ?_Ticker, and ?_Drawer functions
- * calls I_GetTime, I_StartFrame, and I_StartTic
- */
-
-void D_PostEvent (event_t *ev);
-/* called by IO functions when input is detected */
-
-void NetUpdate (void);
-/* create any new ticcmds and broadcast to other players */
-
-void D_QuitNetGame (void);
-/* broadcasts special packets to other players to notify of game exit */
-
-void TryRunTics (void);
-
-
-/*
- * ---------
- * SYSTEM IO
- * ---------
- */
-
-/*
- * Do or do not use external soundserver.
- * The sndserver binary to be run separately
- *  has been introduced by Dave Taylor.
- * The integrated sound support is experimental,
- *  and unfinished. Default is synchronous.
- * Experimental asynchronous timer based is
- *  handled by SNDINTR.
- *#define SNDSERV  1
- *#define SNDINTR  1
- */
-
-/*
- * This one switches between MIT SHM (no proper mouse)
- * and XFree86 DGA (mickey sampling). The original
- * linuxdoom used SHM, which is default.
- *#define X11_DGA		1
- */
-
-/*
- * For resize of screen, at start of game.
- * It will not work dynamically, see visplanes.
- */
-#define	BASE_WIDTH		320
-
-/*
- * It is educational but futile to change this
- *  scaling e.g. to 2. Drawing of status bar,
- *  menues etc. is tied to the scale implied
- *  by the graphics.
- */
-#define	SCREEN_MUL		1
-#define	INV_ASPECT_RATIO	0.625   /* 0.75, ideally */
-
-/*
- * So there.
- */
-#define SCREENWIDTH  320
-/* SCREEN_MUL*BASE_WIDTH */
-#define SCREENHEIGHT 200
-/* (int)(SCREEN_MUL*BASE_WIDTH*INV_ASPECT_RATIO) */
-
-extern int screenwidth;
-extern int screenheight;
-#define MAXSCREENWIDTH 1024
-#define MAXSCREENHEIGHT 768
-
-/*
- * Added for use with SVGALIB(inits some things); dummy for X11 and GGI Targets */
-void InitGraphLib(void);
-
-/* Added for a clean exit... */
-void I_ShutdownGraphics(void);
-
-/* Checks the resolution via the modules rend_svga, rend_x11 or rend_ggi */
-void I_CheckRes( void );
-
-byte *I_ZoneBase (int *size);
-/*
- * called by startup code to get the ammount of memory to malloc
- * for the zone management
- */
-
-int I_GetTime (void);
-/*
- * called by D_DoomLoop
- * returns current time in tics
- */
-
-void I_StartFrame (void);
-/*
- * called by D_DoomLoop
- * called before processing any tics in a frame (just after displaying a frame)
- * time consuming syncronous operations are performed here (joystick reading)
- * can call D_PostEvent
- */
-
-void I_StartTic (void);
-/*
- * called by D_DoomLoop
- * called before processing each tic in a frame
- * quick syncronous operations are performed here
- * can call D_PostEvent
- *
- * asyncronous interrupt functions should maintain private ques that are
- * read by the syncronous functions to be converted into events
- */
-
-void I_Init (void);
-/*
- * called by D_DoomMain
- * determines the hardware configuration and sets up the video mode
- */
-
-void I_InitGraphics (void);
-
-void I_InitNetwork (void);
-void I_NetCmd (void);
-
-void I_Error (char *error, ...);
-/*
- * called by anything that can generate a terminal error
- * bad exit with diagnostic message
- */
-
-void I_Quit (void);
-/*
- * called by M_Responder when quit is selected
- * clean exit, displays sell blurb
- */
-
-void I_SetPalette (byte *palette);
-/* takes full 8 bit values */
-
-void I_FinishUpdate(void);
-/* Copy buffer to video */
-
-void I_WipeUpdate(wipe_t wipe);
-/* Copy buffer to video with wipe effect */
-
-void I_WaitVBL(int count);
-/* wait for vertical retrace or pause a bit */
-
-void I_BeginRead (void);
-void I_EndRead (void);
-
-byte	*I_AllocLow (int length);
-/* allocates from low memory under dos, just mallocs under unix */
-
-void I_Tactile (int on, int off, int total);
-
-
-/*
- * ----
- * GAME
- * ----
- */
-
-void G_DeathMatchSpawnPlayer (int playernum);
-
-void G_InitNew (skill_t skill, int episode, int map);
-
-void G_DeferedInitNew (skill_t skill, int episode, int map);
-/*
- * can be called by the startup code or M_Responder
- * a normal game starts at map 1, but a warp test can start elsewhere
- */
-
-void G_DeferedPlayDemo (char *demo);
-
-void G_LoadGame (char *name);
-/*
- * can be called by the startup code or M_Responder
- * calls P_SetupLevel or W_EnterWorld
- */
-void G_DoLoadGame (void);
-
-void G_SaveGame (int slot, char *description);
-/*
- * called by M_Responder
- *
- * Support routines for saving games
- */
-void SV_Open(char *fileName);
-void SV_Close(char *fileName);
-void SV_Write(void *buffer, int size);
-void SV_WriteByte(byte val);
-void SV_WriteWord(unsigned short val);
-void SV_WriteLong(unsigned int val);
-
-void G_RecordDemo (skill_t skill, int numplayers, int episode
-		   ,int map, char *name);
-/* only called by startup code */
-
-void G_PlayDemo (char *name);
-void G_TimeDemo (char *name);
-
-boolean G_CheckDemoStatus (void);
-
-void G_ExitLevel (void);
-void G_SecretExitLevel (void);
-
-void G_WorldDone (void);
-
-void G_Ticker (void);
-boolean G_Responder (event_t *ev);
-
-void G_ScreenShot (void);
-
-
-/*
- * -----
- * PLAY
- * -----
- */
-
-void P_Ticker (void);
-/*
- * called by C_Ticker
- * can call G_PlayerExited
- * carries out all thinking of monsters and players
- */
-
-void P_SetupLevel (int episode, int map, int playermask, skill_t skill);
-/* called by W_Ticker */
-
-void P_Init (void);
-/* called by startup code */
-
-void P_ArchivePlayers (void);
-void P_UnArchivePlayers (void);
-void P_ArchiveWorld (void);
-void P_UnArchiveWorld (void);
-void P_ArchiveThinkers (void);
-void P_UnArchiveThinkers (void);
-void P_ArchiveSpecials (void);
-void P_UnArchiveSpecials (void);
-/* load / save game routines */
-
-
-/*
- * -------
- * REFRESH
- * -------
- */
-
-extern boolean setsizeneeded;
-
-extern boolean BorderNeedRefresh;
-extern boolean BorderTopRefresh;
-
-extern int UpdateState;
-/* define the different areas for the dirty map */
-#define I_NOUPDATE	0
-#define I_FULLVIEW	1
-#define I_STATBAR	2
-#define I_MESSAGES	4
-#define I_FULLSCRN	8
-
-void R_RenderPlayerView (player_t *player);
-/* called by G_Drawer */
-
-void R_Init (void);
-/* called by startup code */
-
-void R_DrawViewBorder (void);
-void R_DrawTopBorder (void);
-/* if the view size is not full screen, draws a border around it */
-
-void R_SetViewSize (int blocks, int detail);
-/* called by M_Responder */
-
-int	R_FlatNumForName (char *name);
-
-int	R_TextureNumForName (char *name);
-int	R_CheckTextureNumForName (char *name);
-/*
- * called by P_Ticker for switches and animations
- * returns the texture number for the texture name
- */
-
-
-/*
- * ----
- * MISC
- * ----
- */
-
-extern	int	myargc;
-extern	char	**myargv;
-
-int	M_CheckParm (char *check);
-/* returns the position of the given parameter in the arg list (0 if not found) */
-
-boolean M_ValidEpisodeMap(int episode, int map);
-/*
- * returns true if the episode/map combo is valid for the current
- * game configuration
- */
-
-void M_ForceUppercase(char *text);
-/* Changes a string to uppercase */
-
-int M_Random (void);
-/* returns a number from 0 to 255 */
-
-int P_Random (void);
-/* as M_Random, but used only by the play simulation */
-
-void M_ClearRandom (void);
-/* fix randoms for demos */
-
-void M_FindResponseFile(void);
-
-void M_ClearBox (fixed_t *box);
-void M_AddToBox (fixed_t *box, fixed_t x, fixed_t y);
-/* bounding box functions */
-
-boolean M_WriteFile (char const *name, void *source, int length);
-int M_ReadFile (char const *name, byte **buffer);
-
-void M_ScreenShot (void);
-
-void M_LoadDefaults (void);
-
-void M_SaveDefaults (void);
-
-int M_DrawText (int x, int y, boolean direct, char *string);
-
-
-/*
- * ----------------------
- *  Interlude (IN_lude.c)
- * ----------------------
- */
-
-extern boolean intermission;
-
-void IN_Start(void);
-void IN_Ticker(void);
-void IN_Drawer(void);
-
-
-/*
- * ----------------------
- *  Chat mode (CT_chat.c)
- * ----------------------
- */
-
-void CT_Init(void);
-void CT_Drawer(void);
-boolean CT_Responder(event_t *ev);
-void CT_Ticker(void);
-char CT_dequeueChatChar(void);
-
-extern boolean chatmodeon;
-extern boolean ultimatemsg;
-
-
-/*
- * --------------------
- *  Finale (F_finale.c)
- * --------------------
- */
-
-void F_Drawer(void);
-void F_Ticker(void);
-void F_StartFinale(void);
-
-
-/*
- * ----------------------
- *  STATUS BAR (SB_bar.c)
- * ----------------------
- */
-
-extern int SB_state;
-void SB_Init(void);
-boolean SB_Responder(event_t *event);
-void SB_Ticker(void);
-void SB_Drawer(void);
-
-
-
-/*
- * -----------------
- *  MENU (MN_menu.c)
- * -----------------
- */
-
-void MN_Init(void);
-void MN_ActivateMenu(void);
-void MN_DeactivateMenu(void);
-boolean MN_Responder(event_t *event);
-void MN_Ticker(void);
-void MN_Drawer(void);
-void MN_DrTextA(char *text, int x, int y);
-int MN_TextAWidth(char *text);
-void MN_DrTextB(char *text, int x, int y);
-int MN_TextBWidth(char *text);
-
-
-/*
- * ------
- *  VIDEO
- * ------
- */
-extern byte* screens[5];
-extern int dirtybox[4];
-extern byte gammatable[5][256];
-extern int usegamma;
-extern int bilifilter;
-extern int lifilter;
-
-void V_Init(void); /* Allocates buffer screens, call before R_Init */
-void V_DrawPatch(int x, int y, patch_t *patch);
-void V_DrawFuzzPatch(int x, int y, patch_t *patch);
-void V_DrawShadowedPatch(int x, int y, patch_t *patch);
-void V_DrawRawScreen(byte *raw);
-void V_Filter_Screen_linear(byte* screenp);
-void V_Filter_Screen_bilinear(byte* screenp);
-
-#include "sounds.h"
-
-
-#endif   /* __DOOMDEF__ */
diff -uNr linux-heretic-1.0/doomdef_std.h linux-heretic-1.0.new/doomdef_std.h
--- linux-heretic-1.0/doomdef_std.h	Wed Apr 21 10:55:53 1999
+++ linux-heretic-1.0.new/doomdef_std.h	Wed Dec 31 19:00:00 1969
@@ -1,1383 +0,0 @@
-
-#ifndef __DOOMDEF__
-#define __DOOMDEF__
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include "doomtype.h"
-
-/* all external data is defined here */
-#include "doomdata.h"
-
-/* all important printed strings */
-#include "dstrings.h"
-
-/* header generated by multigen utility */
-#include "info.h"
-
-/* PC direct to screen pointers (should be unused!) */
-extern byte *destview, *destscreen;	
-
-/*
- * Global parameters/defines.
- *
- * Heretiv version
- */
-#define VERSION 130
-#define VERSION_TEXT "v1.3"
-
-/*
- * most key data are simple ascii (lowercased)
- */
-#define	KEY_RIGHTARROW		        0xae
-#define	KEY_LEFTARROW		        0xac
-#define	KEY_UPARROW			0xad
-#define	KEY_DOWNARROW		        0xaf
-#define	KEY_ESCAPE			27
-#define	KEY_ENTER			13
-#define KEY_TAB		                9
-#define	KEY_F1				(0x80+0x3b)
-#define	KEY_F2				(0x80+0x3c)
-#define	KEY_F3				(0x80+0x3d)
-#define	KEY_F4				(0x80+0x3e)
-#define	KEY_F5				(0x80+0x3f)
-#define	KEY_F6				(0x80+0x40)
-#define	KEY_F7				(0x80+0x41)
-#define	KEY_F8				(0x80+0x42)
-#define	KEY_F9				(0x80+0x43)
-#define	KEY_F10				(0x80+0x44)
-#define	KEY_F11				(0x80+0x57)
-#define	KEY_F12				(0x80+0x58)
-
-#define KEY_INSERT                      (0x80+0x59) 
-#define KEY_DELETE                      (0x80+0x5a) 
-#define KEY_HOME                        (0x80+0x5b) 
-#define KEY_END                         (0x80+0x5c) 
-#define KEY_PAGEUP                      (0x80+0x5d) 
-#define KEY_PAGEDOWN                    (0x80+0x5f) 
-
-#define	KEY_BACKSPACE		        127
-#define	KEY_PAUSE			0xff
-
-#define KEY_EQUALS			0x3d
-#define KEY_MINUS			0x2d
-
-#define	KEY_RSHIFT			(0x80+0x36)
-#define	KEY_RCTRL			(0x80+0x1d)
-#define	KEY_RALT			(0x80+0x38)
-
-#define	KEY_LALT			KEY_RALT
-
-#define	FINEANGLES			8192
-#define	FINEMASK			(FINEANGLES-1)
-#define	ANGLETOFINESHIFT	        19	/* 0x100000000 to 0x2000 */
-
-#define	SAVEGAMENAME       "hticsav"
-#define SAVEGAMENAMECD     "hticsav.cd"
-
-/* The home-directory of the user */
-
-void I_GetHomeDirectory( void );
-
-/*
- * Mission packs - might be useful for TC stuff?
- */
-typedef enum
-{
-  heretic,		/* Heretic */
-  none
-} GameMission_t;
-
-/*
- * Identify language to use, software localization.
- */
-typedef enum
-{
-  english,
-  french,
-  german,
-  unknown  
-} Language_t;
-
-/*
- * if rangecheck is undefined, most parameter validation debugging code
- * will not be compiled
- *
- */
-#define RANGECHECK
-
-/* Used for centering */
-#define X_DISP ((screenwidth-320)/2)
-#define Y_DISP ((screenheight-200)/2)
-/* Used for bottom align. */
-#define Y_BOTTOM (screenheight-200)
-
-/* The maximum number of players, multiplayer/networking. */
-#define MAXPLAYERS		4
-
-/* State updates, number of tics / second. */
-#define TICRATE		        35
-#define TICSPERSEC	        35
-#define NUMARTIFCTS	        28
-#define MAXPLAYERS	        4
-
-#define	FRACBITS		16
-#define	FRACUNIT		(1<<FRACBITS)
-typedef int fixed_t;
-
-#define ANGLE_1		0x01000000
-#define ANGLE_45	0x20000000
-#define ANGLE_90	0x40000000
-#define ANGLE_180	0x80000000
-#define ANGLE_MAX	0xffffffff
-
-#define	ANG45	0x20000000
-#define	ANG90	0x40000000
-#define	ANG180	0x80000000
-#define	ANG270	0xc0000000
-
-typedef unsigned angle_t;
-
-
-#define	BT_ATTACK		1
-#define	BT_USE			2
-#define	BT_CHANGE		4     /* if true, the next 3 bits hold weapon num */
-#define	BT_WEAPONMASK	        (8+16+32)
-#define	BT_WEAPONSHIFT	        3
-
-#define BT_SPECIAL		128   /* game events, not really buttons */
-#define	BTS_SAVEMASK	        (4+8+16)
-#define	BTS_SAVESHIFT	        2
-#define	BT_SPECIALMASK	        3
-#define	BTS_PAUSE		1     /* pause the game */
-#define	BTS_SAVEGAME	        2     /* save the game at each console */
-/* savegame slot numbers occupy the second byte of buttons */
-
-typedef enum
-{
-  ev_keydown,
-  ev_keyup,
-  ev_mouse,
-  ev_joystick
-} evtype_t;
-
-typedef struct
-{
-  evtype_t	type;
-  int		data1;		/* keys / mouse/joystick buttons */
-  int		data2;		/* mouse/joystick x move */
-  int		data3;		/* mouse/joystick y move */
-} event_t;
-
-typedef struct
-{
-  char		forwardmove;	/* *2048 for move */
-  char		sidemove;       /* *2048 for move */
-  short		angleturn;      /* <<16 for angle delta */
-  short		consistancy;	/* checks for net game */
-  byte		chatchar;
-  byte		buttons;
-  byte		lookfly;	/* look/fly up/down/centering */
-  byte		arti;		/* artitype_t to use */
-} ticcmd_t;
-
-
-/*
- * The current state of the game: whether we are
- * playing, gazing at the intermission screen,
- * the game final animation, or a demo.
- */
-typedef enum
-{
-  GS_LEVEL,
-  GS_INTERMISSION,
-  GS_FINALE,
-  GS_DEMOSCREEN
-} gamestate_t;
-
-typedef enum
-{
-  ga_nothing,
-  ga_loadlevel,
-  ga_newgame,
-  ga_loadgame,
-  ga_savegame,
-  ga_playdemo,
-  ga_completed,
-  ga_victory,
-  ga_worlddone,
-  ga_screenshot
-} gameaction_t;
-
-typedef enum
-{
-  wipe_0,
-  wipe_1,
-  wipe_2,
-  wipe_3,
-  wipe_4,
-  NUMWIPES,
-  wipe_random
-} wipe_t;
-
-
-/*
- * Difficulty/skill settings/filters.
- */
-
-/* Skill flags. */
-#define	MTF_EASY		1
-#define	MTF_NORMAL		2
-#define	MTF_HARD		4
-
-/* Deaf monsters/do not react to sound. */
-#define	MTF_AMBUSH		8
-
-typedef enum
-{
-  sk_baby,
-  sk_easy,
-  sk_medium,
-  sk_hard,
-  sk_nightmare
-} skill_t;
-
-/*
- * Key cards.
- */
-typedef enum
-{
-  key_yellow,
-  key_green,
-  key_blue,
-  NUMKEYS
-} keytype_t;
-
-/* The defined weapons,
- *  including a marker indicating
- *  user has not changed weapon.
- */
-typedef enum
-{
-  wp_staff,
-  wp_goldwand,
-  wp_crossbow,
-  wp_blaster,
-  wp_skullrod,
-  wp_phoenixrod,
-  wp_mace,
-  wp_gauntlets,
-  wp_beak,
-  NUMWEAPONS,
-  /* No pending weapon change. */
-  wp_nochange
-} weapontype_t;
-
-#define AMMO_GWND_WIMPY 10
-#define AMMO_GWND_HEFTY 50
-#define AMMO_CBOW_WIMPY 5
-#define AMMO_CBOW_HEFTY 20
-#define AMMO_BLSR_WIMPY 10
-#define AMMO_BLSR_HEFTY 25
-#define AMMO_SKRD_WIMPY 20
-#define AMMO_SKRD_HEFTY 100
-#define AMMO_PHRD_WIMPY 1
-#define AMMO_PHRD_HEFTY 10
-#define AMMO_MACE_WIMPY 20
-#define AMMO_MACE_HEFTY 100
-
-/* Ammunition types defined. */
-typedef enum
-{
-  am_goldwand,
-  am_crossbow,
-  am_blaster,
-  am_skullrod,
-  am_phoenixrod,
-  am_mace,
-  NUMAMMO,
-  am_noammo /* staff, gauntlets */
-} ammotype_t;
-
-typedef struct
-{
-  ammotype_t ammo;
-  int upstate;
-  int downstate;
-  int readystate;
-  int atkstate;
-  int holdatkstate;
-  int flashstate;
-} weaponinfo_t;
-
-extern weaponinfo_t wpnlev1info[NUMWEAPONS];
-extern weaponinfo_t wpnlev2info[NUMWEAPONS];
-
-/* Power up artifacts. */
-typedef enum
-{
-  pw_None,
-  pw_invulnerability,
-  pw_invisibility,
-  pw_allmap,
-  pw_infrared,
-  pw_weaponlevel2,
-  pw_flight,
-  pw_shield,
-  pw_health2,
-  NUMPOWERS
-} powertype_t;
-
-typedef enum
-{
-  arti_none,
-  arti_invulnerability,
-  arti_invisibility,
-  arti_health,
-  arti_superhealth,
-  arti_tomeofpower,
-  arti_torch,
-  arti_firebomb,
-  arti_egg,
-  arti_fly,
-  arti_teleport,
-  NUMARTIFACTS
-} artitype_t;
-
-#define	INVULNTICS              (30*35)
-#define	INVISTICS               (60*35)
-#define	INFRATICS               (120*35)
-#define	IRONTICS                (60*35)
-#define WPNLEV2TICS             (40*35)
-#define FLIGHTTICS              (60*35)
-
-#define CHICKENTICS             (40*35)
-
-#define MESSAGETICS             (4*35)
-#define BLINKTHRESHOLD          (4*32)
-
-#define NUMINVENTORYSLOTS	14
-
-typedef struct
-{
-  int type;
-  int count;
-} inventory_t;
-
-
-/*
-  ===============================================================================
-  
-  MAPOBJ DATA
-  
-  ===============================================================================
-*/
-
-/*
- * Experimental stuff.
- * To compile this as "ANSI C with classes"
- *  we will need to handle the various
- *  action functions cleanly.
- */
-typedef  void (*actionf_v) ( void );
-typedef  void (*actionf_p1)( void* );
-typedef  void (*actionf_p2)( void*, void* );
-
-typedef union
-{
-  actionf_p1	acp1;
-  actionf_v	acv;
-  actionf_p2	acp2;
-
-} actionf_t;
-
-
-typedef struct
-{  
-  spritenum_t	        sprite;
-  long			frame;
-  long			tics;
-  
-  actionf_t		action;
-  statenum_t		nextstate;
-  long			misc1, misc2;
-} state_t;
-
-extern state_t	states[NUMSTATES];
-extern char *sprnames[NUMSPRITES];
-
-
-/* think_t is a function pointer to a routine to handle an actor. */
-typedef actionf_t  think_t;
-
-typedef struct thinker_s
-{
-  struct		thinker_s	*prev, *next;
-  think_t		function;
-} thinker_t;
-
-struct player_s;
-
-typedef struct mobj_s
-{
-  thinker_t		thinker;       /* thinker links */
-  
-  /* info for drawing */
-  fixed_t		x,y,z;
-  struct mobj_s	*snext, *sprev;	       /* links in sector (if needed) */
-  angle_t		angle;
-  spritenum_t		sprite;	       /* used to find patch_t and flip value */
-  int			frame;	       /*  might be ord with FF_FULLBRIGHT */
-
-  /* interaction info */
-  struct mobj_s	*bnext, *bprev;		/* links in blocks (if needed) */
-  struct subsector_s	*subsector;
-  fixed_t		floorz, ceilingz; /* closest together of contacted secs */
-  fixed_t		radius, height;	  /* for movement checking */
-  fixed_t		momx, momy, momz; /* momentums */
-  
-  int		        validcount;	  /* if == validcount, already checked */
-  
-  mobjtype_t		type;
-  mobjinfo_t		*info;		  /* &mobjinfo[mobj->type] */
-  int			tics;		  /* state tic counter */
-  state_t		*state;
-  int			damage;		  /* For missiles */
-  int			flags;
-  int			flags2;		  /* Heretic flags */
-  long			special1;	  /* Special info */
-  long			special2;	  /* Special info */
-  int		        health;
-  int			movedir;	  /* 0-7 */
-  int		        movecount;	  /* when 0, select a new dir */
-  struct mobj_s *target;		  /* thing being chased/attacked (or NULL) */
-  /* also the originator for missiles */
-  int			reactiontime;	  /* if non 0, don't attack yet */
-  /* used by player to freeze a bit after */
-  /* teleporting */
-  int			threshold;	  /* if >0, the target will be chased */
-  /* no matter what (even if shot) */
-  struct player_s	*player;	  /* only valid if type == MT_PLAYER */
-  int			lastlook;	  /* player number last looked for */
-  
-  mapthing_t		spawnpoint;	  /* for nightmare respawn */
-} mobj_t;
-
-/* each sector has a degenmobj_t in it's center for sound origin purposes */
-typedef struct
-{
-  thinker_t		thinker;	  /* not used for anything */
-  fixed_t		x,y,z;
-} degenmobj_t;
-
-/* Most damage defined using HITDICE */
-#define HITDICE(a) ((1+(P_Random()&7))*a)
-
-/*
- * frame flags
- */
-#define	FF_FULLBRIGHT	0x8000		  /* flag in thing->frame */
-#define FF_FRAMEMASK	0x7fff
-
-/* --- mobj.flags --- */
-
-#define	MF_SPECIAL		1	  /* call P_SpecialThing when touched */
-#define	MF_SOLID		2
-#define	MF_SHOOTABLE	        4
-#define	MF_NOSECTOR		8	  /* don't use the sector links */
-/* (invisible but touchable) */
-#define	MF_NOBLOCKMAP	        16	  /* don't use the blocklinks */
-/* (inert but displayable) */
-#define	MF_AMBUSH		32
-#define	MF_JUSTHIT		64	  /* try to attack right back */
-#define	MF_JUSTATTACKED	        128	  /* take at least one step before attacking */
-#define	MF_SPAWNCEILING	        256	  /* hang from ceiling instead of floor */
-#define	MF_NOGRAVITY	        512	  /* don't apply gravity every tic */
-
-/* movement flags */
-#define	MF_DROPOFF		0x400	  /* allow jumps from high places */
-#define	MF_PICKUP		0x800	  /* for players to pick up items */
-#define	MF_NOCLIP		0x1000	  /* player cheat */
-#define	MF_SLIDE		0x2000	  /* keep info about sliding along walls */
-#define	MF_FLOAT		0x4000	  /* allow moves to any height, no gravity */
-#define	MF_TELEPORT		0x8000	  /* don't cross lines or look at heights */
-#define MF_MISSILE		0x10000	  /* don't hit same species, explode on block */
-
-#define	MF_DROPPED		0x20000	  /* dropped by a demon, not level spawned */
-#define	MF_SHADOW		0x40000	  /* use fuzzy draw (shadow demons / invis) */
-#define	MF_NOBLOOD		0x80000	  /* don't bleed when shot (use puff) */
-#define	MF_CORPSE		0x100000  /* don't stop moving halfway off a step */
-#define	MF_INFLOAT		0x200000  /* floating to a height for a move, don't */
-/* auto float to target's height */
-
-#define	MF_COUNTKILL	        0x400000  /* count towards intermission kill total */
-#define	MF_COUNTITEM	        0x800000  /* count towards intermission item total */
-
-#define	MF_SKULLFLY		0x1000000 /* skull in flight */
-#define	MF_NOTDMATCH	        0x2000000 /* don't spawn in death match (key cards) */
-
-#define	MF_TRANSLATION	        0xc000000 /* if 0x4 0x8 or 0xc, use a translation */
-#define	MF_TRANSSHIFT	        26	  /* table for player colormaps */
-
-/* --- mobj.flags2 --- */
-
-#define MF2_LOGRAV		0x00000001 /* alternate gravity setting */
-#define MF2_WINDTHRUST		0x00000002 /* gets pushed around by the wind */
-/* specials */
-#define MF2_FLOORBOUNCE		0x00000004 /* bounces off the floor */
-#define MF2_THRUGHOST		0x00000008 /* missile will pass through ghosts */
-#define MF2_FLY			0x00000010 /* fly mode is active */
-#define MF2_FOOTCLIP		0x00000020 /* if feet are allowed to be clipped */
-#define MF2_SPAWNFLOAT		0x00000040 /* spawn random float z */
-#define MF2_NOTELEPORT		0x00000080 /* does not teleport */
-#define MF2_RIP			0x00000100 /* missile rips through solid */
-/* targets */
-#define MF2_PUSHABLE		0x00000200 /* can be pushed by other moving */
-/* mobjs */
-#define MF2_SLIDE	        0x00000400 /* slides against walls */
-#define MF2_ONMOBJ		0x00000800 /* mobj is resting on top of another */
-/* mobj */
-#define MF2_PASSMOBJ		0x00001000 /* Enable z block checking.  If on, */
-/* this flag will allow the mobj to */
-/* pass over/under other mobjs. */
-#define MF2_CANNOTPUSH		0x00002000 /* cannot push other pushable mobjs */
-#define MF2_FEETARECLIPPED	0x00004000 /* a mobj's feet are now being cut */
-#define MF2_BOSS		0x00008000 /* mobj is a major boss */
-#define MF2_FIREDAMAGE		0x00010000 /* does fire damage */
-#define MF2_NODMGTHRUST		0x00020000 /* does not thrust target when */
-/* damaging */
-#define MF2_TELESTOMP		0x00040000 /* mobj can stomp another */
-#define MF2_FLOATBOB		0x00080000 /* use float bobbing z movement */
-#define MF2_DONTDRAW		0X00100000 /* don't generate a vissprite */
-
-//=============================================================================
-
-typedef enum
-{
-  PST_LIVE,			/* playing */
-  PST_DEAD,			/* dead on the ground */
-  PST_REBORN			/* ready to restart */
-} playerstate_t;
-
-/*
- * psprites are scaled shapes directly on the view screen
- * coordinates are given for a 320*200 view screen
- */
-typedef enum
-{
-  ps_weapon,
-  ps_flash,
-  NUMPSPRITES
-} psprnum_t;
-
-typedef struct
-{
-  state_t	*state;		/* a NULL state means not active */
-  int		tics;
-  fixed_t	sx, sy;
-} pspdef_t;
-
-
-
-/*
-  ================
-  =
-  = player_t
-  =
-  ================
-*/
-
-typedef struct player_s
-{
-  mobj_t *mo;
-  playerstate_t playerstate;
-  ticcmd_t cmd;
-  
-  fixed_t		viewz;		   /* focal origin above r.z */
-  fixed_t		viewheight;	   /* base height above floor for viewz */
-  fixed_t		deltaviewheight;   /* squat speed */
-  fixed_t		bob;		   /* bounded/scaled total momentum */
-
-  int			flyheight;
-  int			lookdir;
-  boolean		centering;
-  int			health;		   /* only used between levels, mo->health */
-  /* is used during levels */
-  int			armorpoints, armortype;	/* armor type is 0-2 */
-  
-  inventory_t	        inventory[NUMINVENTORYSLOTS];
-  artitype_t	        readyArtifact;
-  int			artifactCount;
-  int 		        inventorySlotNum;
-  int			powers[NUMPOWERS];
-  boolean		keys[NUMKEYS];
-  boolean		backpack;
-  signed int		frags[MAXPLAYERS];	  /* kills of other players */
-  weapontype_t	        readyweapon;
-  weapontype_t	        pendingweapon;		  /* wp_nochange if not changing */
-  boolean		weaponowned[NUMWEAPONS];
-  int			ammo[NUMAMMO];
-  int			maxammo[NUMAMMO];
-  int			attackdown, usedown;	  /* true if button down last tic */
-  int			cheats;			  /* bit flags */
-  
-  int			refire;			  /* refired shots are less accurate */
-  
-  int			killcount, 
-                        itemcount, 
-                        secretcount;              /* for intermission */
-  char		        *message;		  /* hint messages */
-  int			messageTics;		  /* counter for showing messages */
-  int			damagecount, bonuscount;  /* for screen flashing */
-  int			flamecount;		  /* for flame thrower duration */
-  mobj_t		*attacker;		  /* who did damage (NULL for floors) */
-  int			extralight;		  /* so gun flashes light up areas */
-  int			fixedcolormap;		  /* can be set to REDCOLORMAP, etc */
-  int			colormap;		  /* 0-3 for which color to draw player */
-  pspdef_t	        psprites[NUMPSPRITES];	  /* view sprites (gun, etc) */
-  boolean		didsecret;		  /* true if secret level has been done */
-  int			chickenTics;		  /* player is a chicken if > 0 */
-  int			chickenPeck;		  /* chicken peck countdown */
-  mobj_t		*rain1;			  /* active rain maker 1 */
-  mobj_t		*rain2;			  /* active rain maker 2 */
-} player_t;
-
-#define CF_NOCLIP		1
-#define	CF_GODMODE		2
-#define	CF_NOMOMENTUM	        4    /* not really a cheat, just a debug aid */
-
-#define	BACKUPTICS		12   /* CHANGED FROM 12 !?!? */
-
-typedef struct
-{
-  unsigned	checksum;	     /* high bit is retransmit request */
-  byte		retransmitfrom;	     /* only valid if NCMD_RETRANSMIT */
-  byte		starttic;
-  byte		player, numtics;
-  ticcmd_t	cmds[BACKUPTICS];
-} doomdata_t;
-
-typedef struct
-{
-  long	id;
-  short	intnum;			     /* DOOM executes an int to execute commands */
-  
-  /* communication between DOOM and the driver */
-  short	command;		     /* CMD_SEND or CMD_GET */
-  short	remotenode;		     /* dest for send, set by get (-1 = no packet) */
-  short	datalength;		     /* bytes in doomdata to be sent */
-
-  /* info common to all nodes */
-  short	numnodes;		     /* console is allways node 0 */
-  short	ticdup;			     /* 1 = no duplication, 2-5 = dup for slow nets */
-  short	extratics;		     /* 1 = send a backup tic in every packet */
-  short	deathmatch;		     /* 1 = deathmatch */
-  short	savegame;		     /* -1 = new game, 0-5 = load savegame */
-  short	episode;		     /* 1-3 */
-  short	map;			     /* 1-9 */
-  short	skill;			     /* 1-5 */
-  
-  /* info specific to this node */
-  short	consoleplayer;
-  short	numplayers;
-  short	angleoffset;	             /* 1 = left, 0 = center, -1 = right */
-  short	drone;			     /* 1 = drone */
-  
-  /* packet data to be sent */
-  doomdata_t	data;
-} doomcom_t;
-
-#define	DOOMCOM_ID	0x12345678l
-
-extern	doomcom_t	*doomcom;
-extern	doomdata_t	*netbuffer;  /* points inside doomcom */
-
-#define	MAXNETNODES	8	     /* max computers in a game */
-
-#define	CMD_SEND	1
-#define	CMD_GET		2
-
-#define	SBARHEIGHT	42	     /* status bar height at bottom of screen */
-
-
-
-
-
-/*
-  ===============================================================================
-  
-  GLOBAL VARIABLES
-  
-  ===============================================================================
-*/
-
-#define TELEFOGHEIGHT (32*FRACUNIT)
-
-#define MAXEVENTS 64
-
-extern event_t events[MAXEVENTS];
-extern int eventhead;
-extern int eventtail;
-
-extern fixed_t finesine[5*FINEANGLES/4];
-extern fixed_t *finecosine;
-
-extern gameaction_t gameaction;
-
-extern boolean paused;
-
-extern boolean shareware;   /* true if main WAD is the shareware version */
-extern boolean ExtendedWAD; /* true if main WAD is the extended version */
-
-extern boolean nomonsters;  /* checkparm of -nomonsters */
-
-extern boolean respawnparm; /* checkparm of -respawn */
-
-extern boolean debugmode;   /* checkparm of -debug */
-
-extern boolean usergame;    /* ok to save / end game */
-
-extern boolean ravpic;      /* checkparm of -ravpic */
-
-extern boolean altpal;      /* checkparm to use an alternate palette routine */
-
-extern boolean cdrom;       /* true if cd-rom mode active ("-cdrom") */
-
-extern boolean deathmatch;  /* only if started as net death */
-
-extern boolean netgame;     /* only true if >1 player */
-
-extern boolean playeringame[MAXPLAYERS];
-
-extern int consoleplayer;   /* player taking events and displaying */
-
-extern int displayplayer;
-
-extern int viewangleoffset; /* ANG90 = left side, ANG270 = right */
-
-extern player_t players[MAXPLAYERS];
-
-extern	boolean		singletics;   /* debug flag to cancel adaptiveness */
-
-extern boolean DebugSound;  /* debug flag for displaying sound info */
-
-extern	int		maxammo[NUMAMMO];
-
-extern	boolean		demoplayback;
-extern	int		skytexture;
-
-extern	gamestate_t	gamestate;
-extern	skill_t		gameskill;
-extern	boolean		respawnmonsters;
-extern	int		gameepisode;
-extern	int		gamemap;
-extern 	int 	        prevmap;
-extern	int		totalkills, totalitems, totalsecret;   /* for intermission */
-extern	int		levelstarttic;	  /* gametic at level start */
-extern	int		leveltime;	  /* tics in game play for par */
-
-extern	ticcmd_t	netcmds[MAXPLAYERS][BACKUPTICS];
-extern int ticdup;
-
-#define	MAXNETNODES		8
-extern	ticcmd_t		localcmds[BACKUPTICS];
-extern int rndindex;
-extern int gametic, maketic;
-extern	int        	        nettics[MAXNETNODES];
-
-#define SAVEGAMESIZE 0x30000
-#define SAVESTRINGSIZE 24
-extern byte *savebuffer;
-extern byte *save_p;
-
-extern mapthing_t *deathmatch_p;
-extern mapthing_t deathmatchstarts[10];
-extern mapthing_t playerstarts[MAXPLAYERS];
-
-extern int viewwindowx;
-extern int viewwindowy;
-extern int viewwidth;
-extern int scaledviewwidth;
-extern int viewheight;
-
-/* rhandeev: differentiated mouse X and Y sensitivity */
-extern long mouseXSensitivity;
-extern long mouseYSensitivity;
-
-/* rhandeev: added mouse invert and mouse look features */
-extern boolean mouseInvert;
-extern boolean mouseLook;
-
-extern boolean precache;   /* if true, load all graphics at level load */
-
-extern byte *screen;       /* off screen work buffer, from V_video.c */
-
-extern boolean singledemo; /* quit after playing a demo from cmdline */
-
-extern FILE *debugfile;
-extern int bodyqueslot;
-extern skill_t startskill;
-extern int startepisode;
-extern int startmap;
-extern boolean autostart;
-
-
-/*
-  ===============================================================================
-  
-  GLOBAL FUNCTIONS
-  
-  ===============================================================================
-*/
-
-fixed_t	FixedMul (fixed_t a, fixed_t b);
-fixed_t	FixedDiv (fixed_t a, fixed_t b);
-fixed_t	FixedDiv2 (fixed_t a, fixed_t b);
-
-#ifdef __BIG_ENDIAN__
-
-#define SHORT(x) ((short)(
-(((unsigned short)(x) & (unsigned short)0x00ffU) << 8) 
-|
-(((unsigned short)(x) & (unsigned short)0xff00U) >> 8) ))
-
-#define LONG(x) ((int)(
-(((unsigned int)(x) & (unsigned int)0x000000ffUL) << 24) 
-|
-(((unsigned int)(x) & (unsigned int)0x0000ff00UL) <<  8)
-|
-(((unsigned int)(x) & (unsigned int)0x00ff0000UL) >>  8)
-|
-(((unsigned int)(x) & (unsigned int)0xff000000UL) >> 24) ))
-
-#else
-#define SHORT(x)	(x)
-#define LONG(x)		(x)
-#endif
-
-/*
- * -----------
- * MEMORY ZONE
- * -----------
- * tags < 100 are not overwritten until freed
- */
-#define	PU_STATIC		1		  /* static entire execution time */
-#define	PU_SOUND		2		  /* static while playing */
-#define	PU_MUSIC		3		  /* static while playing */
-#define	PU_DAVE			4		  /* anything else Dave wants static */
-#define	PU_LEVEL		50		  /* static until level exited */
-#define	PU_LEVSPEC		51	          /* a special thinker in a level */
-/* tags >= 100 are purgable whenever needed. */
-#define	PU_PURGELEVEL	        100
-#define	PU_CACHE		101
-
-void	Z_Init (void);
-void 	*Z_Malloc (size_t size, int tag, void *ptr);
-void 	Z_Free (void *ptr);
-void 	Z_FreeTags (int lowtag, int hightag);
-void 	Z_DumpHeap (int lowtag, int hightag);
-void	Z_FileDumpHeap (FILE *f);
-void	Z_CheckHeap (void);
-void	Z_ChangeTag2 (void *ptr, int tag);
-int 	Z_FreeMemory (void);
-
-extern boolean MallocFailureOk;
-
-typedef struct memblock_s
-{
-  size_t                  size;         /* including the header and possibly tiny fragments */
-  void                    **user;       /* NULL if a free block */
-  int                     tag;          /* purgelevel */
-  int                     id;           /* should be ZONEID */
-  struct memblock_s       *next, *prev;
-} memblock_t;
-
-#define Z_ChangeTag(p,t) \
-{ \
-if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
-	I_Error("Z_CT at "__FILE__":%i",__LINE__); \
-Z_ChangeTag2(p,t); \
-};
-
-
-
-//-------
-//WADFILE
-//-------
-typedef struct
-{
-  char		name[8];
-  int		handle,position,size;
-} lumpinfo_t;
-
-extern lumpinfo_t *lumpinfo;
-extern	int	numlumps;
-
-void	W_InitMultipleFiles (char **filenames);
-
-int	W_CheckNumForName (char *name);
-int	W_GetNumForName (char *name);
-
-int	W_LumpLength (int lump);
-void	W_ReadLump (int lump, void *dest);
-
-void	*W_CacheLumpNum (int lump, int tag);
-void	*W_CacheLumpName (char *name, int tag);
-
-int     wadopen( const char *fileName );
-
-
-/*
- * ----------
- * BASE LEVEL
- * ----------
- */
-void D_DoomMain (void);
-
-/*
-void IncThermo(void);
-void InitThermo(int max);
-void tprintf(char *string, int initflag);
-*/
-
-/*
- * not a globally visible function, just included for source reference
- * calls all startup code
- * parses command line options
- * if not overrided, calls N_AdvanceDemo
- */
-
-void D_DoomLoop (void);
-/*
- * not a globally visible function, just included for source reference
- * called by D_DoomMain, never exits
- * manages timing and IO
- * calls all ?_Responder, ?_Ticker, and ?_Drawer functions
- * calls I_GetTime, I_StartFrame, and I_StartTic
- */
-
-void D_PostEvent (event_t *ev);
-/* called by IO functions when input is detected */
-
-void NetUpdate (void);
-/* create any new ticcmds and broadcast to other players */
-
-void D_QuitNetGame (void);
-/* broadcasts special packets to other players to notify of game exit */
-
-void TryRunTics (void);
-
-
-/*
- * ---------
- * SYSTEM IO
- * ---------
- */
-
-/*
- * Do or do not use external soundserver.
- * The sndserver binary to be run separately
- *  has been introduced by Dave Taylor.
- * The integrated sound support is experimental,
- *  and unfinished. Default is synchronous.
- * Experimental asynchronous timer based is
- *  handled by SNDINTR.
- *#define SNDSERV  1
- *#define SNDINTR  1
- */
-
-/*
- * This one switches between MIT SHM (no proper mouse)
- * and XFree86 DGA (mickey sampling). The original
- * linuxdoom used SHM, which is default.
- *#define X11_DGA		1
- */
-
-/*
- * For resize of screen, at start of game.
- * It will not work dynamically, see visplanes.
- */
-#define	BASE_WIDTH		320
-
-/*
- * It is educational but futile to change this
- *  scaling e.g. to 2. Drawing of status bar,
- *  menues etc. is tied to the scale implied
- *  by the graphics.
- */
-#define	SCREEN_MUL		1
-#define	INV_ASPECT_RATIO	0.625   /* 0.75, ideally */
-
-/*
- * So there.
- */
-#define SCREENWIDTH  320
-/* SCREEN_MUL*BASE_WIDTH */
-#define SCREENHEIGHT 200
-/* (int)(SCREEN_MUL*BASE_WIDTH*INV_ASPECT_RATIO) */
-
-extern int screenwidth;
-extern int screenheight;
-#define MAXSCREENWIDTH 1024
-#define MAXSCREENHEIGHT 768
-
-/*
- * Added for use with SVGALIB(inits some things); dummy for X11 and GGI Targets */
-void InitGraphLib(void);
-
-/* Added for a clean exit... */
-void I_ShutdownGraphics(void);
-
-/* Checks the resolution via the modules rend_svga, rend_x11 or rend_ggi */
-void I_CheckRes( void );
-
-byte *I_ZoneBase (size_t *size);
-/*
- * called by startup code to get the ammount of memory to malloc
- * for the zone management
- */
-
-int I_GetTime (void);
-/*
- * called by D_DoomLoop
- * returns current time in tics
- */
-
-void I_StartFrame (void);
-/*
- * called by D_DoomLoop
- * called before processing any tics in a frame (just after displaying a frame)
- * time consuming syncronous operations are performed here (joystick reading)
- * can call D_PostEvent
- */
-
-void I_StartTic (void);
-/*
- * called by D_DoomLoop
- * called before processing each tic in a frame
- * quick syncronous operations are performed here
- * can call D_PostEvent
- *
- * asyncronous interrupt functions should maintain private ques that are
- * read by the syncronous functions to be converted into events
- */
-
-void I_Init (void);
-/*
- * called by D_DoomMain
- * determines the hardware configuration and sets up the video mode
- */
-
-void I_InitGraphics (void);
-
-void I_InitNetwork (void);
-void I_NetCmd (void);
-
-void I_Error (char *error, ...);
-/*
- * called by anything that can generate a terminal error
- * bad exit with diagnostic message
- */
-
-void I_Quit (void);
-/*
- * called by M_Responder when quit is selected
- * clean exit, displays sell blurb
- */
-
-void I_SetPalette (byte *palette);
-/* takes full 8 bit values */
-
-void I_FinishUpdate(void);
-/* Copy buffer to video */
-
-void I_WipeUpdate(wipe_t wipe);
-/* Copy buffer to video with wipe effect */
-
-void I_WaitVBL(int count);
-/* wait for vertical retrace or pause a bit */
-
-void I_BeginRead (void);
-void I_EndRead (void);
-
-byte	*I_AllocLow (int length);
-/* allocates from low memory under dos, just mallocs under unix */
-
-void I_Tactile (int on, int off, int total);
-
-
-/*
- * ----
- * GAME
- * ----
- */
-
-void G_DeathMatchSpawnPlayer (int playernum);
-
-void G_InitNew (skill_t skill, int episode, int map);
-
-void G_DeferedInitNew (skill_t skill, int episode, int map);
-/*
- * can be called by the startup code or M_Responder
- * a normal game starts at map 1, but a warp test can start elsewhere
- */
-
-void G_DeferedPlayDemo (char *demo);
-
-void G_LoadGame (char *name);
-/*
- * can be called by the startup code or M_Responder
- * calls P_SetupLevel or W_EnterWorld
- */
-void G_DoLoadGame (void);
-
-void G_SaveGame (int slot, char *description);
-/*
- * called by M_Responder
- *
- * Support routines for saving games
- */
-void SV_Open(char *fileName);
-void SV_Close(char *fileName);
-void SV_Write(void *buffer, size_t size);
-void SV_WriteByte(byte val);
-void SV_WriteWord(unsigned short val);
-void SV_WriteLong(unsigned int val);
-
-void G_RecordDemo (skill_t skill, int numplayers, int episode
-		   ,int map, char *name);
-/* only called by startup code */
-
-void G_PlayDemo (char *name);
-void G_TimeDemo (char *name);
-
-boolean G_CheckDemoStatus (void);
-
-void G_ExitLevel (void);
-void G_SecretExitLevel (void);
-
-void G_WorldDone (void);
-
-void G_Ticker (void);
-boolean G_Responder (event_t *ev);
-
-void G_ScreenShot (void);
-
-
-/*
- * -----
- * PLAY
- * -----
- */
-
-void P_Ticker (void);
-/*
- * called by C_Ticker
- * can call G_PlayerExited
- * carries out all thinking of monsters and players
- */
-
-void P_SetupLevel (int episode, int map, int playermask, skill_t skill);
-/* called by W_Ticker */
-
-void P_Init (void);
-/* called by startup code */
-
-void P_ArchivePlayers (void);
-void P_UnArchivePlayers (void);
-void P_ArchiveWorld (void);
-void P_UnArchiveWorld (void);
-void P_ArchiveThinkers (void);
-void P_UnArchiveThinkers (void);
-void P_ArchiveSpecials (void);
-void P_UnArchiveSpecials (void);
-/* load / save game routines */
-
-
-/*
- * -------
- * REFRESH
- * -------
- */
-
-extern boolean setsizeneeded;
-
-extern boolean BorderNeedRefresh;
-extern boolean BorderTopRefresh;
-
-extern int UpdateState;
-/* define the different areas for the dirty map */
-#define I_NOUPDATE	0
-#define I_FULLVIEW	1
-#define I_STATBAR	2
-#define I_MESSAGES	4
-#define I_FULLSCRN	8
-
-void R_RenderPlayerView (player_t *player);
-/* called by G_Drawer */
-
-void R_Init (void);
-/* called by startup code */
-
-void R_DrawViewBorder (void);
-void R_DrawTopBorder (void);
-/* if the view size is not full screen, draws a border around it */
-
-void R_SetViewSize (int blocks, int detail);
-/* called by M_Responder */
-
-int	R_FlatNumForName (char *name);
-
-int	R_TextureNumForName (char *name);
-int	R_CheckTextureNumForName (char *name);
-/*
- * called by P_Ticker for switches and animations
- * returns the texture number for the texture name
- */
-
-
-/*
- * ----
- * MISC
- * ----
- */
-
-extern	int	myargc;
-extern	char	**myargv;
-
-int	M_CheckParm (char *check);
-/* returns the position of the given parameter in the arg list (0 if not found) */
-
-boolean M_ValidEpisodeMap(int episode, int map);
-/*
- * returns true if the episode/map combo is valid for the current
- * game configuration
- */
-
-void M_ForceUppercase(char *text);
-/* Changes a string to uppercase */
-
-int M_Random (void);
-/* returns a number from 0 to 255 */
-
-int P_Random (void);
-/* as M_Random, but used only by the play simulation */
-
-void M_ClearRandom (void);
-/* fix randoms for demos */
-
-void M_FindResponseFile(void);
-
-void M_ClearBox (fixed_t *box);
-void M_AddToBox (fixed_t *box, fixed_t x, fixed_t y);
-/* bounding box functions */
-
-boolean M_WriteFile (char const *name, void *source, int length);
-int M_ReadFile (char const *name, byte **buffer);
-
-void M_ScreenShot (void);
-
-void M_LoadDefaults (void);
-
-void M_SaveDefaults (void);
-
-int M_DrawText (int x, int y, boolean direct, char *string);
-
-
-/*
- * ----------------------
- *  Interlude (IN_lude.c)
- * ----------------------
- */
-
-extern boolean intermission;
-
-void IN_Start(void);
-void IN_Ticker(void);
-void IN_Drawer(void);
-
-
-/*
- * ----------------------
- *  Chat mode (CT_chat.c)
- * ----------------------
- */
-
-void CT_Init(void);
-void CT_Drawer(void);
-boolean CT_Responder(event_t *ev);
-void CT_Ticker(void);
-char CT_dequeueChatChar(void);
-
-extern boolean chatmodeon;
-extern boolean ultimatemsg;
-
-
-/*
- * --------------------
- *  Finale (F_finale.c)
- * --------------------
- */
-
-void F_Drawer(void);
-void F_Ticker(void);
-void F_StartFinale(void);
-
-
-/*
- * ----------------------
- *  STATUS BAR (SB_bar.c)
- * ----------------------
- */
-
-extern int SB_state;
-void SB_Init(void);
-boolean SB_Responder(event_t *event);
-void SB_Ticker(void);
-void SB_Drawer(void);
-
-
-
-/*
- * -----------------
- *  MENU (MN_menu.c)
- * -----------------
- */
-
-void MN_Init(void);
-void MN_ActivateMenu(void);
-void MN_DeactivateMenu(void);
-boolean MN_Responder(event_t *event);
-void MN_Ticker(void);
-void MN_Drawer(void);
-void MN_DrTextA(char *text, int x, int y);
-int MN_TextAWidth(char *text);
-void MN_DrTextB(char *text, int x, int y);
-int MN_TextBWidth(char *text);
-
-
-/*
- * ------
- *  VIDEO
- * ------
- */
-extern byte* screens[5];
-extern int dirtybox[4];
-extern byte gammatable[5][256];
-extern long usegamma;
-extern int bilifilter;
-extern int lifilter;
-
-void V_Init(void); /* Allocates buffer screens, call before R_Init */
-void V_DrawPatch(int x, int y, patch_t *patch);
-void V_DrawFuzzPatch(int x, int y, patch_t *patch);
-void V_DrawShadowedPatch(int x, int y, patch_t *patch);
-void V_DrawRawScreen(byte *raw);
-void V_Filter_Screen_linear(byte* screenp);
-void V_Filter_Screen_bilinear(byte* screenp);
-
-#include "sounds.h"
-
-
-#endif   /* __DOOMDEF__ */
diff -uNr linux-heretic-1.0/i_ipx.c linux-heretic-1.0.new/i_ipx.c
--- linux-heretic-1.0/i_ipx.c	Mon Mar 15 11:51:31 1999
+++ linux-heretic-1.0.new/i_ipx.c	Thu Oct 14 15:02:44 1999
@@ -38,10 +38,10 @@
 /* setupdata_t is used as doomdata_t during setup (from ipxnet.h/ipxsrc.zip) */
 typedef struct
 {
-  short gameid; /* so multiple games can setup at once */
-  short drone;
-  short nodesfound;
-  short nodeswanted;
+  short gameid __attribute__((packed)); /* so multiple games can setup at once */
+  short drone __attribute__((packed));
+  short nodesfound __attribute__((packed));
+  short nodeswanted __attribute__((packed));
 } setupdata_t;
 
 typedef unsigned char ipx_node[6];
diff -uNr linux-heretic-1.0/i_ipx_arm.c linux-heretic-1.0.new/i_ipx_arm.c
--- linux-heretic-1.0/i_ipx_arm.c	Mon Mar 15 11:50:21 1999
+++ linux-heretic-1.0.new/i_ipx_arm.c	Wed Dec 31 19:00:00 1969
@@ -1,775 +0,0 @@
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <time.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include "i_ipx.h"
-
-#ifdef __GLIBC__
-#define MYSOCKLEN_T socklen_t
-#include <netipx/ipx.h>
-#else
-#define MYSOCKLEN_T int
-#include <linux/ipx.h>
-#endif /* __GLIBC__ */
-
-#define IPXSETUP_COMPAT    /* be compatible with ipxsetup.exe */
-
-#define MY_PORT 0x869b     /* default port */
-#define MAX_INTERFACES 6
-#define PROC_IPX_IF "/proc/net/ipx_interface"
-
-
-
-/*
- * Novell IPX NETWORKING
- */
-
-/* setupdata_t is used as doomdata_t during setup (from ipxnet.h/ipxsrc.zip) */
-typedef struct
-{
-  short gameid __attribute__((packed)); /* so multiple games can setup at once */
-  short drone __attribute__((packed));
-  short nodesfound __attribute__((packed));
-  short nodeswanted __attribute__((packed));
-} setupdata_t;
-
-typedef unsigned char ipx_node[6];
-typedef unsigned int ipx_net;
-typedef unsigned short ipx_port;
-
-typedef struct {
-  struct sockaddr_ipx sa;  /* address of local interface */
-  int sock;
-} ipxif;   /* ipx interface */
-
-static ipxif ipx_networks[MAX_INTERFACES];
-static int num_ipxifs;   /* # of IPX interfaces found */
-
-typedef struct {
-  int interface;  /* index in ipx_networks */
-  struct sockaddr_ipx peer_addr;
-} ipx_peer;  /* network opponents */
-
-static ipx_peer ipx_peers[MAXNETNODES];
-static setupdata_t nodesetup[MAXNETNODES];
-
-static int all_players_known=FALSE; /* if TRUE, net startup has finished, game in play */
-static int DOOMPORT = MY_PORT;      /* port (IPX socket) to use */
-
-static int my_localtime;
-static int recv_maxfd;
-static fd_set recv_fd_set;
-
-typedef struct {
-  int time;          /* sequence no., -1 at setup time */
-  doomdata_t swx;
-  char buffer[20];   /* to check for big packets */
-} recvbuf_t, sendbuf_t;
-
-recvbuf_t rb;                   /* my receive buffer */
-struct sockaddr_ipx rb_address; /* my receive-address buffer */
-#define remotetime (rb.time)
-
-#define BROADCAST_NODE "\377\377\377\377\377\377"
-static struct sockaddr_ipx broad_addr;  /* contains broadcast address */
-
-/* prototypes */
-
-static int get_ipx_interfaces(void);
-static void look_for_nodes(int numnetnodes);
-static void init_ipx(int interface);
-static void ipx_send(int dest,void *data,int datalen);
-static int ipx_select(void);
-static void IPXPacketSend_notime (void);
-#ifdef IPX_DEBUG
-static void ipx_print_sockaddr(FILE *stream,struct sockaddr_ipx *sa);
-static void ipx_print_network(FILE *stream,ipx_net *net);
-static void ipx_print_node(FILE *stream,ipx_node *node);
-static void ipx_print_port(FILE *stream,ipx_port *port);
-#endif /* #ifdef IPX_DEBUG */
-
-static int inline ipx_same_node(ipx_node *a,ipx_node *b)
-{
-  return(!memcmp(a,b,sizeof(ipx_node)));
-}
-
-static int inline ipx_same_addr(struct sockaddr_ipx *a,struct sockaddr_ipx *b)
-{
-  if (a->sipx_network != b->sipx_network || a->sipx_port != b->sipx_port) return(FALSE);
-  return(ipx_same_node(&a->sipx_node,&b->sipx_node));
-}
-
-
-/*
- * IPXPacketSend
- * sends a packet and updates my_localtime
- */
-
-void IPXPacketSend(void)  /* gets called from outside via pointer */
-{
-  my_localtime++;
-  IPXPacketSend_notime();
-}
-
-
-/*
- * IPXPacketSend_notime
- * sends a packet w/o updating my_localtime
- */
-
-static void IPXPacketSend_notime (void)
-{
-  sendbuf_t  sb;
-
-  memcpy(&sb.swx,netbuffer,doomcom->datalength);
-  sb.time = my_localtime;
-#ifdef IPXSETUP_COMPAT    /* make packet 4 bytes longer, filled with zeros */
-  /* FIXME: access might be unaligned! */
-  *(unsigned long *)(((char *)(&sb.swx))+doomcom->datalength)=0;  /* dos doom hack */
-#endif
-  
-#if 0   /* no byte swap for now, only for LITTLE_ENDIAN */
-  sw.checksum = htonl(netbuffer->checksum);
-  sw.player = netbuffer->player;
-  sw.retransmitfrom = netbuffer->retransmitfrom;
-  sw.starttic = netbuffer->starttic;
-  sw.numtics = netbuffer->numtics;
-  for (c=0 ; c< netbuffer->numtics ; c++)
-    {
-      sw.cmds[c].forwardmove = netbuffer->cmds[c].forwardmove;
-      sw.cmds[c].sidemove = netbuffer->cmds[c].sidemove;
-      sw.cmds[c].angleturn = htons(netbuffer->cmds[c].angleturn);
-      sw.cmds[c].consistancy = htons(netbuffer->cmds[c].consistancy);
-      sw.cmds[c].chatchar = netbuffer->cmds[c].chatchar;
-      sw.cmds[c].buttons = netbuffer->cmds[c].buttons;
-      sw.cmds[c].lookfly = netbuffer->cmds[c].lookfly;
-      sw.cmds[c].arti = netbuffer->cmds[c].arti;
-    }
-#endif
-  
-#ifdef IPXSETUP_COMPAT
-  ipx_send(doomcom->remotenode,&sb,doomcom->datalength+sizeof(int) + 4);
-#else
-  ipx_send(doomcom->remotenode,&sb,doomcom->datalength+sizeof(int)); /* sizeof time */
-#endif
-}
-
-
-/*
- * IPXPacketGet
- * doomcom.remotenode = -1, packet from unknown/new peer
- * returns interface # (index in ipx_networks[]), where packet was reveived, -1 for error
- */
-
-int IPXPacketGet (void)  /* gets called from outside via pointer */
-{
-#define sw (rb.swx)
-  int         i;
-  int         c;
-  MYSOCKLEN_T fromlen;
-  int         interface;
-  
- restart:
-  
-  interface=ipx_select();  /* get interface to recvfrom */
-  if (interface == -1) {
-    doomcom->remotenode = -1;  /* indicates "no packet" on higher level (not setup time) */
-    return(-1);  /* indicates "no packet" */
-  }
-  
-#ifdef IPX_DEBUG
-  /*
-    printf("IPXPacketGet(): receiving from i.f. %d (",interface);
-    ipx_print_sockaddr(stdout,&ipx_networks[interface].sa);
-    printf(")\n");
-  */
-#endif
-  
-  fromlen = sizeof(rb_address);
-  c = recvfrom(ipx_networks[interface].sock,&rb,sizeof(rb),0,
-	       (struct sockaddr *)&rb_address,&fromlen);
-  if (c == -1 ) {
-    I_Error ("IPXPacketGet: recvfrom(): %s",strerror(errno));
-  }
-  
-  /* check, whether packet is from myself and drop it if yes */
-  if (ipx_same_addr(&rb_address,&ipx_networks[interface].sa)) {
-    goto restart;
-  }
-  
-#ifdef IPX_DEBUG
-  printf("IPXPacketGet(): received from (");
-  ipx_print_sockaddr(stdout,&rb_address);
-  printf("): %d bytes\n",c);
-  
-  if (c > sizeof(sw) + sizeof(int)) {
-    printf("**BIG SIZE PACKET RECEIVED: size: %d, max: %d\n",c,sizeof(sw)+sizeof(int));
-  }
-#endif
-  
-  /* search for peer address in my table, start w/index 1, index 0 is myself (dummy) */
-  for (i=1; i<doomcom->numnodes; i++) {
-    if (rb_address.sipx_network == ipx_peers[i].peer_addr.sipx_network &&
-	ipx_same_node(&rb_address.sipx_node,&ipx_peers[i].peer_addr.sipx_node))
-      break;
-  }
-  
-  if (i == doomcom->numnodes) { /* not found in table... */
-    doomcom->remotenode = -1;              /* packet from unknown peer */
-  }
-  else {
-    doomcom->remotenode = i;               /* good packet from a game player */
-  }
-  
-#ifdef IPXSETUP_COMPAT
-  doomcom->datalength = c - sizeof(int) - 4; /* disregard lenght of time counter and dummies */
-#else
-  doomcom->datalength = c - sizeof(int);     /* disregard lenght of time counter */
-#endif
-  memcpy(netbuffer,&sw,c);                   /* copy received data to doom network buffer */
-  return(interface);
-  
-#if 0        /* no swap for now, works on LITTLE_ENDIAN only */
-  /* byte swap */
-  netbuffer->checksum = ntohl(sw.checksum);
-  netbuffer->player = sw.player;
-  netbuffer->retransmitfrom = sw.retransmitfrom;
-  netbuffer->starttic = sw.starttic;
-  netbuffer->numtics = sw.numtics;
-  
-  for (c=0 ; c< netbuffer->numtics ; c++)
-    {
-      netbuffer->cmds[c].forwardmove = sw.cmds[c].forwardmove;
-      netbuffer->cmds[c].sidemove = sw.cmds[c].sidemove;
-      netbuffer->cmds[c].angleturn = ntohs(sw.cmds[c].angleturn);
-      netbuffer->cmds[c].consistancy = ntohs(sw.cmds[c].consistancy);
-      netbuffer->cmds[c].chatchar = sw.cmds[c].chatchar;
-      netbuffer->cmds[c].buttons = sw.cmds[c].buttons;
-      netbuffer->cmds[c].lookfly = sw.cmds[c].lookfly;
-      netbuffer->cmds[c].arti = sw.cmds[c].arti;
-    }
-#endif
-}
-#undef sw
-
-
-/*
- * I_InitIPX
- */
-
-void I_InitIPX (void)    /* called from outside */
-{
-  int i,p;
-  int num_netnodes;  /* from command line */
-  
-  p = M_CheckParm ("-port");
-  if (p && p<myargc-1)
-    {
-      DOOMPORT = atoi (myargv[p+1]);
-      printf ("using alternate port %i\n",DOOMPORT);
-    }
-  
-  /* get # of players from command line */
-  /* e.g. "-ipx 3" ---> 3 players */
-  i = M_CheckParm("-ipx");
-  if (!i || i>=myargc-1) {
-    I_Error("-ipx switch needs an argument");
-  }
-  num_netnodes=atoi(myargv[i+1]);
-  if (num_netnodes <= 1 || num_netnodes > MAXNETNODES) {
-    I_Error("*how many* net players?");
-  }
-  
-  num_ipxifs=get_ipx_interfaces();
-/*
-  if (!num_ipxifs) {
-    I_Error("IPX not installed/configured");
-  }
-*/
-
-  fprintf(stderr, "I_InitIPX num_ipxifs: %d\n", num_ipxifs);
- 
-  for (i=0; i<num_ipxifs; i++) {
-    init_ipx(i);  /* init interface: socket() + bind() */
-  }
-  
-  look_for_nodes(num_netnodes);  /* find and wait for the other nodes */
-  
-  my_localtime = 0;
-  
-  doomcom->id = DOOMCOM_ID;
-  doomcom->numplayers = doomcom->numnodes;
-}
-
-
-/*
- * look_for_nodes
- * find other network players
- * large parts of this routine are from ipxsetup.c (from ipxsrc.zip)
- */
-
-static void look_for_nodes(int numnetnodes)
-{
-  int          i;
-  int          interface;
-  time_t       curtime;
-  time_t       oldsec;
-  setupdata_t  *setup,*dest;
-  int          total,console;
-  
-  /*
-   * wait until we get [numnetnodes] packets, then start playing...
-   * the playernumbers are assigned by netid
-   */
-  printf("Attempting to find all players for %i player net play.\n", numnetnodes);
-  printf("Looking for a node");
-  
-  oldsec = -1;
-  setup = (setupdata_t *)&doomcom->data;
-  my_localtime = -1;          /* in setup, not game */
-  
-  nodesetup[0].nodesfound = 1;
-  nodesetup[0].nodeswanted = numnetnodes;
-  doomcom->numnodes = 1;
-  memcpy(&ipx_peers[0].peer_addr,&ipx_networks[0].sa,sizeof(struct sockaddr_ipx));
-  
-  do {
-    /*
-     * listen to the network
-     */
-    while ((interface=IPXPacketGet()) != -1)
-      {
-	
-#ifdef IPX_DEBUG
-	printf("packet received before: ID = %04X\n",setup->gameid);
-	for (i=0; i<doomcom->numnodes; i++) {
-	  printf("i=%d, found=%d, wanted=%d\n",i,
-		 nodesetup[i].nodesfound,
-		 nodesetup[i].nodeswanted);
-	}
-#endif
-	
-	if (doomcom->remotenode == -1)  /* sender known? */
-	  dest = &nodesetup[doomcom->numnodes];   /* no */
-	else
-	  dest = &nodesetup[doomcom->remotenode]; /* yes */
-	
-	if (remotetime != -1)
-	  {   /* an early game packet, not a setup packet */
-	    if (doomcom->remotenode == -1)
-	      I_Error("Got an unknown game packet during setup");
-	    /* if peer already started, it must have found all nodes */
-	    dest->nodesfound = dest->nodeswanted;
-	    printf("**early game packet received\n");
-	    continue;
-	  }
-	
-	/* update setup info */
-	memcpy(dest,setup,sizeof(*dest));
-	
-#ifdef IPX_DEBUG
-	printf("packet received after:\n");
-	for (i=0; i<doomcom->numnodes; i++) {
-	  printf("i=%d, found=%d, wanted=%d\n",i,
-		 nodesetup[i].nodesfound,
-		 nodesetup[i].nodeswanted);
-	}
-#endif
-	
-	if (doomcom->remotenode != -1)
-	  continue;           /* already know that node address */
-	
-	/*
-	 * this is a new node
-	 * fill in ipx_peers[] entry
-	 */
-	memcpy(&ipx_peers[doomcom->numnodes].peer_addr,&rb_address,
-	       sizeof(struct sockaddr_ipx));
-	ipx_peers[doomcom->numnodes].interface=interface;
-	
-	/*
-	 * if this node has a lower address, take all startup info
-	 */
-	/*
-	  if (memcmp(&remoteadr,&nodeadr[0],sizeof(&remoteadr)) < 0)
-	  {
-	  }
-	*/
-	
-	doomcom->numnodes++;
-	
-	printf("\nFound a node!\n");
-	
-	if (doomcom->numnodes < numnetnodes)
-	  printf("Looking for a node");
-      }
-    
-    /*
-     * we are done if all nodes have found all other nodes
-     */
-    
-    for (i=0; i<doomcom->numnodes; i++)
-      if (nodesetup[i].nodesfound != nodesetup[i].nodeswanted)
-	break;
-    
-    if (i == nodesetup[0].nodeswanted)
-      break;         /* got them all */
-    
-    /*
-     * send out a broadcast packet every second
-     */
-    curtime=time(NULL);
-    if (curtime == oldsec)
-      continue;
-    oldsec = curtime;
-    
-    printf (".");
-    doomcom->datalength = sizeof(*setup);
-    
-    nodesetup[0].nodesfound = doomcom->numnodes;
-    memcpy (&doomcom->data, &nodesetup[0], sizeof(*setup));
-    doomcom->remotenode=MAXNETNODES;  /* indicate broadcast address */
-    IPXPacketSend_notime();     /* send to all */
-  } while (1);
-  
-  /*
-   * count players
-   */
-  total = 0;
-  console = 0;
-  
-  for (i=0 ; i<numnetnodes ; i++)
-    {
-      if (nodesetup[i].drone)
-	continue;
-      total++;
-      if (total > MAXPLAYERS)
-	I_Error("More than %i players specified!",MAXPLAYERS);
-      
-#ifdef IPX_DEBUG
-      printf("player: %d - ",i);
-      ipx_print_node(stdout,&ipx_peers[i].peer_addr.sipx_node);
-      printf(";  interface - ");
-      ipx_print_node(stdout,&ipx_networks[ipx_peers[i].interface].sa.sipx_node);
-      printf ("\n");
-#endif
-      
-      if (memcmp (&ipx_peers[i].peer_addr.sipx_node,
-		  &ipx_networks[ipx_peers[1].interface].sa.sipx_node,
-		  sizeof(ipx_node)) < 0) {
-	console++;
-      }
-    }
-  
-  if (!total)
-    I_Error("No players specified for game!");
-  
-  doomcom->consoleplayer = console;
-  doomcom->numplayers = total;
-  
-  /* build fdset for subsequent select calls */
-  FD_ZERO(&recv_fd_set);
-  recv_maxfd=0;
-  for (i=1; i<doomcom->numnodes; i++) {
-    FD_SET(ipx_networks[ipx_peers[i].interface].sock,&recv_fd_set);
-    if (ipx_networks[ipx_peers[i].interface].sock > recv_maxfd)
-      recv_maxfd=ipx_networks[ipx_peers[i].interface].sock;
-  }
-  recv_maxfd++;
-  all_players_known=TRUE;
-  
-  printf("Console is player %i of %i\n", console+1, total);
-}
-
-
-/*
- * determines from which socket (ipx_network) to receive the next packet
- * returns -1, if no packet waiting...
- */
-
-static int ipx_select(void)
-{
-  fd_set back_fds;
-  int maxfd;
-  fd_set fds;
-  int ret,i;
-  struct timeval timeout;
-  
-  /* build fd_set */
-  
-  if (all_players_known) { /* game time -- use prebuilt fdset */
-    fds=recv_fd_set;
-    maxfd=recv_maxfd;
-  }
-  else {  /* setup time -- build fdset */
-    FD_ZERO(&fds);
-    maxfd=0;
-    for (i=0; i<num_ipxifs; i++) {
-      FD_SET(ipx_networks[i].sock,&fds);
-      if (ipx_networks[i].sock > maxfd)
-	maxfd=ipx_networks[i].sock;
-    }
-    maxfd++; /* index --> number */
-  }
-  back_fds=fds;
-  
-  while(1) {
-    timeout.tv_sec=timeout.tv_usec=0; /* no timeout, no block, no time to waste */
-    ret=select(maxfd,&fds,NULL,NULL,&timeout);
-    if (ret == -1) {  /* error occurred */
-      if (errno == EINTR) {
-	fds=back_fds;
-	continue;
-      }
-      I_Error("select(): %s",strerror(errno));
-    }
-    if (!ret) return(-1);  /* no packet waiting */
-    if (all_players_known) {
-      for (i=1; i<doomcom->numnodes; i++) {
-	if (FD_ISSET(ipx_networks[ipx_peers[i].interface].sock,&fds)) {
-	  return(ipx_peers[i].interface);
-	}
-      }
-    }
-    else {
-      for (i=0; i<num_ipxifs; i++) {
-	if (FD_ISSET(ipx_networks[i].sock,&fds)) {
-	  return(i);
-	}
-      }
-    }
-    /* shouldn't arrive here... */
-    I_Error("fallen out of function ipx_select() ... booouummm!");
-  }
-}
-
-
-/*
- * generic send routine
- * dest is index into ipx_peers[] or MAXNETNODES for broadcast
- */
-
-static void ipx_send(int dest,void *data,int datalen)
-{
-  int i,status;
-  
-  if (dest != MAXNETNODES) {
-    /* send to a single peer */
-    status=sendto(ipx_networks[ipx_peers[dest].interface].sock,
-		  data,datalen,0,(struct sockaddr *)&ipx_peers[dest].peer_addr,
-		  sizeof(struct sockaddr_ipx));
-    if (status == -1) {
-      fprintf(stderr,"sendto() failed: %s\n",strerror(errno));
-    }
-    return;
-  }
-  
-  /* do broadcasts to all connected IPX networks */
-  broad_addr.sipx_family=AF_IPX;
-  broad_addr.sipx_type=0;
-  broad_addr.sipx_port=htons(DOOMPORT);
-  memcpy(&broad_addr.sipx_node,BROADCAST_NODE,sizeof(ipx_node));
-  for (i=0; i<num_ipxifs; i++) {
-    broad_addr.sipx_network=ipx_networks[i].sa.sipx_network; /* set network address */
-    status=sendto(ipx_networks[i].sock,data,datalen,0,
-		  (struct sockaddr *)&broad_addr,sizeof(struct sockaddr_ipx));
-#ifdef IPX_DEBUG
-    if (status == -1) {
-      int oerrno=errno;
-      
-      fprintf(stderr,"cannot broadcast to <");
-      ipx_print_network(stderr,(ipx_net *)&broad_addr.sipx_network);
-      fprintf(stderr,">: %s -- ignoring\n",strerror(oerrno));
-    }
-#endif
-  }
-}
-
-
-/*
- * table of possible IPX frametypes
- * used by get_ipx_interfaces()
- */
-
-static unsigned char ipx_frametypes[] = {
-  IPX_FRAME_NONE,
-  IPX_FRAME_SNAP,
-  IPX_FRAME_8022,
-  IPX_FRAME_ETHERII,
-  IPX_FRAME_8023,
-  IPX_FRAME_TR_8022
-};
-#define NUM_IPX_FRAMES sizeof(ipx_frametypes)
-
-/*
- * tries to detect all IPX interfaces, /proc support not needed
- * won't detect internal IPX net, but we don't need that anyway...
- */
-
-static int get_ipx_interfaces(void)
-{
-  int sock,res,i,j,k=0;
-  char buff[1024];
-  struct ifreq ifr,*pifr,ifr_bak;
-  struct ifconf ifc;
-  struct sockaddr_ipx *sipx;
-  
-  memset(ipx_networks,0,sizeof(ipx_networks));  /* initialize network list */
-  memset(&ifr,0,sizeof(struct ifreq));
-  memset(&ifc,0,sizeof(struct ifconf));
-  memset(buff,0,1024);
-  
-  ifc.ifc_len=sizeof(buff);
-  ifc.ifc_buf=buff;
-  
-  sock = socket(AF_IPX, SOCK_DGRAM, PF_IPX);
-  if (sock == -1) {
-    I_Error("socket(): failed\n");
-  }
-  
-  res=ioctl(sock,SIOCGIFCONF,&ifc);
-  if (res<0) {
-    I_Error("ioctl(...,SIOCGIFCONF,...): %s\n",strerror(errno));
-  }
-  
-  pifr=ifc.ifc_req;
-  
-  for (i=ifc.ifc_len / sizeof(struct ifreq); --i >=0; pifr++) {
-#ifdef IPX_DEBUG
-    printf("found interface %s\n",pifr->ifr_name);
-#endif
-    sipx=(struct sockaddr_ipx *)&pifr->ifr_addr;
-    memcpy(&ifr_bak,pifr,sizeof(ifr_bak));
-    for (j=0; j<NUM_IPX_FRAMES; j++) { /* try all frame types */
-      memcpy(pifr,&ifr_bak,sizeof(ifr_bak));
-      sipx->sipx_type=ipx_frametypes[j];
-      res=ioctl(sock,SIOCGIFADDR,pifr);
-      if (!res) {
-	ipx_networks[k].sa.sipx_network=sipx->sipx_network;
-	memcpy(&ipx_networks[k++].sa.sipx_node,
-	       sipx->sipx_node,sizeof(sipx->sipx_node));
-      }
-#ifdef IPX_DEBUG
-      if (res<0) {
-	printf(" -> ioctl(): %s\n",strerror(errno));
-      }
-      else {
-	printf("  -> net address: ");
-	ipx_print_network(stdout,(ipx_net *)&sipx->sipx_network);
-	printf("\n");
-      }
-#endif
-    }
-  }
-  
-  close(sock);
-  return(k);
-}
-
-
-#if 0
-
-/*
- * get all IPX interfaces, needs /proc support, *not finished*
- */
-
-static ipxif *get_ipx_interfaces(void)
-{
-  int fd;
-  off_t size;
-  char *line;
-  
-  fd=open(PROC_IPX_IF,O_RDONLY);
-  if (fd == -1) {
-    return(NULL);  /* cannot open -> maybe not present */
-  }
-  wrkbuf=malloc(8192); /* should be nuff */
-  if (!wrkbuf) return(NULL);
-  size=read(fd,wrkbuf,8192);
-  if (!size) return(NULL);
-  while (line = getline(&curpos,&size)) ; /* ... &c. &c. &c. ... */
-}
-
-#endif
-
-/*
- * initialize an IPX interface: open socket, bind to doom port, enable broadcasts
- */
-
-static void init_ipx(int interface)
-{
-  int         option=1;  /* for setsockopt() */
-  int         status;
-  MYSOCKLEN_T saipxlen=sizeof(struct sockaddr_ipx);
-  
-  ipx_networks[interface].sock=socket(AF_IPX,SOCK_DGRAM,PF_IPX);
-  if (ipx_networks[interface].sock == -1) {
-    I_Error("cannot open IPX socket: %s",strerror(errno));
-  }
-  ipx_networks[interface].sa.sipx_family=AF_IPX;
-  ipx_networks[interface].sa.sipx_port=htons(DOOMPORT);
-  ipx_networks[interface].sa.sipx_type=0;
-  if (bind(ipx_networks[interface].sock,
-	   (struct sockaddr *)&ipx_networks[interface].sa,
-	   sizeof(struct sockaddr_ipx))) {
-    I_Error("cannot bind to doom port: %s",strerror(errno));
-  }
-  status=getsockname(ipx_networks[interface].sock,
-		     (struct sockaddr *)&ipx_networks[interface].sa,
-		     &saipxlen);
-  if (status == -1) {
-    I_Error("getsockname() failed: %s",strerror(errno));
-  }
-#ifdef IPX_DEBUG
-  printf("Using IPX address: ");
-  ipx_print_sockaddr(stdout,&ipx_networks[interface].sa);
-  printf("\n");
-#endif
-  /* enable broadcasts */
-  if (setsockopt(ipx_networks[interface].sock,SOL_SOCKET,SO_BROADCAST,&option,sizeof(option))) {
-    I_Error("cannot enable broadcasts: %s",strerror(errno));
-  }
-}
-
-#ifdef IPX_DEBUG
-
-static void ipx_print_sockaddr(FILE *stream,struct sockaddr_ipx *sa)
-{
-  ipx_print_network(stream,(ipx_net *)&sa->sipx_network);
-  fprintf(stream,":");
-  ipx_print_node(stream,&sa->sipx_node);
-  fprintf(stream,":");
-  ipx_print_port(stream,&sa->sipx_port);
-}
-
-static void ipx_print_network(FILE *stream,ipx_net *net)
-{
-  ipx_net h=ntohl(*net);
-  fprintf(stream,"%02X%02X%02X%02X",
-	  (h>>24)&0xff,(h>>16)&0xff,(h>>8)&0xff,h&0xff);
-}
-
-static void ipx_print_node(FILE *stream,ipx_node *node)
-{
-  int i;
-  for (i=0; i<sizeof(ipx_node); i++) fprintf(stream,"%02X",*((unsigned char *)node+i));
-}
-
-static void ipx_print_port(FILE *stream,ipx_port *port)
-{
-  fprintf(stream,"%04X",ntohs(*port));
-}
-
-#endif /* #ifdef IPX_DEBUG */
-
diff -uNr linux-heretic-1.0/musserv/Makefile linux-heretic-1.0.new/musserv/Makefile
--- linux-heretic-1.0/musserv/Makefile	Mon Mar 22 17:21:11 1999
+++ linux-heretic-1.0.new/musserv/Makefile	Thu Oct 14 15:15:09 1999
@@ -11,7 +11,7 @@
 
 #CFLAGS = $(WFLAGS) -O2 -mpentiumpro
 #CFLAGS = -Wall -g3
-CFLAGS = $(WFLAGS) -O2
+CFLAGS = $(WFLAGS) $(COPT.arch)
 AFLAGS = $(CFLAGS)
 LDFLAGS = # -s
 LIBS   = 
diff -uNr linux-heretic-1.0/musserv/musserver.h linux-heretic-1.0.new/musserv/musserver.h
--- linux-heretic-1.0/musserv/musserver.h	Sat Mar 20 21:17:12 1999
+++ linux-heretic-1.0.new/musserv/musserver.h	Thu Oct 14 15:03:08 1999
@@ -35,6 +35,10 @@
 #  include <awe_voice.h>
 #endif
 
+#ifndef __PACKED__
+#define __PACKED__
+#endif
+
 extern char *progname;
 extern int verbose;
 extern int unknevents;
@@ -85,7 +89,7 @@
   unsigned char level_2;        /* OP 2: output level */
   unsigned char unused;
   short         basenote;       /* base note offset */
-} __attribute__ ((packed));
+}  __PACKED__ ;
 
 
 struct opl_instr {
@@ -97,7 +101,7 @@
 	unsigned char         finetune;
 	unsigned char         note;
 	struct OPL2instrument patchdata[2];
-} __attribute__ ((packed));
+}  __PACKED__ ;
 
 
 typedef struct OPLfile {
@@ -115,7 +119,7 @@
 	unsigned short sec_channels;   // count of secondary channels
 	unsigned short instrCnt;
 	unsigned short dummy;
-} __attribute__ ((packed));
+}  __PACKED__ ;
 
 
 typedef struct MUSfile {
diff -uNr linux-heretic-1.0/parse_arm.sh linux-heretic-1.0.new/parse_arm.sh
--- linux-heretic-1.0/parse_arm.sh	Mon Mar 22 19:56:43 1999
+++ linux-heretic-1.0.new/parse_arm.sh	Wed Dec 31 19:00:00 1969
@@ -1,22 +0,0 @@
-#!/bin/sh
-rm -f doomdata.h doomdef.h w_wad.c
-
-case "$1" in
-  arm)
-   ln -s doomdef_arm.h doomdef.h
-   ln -s doomdata_arm.h doomdata.h
-   ln -s w_wad_arm.c w_wad.c
-;;
-
-  others)
-   ln -s doomdef_std.h doomdef.h
-   ln -s doomdata_std.h doomdata.h
-   ln -s w_wad_std.c w_wad.c
-;;
-
-  *)
-   echo "Usage: $0 {arm|others}"
-   exit 1
-;;
-esac
-exit 0
diff -uNr linux-heretic-1.0/sndserv/Makefile linux-heretic-1.0.new/sndserv/Makefile
--- linux-heretic-1.0/sndserv/Makefile	Mon Mar 15 10:31:41 1999
+++ linux-heretic-1.0.new/sndserv/Makefile	Thu Oct 14 15:17:46 1999
@@ -1,12 +1,6 @@
 CC = gcc
 
-COPT.x86 = -m486 -O2 -malign-jumps=2 -malign-functions=2
-COPT.m68k = -m68020-60 -O2 -fomit-frame-pointer -D__BIG_ENDIAN__
-COPT.arm = -O2 -fomit-frame-pointer -fpack-struct -fsigned-char
-
-# For arm, replace $(COPT.x86) with $(COPT.arm)
-
-CFLAGS=	-Wall -Wstrict-prototypes $(COPT.x86)
+CFLAGS=	-Wall -Wstrict-prototypes $(COPT.arch)
 
 LIBS=	-lm
 
diff -uNr linux-heretic-1.0/w_wad.c linux-heretic-1.0.new/w_wad.c
--- linux-heretic-1.0/w_wad.c	Tue Apr 13 17:02:58 1999
+++ linux-heretic-1.0.new/w_wad.c	Thu Oct 14 15:02:37 1999
@@ -56,9 +56,9 @@
 typedef struct
 {
   char		identification[4];	/* should be IWAD */
-  int		numlumps;
-  int		infotableofs;
-} wadinfo_t;
+  int		numlumps  __PACKED__ ;
+  int		infotableofs  __PACKED__ ;
+}  __PACKED__  wadinfo_t;
 
 
 typedef struct
@@ -66,7 +66,7 @@
   int		filepos;
   int		size;
   char		name[8];
-} filelump_t;
+}  __PACKED__  filelump_t;
 
 
 /* =============
@@ -144,7 +144,7 @@
 
 int wadopen(const char* fileName)
 {
-    int fd;
+    int fd = -1;
     char* fn;
     char* envhome;
     
@@ -158,16 +158,17 @@
 	    free(fn);
 	    return fd;
 	}
-    else if ((envhome = getenv("HERETICHOME")) != NULL)
+    
+    if ((envhome = getenv("HERETICHOME")) != NULL)
 	{
 	    fn = (char*) malloc(strlen(envhome)+strlen("/")+strlen(fileName)+1);
 	    assert(fn);
 	    sprintf(fn, "%s/%s", envhome, fileName);
 	    fd = open(fn, O_RDONLY | O_BINARY);
 	    free(fn);
-	    return fd;	    
 	}
-    else if ((envhome = getenv("HOME")) != NULL)
+
+    if ((fd < 0) && ((envhome = getenv("HOME")) != NULL))
 	{
 	    fn = (char*) malloc(strlen(envhome)+strlen(HOMEDIR"/")
 				+strlen(fileName)+1);
@@ -175,13 +176,38 @@
 	    sprintf(fn, "%s"HOMEDIR"/%s", envhome, fileName);
 	    fd = open(fn, O_RDONLY | O_BINARY);
 	    free(fn);
-	    return fd;	    	    
 	}
-    else   	  
-	if ((fd = open(fileName, O_RDONLY | O_BINARY)) >= 0)
-	    return fd;
 
-    return -1;
+    if ((fd < 0) && (envhome = getenv("PATH")))
+        {
+            char *path = strdup(envhome), *curentry;
+            assert(path);
+            while (strlen(path) && (fd < 0))
+                {
+                    if (!(curentry = strrchr(path, ':')))
+                        curentry = path;
+                    else
+                        *curentry++ = 0;
+                    fn = (char*) malloc(strlen(curentry)+19+strlen(fileName));  /* Add space for /, ../share/heretic/ */
+                    assert(fn);
+                    sprintf(fn, "%s/%s", curentry, fileName);
+                    fd = open(fn, O_RDONLY | O_BINARY);      
+                    /* check ../share/heretic */
+                    if (fd < 0)                 
+                        {      
+                            sprintf(fn, "%s/../share/heretic/%s", curentry, fileName);
+                            fd = open(fn, O_RDONLY | O_BINARY);
+                        }
+                    free(fn);
+                    *curentry = 0;                          
+                }
+            free(path);
+        }      
+
+    if (fd < 0)
+        fd = open(fileName, O_RDONLY | O_BINARY);
+
+    return fd;
 }
 
 
diff -uNr linux-heretic-1.0/w_wad_arm.c linux-heretic-1.0.new/w_wad_arm.c
--- linux-heretic-1.0/w_wad_arm.c	Mon Mar 15 11:50:37 1999
+++ linux-heretic-1.0.new/w_wad_arm.c	Wed Dec 31 19:00:00 1969
@@ -1,571 +0,0 @@
-/* W_wad.c */
-
-#ifdef NeXT
-#include <libc.h>
-#include <ctype.h>
-
-/* next doesn't need a binary flag in open call */
-#define	O_BINARY	0
-
-#else
-
-#ifdef UNIX
-#include <ctype.h>
-#include <sys/types.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <malloc.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif   /* HAVE_ALLOCA_H */
-
-#define O_BINARY		0
-#endif   /* UNIX */
-
-#include <malloc.h>
-
-#ifdef __GLIBC__
-#include <sys/io.h>
-#else
-#include <sys/uio.h>
-#endif   /* __GLIBC__ */
-
-#include <fcntl.h>
-#include <sys/stat.h>
-#endif   /* NeXT */
-
-#include "doomdef.h"
-
-
-#ifndef HOMEDIR
-#define HOMEDIR "/.heretic"
-#endif /* HOMEDIR */
-
-
-/* ===============
- *    TYPES
- * =============== 
- */
-
-
-typedef struct
-{
-  char		identification[4];	/* should be IWAD */
-  int		numlumps __attribute__ ((packed));
-  int		infotableofs __attribute__ ((packed));
-} __attribute__ ((packed)) wadinfo_t;
-
-
-typedef struct
-{
-  int		filepos;
-  int		size;
-  char		name[8];
-} __attribute__ ((packed)) filelump_t;
-
-
-/* =============
- *  GLOBALS
- * ============= 
- */
-
-lumpinfo_t	*lumpinfo;		/* location of each lump on disk */
-int		numlumps;
-
-void		**lumpcache;
-
-
-/* =================== */
-
-#ifdef UNIX
-
-#define strcmpi strcasecmp
-
-void strupr (char *s)
-{
-  while (*s)
-    *s++ = toupper(*s);
-}
-
-/*
-================
-=
-= filelength
-=
-================
-*/
-
-int filelength (int handle)
-{
-    struct stat	fileinfo;
-    
-    if (fstat (handle,&fileinfo) == -1)
-      I_Error ("Error fstating");
-    
-    return fileinfo.st_size;
-}
-
-#endif   /* UNIX */
-
-
-void ExtractFileBase (char *path, char *dest)
-{
-  char	*src;
-  int	length;
-  
-  src = path + strlen(path) - 1;
-
-  /* back up until a \ or the start */
-  while (src != path 
-	 && *(src-1) != '\\' 
-	 && *(src-1) != '/')
-    src--;
-  
-  /* copy up to eight characters */
-  
-	memset (dest,0,8);
-	length = 0;
-	
-	while (*src && *src != '.')
-	{
-	  if (++length == 9)
-	    I_Error ("Filename base of %s >8 chars",path);
-	  *dest++ = toupper((int)*src++);
-	}
-}
-
-
-/* Helper function */
-
-int wadopen(const char* fileName)
-{
-    int fd;
-    char* fn;
-    char* envhome;
-    
-
-    fn = (char*) malloc(strlen("./")+strlen(fileName)+1);
-    assert(fn);
-    sprintf(fn, "./%s", fileName);
-    if (!access(fn, R_OK))
-	{
-	    fd = open(fn, O_RDONLY | O_BINARY);
-	    free(fn);
-	    return fd;
-	}
-    else if ((envhome = getenv("HERETICHOME")) != NULL)
-	{
-	    fn = (char*) malloc(strlen(envhome)+strlen("/")+strlen(fileName)+1);
-	    assert(fn);
-	    sprintf(fn, "%s/%s", envhome, fileName);
-	    fd = open(fn, O_RDONLY | O_BINARY);
-	    free(fn);
-	    return fd;	    
-	}
-    else if ((envhome = getenv("HOME")) != NULL)
-	{
-	    fn = (char*) malloc(strlen(envhome)+strlen(HOMEDIR"/")
-				+strlen(fileName)+1);
-	    assert(fn);
-	    sprintf(fn, "%s"HOMEDIR"/%s", envhome, fileName);
-	    fd = open(fn, O_RDONLY | O_BINARY);
-	    free(fn);
-	    return fd;	    	    
-	}
-    else   	  
-	if ((fd = open(fileName, O_RDONLY | O_BINARY)) >= 0)
-	    return fd;
-
-    return -1;
-}
-
-
-
-/*
-  ============================================================================
-  
-  LUMP BASED ROUTINES
-  
-  ============================================================================
-*/
-
-/*
-  ====================
-  =
-  = W_AddFile
-  =
-  = All files are optional, but at least one file must be found
-  = Files with a .wad extension are wadlink files with multiple lumps
-  = Other files are single lumps with the base filename for the lump name
-  =
-  ====================
-*/
-
-void W_AddFile (char *filename)
-{
-  wadinfo_t		header;
-  lumpinfo_t		*lump_p;
-  unsigned		i;
-  int			handle, length;
-  int			startlump;
-  filelump_t		*fileinfo, singleinfo;
-	
-  /*
-   * open the file and add to directory
-   */
-
-  
-  if ( (handle = wadopen (filename)) == -1)
-      {
-	  printf (" couldn't open %s\n",filename);
-	  return;
-      }
-  
-  printf (" adding %s\n", filename);
-  startlump = numlumps;
-  
-  if (strcmpi (filename+strlen(filename)-3 , "wad" ) )
-      {
-	  /* single lump file */
-	  fileinfo = &singleinfo;
-	  singleinfo.filepos = 0;
-	  singleinfo.size = LONG(filelength(handle));
-	  ExtractFileBase (filename, singleinfo.name);
-	  numlumps++;
-      }
-  else 
-    {
-	/* WAD file */
-	read (handle, &header, sizeof(header));
-	if (strncmp(header.identification,"IWAD",4))
-	    {
-	  if (strncmp(header.identification,"PWAD",4))
-	      I_Error ("Wad file %s doesn't have IWAD or PWAD id\n"
-		       ,filename);
-	    }
-      header.numlumps = LONG(header.numlumps);
-      header.infotableofs = LONG(header.infotableofs);
-      length = header.numlumps*sizeof(filelump_t);
-      fileinfo = alloca (length);
-      lseek (handle, header.infotableofs, SEEK_SET);
-      read (handle, fileinfo, length);
-      numlumps += header.numlumps;
-    }
-
-  /* Fill in lumpinfo */
-  lumpinfo = realloc (lumpinfo, numlumps*sizeof(lumpinfo_t));
-  if (!lumpinfo)
-    I_Error ("Couldn't realloc lumpinfo");
-  lump_p = &lumpinfo[startlump];
-  
-  for (i=startlump ; i<numlumps ; i++,lump_p++, fileinfo++)
-    {
-      lump_p->handle = handle;
-      lump_p->position = LONG(fileinfo->filepos);
-      lump_p->size = LONG(fileinfo->size);
-      strncpy (lump_p->name, fileinfo->name, 8);
-    }
-}
-
-
-/*
-  ====================
-  =
-  = W_InitMultipleFiles
-  =
-  = Pass a null terminated list of files to use.
-  =
-  = All files are optional, but at least one file must be found
-  =
-  = Files with a .wad extension are idlink files with multiple lumps
-  =
-  = Other files are single lumps with the base filename for the lump name
-  =
-  = Lump names can appear multiple times. The name searcher looks backwards,
-  = so a later file can override an earlier one.
-  =
-  ====================
-*/
-
-void W_InitMultipleFiles (char **filenames)
-{	
-  int		size;
-  
-  /* open all the files, load headers, and count lumps */
-  numlumps = 0;
-  lumpinfo = malloc(1);	/* will be realloced as lumps are added */
-  
-  for ( ; *filenames ; filenames++)
-    W_AddFile (*filenames);
-  
-  if (!numlumps)
-    I_Error ("W_InitFiles: no files found");
-  
-  /* set up caching */
-  size = numlumps * sizeof(*lumpcache);
-  lumpcache = malloc (size);
-  assert(lumpcache);
-  if (!lumpcache)
-    I_Error ("Couldn't allocate lumpcache");
-  memset (lumpcache,0, size);
-}
-
-
-/*
-  ====================
-  =
-  = W_InitFile
-  =
-  = Just initialize from a single file
-  =
-  ====================
-*/
-
-void W_InitFile (char *filename)
-{
-  char	*names[2];
-  
-  names[0] = filename;
-  names[1] = NULL;
-  W_InitMultipleFiles (names);
-}
-
-
-/*
-  ====================
-  =
-  = W_NumLumps
-  =
-  ====================
-*/
-
-int	W_NumLumps (void)
-{
-  return numlumps;
-}
-
-
-/*
-  ====================
-  =
-  = W_CheckNumForName
-  =
-  = Returns -1 if name not found
-  =
-  ====================
-*/
-
-int	W_CheckNumForName (char *name)
-{
-  char	        name8[9];
-  int		v1,v2;
-  lumpinfo_t	*lump_p;
-  
-  /* make the name into two integers for easy compares */
-  
-  strncpy (name8,name,8);
-  name8[8] = 0;			/* in case the name was a fill 8 chars */
-  strupr (name8);		/* case insensitive */
-
-  v1 = *(int *)name8;
-  v2 = *(int *)&name8[4];
-  
-  
-  /* scan backwards so patch lump files take precedence */
-  
-  lump_p = lumpinfo + numlumps;
-  
-  while (lump_p-- != lumpinfo)
-    if ( *(int *)lump_p->name == v1 
-	 && *(int *)&lump_p->name[4] == v2)
-      return lump_p - lumpinfo;
-    
-  return -1;
-}
-
-
-/*
-  ====================
-  =
-  = W_GetNumForName
-  =
-  = Calls W_CheckNumForName, but bombs out if not found
-  =
-  ====================
-*/
-
-int	W_GetNumForName (char *name)
-{
-  int	i;
-  
-  i = W_CheckNumForName (name);
-  if (i != -1)
-    return i;
-  
-  I_Error ("W_GetNumForName: %s not found!",name);
-  return -1;
-}
-
-
-/*
-  ====================
-  =
-  = W_LumpLength
-  =
-  = Returns the buffer size needed to load the given lump
-  =
-  ====================
-*/
-
-int W_LumpLength (int lump)
-{
-  if (lump >= numlumps)
-    I_Error ("W_LumpLength: %i >= numlumps",lump);
-  return lumpinfo[lump].size;
-}
-
-
-/*
-  ====================
-  =
-  = W_ReadLump
-  =
-  = Loads the lump into the given buffer, which must be >= W_LumpLength()
-  =
-  ====================
-*/
-
-void W_ReadLump (int lump, void *dest)
-{
-  int		c;
-  lumpinfo_t	*l;
-  
-  if (lump >= numlumps)
-    I_Error ("W_ReadLump: %i >= numlumps",lump);
-  l = lumpinfo+lump;
-  
-  /* I_BeginRead (); - for use with DiskIconFlashing... */
-	
-  lseek (l->handle, l->position, SEEK_SET);
-  c = read (l->handle, dest, l->size);
-  
-  if (c < l->size)
-    I_Error ("W_ReadLump: only read %i of %i on lump %i",c,l->size,lump);	
-  /* I_EndRead (); - for use with DiskIconFlashing... */
-}
-
-
-
-/*
-  ====================
-  =
-  = W_CacheLumpNum
-  =
-  ====================
-*/
-
-void	*W_CacheLumpNum (int lump, int tag)
-{
-  byte *ptr;
-  
-  if ((unsigned)lump >= numlumps)
-    I_Error ("W_CacheLumpNum: %i >= numlumps",lump);
-  
-  if (!lumpcache[lump])
-    {	/* read the lump in */
-      /* printf ("cache miss on lump %i\n",lump); */
-      ptr = Z_Malloc (W_LumpLength (lump), tag, &lumpcache[lump]);
-      W_ReadLump (lump, lumpcache[lump]);
-    }
-  else
-    {
-      /* printf ("cache hit on lump %i\n",lump); */
-      Z_ChangeTag (lumpcache[lump],tag);
-    }
-  
-  return lumpcache[lump];
-}
-
-
-/*
-  ====================
-  =
-  = W_CacheLumpName
-  =
-  ====================
-*/
-
-void	*W_CacheLumpName (char *name, int tag)
-{
-  return W_CacheLumpNum (W_GetNumForName(name), tag);
-}
-
-
-
-/*
-  ====================
-  =
-  = W_Profile
-  =
-  ====================
-*/
-
-// Ripped out for Heretic
-/*
-int	info[2500][10];
-int	profilecount;
-
-void W_Profile (void)
-{
-	int		i;
-	memblock_t	*block;
-	void	*ptr;
-	char	ch;
-	FILE	*f;
-	int		j;
-	char	name[9];
-	
-	
-	for (i=0 ; i<numlumps ; i++)
-	{	
-		ptr = lumpcache[i];
-		if (!ptr)
-		{
-			ch = ' ';
-			continue;
-		}
-		else
-		{
-			block = (memblock_t *) ( (byte *)ptr - sizeof(memblock_t));
-			if (block->tag < PU_PURGELEVEL)
-				ch = 'S';
-			else
-				ch = 'P';
-		}
-		info[i][profilecount] = ch;
-	}
-	profilecount++;
-	
-	f = fopen ("waddump.txt","w");
-	name[8] = 0;
-	for (i=0 ; i<numlumps ; i++)
-	{
-		memcpy (name,lumpinfo[i].name,8);
-		for (j=0 ; j<8 ; j++)
-			if (!name[j])
-				break;
-		for ( ; j<8 ; j++)
-			name[j] = ' ';
-		fprintf (f,"%s ",name);
-		for (j=0 ; j<profilecount ; j++)
-			fprintf (f,"    %c",info[i][j]);
-		fprintf (f,"\n");
-	}
-	fclose (f);
-}
-*/
diff -uNr linux-heretic-1.0/w_wad_std.c linux-heretic-1.0.new/w_wad_std.c
--- linux-heretic-1.0/w_wad_std.c	Tue Apr 13 17:02:58 1999
+++ linux-heretic-1.0.new/w_wad_std.c	Wed Dec 31 19:00:00 1969
@@ -1,572 +0,0 @@
-/* W_wad.c */
-
-#ifdef NeXT
-#include <libc.h>
-#include <ctype.h>
-
-/* next doesn't need a binary flag in open call */
-#define	O_BINARY	0
-
-#else
-
-#ifdef UNIX
-#include <ctype.h>
-#include <sys/types.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <malloc.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif   /* HAVE_ALLOCA_H */
-
-#define O_BINARY		0
-#endif   /* UNIX */
-
-#include <malloc.h>
-
-#ifdef __GLIBC__
-#include <sys/io.h>
-#else
-#include <sys/uio.h>
-#endif   /* __GLIBC__ */
-
-#include <fcntl.h>
-#include <sys/stat.h>
-#endif   /* NeXT */
-
-#include "doomdef.h"
-
-
-#ifndef HOMEDIR
-#define HOMEDIR "/.heretic"
-#endif /* HOMEDIR */
-
-
-/* ===============
- *    TYPES
- * =============== 
- */
-
-
-typedef struct
-{
-  char		identification[4];	/* should be IWAD */
-  int		numlumps;
-  int		infotableofs;
-} wadinfo_t;
-
-
-typedef struct
-{
-  int		filepos;
-  int		size;
-  char		name[8];
-} filelump_t;
-
-
-/* =============
- *  GLOBALS
- * ============= 
- */
-
-lumpinfo_t	*lumpinfo;		/* location of each lump on disk */
-int		numlumps;
-
-void		**lumpcache;
-
-
-/* =================== */
-
-#ifdef UNIX
-
-#define strcmpi strcasecmp
-
-void strupr (char *s)
-{
-  while (*s)
-    *s++ = toupper(*s);
-}
-
-/*
-================
-=
-= filelength
-=
-================
-*/
-
-int filelength (int handle)
-{
-    struct stat	fileinfo;
-    
-    if (fstat (handle,&fileinfo) == -1)
-      I_Error ("Error fstating");
-    
-    return fileinfo.st_size;
-}
-
-#endif   /* UNIX */
-
-
-void ExtractFileBase (char *path, char *dest)
-{
-  char	*src;
-  int	length;
-  
-  src = path + strlen(path) - 1;
-
-  /* back up until a \ or the start */
-  while (src != path 
-	 && *(src-1) != '\\' 
-	 && *(src-1) != '/')
-    src--;
-  
-  /* copy up to eight characters */
-  
-	memset (dest,0,8);
-	length = 0;
-	
-	while (*src && *src != '.')
-	{
-	  if (++length == 9)
-	    I_Error ("Filename base of %s >8 chars",path);
-	  *dest++ = toupper((int)*src++);
-	}
-}
-
-
-/* Helper function */
-
-int wadopen(const char* fileName)
-{
-    int fd;
-    char* fn;
-    char* envhome;
-    
-
-    fn = (char*) malloc(strlen("./")+strlen(fileName)+1);
-    assert(fn);
-    sprintf(fn, "./%s", fileName);
-    if (!access(fn, R_OK))
-	{
-	    fd = open(fn, O_RDONLY | O_BINARY);
-	    free(fn);
-	    return fd;
-	}
-    else if ((envhome = getenv("HERETICHOME")) != NULL)
-	{
-	    fn = (char*) malloc(strlen(envhome)+strlen("/")+strlen(fileName)+1);
-	    assert(fn);
-	    sprintf(fn, "%s/%s", envhome, fileName);
-	    fd = open(fn, O_RDONLY | O_BINARY);
-	    free(fn);
-	    return fd;	    
-	}
-    else if ((envhome = getenv("HOME")) != NULL)
-	{
-	    fn = (char*) malloc(strlen(envhome)+strlen(HOMEDIR"/")
-				+strlen(fileName)+1);
-	    assert(fn);
-	    sprintf(fn, "%s"HOMEDIR"/%s", envhome, fileName);
-	    fd = open(fn, O_RDONLY | O_BINARY);
-	    free(fn);
-	    return fd;	    	    
-	}
-    else   	  
-	if ((fd = open(fileName, O_RDONLY | O_BINARY)) >= 0)
-	    return fd;
-
-    return -1;
-}
-
-
-
-/*
-  ============================================================================
-  
-  LUMP BASED ROUTINES
-  
-  ============================================================================
-*/
-
-/*
-  ====================
-  =
-  = W_AddFile
-  =
-  = All files are optional, but at least one file must be found
-  = Files with a .wad extension are wadlink files with multiple lumps
-  = Other files are single lumps with the base filename for the lump name
-  =
-  ====================
-*/
-
-void W_AddFile (char *filename)
-{
-  wadinfo_t		header;
-  lumpinfo_t		*lump_p;
-  unsigned		i;
-  int			handle;
-  size_t		length;
-  int			startlump;
-  filelump_t		*fileinfo, singleinfo;
-	
-  /*
-   * open the file and add to directory
-   */
-
-  
-  if ( (handle = wadopen (filename)) == -1)
-      {
-	  printf (" couldn't open %s\n",filename);
-	  return;
-      }
-  
-  printf (" adding %s\n", filename);
-  startlump = numlumps;
-  
-  if (strcmpi (filename+strlen(filename)-3 , "wad" ) )
-      {
-	  /* single lump file */
-	  fileinfo = &singleinfo;
-	  singleinfo.filepos = 0;
-	  singleinfo.size = LONG(filelength(handle));
-	  ExtractFileBase (filename, singleinfo.name);
-	  numlumps++;
-      }
-  else 
-    {
-	/* WAD file */
-	read (handle, &header, sizeof(header));
-	if (strncmp(header.identification,"IWAD",4))
-	    {
-	  if (strncmp(header.identification,"PWAD",4))
-	      I_Error ("Wad file %s doesn't have IWAD or PWAD id\n"
-		       ,filename);
-	    }
-      header.numlumps = LONG(header.numlumps);
-      header.infotableofs = LONG(header.infotableofs);
-      length = header.numlumps*sizeof(filelump_t);
-      fileinfo = alloca (length);
-      lseek (handle, header.infotableofs, SEEK_SET);
-      read (handle, fileinfo, length);
-      numlumps += header.numlumps;
-    }
-
-  /* Fill in lumpinfo */
-  lumpinfo = realloc (lumpinfo, numlumps*sizeof(lumpinfo_t));
-  if (!lumpinfo)
-    I_Error ("Couldn't realloc lumpinfo");
-  lump_p = &lumpinfo[startlump];
-  
-  for (i=startlump ; i<numlumps ; i++,lump_p++, fileinfo++)
-    {
-      lump_p->handle = handle;
-      lump_p->position = LONG(fileinfo->filepos);
-      lump_p->size = LONG(fileinfo->size);
-      strncpy (lump_p->name, fileinfo->name, 8);
-    }
-}
-
-
-/*
-  ====================
-  =
-  = W_InitMultipleFiles
-  =
-  = Pass a null terminated list of files to use.
-  =
-  = All files are optional, but at least one file must be found
-  =
-  = Files with a .wad extension are idlink files with multiple lumps
-  =
-  = Other files are single lumps with the base filename for the lump name
-  =
-  = Lump names can appear multiple times. The name searcher looks backwards,
-  = so a later file can override an earlier one.
-  =
-  ====================
-*/
-
-void W_InitMultipleFiles (char **filenames)
-{	
-  int		size;
-  
-  /* open all the files, load headers, and count lumps */
-  numlumps = 0;
-  lumpinfo = malloc(1);	/* will be realloced as lumps are added */
-  
-  for ( ; *filenames ; filenames++)
-    W_AddFile (*filenames);
-  
-  if (!numlumps)
-    I_Error ("W_InitFiles: no files found");
-  
-  /* set up caching */
-  size = numlumps * sizeof(*lumpcache);
-  lumpcache = malloc (size);
-  assert(lumpcache);
-  if (!lumpcache)
-    I_Error ("Couldn't allocate lumpcache");
-  memset (lumpcache,0, size);
-}
-
-
-/*
-  ====================
-  =
-  = W_InitFile
-  =
-  = Just initialize from a single file
-  =
-  ====================
-*/
-
-void W_InitFile (char *filename)
-{
-  char	*names[2];
-  
-  names[0] = filename;
-  names[1] = NULL;
-  W_InitMultipleFiles (names);
-}
-
-
-/*
-  ====================
-  =
-  = W_NumLumps
-  =
-  ====================
-*/
-
-int	W_NumLumps (void)
-{
-  return numlumps;
-}
-
-
-/*
-  ====================
-  =
-  = W_CheckNumForName
-  =
-  = Returns -1 if name not found
-  =
-  ====================
-*/
-
-int	W_CheckNumForName (char *name)
-{
-  char	        name8[9];
-  int		v1,v2;
-  lumpinfo_t	*lump_p;
-  
-  /* make the name into two integers for easy compares */
-  
-  strncpy (name8,name,8);
-  name8[8] = 0;			/* in case the name was a fill 8 chars */
-  strupr (name8);		/* case insensitive */
-
-  v1 = *(int *)name8;
-  v2 = *(int *)&name8[4];
-  
-  
-  /* scan backwards so patch lump files take precedence */
-  
-  lump_p = lumpinfo + numlumps;
-  
-  while (lump_p-- != lumpinfo)
-    if ( *(int *)lump_p->name == v1 
-	 && *(int *)&lump_p->name[4] == v2)
-      return lump_p - lumpinfo;
-    
-  return -1;
-}
-
-
-/*
-  ====================
-  =
-  = W_GetNumForName
-  =
-  = Calls W_CheckNumForName, but bombs out if not found
-  =
-  ====================
-*/
-
-int	W_GetNumForName (char *name)
-{
-  int	i;
-  
-  i = W_CheckNumForName (name);
-  if (i != -1)
-    return i;
-  
-  I_Error ("W_GetNumForName: %s not found!",name);
-  return -1;
-}
-
-
-/*
-  ====================
-  =
-  = W_LumpLength
-  =
-  = Returns the buffer size needed to load the given lump
-  =
-  ====================
-*/
-
-int W_LumpLength (int lump)
-{
-  if (lump >= numlumps)
-    I_Error ("W_LumpLength: %i >= numlumps",lump);
-  return lumpinfo[lump].size;
-}
-
-
-/*
-  ====================
-  =
-  = W_ReadLump
-  =
-  = Loads the lump into the given buffer, which must be >= W_LumpLength()
-  =
-  ====================
-*/
-
-void W_ReadLump (int lump, void *dest)
-{
-  int		c;
-  lumpinfo_t	*l;
-  
-  if (lump >= numlumps)
-    I_Error ("W_ReadLump: %i >= numlumps",lump);
-  l = lumpinfo+lump;
-  
-  /* I_BeginRead (); - for use with DiskIconFlashing... */
-	
-  lseek (l->handle, l->position, SEEK_SET);
-  c = read (l->handle, dest, l->size);
-  
-  if (c < l->size)
-    I_Error ("W_ReadLump: only read %i of %i on lump %i",c,l->size,lump);	
-  /* I_EndRead (); - for use with DiskIconFlashing... */
-}
-
-
-
-/*
-  ====================
-  =
-  = W_CacheLumpNum
-  =
-  ====================
-*/
-
-void	*W_CacheLumpNum (int lump, int tag)
-{
-  byte *ptr;
-  
-  if ((unsigned)lump >= numlumps)
-    I_Error ("W_CacheLumpNum: %i >= numlumps",lump);
-  
-  if (!lumpcache[lump])
-    {	/* read the lump in */
-      /* printf ("cache miss on lump %i\n",lump); */
-      ptr = Z_Malloc (W_LumpLength (lump), tag, &lumpcache[lump]);
-      W_ReadLump (lump, lumpcache[lump]);
-    }
-  else
-    {
-      /* printf ("cache hit on lump %i\n",lump); */
-      Z_ChangeTag (lumpcache[lump],tag);
-    }
-  
-  return lumpcache[lump];
-}
-
-
-/*
-  ====================
-  =
-  = W_CacheLumpName
-  =
-  ====================
-*/
-
-void	*W_CacheLumpName (char *name, int tag)
-{
-  return W_CacheLumpNum (W_GetNumForName(name), tag);
-}
-
-
-
-/*
-  ====================
-  =
-  = W_Profile
-  =
-  ====================
-*/
-
-// Ripped out for Heretic
-/*
-int	info[2500][10];
-int	profilecount;
-
-void W_Profile (void)
-{
-	int		i;
-	memblock_t	*block;
-	void	*ptr;
-	char	ch;
-	FILE	*f;
-	int		j;
-	char	name[9];
-	
-	
-	for (i=0 ; i<numlumps ; i++)
-	{	
-		ptr = lumpcache[i];
-		if (!ptr)
-		{
-			ch = ' ';
-			continue;
-		}
-		else
-		{
-			block = (memblock_t *) ( (byte *)ptr - sizeof(memblock_t));
-			if (block->tag < PU_PURGELEVEL)
-				ch = 'S';
-			else
-				ch = 'P';
-		}
-		info[i][profilecount] = ch;
-	}
-	profilecount++;
-	
-	f = fopen ("waddump.txt","w");
-	name[8] = 0;
-	for (i=0 ; i<numlumps ; i++)
-	{
-		memcpy (name,lumpinfo[i].name,8);
-		for (j=0 ; j<8 ; j++)
-			if (!name[j])
-				break;
-		for ( ; j<8 ; j++)
-			name[j] = ' ';
-		fprintf (f,"%s ",name);
-		for (j=0 ; j<profilecount ; j++)
-			fprintf (f,"    %c",info[i][j]);
-		fprintf (f,"\n");
-	}
-	fclose (f);
-}
-*/
 
diff -uNr linux-heretic-1.0/d_main.c linux-heretic-1.0.new/d_main.c
--- linux-heretic-1.0/d_main.c	Fri Aug 20 09:20:46 1999
+++ linux-heretic-1.0.new/d_main.c	Fri Oct 15 14:34:54 1999
@@ -618,6 +618,16 @@
   
   /* fprintf(stdout, "basedefault: %s\n", basedefault ); */
   
+  /* Add current directory to path */
+  if (getenv("PATH"))
+  {
+  	char *path = getenv("PATH");
+  	char *newpath = malloc(strlen(path)+2);
+  	sprintf(newpath, "%s:", path);
+  	setenv("PATH", newpath, 1);
+  	free(newpath);
+  }
+  
   /* Check if filtering is wanted */ 
   if ( M_CheckParm("-linear")!=0 ) lifilter=1;
   if ( M_CheckParm("-bilinear")!=0 ) bilifilter=1;
diff -uNr linux-heretic-1.0/m_misc.c linux-heretic-1.0.new/m_misc.c
--- linux-heretic-1.0/m_misc.c	Wed Apr 21 10:55:54 1999
+++ linux-heretic-1.0.new/m_misc.c	Fri Oct 15 14:50:07 1999
@@ -466,14 +466,14 @@
   { "key_useartifact", &key_useartifact, KEY_ENTER },
 
 #ifdef SNDSERV
-  {"sndserver", (long *) &sndserver_filename, (long) "./sndserver"},
+  {"sndserver", (long *) &sndserver_filename, (long) "sndserver"},
   {"sndopts", (long *) &sndserver_options, (long) "-quiet"},
 #endif
 #ifdef __DOSOUND__
   {"mb_used", &mb_used, 2},
 #endif
 #ifdef MUSSERV
-  {"musserver", (long *) &musserver_filename, (long) "./musserver"},
+  {"musserver", (long *) &musserver_filename, (long) "musserver"},
   {"musopts", (long *) &musserver_options, (long) ""},
 #endif
 #endif
diff -uNr linux-heretic-1.0/sndserv/wadread.c linux-heretic-1.0.new/sndserv/wadread.c
--- linux-heretic-1.0/sndserv/wadread.c	Thu Feb 11 18:29:12 1999
+++ linux-heretic-1.0.new/sndserv/wadread.c	Fri Oct 15 15:18:11 1999
@@ -156,7 +156,7 @@
 	    else
 		free(fn);
 	}
-    else if ((envhome = getenv("HOME")) != NULL)
+    if ((envhome = getenv("HOME")) != NULL)
 	{
 	    fn = (char*) malloc(strlen(envhome)+strlen(HOMEDIR"/")
 				+strlen(wadname)+1);
@@ -167,8 +167,37 @@
 	    else
 		free(fn);
 	}
-    else
-	if (!access(wadname, R_OK))
+    if ((envhome = getenv("PATH")))
+        {
+            char *path = strdup(envhome), *curentry;
+            assert(path);                           
+            while (strlen(path))
+                {
+                    if (!(curentry = strrchr(path, ':')))
+                        curentry = path;
+                    else
+                        *curentry++ = 0;
+                    fn = (char*)malloc(strlen(curentry)+19+strlen(wadname));   /* Add space for /, ../share/heretic/ */
+                    assert(fn);                                 
+                    sprintf(fn, "%s/%s", curentry, wadname);
+                    if (!access(fn, R_OK))
+                        {
+                            free(path);
+                            return fn;
+                        }
+                    /* check ../share/heretic */
+                    sprintf(fn, "%s/../share/heretic/%s", curentry, wadname);
+                    if (!access(fn, R_OK))
+                        {
+                            free(path);
+                            return fn;
+                        }
+                    free(fn);
+                    *curentry = 0;                          
+                }
+            free(path);
+        }        
+    if (!access(wadname, R_OK))
 	    return wadname;
     
     fn = (char*) malloc(strlen("./")+strlen(wadname)+1);
diff -uNr linux-heretic-1.0/soundclient/i_sound.c linux-heretic-1.0.new/soundclient/i_sound.c
--- linux-heretic-1.0/soundclient/i_sound.c	Mon Mar 22 20:22:32 1999
+++ linux-heretic-1.0.new/soundclient/i_sound.c	Fri Oct 15 15:38:14 1999
@@ -377,9 +377,12 @@
 void I_InitSound(void)
 {
 #ifdef SNDSERV
-  char buffer[256];
-  
+  char *buffer = (char *)malloc(256);
+  if (!buffer)
+  	return;
+ 
   sprintf(buffer, "%s", sndserver_filename);
+  find_in_path(&buffer, 256);
   
   /* start sound process */
   if ( !access(buffer, X_OK) )
@@ -393,6 +396,8 @@
     }
   else
     fprintf(stderr, "Could not start sound server [%s]\n", buffer);
+  
+  free(buffer);
 #endif /* SNDSERV */
 }
 
@@ -425,10 +430,14 @@
 void I_InitMusic(void)
 {
 #ifdef MUSSERV
-  char buffer[256];
+  char *buffer = (char *)malloc(256);
   int old_uid=-1;
   
+  if (!buffer)
+  	return;
+  
   sprintf(buffer, "%s", musserver_filename);
+  find_in_path(&buffer, 256);
   
   if (!access(buffer,X_OK)) {
     /* start musserver via popen() (ugly) */
@@ -444,6 +453,7 @@
     
     if (!musserver) {
       fprintf(stderr,"Could not start music server [%s]: %s\n",buffer,strerror(errno));
+      free(buffer);
       return;
     }
 
@@ -461,6 +471,8 @@
   else {
     fprintf(stderr,"Could not start music server [%s]\n",buffer);
   }
+  
+  free(buffer);
 #endif /* MUSSERV */
 }
 
@@ -563,3 +564,39 @@
 {
   return (handle == playing_handle);
 }
+
+void find_in_path(char **filename, int size)
+{
+    char *envhome = getenv("PATH"), *path, *curentry, *fn;
+    
+    if (strchr(*filename, '/') || !envhome)
+        return;
+        
+    if (!(path = strdup(envhome)))
+        return;
+    
+    while (strlen(path))
+        {
+            if (!(curentry = strrchr(path, ':')))
+                curentry = path;
+            else
+                *curentry++ = 0;
+            if (!(fn = (char*)malloc(strlen(curentry)+2+strlen(*filename))))
+                {
+                    free(path);
+                    return;
+                }
+            sprintf(fn, "%s/%s", curentry, *filename);
+            if (!access(fn, X_OK))
+                {
+                    strncpy(*filename, fn, size-1);
+                    free(fn);
+                    free(path);
+                    return;
+                }
+            free(fn);                                
+            *curentry = 0;
+        }
+   free(path);
+}      
+
diff -uNr linux-heretic-1.0/soundclient/i_sound.h linux-heretic-1.0.new/soundclient/i_sound.h
--- linux-heretic-1.0/soundclient/i_sound.h	Tue Apr 13 17:02:58 1999
+++ linux-heretic-1.0.new/soundclient/i_sound.h	Fri Oct 15 15:39:35 1999
@@ -108,5 +108,7 @@
 /* See above (register), then think backwards */
 void I_UnRegisterSong(int handle);
 
+/* Find an executable in the path (for finding servers) */
+void find_in_path(char **filename, int size);
 
 #endif

diff -uNr linux-heretic-1.0/doomtype.h linux-heretic-1.0.new/doomtype.h
--- linux-heretic-1.0/doomtype.h	Thu Apr 15 07:48:55 1999
+++ linux-heretic-1.0.new/doomtype.h	Mon Oct 18 14:58:57 1999
@@ -94,6 +94,11 @@
 #define TRUE 1
 #endif
 
+/* Structure packing */
+#ifndef __PACKED__
+#define __PACKED__
+#endif
+
 #include <sys/types.h>
 
 #endif   /* __DOOMTYPE__ */
