diff options
Diffstat (limited to 'src/net_defs.h')
-rw-r--r-- | src/net_defs.h | 76 |
1 files changed, 72 insertions, 4 deletions
diff --git a/src/net_defs.h b/src/net_defs.h index c2d4d561..ba50f48e 100644 --- a/src/net_defs.h +++ b/src/net_defs.h @@ -26,9 +26,31 @@ #ifndef NET_DEFS_H #define NET_DEFS_H -#include "doomdef.h" +#include <stdio.h> + #include "doomtype.h" #include "d_ticcmd.h" +#include "sha1.h" + +// Absolute maximum number of "nodes" in the game. This is different to +// NET_MAXPLAYERS, as there may be observers that are not participating +// (eg. left/right monitors) + +#define MAXNETNODES 16 + +// The maximum number of players, multiplayer/networking. +// This is the maximum supported by the networking code; individual games +// have their own values for MAXPLAYERS that can be smaller. + +#define NET_MAXPLAYERS 8 + +// Maximum length of a player's name. + +#define MAXPLAYERNAME 30 + +// Networking and tick handling related. + +#define BACKUPTICS 128 typedef struct _net_module_s net_module_t; typedef struct _net_packet_s net_packet_t; @@ -127,6 +149,24 @@ typedef enum NET_MASTER_PACKET_TYPE_SIGN_END_RESPONSE, } net_master_packet_type_t; +// Settings specified when the client connects to the server. + +typedef struct +{ + int gamemode; + int gamemission; + int lowres_turn; + int drone; + int max_players; + int is_freedoom; + sha1_digest_t wad_sha1sum; + sha1_digest_t deh_sha1sum; + int player_class; +} net_connect_data_t; + +// Game settings sent by client to server when initiating game start, +// and received from the server by clients when the game starts. + typedef struct { int ticdup; @@ -143,6 +183,17 @@ typedef struct int new_sync; int timelimit; int loadgame; + + // These fields are only used by the server when sending a game + // start message: + + int num_players; + int consoleplayer; + + // Hexen player classes: + + int player_classes[NET_MAXPLAYERS]; + } net_gamesettings_t; #define NET_TICDIFF_FORWARD (1 << 0) @@ -151,6 +202,8 @@ typedef struct #define NET_TICDIFF_BUTTONS (1 << 3) #define NET_TICDIFF_CONSISTANCY (1 << 4) #define NET_TICDIFF_CHATCHAR (1 << 5) +#define NET_TICDIFF_RAVEN (1 << 6) +#define NET_TICDIFF_STRIFE (1 << 7) typedef struct { @@ -164,8 +217,8 @@ typedef struct { signed int latency; unsigned int seq; - boolean playeringame[MAXPLAYERS]; - net_ticdiff_t cmds[MAXPLAYERS]; + boolean playeringame[NET_MAXPLAYERS]; + net_ticdiff_t cmds[NET_MAXPLAYERS]; } net_full_ticcmd_t; // Data sent in response to server queries @@ -181,5 +234,20 @@ typedef struct char *description; } net_querydata_t; -#endif /* #ifndef NET_DEFS_H */ +// Data sent by the server while waiting for the game to start. +typedef struct +{ + int num_players; + int num_drones; + int max_players; + int is_controller; + int consoleplayer; + char player_names[NET_MAXPLAYERS][MAXPLAYERNAME]; + char player_addrs[NET_MAXPLAYERS][MAXPLAYERNAME]; + sha1_digest_t wad_sha1sum; + sha1_digest_t deh_sha1sum; + int is_freedoom; +} net_waitdata_t; + +#endif /* #ifndef NET_DEFS_H */ |