mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
server: extend gun frame and index to short
This commit is contained in:
parent
cc2f531faa
commit
c57fd107d6
2 changed files with 36 additions and 6 deletions
|
@ -631,12 +631,27 @@ CL_ParsePlayerstate(frame_t *oldframe, frame_t *newframe)
|
|||
|
||||
if (flags & PS_WEAPONINDEX)
|
||||
{
|
||||
state->gunindex = MSG_ReadByte(&net_message);
|
||||
if (IS_QII97_PROTOCOL(cls.serverProtocol))
|
||||
{
|
||||
state->gunindex = MSG_ReadByte(&net_message);
|
||||
}
|
||||
else
|
||||
{
|
||||
state->gunindex = MSG_ReadShort(&net_message);
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & PS_WEAPONFRAME)
|
||||
{
|
||||
state->gunframe = MSG_ReadByte(&net_message);
|
||||
if (IS_QII97_PROTOCOL(cls.serverProtocol))
|
||||
{
|
||||
state->gunframe = MSG_ReadByte(&net_message);
|
||||
}
|
||||
else
|
||||
{
|
||||
state->gunframe = MSG_ReadShort(&net_message);
|
||||
}
|
||||
|
||||
state->gunoffset[0] = MSG_ReadChar(&net_message) * 0.25f;
|
||||
state->gunoffset[1] = MSG_ReadChar(&net_message) * 0.25f;
|
||||
state->gunoffset[2] = MSG_ReadChar(&net_message) * 0.25f;
|
||||
|
|
|
@ -150,7 +150,7 @@ SV_EmitPacketEntities(client_frame_t *from, client_frame_t *to, sizebuf_t *msg,
|
|||
|
||||
static void
|
||||
SV_WritePlayerstateToClient(client_frame_t *from, client_frame_t *to,
|
||||
sizebuf_t *msg)
|
||||
sizebuf_t *msg, int protocol)
|
||||
{
|
||||
int i;
|
||||
int pflags;
|
||||
|
@ -338,12 +338,27 @@ SV_WritePlayerstateToClient(client_frame_t *from, client_frame_t *to,
|
|||
|
||||
if (pflags & PS_WEAPONINDEX)
|
||||
{
|
||||
MSG_WriteByte(msg, ps->gunindex);
|
||||
if (IS_QII97_PROTOCOL(protocol))
|
||||
{
|
||||
MSG_WriteByte(msg, ps->gunindex);
|
||||
}
|
||||
else
|
||||
{
|
||||
MSG_WriteShort(msg, ps->gunindex);
|
||||
}
|
||||
}
|
||||
|
||||
if (pflags & PS_WEAPONFRAME)
|
||||
{
|
||||
MSG_WriteByte(msg, ps->gunframe);
|
||||
if (IS_QII97_PROTOCOL(protocol))
|
||||
{
|
||||
MSG_WriteByte(msg, ps->gunframe);
|
||||
}
|
||||
else
|
||||
{
|
||||
MSG_WriteShort(msg, ps->gunframe);
|
||||
}
|
||||
|
||||
MSG_WriteChar(msg, ps->gunoffset[0] * 4);
|
||||
MSG_WriteChar(msg, ps->gunoffset[1] * 4);
|
||||
MSG_WriteChar(msg, ps->gunoffset[2] * 4);
|
||||
|
@ -431,7 +446,7 @@ SV_WriteFrameToClient(client_t *client, sizebuf_t *msg)
|
|||
SZ_Write(msg, frame->areabits, frame->areabytes);
|
||||
|
||||
/* delta encode the playerstate */
|
||||
SV_WritePlayerstateToClient(oldframe, frame, msg);
|
||||
SV_WritePlayerstateToClient(oldframe, frame, msg, client->protocol);
|
||||
|
||||
/* delta encode the entities */
|
||||
SV_EmitPacketEntities(oldframe, frame, msg, client->protocol);
|
||||
|
|
Loading…
Reference in a new issue