1
0
Fork 0
forked from fte/fteqw

Better compat with quakespasm's demos.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5566 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-10-14 02:36:57 +00:00
parent 9984042186
commit 76f1f0ef66
16 changed files with 178 additions and 127 deletions

View file

@ -1366,10 +1366,14 @@ void CLNQ_WriteServerData(sizebuf_t *buf) //for demo recording
protfl |= RMQFL_SHORTANGLE;
if (cls.netchan.message.prim.anglesize == 4)
protfl |= RMQFL_FLOATANGLE;
if (cls.netchan.message.prim.coordsize == 3)
protfl |= RMQFL_24BITCOORD;
if (cls.netchan.message.prim.coordsize == 4)
protfl |= RMQFL_FLOATCOORD;
switch(cls.netchan.message.prim.coordtype)
{
case COORDTYPE_FLOAT_32: protfl |= RMQFL_FLOATCOORD; break;
case COORDTYPE_FIXED_28_4: protfl |= RMQFL_INT32COORD; break;
case COORDTYPE_FIXED_16_8: protfl |= RMQFL_24BITCOORD; break;
default: //err?
case COORDTYPE_FIXED_13_3: break;
}
switch(cls.protocol_nq)
{
default:

View file

@ -2342,7 +2342,7 @@ void CL_CheckServerInfo(void)
if (!(movevars.flags&MOVEFLAG_VALID))
movevars.flags = (movevars.flags&~MOVEFLAG_QWEDGEBOX) | (*s?0:MOVEFLAG_QWEDGEBOX);
}
movevars.coordsize = cls.netchan.netprim.coordsize;
movevars.coordtype = cls.netchan.netprim.coordtype;
// Initialize cl.maxpitch & cl.minpitch
if (cls.protocol == CP_QUAKEWORLD || cls.protocol == CP_NETQUAKE)

View file

@ -3233,12 +3233,12 @@ static void CLQW_ParseServerData (void)
if (cls.fteprotocolextensions & PEXT_FLOATCOORDS)
{
cls.netchan.netprim.coordsize = 4;
cls.netchan.netprim.coordtype = COORDTYPE_FLOAT_32;
cls.netchan.netprim.anglesize = 2;
}
else
{
cls.netchan.netprim.coordsize = 2;
cls.netchan.netprim.coordtype = COORDTYPE_FIXED_13_3;
cls.netchan.netprim.anglesize = 1;
}
cls.netchan.message.prim = cls.netchan.netprim;
@ -3478,7 +3478,7 @@ static void CLQ2_ParseServerData (void)
// int cflag;
memset(&cls.netchan.netprim, 0, sizeof(cls.netchan.netprim));
cls.netchan.netprim.coordsize = 2;
cls.netchan.netprim.coordtype = COORDTYPE_FIXED_13_3;
cls.netchan.netprim.anglesize = 1;
cls.fteprotocolextensions = 0;
cls.fteprotocolextensions2 = 0;
@ -3513,7 +3513,7 @@ static void CLQ2_ParseServerData (void)
i = MSG_ReadLong ();
if (cls.fteprotocolextensions & PEXT_FLOATCOORDS)
cls.netchan.netprim.coordsize = 4;
cls.netchan.netprim.coordtype = COORDTYPE_FLOAT_32;
}
cls.protocol_q2 = i;
@ -3669,7 +3669,7 @@ static void CLNQ_ParseProtoVersion(void)
break;
}
netprim.coordsize = 2;
netprim.coordtype = COORDTYPE_FIXED_13_3;
netprim.anglesize = 1;
cls.protocol_nq = CPNQ_ID;
@ -3706,17 +3706,19 @@ static void CLNQ_ParseProtoVersion(void)
if (fl & RMQFL_FLOATANGLE)
netprim.anglesize = 4;
if (fl & RMQFL_24BITCOORD)
netprim.coordsize = 3;
netprim.coordtype = COORDTYPE_FIXED_16_8;
if (fl & RMQFL_INT32COORD)
netprim.coordtype = COORDTYPE_FIXED_28_4;
if (fl & RMQFL_FLOATCOORD)
netprim.coordsize = 4;
if (fl & ~(RMQFL_SHORTANGLE|RMQFL_FLOATANGLE|RMQFL_24BITCOORD|RMQFL_FLOATCOORD|RMQFL_EDICTSCALE))
netprim.coordtype = COORDTYPE_FLOAT_32;
if (fl & ~(RMQFL_SHORTANGLE|RMQFL_FLOATANGLE|RMQFL_24BITCOORD|RMQFL_INT32COORD|RMQFL_FLOATCOORD|RMQFL_EDICTSCALE))
Con_Printf("WARNING: Server is using unsupported RMQ extensions\n");
}
else if (protover == PROTOCOL_VERSION_DP5)
{
//darkplaces5
cls.protocol_nq = CPNQ_DP5;
netprim.coordsize = 4;
netprim.coordtype = COORDTYPE_FLOAT_32;
netprim.anglesize = 2;
Con_DPrintf("DP5 protocols\n");
@ -3725,7 +3727,7 @@ static void CLNQ_ParseProtoVersion(void)
{
//darkplaces6 (it's a small difference from dp5)
cls.protocol_nq = CPNQ_DP6;
netprim.coordsize = 4;
netprim.coordtype = COORDTYPE_FLOAT_32;
netprim.anglesize = 2;
cls.z_ext = Z_EXT_VIEWHEIGHT;
@ -3736,7 +3738,7 @@ static void CLNQ_ParseProtoVersion(void)
{
//darkplaces7 (it's a small difference from dp5)
cls.protocol_nq = CPNQ_DP7;
netprim.coordsize = 4;
netprim.coordtype = COORDTYPE_FLOAT_32;
netprim.anglesize = 2;
cls.z_ext = Z_EXT_VIEWHEIGHT;
@ -3770,8 +3772,8 @@ static void CLNQ_ParseProtoVersion(void)
{
if (netprim.anglesize < 2)
netprim.anglesize = 2;
if (netprim.coordsize < 4)
netprim.coordsize = 4;
if (netprim.coordtype < COORDTYPE_FLOAT_32)
netprim.coordtype = COORDTYPE_FLOAT_32;
}
cls.netchan.message.prim = cls.netchan.netprim = netprim;
MSG_ChangePrimitives(netprim);

View file

@ -3593,7 +3593,7 @@ static void QCBUILTIN PF_cs_runplayerphysics (pubprogfuncs_t *prinst, struct glo
pmove.safeorigin_known = false;
pmove.capsule = false; //FIXME
movevars.coordsize = cls.netchan.message.prim.coordsize;
movevars.coordtype = cls.netchan.message.prim.coordtype;
if (ent->xv->gravity)
movevars.entgravity = ent->xv->gravity;
else if (csqc_playerseat >= 0 && cl.playerview[csqc_playerseat].playernum+1 == ent->xv->entnum)
@ -7466,7 +7466,7 @@ qboolean CSQC_Init (qboolean anycsqc, const char *csprogsname, unsigned int chec
movevars.flyfriction = 4;//*pm_flyfriction.string?pm_flyfriction.value:4;
movevars.edgefriction = 2;//*pm_edgefriction.string?pm_edgefriction.value:2;
movevars.stepheight = PM_DEFAULTSTEPHEIGHT;
movevars.coordsize = 4;
movevars.coordtype = COORDTYPE_FLOAT_32;
movevars.flags = MOVEFLAG_NOGRAVITYONGROUND;
}

View file

@ -3791,6 +3791,8 @@ static void Cmd_set_f(void)
Con_Printf ("variable %s is readonly\n", var->name);
return;
}
if (var->flags & CVAR_NOUNSAFEEXPAND)
forceflags &= ~(CVAR_USERINFO|CVAR_SERVERINFO);
if (Cmd_FromGamecode())
{

View file

@ -946,34 +946,47 @@ void MSG_WriteString (sizebuf_t *sb, const char *s)
SZ_Write (sb, s, Q_strlen(s)+1);
}
float MSG_FromCoord(coorddata c, int bytes)
float MSG_FromCoord(coorddata c, int type)
{
switch(bytes)
switch(type)
{
case 2: //encode 1/8th precision, giving -4096 to 4096 map sizes
case COORDTYPE_FIXED_13_3: //encode 1/8th precision, giving -4096 to 4096 map sizes
return LittleShort(c.b2)/8.0f;
case 3:
case COORDTYPE_FIXED_16_8:
return LittleShort(c.b2) + (((unsigned char*)c.b)[2] * (1/255.0)); /*FIXME: RMQe uses 255, should be 256*/
case 4:
case COORDTYPE_FIXED_28_4:
return LittleLong(c.b4)/16.0f;
case COORDTYPE_FLOAT_32:
return LittleFloat(c.f);
default:
Sys_Error("MSG_ToCoord: not a sane coordsize");
return 0;
}
}
coorddata MSG_ToCoord(float f, int bytes) //return value should be treated as (char*)&ret;
coorddata MSG_ToCoord(float f, int type) //return value should be treated as (char*)&ret;
{
coorddata r;
switch(bytes)
switch(type)
{
case 2:
case COORDTYPE_FIXED_13_3:
r.b4 = 0;
if (f >= 0)
r.b2 = LittleShort((short)(f*8+0.5f));
else
r.b2 = LittleShort((short)(f*8-0.5f));
break;
case 4:
case COORDTYPE_FIXED_16_8:
r.b2 = LittleShort((short)f);
r.b[2] = (int)(f*255)%255;
r.b[3] = 0;
break;
case COORDTYPE_FIXED_28_4:
if (f >= 0)
r.b4 = LittleLong((short)(f*16+0.5f));
else
r.b4 = LittleLong((short)(f*16-0.5f));
break;
case COORDTYPE_FLOAT_32:
r.f = LittleFloat(f);
break;
default:
@ -1016,8 +1029,8 @@ coorddata MSG_ToAngle(float f, int bytes) //return value is NOT byteswapped.
void MSG_WriteCoord (sizebuf_t *sb, float f)
{
coorddata i = MSG_ToCoord(f, sb->prim.coordsize);
SZ_Write (sb, (void*)&i, sb->prim.coordsize);
coorddata i = MSG_ToCoord(f, sb->prim.coordtype);
SZ_Write (sb, (void*)&i, sb->prim.coordtype&0xf);
}
/*static void MSG_WriteCoord24 (sizebuf_t *sb, float f)
{
@ -1682,10 +1695,10 @@ char *MSG_ReadStringLine (void)
float MSG_ReadCoord (void)
{
coorddata c = {{0}};
if (!net_message.prim.coordsize)
net_message.prim.coordsize = 2;
MSG_ReadData(&c, net_message.prim.coordsize);
return MSG_FromCoord(c, net_message.prim.coordsize);
if (net_message.prim.coordtype == COORDTYPE_UNDEFINED)
net_message.prim.coordtype = COORDTYPE_FIXED_13_3;
MSG_ReadData(&c, net_message.prim.coordtype&0xf);
return MSG_FromCoord(c, net_message.prim.coordtype);
}
/*static float MSG_ReadCoord24 (void)
{

View file

@ -152,13 +152,18 @@ typedef enum {qfalse, qtrue} qboolean;
struct netprim_s
{
qbyte coordsize;
qbyte coordtype; //low 4 bits are the size, upper 4 are disambiguation...
#define COORDTYPE_UNDEFINED 0 //invalid
#define COORDTYPE_FIXED_13_3 2 //vanilla/etc
#define COORDTYPE_FIXED_16_8 3 //rmq
#define COORDTYPE_FIXED_28_4 4 //rmq, pointless
#define COORDTYPE_FLOAT_32 (4|0x80) //fte/dp/rmq
qbyte anglesize;
#define NPQ2_ANG16 (1u<<0)
#define NPQ2_SOLID32 (1u<<1)
#define NPQ2_R1Q2_UCMD (1u<<2)
qbyte flags;
#define NPQ2_ANG16 (1u<<0)
#define NPQ2_SOLID32 (1u<<1)
#define NPQ2_R1Q2_UCMD (1u<<2)
qbyte pad;
};
//============================================================================

View file

@ -1232,11 +1232,11 @@ static void PM_NudgePosition (void)
#ifdef HAVE_LEGACY
pm_noround.ival ||
#endif
movevars.coordsize == 4) //float precision on the network. no need to truncate.
movevars.coordtype == COORDTYPE_FLOAT_32) //float precision on the network. no need to truncate.
{
VectorCopy (pmove.origin, base);
}
else if (movevars.coordsize) //1/8th precision, but don't truncate because that screws everything up.
else if (movevars.coordtype == COORDTYPE_FIXED_13_3) //1/8th precision, but don't truncate because that screws everything up.
{
for (i=0 ; i<3 ; i++)
{

View file

@ -122,7 +122,7 @@ typedef struct {
qboolean slidyslopes;
int stepheight;
qbyte coordsize; //FIXME: EZPEXT1_FLOATENTCOORDS should mean 4, but the result does not match ezquake/mvdsv which would result in inconsistencies. so player coords are rounded inconsistently.
qbyte coordtype; //FIXME: EZPEXT1_FLOATENTCOORDS should mean 4, but the result does not match ezquake/mvdsv which would result in inconsistencies. so player coords are rounded inconsistently.
unsigned int flags;
} movevars_t;

View file

@ -881,17 +881,18 @@ void NPP_NQFlush(void)
{ //for old clients, use a te_explosion.
//for clients that support it, use a TEQW_EXPLOSIONNOSPRITE
vec3_t org;
int coordsize = (destprim->coordtype&0xf);
coorddata cd;
if (sv.multicast.cursize + bufferlen > sv.multicast.maxsize)
SV_FlushBroadcasts();
SZ_Write(&sv.multicast, buffer, bufferlen);
memcpy(&cd, &buffer[2+destprim->coordsize*0], destprim->coordsize);
org[0] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[2+destprim->coordsize*1], destprim->coordsize);
org[1] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[2+destprim->coordsize*2], destprim->coordsize);
org[2] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[2+coordsize*0], coordsize);
org[0] = MSG_FromCoord(cd, coordsize);
memcpy(&cd, &buffer[2+coordsize*1], coordsize);
org[1] = MSG_FromCoord(cd, coordsize);
memcpy(&cd, &buffer[2+coordsize*2], coordsize);
org[2] = MSG_FromCoord(cd, coordsize);
requireextension = PEXT_TE_BULLET;
SV_MulticastProtExt(org, multicasttype, pr_global_struct->dimension_send, 0, requireextension);
@ -908,13 +909,14 @@ void NPP_NQFlush(void)
if (writedest == &sv.datagram || writedest == &sv.multicast)
{
vec3_t org;
int coordsize = (destprim->coordtype&0xf);
coorddata cd;
memcpy(&cd, &buffer[2+destprim->coordsize*0], destprim->coordsize);
org[0] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[2+destprim->coordsize*1], destprim->coordsize);
org[1] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[2+destprim->coordsize*2], destprim->coordsize);
org[2] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[2+coordsize*0], coordsize);
org[0] = MSG_FromCoord(cd, coordsize);
memcpy(&cd, &buffer[2+coordsize*1], coordsize);
org[1] = MSG_FromCoord(cd, coordsize);
memcpy(&cd, &buffer[2+coordsize*2], coordsize);
org[2] = MSG_FromCoord(cd, coordsize);
buffer[1] = TEQW_QWEXPLOSION; //use a generic crappy explosion
SZ_Write(&sv.multicast, buffer, bufferlen-2); //trim the two trailing colour bytes
@ -963,14 +965,15 @@ void NPP_NQFlush(void)
if (multicastpos)
{
vec3_t org;
int coordsize = (destprim->coordtype&0xf);
coorddata cd;
memcpy(&cd, &buffer[multicastpos+destprim->coordsize*0], destprim->coordsize);
org[0] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[multicastpos+destprim->coordsize*1], destprim->coordsize);
org[1] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[multicastpos+destprim->coordsize*2], destprim->coordsize);
org[2] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[multicastpos+coordsize*0], coordsize);
org[0] = MSG_FromCoord(cd, coordsize);
memcpy(&cd, &buffer[multicastpos+coordsize*1], coordsize);
org[1] = MSG_FromCoord(cd, coordsize);
memcpy(&cd, &buffer[multicastpos+coordsize*2], coordsize);
org[2] = MSG_FromCoord(cd, coordsize);
SV_MulticastProtExt(org, multicasttype, pr_global_struct->dimension_send, requireextension, 0);
}
@ -1231,7 +1234,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
#endif
break;
case svc_sound:
protocollen = 5+destprim->coordsize*3;
protocollen = 5+(destprim->coordtype&0xf)*3;
if (data & NQSND_VOLUME)
protocollen++;
if (data & NQSND_ATTENUATION)
@ -1254,7 +1257,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
case TE_LIGHTNING3:
multicastpos=4;
multicasttype=MULTICAST_PHS;
protocollen = destprim->coordsize*6+sizeof(short)+sizeof(qbyte)*2;
protocollen = (destprim->coordtype&0xf)*6+sizeof(short)+sizeof(qbyte)*2;
break;
case TENQ_NQGUNSHOT:
multicastpos=3;
@ -1263,19 +1266,19 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
//emit it here and we don't need to remember to play with temp_entity later
NPP_AddData(&data, sizeof(qbyte));
data = 1;
protocollen = destprim->coordsize*3+sizeof(qbyte)*3;
protocollen = (destprim->coordtype&0xf)*3+sizeof(qbyte)*3;
break;
case TENQ_NQEXPLOSION:
case TE_SPIKE:
case TE_SUPERSPIKE:
multicastpos=2;
multicasttype=MULTICAST_PHS;
protocollen = destprim->coordsize*3+sizeof(qbyte)*2;
protocollen = (destprim->coordtype&0xf)*3+sizeof(qbyte)*2;
break;
case TE_LAVASPLASH:
multicastpos=2;
multicasttype=MULTICAST_ALL;
protocollen = destprim->coordsize*3+sizeof(qbyte)*2;
protocollen = (destprim->coordtype&0xf)*3+sizeof(qbyte)*2;
break;
case TE_TAREXPLOSION:
case TE_WIZSPIKE:
@ -1283,25 +1286,25 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
case TE_TELEPORT:
multicastpos=2;
multicasttype=MULTICAST_PVS;
protocollen = destprim->coordsize*3+sizeof(qbyte)*2;
protocollen = (destprim->coordtype&0xf)*3+sizeof(qbyte)*2;
break;
case TE_EXPLOSION3_NEH:
protocollen = sizeof(qbyte) + destprim->coordsize*6;
protocollen = sizeof(qbyte) + (destprim->coordtype&0xf)*6;
ignoreprotocol = true;
break;
case TENQ_EXPLOSION2:
protocollen = sizeof(qbyte)*4 + destprim->coordsize*3;
protocollen = sizeof(qbyte)*4 + (destprim->coordtype&0xf)*3;
multicastpos=2;
multicasttype=MULTICAST_PHS;
break;
case TE_EXPLOSIONSMALL2:
data = TEQW_QWEXPLOSION;
protocollen = sizeof(qbyte)*2 + destprim->coordsize*3;
protocollen = sizeof(qbyte)*2 + (destprim->coordtype&0xf)*3;
multicastpos=2;
multicasttype=MULTICAST_PHS;
break;
case TEQW_RAILTRAIL:
protocollen = destprim->coordsize*6+sizeof(qbyte)*1;
protocollen = (destprim->coordtype&0xf)*6+sizeof(qbyte)*1;
multicastpos=2;
multicasttype=MULTICAST_PHS;
break;
@ -1313,42 +1316,42 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
case TEH2_STREAM_ICECHUNKS:
case TEH2_STREAM_GAZE:
case TEH2_STREAM_FAMINE:
protocollen = destprim->coordsize*6+sizeof(short)+sizeof(qbyte)*(2+2);
protocollen = (destprim->coordtype&0xf)*6+sizeof(short)+sizeof(qbyte)*(2+2);
multicastpos = 8;
multicasttype=MULTICAST_PHS;
break;
case TEH2_STREAM_COLORBEAM:
protocollen = destprim->coordsize*6+sizeof(short)+sizeof(qbyte)*(3+2);
protocollen = (destprim->coordtype&0xf)*6+sizeof(short)+sizeof(qbyte)*(3+2);
multicastpos = 8;
multicasttype=MULTICAST_PHS;
break;
case TEDP_FLAMEJET: //TE_FLAMEJET
protocollen = destprim->coordsize*6 +sizeof(qbyte)*3;
protocollen = (destprim->coordtype&0xf)*6 +sizeof(qbyte)*3;
multicastpos = 2;
multicasttype=MULTICAST_PVS;
break;
case TEDP_TEI_G3:
protocollen = destprim->coordsize*9+sizeof(qbyte)*2;
protocollen = (destprim->coordtype&0xf)*9+sizeof(qbyte)*2;
multicastpos = 2;
multicasttype=MULTICAST_PHS;
break;
case TEDP_SMOKE:
protocollen = destprim->coordsize*6+sizeof(qbyte)*3;
protocollen = (destprim->coordtype&0xf)*6+sizeof(qbyte)*3;
multicastpos = 2;
multicasttype=MULTICAST_PHS;
break;
case TEDP_TEI_BIGEXPLOSION:
protocollen = destprim->coordsize*3+sizeof(qbyte)*2;
protocollen = (destprim->coordtype&0xf)*3+sizeof(qbyte)*2;
multicastpos = 2;
multicasttype=MULTICAST_PHS;
break;
case TEDP_TEI_PLASMAHIT:
protocollen = destprim->coordsize*6+sizeof(qbyte)*3;
protocollen = (destprim->coordtype&0xf)*6+sizeof(qbyte)*3;
multicastpos = 2;
multicasttype=MULTICAST_PHS;
break;
@ -1402,7 +1405,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
if (progstype == PROG_TENEBRAE)
{
//svc, coord6, byte, long, long, effectname
if (bufferlen >= sizeof(qbyte)*2+destprim->coordsize*6+sizeof(int)*2 && !data)
if (bufferlen >= sizeof(qbyte)*2+(destprim->coordtype&0xf)*6+sizeof(int)*2 && !data)
protocollen = bufferlen;
break;
}
@ -1415,7 +1418,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
if (progstype == PROG_TENEBRAE)
{
//svc, coord3, byte, effectname
if (bufferlen >= sizeof(qbyte)*2+destprim->coordsize*3 && !data)
if (bufferlen >= sizeof(qbyte)*2+(destprim->coordtype&0xf)*3 && !data)
protocollen = bufferlen;
break;
}
@ -1574,7 +1577,7 @@ void NPP_NQWriteCoord(int dest, float in) //replacement write func (nq to qw)
PR_StackTrace(svprogfuncs, false);
}
if (destprim->coordsize==4)
if (destprim->coordtype==COORDTYPE_FLOAT_32)
{
float dataf = in;
@ -1791,7 +1794,7 @@ void NPP_QWFlush(void)
ClientReliableWrite_Byte(cl, svc_intermission);
i = 1;
if (destprim->coordsize == 4)
if (destprim->coordtype==COORDTYPE_FLOAT_32)
{
org[0] = NPP_ReadFloat(buffer+i+0);
org[1] = NPP_ReadFloat(buffer+i+4);
@ -1969,7 +1972,7 @@ void NPP_QWFlush(void)
NPP_AddData(&svc, sizeof(qbyte));
for (i = 0; i < 3; i++)
{
if (destprim->coordsize == 4)
if (destprim->coordtype==COORDTYPE_FLOAT_32)
NPP_AddData(&org[i], sizeof(float));
else
{
@ -2026,14 +2029,15 @@ void NPP_QWFlush(void)
{
int qwsize;
vec3_t org;
int coordsize = (destprim->coordtype&0xf);
coorddata cd;
memcpy(&cd, &buffer[multicastpos+destprim->coordsize*0], destprim->coordsize);
org[0] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[multicastpos+destprim->coordsize*1], destprim->coordsize);
org[1] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[multicastpos+destprim->coordsize*2], destprim->coordsize);
org[2] = MSG_FromCoord(cd, destprim->coordsize);
memcpy(&cd, &buffer[multicastpos+coordsize*0], coordsize);
org[0] = MSG_FromCoord(cd, coordsize);
memcpy(&cd, &buffer[multicastpos+coordsize*1], coordsize);
org[1] = MSG_FromCoord(cd, coordsize);
memcpy(&cd, &buffer[multicastpos+coordsize*2], coordsize);
org[2] = MSG_FromCoord(cd, coordsize);
qwsize = sv.multicast.cursize;
sv.multicast.cursize = 0;
@ -2140,7 +2144,7 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
protocollen = 1;
break;
case svc_intermission:
protocollen = 1 + destprim->coordsize*3 + destprim->anglesize*3;
protocollen = 1 + (destprim->coordtype&0xf)*3 + destprim->anglesize*3;
break;
case svc_finale:
nullterms = 1;
@ -2210,13 +2214,13 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
case TE_LIGHTNING3:
multicastpos=4;
multicasttype=MULTICAST_PHS;
protocollen = destprim->coordsize*6+sizeof(short)+sizeof(qbyte)*2;
protocollen = (destprim->coordtype&0xf)*6+sizeof(short)+sizeof(qbyte)*2;
break;
case TEQW_QWBLOOD: //needs to be converted to a particle
case TEQW_QWGUNSHOT: //needs qbyte 2 removed
multicastpos=3;
multicasttype=MULTICAST_PVS;
protocollen = destprim->coordsize*3+sizeof(qbyte)*3;
protocollen = (destprim->coordtype&0xf)*3+sizeof(qbyte)*3;
break;
case TEQW_LIGHTNINGBLOOD:
case TEQW_QWEXPLOSION:
@ -2224,7 +2228,7 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
case TE_SUPERSPIKE:
multicastpos=2;
multicasttype=MULTICAST_PHS_R;
protocollen = destprim->coordsize*3+sizeof(qbyte)*2;
protocollen = (destprim->coordtype&0xf)*3+sizeof(qbyte)*2;
break;
case TE_TAREXPLOSION:
case TE_WIZSPIKE:
@ -2233,12 +2237,12 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
case TE_TELEPORT:
multicastpos=2;
multicasttype=MULTICAST_PVS;
protocollen = destprim->coordsize*3+sizeof(qbyte)*2;
protocollen = (destprim->coordtype&0xf)*3+sizeof(qbyte)*2;
break;
case TEQW_RAILTRAIL:
multicastpos=1;
multicasttype=MULTICAST_PVS;
protocollen = destprim->coordsize*3+sizeof(qbyte)*1;
protocollen = (destprim->coordtype&0xf)*3+sizeof(qbyte)*1;
break;
default:
protocollen = sizeof(buffer);
@ -2321,7 +2325,7 @@ void NPP_QWWriteAngle(int dest, float in) //replacement write func (nq to qw)
}
void NPP_QWWriteCoord(int dest, float in) //replacement write func (nq to qw)
{
if (destprim->coordsize==4)
if (destprim->coordtype==COORDTYPE_FLOAT_32)
{
NPP_QWWriteFloat(dest, in);
}

View file

@ -5361,7 +5361,7 @@ void QCBUILTIN PF_WriteAngle (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
void QCBUILTIN PF_WriteCoord (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int dest = G_FLOAT(OFS_PARM0);
if (developer.ival && sv.reliable_datagram.prim.coordsize == 2)
if (developer.ival && sv.reliable_datagram.prim.coordtype == COORDTYPE_FIXED_13_3)
{
int v = G_FLOAT(OFS_PARM1)*8;
if (v > 32767)
@ -6151,7 +6151,7 @@ char *PF_infokey_Internal (int entnum, const char *key)
value = "bjp3";
break;
case SCP_FITZ666:
if (svs.clients[entnum-1].netchan.netprim.coordsize != 2)
if (svs.clients[entnum-1].netchan.netprim.coordtype != COORDTYPE_FIXED_13_3)
value = "rmq999";
else
value = "fitz666";
@ -9878,11 +9878,11 @@ static void QCBUILTIN PF_runclientphys(pubprogfuncs_t *prinst, struct globalvars
#endif
if (client)
{
movevars.coordsize = client->netchan.netprim.coordsize;
movevars.coordtype = client->netchan.netprim.coordtype;
client->lastruncmd = sv.time*1000;
}
else
movevars.coordsize = svs.netprim.coordsize;
movevars.coordtype = svs.netprim.coordtype;
pmove.numtouch = 0;
pmove.world = &sv.world;

View file

@ -655,12 +655,12 @@ void SVQW_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg,
// send an update
bits = 0;
if (msg->prim.coordsize == 2)
if (msg->prim.coordtype != COORDTYPE_FLOAT_32)
{
for (i=0 ; i<3 ; i++)
{
coordd[i] = MSG_ToCoord(to->origin[i], msg->prim.coordsize);
if (MSG_ToCoord(from->origin[i], msg->prim.coordsize).b4 != coordd[i].b4)
coordd[i] = MSG_ToCoord(to->origin[i], msg->prim.coordtype);
if (MSG_ToCoord(from->origin[i], msg->prim.coordtype).b4 != coordd[i].b4)
bits |= U_ORIGIN1<<i;
else
to->origin[i] = from->origin[i];
@ -670,7 +670,7 @@ void SVQW_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg,
{
for (i=0 ; i<3 ; i++)
{
coordd[i] = MSG_ToCoord(to->origin[i], msg->prim.coordsize);
coordd[i] = MSG_ToCoord(to->origin[i], msg->prim.coordtype);
if (to->origin[i] != from->origin[i])
bits |= U_ORIGIN1<<i;
}
@ -834,15 +834,15 @@ void SVQW_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg,
if (bits & U_EFFECTS)
MSG_WriteByte (msg, to->effects&0x00ff);
if (bits & U_ORIGIN1)
SZ_Write(msg, &coordd[0], msg->prim.coordsize);
SZ_Write(msg, &coordd[0], msg->prim.coordtype&0xf);
if (bits & U_ANGLE1)
SZ_Write(msg, &angled[0], msg->prim.anglesize);
if (bits & U_ORIGIN2)
SZ_Write(msg, &coordd[1], msg->prim.coordsize);
SZ_Write(msg, &coordd[1], msg->prim.coordtype&0xf);
if (bits & U_ANGLE2)
SZ_Write(msg, &angled[1], msg->prim.anglesize);
if (bits & U_ORIGIN3)
SZ_Write(msg, &coordd[2], msg->prim.coordsize);
SZ_Write(msg, &coordd[2], msg->prim.coordtype&0xf);
if (bits & U_ANGLE3)
SZ_Write(msg, &angled[2], msg->prim.anglesize);

View file

@ -724,12 +724,12 @@ void SV_SetupNetworkBuffers(qboolean bigcoords)
//determine basic primitive sizes.
if (bigcoords)
{
svs.netprim.coordsize = 4;
svs.netprim.coordtype = COORDTYPE_FLOAT_32;
svs.netprim.anglesize = 2;
}
else
{
svs.netprim.coordsize = 2;
svs.netprim.coordtype = COORDTYPE_FIXED_13_3;
svs.netprim.anglesize = 1;
}

View file

@ -1748,7 +1748,7 @@ void SV_MVD_SendInitialGamestate(mvddest_t *dest)
MSG_WriteByte (&buf, svc_serverdata);
//fix up extensions to match sv_bigcoords correctly. sorry for old clients not working.
if (buf.prim.coordsize == 4)
if (buf.prim.coordtype == COORDTYPE_FLOAT_32)
demo.recorder.fteprotocolextensions |= PEXT_FLOATCOORDS;
else
demo.recorder.fteprotocolextensions &= ~PEXT_FLOATCOORDS;

View file

@ -1612,9 +1612,9 @@ void SV_FindModelNumbers (void)
{
if (!sv.strings.model_precache[i])
break;
if (!strcmp(sv.strings.model_precache[i],"progs/spike.mdl") && sv.multicast.prim.coordsize == 2)
if (!strcmp(sv.strings.model_precache[i],"progs/spike.mdl") && sv.multicast.prim.coordtype == COORDTYPE_FIXED_13_3)
sv_nailmodel = i;
if (!strcmp(sv.strings.model_precache[i],"progs/s_spike.mdl") && sv.multicast.prim.coordsize == 2)
if (!strcmp(sv.strings.model_precache[i],"progs/s_spike.mdl") && sv.multicast.prim.coordtype == COORDTYPE_FIXED_13_3)
sv_supernailmodel = i;
if (!strcmp(sv.strings.model_precache[i],"progs/player.mdl"))
sv_playermodel = i;

View file

@ -239,6 +239,7 @@ void SV_New_f (void)
int playernum;
int splitnum;
client_t *split;
unsigned int fteext1; //reported to client
host_client->prespawn_stage = PRESPAWN_INVALID;
host_client->prespawn_idx = 0;
@ -296,10 +297,25 @@ void SV_New_f (void)
gamedir = "";
}
if (svs.netprim.coordsize > 2 && !(host_client->fteprotocolextensions & PEXT_FLOATCOORDS))
fteext1 = host_client->fteprotocolextensions;
switch(svs.netprim.coordtype)
{
SV_ClientPrintf(host_client, 2, "\n\n\n\nPlease set cl_nopext to 0 and then reconnect.\nIf that doesn't work, please update your engine - "ENGINEWEBSITE"\n");
Con_Printf("%s does not support bigcoords\n", host_client->name);
case COORDTYPE_FLOAT_32:
fteext1 |= PEXT_FLOATCOORDS;
if (!(host_client->fteprotocolextensions & PEXT_FLOATCOORDS))
{
SV_ClientPrintf(host_client, 2, "\n\n\n\nPlease set cl_nopext to 0 and then reconnect.\nIf that doesn't work, please update your engine - "ENGINEWEBSITE"\n");
Con_Printf("%s does not support bigcoords\n", host_client->name);
host_client->drop = true;
return;
}
break;
case COORDTYPE_FIXED_13_3:
fteext1 &= ~PEXT_FLOATCOORDS;
break;
default:
SV_ClientPrintf(host_client, 2, "Unsupported coord type\n");
Con_Printf("%s unsupported coord type\n", host_client->name);
host_client->drop = true;
return;
}
@ -344,13 +360,10 @@ void SV_New_f (void)
// send the serverdata
ClientReliableWrite_Byte (host_client, ISQ2CLIENT(host_client)?svcq2_serverdata:svc_serverdata);
if (host_client->fteprotocolextensions)//let the client know
if (fteext1)//let the client know
{
ClientReliableWrite_Long (host_client, PROTOCOL_VERSION_FTE1);
if (svs.netprim.coordsize == 2) //we're not using float orgs on this level.
ClientReliableWrite_Long (host_client, host_client->fteprotocolextensions&~PEXT_FLOATCOORDS);
else
ClientReliableWrite_Long (host_client, host_client->fteprotocolextensions|PEXT_FLOATCOORDS);
ClientReliableWrite_Long (host_client, fteext1);
}
if (host_client->fteprotocolextensions2)//let the client know
{
@ -565,7 +578,7 @@ void SVNQ_New_f (void)
protmain = PROTOCOL_VERSION_NQ;
protfl = 0;
//force floatcoords as required.
if (sv.nqdatagram.prim.coordsize >= 4)
if (sv.nqdatagram.prim.coordtype == COORDTYPE_FLOAT_32)
protext1 |= PEXT_FLOATCOORDS;
else
protext1 &= ~PEXT_FLOATCOORDS;
@ -606,11 +619,19 @@ void SVNQ_New_f (void)
case SCP_FITZ666:
SV_LogPlayer(host_client, "new (NQ)");
if (host_client->protocol == SCP_FITZ666 ||
sv.nqdatagram.prim.anglesize != 1 || sv.nqdatagram.prim.coordsize != 2)
sv.nqdatagram.prim.anglesize != 1 || sv.nqdatagram.prim.coordtype != COORDTYPE_FIXED_13_3)
{
protfl =
((sv.nqdatagram.prim.coordsize==4)?RMQFL_FLOATCOORD:0) |
((sv.nqdatagram.prim.anglesize==2)?RMQFL_SHORTANGLE:0);
protfl = ((sv.nqdatagram.prim.anglesize==2)?RMQFL_SHORTANGLE:0);
switch(sv.nqdatagram.prim.coordtype)
{
case COORDTYPE_FLOAT_32: protfl |= RMQFL_FLOATCOORD; break;
case COORDTYPE_FIXED_28_4: protfl |= RMQFL_INT32COORD; break;
case COORDTYPE_FIXED_16_8: protfl |= RMQFL_24BITCOORD; break;
case COORDTYPE_FIXED_13_3: protfl |= 0; break;
default:
host_client->drop = true;
break;
}
host_client->protocol = SCP_FITZ666; /*mneh, close enough, the rmq stuff is just modifiers*/
if (protfl)
@ -7117,7 +7138,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
movevars.watersinkspeed = *pm_watersinkspeed.string?pm_watersinkspeed.value:60;
movevars.flyfriction = *pm_flyfriction.string?pm_flyfriction.value:4;
movevars.edgefriction = *pm_edgefriction.string?pm_edgefriction.value:2;
movevars.coordsize = host_client->netchan.netprim.coordsize;
movevars.coordtype = host_client->netchan.netprim.coordtype;
movevars.flags = MOVEFLAG_VALID|MOVEFLAG_NOGRAVITYONGROUND|(*pm_edgefriction.string?0:MOVEFLAG_QWEDGEBOX);
for (i=0 ; i<3 ; i++)
@ -7363,7 +7384,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
movevars.watersinkspeed = *pm_watersinkspeed.string?pm_watersinkspeed.value:60;
movevars.flyfriction = *pm_flyfriction.string?pm_flyfriction.value:4;
movevars.edgefriction = *pm_edgefriction.string?pm_edgefriction.value:2;
movevars.coordsize = host_client->netchan.netprim.coordsize;
movevars.coordtype = host_client->netchan.netprim.coordtype;
movevars.flags = MOVEFLAG_VALID|MOVEFLAG_NOGRAVITYONGROUND|(*pm_edgefriction.string?0:MOVEFLAG_QWEDGEBOX);
// should already be folded into host_client->maxspeed