diff options
author | Simon Howard | 2008-09-10 18:45:53 +0000 |
---|---|---|
committer | Simon Howard | 2008-09-10 18:45:53 +0000 |
commit | 154d9d8024ffad9027981eb586913d14c6c50d60 (patch) | |
tree | b01a4e3f4d46b2fe8ae3a209aad5b7c0f151e87c | |
parent | 580372cddbb04538da69a3936f670f7128765c4b (diff) | |
download | chocolate-doom-154d9d8024ffad9027981eb586913d14c6c50d60.tar.gz chocolate-doom-154d9d8024ffad9027981eb586913d14c6c50d60.tar.bz2 chocolate-doom-154d9d8024ffad9027981eb586913d14c6c50d60.zip |
Split off game mode/mission/version definitions into common code, along
with various netgame constants.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1218
-rw-r--r-- | src/Makefile.am | 10 | ||||
-rw-r--r-- | src/doom/d_net.h | 5 | ||||
-rw-r--r-- | src/doom/doomdef.h | 50 | ||||
-rw-r--r-- | src/doom/doomstat.h | 3 | ||||
-rw-r--r-- | src/net_common.c | 22 | ||||
-rw-r--r-- | src/net_common.h | 5 | ||||
-rw-r--r-- | src/net_defs.h | 10 | ||||
-rw-r--r-- | src/net_query.c | 1 | ||||
-rw-r--r-- | src/net_server.c | 5 |
9 files changed, 29 insertions, 82 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 75e86850..eb5d4715 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,6 +9,7 @@ AM_CFLAGS = -Idoom -I../textscreen -I../pcsound @SDL_CFLAGS@ @SDLMIXER_CFLAGS@ @ DEDSERV_FILES=\ d_dedicated.c \ +d_mode.c d_mode.h \ i_main.c \ i_timer.c i_timer.h \ m_argv.c m_argv.h \ @@ -27,10 +28,11 @@ chocolate_server_LDADD = @LDFLAGS@ @SDL_LIBS@ @SDLNET_LIBS@ MAIN_SOURCE_FILES=\ d_event.c d_event.h \ -doomkeys.h \ -doomfeatures.h \ -doomtype.h \ -d_ticcmd.h \ + doomkeys.h \ + doomfeatures.h \ + doomtype.h \ +d_mode.c d_mode.h \ + d_ticcmd.h \ i_cdmus.c i_cdmus.h \ i_main.c \ i_joystick.c i_joystick.h \ diff --git a/src/doom/d_net.h b/src/doom/d_net.h index df3d2d4b..6d162d20 100644 --- a/src/doom/d_net.h +++ b/src/doom/d_net.h @@ -30,11 +30,6 @@ #include "d_player.h" -#define MAXNETNODES 8 - -// Networking and tick handling related. -#define BACKUPTICS 128 - extern int extratics; // Create any new ticcmds and broadcast to other players. diff --git a/src/doom/doomdef.h b/src/doom/doomdef.h index 6db199d4..7df8acd5 100644 --- a/src/doom/doomdef.h +++ b/src/doom/doomdef.h @@ -31,7 +31,9 @@ #include <stdio.h> #include <string.h> +#include "doomtype.h" #include "i_timer.h" +#include "d_mode.h" // // Global parameters/defines. @@ -43,42 +45,6 @@ #define DOOM_191_VERSION 111 -// Game mode handling - identify IWAD version -// to handle IWAD dependend animations etc. -typedef enum -{ - shareware, // DOOM 1 shareware, E1, M9 - registered, // DOOM 1 registered, E3, M27 - commercial, // DOOM 2 retail, E1 M34 - // DOOM 2 german edition not handled - retail, // DOOM 1 retail, E4, M36 - indetermined // Well, no IWAD found. - -} GameMode_t; - - -// Mission packs - might be useful for TC stuff? -typedef enum -{ - doom, // DOOM 1 - doom2, // DOOM 2 - pack_tnt, // TNT mission pack - pack_plut, // Plutonia pack - none - -} GameMission_t; - -// What version are we emulating? - -typedef enum -{ - exe_doom_1_9, // Doom 1.9: used for shareware, registered and commercial - exe_ultimate, // Ultimate Doom (retail) - exe_final, // Final Doom - exe_chex, // Chex Quest executable (based on Final Doom) -} GameVersion_t; - - // If rangecheck is undefined, // most parameter validation debugging code will not be compiled #define RANGECHECK @@ -106,18 +72,6 @@ typedef enum // Deaf monsters/do not react to sound. #define MTF_AMBUSH 8 -typedef enum -{ - sk_noitems = -1, // the "-skill 0" hack - sk_baby = 0, - sk_easy, - sk_medium, - sk_hard, - sk_nightmare -} skill_t; - - - // // Key cards. diff --git a/src/doom/doomstat.h b/src/doom/doomstat.h index 2207fb25..eb0f8b5d 100644 --- a/src/doom/doomstat.h +++ b/src/doom/doomstat.h @@ -41,7 +41,10 @@ // We need the playr data structure as well. #include "d_player.h" +// Game mode/mission +#include "d_mode.h" +#include "net_defs.h" diff --git a/src/net_common.c b/src/net_common.c index 80545a91..d1d4390a 100644 --- a/src/net_common.c +++ b/src/net_common.c @@ -21,10 +21,12 @@ // Common code shared between the client and server // +#include <stdio.h> #include <ctype.h> #include <stdlib.h> #include "doomtype.h" +#include "d_mode.h" #include "i_timer.h" #include "net_common.h" @@ -531,24 +533,6 @@ void NET_SafePuts(char *s) putchar('\n'); } -// Check that a gamemode+gamemission received over the network is valid. - -boolean NET_ValidGameMode(GameMode_t mode, GameMission_t mission) -{ - if (mode == shareware || mode == registered || mode == retail) - { - return true; - } - else if (mode == commercial) - { - return mission == doom2 || mission == pack_tnt || mission == pack_plut; - } - else - { - return false; - } -} - // Check that game settings are valid boolean NET_ValidGameSettings(GameMode_t mode, GameMission_t mission, @@ -566,7 +550,7 @@ boolean NET_ValidGameSettings(GameMode_t mode, GameMission_t mission, if (settings->skill < sk_noitems || settings->skill > sk_nightmare) return false; - if (settings->gameversion < exe_doom_1_9 || settings->gameversion > exe_chex) + if (!D_ValidGameVersion(mission, settings->gameversion)) return false; if (mode == shareware || mode == retail || mode == registered) diff --git a/src/net_common.h b/src/net_common.h index 546f4d7a..49a06024 100644 --- a/src/net_common.h +++ b/src/net_common.h @@ -24,11 +24,10 @@ #ifndef NET_COMMON_H #define NET_COMMON_H +#include "d_mode.h" #include "net_defs.h" #include "net_packet.h" -#include "doomdef.h" - typedef enum { // sending syn packets, waiting for an ACK reply @@ -113,8 +112,6 @@ net_packet_t *NET_Conn_NewReliable(net_connection_t *conn, int packet_type); void NET_SafePuts(char *msg); unsigned int NET_ExpandTicNum(unsigned int relative, unsigned int b); - -boolean NET_ValidGameMode(GameMode_t mode, GameMission_t mission); boolean NET_ValidGameSettings(GameMode_t mode, GameMission_t mission, net_gamesettings_t *settings); diff --git a/src/net_defs.h b/src/net_defs.h index 5fc90401..bc7d985b 100644 --- a/src/net_defs.h +++ b/src/net_defs.h @@ -29,10 +29,20 @@ #include "doomtype.h" #include "d_ticcmd.h" +// Absolute maximum number of "nodes" in the game. This is different to +// MAXPLAYERS, as there may be observers that are not participating +// (eg. left/right monitors) + +#define MAXNETNODES 16 + // The maximum number of players, multiplayer/networking. #define MAXPLAYERS 4 +// Networking and tick handling related. + +#define BACKUPTICS 128 + 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_query.c b/src/net_query.c index 72650ac2..b50b4292 100644 --- a/src/net_query.c +++ b/src/net_query.c @@ -22,6 +22,7 @@ // Querying servers to find their current status. // +#include <stdio.h> #include <stdarg.h> #include <stdlib.h> diff --git a/src/net_server.c b/src/net_server.c index 6ad590f3..5e256122 100644 --- a/src/net_server.c +++ b/src/net_server.c @@ -21,6 +21,7 @@ // Network server code // +#include <stdio.h> #include <stdarg.h> #include <stdlib.h> #include <string.h> @@ -28,7 +29,7 @@ #include "config.h" #include "doomtype.h" -#include "doomstat.h" +#include "d_mode.h" #include "i_system.h" #include "i_timer.h" @@ -511,7 +512,7 @@ static void NET_SV_ParseSYN(net_packet_t *packet, return; } - if (!NET_ValidGameMode(cl_gamemode, cl_gamemission)) + if (!D_ValidGameMode(cl_gamemission, cl_gamemode)) { return; } |