Use per-node reference tics in ExpandTics
This commit is contained in:
parent
fc07db26c0
commit
e49d3d0bb9
|
@ -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)
|
// of 512 bytes is like 0.1)
|
||||||
UINT16 software_MAXPACKETLENGTH;
|
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 low The lowest byte of the tic value
|
||||||
|
* \param node The node to deduce the tic for
|
||||||
* \return The full tic value
|
* \return The full tic value
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
tic_t ExpandTics(INT32 low)
|
tic_t ExpandTics(INT32 low, INT32 node)
|
||||||
{
|
{
|
||||||
INT32 delta;
|
INT32 delta;
|
||||||
|
|
||||||
delta = low - (maketic & UINT8_MAX);
|
delta = low - (nettics[node] & UINT8_MAX);
|
||||||
|
|
||||||
if (delta >= -64 && delta <= 64)
|
if (delta >= -64 && delta <= 64)
|
||||||
return (maketic & ~UINT8_MAX) + low;
|
return (nettics[node] & ~UINT8_MAX) + low;
|
||||||
else if (delta > 64)
|
else if (delta > 64)
|
||||||
return (maketic & ~UINT8_MAX) - 256 + low;
|
return (nettics[node] & ~UINT8_MAX) - 256 + low;
|
||||||
else //if (delta < -64)
|
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
|
// To save bytes, only the low byte of tic numbers are sent
|
||||||
// Use ExpandTics to figure out what the rest of the bytes are
|
// Use ExpandTics to figure out what the rest of the bytes are
|
||||||
realstart = ExpandTics(netbuffer->u.clientpak.client_tic);
|
realstart = ExpandTics(netbuffer->u.clientpak.client_tic, node);
|
||||||
realend = ExpandTics(netbuffer->u.clientpak.resendfrom);
|
realend = ExpandTics(netbuffer->u.clientpak.resendfrom, node);
|
||||||
|
|
||||||
if (netbuffer->packettype == PT_CLIENTMIS || netbuffer->packettype == PT_CLIENT2MIS
|
if (netbuffer->packettype == PT_CLIENTMIS || netbuffer->packettype == PT_CLIENT2MIS
|
||||||
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS
|
|| netbuffer->packettype == PT_NODEKEEPALIVEMIS
|
||||||
|
|
|
@ -520,7 +520,7 @@ extern consvar_t cv_resynchattempts, cv_blamecfail;
|
||||||
extern consvar_t cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
extern consvar_t cv_maxsend, cv_noticedownload, cv_downloadspeed;
|
||||||
|
|
||||||
// Used in d_net, the only dependence
|
// Used in d_net, the only dependence
|
||||||
tic_t ExpandTics(INT32 low);
|
tic_t ExpandTics(INT32 low, INT32 node);
|
||||||
void D_ClientServerInit(void);
|
void D_ClientServerInit(void);
|
||||||
|
|
||||||
// Initialise the other field
|
// Initialise the other field
|
||||||
|
|
|
@ -857,8 +857,8 @@ static void DebugPrintpacket(const char *header)
|
||||||
case PT_NODEKEEPALIVE:
|
case PT_NODEKEEPALIVE:
|
||||||
case PT_NODEKEEPALIVEMIS:
|
case PT_NODEKEEPALIVEMIS:
|
||||||
fprintf(debugfile, " tic %4u resendfrom %u\n",
|
fprintf(debugfile, " tic %4u resendfrom %u\n",
|
||||||
(UINT32)ExpandTics(netbuffer->u.clientpak.client_tic),
|
(UINT32)ExpandTics(netbuffer->u.clientpak.client_tic, doomcom->remotenode),
|
||||||
(UINT32)ExpandTics (netbuffer->u.clientpak.resendfrom));
|
(UINT32)ExpandTics (netbuffer->u.clientpak.resendfrom, doomcom->remotenode));
|
||||||
break;
|
break;
|
||||||
case PT_TEXTCMD:
|
case PT_TEXTCMD:
|
||||||
case PT_TEXTCMD2:
|
case PT_TEXTCMD2:
|
||||||
|
|
Loading…
Reference in a new issue