mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
Fix support for replacementdeltas with ent counts above 32767 (in case other engines use qss as their reference for support, or if it gets bumped later).
This commit is contained in:
parent
1c750b3f5f
commit
85e9399f2f
6 changed files with 26 additions and 22 deletions
|
@ -63,7 +63,7 @@ void CL_ParseBeam (qmodel_t *m, const char *trailname, const char *impactname)
|
||||||
beam_t *b;
|
beam_t *b;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ent = MSG_ReadShort ();
|
ent = MSG_ReadEntity (cl.protocol_pext2);
|
||||||
|
|
||||||
start[0] = MSG_ReadCoord (cl.protocolflags);
|
start[0] = MSG_ReadCoord (cl.protocolflags);
|
||||||
start[1] = MSG_ReadCoord (cl.protocolflags);
|
start[1] = MSG_ReadCoord (cl.protocolflags);
|
||||||
|
|
|
@ -761,6 +761,19 @@ void MSG_WriteAngle16 (sizebuf_t *sb, float f, unsigned int flags)
|
||||||
}
|
}
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
|
//spike -- for PEXT2_REPLACEMENTDELTAS
|
||||||
|
void MSG_WriteEntity (sizebuf_t *sb, unsigned int entnum, unsigned int pext2)
|
||||||
|
{
|
||||||
|
//high short, low byte
|
||||||
|
if (entnum > 0x7fff && (pext2 & PEXT2_REPLACEMENTDELTAS))
|
||||||
|
{
|
||||||
|
MSG_WriteShort(sb, 0x8000|(entnum>>8));
|
||||||
|
MSG_WriteByte(sb, entnum&0xff);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
MSG_WriteShort(sb, entnum);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// reading functions
|
// reading functions
|
||||||
//
|
//
|
||||||
|
@ -932,9 +945,9 @@ float MSG_ReadAngle16 (unsigned int flags)
|
||||||
}
|
}
|
||||||
//johnfitz
|
//johnfitz
|
||||||
|
|
||||||
int MSG_ReadEntity(unsigned int pext2)
|
unsigned int MSG_ReadEntity(unsigned int pext2)
|
||||||
{
|
{
|
||||||
int e = (unsigned short)MSG_ReadShort();
|
unsigned int e = (unsigned short)MSG_ReadShort();
|
||||||
if (pext2 & PEXT2_REPLACEMENTDELTAS)
|
if (pext2 & PEXT2_REPLACEMENTDELTAS)
|
||||||
{
|
{
|
||||||
if (e & 0x8000)
|
if (e & 0x8000)
|
||||||
|
|
|
@ -103,6 +103,7 @@ void MSG_WriteString (sizebuf_t *sb, const char *s);
|
||||||
void MSG_WriteCoord (sizebuf_t *sb, float f, unsigned int flags);
|
void MSG_WriteCoord (sizebuf_t *sb, float f, unsigned int flags);
|
||||||
void MSG_WriteAngle (sizebuf_t *sb, float f, unsigned int flags);
|
void MSG_WriteAngle (sizebuf_t *sb, float f, unsigned int flags);
|
||||||
void MSG_WriteAngle16 (sizebuf_t *sb, float f, unsigned int flags); //johnfitz
|
void MSG_WriteAngle16 (sizebuf_t *sb, float f, unsigned int flags); //johnfitz
|
||||||
|
void MSG_WriteEntity(sizebuf_t *sb, unsigned int index, unsigned int pext2); //spike
|
||||||
struct entity_state_s;
|
struct entity_state_s;
|
||||||
void MSG_WriteStaticOrBaseLine(sizebuf_t *buf, int idx, struct entity_state_s *state, unsigned int protocol_pext2, unsigned int protocol, unsigned int protocolflags); //spike
|
void MSG_WriteStaticOrBaseLine(sizebuf_t *buf, int idx, struct entity_state_s *state, unsigned int protocol_pext2, unsigned int protocol, unsigned int protocolflags); //spike
|
||||||
|
|
||||||
|
@ -121,7 +122,7 @@ float MSG_ReadCoord (unsigned int flags);
|
||||||
float MSG_ReadAngle (unsigned int flags);
|
float MSG_ReadAngle (unsigned int flags);
|
||||||
float MSG_ReadAngle16 (unsigned int flags); //johnfitz
|
float MSG_ReadAngle16 (unsigned int flags); //johnfitz
|
||||||
byte *MSG_ReadData (unsigned int length); // spike
|
byte *MSG_ReadData (unsigned int length); // spike
|
||||||
int MSG_ReadEntity(unsigned int pext2); //spike
|
unsigned int MSG_ReadEntity(unsigned int pext2); //spike
|
||||||
|
|
||||||
void COM_Effectinfo_Enumerate(int (*cb)(const char *pname)); //spike -- for dp compat
|
void COM_Effectinfo_Enumerate(int (*cb)(const char *pname)); //spike -- for dp compat
|
||||||
|
|
||||||
|
|
|
@ -1638,10 +1638,10 @@ static void PF_sv_WriteString (void)
|
||||||
MSG_WriteString (WriteDest(), G_STRING(OFS_PARM1));
|
MSG_WriteString (WriteDest(), G_STRING(OFS_PARM1));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MSG_WriteEntity MSG_WriteShort //fixme - replacement deltas encodes 0x8000+ in 24 bits
|
|
||||||
static void PF_sv_WriteEntity (void)
|
static void PF_sv_WriteEntity (void)
|
||||||
{
|
{
|
||||||
MSG_WriteEntity (WriteDest(), G_EDICTNUM(OFS_PARM1));
|
extern unsigned int sv_protocol_pext2; //spike -- this ought to be client-specific, but we can't cope with that, so just live with the problems when ents>32768 (which QS doesn't support anyway)
|
||||||
|
MSG_WriteEntity (WriteDest(), G_EDICTNUM(OFS_PARM1), sv_protocol_pext2);
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
|
@ -5209,6 +5209,7 @@ static void PF_cl_sendevent(void)
|
||||||
const char *eventname = G_STRING(OFS_PARM0);
|
const char *eventname = G_STRING(OFS_PARM0);
|
||||||
const char *eventargs = G_STRING(OFS_PARM1);
|
const char *eventargs = G_STRING(OFS_PARM1);
|
||||||
int a;
|
int a;
|
||||||
|
eval_t *val;
|
||||||
|
|
||||||
MSG_WriteByte(&cls.message, clcfte_qcrequest);
|
MSG_WriteByte(&cls.message, clcfte_qcrequest);
|
||||||
for (a = 2; a < 8 && *eventargs; a++, eventargs++)
|
for (a = 2; a < 8 && *eventargs; a++, eventargs++)
|
||||||
|
@ -5233,10 +5234,11 @@ static void PF_cl_sendevent(void)
|
||||||
MSG_WriteFloat(&cls.message, G_FLOAT(OFS_PARM0+a*3+1));
|
MSG_WriteFloat(&cls.message, G_FLOAT(OFS_PARM0+a*3+1));
|
||||||
MSG_WriteFloat(&cls.message, G_FLOAT(OFS_PARM0+a*3+2));
|
MSG_WriteFloat(&cls.message, G_FLOAT(OFS_PARM0+a*3+2));
|
||||||
break;
|
break;
|
||||||
// case 'e':
|
case 'e':
|
||||||
// MSG_WriteByte(&cls.message, ev_entity);
|
MSG_WriteByte(&cls.message, ev_entity);
|
||||||
// MSG_WriteEntity(&cls.message, ent->v.entnum);
|
val = GetEdictFieldValue(host_client->edict, ED_FindFieldOffset("entnum")); //we need to transmit the SERVER's number, the client's number is meaningless to it.
|
||||||
// break;
|
MSG_WriteEntity(&cls.message, val?val->_float:0, cl.protocol_pext2);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MSG_WriteByte(&cls.message, 0);
|
MSG_WriteByte(&cls.message, 0);
|
||||||
|
|
|
@ -274,18 +274,6 @@ static unsigned int MSGFTE_DeltaCalcBits(entity_state_t *from, entity_state_t *t
|
||||||
return bits;
|
return bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#undef MSG_WriteEntity
|
|
||||||
void MSG_WriteEntity (sizebuf_t *sb, int c, unsigned int pext2)
|
|
||||||
{
|
|
||||||
//high short, low byte
|
|
||||||
if (c > 0x7fff && (pext2 & PEXT2_REPLACEMENTDELTAS))
|
|
||||||
{
|
|
||||||
MSG_WriteShort(sb, 0x8000|(c>>8));
|
|
||||||
MSG_WriteByte(sb, c&0xff);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
MSG_WriteShort(sb, c);
|
|
||||||
}
|
|
||||||
static void MSGFTE_WriteEntityUpdate(unsigned int bits, entity_state_t *state, sizebuf_t *msg, unsigned int pext2, unsigned int protocolflags)
|
static void MSGFTE_WriteEntityUpdate(unsigned int bits, entity_state_t *state, sizebuf_t *msg, unsigned int pext2, unsigned int protocolflags)
|
||||||
{
|
{
|
||||||
unsigned int predbits = 0;
|
unsigned int predbits = 0;
|
||||||
|
|
Loading…
Reference in a new issue