2014-03-15 16:59:03 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2020-02-19 22:08:45 +00:00
|
|
|
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file d_clisrv.h
|
|
|
|
/// \brief high level networking stuff
|
|
|
|
|
|
|
|
#ifndef __D_CLISRV__
|
|
|
|
#define __D_CLISRV__
|
|
|
|
|
|
|
|
#include "d_ticcmd.h"
|
|
|
|
#include "d_netcmd.h"
|
2019-10-19 15:09:18 +00:00
|
|
|
#include "d_net.h"
|
2014-03-15 16:59:03 +00:00
|
|
|
#include "tables.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
|
2019-12-26 04:44:25 +00:00
|
|
|
/*
|
2020-04-13 00:05:18 +00:00
|
|
|
The 'packet version' is used to distinguish packet formats.
|
|
|
|
This version is independent of VERSION and SUBVERSION. Different
|
|
|
|
applications may follow different packet versions.
|
2019-12-26 04:44:25 +00:00
|
|
|
*/
|
2020-02-22 01:17:21 +00:00
|
|
|
#define PACKETVERSION 3
|
2019-12-26 04:44:25 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// Network play related stuff.
|
|
|
|
// There is a data struct that stores network
|
|
|
|
// communication related stuff, and another
|
|
|
|
// one that defines the actual packets to
|
|
|
|
// be transmitted.
|
|
|
|
|
|
|
|
// Networking and tick handling related.
|
2020-05-18 10:35:55 +00:00
|
|
|
#define BACKUPTICS 1024
|
2020-05-18 09:34:09 +00:00
|
|
|
#define CLIENTBACKUPTICS 32
|
2014-03-15 16:59:03 +00:00
|
|
|
#define MAXTEXTCMD 256
|
|
|
|
//
|
|
|
|
// Packet structure
|
|
|
|
//
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
PT_NOTHING, // To send a nop through the network. ^_~
|
|
|
|
PT_SERVERCFG, // Server config used in start game
|
|
|
|
// (must stay 1 for backwards compatibility).
|
|
|
|
// This is a positive response to a CLIENTJOIN request.
|
|
|
|
PT_CLIENTCMD, // Ticcmd of the client.
|
|
|
|
PT_CLIENTMIS, // Same as above with but saying resend from.
|
|
|
|
PT_CLIENT2CMD, // 2 cmds in the packet for splitscreen.
|
|
|
|
PT_CLIENT2MIS, // Same as above with but saying resend from
|
|
|
|
PT_NODEKEEPALIVE, // Same but without ticcmd and consistancy
|
|
|
|
PT_NODEKEEPALIVEMIS,
|
|
|
|
PT_SERVERTICS, // All cmds for the tic.
|
|
|
|
PT_SERVERREFUSE, // Server refuses joiner (reason inside).
|
|
|
|
PT_SERVERSHUTDOWN,
|
|
|
|
PT_CLIENTQUIT, // Client closes the connection.
|
|
|
|
|
|
|
|
PT_ASKINFO, // Anyone can ask info of the server.
|
|
|
|
PT_SERVERINFO, // Send game & server info (gamespy).
|
|
|
|
PT_PLAYERINFO, // Send information for players in game (gamespy).
|
|
|
|
PT_REQUESTFILE, // Client requests a file transfer
|
|
|
|
PT_ASKINFOVIAMS, // Packet from the MS requesting info be sent to new client.
|
|
|
|
// If this ID changes, update masterserver definition.
|
2014-03-21 18:42:55 +00:00
|
|
|
PT_RESYNCHEND, // Player is now resynched and is being requested to remake the gametic
|
|
|
|
PT_RESYNCHGET, // Player got resynch packet
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2020-01-22 22:08:57 +00:00
|
|
|
PT_SENDINGLUAFILE, // Server telling a client Lua needs to open a file
|
|
|
|
PT_ASKLUAFILE, // Client telling the server they don't have the file
|
|
|
|
PT_HASLUAFILE, // Client telling the server they have the file
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// Add non-PT_CANFAIL packet types here to avoid breaking MS compatibility.
|
|
|
|
|
|
|
|
PT_CANFAIL, // This is kind of a priority. Anything bigger than CANFAIL
|
2016-12-31 18:26:33 +00:00
|
|
|
// allows HSendPacket(*, true, *, *) to return false.
|
2014-03-15 16:59:03 +00:00
|
|
|
// In addition, this packet can't occupy all the available slots.
|
|
|
|
|
|
|
|
PT_FILEFRAGMENT = PT_CANFAIL, // A part of a file.
|
2020-05-16 20:09:00 +00:00
|
|
|
PT_FILEACK,
|
|
|
|
PT_FILERECEIVED,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
PT_TEXTCMD, // Extra text commands from the client.
|
|
|
|
PT_TEXTCMD2, // Splitscreen text commands.
|
|
|
|
PT_CLIENTJOIN, // Client wants to join; used in start game.
|
|
|
|
PT_NODETIMEOUT, // Packet sent to self if the connection times out.
|
2014-03-21 18:42:55 +00:00
|
|
|
PT_RESYNCHING, // Packet sent to resync players.
|
|
|
|
// Blocks game advance until synched.
|
2019-07-15 22:39:58 +00:00
|
|
|
|
|
|
|
PT_LOGIN, // Login attempt from the client.
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
PT_PING, // Packet sent to tell clients the other client's latency to server.
|
|
|
|
NUMPACKETTYPE
|
|
|
|
} packettype_t;
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
#ifdef PACKETDROP
|
|
|
|
void Command_Drop(void);
|
|
|
|
void Command_Droprate(void);
|
|
|
|
#endif
|
2017-01-14 18:24:22 +00:00
|
|
|
#ifdef _DEBUG
|
2017-01-13 19:53:52 +00:00
|
|
|
void Command_Numnodes(void);
|
|
|
|
#endif
|
2016-12-31 18:26:33 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#pragma pack(1)
|
|
|
|
#endif
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
// Client to server packet
|
2014-03-15 16:59:03 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT8 client_tic;
|
|
|
|
UINT8 resendfrom;
|
|
|
|
INT16 consistancy;
|
|
|
|
ticcmd_t cmd;
|
|
|
|
} ATTRPACK clientcmd_pak;
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
// Splitscreen packet
|
2014-03-15 16:59:03 +00:00
|
|
|
// WARNING: must have the same format of clientcmd_pak, for more easy use
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT8 client_tic;
|
|
|
|
UINT8 resendfrom;
|
|
|
|
INT16 consistancy;
|
|
|
|
ticcmd_t cmd, cmd2;
|
|
|
|
} ATTRPACK client2cmd_pak;
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(disable : 4200)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Server to client packet
|
|
|
|
// this packet is too large
|
|
|
|
typedef struct
|
|
|
|
{
|
2020-05-17 18:09:11 +00:00
|
|
|
tic_t starttic;
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT8 numtics;
|
|
|
|
UINT8 numslots; // "Slots filled": Highest player number in use plus one.
|
2016-12-31 18:26:33 +00:00
|
|
|
ticcmd_t cmds[45]; // Normally [BACKUPTIC][MAXPLAYERS] but too large
|
2014-03-15 16:59:03 +00:00
|
|
|
} ATTRPACK servertics_pak;
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
// Sent to client when all consistency data
|
2014-03-21 18:42:55 +00:00
|
|
|
// for players has been restored
|
2014-03-15 16:59:03 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT32 randomseed;
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
// CTF flag stuff
|
2014-03-21 18:42:55 +00:00
|
|
|
SINT8 flagplayer[2];
|
|
|
|
INT32 flagloose[2];
|
|
|
|
INT32 flagflags[2];
|
|
|
|
fixed_t flagx[2];
|
|
|
|
fixed_t flagy[2];
|
|
|
|
fixed_t flagz[2];
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT32 ingame; // Spectator bit for each player
|
2017-07-03 14:43:29 +00:00
|
|
|
UINT32 outofcoop; // outofcoop bit for each player
|
2017-01-03 22:43:46 +00:00
|
|
|
INT32 ctfteam[MAXPLAYERS]; // Which team? (can't be 1 bit, since in regular Match there are no teams)
|
2014-03-21 18:42:55 +00:00
|
|
|
|
|
|
|
// Resynch game scores and the like all at once
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT32 score[MAXPLAYERS]; // Everyone's score
|
2014-03-21 18:42:55 +00:00
|
|
|
INT16 numboxes[MAXPLAYERS];
|
|
|
|
INT16 totalring[MAXPLAYERS];
|
|
|
|
tic_t realtime[MAXPLAYERS];
|
|
|
|
UINT8 laps[MAXPLAYERS];
|
|
|
|
} ATTRPACK resynchend_pak;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2014-03-21 18:42:55 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2016-12-31 18:26:33 +00:00
|
|
|
// Player stuff
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT8 playernum;
|
|
|
|
|
2014-03-21 18:42:55 +00:00
|
|
|
// Do not send anything visual related.
|
|
|
|
// Only send data that we need to know for physics.
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT8 playerstate; // playerstate_t
|
|
|
|
UINT32 pflags; // pflags_t
|
|
|
|
UINT8 panim; // panim_t
|
2014-03-21 18:42:55 +00:00
|
|
|
|
2020-05-28 09:03:35 +00:00
|
|
|
INT16 angleturn;
|
|
|
|
INT16 oldrelangleturn;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
angle_t aiming;
|
|
|
|
INT32 currentweapon;
|
|
|
|
INT32 ringweapons;
|
2019-08-26 23:07:17 +00:00
|
|
|
UINT16 ammoremoval;
|
|
|
|
tic_t ammoremovaltimer;
|
|
|
|
INT32 ammoremovalweapon;
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT16 powers[NUMPOWERS];
|
2014-03-21 18:42:55 +00:00
|
|
|
|
|
|
|
// Score is resynched in the confirm resync packet
|
2018-06-03 21:41:54 +00:00
|
|
|
INT16 rings;
|
|
|
|
INT16 spheres;
|
2014-03-21 18:42:55 +00:00
|
|
|
SINT8 lives;
|
|
|
|
SINT8 continues;
|
|
|
|
UINT8 scoreadd;
|
|
|
|
SINT8 xtralife;
|
|
|
|
SINT8 pity;
|
|
|
|
|
2020-05-24 00:29:07 +00:00
|
|
|
UINT16 skincolor;
|
2014-03-15 16:59:03 +00:00
|
|
|
INT32 skin;
|
2017-03-16 18:57:42 +00:00
|
|
|
UINT32 availabilities;
|
2014-03-21 18:42:55 +00:00
|
|
|
// Just in case Lua does something like
|
|
|
|
// modify these at runtime
|
2016-09-25 17:21:52 +00:00
|
|
|
fixed_t camerascale;
|
|
|
|
fixed_t shieldscale;
|
2014-03-15 16:59:03 +00:00
|
|
|
fixed_t normalspeed;
|
|
|
|
fixed_t runspeed;
|
|
|
|
UINT8 thrustfactor;
|
|
|
|
UINT8 accelstart;
|
|
|
|
UINT8 acceleration;
|
|
|
|
UINT8 charability;
|
|
|
|
UINT8 charability2;
|
|
|
|
UINT32 charflags;
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT32 thokitem; // mobjtype_t
|
|
|
|
UINT32 spinitem; // mobjtype_t
|
|
|
|
UINT32 revitem; // mobjtype_t
|
2017-10-02 13:08:58 +00:00
|
|
|
UINT32 followitem; // mobjtype_t
|
2016-04-16 17:40:14 +00:00
|
|
|
fixed_t actionspd;
|
|
|
|
fixed_t mindash;
|
|
|
|
fixed_t maxdash;
|
2014-03-15 16:59:03 +00:00
|
|
|
fixed_t jumpfactor;
|
2016-09-25 17:21:52 +00:00
|
|
|
fixed_t playerheight;
|
|
|
|
fixed_t playerspinheight;
|
2014-03-21 18:42:55 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
fixed_t speed;
|
|
|
|
UINT8 secondjump;
|
|
|
|
UINT8 fly1;
|
|
|
|
tic_t glidetime;
|
|
|
|
UINT8 climbing;
|
|
|
|
INT32 deadtimer;
|
|
|
|
tic_t exiting;
|
|
|
|
UINT8 homing;
|
2016-01-25 11:47:33 +00:00
|
|
|
tic_t dashmode;
|
2016-04-16 17:40:14 +00:00
|
|
|
tic_t skidtime;
|
2014-03-15 16:59:03 +00:00
|
|
|
fixed_t cmomx;
|
|
|
|
fixed_t cmomy;
|
|
|
|
fixed_t rmomx;
|
|
|
|
fixed_t rmomy;
|
2014-03-21 18:42:55 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
INT32 weapondelay;
|
|
|
|
INT32 tossdelay;
|
2014-03-21 18:42:55 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
INT16 starpostx;
|
|
|
|
INT16 starposty;
|
|
|
|
INT16 starpostz;
|
|
|
|
INT32 starpostnum;
|
|
|
|
tic_t starposttime;
|
|
|
|
angle_t starpostangle;
|
2019-09-07 21:11:33 +00:00
|
|
|
fixed_t starpostscale;
|
2014-03-21 18:42:55 +00:00
|
|
|
|
|
|
|
INT32 maxlink;
|
|
|
|
fixed_t dashspeed;
|
2014-03-15 16:59:03 +00:00
|
|
|
angle_t angle_pos;
|
|
|
|
angle_t old_angle_pos;
|
|
|
|
tic_t bumpertime;
|
|
|
|
INT32 flyangle;
|
|
|
|
tic_t drilltimer;
|
|
|
|
INT32 linkcount;
|
|
|
|
tic_t linktimer;
|
|
|
|
INT32 anotherflyangle;
|
|
|
|
tic_t nightstime;
|
|
|
|
INT32 drillmeter;
|
|
|
|
UINT8 drilldelay;
|
|
|
|
UINT8 bonustime;
|
|
|
|
UINT8 mare;
|
|
|
|
INT16 lastsidehit, lastlinehit;
|
2014-03-21 18:42:55 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
tic_t losstime;
|
|
|
|
UINT8 timeshit;
|
|
|
|
INT32 onconveyor;
|
|
|
|
|
|
|
|
//player->mo stuff
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT8 hasmo; // Boolean
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2015-08-15 20:07:16 +00:00
|
|
|
INT32 health;
|
2014-03-15 16:59:03 +00:00
|
|
|
angle_t angle;
|
2019-11-15 01:14:40 +00:00
|
|
|
angle_t rollangle;
|
2014-03-15 16:59:03 +00:00
|
|
|
fixed_t x;
|
|
|
|
fixed_t y;
|
|
|
|
fixed_t z;
|
|
|
|
fixed_t momx;
|
|
|
|
fixed_t momy;
|
|
|
|
fixed_t momz;
|
|
|
|
fixed_t friction;
|
|
|
|
fixed_t movefactor;
|
|
|
|
|
2019-10-17 17:22:06 +00:00
|
|
|
spritenum_t sprite;
|
|
|
|
UINT32 frame;
|
|
|
|
UINT8 sprite2;
|
|
|
|
UINT16 anim_duration;
|
2016-04-16 17:40:14 +00:00
|
|
|
INT32 tics;
|
2014-03-15 16:59:03 +00:00
|
|
|
statenum_t statenum;
|
|
|
|
UINT32 flags;
|
|
|
|
UINT32 flags2;
|
2016-04-16 17:40:14 +00:00
|
|
|
UINT16 eflags;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
fixed_t radius;
|
|
|
|
fixed_t height;
|
|
|
|
fixed_t scale;
|
|
|
|
fixed_t destscale;
|
|
|
|
fixed_t scalespeed;
|
2014-03-21 18:42:55 +00:00
|
|
|
} ATTRPACK resynch_pak;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT8 version; // Different versions don't work
|
|
|
|
UINT8 subversion; // Contains build version
|
2014-03-21 18:42:55 +00:00
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
// Server launch stuffs
|
2014-03-21 18:42:55 +00:00
|
|
|
UINT8 serverplayer;
|
|
|
|
UINT8 totalslotnum; // "Slots": highest player number in use plus one.
|
|
|
|
|
|
|
|
tic_t gametic;
|
|
|
|
UINT8 clientnode;
|
|
|
|
UINT8 gamestate;
|
|
|
|
|
2014-08-04 03:49:33 +00:00
|
|
|
// 0xFF == not in game; else player skin num
|
|
|
|
UINT8 playerskins[MAXPLAYERS];
|
2020-05-24 00:29:07 +00:00
|
|
|
UINT16 playercolor[MAXPLAYERS];
|
2017-03-17 23:11:32 +00:00
|
|
|
UINT32 playeravailabilities[MAXPLAYERS];
|
2014-08-04 03:49:33 +00:00
|
|
|
|
2014-03-21 18:42:55 +00:00
|
|
|
UINT8 gametype;
|
|
|
|
UINT8 modifiedgame;
|
2017-12-08 04:45:39 +00:00
|
|
|
SINT8 adminplayers[MAXPLAYERS]; // Needs to be signed
|
2014-03-21 18:42:55 +00:00
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
char server_context[8]; // Unique context id, generated at server startup.
|
2014-03-21 18:42:55 +00:00
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT8 varlengthinputs[0]; // Playernames and netvars
|
2014-03-21 18:42:55 +00:00
|
|
|
} ATTRPACK serverconfig_pak;
|
|
|
|
|
2020-05-16 20:09:00 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2014-03-21 18:42:55 +00:00
|
|
|
UINT8 fileid;
|
2020-05-16 20:09:00 +00:00
|
|
|
UINT32 filesize;
|
2020-05-20 14:21:18 +00:00
|
|
|
UINT8 iteration;
|
2014-03-21 18:42:55 +00:00
|
|
|
UINT32 position;
|
|
|
|
UINT16 size;
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT8 data[0]; // Size is variable using hardware_MAXPACKETLENGTH
|
2014-03-21 18:42:55 +00:00
|
|
|
} ATTRPACK filetx_pak;
|
|
|
|
|
2020-05-16 20:09:00 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT32 start;
|
|
|
|
UINT32 acks;
|
|
|
|
} ATTRPACK fileacksegment_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT8 fileid;
|
2020-05-20 14:21:18 +00:00
|
|
|
UINT8 iteration;
|
2020-05-16 20:09:00 +00:00
|
|
|
UINT8 numsegments;
|
|
|
|
fileacksegment_t segments[0];
|
|
|
|
} ATTRPACK fileack_pak;
|
|
|
|
|
2014-03-21 18:42:55 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(default : 4200)
|
|
|
|
#endif
|
|
|
|
|
2019-12-26 04:44:25 +00:00
|
|
|
#define MAXAPPLICATION 16
|
|
|
|
|
2014-03-21 18:42:55 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2019-12-26 04:44:25 +00:00
|
|
|
UINT8 _255;/* see serverinfo_pak */
|
|
|
|
UINT8 packetversion;
|
|
|
|
char application[MAXAPPLICATION];
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT8 version; // Different versions don't work
|
|
|
|
UINT8 subversion; // Contains build version
|
2014-03-21 18:42:55 +00:00
|
|
|
UINT8 localplayers;
|
|
|
|
UINT8 mode;
|
2019-10-19 15:09:18 +00:00
|
|
|
char names[MAXSPLITSCREENPLAYERS][MAXPLAYERNAME];
|
2014-03-21 18:42:55 +00:00
|
|
|
} ATTRPACK clientconfig_pak;
|
|
|
|
|
|
|
|
#define MAXSERVERNAME 32
|
2017-04-29 15:40:07 +00:00
|
|
|
#define MAXFILENEEDED 915
|
2016-12-31 18:26:33 +00:00
|
|
|
// This packet is too large
|
2014-03-21 18:42:55 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2019-12-26 04:44:25 +00:00
|
|
|
/*
|
|
|
|
In the old packet, 'version' is the first field. Now that field is set
|
|
|
|
to 255 always, so older versions won't be confused with the new
|
|
|
|
versions or vice-versa.
|
|
|
|
*/
|
|
|
|
UINT8 _255;
|
|
|
|
UINT8 packetversion;
|
|
|
|
char application[MAXAPPLICATION];
|
2014-03-21 18:42:55 +00:00
|
|
|
UINT8 version;
|
|
|
|
UINT8 subversion;
|
|
|
|
UINT8 numberofplayer;
|
|
|
|
UINT8 maxplayer;
|
2020-02-22 01:17:21 +00:00
|
|
|
UINT8 refusereason; // 0: joinable, 1: joins disabled, 2: full
|
2019-12-31 06:18:55 +00:00
|
|
|
char gametypename[24];
|
2014-03-21 18:42:55 +00:00
|
|
|
UINT8 modifiedgame;
|
|
|
|
UINT8 cheatsenabled;
|
|
|
|
UINT8 isdedicated;
|
|
|
|
UINT8 fileneedednum;
|
|
|
|
tic_t time;
|
|
|
|
tic_t leveltime;
|
|
|
|
char servername[MAXSERVERNAME];
|
|
|
|
char mapname[8];
|
|
|
|
char maptitle[33];
|
|
|
|
unsigned char mapmd5[16];
|
|
|
|
UINT8 actnum;
|
|
|
|
UINT8 iszone;
|
2017-04-29 15:40:07 +00:00
|
|
|
UINT8 fileneeded[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
|
2014-03-21 18:42:55 +00:00
|
|
|
} ATTRPACK serverinfo_pak;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char reason[255];
|
|
|
|
} ATTRPACK serverrefuse_pak;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT8 version;
|
|
|
|
tic_t time; // used for ping evaluation
|
|
|
|
} ATTRPACK askinfo_pak;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char clientaddr[22];
|
|
|
|
tic_t time; // used for ping evaluation
|
|
|
|
} ATTRPACK msaskinfo_pak;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Shorter player information for external use.
|
|
|
|
typedef struct
|
|
|
|
{
|
2020-01-12 17:34:08 +00:00
|
|
|
UINT8 num;
|
2014-03-15 16:59:03 +00:00
|
|
|
char name[MAXPLAYERNAME+1];
|
|
|
|
UINT8 address[4]; // sending another string would run us up against MAXPACKETLENGTH
|
|
|
|
UINT8 team;
|
|
|
|
UINT8 skin;
|
|
|
|
UINT8 data; // Color is first four bits, hasflag, isit and issuper have one bit each, the last is unused.
|
|
|
|
UINT32 score;
|
|
|
|
UINT16 timeinserver; // In seconds.
|
|
|
|
} ATTRPACK plrinfo;
|
|
|
|
|
|
|
|
// Shortest player information for join during intermission.
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char name[MAXPLAYERNAME+1];
|
|
|
|
UINT8 skin;
|
2020-05-24 00:29:07 +00:00
|
|
|
UINT16 color;
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT32 pflags;
|
|
|
|
UINT32 score;
|
|
|
|
UINT8 ctfteam;
|
|
|
|
} ATTRPACK plrconfig;
|
|
|
|
|
|
|
|
//
|
2016-12-31 18:26:33 +00:00
|
|
|
// Network packet data
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT32 checksum;
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT8 ack; // If not zero the node asks for acknowledgement, the receiver must resend the ack
|
|
|
|
UINT8 ackreturn; // The return of the ack number
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
UINT8 packettype;
|
2016-12-31 18:26:33 +00:00
|
|
|
UINT8 reserved; // Padding
|
2014-03-15 16:59:03 +00:00
|
|
|
union
|
|
|
|
{
|
2016-12-31 18:26:33 +00:00
|
|
|
clientcmd_pak clientpak; // 144 bytes
|
|
|
|
client2cmd_pak client2pak; // 200 bytes
|
|
|
|
servertics_pak serverpak; // 132495 bytes (more around 360, no?)
|
|
|
|
serverconfig_pak servercfg; // 773 bytes
|
|
|
|
resynchend_pak resynchend; //
|
|
|
|
resynch_pak resynchpak; //
|
|
|
|
UINT8 resynchgot; //
|
|
|
|
UINT8 textcmd[MAXTEXTCMD+1]; // 66049 bytes (wut??? 64k??? More like 257 bytes...)
|
|
|
|
filetx_pak filetxpak; // 139 bytes
|
2020-05-16 20:09:00 +00:00
|
|
|
fileack_pak fileack;
|
|
|
|
UINT8 filereceived;
|
2016-12-31 18:26:33 +00:00
|
|
|
clientconfig_pak clientcfg; // 136 bytes
|
2019-08-17 17:33:14 +00:00
|
|
|
UINT8 md5sum[16];
|
2016-12-31 18:26:33 +00:00
|
|
|
serverinfo_pak serverinfo; // 1024 bytes
|
|
|
|
serverrefuse_pak serverrefuse; // 65025 bytes (somehow I feel like those values are garbage...)
|
|
|
|
askinfo_pak askinfo; // 61 bytes
|
|
|
|
msaskinfo_pak msaskinfo; // 22 bytes
|
2019-11-18 01:22:47 +00:00
|
|
|
plrinfo playerinfo[MAXPLAYERS]; // 576 bytes(?)
|
|
|
|
plrconfig playerconfig[MAXPLAYERS]; // (up to) 528 bytes(?)
|
|
|
|
UINT32 pingtable[MAXPLAYERS+1]; // 68 bytes
|
2016-12-31 18:26:33 +00:00
|
|
|
} u; // This is needed to pack diff packet types data together
|
2014-03-15 16:59:03 +00:00
|
|
|
} ATTRPACK doomdata_t;
|
|
|
|
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#pragma pack()
|
|
|
|
#endif
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
#define MAXSERVERLIST 64 // Depends only on the display
|
2014-03-15 16:59:03 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
SINT8 node;
|
|
|
|
serverinfo_pak info;
|
|
|
|
} serverelem_t;
|
|
|
|
|
|
|
|
extern serverelem_t serverlist[MAXSERVERLIST];
|
|
|
|
extern UINT32 serverlistcount;
|
|
|
|
extern INT32 mapchangepending;
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
// Points inside doomcom
|
2014-03-15 16:59:03 +00:00
|
|
|
extern doomdata_t *netbuffer;
|
|
|
|
|
2019-08-27 00:38:32 +00:00
|
|
|
extern consvar_t cv_showjoinaddress;
|
2014-03-15 16:59:03 +00:00
|
|
|
extern consvar_t cv_playbackspeed;
|
|
|
|
|
2018-12-14 23:56:11 +00:00
|
|
|
#define BASEPACKETSIZE offsetof(doomdata_t, u)
|
|
|
|
#define FILETXHEADER offsetof(filetx_pak, data)
|
|
|
|
#define BASESERVERTICSSIZE offsetof(doomdata_t, u.serverpak.cmds[0])
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#define KICK_MSG_GO_AWAY 1
|
|
|
|
#define KICK_MSG_CON_FAIL 2
|
|
|
|
#define KICK_MSG_PLAYER_QUIT 3
|
|
|
|
#define KICK_MSG_TIMEOUT 4
|
|
|
|
#define KICK_MSG_BANNED 5
|
|
|
|
#define KICK_MSG_PING_HIGH 6
|
|
|
|
#define KICK_MSG_CUSTOM_KICK 7
|
|
|
|
#define KICK_MSG_CUSTOM_BAN 8
|
2020-01-22 02:05:08 +00:00
|
|
|
#define KICK_MSG_KEEP_BODY 0x80
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2016-10-21 20:25:07 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
KR_KICK = 1, //Kicked by server
|
|
|
|
KR_PINGLIMIT = 2, //Broke Ping Limit
|
|
|
|
KR_SYNCH = 3, //Synch Failure
|
2018-11-14 15:54:33 +00:00
|
|
|
KR_TIMEOUT = 4, //Connection Timeout
|
2016-10-21 20:25:07 +00:00
|
|
|
KR_BAN = 5, //Banned by server
|
|
|
|
KR_LEAVE = 6, //Quit the game
|
2018-11-14 15:54:33 +00:00
|
|
|
|
2016-10-21 20:25:07 +00:00
|
|
|
} kickreason_t;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
extern boolean server;
|
2017-01-13 19:53:52 +00:00
|
|
|
#define client (!server)
|
2016-12-31 18:26:33 +00:00
|
|
|
extern boolean dedicated; // For dedicated server
|
2014-03-15 16:59:03 +00:00
|
|
|
extern UINT16 software_MAXPACKETLENGTH;
|
|
|
|
extern boolean acceptnewnode;
|
|
|
|
extern SINT8 servernode;
|
|
|
|
|
|
|
|
void Command_Ping_f(void);
|
|
|
|
extern tic_t connectiontimeout;
|
2017-01-13 19:53:52 +00:00
|
|
|
extern tic_t jointimeout;
|
2014-03-15 16:59:03 +00:00
|
|
|
extern UINT16 pingmeasurecount;
|
|
|
|
extern UINT32 realpingtable[MAXPLAYERS];
|
|
|
|
extern UINT32 playerpingtable[MAXPLAYERS];
|
2019-11-18 01:22:47 +00:00
|
|
|
extern tic_t servermaxping;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2020-04-24 12:05:15 +00:00
|
|
|
extern consvar_t cv_allownewplayer, cv_joinnextround, cv_maxplayers, cv_joindelay, cv_rejointimeout;
|
2020-01-22 02:05:08 +00:00
|
|
|
extern consvar_t cv_resynchattempts, cv_blamecfail;
|
|
|
|
extern consvar_t cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
// Used in d_net, the only dependence
|
2020-05-17 18:23:07 +00:00
|
|
|
tic_t ExpandTics(INT32 low, INT32 node);
|
2014-03-15 16:59:03 +00:00
|
|
|
void D_ClientServerInit(void);
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
// Initialise the other field
|
2014-03-15 16:59:03 +00:00
|
|
|
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
|
|
|
|
void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam);
|
|
|
|
void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam); // splitsreen player
|
2020-01-12 18:43:04 +00:00
|
|
|
void SendKick(UINT8 playernum, UINT8 msg);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Create any new ticcmds and broadcast to other players.
|
|
|
|
void NetUpdate(void);
|
|
|
|
|
|
|
|
void SV_StartSinglePlayerServer(void);
|
|
|
|
boolean SV_SpawnServer(void);
|
|
|
|
void SV_StopServer(void);
|
|
|
|
void SV_ResetServer(void);
|
|
|
|
void CL_AddSplitscreenPlayer(void);
|
|
|
|
void CL_RemoveSplitscreenPlayer(void);
|
|
|
|
void CL_Reset(void);
|
|
|
|
void CL_ClearPlayer(INT32 playernum);
|
|
|
|
void CL_UpdateServerList(boolean internetsearch, INT32 room);
|
2016-12-31 18:26:33 +00:00
|
|
|
// Is there a game running
|
2014-03-15 16:59:03 +00:00
|
|
|
boolean Playing(void);
|
|
|
|
|
|
|
|
// Broadcasts special packets to other players
|
|
|
|
// to notify of game exit
|
|
|
|
void D_QuitNetGame(void);
|
|
|
|
|
2016-12-31 18:26:33 +00:00
|
|
|
//? How many ticks to run?
|
2014-03-15 16:59:03 +00:00
|
|
|
void TryRunTics(tic_t realtic);
|
|
|
|
|
|
|
|
// extra data for lmps
|
|
|
|
// these functions scare me. they contain magic.
|
|
|
|
/*boolean AddLmpExtradata(UINT8 **demo_p, INT32 playernum);
|
|
|
|
void ReadLmpExtraData(UINT8 **demo_pointer, INT32 playernum);*/
|
|
|
|
|
|
|
|
#ifndef NONET
|
|
|
|
// translate a playername in a player number return -1 if not found and
|
|
|
|
// print a error message in the console
|
|
|
|
SINT8 nametonum(const char *name);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern char motd[254], server_context[8];
|
|
|
|
extern UINT8 playernode[MAXPLAYERS];
|
|
|
|
|
|
|
|
INT32 D_NumPlayers(void);
|
|
|
|
void D_ResetTiccmds(void);
|
|
|
|
|
|
|
|
tic_t GetLag(INT32 node);
|
|
|
|
UINT8 GetFreeXCmdSize(void);
|
|
|
|
|
2019-07-15 22:39:58 +00:00
|
|
|
void D_MD5PasswordPass(const UINT8 *buffer, size_t len, const char *salt, void *dest);
|
|
|
|
|
2014-03-21 18:42:55 +00:00
|
|
|
extern UINT8 hu_resynching;
|
2019-07-15 22:39:58 +00:00
|
|
|
|
2019-08-17 17:33:14 +00:00
|
|
|
extern UINT8 adminpassmd5[16];
|
2019-07-15 22:39:58 +00:00
|
|
|
extern boolean adminpasswordset;
|
2014-03-15 16:59:03 +00:00
|
|
|
#endif
|