mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-26 05:31:39 +00:00
Store tic values in packets on two bytes instead of one
This commit is contained in:
parent
208af4e710
commit
9b7764df9f
2 changed files with 15 additions and 15 deletions
|
@ -205,14 +205,14 @@ tic_t ExpandTics(INT32 low)
|
||||||
{
|
{
|
||||||
INT32 delta;
|
INT32 delta;
|
||||||
|
|
||||||
delta = low - (maketic & UINT8_MAX);
|
delta = low - (maketic & UINT16_MAX);
|
||||||
|
|
||||||
if (delta >= -64 && delta <= 64)
|
if (delta >= -128 && delta <= 128)
|
||||||
return (maketic & ~UINT8_MAX) + low;
|
return (maketic & ~UINT16_MAX) + low;
|
||||||
else if (delta > 64)
|
else if (delta > 128)
|
||||||
return (maketic & ~UINT8_MAX) - 256 + low;
|
return (maketic & ~UINT16_MAX) - 65536 + low;
|
||||||
else //if (delta < -64)
|
else //if (delta < -128)
|
||||||
return (maketic & ~UINT8_MAX) + 256 + low;
|
return (maketic & ~UINT16_MAX) + 65536 + low;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
|
@ -4534,8 +4534,8 @@ static void CL_SendClientCmd(void)
|
||||||
|
|
||||||
if (cl_packetmissed)
|
if (cl_packetmissed)
|
||||||
netbuffer->packettype++;
|
netbuffer->packettype++;
|
||||||
netbuffer->u.clientpak.resendfrom = (UINT8)(neededtic & UINT8_MAX);
|
netbuffer->u.clientpak.resendfrom = (UINT16)(neededtic & UINT16_MAX);
|
||||||
netbuffer->u.clientpak.client_tic = (UINT8)(gametic & UINT8_MAX);
|
netbuffer->u.clientpak.client_tic = (UINT16)( gametic & UINT16_MAX);
|
||||||
|
|
||||||
if (gamestate == GS_WAITINGPLAYERS)
|
if (gamestate == GS_WAITINGPLAYERS)
|
||||||
{
|
{
|
||||||
|
@ -4659,7 +4659,7 @@ static void SV_SendTics(void)
|
||||||
|
|
||||||
// Send the tics
|
// Send the tics
|
||||||
netbuffer->packettype = PT_SERVERTICS;
|
netbuffer->packettype = PT_SERVERTICS;
|
||||||
netbuffer->u.serverpak.starttic = (UINT8)realfirsttic;
|
netbuffer->u.serverpak.starttic = (UINT16)realfirsttic;
|
||||||
netbuffer->u.serverpak.numtics = (UINT8)(lasttictosend - realfirsttic);
|
netbuffer->u.serverpak.numtics = (UINT8)(lasttictosend - realfirsttic);
|
||||||
netbuffer->u.serverpak.numslots = (UINT8)SHORT(doomcom->numslots);
|
netbuffer->u.serverpak.numslots = (UINT8)SHORT(doomcom->numslots);
|
||||||
bufpos = (UINT8 *)&netbuffer->u.serverpak.cmds;
|
bufpos = (UINT8 *)&netbuffer->u.serverpak.cmds;
|
||||||
|
|
|
@ -104,8 +104,8 @@ void Command_Numnodes(void);
|
||||||
// Client to server packet
|
// Client to server packet
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
UINT8 client_tic;
|
UINT16 client_tic;
|
||||||
UINT8 resendfrom;
|
UINT16 resendfrom;
|
||||||
INT16 consistancy;
|
INT16 consistancy;
|
||||||
ticcmd_t cmd;
|
ticcmd_t cmd;
|
||||||
} ATTRPACK clientcmd_pak;
|
} ATTRPACK clientcmd_pak;
|
||||||
|
@ -114,8 +114,8 @@ typedef struct
|
||||||
// WARNING: must have the same format of clientcmd_pak, for more easy use
|
// WARNING: must have the same format of clientcmd_pak, for more easy use
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
UINT8 client_tic;
|
UINT16 client_tic;
|
||||||
UINT8 resendfrom;
|
UINT16 resendfrom;
|
||||||
INT16 consistancy;
|
INT16 consistancy;
|
||||||
ticcmd_t cmd, cmd2;
|
ticcmd_t cmd, cmd2;
|
||||||
} ATTRPACK client2cmd_pak;
|
} ATTRPACK client2cmd_pak;
|
||||||
|
@ -128,7 +128,7 @@ typedef struct
|
||||||
// this packet is too large
|
// this packet is too large
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
UINT8 starttic;
|
UINT16 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]; // Normally [BACKUPTIC][MAXPLAYERS] but too large
|
||||||
|
|
Loading…
Reference in a new issue