Move client connection handling to a new file

This commit is contained in:
LJ Sonic 2022-12-31 21:37:35 +01:00
parent 717e0d5a17
commit 4660d3cab6
8 changed files with 1256 additions and 1190 deletions

View file

@ -57,6 +57,7 @@
#include "netcode/d_net.h"
#include "netcode/mserv.h"
#include "netcode/client_connection.h"
#include "m_misc.h"
#include "m_anigif.h"
#include "byteptr.h"

View file

@ -1,4 +1,5 @@
d_clisrv.c
client_connection.c
d_net.c
d_netcmd.c
d_netfil.c

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,61 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2022 by Sonic Team Junior.
//
// 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 client_connection.h
/// \brief Client connection handling
#ifndef __D_CLIENT_CONNECTION__
#define __D_CLIENT_CONNECTION__
#include "../doomtype.h"
#include "d_clisrv.h"
#define MAXSERVERLIST (MAXNETNODES-1)
typedef struct
{
SINT8 node;
serverinfo_pak info;
} serverelem_t;
typedef enum
{
CL_SEARCHING,
CL_CHECKFILES,
CL_DOWNLOADFILES,
CL_ASKJOIN,
CL_LOADFILES,
CL_WAITJOINRESPONSE,
CL_DOWNLOADSAVEGAME,
CL_CONNECTED,
CL_ABORTED,
CL_ASKFULLFILELIST,
CL_CONFIRMCONNECT
} cl_mode_t;
extern serverelem_t serverlist[MAXSERVERLIST];
extern UINT32 serverlistcount;
extern cl_mode_t cl_mode;
extern boolean serverisfull; //lets us be aware if the server was full after we check files, but before downloading, so we can ask if the user still wants to download or not
extern tic_t firstconnectattempttime;
extern UINT8 mynode; // my address pointofview server
void CL_QueryServerList(msg_server_t *list);
void CL_UpdateServerList(boolean internetsearch, INT32 room);
void CL_ConnectToServer(void);
boolean CL_SendJoin(void);
void HandleServerInfo(SINT8 node);
void PT_MoreFilesNeeded(SINT8 node);
void PT_ServerRefuse(SINT8 node);
void PT_ServerCFG(SINT8 node);
#endif

File diff suppressed because it is too large Load diff

View file

@ -332,15 +332,6 @@ typedef struct
#pragma pack()
#endif
#define MAXSERVERLIST (MAXNETNODES-1)
typedef struct
{
SINT8 node;
serverinfo_pak info;
} serverelem_t;
extern serverelem_t serverlist[MAXSERVERLIST];
extern UINT32 serverlistcount;
extern INT32 mapchangepending;
// Points inside doomcom
@ -385,6 +376,8 @@ extern boolean dedicated; // For dedicated server
extern UINT16 software_MAXPACKETLENGTH;
extern boolean acceptnewnode;
extern SINT8 servernode;
extern tic_t maketic;
extern tic_t neededtic;
void Command_Ping_f(void);
extern tic_t connectiontimeout;
@ -411,6 +404,8 @@ void SendKick(UINT8 playernum, UINT8 msg);
// Create any new ticcmds and broadcast to other players.
void NetUpdate(void);
void GetPackets(void);
void SV_StartSinglePlayerServer(void);
void SV_SpawnServer(void);
void SV_StopServer(void);
@ -419,9 +414,8 @@ void CL_AddSplitscreenPlayer(void);
void CL_RemoveSplitscreenPlayer(void);
void CL_Reset(void);
void CL_ClearPlayer(INT32 playernum);
void CL_QueryServerList(msg_server_t *list);
void CL_UpdateServerList(boolean internetsearch, INT32 room);
void CL_RemovePlayer(INT32 playernum, kickreason_t reason);
void CL_LoadReceivedSavegame(boolean reloading);
// Is there a game running
boolean Playing(void);

View file

@ -20,6 +20,7 @@ Documentation available here.
#include "../doomdef.h"
#include "d_clisrv.h"
#include "client_connection.h"
#include "../command.h"
#include "../m_argv.h"
#include "../m_menu.h"

View file

@ -20,6 +20,7 @@
#include "../command.h"
#include "../i_threads.h"
#include "mserv.h"
#include "client_connection.h"
#include "../m_menu.h"
#include "../z_zone.h"