mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-22 17:21:24 +00:00
Cleanup comments
This commit is contained in:
parent
6f53683519
commit
7f4e82e7d9
4 changed files with 39 additions and 51 deletions
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
cl_mode_t cl_mode = CL_SEARCHING;
|
cl_mode_t cl_mode = CL_SEARCHING;
|
||||||
static UINT16 cl_lastcheckedfilecount = 0; // used for full file list
|
static UINT16 cl_lastcheckedfilecount = 0; // used for full file list
|
||||||
boolean serverisfull = false; //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
|
boolean serverisfull = false; // 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
|
||||||
tic_t firstconnectattempttime = 0;
|
tic_t firstconnectattempttime = 0;
|
||||||
UINT8 mynode;
|
UINT8 mynode;
|
||||||
static void *snake = NULL;
|
static void *snake = NULL;
|
||||||
|
@ -137,7 +137,7 @@ static inline void CL_DrawConnectionStatus(void)
|
||||||
|
|
||||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-16, V_YELLOWMAP, "Press ESC to abort");
|
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-16-16, V_YELLOWMAP, "Press ESC to abort");
|
||||||
|
|
||||||
//ima just count files here
|
// ima just count files here
|
||||||
if (fileneeded)
|
if (fileneeded)
|
||||||
{
|
{
|
||||||
for (INT32 i = 0; i < fileneedednum; i++)
|
for (INT32 i = 0; i < fileneedednum; i++)
|
||||||
|
@ -248,7 +248,7 @@ boolean CL_SendJoin(void)
|
||||||
|
|
||||||
CleanupPlayerName(consoleplayer, cv_playername.zstring);
|
CleanupPlayerName(consoleplayer, cv_playername.zstring);
|
||||||
if (splitscreen)
|
if (splitscreen)
|
||||||
CleanupPlayerName(1, cv_playername2.zstring);/* 1 is a HACK? oh no */
|
CleanupPlayerName(1, cv_playername2.zstring); // 1 is a HACK? oh no
|
||||||
|
|
||||||
strncpy(netbuffer->u.clientcfg.names[0], cv_playername.zstring, MAXPLAYERNAME);
|
strncpy(netbuffer->u.clientcfg.names[0], cv_playername.zstring, MAXPLAYERNAME);
|
||||||
strncpy(netbuffer->u.clientcfg.names[1], cv_playername2.zstring, MAXPLAYERNAME);
|
strncpy(netbuffer->u.clientcfg.names[1], cv_playername2.zstring, MAXPLAYERNAME);
|
||||||
|
@ -306,14 +306,14 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
||||||
if (serverlistcount >= MAXSERVERLIST)
|
if (serverlistcount >= MAXSERVERLIST)
|
||||||
return; // list full
|
return; // list full
|
||||||
|
|
||||||
/* check it later if connecting to this one */
|
// check it later if connecting to this one
|
||||||
if (node != servernode)
|
if (node != servernode)
|
||||||
{
|
{
|
||||||
if (info->_255 != 255)
|
if (info->_255 != 255)
|
||||||
return;/* old packet format */
|
return; // Old packet format
|
||||||
|
|
||||||
if (info->packetversion != PACKETVERSION)
|
if (info->packetversion != PACKETVERSION)
|
||||||
return;/* old new packet format */
|
return; // Old new packet format
|
||||||
|
|
||||||
if (info->version != VERSION)
|
if (info->version != VERSION)
|
||||||
return; // Not same version.
|
return; // Not same version.
|
||||||
|
@ -322,7 +322,7 @@ static void SL_InsertServer(serverinfo_pak* info, SINT8 node)
|
||||||
return; // Close, but no cigar.
|
return; // Close, but no cigar.
|
||||||
|
|
||||||
if (strcmp(info->application, SRB2APPLICATION))
|
if (strcmp(info->application, SRB2APPLICATION))
|
||||||
return;/* that's a different mod */
|
return; // That's a different mod
|
||||||
}
|
}
|
||||||
|
|
||||||
i = serverlistcount++;
|
i = serverlistcount++;
|
||||||
|
@ -380,7 +380,7 @@ Fetch_servers_thread (struct Fetch_servers_ctx *ctx)
|
||||||
|
|
||||||
free(ctx);
|
free(ctx);
|
||||||
}
|
}
|
||||||
#endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/
|
#endif // defined (MASTERSERVER) && defined (HAVE_THREADS)
|
||||||
|
|
||||||
void CL_QueryServerList (msg_server_t *server_list)
|
void CL_QueryServerList (msg_server_t *server_list)
|
||||||
{
|
{
|
||||||
|
@ -389,7 +389,7 @@ void CL_QueryServerList (msg_server_t *server_list)
|
||||||
// Make sure MS version matches our own, to
|
// Make sure MS version matches our own, to
|
||||||
// thwart nefarious servers who lie to the MS.
|
// thwart nefarious servers who lie to the MS.
|
||||||
|
|
||||||
/* lol bruh, that version COMES from the servers */
|
// lol bruh, that version COMES from the servers
|
||||||
//if (strcmp(version, server_list[i].version) == 0)
|
//if (strcmp(version, server_list[i].version) == 0)
|
||||||
{
|
{
|
||||||
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
|
INT32 node = I_NetMakeNodewPort(server_list[i].ip, server_list[i].port);
|
||||||
|
@ -441,7 +441,7 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
|
||||||
|
|
||||||
ctx = malloc(sizeof *ctx);
|
ctx = malloc(sizeof *ctx);
|
||||||
|
|
||||||
/* This called from M_Refresh so I don't use a mutex */
|
// This called from M_Refresh so I don't use a mutex
|
||||||
m_waiting_mode = M_WAITING_SERVERS;
|
m_waiting_mode = M_WAITING_SERVERS;
|
||||||
|
|
||||||
I_lock_mutex(&ms_QueryId_mutex);
|
I_lock_mutex(&ms_QueryId_mutex);
|
||||||
|
@ -465,7 +465,7 @@ void CL_UpdateServerList(boolean internetsearch, INT32 room)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif/*MASTERSERVER*/
|
#endif // MASTERSERVER
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_ConfirmConnect(event_t *ev)
|
static void M_ConfirmConnect(event_t *ev)
|
||||||
|
@ -619,7 +619,7 @@ static const char * InvalidServerReason (serverinfo_pak *info)
|
||||||
{
|
{
|
||||||
#define EOT "\nPress ESC\n"
|
#define EOT "\nPress ESC\n"
|
||||||
|
|
||||||
/* magic number for new packet format */
|
// Magic number for new packet format
|
||||||
if (info->_255 != 255)
|
if (info->_255 != 255)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
@ -691,10 +691,10 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
// serverlist is updated by GetPacket function
|
// serverlist is updated by GetPackets
|
||||||
if (serverlistcount > 0)
|
if (serverlistcount > 0)
|
||||||
{
|
{
|
||||||
// this can be a responce to our broadcast request
|
// This can be a response to our broadcast request
|
||||||
if (servernode == -1 || servernode >= MAXNETNODES)
|
if (servernode == -1 || servernode >= MAXNETNODES)
|
||||||
{
|
{
|
||||||
i = 0;
|
i = 0;
|
||||||
|
@ -819,7 +819,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||||
if (CL_LoadServerFiles())
|
if (CL_LoadServerFiles())
|
||||||
{
|
{
|
||||||
FreeFileNeeded();
|
FreeFileNeeded();
|
||||||
*asksent = 0; //This ensure the first join ask is right away
|
*asksent = 0; // This ensures the first join request is right away
|
||||||
firstconnectattempttime = I_GetTime();
|
firstconnectattempttime = I_GetTime();
|
||||||
cl_mode = CL_ASKJOIN;
|
cl_mode = CL_ASKJOIN;
|
||||||
}
|
}
|
||||||
|
@ -841,9 +841,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare structures to save the file
|
// Prepare structures to save the file
|
||||||
// WARNING: this can be useless in case of server not in GS_LEVEL
|
|
||||||
// but since the network layer doesn't provide ordered packets...
|
|
||||||
CL_PrepareDownloadSaveGame(tmpsave);
|
CL_PrepareDownloadSaveGame(tmpsave);
|
||||||
|
|
||||||
if (I_GetTime() >= *asksent && CL_SendJoin())
|
if (I_GetTime() >= *asksent && CL_SendJoin())
|
||||||
|
@ -954,11 +952,6 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||||
|
|
||||||
#define TMPSAVENAME "$$$.sav"
|
#define TMPSAVENAME "$$$.sav"
|
||||||
|
|
||||||
/** Use adaptive send using net_bandwidth and stat.sendbytes
|
|
||||||
*
|
|
||||||
* \todo Better description...
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void CL_ConnectToServer(void)
|
void CL_ConnectToServer(void)
|
||||||
{
|
{
|
||||||
INT32 pnumnodes, nodewaited = doomcom->numnodes, i;
|
INT32 pnumnodes, nodewaited = doomcom->numnodes, i;
|
||||||
|
@ -1158,7 +1151,7 @@ void PT_ServerCFG(SINT8 node)
|
||||||
DEBFILE(va("Server accept join gametic=%u mynode=%d\n", gametic, mynode));
|
DEBFILE(va("Server accept join gametic=%u mynode=%d\n", gametic, mynode));
|
||||||
|
|
||||||
/// \note Wait. What if a Lua script uses some global custom variables synched with the NetVars hook?
|
/// \note Wait. What if a Lua script uses some global custom variables synched with the NetVars hook?
|
||||||
/// Shouldn't them be downloaded even at intermission time?
|
/// Shouldn't they be downloaded even at intermission time?
|
||||||
/// Also, according to PT_ClientJoin, the server will send the savegame even during intermission...
|
/// Also, according to PT_ClientJoin, the server will send the savegame even during intermission...
|
||||||
if (netbuffer->u.servercfg.gamestate == GS_LEVEL/* ||
|
if (netbuffer->u.servercfg.gamestate == GS_LEVEL/* ||
|
||||||
netbuffer->u.servercfg.gamestate == GS_INTERMISSION*/)
|
netbuffer->u.servercfg.gamestate == GS_INTERMISSION*/)
|
||||||
|
|
|
@ -1252,8 +1252,8 @@ void NetUpdate(void)
|
||||||
|
|
||||||
GetPackets(); // get packet from client or from server
|
GetPackets(); // get packet from client or from server
|
||||||
|
|
||||||
// client send the command after a receive of the server
|
// The client sends the command after receiving from the server
|
||||||
// the server send before because in single player is beter
|
// The server sends it before because this is better in single player
|
||||||
|
|
||||||
#ifdef MASTERSERVER
|
#ifdef MASTERSERVER
|
||||||
MasterClient_Ticker(); // Acking the Master Server
|
MasterClient_Ticker(); // Acking the Master Server
|
||||||
|
@ -1402,7 +1402,7 @@ SINT8 nametonum(const char *name)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// is there a game running
|
// Is there a game running?
|
||||||
boolean Playing(void)
|
boolean Playing(void)
|
||||||
{
|
{
|
||||||
return (server && serverrunning) || (client && cl_mode == CL_CONNECTED);
|
return (server && serverrunning) || (client && cl_mode == CL_CONNECTED);
|
||||||
|
@ -1423,11 +1423,8 @@ INT32 D_NumPlayers(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// NetUpdate
|
// Consistancy
|
||||||
// Builds ticcmds for console player,
|
|
||||||
// sends out a packet
|
|
||||||
//
|
//
|
||||||
// no more use random generator, because at very first tic isn't yet synchronized
|
|
||||||
// Note: It is called consistAncy on purpose.
|
// Note: It is called consistAncy on purpose.
|
||||||
//
|
//
|
||||||
INT16 Consistancy(void)
|
INT16 Consistancy(void)
|
||||||
|
|
|
@ -123,13 +123,12 @@ typedef struct
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Server to client packet
|
// Server to client packet
|
||||||
// this packet is too large
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
tic_t starttic;
|
tic_t starttic;
|
||||||
UINT8 numtics;
|
UINT8 numtics;
|
||||||
UINT8 numslots; // "Slots filled": Highest player number in use plus one.
|
UINT8 numslots; // "Slots filled": Highest player number in use plus one.
|
||||||
ticcmd_t cmds[45]; // Normally [BACKUPTIC][MAXPLAYERS] but too large
|
ticcmd_t cmds[45];
|
||||||
} ATTRPACK servertics_pak;
|
} ATTRPACK servertics_pak;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#include "../doomstat.h"
|
#include "../doomstat.h"
|
||||||
#include "../doomtype.h"
|
#include "../doomtype.h"
|
||||||
|
|
||||||
tic_t firstticstosend; // min of the nettics
|
tic_t firstticstosend; // Smallest netnode.tic
|
||||||
tic_t tictoclear = 0; // optimize d_clearticcmd
|
tic_t tictoclear = 0; // Optimize D_ClearTiccmd
|
||||||
ticcmd_t localcmds;
|
ticcmd_t localcmds;
|
||||||
ticcmd_t localcmds2;
|
ticcmd_t localcmds2;
|
||||||
boolean cl_packetmissed;
|
boolean cl_packetmissed;
|
||||||
|
@ -312,10 +312,9 @@ static tic_t SV_CalculateNumTicsForPacket(SINT8 nodenum, tic_t firsttic, tic_t l
|
||||||
sizeu1(size), tic, firsttic, lasttic));
|
sizeu1(size), tic, firsttic, lasttic));
|
||||||
lasttic = tic;
|
lasttic = tic;
|
||||||
|
|
||||||
// too bad: too much player have send extradata and there is too
|
// Too bad: too many players have sent extra data
|
||||||
// much data in one tic.
|
// and there is too much data for a single tic.
|
||||||
// To avoid it put the data on the next tic. (see getpacket
|
// To avoid that, keep the data for the next tic (see PT_TEXTCMD).
|
||||||
// textcmd case) but when numplayer changes the computation can be different
|
|
||||||
if (lasttic == firsttic)
|
if (lasttic == firsttic)
|
||||||
{
|
{
|
||||||
if (size > MAXPACKETLENGTH)
|
if (size > MAXPACKETLENGTH)
|
||||||
|
@ -335,15 +334,15 @@ static tic_t SV_CalculateNumTicsForPacket(SINT8 nodenum, tic_t firsttic, tic_t l
|
||||||
return lasttic - firsttic;
|
return lasttic - firsttic;
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the server packet
|
// Sends the server packet
|
||||||
// send tic from firstticstosend to maketic-1
|
// Sends tic/net commands from firstticstosend to maketic-1
|
||||||
void SV_SendTics(void)
|
void SV_SendTics(void)
|
||||||
{
|
{
|
||||||
tic_t realfirsttic, lasttictosend;
|
tic_t realfirsttic, lasttictosend;
|
||||||
|
|
||||||
// send to all client but not to me
|
// Send to all clients except yourself
|
||||||
// for each node create a packet with x tics and send it
|
// For each node, create a packet with x tics and send it
|
||||||
// x is computed using netnodes[n].supposedtic, max packet size and maketic
|
// x is computed using node.supposedtic, max packet size and maketic
|
||||||
for (INT32 n = 1; n < MAXNETNODES; n++)
|
for (INT32 n = 1; n < MAXNETNODES; n++)
|
||||||
if (netnodes[n].ingame)
|
if (netnodes[n].ingame)
|
||||||
{
|
{
|
||||||
|
@ -355,17 +354,17 @@ void SV_SendTics(void)
|
||||||
|
|
||||||
if (realfirsttic >= lasttictosend)
|
if (realfirsttic >= lasttictosend)
|
||||||
{
|
{
|
||||||
// well we have sent all tics we will so use extrabandwidth
|
// Well, we have sent all the tics, so we will use extra bandwidth
|
||||||
// to resent packet that are supposed lost (this is necessary since lost
|
// to resend packets that are supposed lost.
|
||||||
// packet detection work when we have received packet with firsttic > neededtic
|
// This is necessary since lost packet detection
|
||||||
// (getpacket servertics case)
|
// works when we receive a packet with firsttic > neededtic (PT_SERVERTICS)
|
||||||
DEBFILE(va("Nothing to send node %u mak=%u sup=%u net=%u \n",
|
DEBFILE(va("Nothing to send node %u mak=%u sup=%u net=%u \n",
|
||||||
n, maketic, node->supposedtic, node->tic));
|
n, maketic, node->supposedtic, node->tic));
|
||||||
|
|
||||||
realfirsttic = node->tic;
|
realfirsttic = node->tic;
|
||||||
|
|
||||||
if (realfirsttic >= lasttictosend || (I_GetTime() + n)&3)
|
if (realfirsttic >= lasttictosend || (I_GetTime() + n)&3)
|
||||||
// all tic are ok
|
// All tics are Ok
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DEBFILE(va("Sent %d anyway\n", realfirsttic));
|
DEBFILE(va("Sent %d anyway\n", realfirsttic));
|
||||||
|
@ -389,7 +388,7 @@ void SV_SendTics(void)
|
||||||
size_t packsize = bufpos - (UINT8 *)&(netbuffer->u);
|
size_t packsize = bufpos - (UINT8 *)&(netbuffer->u);
|
||||||
HSendPacket(n, false, 0, packsize);
|
HSendPacket(n, false, 0, packsize);
|
||||||
|
|
||||||
// when tic are too large, only one tic is sent so don't go backward!
|
// When tics are too large, only one tic is sent so don't go backwards!
|
||||||
if (lasttictosend-doomcom->extratics > realfirsttic)
|
if (lasttictosend-doomcom->extratics > realfirsttic)
|
||||||
node->supposedtic = lasttictosend-doomcom->extratics;
|
node->supposedtic = lasttictosend-doomcom->extratics;
|
||||||
else
|
else
|
||||||
|
@ -450,6 +449,6 @@ void SV_Maketic(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// all tic are now proceed make the next
|
// All tics have been processed, make the next
|
||||||
maketic++;
|
maketic++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue