mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-18 18:11:28 +00:00
Use per-node reference tics in ExpandTics
This commit is contained in:
parent
fc07db26c0
commit
e49d3d0bb9
3 changed files with 12 additions and 11 deletions
|
@ -195,24 +195,25 @@ static inline void *G_ScpyTiccmd(ticcmd_t* dest, void* src, const size_t n)
|
|||
// of 512 bytes is like 0.1)
|
||||
UINT16 software_MAXPACKETLENGTH;
|
||||
|
||||
/** Guesses the value of a tic from its lowest byte and from maketic
|
||||
/** Guesses the full value of a tic from its lowest byte, for a specific node
|
||||
*
|
||||
* \param low The lowest byte of the tic value
|
||||
* \param node The node to deduce the tic for
|
||||
* \return The full tic value
|
||||
*
|
||||
*/
|
||||
tic_t ExpandTics(INT32 low)
|
||||
tic_t ExpandTics(INT32 low, INT32 node)
|
||||
{
|
||||
INT32 delta;
|
||||
|
||||
delta = low - (maketic & UINT8_MAX);
|
||||
delta = low - (nettics[node] & UINT8_MAX);
|
||||
|
||||
if (delta >= -64 && delta <= 64)
|
||||
return (maketic & ~UINT8_MAX) + low;
|
||||
return (nettics[node] & ~UINT8_MAX) + low;
|
||||
else if (delta > 64)
|
||||
return (maketic & ~UINT8_MAX) - 256 + low;
|
||||
return (nettics[node] & ~UINT8_MAX) - 256 + low;
|
||||
else //if (delta < -64)
|
||||
return (maketic & ~UINT8_MAX) + 256 + low;
|
||||
return (nettics[node] & ~UINT8_MAX) + 256 + low;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
@ -3999,8 +4000,8 @@ static void HandlePacketFromPlayer(SINT8 node)
|
|||
|
||||
// To save bytes, only the low byte of tic numbers are sent
|
||||
// Use ExpandTics to figure out what the rest of the bytes are
|
||||
realstart = ExpandTics(netbuffer->u.clientpak.client_tic);
|
||||
realend = ExpandTics(netbuffer->u.clientpak.resendfrom);
|
||||
realstart = ExpandTics(netbuffer->u.clientpak.client_tic, node);
|
||||
realend = ExpandTics(netbuffer->u.clientpak.resendfrom, node);
|
||||
|
||||
if (netbuffer->packettype == PT_CLIENTMIS || netbuffer->packettype == PT_CLIENT2MIS
|
||||
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS
|
||||
|
|
|
@ -520,7 +520,7 @@ extern consvar_t cv_resynchattempts, cv_blamecfail;
|
|||
extern consvar_t cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||
|
||||
// Used in d_net, the only dependence
|
||||
tic_t ExpandTics(INT32 low);
|
||||
tic_t ExpandTics(INT32 low, INT32 node);
|
||||
void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
|
|
|
@ -857,8 +857,8 @@ static void DebugPrintpacket(const char *header)
|
|||
case PT_NODEKEEPALIVE:
|
||||
case PT_NODEKEEPALIVEMIS:
|
||||
fprintf(debugfile, " tic %4u resendfrom %u\n",
|
||||
(UINT32)ExpandTics(netbuffer->u.clientpak.client_tic),
|
||||
(UINT32)ExpandTics (netbuffer->u.clientpak.resendfrom));
|
||||
(UINT32)ExpandTics(netbuffer->u.clientpak.client_tic, doomcom->remotenode),
|
||||
(UINT32)ExpandTics (netbuffer->u.clientpak.resendfrom, doomcom->remotenode));
|
||||
break;
|
||||
case PT_TEXTCMD:
|
||||
case PT_TEXTCMD2:
|
||||
|
|
Loading…
Reference in a new issue