Merge branch 'blankart-dev' into openalclassic
This commit is contained in:
commit
12cf01c557
9 changed files with 854 additions and 790 deletions
1542
src/d_clisrv.c
1542
src/d_clisrv.c
File diff suppressed because it is too large
Load diff
|
|
@ -360,7 +360,7 @@ struct doomdata_t
|
|||
UINT8 ackreturn; // The return of the ack number
|
||||
|
||||
UINT8 packettype;
|
||||
UINT8 reserved; // Padding
|
||||
UINT8 packetindex;
|
||||
union
|
||||
{
|
||||
clientcmd_pak clientpak;
|
||||
|
|
|
|||
24
src/d_net.c
24
src/d_net.c
|
|
@ -97,12 +97,13 @@ bannednode_t *bannednode = NULL;
|
|||
static tic_t statstarttic;
|
||||
INT32 getbytes = 0;
|
||||
INT64 sendbytes = 0;
|
||||
UINT8 plcycle = 0;
|
||||
UINT32 sentpackets[PACKETLOSSCYCLES][MAXNETNODES];
|
||||
UINT32 lostpackets[PACKETLOSSCYCLES][MAXNETNODES];
|
||||
static INT32 retransmit = 0, duppacket = 0;
|
||||
static INT32 sendackpacket = 0, getackpacket = 0;
|
||||
INT32 ticruned = 0, ticmiss = 0;
|
||||
|
||||
boolean packetloss[MAXPLAYERS][PACKETMEASUREWINDOW];
|
||||
|
||||
// globals
|
||||
INT32 getbps, sendbps;
|
||||
float lostpercent, duppercent, gamelostpercent;
|
||||
|
|
@ -194,6 +195,8 @@ typedef struct
|
|||
UINT8 nextacknum;
|
||||
|
||||
UINT8 flags;
|
||||
UINT8 sendnum;
|
||||
UINT8 recvnum;
|
||||
} netnode_t;
|
||||
|
||||
static netnode_t nodes[MAXNETNODES];
|
||||
|
|
@ -523,6 +526,7 @@ void Net_AckTicker(void)
|
|||
ackpak[i].senttime = I_GetTime();
|
||||
ackpak[i].resentnum++;
|
||||
ackpak[i].nextacknum = node->nextacknum;
|
||||
netbuffer->packetindex = node->sendnum++;
|
||||
retransmit++; // For stat
|
||||
HSendPacket((INT32)(node - nodes), false, ackpak[i].acknum,
|
||||
(size_t)(ackpak[i].length - BASEPACKETSIZE));
|
||||
|
|
@ -633,6 +637,8 @@ static void InitNode(netnode_t *node)
|
|||
node->nextacknum = 1;
|
||||
node->remotefirstack = 0;
|
||||
node->flags = 0;
|
||||
node->sendnum = 0;
|
||||
node->recvnum = 0;
|
||||
}
|
||||
|
||||
static void InitAck(void)
|
||||
|
|
@ -1077,6 +1083,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
|||
else
|
||||
netbuffer->ack = acknum;
|
||||
|
||||
netbuffer->packetindex = nodes[doomcom->remotenode].sendnum++;
|
||||
netbuffer->checksum = NetbufferChecksum();
|
||||
sendbytes += packetheaderlength + doomcom->datalength; // For stat
|
||||
|
||||
|
|
@ -1196,6 +1203,19 @@ boolean HGetPacket(void)
|
|||
continue; // discarded (duplicated)
|
||||
}
|
||||
|
||||
// measure packet loss
|
||||
if ((SINT8)(netbuffer->packetindex - nodes[doomcom->remotenode].recvnum) <= 0)
|
||||
{
|
||||
// got out of order packet, so compensate
|
||||
lostpackets[plcycle][doomcom->remotenode]--;
|
||||
}
|
||||
else
|
||||
{
|
||||
sentpackets[plcycle][doomcom->remotenode] += (SINT8)(netbuffer->packetindex - nodes[doomcom->remotenode].recvnum);
|
||||
lostpackets[plcycle][doomcom->remotenode] += (SINT8)(netbuffer->packetindex - nodes[doomcom->remotenode].recvnum) - 1;
|
||||
nodes[doomcom->remotenode].recvnum = netbuffer->packetindex;
|
||||
}
|
||||
|
||||
// A packet with just ackreturn
|
||||
if (netbuffer->packettype == PT_NOTHING)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ extern INT32 packetheaderlength;
|
|||
boolean Net_GetNetStat(void);
|
||||
extern INT32 getbytes;
|
||||
extern INT64 sendbytes; // Realtime updated
|
||||
|
||||
#define PACKETMEASUREWINDOW (TICRATE*2)
|
||||
extern boolean packetloss[MAXPLAYERS][PACKETMEASUREWINDOW];
|
||||
extern UINT8 plcycle;
|
||||
extern UINT32 sentpackets[PACKETLOSSCYCLES][MAXNETNODES];
|
||||
extern UINT32 lostpackets[PACKETLOSSCYCLES][MAXNETNODES];
|
||||
|
||||
extern SINT8 nodetoplayer[MAXNETNODES];
|
||||
extern SINT8 nodetoplayer2[MAXNETNODES]; // Say the numplayer for this node if any (splitscreen)
|
||||
|
|
|
|||
|
|
@ -496,14 +496,19 @@ tryagain:
|
|||
}
|
||||
|
||||
// get request filepak and put it on the send queue
|
||||
// returns false if a requested file was not found or cannot be sent
|
||||
boolean PT_RequestFile(INT32 node)
|
||||
void PT_RequestFile(INT32 node)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
char wad[MAX_WADPATH+1];
|
||||
UINT8 *p = netbuffer->u.textcmd;
|
||||
UINT8 id;
|
||||
|
||||
if (client || !cv_downloading.value)
|
||||
{
|
||||
Net_CloseConnection(node); // close connection if you are not the server or disabled downloading
|
||||
return;
|
||||
}
|
||||
|
||||
while (p < netbuffer->u.textcmd + MAXTEXTCMD) // Don't allow hacked client to overflow
|
||||
{
|
||||
id = READUINT8(p);
|
||||
|
|
@ -515,10 +520,11 @@ boolean PT_RequestFile(INT32 node)
|
|||
if (cv_noticedownload.value)
|
||||
CONS_Printf("Bad PT_REQUESTFILE from node %d!\n", node);
|
||||
SV_AbortSendFiles(node);
|
||||
return false; // don't read any more
|
||||
Net_CloseConnection(node); // close connection if one of the requested files could not be sent
|
||||
return; // don't read the rest of the files
|
||||
}
|
||||
}
|
||||
return true; // no problems with any files
|
||||
return; // no problems with any files
|
||||
}
|
||||
|
||||
/** Checks if the files needed aren't already loaded or on the disk
|
||||
|
|
@ -1262,14 +1268,16 @@ void FileSendTicker(void)
|
|||
}
|
||||
}
|
||||
|
||||
void PT_FileAck(void)
|
||||
void PT_FileAck(SINT8 node)
|
||||
{
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
fileack_pak *packet = (void*)&netbuffer->u.fileack;
|
||||
INT32 node = doomcom->remotenode;
|
||||
filetran_t *trans = &transfer[node];
|
||||
INT32 i, j;
|
||||
|
||||
if (client)
|
||||
return;
|
||||
|
||||
// Wrong file id? Ignore it, it's probably a late packet
|
||||
if (!(trans->txlist && packet->fileid == trans->txlist->fileid))
|
||||
return;
|
||||
|
|
@ -1316,12 +1324,12 @@ void PT_FileAck(void)
|
|||
}
|
||||
}
|
||||
|
||||
void PT_FileReceived(void)
|
||||
void PT_FileReceived(SINT8 node)
|
||||
{
|
||||
filetx_t *trans = transfer[doomcom->remotenode].txlist;
|
||||
filetx_t *trans = transfer[node].txlist;
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
|
||||
if (trans && netbuffer->u.filereceived == trans->fileid)
|
||||
if (server && trans && netbuffer->u.filereceived == trans->fileid)
|
||||
SV_EndFileSend(doomcom->remotenode);
|
||||
}
|
||||
|
||||
|
|
@ -1409,8 +1417,27 @@ void FileReceiveTicker(void)
|
|||
}
|
||||
}
|
||||
|
||||
void PT_FileFragment(void)
|
||||
void PT_FileFragment(SINT8 node, INT32 netconsole)
|
||||
{
|
||||
if (nodeingame[node])
|
||||
{
|
||||
// Only accept PT_FILEFRAGMENT from the server.
|
||||
if (node != servernode)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("%s received from non-host %d\n"), "PT_FILEFRAGMENT", node);
|
||||
if (server)
|
||||
SendKick(netconsole, KICK_MSG_CON_FAIL /*| KICK_MSG_KEEP_BODY*/);
|
||||
return;
|
||||
}
|
||||
if (server)
|
||||
return;
|
||||
}
|
||||
else if (server || node != servernode)
|
||||
{
|
||||
Net_CloseConnection(node);
|
||||
return;
|
||||
}
|
||||
|
||||
doomdata_t *netbuffer = DOOMCOM_DATA(doomcom);
|
||||
filetx_pak *pak = (void*)&netbuffer->u.filetxpak;
|
||||
INT32 filenum = pak->fileid;
|
||||
|
|
|
|||
|
|
@ -96,16 +96,16 @@ void AddRamToSendQueue(INT32 node, void *data, size_t size, freemethod_t freemet
|
|||
UINT8 fileid);
|
||||
|
||||
void FileSendTicker(void);
|
||||
void PT_FileAck(void);
|
||||
void PT_FileReceived(void);
|
||||
void PT_FileAck(SINT8 node);
|
||||
void PT_FileReceived(SINT8 node);
|
||||
boolean SendingFile(INT32 node);
|
||||
|
||||
void FileReceiveTicker(void);
|
||||
void PT_FileFragment(void);
|
||||
void PT_FileFragment(SINT8 node, INT32 netconsole);
|
||||
|
||||
boolean CL_CheckDownloadable(void);
|
||||
boolean CL_SendFileRequest(void);
|
||||
boolean PT_RequestFile(INT32 node);
|
||||
void PT_RequestFile(INT32 node);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
|||
|
|
@ -193,6 +193,7 @@ extern char logfilename[1024];
|
|||
#define MAXPLAYERNAME 21
|
||||
#define MAXSPLITSCREENPLAYERS 4 // Max number of players on a single computer
|
||||
#define MAXGAMEPADS (MAXSPLITSCREENPLAYERS * 2) // Number of gamepads we'll be allowing
|
||||
#define PACKETLOSSCYCLES 4 // amount of cycles to do when measuring packet loss
|
||||
|
||||
#define MAXSKINS 4096
|
||||
#define MAXFOLLOWERS UINT16_MAX
|
||||
|
|
|
|||
|
|
@ -238,10 +238,10 @@ void R_InitSkins(void)
|
|||
R_PatchSkins((UINT16)i);
|
||||
R_LoadSpriteInfoLumps(i, wadfiles[i]->numlumps);
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (i < NUMMAINWADS)
|
||||
{
|
||||
g_discord_skins = numskins;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
ST_ReloadSkinFaceGraphics();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,10 +178,10 @@ void Taggroup_Add (taggroup_t *garray[], const mtag_t tag, size_t id)
|
|||
if (Taggroup_Find(group, id) != (size_t)-1)
|
||||
return;
|
||||
|
||||
if (! in_bit_array(tags_available, tag))
|
||||
if (! in_bit_array(tags_available, (UINT16)tag))
|
||||
{
|
||||
num_tags++;
|
||||
set_bit_array(tags_available, tag);
|
||||
set_bit_array(tags_available, (UINT16)tag);
|
||||
}
|
||||
|
||||
// Create group if empty.
|
||||
|
|
@ -218,10 +218,10 @@ static void Taggroup_Add_Init(taggroup_t *garray[], const mtag_t tag, size_t id)
|
|||
|
||||
group = garray[(UINT16)tag];
|
||||
|
||||
if (! in_bit_array(tags_available, tag))
|
||||
if (! in_bit_array(tags_available, (UINT16)tag))
|
||||
{
|
||||
num_tags++;
|
||||
set_bit_array(tags_available, tag);
|
||||
set_bit_array(tags_available, (UINT16)tag);
|
||||
}
|
||||
|
||||
// Create group if empty.
|
||||
|
|
@ -268,7 +268,7 @@ void Taggroup_Remove (taggroup_t *garray[], const mtag_t tag, size_t id)
|
|||
if (group->count == 1 && total_elements_with_tag(tag) == 1)
|
||||
{
|
||||
num_tags--;
|
||||
unset_bit_array(tags_available, tag);
|
||||
unset_bit_array(tags_available, (UINT16)tag);
|
||||
}
|
||||
|
||||
// Strip away taggroup if no elements left.
|
||||
|
|
|
|||
Loading…
Reference in a new issue