mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-25 21:31:37 +00:00
Quake II: read the skin, effects, renderfx, and solidsize fields as unsigned shorts (#200)
* Quake II: read the skin, effects, renderfx, and solidsize fields as unsigned shorts. * Add missing header definition for int MSG_ReadUShort(); * Rename MSG_ReadUShort() to MSG_ReadUInt16() as per @Shpoike's wishes * solidsize needs to be read in via MSG_ReadSize16 because it does protocol conversions (@Shpoike) * Q2UFRAME16 and Q2USOUND should be read unsigned as well, as it matches the internal data within FTE (@Shpoike)
This commit is contained in:
parent
65dccaf2db
commit
f317282571
3 changed files with 30 additions and 5 deletions
|
@ -976,28 +976,28 @@ static void CLQ2_ParseDelta (entity_state_t *from, entity_state_t *to, int numbe
|
|||
if (bits & Q2U_FRAME8)
|
||||
to->frame = MSG_ReadByte ();
|
||||
if (bits & Q2U_FRAME16)
|
||||
to->frame = MSG_ReadShort ();
|
||||
to->frame = MSG_ReadUInt16();
|
||||
|
||||
if ((bits & Q2U_SKIN8) && (bits & Q2U_SKIN16)) //used for laser colors
|
||||
to->skinnum = MSG_ReadLong();
|
||||
else if (bits & Q2U_SKIN8)
|
||||
to->skinnum = MSG_ReadByte();
|
||||
else if (bits & Q2U_SKIN16)
|
||||
to->skinnum = MSG_ReadShort();
|
||||
to->skinnum = MSG_ReadUInt16();
|
||||
|
||||
if ( (bits & (Q2U_EFFECTS8|Q2U_EFFECTS16)) == (Q2U_EFFECTS8|Q2U_EFFECTS16) )
|
||||
to->effects = MSG_ReadLong();
|
||||
else if (bits & Q2U_EFFECTS8)
|
||||
to->effects = MSG_ReadByte();
|
||||
else if (bits & Q2U_EFFECTS16)
|
||||
to->effects = MSG_ReadShort();
|
||||
to->effects = MSG_ReadUInt16();
|
||||
|
||||
if ( (bits & (Q2U_RENDERFX8|Q2U_RENDERFX16)) == (Q2U_RENDERFX8|Q2U_RENDERFX16) )
|
||||
to->u.q2.renderfx = MSG_ReadLong() & 0x0007ffff; //only the standard ones actually supported by vanilla q2.
|
||||
else if (bits & Q2U_RENDERFX8)
|
||||
to->u.q2.renderfx = MSG_ReadByte();
|
||||
else if (bits & Q2U_RENDERFX16)
|
||||
to->u.q2.renderfx = MSG_ReadShort();
|
||||
to->u.q2.renderfx = MSG_ReadUInt16();
|
||||
|
||||
if (bits & Q2U_ORIGIN1)
|
||||
to->origin[0] = MSG_ReadCoord ();
|
||||
|
@ -1031,7 +1031,7 @@ static void CLQ2_ParseDelta (entity_state_t *from, entity_state_t *to, int numbe
|
|||
if (bits & Q2U_SOUND)
|
||||
{
|
||||
if (bits & Q2UX_INDEX16)
|
||||
to->u.q2.sound = MSG_ReadShort();
|
||||
to->u.q2.sound = MSG_ReadUInt16();
|
||||
else
|
||||
to->u.q2.sound = MSG_ReadByte ();
|
||||
}
|
||||
|
|
|
@ -2183,6 +2183,30 @@ int MSG_ReadShort (void)
|
|||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadUInt16 (void)
|
||||
{
|
||||
int c;
|
||||
unsigned int msg_readcount;
|
||||
|
||||
if (msg_readmsg->packing!=SZ_RAWBYTES)
|
||||
return (short)MSG_ReadBits(16);
|
||||
|
||||
msg_readcount = msg_readmsg->currentbit>>3;
|
||||
if (msg_readcount+2 > msg_readmsg->cursize)
|
||||
{
|
||||
msg_badread = true;
|
||||
return -1;
|
||||
}
|
||||
|
||||
c = (unsigned short)(msg_readmsg->data[msg_readcount]
|
||||
+ (msg_readmsg->data[msg_readcount+1]<<8));
|
||||
|
||||
msg_readcount += 2;
|
||||
msg_readmsg->currentbit = msg_readcount<<3;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
int MSG_ReadLong (void)
|
||||
{
|
||||
int c;
|
||||
|
|
|
@ -352,6 +352,7 @@ int MSG_ReadChar (void);
|
|||
int MSG_ReadBits(int bits);
|
||||
int MSG_ReadByte (void);
|
||||
int MSG_ReadShort (void);
|
||||
int MSG_ReadUInt16 (void);
|
||||
int MSG_ReadLong (void);
|
||||
qint64_t MSG_ReadInt64 (void);
|
||||
quint64_t MSG_ReadUInt64 (void);
|
||||
|
|
Loading…
Reference in a new issue