diff options
Diffstat (limited to 'src/net_defs.h')
-rw-r--r-- | src/net_defs.h | 83 |
1 files changed, 77 insertions, 6 deletions
diff --git a/src/net_defs.h b/src/net_defs.h index c2d4d561..bdc8acc2 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; @@ -94,7 +116,7 @@ struct _net_addr_s // packet types -typedef enum +typedef enum { NET_PACKET_TYPE_SYN, NET_PACKET_TYPE_ACK, @@ -111,6 +133,7 @@ typedef enum NET_PACKET_TYPE_CONSOLE_MESSAGE, NET_PACKET_TYPE_QUERY, NET_PACKET_TYPE_QUERY_RESPONSE, + NET_PACKET_TYPE_LAUNCH, } net_packet_type_t; typedef enum @@ -127,7 +150,25 @@ typedef enum NET_MASTER_PACKET_TYPE_SIGN_END_RESPONSE, } net_master_packet_type_t; -typedef struct +// 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; int extratics; @@ -143,6 +184,18 @@ typedef struct int new_sync; int timelimit; int loadgame; + int random; // [Strife only] + + // 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 +204,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 +219,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 +236,21 @@ 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 ready_players; + 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 */ |