foxygit / doom Log in
commit 439a4b158b47c635100b0006470a7ed1e44e29f3
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Sep 6 20:06:14 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Sep 6 20:06:14 2008 +0000

    Remove includes of doomdef.h where possible, move generic parts into top
    level.

    Subversion-branch: /branches/raven-branch
    Subversion-revision: 1204
---
 src/Makefile.am     |   2 +-
 src/deh_ammo.c      |   1 -
 src/deh_cheat.c     |   3 +-
 src/deh_frame.c     |   1 -
 src/deh_main.c      |   4 +-
 src/deh_mapping.c   |   2 +-
 src/deh_misc.c      |   1 -
 src/deh_ptr.c       |   2 +-
 src/deh_sound.c     |   2 +-
 src/deh_text.c      |   3 +-
 src/deh_thing.c     |   2 +-
 src/deh_weapon.c    |   1 -
 src/doom/am_map.c   |   1 +
 src/doom/d_iwad.c   |   1 +
 src/doom/d_player.h |   1 +
 src/doom/doomdef.h  | 110 +---------------------------------------------------
 src/doom/g_game.c   |   1 +
 src/doom/hu_lib.c   |   1 +
 src/doom/hu_stuff.c |   1 +
 src/doom/m_menu.c   |   1 +
 src/doom/r_defs.h   |   1 +
 src/doom/st_stuff.c |   1 +
 src/doomtype.h      |  33 ++++++++++++++++
 src/f_wipe.c        |   2 +-
 src/i_main.c        |   2 +-
 src/i_pcsound.c     |   1 -
 src/i_scale.c       |   4 +-
 src/i_sdlmusic.c    |   2 +-
 src/i_sdlsound.c    |   2 +-
 src/i_system.c      |   2 +-
 src/i_timer.c       |   2 +-
 src/i_timer.h       |   2 +
 src/i_video.c       |   3 +-
 src/i_video.h       |  46 ++++++++++++++--------
 src/m_argv.c        |   2 +-
 src/m_config.c      |   3 +-
 src/m_misc.c        |   2 +-
 src/md5.c           |   1 -
 src/mus2mid.c       |   1 -
 src/net_client.c    |   2 +-
 src/net_client.h    |   1 -
 src/net_common.c    |   2 +-
 src/net_common.h    |   2 +
 src/net_dedicated.c |   2 +
 src/net_defs.h      |   5 ++-
 src/net_gui.c       |   1 +
 src/net_loop.c      |   2 +-
 src/net_sdl.c       |   2 +-
 src/net_server.c    |   2 +-
 src/net_structrw.c  |   2 +-
 src/s_sound.c       |   2 +-
 src/v_video.c       |   2 +-
 src/v_video.h       |   2 -
 src/w_file.c        |   1 -
 src/w_merge.c       |   2 +-
 src/w_wad.c         |   1 -
 src/z_native.c      |   3 +-
 src/z_zone.c        |   2 +-
 58 files changed, 123 insertions(+), 168 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index e4d14ffd..5337c008 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,7 +5,7 @@ gamesdir = $(prefix)/games

 games_PROGRAMS = chocolate-doom chocolate-server

-AM_CFLAGS = -Idoom -I../textscreen -I../pcsound @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@
+AM_CFLAGS = -Idoom -I../textscreen -I../pcsound @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @SDLNET_CFLAGS@ -Werror

 DEDSERV_FILES=\
 d_dedicated.c                              \
diff --git a/src/deh_ammo.c b/src/deh_ammo.c
index 2c6a9022..eb26ef75 100644
--- a/src/deh_ammo.c
+++ b/src/deh_ammo.c
@@ -28,7 +28,6 @@
 #include <stdlib.h>
 #include <string.h>

-#include "doomdef.h"
 #include "doomtype.h"
 #include "deh_defs.h"
 #include "deh_io.h"
diff --git a/src/deh_cheat.c b/src/deh_cheat.c
index f501adbf..d4ea9113 100644
--- a/src/deh_cheat.c
+++ b/src/deh_cheat.c
@@ -24,7 +24,8 @@
 //
 //-----------------------------------------------------------------------------

-#include "doomdef.h"
+#include <stdlib.h>
+
 #include "doomtype.h"

 #include "deh_defs.h"
diff --git a/src/deh_frame.c b/src/deh_frame.c
index 398fa014..3972f8df 100644
--- a/src/deh_frame.c
+++ b/src/deh_frame.c
@@ -26,7 +26,6 @@

 #include <stdlib.h>

-#include "doomdef.h"
 #include "doomtype.h"
 #include "d_items.h"
 #include "info.h"
diff --git a/src/deh_main.c b/src/deh_main.c
index b70a3384..9d528b0a 100644
--- a/src/deh_main.c
+++ b/src/deh_main.c
@@ -24,9 +24,11 @@
 //
 //-----------------------------------------------------------------------------

+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <ctype.h>

-#include "doomdef.h"
 #include "doomtype.h"
 #include "d_iwad.h"
 #include "m_argv.h"
diff --git a/src/deh_mapping.c b/src/deh_mapping.c
index c1466031..b215b128 100644
--- a/src/deh_mapping.c
+++ b/src/deh_mapping.c
@@ -30,7 +30,7 @@
 #include <stdlib.h>
 #include <string.h>

-#include "doomdef.h"
+#include "doomtype.h"
 #include "i_system.h"
 #include "deh_mapping.h"

diff --git a/src/deh_misc.c b/src/deh_misc.c
index c8107858..b57d0ef0 100644
--- a/src/deh_misc.c
+++ b/src/deh_misc.c
@@ -27,7 +27,6 @@
 #include <stdlib.h>
 #include <string.h>

-#include "doomdef.h"
 #include "doomtype.h"
 #include "deh_defs.h"
 #include "deh_io.h"
diff --git a/src/deh_ptr.c b/src/deh_ptr.c
index a819ddc0..87daf7d8 100644
--- a/src/deh_ptr.c
+++ b/src/deh_ptr.c
@@ -24,10 +24,10 @@
 //
 //-----------------------------------------------------------------------------

+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

-#include "doomdef.h"
 #include "doomtype.h"
 #include "info.h"

diff --git a/src/deh_sound.c b/src/deh_sound.c
index 4a13d0ca..b28154d9 100644
--- a/src/deh_sound.c
+++ b/src/deh_sound.c
@@ -24,9 +24,9 @@
 //
 //-----------------------------------------------------------------------------

+#include <stdio.h>
 #include <stdlib.h>

-#include "doomdef.h"
 #include "doomfeatures.h"
 #include "doomtype.h"
 #include "deh_defs.h"
diff --git a/src/deh_text.c b/src/deh_text.c
index ff5e2d70..853e30e4 100644
--- a/src/deh_text.c
+++ b/src/deh_text.c
@@ -24,7 +24,8 @@
 //
 //-----------------------------------------------------------------------------

-#include "doomdef.h"
+#include <string.h>
+
 #include "doomtype.h"

 #include "z_zone.h"
diff --git a/src/deh_thing.c b/src/deh_thing.c
index 4823dc76..5400ae60 100644
--- a/src/deh_thing.c
+++ b/src/deh_thing.c
@@ -24,9 +24,9 @@
 //
 //-----------------------------------------------------------------------------

+#include <stdio.h>
 #include <stdlib.h>

-#include "doomdef.h"
 #include "doomtype.h"

 #include "deh_defs.h"
diff --git a/src/deh_weapon.c b/src/deh_weapon.c
index cc525ee3..7ffa159a 100644
--- a/src/deh_weapon.c
+++ b/src/deh_weapon.c
@@ -27,7 +27,6 @@
 #include <stdlib.h>
 #include <string.h>

-#include "doomdef.h"
 #include "doomtype.h"

 #include "d_items.h"
diff --git a/src/doom/am_map.c b/src/doom/am_map.c
index 5fbe748a..9b662ac2 100644
--- a/src/doom/am_map.c
+++ b/src/doom/am_map.c
@@ -30,6 +30,7 @@
 #include "deh_main.h"

 #include "z_zone.h"
+#include "doomkeys.h"
 #include "doomdef.h"
 #include "st_stuff.h"
 #include "p_local.h"
diff --git a/src/doom/d_iwad.c b/src/doom/d_iwad.c
index 032679e6..dcf2651a 100644
--- a/src/doom/d_iwad.c
+++ b/src/doom/d_iwad.c
@@ -30,6 +30,7 @@
 #include <string.h>

 #include "deh_main.h"
+#include "doomkeys.h"
 #include "doomdef.h"
 #include "doomstat.h"
 #include "i_system.h"
diff --git a/src/doom/d_player.h b/src/doom/d_player.h
index 46b9b6c0..8bdccf46 100644
--- a/src/doom/d_player.h
+++ b/src/doom/d_player.h
@@ -45,6 +45,7 @@
 // as commands per game tick.
 #include "d_ticcmd.h"

+#include "net_defs.h"



diff --git a/src/doom/doomdef.h b/src/doom/doomdef.h
index 52964242..6db199d4 100644
--- a/src/doom/doomdef.h
+++ b/src/doom/doomdef.h
@@ -31,38 +31,7 @@
 #include <stdio.h>
 #include <string.h>

-// #define macros to provide functions missing in Windows.
-// Outside Windows, we use strings.h for str[n]casecmp.
-
-
-#ifdef _WIN32
-
-#define snprintf _snprintf
-#define vsnprintf _vsnprintf
-#define strcasecmp stricmp
-#define strncasecmp strnicmp
-
-#else
-
-#include <strings.h>
-
-#endif
-
-
-//
-// The packed attribute forces structures to be packed into the minimum
-// space necessary.  If this is not done, the compiler may align structure
-// fields differently to optimise memory access, inflating the overall
-// structure size.  It is important to use the packed attribute on certain
-// structures where alignment is important, particularly data read/written
-// to disk.
-//
-
-#ifdef __GNUC__
-#define PACKEDATTR __attribute__((packed))
-#else
-#define PACKEDATTR
-#endif
+#include "i_timer.h"

 //
 // Global parameters/defines.
@@ -114,27 +83,6 @@ typedef enum
 // most parameter validation debugging code will not be compiled
 #define RANGECHECK

-
-
-// Screen width and height.
-
-#define SCREENWIDTH  320
-#define SCREENHEIGHT 200
-
-// Screen width used for "squash" scale functions
-
-#define SCREENWIDTH_4_3 256
-
-// Screen height used for "stretch" scale functions.
-
-#define SCREENHEIGHT_4_3 240
-
-// The maximum number of players, multiplayer/networking.
-#define MAXPLAYERS		4
-
-// State updates, number of tics / second.
-#define TICRATE		35
-
 // The current state of the game: whether we are
 // playing, gazing at the intermission screen,
 // the game final animation, or a demo.
@@ -254,59 +202,5 @@ typedef enum

 } powerduration_t;

-
-// fraggle: moved key definitions to a separate file
-
-#include "doomkeys.h"
-
-
-// DOOM basic types (boolean),
-//  and max/min values.
-//#include "doomtype.h"
-
-// Fixed point.
-//#include "m_fixed.h"
-
-// Endianess handling.
-//#include "m_swap.h"
-
-
-// Binary Angles, sine/cosine/atan lookups.
-//#include "tables.h"
-
-// Event type.
-//#include "d_event.h"
-
-// Game function, skills.
-//#include "g_game.h"
-
-// All external data is defined here.
-//#include "doomdata.h"
-
-// All important printed strings.
-// Language selection (message strings).
-//#include "dstrings.h"
-
-// Player is a special actor.
-//struct player_s;
-
-
-//#include "d_items.h"
-//#include "d_player.h"
-//#include "p_mobj.h"
-//#include "d_net.h"
-
-// PLAY
-//#include "p_tick.h"
-
-
-
-
-// Header, generated by sound utility.
-// The utility was written by Dave Taylor.
-//#include "sounds.h"
-
-
-
-
 #endif          // __DOOMDEF__
+
diff --git a/src/doom/g_game.c b/src/doom/g_game.c
index 44e77a74..978f38ee 100644
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -30,6 +30,7 @@
 #include <math.h>

 #include "doomdef.h"
+#include "doomkeys.h"
 #include "doomstat.h"

 #include "deh_main.h"
diff --git a/src/doom/hu_lib.c b/src/doom/hu_lib.c
index a6b00f3f..5d8428ba 100644
--- a/src/doom/hu_lib.c
+++ b/src/doom/hu_lib.c
@@ -27,6 +27,7 @@
 #include <ctype.h>

 #include "doomdef.h"
+#include "doomkeys.h"

 #include "v_video.h"
 #include "i_swap.h"
diff --git a/src/doom/hu_stuff.c b/src/doom/hu_stuff.c
index 886236ba..ace4cef2 100644
--- a/src/doom/hu_stuff.c
+++ b/src/doom/hu_stuff.c
@@ -27,6 +27,7 @@
 #include <ctype.h>

 #include "doomdef.h"
+#include "doomkeys.h"

 #include "z_zone.h"

diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index aab2afce..67bcd125 100644
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -31,6 +31,7 @@


 #include "doomdef.h"
+#include "doomkeys.h"
 #include "dstrings.h"

 #include "d_main.h"
diff --git a/src/doom/r_defs.h b/src/doom/r_defs.h
index 4e0d85b7..fe3517c2 100644
--- a/src/doom/r_defs.h
+++ b/src/doom/r_defs.h
@@ -42,6 +42,7 @@
 // SECTORS do store MObjs anyway.
 #include "p_mobj.h"

+#include "i_video.h"



diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c
index f92d2dda..22d98685 100644
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -39,6 +39,7 @@
 #include "deh_main.h"
 #include "deh_misc.h"
 #include "doomdef.h"
+#include "doomkeys.h"

 #include "g_game.h"

diff --git a/src/doomtype.h b/src/doomtype.h
index 2c9680b3..0adc5fab 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -29,6 +29,39 @@
 #ifndef __DOOMTYPE__
 #define __DOOMTYPE__

+// #define macros to provide functions missing in Windows.
+// Outside Windows, we use strings.h for str[n]casecmp.
+
+
+#ifdef _WIN32
+
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#define strcasecmp stricmp
+#define strncasecmp strnicmp
+
+#else
+
+#include <strings.h>
+
+#endif
+
+
+//
+// The packed attribute forces structures to be packed into the minimum
+// space necessary.  If this is not done, the compiler may align structure
+// fields differently to optimise memory access, inflating the overall
+// structure size.  It is important to use the packed attribute on certain
+// structures where alignment is important, particularly data read/written
+// to disk.
+//
+
+#ifdef __GNUC__
+#define PACKEDATTR __attribute__((packed))
+#else
+#define PACKEDATTR
+#endif
+
 // C99 integer types; with gcc we just use this.  Other compilers
 // should add conditional statements that define the C99 types.

diff --git a/src/f_wipe.c b/src/f_wipe.c
index a3fe1fb3..aeb27f12 100644
--- a/src/f_wipe.c
+++ b/src/f_wipe.c
@@ -33,7 +33,7 @@
 #include "v_video.h"
 #include "m_random.h"

-#include "doomdef.h"
+#include "doomtype.h"

 #include "f_wipe.h"

diff --git a/src/i_main.c b/src/i_main.c
index 748a72be..0ba37d11 100644
--- a/src/i_main.c
+++ b/src/i_main.c
@@ -34,7 +34,7 @@
 #include <windows.h>
 #endif

-#include "doomdef.h"
+#include "doomtype.h"
 #include "i_system.h"
 #include "m_argv.h"
 #include "d_main.h"
diff --git a/src/i_pcsound.c b/src/i_pcsound.c
index c2c77fe7..620acf39 100644
--- a/src/i_pcsound.c
+++ b/src/i_pcsound.c
@@ -25,7 +25,6 @@

 #include "SDL.h"

-#include "doomdef.h"
 #include "doomtype.h"

 #include "deh_main.h"
diff --git a/src/i_scale.c b/src/i_scale.c
index a022ab15..de6eefc5 100644
--- a/src/i_scale.c
+++ b/src/i_scale.c
@@ -26,7 +26,9 @@
 //
 //-----------------------------------------------------------------------------

-#include "doomdef.h"
+#include <stdlib.h>
+#include <string.h>
+
 #include "doomtype.h"

 #include "i_video.h"
diff --git a/src/i_sdlmusic.c b/src/i_sdlmusic.c
index 313e2a58..2e4562ab 100644
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -30,7 +30,7 @@
 #include "SDL.h"
 #include "SDL_mixer.h"

-#include "doomdef.h"
+#include "doomtype.h"
 #include "memio.h"
 #include "mus2mid.h"

diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c
index b6fc9787..6f765be4 100644
--- a/src/i_sdlsound.c
+++ b/src/i_sdlsound.c
@@ -45,7 +45,7 @@
 #include "w_wad.h"
 #include "z_zone.h"

-#include "doomdef.h"
+#include "doomtype.h"

 #define LOW_PASS_FILTER
 #define NUM_CHANNELS 16
diff --git a/src/i_system.c b/src/i_system.c
index fe596a60..cbf9760a 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -39,7 +39,7 @@
 #endif

 #include "deh_main.h"
-#include "doomdef.h"
+#include "doomtype.h"
 #include "doomstat.h"
 #include "m_argv.h"
 #include "m_config.h"
diff --git a/src/i_timer.c b/src/i_timer.c
index 5fd7fba9..8ae68b82 100644
--- a/src/i_timer.c
+++ b/src/i_timer.c
@@ -27,7 +27,7 @@
 #include "SDL.h"

 #include "i_timer.h"
-#include "doomdef.h"
+#include "doomtype.h"

 //
 // I_GetTime
diff --git a/src/i_timer.h b/src/i_timer.h
index 83ccecc9..85816064 100644
--- a/src/i_timer.h
+++ b/src/i_timer.h
@@ -28,6 +28,8 @@
 #ifndef __I_TIMER__
 #define __I_TIMER__

+#define TICRATE 35
+
 // Called by D_DoomLoop,
 // returns current time in tics.
 int I_GetTime (void);
diff --git a/src/i_video.c b/src/i_video.c
index 0fe25736..cbfc4b4c 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -34,7 +34,8 @@

 #include "config.h"
 #include "deh_main.h"
-#include "doomdef.h"
+#include "doomtype.h"
+#include "doomkeys.h"
 #include "doomstat.h"
 #include "d_main.h"
 #include "i_joystick.h"
diff --git a/src/i_video.h b/src/i_video.h
index bd5de24a..3e871d5c 100644
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -28,33 +28,45 @@
 #ifndef __I_VIDEO__
 #define __I_VIDEO__

-
 #include "doomtype.h"

+// Screen width and height.
+
+#define SCREENWIDTH  320
+#define SCREENHEIGHT 200
+
+// Screen width used for "squash" scale functions
+
+#define SCREENWIDTH_4_3 256
+
+// Screen height used for "stretch" scale functions.
+
+#define SCREENHEIGHT_4_3 240
+
 typedef struct
 {
-        // Screen width and height
+    // Screen width and height

-        int width;
-        int height;
+    int width;
+    int height;

-        // Initialisation function to call when using this mode.
-        // Called with a pointer to the Doom palette.
-        //
-        // If NULL, no init function is called.
+    // Initialisation function to call when using this mode.
+    // Called with a pointer to the Doom palette.
+    //
+    // If NULL, no init function is called.

-        void (*InitMode)(byte *palette);
-
-        // Function to call to draw the screen from the source buffer.
-        // Return true if draw was successful.
+    void (*InitMode)(byte *palette);
+
+    // Function to call to draw the screen from the source buffer.
+    // Return true if draw was successful.

-        boolean (*DrawScreen)(int x1, int y1, int x2, int y2);
+    boolean (*DrawScreen)(int x1, int y1, int x2, int y2);

-        // If true, this is a "poor quality" mode.  The autoadjust
-        // code should always attempt to use a different mode to this
-        // mode in fullscreen.
+    // If true, this is a "poor quality" mode.  The autoadjust
+    // code should always attempt to use a different mode to this
+    // mode in fullscreen.

-        boolean poor_quality;
+    boolean poor_quality;
 } screen_mode_t;

 // Called by D_DoomMain,
diff --git a/src/m_argv.c b/src/m_argv.c
index 78404d35..bcfaa3da 100644
--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include <string.h>

-#include "doomdef.h"
+#include "doomtype.h"
 #include "i_system.h"
 #include "m_misc.h"

diff --git a/src/m_config.c b/src/m_config.c
index 4066cb3c..bea255d2 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -33,7 +33,8 @@

 #include "config.h"
 #include "deh_main.h"
-#include "doomdef.h"
+#include "doomtype.h"
+#include "doomkeys.h"
 #include "doomfeatures.h"

 #include "z_zone.h"
diff --git a/src/m_misc.c b/src/m_misc.c
index acab0a5b..88519b3c 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -42,7 +42,7 @@
 #include <sys/types.h>
 #endif

-#include "doomdef.h"
+#include "doomtype.h"
 #include "doomstat.h"

 #include "deh_main.h"
diff --git a/src/md5.c b/src/md5.c
index fb99e2f7..2b184f98 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -20,7 +20,6 @@
  * Still in the public domain.
  */

-#include "doomdef.h"
 #include "i_swap.h"

 #include <string.h>             /* for memcpy() */
diff --git a/src/mus2mid.c b/src/mus2mid.c
index 66051bae..8ba1a5ff 100644
--- a/src/mus2mid.c
+++ b/src/mus2mid.c
@@ -25,7 +25,6 @@

 #include <stdio.h>

-#include "doomdef.h"
 #include "doomtype.h"
 #include "i_swap.h"

diff --git a/src/net_client.c b/src/net_client.c
index 36dafe7a..26cd2133 100644
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -26,7 +26,7 @@
 #include <string.h>

 #include "config.h"
-#include "doomdef.h"
+#include "doomtype.h"
 #include "doomstat.h"
 #include "deh_main.h"
 #include "g_game.h"
diff --git a/src/net_client.h b/src/net_client.h
index 7c124e3f..991c542b 100644
--- a/src/net_client.h
+++ b/src/net_client.h
@@ -24,7 +24,6 @@
 #ifndef NET_CLIENT_H
 #define NET_CLIENT_H

-#include "doomdef.h"
 #include "doomtype.h"
 #include "d_ticcmd.h"
 #include "md5.h"
diff --git a/src/net_common.c b/src/net_common.c
index 5af6aaa7..80545a91 100644
--- a/src/net_common.c
+++ b/src/net_common.c
@@ -24,7 +24,7 @@
 #include <ctype.h>
 #include <stdlib.h>

-#include "doomdef.h"
+#include "doomtype.h"
 #include "i_timer.h"

 #include "net_common.h"
diff --git a/src/net_common.h b/src/net_common.h
index 885ee44d..546f4d7a 100644
--- a/src/net_common.h
+++ b/src/net_common.h
@@ -27,6 +27,8 @@
 #include "net_defs.h"
 #include "net_packet.h"

+#include "doomdef.h"
+
 typedef enum
 {
     // sending syn packets, waiting for an ACK reply
diff --git a/src/net_dedicated.c b/src/net_dedicated.c
index 6a153300..ae710c8e 100644
--- a/src/net_dedicated.c
+++ b/src/net_dedicated.c
@@ -23,6 +23,8 @@
 // Dedicated server code.
 //

+#include <stdlib.h>
+
 #include "doomtype.h"

 #include "i_system.h"
diff --git a/src/net_defs.h b/src/net_defs.h
index c575020f..5fc90401 100644
--- a/src/net_defs.h
+++ b/src/net_defs.h
@@ -26,10 +26,13 @@
 #ifndef NET_DEFS_H
 #define NET_DEFS_H

-#include "doomdef.h"
 #include "doomtype.h"
 #include "d_ticcmd.h"

+// The maximum number of players, multiplayer/networking.
+
+#define MAXPLAYERS		4
+
 typedef struct _net_module_s net_module_t;
 typedef struct _net_packet_s net_packet_t;
 typedef struct _net_addr_s net_addr_t;
diff --git a/src/net_gui.c b/src/net_gui.c
index 9816346b..4cbe0699 100644
--- a/src/net_gui.c
+++ b/src/net_gui.c
@@ -29,6 +29,7 @@

 #include "config.h"
 #include "doomstat.h"
+#include "doomkeys.h"

 #include "i_system.h"
 #include "i_timer.h"
diff --git a/src/net_loop.c b/src/net_loop.c
index 890dcbf2..825609d9 100644
--- a/src/net_loop.c
+++ b/src/net_loop.c
@@ -26,7 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>

-#include "doomdef.h"
+#include "doomtype.h"
 #include "i_system.h"
 #include "net_defs.h"
 #include "net_loop.h"
diff --git a/src/net_sdl.c b/src/net_sdl.c
index 92606fac..db129853 100644
--- a/src/net_sdl.c
+++ b/src/net_sdl.c
@@ -27,7 +27,7 @@
 #include <string.h>
 #include <stdio.h>

-#include "doomdef.h"
+#include "doomtype.h"
 #include "i_system.h"
 #include "m_argv.h"
 #include "net_defs.h"
diff --git a/src/net_server.c b/src/net_server.c
index a90ed4fd..6ad590f3 100644
--- a/src/net_server.c
+++ b/src/net_server.c
@@ -27,7 +27,7 @@

 #include "config.h"

-#include "doomdef.h"
+#include "doomtype.h"
 #include "doomstat.h"
 #include "i_system.h"
 #include "i_timer.h"
diff --git a/src/net_structrw.c b/src/net_structrw.c
index c2e878fa..43263061 100644
--- a/src/net_structrw.c
+++ b/src/net_structrw.c
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 #include <string.h>

-#include "doomdef.h"
+#include "doomtype.h"

 #include "net_packet.h"
 #include "net_structrw.h"
diff --git a/src/s_sound.c b/src/s_sound.c
index 70fa75f3..f3f6bf1f 100644
--- a/src/s_sound.c
+++ b/src/s_sound.c
@@ -32,7 +32,7 @@
 #include "deh_main.h"

 #include "doomstat.h"
-#include "doomdef.h"
+#include "doomtype.h"

 #include "sounds.h"
 #include "s_sound.h"
diff --git a/src/v_video.c b/src/v_video.c
index 82d9f357..07908f84 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -32,7 +32,7 @@
 #include "i_system.h"
 #include "r_local.h"

-#include "doomdef.h"
+#include "doomtype.h"
 #include "doomdata.h"

 #include "deh_main.h"
diff --git a/src/v_video.h b/src/v_video.h
index 3782b4eb..c9b10db8 100644
--- a/src/v_video.h
+++ b/src/v_video.h
@@ -32,8 +32,6 @@

 #include "doomtype.h"

-#include "doomdef.h"
-
 // Needed because we are refering to patches.
 #include "r_data.h"

diff --git a/src/w_file.c b/src/w_file.c
index bd1a99bd..05532a68 100644
--- a/src/w_file.c
+++ b/src/w_file.c
@@ -26,7 +26,6 @@

 #include "config.h"

-#include "doomdef.h"
 #include "doomtype.h"
 #include "m_argv.h"

diff --git a/src/w_merge.c b/src/w_merge.c
index 372b3583..d033eef1 100644
--- a/src/w_merge.c
+++ b/src/w_merge.c
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include <string.h>

-#include "doomdef.h"
+#include "doomtype.h"
 #include "i_system.h"
 #include "w_merge.h"
 #include "w_wad.h"
diff --git a/src/w_wad.c b/src/w_wad.c
index 9425705c..8fa46cd7 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -32,7 +32,6 @@
 #include <stdlib.h>
 #include <string.h>

-#include "doomdef.h"
 #include "doomtype.h"

 #include "i_swap.h"
diff --git a/src/z_native.c b/src/z_native.c
index 199c9426..7d31bc6c 100644
--- a/src/z_native.c
+++ b/src/z_native.c
@@ -29,10 +29,11 @@


 #include <stdlib.h>
+#include <string.h>

 #include "z_zone.h"
 #include "i_system.h"
-#include "doomdef.h"
+#include "doomtype.h"

 #define ZONEID	0x1d4a11

diff --git a/src/z_zone.c b/src/z_zone.c
index f0b8ad53..54a5ffc5 100644
--- a/src/z_zone.c
+++ b/src/z_zone.c
@@ -27,7 +27,7 @@

 #include "z_zone.h"
 #include "i_system.h"
-#include "doomdef.h"
+#include "doomtype.h"


 //