mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-02 14:01:26 +00:00
RMQ protocol (999) support, adapted from RMQEngine
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1313 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
316de63f98
commit
5b21d5935f
14 changed files with 169 additions and 101 deletions
|
@ -361,9 +361,9 @@ void CL_SendMove (const usercmd_t *cmd)
|
|||
for (i=0 ; i<3 ; i++)
|
||||
//johnfitz -- 16-bit angles for PROTOCOL_FITZQUAKE
|
||||
if (cl.protocol == PROTOCOL_NETQUAKE)
|
||||
MSG_WriteAngle (&buf, cl.viewangles[i]);
|
||||
MSG_WriteAngle (&buf, cl.viewangles[i], cl.protocolflags);
|
||||
else
|
||||
MSG_WriteAngle16 (&buf, cl.viewangles[i]);
|
||||
MSG_WriteAngle16 (&buf, cl.viewangles[i], cl.protocolflags);
|
||||
//johnfitz
|
||||
|
||||
MSG_WriteShort (&buf, cmd->forwardmove);
|
||||
|
|
|
@ -180,7 +180,7 @@ void CL_ParseStartSoundPacket(void)
|
|||
Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
pos[i] = MSG_ReadCoord ();
|
||||
pos[i] = MSG_ReadCoord (cl.protocolflags);
|
||||
|
||||
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
|
||||
}
|
||||
|
@ -276,13 +276,27 @@ void CL_ParseServerInfo (void)
|
|||
// parse protocol version number
|
||||
i = MSG_ReadLong ();
|
||||
//johnfitz -- support multiple protocols
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE) {
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ) {
|
||||
Con_Printf ("\n"); //because there's no newline after serverinfo print
|
||||
Host_Error ("Server returned version %i, not %i or %i", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE);
|
||||
Host_Error ("Server returned version %i, not %i or %i or %i", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||
}
|
||||
cl.protocol = i;
|
||||
//johnfitz
|
||||
|
||||
if (cl.protocol == PROTOCOL_RMQ)
|
||||
{
|
||||
const unsigned int supportedflags = (PRFL_SHORTANGLE | PRFL_FLOATANGLE | PRFL_24BITCOORD | PRFL_FLOATCOORD | PRFL_EDICTSCALE | PRFL_INT32COORD);
|
||||
|
||||
// mh - read protocol flags from server so that we know what protocol features to expect
|
||||
cl.protocolflags = (unsigned int) MSG_ReadLong ();
|
||||
|
||||
if (0 != (cl.protocolflags & (~supportedflags)))
|
||||
{
|
||||
Con_Warning("PROTOCOL_RMQ protocolflags %i contains unsupported flags\n", cl.protocolflags);
|
||||
}
|
||||
}
|
||||
else cl.protocolflags = 0;
|
||||
|
||||
// parse maxclients
|
||||
cl.maxclients = MSG_ReadByte ();
|
||||
if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD)
|
||||
|
@ -428,7 +442,7 @@ void CL_ParseUpdate (int bits)
|
|||
}
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
if (cl.protocol == PROTOCOL_FITZQUAKE)
|
||||
if (cl.protocol == PROTOCOL_FITZQUAKE || cl.protocol == PROTOCOL_RMQ)
|
||||
{
|
||||
if (bits & U_EXTEND1)
|
||||
bits |= MSG_ReadByte() << 16;
|
||||
|
@ -502,29 +516,29 @@ void CL_ParseUpdate (int bits)
|
|||
VectorCopy (ent->msg_angles[0], ent->msg_angles[1]);
|
||||
|
||||
if (bits & U_ORIGIN1)
|
||||
ent->msg_origins[0][0] = MSG_ReadCoord ();
|
||||
ent->msg_origins[0][0] = MSG_ReadCoord (cl.protocolflags);
|
||||
else
|
||||
ent->msg_origins[0][0] = ent->baseline.origin[0];
|
||||
if (bits & U_ANGLE1)
|
||||
ent->msg_angles[0][0] = MSG_ReadAngle();
|
||||
ent->msg_angles[0][0] = MSG_ReadAngle(cl.protocolflags);
|
||||
else
|
||||
ent->msg_angles[0][0] = ent->baseline.angles[0];
|
||||
|
||||
if (bits & U_ORIGIN2)
|
||||
ent->msg_origins[0][1] = MSG_ReadCoord ();
|
||||
ent->msg_origins[0][1] = MSG_ReadCoord (cl.protocolflags);
|
||||
else
|
||||
ent->msg_origins[0][1] = ent->baseline.origin[1];
|
||||
if (bits & U_ANGLE2)
|
||||
ent->msg_angles[0][1] = MSG_ReadAngle();
|
||||
ent->msg_angles[0][1] = MSG_ReadAngle(cl.protocolflags);
|
||||
else
|
||||
ent->msg_angles[0][1] = ent->baseline.angles[1];
|
||||
|
||||
if (bits & U_ORIGIN3)
|
||||
ent->msg_origins[0][2] = MSG_ReadCoord ();
|
||||
ent->msg_origins[0][2] = MSG_ReadCoord (cl.protocolflags);
|
||||
else
|
||||
ent->msg_origins[0][2] = ent->baseline.origin[2];
|
||||
if (bits & U_ANGLE3)
|
||||
ent->msg_angles[0][2] = MSG_ReadAngle();
|
||||
ent->msg_angles[0][2] = MSG_ReadAngle(cl.protocolflags);
|
||||
else
|
||||
ent->msg_angles[0][2] = ent->baseline.angles[2];
|
||||
|
||||
|
@ -539,12 +553,14 @@ void CL_ParseUpdate (int bits)
|
|||
//johnfitz
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE and PROTOCOL_NEHAHRA
|
||||
if (cl.protocol == PROTOCOL_FITZQUAKE)
|
||||
if (cl.protocol == PROTOCOL_FITZQUAKE || cl.protocol == PROTOCOL_RMQ)
|
||||
{
|
||||
if (bits & U_ALPHA)
|
||||
ent->alpha = MSG_ReadByte();
|
||||
else
|
||||
ent->alpha = ent->baseline.alpha;
|
||||
if (bits & U_SCALE)
|
||||
MSG_ReadByte(); // PROTOCOL_RMQ: currently ignored
|
||||
if (bits & U_FRAME2)
|
||||
ent->frame = (ent->frame & 0x00FF) | (MSG_ReadByte() << 8);
|
||||
if (bits & U_MODEL2)
|
||||
|
@ -634,8 +650,8 @@ void CL_ParseBaseline (entity_t *ent, int version) //johnfitz -- added argument
|
|||
ent->baseline.skin = MSG_ReadByte();
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
ent->baseline.origin[i] = MSG_ReadCoord ();
|
||||
ent->baseline.angles[i] = MSG_ReadAngle ();
|
||||
ent->baseline.origin[i] = MSG_ReadCoord (cl.protocolflags);
|
||||
ent->baseline.angles[i] = MSG_ReadAngle (cl.protocolflags);
|
||||
}
|
||||
|
||||
ent->baseline.alpha = (bits & B_ALPHA) ? MSG_ReadByte() : ENTALPHA_DEFAULT; //johnfitz -- PROTOCOL_FITZQUAKE
|
||||
|
@ -896,7 +912,7 @@ void CL_ParseStaticSound (int version) //johnfitz -- added argument
|
|||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
org[i] = MSG_ReadCoord ();
|
||||
org[i] = MSG_ReadCoord (cl.protocolflags);
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
if (version == 2)
|
||||
|
@ -987,8 +1003,8 @@ void CL_ParseServerMessage (void)
|
|||
case svc_version:
|
||||
i = MSG_ReadLong ();
|
||||
//johnfitz -- support multiple protocols
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE)
|
||||
Host_Error ("Server returned version %i, not %i or %i", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE);
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ)
|
||||
Host_Error ("Server returned version %i, not %i or %i or %i", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||
cl.protocol = i;
|
||||
//johnfitz
|
||||
break;
|
||||
|
@ -1023,7 +1039,7 @@ void CL_ParseServerMessage (void)
|
|||
|
||||
case svc_setangle:
|
||||
for (i=0 ; i<3 ; i++)
|
||||
cl.viewangles[i] = MSG_ReadAngle ();
|
||||
cl.viewangles[i] = MSG_ReadAngle (cl.protocolflags);
|
||||
break;
|
||||
|
||||
case svc_setview:
|
||||
|
|
|
@ -65,13 +65,13 @@ void CL_ParseBeam (qmodel_t *m)
|
|||
|
||||
ent = MSG_ReadShort ();
|
||||
|
||||
start[0] = MSG_ReadCoord ();
|
||||
start[1] = MSG_ReadCoord ();
|
||||
start[2] = MSG_ReadCoord ();
|
||||
start[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
start[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
start[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
|
||||
end[0] = MSG_ReadCoord ();
|
||||
end[1] = MSG_ReadCoord ();
|
||||
end[2] = MSG_ReadCoord ();
|
||||
end[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
end[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
end[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
|
||||
// override any beam with the same entity
|
||||
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
|
||||
|
@ -125,25 +125,25 @@ void CL_ParseTEnt (void)
|
|||
switch (type)
|
||||
{
|
||||
case TE_WIZSPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
R_RunParticleEffect (pos, vec3_origin, 20, 30);
|
||||
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_KNIGHTSPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
R_RunParticleEffect (pos, vec3_origin, 226, 20);
|
||||
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_SPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
R_RunParticleEffect (pos, vec3_origin, 0, 10);
|
||||
if ( rand() % 5 )
|
||||
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
|
||||
|
@ -159,9 +159,9 @@ void CL_ParseTEnt (void)
|
|||
}
|
||||
break;
|
||||
case TE_SUPERSPIKE: // super spike hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
R_RunParticleEffect (pos, vec3_origin, 0, 20);
|
||||
|
||||
if ( rand() % 5 )
|
||||
|
@ -179,16 +179,16 @@ void CL_ParseTEnt (void)
|
|||
break;
|
||||
|
||||
case TE_GUNSHOT: // bullet hitting wall
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
R_RunParticleEffect (pos, vec3_origin, 0, 20);
|
||||
break;
|
||||
|
||||
case TE_EXPLOSION: // rocket explosion
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
R_ParticleExplosion (pos);
|
||||
dl = CL_AllocDlight (0);
|
||||
VectorCopy (pos, dl->origin);
|
||||
|
@ -199,9 +199,9 @@ void CL_ParseTEnt (void)
|
|||
break;
|
||||
|
||||
case TE_TAREXPLOSION: // tarbaby explosion
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
R_BlobExplosion (pos);
|
||||
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
|
||||
|
@ -226,23 +226,23 @@ void CL_ParseTEnt (void)
|
|||
// PGM 01/21/97
|
||||
|
||||
case TE_LAVASPLASH:
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
R_LavaSplash (pos);
|
||||
break;
|
||||
|
||||
case TE_TELEPORT:
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
R_TeleportSplash (pos);
|
||||
break;
|
||||
|
||||
case TE_EXPLOSION2: // color mapped explosion
|
||||
pos[0] = MSG_ReadCoord ();
|
||||
pos[1] = MSG_ReadCoord ();
|
||||
pos[2] = MSG_ReadCoord ();
|
||||
pos[0] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[1] = MSG_ReadCoord (cl.protocolflags);
|
||||
pos[2] = MSG_ReadCoord (cl.protocolflags);
|
||||
colorStart = MSG_ReadByte ();
|
||||
colorLength = MSG_ReadByte ();
|
||||
R_ParticleExplosion2 (pos, colorStart, colorLength);
|
||||
|
|
|
@ -224,6 +224,7 @@ typedef struct
|
|||
scoreboard_t *scores; // [cl.maxclients]
|
||||
|
||||
unsigned protocol; //johnfitz
|
||||
unsigned protocolflags;
|
||||
} client_state_t;
|
||||
|
||||
|
||||
|
|
|
@ -683,20 +683,32 @@ void MSG_WriteCoord32f (sizebuf_t *sb, float f)
|
|||
MSG_WriteFloat (sb, f);
|
||||
}
|
||||
|
||||
void MSG_WriteCoord (sizebuf_t *sb, float f)
|
||||
void MSG_WriteCoord (sizebuf_t *sb, float f, unsigned int flags)
|
||||
{
|
||||
MSG_WriteCoord16 (sb, f);
|
||||
if (flags & PRFL_FLOATCOORD)
|
||||
MSG_WriteFloat (sb, f);
|
||||
else if (flags & PRFL_INT32COORD)
|
||||
MSG_WriteLong (sb, Q_rint (f * 16));
|
||||
else if (flags & PRFL_24BITCOORD)
|
||||
MSG_WriteCoord24 (sb, f);
|
||||
else MSG_WriteCoord16 (sb, f);
|
||||
}
|
||||
|
||||
void MSG_WriteAngle (sizebuf_t *sb, float f)
|
||||
void MSG_WriteAngle (sizebuf_t *sb, float f, unsigned int flags)
|
||||
{
|
||||
MSG_WriteByte (sb, Q_rint(f * 256.0 / 360.0) & 255); //johnfitz -- use Q_rint instead of (int)
|
||||
if (flags & PRFL_FLOATANGLE)
|
||||
MSG_WriteFloat (sb, f);
|
||||
else if (flags & PRFL_SHORTANGLE)
|
||||
MSG_WriteShort (sb, Q_rint(f * 65536.0 / 360.0) & 65535);
|
||||
else MSG_WriteByte (sb, Q_rint(f * 256.0 / 360.0) & 255); //johnfitz -- use Q_rint instead of (int) }
|
||||
}
|
||||
|
||||
//johnfitz -- for PROTOCOL_FITZQUAKE
|
||||
void MSG_WriteAngle16 (sizebuf_t *sb, float f)
|
||||
void MSG_WriteAngle16 (sizebuf_t *sb, float f, unsigned int flags)
|
||||
{
|
||||
MSG_WriteShort (sb, Q_rint(f * 65536.0 / 360.0) & 65535);
|
||||
if (flags & PRFL_FLOATANGLE)
|
||||
MSG_WriteFloat (sb, f);
|
||||
else MSG_WriteShort (sb, Q_rint(f * 65536.0 / 360.0) & 65535);
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
|
@ -842,20 +854,32 @@ float MSG_ReadCoord32f (void)
|
|||
return MSG_ReadFloat();
|
||||
}
|
||||
|
||||
float MSG_ReadCoord (void)
|
||||
float MSG_ReadCoord (unsigned int flags)
|
||||
{
|
||||
return MSG_ReadCoord16();
|
||||
if (flags & PRFL_FLOATCOORD)
|
||||
return MSG_ReadFloat ();
|
||||
else if (flags & PRFL_INT32COORD)
|
||||
return MSG_ReadLong () * (1.0 / 16.0);
|
||||
else if (flags & PRFL_24BITCOORD)
|
||||
return MSG_ReadCoord24 ();
|
||||
else return MSG_ReadCoord16 ();
|
||||
}
|
||||
|
||||
float MSG_ReadAngle (void)
|
||||
float MSG_ReadAngle (unsigned int flags)
|
||||
{
|
||||
return MSG_ReadChar() * (360.0/256);
|
||||
if (flags & PRFL_FLOATANGLE)
|
||||
return MSG_ReadFloat ();
|
||||
else if (flags & PRFL_SHORTANGLE)
|
||||
return MSG_ReadShort () * (360.0 / 65536);
|
||||
else return MSG_ReadChar () * (360.0 / 256);
|
||||
}
|
||||
|
||||
//johnfitz -- for PROTOCOL_FITZQUAKE
|
||||
float MSG_ReadAngle16 (void)
|
||||
float MSG_ReadAngle16 (unsigned int flags)
|
||||
{
|
||||
return MSG_ReadShort() * (360.0 / 65536);
|
||||
if (flags & PRFL_FLOATANGLE)
|
||||
return MSG_ReadFloat (); // make sure
|
||||
else return MSG_ReadShort () * (360.0 / 65536);
|
||||
}
|
||||
//johnfitz
|
||||
|
||||
|
|
|
@ -100,9 +100,9 @@ void MSG_WriteShort (sizebuf_t *sb, int c);
|
|||
void MSG_WriteLong (sizebuf_t *sb, int c);
|
||||
void MSG_WriteFloat (sizebuf_t *sb, float f);
|
||||
void MSG_WriteString (sizebuf_t *sb, const char *s);
|
||||
void MSG_WriteCoord (sizebuf_t *sb, float f);
|
||||
void MSG_WriteAngle (sizebuf_t *sb, float f);
|
||||
void MSG_WriteAngle16 (sizebuf_t *sb, float f); //johnfitz
|
||||
void MSG_WriteCoord (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
|
||||
|
||||
extern int msg_readcount;
|
||||
extern qboolean msg_badread; // set if a read goes beyond end of message
|
||||
|
@ -115,9 +115,9 @@ int MSG_ReadLong (void);
|
|||
float MSG_ReadFloat (void);
|
||||
const char *MSG_ReadString (void);
|
||||
|
||||
float MSG_ReadCoord (void);
|
||||
float MSG_ReadAngle (void);
|
||||
float MSG_ReadAngle16 (void); //johnfitz
|
||||
float MSG_ReadCoord (unsigned int flags);
|
||||
float MSG_ReadAngle (unsigned int flags);
|
||||
float MSG_ReadAngle16 (unsigned int flags); //johnfitz
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
|
|
@ -1711,8 +1711,8 @@ void Host_Spawn_f (void)
|
|||
ent = EDICT_NUM( 1 + (host_client - svs.clients) );
|
||||
MSG_WriteByte (&host_client->message, svc_setangle);
|
||||
for (i = 0; i < 2; i++)
|
||||
MSG_WriteAngle (&host_client->message, ent->v.angles[i] );
|
||||
MSG_WriteAngle (&host_client->message, 0 );
|
||||
MSG_WriteAngle (&host_client->message, ent->v.angles[i], sv.protocolflags );
|
||||
MSG_WriteAngle (&host_client->message, 0, sv.protocolflags );
|
||||
|
||||
SV_WriteClientdataToMessage (sv_player, &host_client->message);
|
||||
|
||||
|
|
|
@ -589,7 +589,7 @@ static void PF_ambientsound (void)
|
|||
//johnfitz
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
MSG_WriteCoord(&sv.signon, pos[i]);
|
||||
MSG_WriteCoord(&sv.signon, pos[i], sv.protocolflags);
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
if (large)
|
||||
|
@ -1506,12 +1506,12 @@ static void PF_WriteLong (void)
|
|||
|
||||
static void PF_WriteAngle (void)
|
||||
{
|
||||
MSG_WriteAngle (WriteDest(), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteAngle (WriteDest(), G_FLOAT(OFS_PARM1), sv.protocolflags);
|
||||
}
|
||||
|
||||
static void PF_WriteCoord (void)
|
||||
{
|
||||
MSG_WriteCoord (WriteDest(), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteCoord (WriteDest(), G_FLOAT(OFS_PARM1), sv.protocolflags);
|
||||
}
|
||||
|
||||
static void PF_WriteString (void)
|
||||
|
@ -1583,8 +1583,8 @@ static void PF_makestatic (void)
|
|||
MSG_WriteByte (&sv.signon, ent->v.skin);
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
MSG_WriteCoord(&sv.signon, ent->v.origin[i]);
|
||||
MSG_WriteAngle(&sv.signon, ent->v.angles[i]);
|
||||
MSG_WriteCoord(&sv.signon, ent->v.origin[i], sv.protocolflags);
|
||||
MSG_WriteAngle(&sv.signon, ent->v.angles[i], sv.protocolflags);
|
||||
}
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
|
|
|
@ -27,6 +27,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define PROTOCOL_NETQUAKE 15 //johnfitz -- standard quake protocol
|
||||
#define PROTOCOL_FITZQUAKE 666 //johnfitz -- added new protocol for fitzquake 0.85
|
||||
#define PROTOCOL_RMQ 999
|
||||
|
||||
// PROTOCOL_RMQ protocol flags
|
||||
#define PRFL_SHORTANGLE (1 << 1)
|
||||
#define PRFL_FLOATANGLE (1 << 2)
|
||||
#define PRFL_24BITCOORD (1 << 3)
|
||||
#define PRFL_FLOATCOORD (1 << 4)
|
||||
#define PRFL_EDICTSCALE (1 << 5)
|
||||
#define PRFL_ALPHASANITY (1 << 6) // cleanup insanity with alpha
|
||||
#define PRFL_INT32COORD (1 << 7)
|
||||
#define PRFL_MOREFLAGS (1 << 31) // not supported
|
||||
|
||||
// if the high bit of the servercmd is set, the low bits are fast update flags:
|
||||
#define U_MOREBITS (1<<0)
|
||||
|
@ -52,7 +63,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define U_FRAME2 (1<<17) // 1 byte, this is .frame & 0xFF00 (second byte)
|
||||
#define U_MODEL2 (1<<18) // 1 byte, this is .modelindex & 0xFF00 (second byte)
|
||||
#define U_LERPFINISH (1<<19) // 1 byte, 0.0-1.0 maps to 0-255, not sent if exactly 0.1, this is ent->v.nextthink - sv.time, used for lerping
|
||||
#define U_UNUSED20 (1<<20)
|
||||
#define U_SCALE (1<<20) // 1 byte, for PROTOCOL_RMQ PRFL_EDICTSCALE, currently read but ignored
|
||||
#define U_UNUSED21 (1<<21)
|
||||
#define U_UNUSED22 (1<<22)
|
||||
#define U_EXTEND2 (1<<23) // another byte to follow, future expansion
|
||||
|
|
|
@ -329,7 +329,7 @@ void R_ParseParticleEffect (void)
|
|||
int i, count, msgcount, color;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
org[i] = MSG_ReadCoord ();
|
||||
org[i] = MSG_ReadCoord (cl.protocolflags);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
dir[i] = MSG_ReadChar () * (1.0/16);
|
||||
msgcount = MSG_ReadByte ();
|
||||
|
|
|
@ -74,6 +74,7 @@ typedef struct
|
|||
byte signon_buf[MAX_MSGLEN-2]; //johnfitz -- was 8192, now uses MAX_MSGLEN
|
||||
|
||||
unsigned protocol; //johnfitz
|
||||
unsigned protocolflags;
|
||||
} server_t;
|
||||
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ void SV_Protocol_f (void)
|
|||
break;
|
||||
case 2:
|
||||
i = atoi(Cmd_Argv(1));
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE)
|
||||
Con_Printf ("sv_protocol must be %i or %i\n", PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE);
|
||||
if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE && i != PROTOCOL_RMQ)
|
||||
Con_Printf ("sv_protocol must be %i or %i or %i\n", PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE, PROTOCOL_RMQ);
|
||||
else
|
||||
{
|
||||
sv_protocol = i;
|
||||
|
@ -130,9 +130,9 @@ void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count)
|
|||
if (sv.datagram.cursize > MAX_DATAGRAM-16)
|
||||
return;
|
||||
MSG_WriteByte (&sv.datagram, svc_particle);
|
||||
MSG_WriteCoord (&sv.datagram, org[0]);
|
||||
MSG_WriteCoord (&sv.datagram, org[1]);
|
||||
MSG_WriteCoord (&sv.datagram, org[2]);
|
||||
MSG_WriteCoord (&sv.datagram, org[0], sv.protocolflags);
|
||||
MSG_WriteCoord (&sv.datagram, org[1], sv.protocolflags);
|
||||
MSG_WriteCoord (&sv.datagram, org[2], sv.protocolflags);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
v = dir[i]*16;
|
||||
|
@ -239,7 +239,7 @@ void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume
|
|||
//johnfitz
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
MSG_WriteCoord (&sv.datagram, entity->v.origin[i]+0.5*(entity->v.mins[i]+entity->v.maxs[i]));
|
||||
MSG_WriteCoord (&sv.datagram, entity->v.origin[i]+0.5*(entity->v.mins[i]+entity->v.maxs[i]), sv.protocolflags);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -270,6 +270,13 @@ void SV_SendServerinfo (client_t *client)
|
|||
|
||||
MSG_WriteByte (&client->message, svc_serverinfo);
|
||||
MSG_WriteLong (&client->message, sv.protocol); //johnfitz -- sv.protocol instead of PROTOCOL_VERSION
|
||||
|
||||
if (sv.protocol == PROTOCOL_RMQ)
|
||||
{
|
||||
// mh - now send protocol flags so that the client knows the protocol features to expect
|
||||
MSG_WriteLong (&client->message, sv.protocolflags);
|
||||
}
|
||||
|
||||
MSG_WriteByte (&client->message, svs.maxclients);
|
||||
|
||||
if (!coop.value && deathmatch.value)
|
||||
|
@ -673,17 +680,17 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
|||
if (bits & U_EFFECTS)
|
||||
MSG_WriteByte (msg, ent->v.effects);
|
||||
if (bits & U_ORIGIN1)
|
||||
MSG_WriteCoord (msg, ent->v.origin[0]);
|
||||
MSG_WriteCoord (msg, ent->v.origin[0], sv.protocolflags);
|
||||
if (bits & U_ANGLE1)
|
||||
MSG_WriteAngle(msg, ent->v.angles[0]);
|
||||
MSG_WriteAngle(msg, ent->v.angles[0], sv.protocolflags);
|
||||
if (bits & U_ORIGIN2)
|
||||
MSG_WriteCoord (msg, ent->v.origin[1]);
|
||||
MSG_WriteCoord (msg, ent->v.origin[1], sv.protocolflags);
|
||||
if (bits & U_ANGLE2)
|
||||
MSG_WriteAngle(msg, ent->v.angles[1]);
|
||||
MSG_WriteAngle(msg, ent->v.angles[1], sv.protocolflags);
|
||||
if (bits & U_ORIGIN3)
|
||||
MSG_WriteCoord (msg, ent->v.origin[2]);
|
||||
MSG_WriteCoord (msg, ent->v.origin[2], sv.protocolflags);
|
||||
if (bits & U_ANGLE3)
|
||||
MSG_WriteAngle(msg, ent->v.angles[2]);
|
||||
MSG_WriteAngle(msg, ent->v.angles[2], sv.protocolflags);
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
if (bits & U_ALPHA)
|
||||
|
@ -748,7 +755,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
MSG_WriteByte (msg, ent->v.dmg_save);
|
||||
MSG_WriteByte (msg, ent->v.dmg_take);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
MSG_WriteCoord (msg, other->v.origin[i] + 0.5*(other->v.mins[i] + other->v.maxs[i]));
|
||||
MSG_WriteCoord (msg, other->v.origin[i] + 0.5*(other->v.mins[i] + other->v.maxs[i]), sv.protocolflags );
|
||||
|
||||
ent->v.dmg_take = 0;
|
||||
ent->v.dmg_save = 0;
|
||||
|
@ -764,7 +771,7 @@ void SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
{
|
||||
MSG_WriteByte (msg, svc_setangle);
|
||||
for (i=0 ; i < 3 ; i++)
|
||||
MSG_WriteAngle (msg, ent->v.angles[i] );
|
||||
MSG_WriteAngle (msg, ent->v.angles[i], sv.protocolflags );
|
||||
ent->v.fixangle = 0;
|
||||
}
|
||||
|
||||
|
@ -1208,8 +1215,8 @@ void SV_CreateBaseline (void)
|
|||
MSG_WriteByte (&sv.signon, svent->baseline.skin);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
MSG_WriteCoord(&sv.signon, svent->baseline.origin[i]);
|
||||
MSG_WriteAngle(&sv.signon, svent->baseline.angles[i]);
|
||||
MSG_WriteCoord(&sv.signon, svent->baseline.origin[i], sv.protocolflags);
|
||||
MSG_WriteAngle(&sv.signon, svent->baseline.angles[i], sv.protocolflags);
|
||||
}
|
||||
|
||||
//johnfitz -- PROTOCOL_FITZQUAKE
|
||||
|
@ -1325,6 +1332,14 @@ void SV_SpawnServer (const char *server)
|
|||
q_strlcpy (sv.name, server, sizeof(sv.name));
|
||||
|
||||
sv.protocol = sv_protocol; // johnfitz
|
||||
|
||||
if (sv.protocol == PROTOCOL_RMQ)
|
||||
{
|
||||
// set up the protocol flags used by this server
|
||||
// (note - these could be cvar-ised so that server admins could choose the protocol features used by their servers)
|
||||
sv.protocolflags = PRFL_INT32COORD | PRFL_SHORTANGLE;
|
||||
}
|
||||
else sv.protocolflags = 0;
|
||||
|
||||
// load progs to get entity field count
|
||||
PR_LoadProgs ();
|
||||
|
|
|
@ -450,9 +450,9 @@ void SV_ReadClientMove (usercmd_t *move)
|
|||
for (i=0 ; i<3 ; i++)
|
||||
//johnfitz -- 16-bit angles for PROTOCOL_FITZQUAKE
|
||||
if (sv.protocol == PROTOCOL_NETQUAKE)
|
||||
angle[i] = MSG_ReadAngle ();
|
||||
angle[i] = MSG_ReadAngle (sv.protocolflags);
|
||||
else
|
||||
angle[i] = MSG_ReadAngle16 ();
|
||||
angle[i] = MSG_ReadAngle16 (sv.protocolflags);
|
||||
//johnfitz
|
||||
|
||||
VectorCopy (angle, host_client->edict->v.v_angle);
|
||||
|
|
|
@ -270,7 +270,7 @@ void V_ParseDamage (void)
|
|||
armor = MSG_ReadByte ();
|
||||
blood = MSG_ReadByte ();
|
||||
for (i=0 ; i<3 ; i++)
|
||||
from[i] = MSG_ReadCoord ();
|
||||
from[i] = MSG_ReadCoord (cl.protocolflags);
|
||||
|
||||
count = blood*0.5 + armor*0.5;
|
||||
if (count < 10)
|
||||
|
|
Loading…
Reference in a new issue