diff --git a/Quake/cl_input.c b/Quake/cl_input.c index ba33345f..11837945 100644 --- a/Quake/cl_input.c +++ b/Quake/cl_input.c @@ -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); diff --git a/Quake/cl_parse.c b/Quake/cl_parse.c index 9d556776..6e14ef41 100644 --- a/Quake/cl_parse.c +++ b/Quake/cl_parse.c @@ -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: diff --git a/Quake/cl_tent.c b/Quake/cl_tent.c index b3bcbb29..b1c9b8cf 100644 --- a/Quake/cl_tent.c +++ b/Quake/cl_tent.c @@ -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); diff --git a/Quake/client.h b/Quake/client.h index 37f86780..6f64ffae 100644 --- a/Quake/client.h +++ b/Quake/client.h @@ -224,6 +224,7 @@ typedef struct scoreboard_t *scores; // [cl.maxclients] unsigned protocol; //johnfitz + unsigned protocolflags; } client_state_t; diff --git a/Quake/common.c b/Quake/common.c index baaaac1a..b1b34593 100644 --- a/Quake/common.c +++ b/Quake/common.c @@ -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 diff --git a/Quake/common.h b/Quake/common.h index e10a4541..81461140 100644 --- a/Quake/common.h +++ b/Quake/common.h @@ -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 //============================================================================ diff --git a/Quake/host_cmd.c b/Quake/host_cmd.c index f8adfbf3..b9ee3885 100644 --- a/Quake/host_cmd.c +++ b/Quake/host_cmd.c @@ -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); diff --git a/Quake/pr_cmds.c b/Quake/pr_cmds.c index bf1c4eed..afdd69b3 100644 --- a/Quake/pr_cmds.c +++ b/Quake/pr_cmds.c @@ -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 diff --git a/Quake/protocol.h b/Quake/protocol.h index a53267bc..81c7e966 100644 --- a/Quake/protocol.h +++ b/Quake/protocol.h @@ -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 diff --git a/Quake/r_part.c b/Quake/r_part.c index 3f474b2f..8bc1bf31 100644 --- a/Quake/r_part.c +++ b/Quake/r_part.c @@ -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 (); diff --git a/Quake/server.h b/Quake/server.h index 635a567d..114432da 100644 --- a/Quake/server.h +++ b/Quake/server.h @@ -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; diff --git a/Quake/sv_main.c b/Quake/sv_main.c index 60699bf3..d2a0b9b2 100644 --- a/Quake/sv_main.c +++ b/Quake/sv_main.c @@ -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 (); diff --git a/Quake/sv_user.c b/Quake/sv_user.c index fe98c057..c3e4cb56 100644 --- a/Quake/sv_user.c +++ b/Quake/sv_user.c @@ -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); diff --git a/Quake/view.c b/Quake/view.c index 924d492c..6190042f 100644 --- a/Quake/view.c +++ b/Quake/view.c @@ -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)