Some small tweeks, and a new matchclientname extension. Woot.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1377 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-09-26 03:40:09 +00:00
parent aac5a6578c
commit d697b1ca2d
4 changed files with 229 additions and 158 deletions

View file

@ -762,7 +762,7 @@ entity_state_t *CL_FindOldPacketEntity(int num)
// flag // flag
#define E5_FRAME16 (1<<21) #define E5_FRAME16 (1<<21)
// unused // unused
#define E5_UNUSED22 (1<<22) #define E5_COLORMOD (1<<22)
// bits >= (1<<24) // bits >= (1<<24)
#define E5_EXTEND3 (1<<23) #define E5_EXTEND3 (1<<23)
@ -783,6 +783,8 @@ entity_state_t *CL_FindOldPacketEntity(int num)
// bits2 > 0 // bits2 > 0
#define E5_EXTEND4 (1<<31) #define E5_EXTEND4 (1<<31)
#define E5_ALLUNUSED (E5_UNUSED24|E5_UNUSED25|E5_UNUSED26|E5_UNUSED27|E5_UNUSED28|E5_UNUSED29|E5_UNUSED30)
entity_state_t defaultstate; entity_state_t defaultstate;
void DP5_ParseDelta(entity_state_t *s) void DP5_ParseDelta(entity_state_t *s)
{ {
@ -798,6 +800,12 @@ void DP5_ParseDelta(entity_state_t *s)
bits |= MSG_ReadByte() << 24; bits |= MSG_ReadByte() << 24;
} }
} }
if (bits & E5_ALLUNUSED)
{
Host_EndGame("Detected 'unused' bits in DP5+ entity delta - %x (%x)\n", bits, (bits & E5_ALLUNUSED));
}
if (bits & E5_FULLUPDATE) if (bits & E5_FULLUPDATE)
{ {
int num; int num;
@ -885,24 +893,24 @@ void DP5_ParseDelta(entity_state_t *s)
} }
if (bits & E5_LIGHT) if (bits & E5_LIGHT)
{ {
MSG_ReadShort(); s->light[0] = MSG_ReadShort();
MSG_ReadShort(); s->light[1] = MSG_ReadShort();
MSG_ReadShort(); s->light[2] = MSG_ReadShort();
MSG_ReadShort(); s->light[3] = MSG_ReadShort();
MSG_ReadByte(); s->lightstyle = MSG_ReadByte();
MSG_ReadByte(); s->lightpflags = MSG_ReadByte();
// s->light[0] = (unsigned short) MSG_ReadShort();
// s->light[1] = (unsigned short) MSG_ReadShort();
// s->light[2] = (unsigned short) MSG_ReadShort();
// s->light[3] = (unsigned short) MSG_ReadShort();
// s->lightstyle = MSG_ReadByte();
// s->lightpflags = MSG_ReadByte();
} }
if (bits & E5_GLOW) if (bits & E5_GLOW)
{ {
s->glowsize = MSG_ReadByte(); s->glowsize = MSG_ReadByte();
s->glowcolour = MSG_ReadByte(); s->glowcolour = MSG_ReadByte();
} }
if (bits & E5_COLORMOD)
{
MSG_ReadByte();
MSG_ReadByte();
MSG_ReadByte();
}
} }
int cl_latestframenum; int cl_latestframenum;
@ -2471,7 +2479,7 @@ void CL_LinkViewModel(void)
// dlight_t *dl; // dlight_t *dl;
// int ambientlight, shadelight; // int ambientlight, shadelight;
static struct model_s *oldmodel[MAX_SPLITS]; static struct model_s *oldmodel[MAX_SPLITS];
static float lerptime[MAX_SPLITS]; static float lerptime[MAX_SPLITS];
static int prevframe[MAX_SPLITS]; static int prevframe[MAX_SPLITS];
static int oldframe[MAX_SPLITS]; static int oldframe[MAX_SPLITS];

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
@ -43,7 +43,7 @@ char *svc_strings[] =
"svc_stufftext", // [string] stuffed into client's console buffer "svc_stufftext", // [string] stuffed into client's console buffer
// the string should be \n terminated // the string should be \n terminated
"svc_setangle", // [vec3] set the view angle to this absolute value "svc_setangle", // [vec3] set the view angle to this absolute value
"svc_serverdata", // [long] version ... "svc_serverdata", // [long] version ...
"svc_lightstyle", // [qbyte] [string] "svc_lightstyle", // [qbyte] [string]
"svc_updatename", // [qbyte] [string] "svc_updatename", // [qbyte] [string]
@ -53,11 +53,11 @@ char *svc_strings[] =
"svc_updatecolors", // [qbyte] [qbyte] "svc_updatecolors", // [qbyte] [qbyte]
"svc_particle", // [vec3] <variable> "svc_particle", // [vec3] <variable>
"svc_damage", // [qbyte] impact [qbyte] blood [vec3] from "svc_damage", // [qbyte] impact [qbyte] blood [vec3] from
"svc_spawnstatic", "svc_spawnstatic",
"svc_spawnstatic2", "svc_spawnstatic2",
"svc_spawnbaseline", "svc_spawnbaseline",
"svc_temp_entity", // <variable> "svc_temp_entity", // <variable>
"svc_setpause", "svc_setpause",
"svc_signonnum", "svc_signonnum",
@ -155,13 +155,14 @@ char *svc_nqstrings[] =
"nqsvc_finale", // [string] music [string] text "nqsvc_finale", // [string] music [string] text
"nqsvc_cdtrack", // [qbyte] track [qbyte] looptrack "nqsvc_cdtrack", // [qbyte] track [qbyte] looptrack
"nqsvc_sellscreen", "nqsvc_sellscreen",
"nqsvc_cutscene", "nqsvc_cutscene", //34
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL", //40
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL", "NEW PROTOCOL",
@ -170,7 +171,17 @@ char *svc_nqstrings[] =
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL", "NEW PROTOCOL",
"NEW PROTOCOL" "NEW PROTOCOL",
"dpsvc_cgame", //50
"dpsvc_updatestatubyte",
"dpsvc_effect",
"dpsvc_effect2",
"dp6svc_precache/dp5svc_sound2",
"dpsvc_spawnbaseline2",
"dpsvc_spawnstatic2",
"dpsvc_entities",
"NEW PROTOCOL",
"dpsvc_spawnstaticsound2"
}; };
extern cvar_t requiredownloads, cl_standardchat; extern cvar_t requiredownloads, cl_standardchat;
@ -404,7 +415,7 @@ qboolean CL_CheckOrDownloadFile (char *filename, char *localname, int nodelay)
Con_TPrintf (TL_NORELATIVEPATHS); Con_TPrintf (TL_NORELATIVEPATHS);
return true; return true;
} }
if (COM_FCheckExists (localname)) if (COM_FCheckExists (localname))
{ // it exists, no need to download { // it exists, no need to download
return true; return true;
@ -470,7 +481,7 @@ qboolean CL_CheckMD2Skins (char *name)
while (precache_model_skin - 1 < LittleLong(pheader->num_skins)) while (precache_model_skin - 1 < LittleLong(pheader->num_skins))
{ {
str = (char *)precache_model + str = (char *)precache_model +
LittleLong(pheader->ofs_skins) + LittleLong(pheader->ofs_skins) +
(precache_model_skin - 1)*MD2MAX_SKINNAME; (precache_model_skin - 1)*MD2MAX_SKINNAME;
COM_CleanUpPath(str); COM_CleanUpPath(str);
if (!CL_CheckOrDownloadFile(str, str, false)) if (!CL_CheckOrDownloadFile(str, str, false))
@ -483,12 +494,12 @@ qboolean CL_CheckMD2Skins (char *name)
} }
precache_model_skin++; precache_model_skin++;
} }
if (precache_model) { if (precache_model) {
BZ_Free(precache_model); BZ_Free(precache_model);
precache_model=NULL; precache_model=NULL;
} }
precache_model_skin = 0; precache_model_skin = 0;
return false; return false;
} }
/* /*
@ -531,7 +542,7 @@ void Model_NextDownload (void)
cls.downloadtype = dl_model; cls.downloadtype = dl_model;
for ( for (
; cl.model_name[cls.downloadnumber][0] ; cl.model_name[cls.downloadnumber][0]
; cls.downloadnumber++) ; cls.downloadnumber++)
{ {
@ -612,7 +623,7 @@ void Model_NextDownload (void)
Mod_NowLoadExternal(); Mod_NowLoadExternal();
} }
// all done // all done
R_NewMap (); R_NewMap ();
@ -684,7 +695,7 @@ void Sound_NextDownload (void)
} }
#endif #endif
for ( for (
; cl.sound_name[cls.downloadnumber][0] ; cl.sound_name[cls.downloadnumber][0]
; cls.downloadnumber++) ; cls.downloadnumber++)
{ {
@ -804,7 +815,7 @@ void CL_SendDownloadReq(sizebuf_t *msg)
#define ZEXPORT VARGS #define ZEXPORT VARGS
#include "../../zip/zlib.h" #include "../../zip/zlib.h"
//# pragma comment (lib, "zip/zlib.lib") //# pragma comment (lib, "zip/zlib.lib")
#else #else
#include <zlib.h> #include <zlib.h>
#endif #endif
@ -941,7 +952,7 @@ void CL_ParseChunkedDownload(void)
// Con_Printf("^1too new!\n", chunknum); // Con_Printf("^1too new!\n", chunknum);
return; return;
} }
if (recievedblock[chunknum&(MAXBLOCKS-1)]) if (recievedblock[chunknum&(MAXBLOCKS-1)])
{ {
// Con_Printf("duplicated\n", chunknum); // Con_Printf("duplicated\n", chunknum);
@ -1194,7 +1205,7 @@ Con_DPrintf("Upload starting of %d...\n", size);
upload_pos = 0; upload_pos = 0;
CL_NextUpload(); CL_NextUpload();
} }
qboolean CL_IsUploading(void) qboolean CL_IsUploading(void)
{ {
@ -1234,11 +1245,11 @@ void CL_ParseServerData (void)
int protover, svcnt; int protover, svcnt;
float maxspeed, entgrav; float maxspeed, entgrav;
Con_DPrintf ("Serverdata packet received.\n"); Con_DPrintf ("Serverdata packet received.\n");
// //
// wipe the client_state_t struct // wipe the client_state_t struct
// //
SCR_BeginLoadingPlaque(); SCR_BeginLoadingPlaque();
@ -1262,8 +1273,8 @@ void CL_ParseServerData (void)
Host_EndGame ("Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/", protover, PROTOCOL_VERSION); Host_EndGame ("Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/", protover, PROTOCOL_VERSION);
} }
#else #else
protover = MSG_ReadLong (); protover = MSG_ReadLong ();
if (protover != PROTOCOL_VERSION && if (protover != PROTOCOL_VERSION &&
!(cls.demoplayback && (protover == 26 || protover == 27 || protover == 28))) !(cls.demoplayback && (protover == 26 || protover == 27 || protover == 28)))
Host_EndGame ("Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/", protover, PROTOCOL_VERSION); Host_EndGame ("Server returned version %i, not %i\nYou probably need to upgrade.\nCheck http://www.quakeworld.net/", protover, PROTOCOL_VERSION);
#endif #endif
@ -1418,7 +1429,7 @@ void CLQ2_ParseServerData (void)
sizeofcoord = 2; sizeofcoord = 2;
sizeofangle = 1; sizeofangle = 1;
Con_DPrintf ("Serverdata packet received.\n"); Con_DPrintf ("Serverdata packet received.\n");
// //
// wipe the client_state_t struct // wipe the client_state_t struct
@ -1509,7 +1520,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
CL_ClearState (); CL_ClearState ();
Stats_NewMap(); Stats_NewMap();
protover = MSG_ReadLong (); protover = MSG_ReadLong ();
sizeofcoord = 2; sizeofcoord = 2;
sizeofangle = 1; sizeofangle = 1;
@ -1525,6 +1536,8 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
nq_dp_protocol = 5; nq_dp_protocol = 5;
sizeofcoord = 4; sizeofcoord = 4;
sizeofangle = 2; sizeofangle = 2;
Con_DPrintf("DP5 protocols\n");
} }
else if (protover == DP6_PROTOCOL_VERSION) else if (protover == DP6_PROTOCOL_VERSION)
{ {
@ -1534,6 +1547,8 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
sizeofangle = 2; sizeofangle = 2;
cls.z_ext = Z_EXT_VIEWHEIGHT; cls.z_ext = Z_EXT_VIEWHEIGHT;
Con_DPrintf("DP6 protocols\n");
} }
else if (protover == DP7_PROTOCOL_VERSION) else if (protover == DP7_PROTOCOL_VERSION)
{ {
@ -1543,12 +1558,18 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
sizeofangle = 2; sizeofangle = 2;
cls.z_ext = Z_EXT_VIEWHEIGHT; cls.z_ext = Z_EXT_VIEWHEIGHT;
Con_DPrintf("DP7 protocols\n");
} }
else if (protover != NQ_PROTOCOL_VERSION) else if (protover != NQ_PROTOCOL_VERSION)
{ {
Host_EndGame ("Server returned version %i, not %i\nYou will need to use a different client.", protover, NQ_PROTOCOL_VERSION); Host_EndGame ("Server returned version %i, not %i\nYou will need to use a different client.", protover, NQ_PROTOCOL_VERSION);
} }
else
{
Con_DPrintf("Standard NQ protocols\n");
}
if (MSG_ReadByte() > MAX_CLIENTS) if (MSG_ReadByte() > MAX_CLIENTS)
{ {
Con_Printf ("Warning, this server supports more than 32 clients, additional clients will do bad things\n"); Con_Printf ("Warning, this server supports more than 32 clients, additional clients will do bad things\n");
@ -1591,7 +1612,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
memset (cl.sound_name, 0, sizeof(cl.sound_name)); memset (cl.sound_name, 0, sizeof(cl.sound_name));
for (numsounds=1 ; ; numsounds++) for (numsounds=1 ; ; numsounds++)
{ {
str = MSG_ReadString (); str = MSG_ReadString ();
if (!str[0]) if (!str[0])
break; break;
if (numsounds==MAX_SOUNDS) if (numsounds==MAX_SOUNDS)
@ -1616,7 +1637,7 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
{ {
if (cl.model_precache[i] == NULL) if (cl.model_precache[i] == NULL)
{ {
Host_EndGame("Model %s not found\n", cl.model_name[i]); Host_EndGame("Model %s not found\n", cl.model_name[i]);
} }
} }
CL_KeepaliveMessage (); CL_KeepaliveMessage ();
@ -1625,14 +1646,14 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
S_BeginPrecaching (); S_BeginPrecaching ();
for (i=1 ; i<numsounds ; i++) for (i=1 ; i<numsounds ; i++)
{ {
cl.sound_precache[i] = S_PrecacheSound (cl.sound_name[i]); cl.sound_precache[i] = S_PrecacheSound (cl.sound_name[i]);
CL_KeepaliveMessage (); CL_KeepaliveMessage ();
} }
S_EndPrecaching (); S_EndPrecaching ();
cl.worldmodel = cl.model_precache[1]; cl.worldmodel = cl.model_precache[1];
R_NewMap (); R_NewMap ();
if (cls.demoplayback) if (cls.demoplayback)
@ -1657,25 +1678,25 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
CL_SendClientCommand(true, "prespawn"); CL_SendClientCommand(true, "prespawn");
break; break;
case 2: case 2:
CL_SendClientCommand(true, "name \"%s\"\n", name.string); CL_SendClientCommand(true, "name \"%s\"\n", name.string);
name.modified = false; name.modified = false;
CL_SendClientCommand(true, "color %i %i\n", (int)topcolor.value, (int)bottomcolor.value); CL_SendClientCommand(true, "color %i %i\n", (int)topcolor.value, (int)bottomcolor.value);
CL_SendClientCommand(true, "spawn %s", ""); CL_SendClientCommand(true, "spawn %s", "");
break; break;
case 3: case 3:
CL_SendClientCommand(true, "begin"); CL_SendClientCommand(true, "begin");
Cache_Report (); // print remaining memory Cache_Report (); // print remaining memory
#ifdef VM_CG #ifdef VM_CG
CG_Start(); CG_Start();
#endif #endif
break; break;
case 4: case 4:
SCR_EndLoadingPlaque (); // allow normal screen updates SCR_EndLoadingPlaque (); // allow normal screen updates
break; break;
} }
} }
@ -1718,17 +1739,19 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
#define DEFAULT_VIEWHEIGHT 22 #define DEFAULT_VIEWHEIGHT 22
void CLNQ_ParseClientdata (int bits) void CLNQ_ParseClientdata (void)
{ {
int i; int i;
bits &= 0xffff; unsigned int bits;
bits = MSG_ReadShort();
if (bits & DPSU_EXTEND1) if (bits & DPSU_EXTEND1)
bits |= (MSG_ReadByte() << 16); bits |= (MSG_ReadByte() << 16);
if (bits & DPSU_EXTEND2) if (bits & DPSU_EXTEND2)
bits |= (MSG_ReadByte() << 24); bits |= (MSG_ReadByte() << 24);
if (bits & SU_VIEWHEIGHT) if (bits & SU_VIEWHEIGHT)
CL_SetStat(0, STAT_VIEWHEIGHT, MSG_ReadChar ()); CL_SetStat(0, STAT_VIEWHEIGHT, MSG_ReadChar ());
else if (nq_dp_protocol < 6) else if (nq_dp_protocol < 6)
@ -1738,7 +1761,7 @@ void CLNQ_ParseClientdata (int bits)
/*cl.idealpitch =*/ MSG_ReadChar (); /*cl.idealpitch =*/ MSG_ReadChar ();
/*else /*else
cl.idealpitch = 0;*/ cl.idealpitch = 0;*/
// VectorCopy (cl.mvelocity[0], cl.mvelocity[1]); // VectorCopy (cl.mvelocity[0], cl.mvelocity[1]);
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
{ {
@ -1847,12 +1870,12 @@ void CL_ParseSoundlist (void)
numsounds++; numsounds++;
if (numsounds >= MAX_SOUNDS) if (numsounds >= MAX_SOUNDS)
Host_EndGame ("Server sent too many sound_precache"); Host_EndGame ("Server sent too many sound_precache");
// if (strlen(str)>4) // if (strlen(str)>4)
// if (!strcmp(str+strlen(str)-4, ".mp3")) //don't let the server send us a specific mp3. convert it to wav and this way we know not to look outside the quake path for it. // if (!strcmp(str+strlen(str)-4, ".mp3")) //don't let the server send us a specific mp3. convert it to wav and this way we know not to look outside the quake path for it.
// strcpy(str+strlen(str)-4, ".wav"); // strcpy(str+strlen(str)-4, ".wav");
strcpy (cl.sound_name[numsounds], str); strcpy (cl.sound_name[numsounds], str);
} }
n = MSG_ReadByte(); n = MSG_ReadByte();
@ -1916,7 +1939,7 @@ void CL_ParseModellist (qboolean lots)
if (!strcmp(cl.model_name[nummodels],"progs/grenade.mdl")) if (!strcmp(cl.model_name[nummodels],"progs/grenade.mdl"))
cl_grenadeindex = nummodels; cl_grenadeindex = nummodels;
if (!strcmp(cl.model_name[nummodels],"progs/gib1.mdl")) if (!strcmp(cl.model_name[nummodels],"progs/gib1.mdl"))
cl_gib1index = nummodels; cl_gib1index = nummodels;
if (!strcmp(cl.model_name[nummodels],"progs/gib2.mdl")) if (!strcmp(cl.model_name[nummodels],"progs/gib2.mdl"))
@ -2003,7 +2026,7 @@ void CLQ2_ParseConfigString (void)
// strcpy (cl.configstrings[i], s); // strcpy (cl.configstrings[i], s);
// do something apropriate // do something apropriate
if (i == Q2CS_SKY) if (i == Q2CS_SKY)
{ {
@ -2068,7 +2091,7 @@ void CL_ParseBaseline (entity_state_t *es)
int i; int i;
memset(es, 0, sizeof(entity_state_t)); memset(es, 0, sizeof(entity_state_t));
es->modelindex = MSG_ReadByte (); es->modelindex = MSG_ReadByte ();
es->frame = MSG_ReadByte (); es->frame = MSG_ReadByte ();
es->colormap = MSG_ReadByte(); es->colormap = MSG_ReadByte();
@ -2092,7 +2115,7 @@ void CL_ParseBaseline2 (void)
memset(&nullst, 0, sizeof(entity_state_t)); memset(&nullst, 0, sizeof(entity_state_t));
memset(&es, 0, sizeof(entity_state_t)); memset(&es, 0, sizeof(entity_state_t));
CL_ParseDelta(&nullst, &es, MSG_ReadShort(), true); CL_ParseDelta(&nullst, &es, MSG_ReadShort(), true);
memcpy(&cl_baselines[es.number], &es, sizeof(es)); memcpy(&cl_baselines[es.number], &es, sizeof(es));
} }
@ -2148,7 +2171,7 @@ void CL_ParseStatic (int version)
if (i == cl.num_statics) if (i == cl.num_statics)
cl.num_statics++; cl.num_statics++;
} }
if (i >= MAX_STATIC_ENTITIES) if (i >= MAX_STATIC_ENTITIES)
{ {
cl.num_statics--; cl.num_statics--;
@ -2188,7 +2211,7 @@ void CL_ParseStatic (int version)
Con_TPrintf (TLC_PARSESTATICWITHNOMAP); Con_TPrintf (TLC_PARSESTATICWITHNOMAP);
return; return;
} }
R_AddEfrags (ent); R_AddEfrags (ent);
} }
@ -2203,7 +2226,7 @@ void CL_ParseStaticSound (void)
vec3_t org; vec3_t org;
int sound_num, vol, atten; int sound_num, vol, atten;
int i; int i;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
org[i] = MSG_ReadCoord (); org[i] = MSG_ReadCoord ();
sound_num = MSG_ReadByte (); sound_num = MSG_ReadByte ();
@ -2212,7 +2235,7 @@ void CL_ParseStaticSound (void)
if (!cl_staticsounds.value) if (!cl_staticsounds.value)
return; return;
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten); S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
} }
@ -2237,32 +2260,32 @@ void CL_ParseStartSoundPacket(void)
int channel, ent; int channel, ent;
int sound_num; int sound_num;
int volume; int volume;
float attenuation; float attenuation;
int i; int i;
channel = MSG_ReadShort(); channel = MSG_ReadShort();
if (channel & SND_VOLUME) if (channel & SND_VOLUME)
volume = MSG_ReadByte (); volume = MSG_ReadByte ();
else else
volume = DEFAULT_SOUND_PACKET_VOLUME; volume = DEFAULT_SOUND_PACKET_VOLUME;
if (channel & SND_ATTENUATION) if (channel & SND_ATTENUATION)
attenuation = MSG_ReadByte () / 64.0; attenuation = MSG_ReadByte () / 64.0;
else else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION; attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
sound_num = MSG_ReadByte (); sound_num = MSG_ReadByte ();
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
pos[i] = MSG_ReadCoord (); pos[i] = MSG_ReadCoord ();
ent = (channel>>3)&1023; ent = (channel>>3)&1023;
channel &= 7; channel &= 7;
if (ent > MAX_EDICTS) if (ent > MAX_EDICTS)
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent); Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent);
#ifdef PEXT_CSQC #ifdef PEXT_CSQC
if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation)) if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation))
#endif #endif
@ -2281,7 +2304,7 @@ void CLQ2_ParseStartSoundPacket(void)
int channel, ent; int channel, ent;
int sound_num; int sound_num;
float volume; float volume;
float attenuation; float attenuation;
int flags; int flags;
float ofs; float ofs;
@ -2292,11 +2315,11 @@ void CLQ2_ParseStartSoundPacket(void)
volume = MSG_ReadByte () / 255.0; volume = MSG_ReadByte () / 255.0;
else else
volume = Q2DEFAULT_SOUND_PACKET_VOLUME; volume = Q2DEFAULT_SOUND_PACKET_VOLUME;
if (flags & Q2SND_ATTENUATION) if (flags & Q2SND_ATTENUATION)
attenuation = MSG_ReadByte () / 64.0; attenuation = MSG_ReadByte () / 64.0;
else else
attenuation = Q2DEFAULT_SOUND_PACKET_ATTENUATION; attenuation = Q2DEFAULT_SOUND_PACKET_ATTENUATION;
if (flags & Q2SND_OFFSET) if (flags & Q2SND_OFFSET)
ofs = MSG_ReadByte () / 1000.0; ofs = MSG_ReadByte () / 1000.0;
@ -2305,7 +2328,7 @@ void CLQ2_ParseStartSoundPacket(void)
if (flags & Q2SND_ENT) if (flags & Q2SND_ENT)
{ // entity reletive { // entity reletive
channel = MSG_ReadShort(); channel = MSG_ReadShort();
ent = channel>>3; ent = channel>>3;
if (ent > MAX_EDICTS) if (ent > MAX_EDICTS)
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent); Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent);
@ -2321,7 +2344,7 @@ void CLQ2_ParseStartSoundPacket(void)
if (flags & Q2SND_POS) if (flags & Q2SND_POS)
{ // positioned in space { // positioned in space
MSG_ReadPos (pos_v); MSG_ReadPos (pos_v);
pos = pos_v; pos = pos_v;
} }
else // use entity number else // use entity number
@ -2348,21 +2371,21 @@ void CLNQ_ParseStartSoundPacket(void)
int sound_num; int sound_num;
int volume; int volume;
int field_mask; int field_mask;
float attenuation; float attenuation;
int i; int i;
field_mask = MSG_ReadByte(); field_mask = MSG_ReadByte();
if (field_mask & NQSND_VOLUME) if (field_mask & NQSND_VOLUME)
volume = MSG_ReadByte (); volume = MSG_ReadByte ();
else else
volume = DEFAULT_SOUND_PACKET_VOLUME; volume = DEFAULT_SOUND_PACKET_VOLUME;
if (field_mask & NQSND_ATTENUATION) if (field_mask & NQSND_ATTENUATION)
attenuation = MSG_ReadByte () / 64.0; attenuation = MSG_ReadByte () / 64.0;
else else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION; attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
channel = MSG_ReadShort (); channel = MSG_ReadShort ();
sound_num = MSG_ReadByte (); sound_num = MSG_ReadByte ();
@ -2371,15 +2394,15 @@ void CLNQ_ParseStartSoundPacket(void)
if (ent > MAX_EDICTS) if (ent > MAX_EDICTS)
Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent); Host_EndGame ("CL_ParseStartSoundPacket: ent = %i", ent);
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
pos[i] = MSG_ReadCoord (); pos[i] = MSG_ReadCoord ();
S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation); S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
if (ent == cl.playernum[0]+1) if (ent == cl.playernum[0]+1)
TP_CheckPickupSound(cl.sound_name[sound_num], pos); TP_CheckPickupSound(cl.sound_name[sound_num], pos);
} }
#endif #endif
@ -2426,7 +2449,7 @@ void CL_ParseClientdata (void)
cls.latency = latency; cls.latency = latency;
else else
cls.latency += 0.001; // drift up, so correction are needed cls.latency += 0.001; // drift up, so correction are needed
} }
} }
/* /*
@ -2519,12 +2542,12 @@ void CL_NewTranslation (int slot)
else else
for (j=0 ; j<16 ; j++) for (j=0 ; j<16 ; j++)
dest[TOP_RANGE+j] = source[top+15-j]; dest[TOP_RANGE+j] = source[top+15-j];
if (bottom < 128) if (bottom < 128)
memcpy (dest + BOTTOM_RANGE, source + bottom, 16); memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
else else
for (j=0 ; j<16 ; j++) for (j=0 ; j<16 ; j++)
dest[BOTTOM_RANGE+j] = source[bottom+15-j]; dest[BOTTOM_RANGE+j] = source[bottom+15-j];
} }
} }
} }
@ -2654,7 +2677,7 @@ void CL_SetStat (int pnum, int stat, int value)
if (cl.stats[pnum][stat] != value) if (cl.stats[pnum][stat] != value)
Sbar_Changed (); Sbar_Changed ();
if (stat == STAT_ITEMS) if (stat == STAT_ITEMS)
{ // set flash times { // set flash times
for (j=0 ; j<32 ; j++) for (j=0 ; j<32 ; j++)
@ -2716,7 +2739,7 @@ void CL_MuzzleFlash (int destsplit)
if (i-1 == cl.playernum[destsplit] && cl_muzzleflash.value == 2) if (i-1 == cl.playernum[destsplit] && cl_muzzleflash.value == 2)
return; return;
pack = &cl.frames[cls.netchan.incoming_sequence&UPDATE_MASK].packet_entities; pack = &cl.frames[cls.netchan.incoming_sequence&UPDATE_MASK].packet_entities;
for (pnum=0 ; pnum<pack->num_entities ; pnum++) //try looking for an entity with that id first for (pnum=0 ; pnum<pack->num_entities ; pnum++) //try looking for an entity with that id first
{ {
@ -2825,7 +2848,7 @@ void CLQ2_ParseMuzzleFlash (void)
_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); _snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0); Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0);
break; break;
case Q2MZ_SHOTGUN: case Q2MZ_SHOTGUN:
dl->color[0] = 0.2;dl->color[1] = 0.2;dl->color[2] = 0; dl->color[0] = 0.2;dl->color[1] = 0.2;dl->color[2] = 0;
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/shotgf1b.wav"), volume, ATTN_NORM, 0); Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/shotgf1b.wav"), volume, ATTN_NORM, 0);
@ -2861,7 +2884,7 @@ void CLQ2_ParseMuzzleFlash (void)
_snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); _snprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1);
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0.066); Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound(soundname), volume, ATTN_NORM, 0.066);
break; break;
case Q2MZ_RAILGUN: case Q2MZ_RAILGUN:
dl->color[0] = 0.1;dl->color[1] = 0.1;dl->color[2] = 0.2; dl->color[0] = 0.1;dl->color[1] = 0.1;dl->color[2] = 0.2;
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/railgf1a.wav"), volume, ATTN_NORM, 0); Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/railgf1a.wav"), volume, ATTN_NORM, 0);
@ -2905,7 +2928,7 @@ void CLQ2_ParseMuzzleFlash (void)
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/plasshot.wav"), volume, ATTN_NORM, 0); Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/plasshot.wav"), volume, ATTN_NORM, 0);
break; break;
// RAFAEL // RAFAEL
case Q2MZ_IONRIPPER: case Q2MZ_IONRIPPER:
dl->color[0] = 0.2;dl->color[1] = 0.1; dl->color[2] = 0.1; dl->color[0] = 0.2;dl->color[1] = 0.1; dl->color[2] = 0.1;
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/rippfire.wav"), volume, ATTN_NORM, 0); Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/rippfire.wav"), volume, ATTN_NORM, 0);
break; break;
@ -2934,7 +2957,7 @@ void CLQ2_ParseMuzzleFlash (void)
// negative flashes handled the same in gl/soft until CL_AddDLights // negative flashes handled the same in gl/soft until CL_AddDLights
dl->color[0] = -0.2;dl->color[1] = -0.2;dl->color[2] = -0.2; dl->color[0] = -0.2;dl->color[1] = -0.2;dl->color[2] = -0.2;
Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/disint2.wav"), volume, ATTN_NORM, 0); Q2S_StartSound (NULL, i, CHAN_WEAPON, S_PrecacheSound("weapons/disint2.wav"), volume, ATTN_NORM, 0);
break; break;
case Q2MZ_NUKE1: case Q2MZ_NUKE1:
dl->color[0] = 0.2;dl->color[1] = 0;dl->color[2] = 0; dl->color[0] = 0.2;dl->color[1] = 0;dl->color[2] = 0;
dl->die = cl.time + 100; dl->die = cl.time + 100;
@ -2956,7 +2979,7 @@ void CLQ2_ParseMuzzleFlash (void)
} }
} }
void CLQ2_ParseMuzzleFlash2 (void) void CLQ2_ParseMuzzleFlash2 (void)
{ {
int ent; int ent;
int flash_number; int flash_number;
@ -2984,7 +3007,7 @@ void CLQ2_ParseInventory (void)
int build_number( void ); int build_number( void );
//return if we want to print the message. //return if we want to print the message.
char *CL_ParseChat(char *text, player_info_t **player) char *CL_ParseChat(char *text, player_info_t **player)
{ {
extern cvar_t cl_chatsound, cl_nofake; extern cvar_t cl_chatsound, cl_nofake;
int flags; int flags;
int offset=0; int offset=0;
@ -3054,7 +3077,7 @@ char *CL_ParseChat(char *text, player_info_t **player)
if (cl_nofake.value == 1 || (cl_nofake.value == 2 && flags != 2)) { if (cl_nofake.value == 1 || (cl_nofake.value == 2 && flags != 2)) {
for (p = s; *p; p++) for (p = s; *p; p++)
if (*p == 13 || (*p == 10 && p[1])) if (*p == 13 || (*p == 10 && p[1]))
*p = ' '; *p = ' ';
} }
msgflags = flags; msgflags = flags;
@ -3231,7 +3254,7 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
if (!memessage) if (!memessage)
{ {
// only print seperator with an actual player name // only print seperator with an actual player name
con_ormask = CON_STANDARDMASK; con_ormask = CON_STANDARDMASK;
if (!cl_standardchat.value && (plrflags & TPM_SPECTATOR)) if (!cl_standardchat.value && (plrflags & TPM_SPECTATOR))
Con_Printf ("^0:^7 "); Con_Printf ("^0:^7 ");
else else
@ -3403,7 +3426,7 @@ void CL_ParseServerMessage (void)
} }
SHOWNET(svc_strings[cmd]); SHOWNET(svc_strings[cmd]);
// other commands // other commands
switch (cmd) switch (cmd)
{ {
@ -3416,11 +3439,11 @@ void CL_ParseServerMessage (void)
cl.gametime = MSG_ReadFloat(); cl.gametime = MSG_ReadFloat();
cl.gametimemark = realtime; cl.gametimemark = realtime;
break; break;
case svc_nop: case svc_nop:
// Con_Printf ("svc_nop\n"); // Con_Printf ("svc_nop\n");
break; break;
case svc_disconnect: case svc_disconnect:
if (cls.state == ca_connected) if (cls.state == ca_connected)
{ {
@ -3454,15 +3477,15 @@ void CL_ParseServerMessage (void)
Con_TPrintf (TL_ST, Translate(s)); Con_TPrintf (TL_ST, Translate(s));
} }
break; break;
case svc_centerprint: case svc_centerprint:
SCR_CenterPrint (destsplit, Translate(MSG_ReadString ())); SCR_CenterPrint (destsplit, Translate(MSG_ReadString ()));
break; break;
case svc_stufftext: case svc_stufftext:
s = MSG_ReadString (); s = MSG_ReadString ();
CL_ParseStuffCmd(s, destsplit); CL_ParseStuffCmd(s, destsplit);
break; break;
case svc_damage: case svc_damage:
@ -3478,7 +3501,7 @@ void CL_ParseServerMessage (void)
case svc_setview: case svc_setview:
if (!(cls.fteprotocolextensions & PEXT_SETVIEW)) if (!(cls.fteprotocolextensions & PEXT_SETVIEW))
Host_EndGame("PEXT_SETVIEW is meant to be disabled\n"); Host_EndGame("PEXT_SETVIEW is meant to be disabled\n");
cl.viewentity[destsplit]=MSG_ReadShort(); cl.viewentity[destsplit]=MSG_ReadShort();
break; break;
#endif #endif
case svc_setangle: case svc_setangle:
@ -3528,19 +3551,19 @@ void CL_ParseServerMessage (void)
case svc_sound: case svc_sound:
CL_ParseStartSoundPacket(); CL_ParseStartSoundPacket();
break; break;
case svc_stopsound: case svc_stopsound:
i = MSG_ReadShort(); i = MSG_ReadShort();
S_StopSound(i>>3, i&7); S_StopSound(i>>3, i&7);
break; break;
case svc_updatefrags: case svc_updatefrags:
Sbar_Changed (); Sbar_Changed ();
i = MSG_ReadByte (); i = MSG_ReadByte ();
if (i >= MAX_CLIENTS) if (i >= MAX_CLIENTS)
Host_EndGame ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD"); Host_EndGame ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
cl.players[i].frags = MSG_ReadShort (); cl.players[i].frags = MSG_ReadShort ();
break; break;
case svc_updateping: case svc_updateping:
i = MSG_ReadByte (); i = MSG_ReadByte ();
@ -3548,14 +3571,14 @@ void CL_ParseServerMessage (void)
Host_EndGame ("CL_ParseServerMessage: svc_updateping > MAX_SCOREBOARD"); Host_EndGame ("CL_ParseServerMessage: svc_updateping > MAX_SCOREBOARD");
cl.players[i].ping = MSG_ReadShort (); cl.players[i].ping = MSG_ReadShort ();
break; break;
case svc_updatepl: case svc_updatepl:
i = MSG_ReadByte (); i = MSG_ReadByte ();
if (i >= MAX_CLIENTS) if (i >= MAX_CLIENTS)
Host_EndGame ("CL_ParseServerMessage: svc_updatepl > MAX_SCOREBOARD"); Host_EndGame ("CL_ParseServerMessage: svc_updatepl > MAX_SCOREBOARD");
cl.players[i].pl = MSG_ReadByte (); cl.players[i].pl = MSG_ReadByte ();
break; break;
case svc_updateentertime: case svc_updateentertime:
// time is sent over as seconds ago // time is sent over as seconds ago
i = MSG_ReadByte (); i = MSG_ReadByte ();
@ -3563,7 +3586,7 @@ void CL_ParseServerMessage (void)
Host_EndGame ("CL_ParseServerMessage: svc_updateentertime > MAX_SCOREBOARD"); Host_EndGame ("CL_ParseServerMessage: svc_updateentertime > MAX_SCOREBOARD");
cl.players[i].entertime = realtime - MSG_ReadFloat (); cl.players[i].entertime = realtime - MSG_ReadFloat ();
break; break;
case svc_spawnbaseline: case svc_spawnbaseline:
i = MSG_ReadShort (); i = MSG_ReadShort ();
CL_ParseBaseline (&cl_baselines[i]); CL_ParseBaseline (&cl_baselines[i]);
@ -3619,7 +3642,7 @@ void CL_ParseServerMessage (void)
j = MSG_ReadLong (); //make qbyte if nq compatability? j = MSG_ReadLong (); //make qbyte if nq compatability?
CL_SetStat (destsplit, i, j); CL_SetStat (destsplit, i, j);
break; break;
case svc_spawnstaticsound: case svc_spawnstaticsound:
CL_ParseStaticSound (); CL_ParseStaticSound ();
break; break;
@ -3636,7 +3659,7 @@ void CL_ParseServerMessage (void)
cl.completed_time = realtime; cl.completed_time = realtime;
vid.recalc_refdef = true; // go to full screen vid.recalc_refdef = true; // go to full screen
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
cl.simorg[0][i] = MSG_ReadCoord (); cl.simorg[0][i] = MSG_ReadCoord ();
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
cl.simangles[0][i] = MSG_ReadAngle (); cl.simangles[0][i] = MSG_ReadAngle ();
VectorCopy (vec3_origin, cl.simvel[0]); VectorCopy (vec3_origin, cl.simvel[0]);
@ -3650,9 +3673,9 @@ void CL_ParseServerMessage (void)
cl.intermission = 2; cl.intermission = 2;
cl.completed_time = realtime; cl.completed_time = realtime;
vid.recalc_refdef = true; // go to full screen vid.recalc_refdef = true; // go to full screen
SCR_CenterPrint (destsplit, MSG_ReadString ()); SCR_CenterPrint (destsplit, MSG_ReadString ());
break; break;
case svc_sellscreen: case svc_sellscreen:
Cmd_ExecuteString ("help", RESTRICT_RCON); Cmd_ExecuteString ("help", RESTRICT_RCON);
break; break;
@ -3841,7 +3864,7 @@ void CLQ2_ParseServerMessage (void)
} }
SHOWNET(va("%i", cmd)); SHOWNET(va("%i", cmd));
// other commands // other commands
switch (cmd) switch (cmd)
{ {
@ -3851,7 +3874,7 @@ void CLQ2_ParseServerMessage (void)
//known to game //known to game
case svcq2_muzzleflash: case svcq2_muzzleflash:
CLQ2_ParseMuzzleFlash(); CLQ2_ParseMuzzleFlash();
break; break;
case svcq2_muzzleflash2: case svcq2_muzzleflash2:
CLQ2_ParseMuzzleFlash2(); CLQ2_ParseMuzzleFlash2();
@ -3927,7 +3950,7 @@ void CLQ2_ParseServerMessage (void)
case svcq2_configstring: //13 // [short] [string] case svcq2_configstring: //13 // [short] [string]
CLQ2_ParseConfigString(); CLQ2_ParseConfigString();
break; break;
case svcq2_spawnbaseline://14 case svcq2_spawnbaseline://14
CLQ2_ParseBaseline(); CLQ2_ParseBaseline();
break; break;
case svcq2_centerprint: //15 // [string] to put in center of the screen case svcq2_centerprint: //15 // [string] to put in center of the screen
@ -4006,17 +4029,17 @@ void CLNQ_ParseServerMessage (void)
} }
SHOWNET2(svc_nqstrings[cmd>(sizeof(svc_nqstrings)/sizeof(char*))?0:cmd], cmd); SHOWNET2(svc_nqstrings[cmd>(sizeof(svc_nqstrings)/sizeof(char*))?0:cmd], cmd);
// other commands // other commands
switch (cmd) switch (cmd)
{ {
default: default:
Host_EndGame ("CLNQ_ParseServerMessage: Illegible server message (%i)", cmd); Host_EndGame ("CLNQ_ParseServerMessage: Illegible server message (%i)", cmd);
return; return;
case svc_nop: case svc_nop:
// Con_Printf ("svc_nop\n"); // Con_Printf ("svc_nop\n");
break; break;
case svc_print: case svc_print:
s = MSG_ReadString (); s = MSG_ReadString ();
@ -4043,11 +4066,11 @@ void CLNQ_ParseServerMessage (void)
case svc_disconnect: case svc_disconnect:
CL_Disconnect(); CL_Disconnect();
break; break;
case svc_centerprint: case svc_centerprint:
SCR_CenterPrint (0, Translate(MSG_ReadString ())); SCR_CenterPrint (0, Translate(MSG_ReadString ()));
break; break;
case svc_stufftext: case svc_stufftext:
s = MSG_ReadString (); s = MSG_ReadString ();
Con_DPrintf ("stufftext: %s\n", s); Con_DPrintf ("stufftext: %s\n", s);
@ -4057,7 +4080,7 @@ void CLNQ_ParseServerMessage (void)
case svc_serverdata: case svc_serverdata:
Cbuf_Execute (); // make sure any stuffed commands are done Cbuf_Execute (); // make sure any stuffed commands are done
CLNQ_ParseServerData (); CLNQ_ParseServerData ();
vid.recalc_refdef = true; // leave full screen intermission vid.recalc_refdef = true; // leave full screen intermission
break; break;
case svcdp_precache: case svcdp_precache:
@ -4068,8 +4091,8 @@ void CLNQ_ParseServerMessage (void)
cl.cdtrack = MSG_ReadByte (); cl.cdtrack = MSG_ReadByte ();
MSG_ReadByte (); MSG_ReadByte ();
CDAudio_Play ((qbyte)cl.cdtrack, true); CDAudio_Play ((qbyte)cl.cdtrack, true);
break; break;
case svc_setview: case svc_setview:
if (!cl.viewentity[0]) if (!cl.viewentity[0])
@ -4101,7 +4124,7 @@ void CLNQ_ParseServerMessage (void)
case svc_spawnstatic: case svc_spawnstatic:
CL_ParseStatic (1); CL_ParseStatic (1);
break; break;
case svc_spawnbaseline: case svc_spawnbaseline:
i = MSG_ReadShort (); i = MSG_ReadShort ();
CL_ParseBaseline (&cl_baselines[i]); CL_ParseBaseline (&cl_baselines[i]);
@ -4171,12 +4194,12 @@ void CLNQ_ParseServerMessage (void)
break; break;
case svc_updatestat: case svc_updatestat:
i = MSG_ReadByte (); i = MSG_ReadByte ();
j = MSG_ReadLong (); j = MSG_ReadLong ();
CL_SetStat (0, i, j); CL_SetStat (0, i, j);
break; break;
case 51://svc_updatestat: case svcdp_updatestatbyte:
i = MSG_ReadByte (); i = MSG_ReadByte ();
j = MSG_ReadByte (); j = MSG_ReadByte ();
CL_SetStat (0, i, j); CL_SetStat (0, i, j);
break; break;
@ -4187,8 +4210,7 @@ void CLNQ_ParseServerMessage (void)
break; break;
case svc_clientdata: case svc_clientdata:
i = MSG_ReadShort (); CLNQ_ParseClientdata ();
CLNQ_ParseClientdata (i);
break; break;
case svc_sound: case svc_sound:
@ -4198,7 +4220,7 @@ void CLNQ_ParseServerMessage (void)
case svc_temp_entity: case svc_temp_entity:
CL_ParseTEnt (true); CL_ParseTEnt (true);
break; break;
case svc_particle: case svc_particle:
CLNQ_ParseParticleEffect (); CLNQ_ParseParticleEffect ();
break; break;
@ -4223,7 +4245,7 @@ void CLNQ_ParseServerMessage (void)
cl.intermission = 2; cl.intermission = 2;
cl.completed_time = cl.time; cl.completed_time = cl.time;
vid.recalc_refdef = true; // go to full screen vid.recalc_refdef = true; // go to full screen
SCR_CenterPrint (0, MSG_ReadString ()); SCR_CenterPrint (0, MSG_ReadString ());
break; break;
case svc_cutscene: case svc_cutscene:
@ -4253,7 +4275,7 @@ void CLNQ_ParseServerMessage (void)
{ // first update is the final signon stage { // first update is the final signon stage
cls.signon = 4; cls.signon = 4;
CLNQ_SignonReply (); CLNQ_SignonReply ();
} }
//well, it's really any protocol, but we're only going to support version 5. //well, it's really any protocol, but we're only going to support version 5.
CLNQ_ParseDarkPlaces5Entities(); CLNQ_ParseDarkPlaces5Entities();
break; break;

View file

@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
@ -142,11 +142,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_updatecolors 17 // [qbyte] [qbyte] [qbyte] #define svc_updatecolors 17 // [qbyte] [qbyte] [qbyte]
#define svc_particle 18 // [vec3] <variable> #define svc_particle 18 // [vec3] <variable>
#define svc_damage 19 #define svc_damage 19
#define svc_spawnstatic 20 #define svc_spawnstatic 20
#define svc_spawnstatic2 21 #define svc_spawnstatic2 21
#define svc_spawnbaseline 22 #define svc_spawnbaseline 22
#define svc_temp_entity 23 // variable #define svc_temp_entity 23 // variable
#define svc_setpause 24 // [qbyte] on / off #define svc_setpause 24 // [qbyte] on / off
#define svc_signonnum 25 // [qbyte] used for the signon sequence #define svc_signonnum 25 // [qbyte] used for the signon sequence
@ -166,6 +166,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_cutscene 34 //hmm... nq only... added after qw tree splitt? #define svc_cutscene 34 //hmm... nq only... added after qw tree splitt?
//QW svcs
#define svc_smallkick 34 // set client punchangle to 2 #define svc_smallkick 34 // set client punchangle to 2
#define svc_bigkick 35 // set client punchangle to 4 #define svc_bigkick 35 // set client punchangle to 4
@ -181,7 +184,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_download 41 // [short] size [size bytes] #define svc_download 41 // [short] size [size bytes]
#define svc_playerinfo 42 // variable #define svc_playerinfo 42 // variable
#define svc_nails 43 // [qbyte] num [48 bits] xyzpy 12 12 12 4 8 #define svc_nails 43 // [qbyte] num [48 bits] xyzpy 12 12 12 4 8
#define svc_chokecount 44 // [qbyte] packets choked #define svc_chokecount 44 // [qbyte] packets choked
#define svc_modellist 45 // [strings] #define svc_modellist 45 // [strings]
#define svc_soundlist 46 // [strings] #define svc_soundlist 46 // [strings]
@ -191,14 +194,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_entgravity 50 // gravity change, for prediction #define svc_entgravity 50 // gravity change, for prediction
#define svc_setinfo 51 // setinfo on a client #define svc_setinfo 51 // setinfo on a client
#define svc_serverinfo 52 // serverinfo #define svc_serverinfo 52 // serverinfo
#define svcnq_effect 52 // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
#define svcnq_effect2 53 // [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate
#define svc_updatepl 53 // [qbyte] [qbyte] #define svc_updatepl 53 // [qbyte] [qbyte]
#define svcdp_precache 54 // [short] precacheindex [string] filename, precacheindex is + 0 for modelindex and +32768 for soundindex //mvdsv extended svcs (for mvd playback)
#define svc_nails2 54 //qwe - [qbyte] num [52 bits] nxyzpy 8 12 12 12 4 8 #define svc_nails2 54 //qwe - [qbyte] num [52 bits] nxyzpy 8 12 12 12 4 8
#define svcdp_spawnbaseline2 55 //FTE extended svcs
#ifdef PEXT_VIEW2 #ifdef PEXT_VIEW2
#define svc_view2 56 #define svc_view2 56
#endif #endif
@ -206,8 +207,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_lightstylecol 57 #define svc_lightstylecol 57
#endif #endif
#define svcdp_entities 57
#ifdef PEXT_BULLETENS #ifdef PEXT_BULLETENS
#define svc_bulletentext 58 #define svc_bulletentext 58
#endif #endif
@ -246,6 +245,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_precache 77 #define svc_precache 77
//DP extended svcs
#define svcdp_updatestatbyte 51
#define svcnq_effect 52 // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate
#define svcnq_effect2 53 // [vector] org [short] modelindex [short] startframe [byte] framecount [byte] framerate
#define svcdp_precache 54 // [short] precacheindex [string] filename, precacheindex is + 0 for modelindex and +32768 for soundindex
#define svcdp_spawnbaseline2 55
#define svcdp_entities 57
#define svc_invalid 256 #define svc_invalid 256
@ -269,7 +279,7 @@ enum svcq2_ops_e
svcq2_stufftext, //11 // [string] stuffed into client's console buffer, should be \n terminated svcq2_stufftext, //11 // [string] stuffed into client's console buffer, should be \n terminated
svcq2_serverdata, //12 // [long] protocol ... svcq2_serverdata, //12 // [long] protocol ...
svcq2_configstring, //13 // [short] [string] svcq2_configstring, //13 // [short] [string]
svcq2_spawnbaseline,//14 svcq2_spawnbaseline,//14
svcq2_centerprint, //15 // [string] to put in center of the screen svcq2_centerprint, //15 // [string] to put in center of the screen
svcq2_download, //16 // [short] size [size bytes] svcq2_download, //16 // [short] size [size bytes]
svcq2_playerinfo, //17 // variable svcq2_playerinfo, //17 // variable
@ -281,7 +291,7 @@ enum svcq2_ops_e
enum clcq2_ops_e enum clcq2_ops_e
{ {
clcq2_bad, clcq2_bad,
clcq2_nop, clcq2_nop,
clcq2_move, // [[usercmd_t] clcq2_move, // [[usercmd_t]
clcq2_userinfo, // [[userinfo string] clcq2_userinfo, // [[userinfo string]
clcq2_stringcmd // [string] message clcq2_stringcmd // [string] message

View file

@ -2967,7 +2967,7 @@ void PF_stuffcmd (progfuncs_t *prinst, struct globalvars_s *pr_globals)
cl = &svs.clients[entnum-1]; cl = &svs.clients[entnum-1];
if (strcmp(str, "disconnect\n") == 0) if (strcmp(str, "disconnect\n") == 0)
{ {
// so long and thanks for all the fish // so long and thanks for all the fish
@ -5083,24 +5083,24 @@ void PF_infokey (progfuncs_t *prinst, struct globalvars_s *pr_globals)
} }
else if (e1 <= MAX_CLIENTS) else if (e1 <= MAX_CLIENTS)
{ {
if (!strcmp(key, "ip")) value = ov;
if (!strcmp(key, "ip") || !strcmp(key, "realip")) //note: FTE doesn't support mvdsv's realip stuff, so pretend that we do if the mod asks
value = strcpy(ov, NET_BaseAdrToString (svs.clients[e1-1].netchan.remote_address)); value = strcpy(ov, NET_BaseAdrToString (svs.clients[e1-1].netchan.remote_address));
else if (!strcmp(key, "ping")) else if (!strcmp(key, "ping"))
{ sprintf(ov, "%d", SV_CalcPing (&svs.clients[e1-1]));
int ping = SV_CalcPing (&svs.clients[e1-1]); else if (!strcmp(key, "*userid"))
sprintf(ov, "%d", ping); sprintf(ov, "%d", svs.clients[e1-1].userid);
value = ov; else if (!strcmp(key, "download"))
} sprintf(ov, "%d", svs.clients[e1-1].download != NULL ? (int)(100*svs.clients[e1-1].downloadcount/svs.clients[e1-1].downloadsize) : -1);
// else if (!strcmp(key, "login")) //mvdsv
// value = "";
else if (!strcmp(key, "trustlevel")) //info for progs. else if (!strcmp(key, "trustlevel")) //info for progs.
{ {
rankstats_t rs; rankstats_t rs;
if (!svs.clients[e1-1].rankid) if (!svs.clients[e1-1].rankid)
value = ""; value = "";
else if (Rank_GetPlayerStats(svs.clients[e1-1].rankid, &rs)) else if (Rank_GetPlayerStats(svs.clients[e1-1].rankid, &rs))
{
sprintf(ov, "%d", rs.trustlevel); sprintf(ov, "%d", rs.trustlevel);
value = ov;
}
else else
value = ""; value = "";
} }
@ -6156,7 +6156,7 @@ lh_extension_t QSG_Extensions[] = {
{"FRIK_FILE", 11, NULL, {"stof", "fopen","fclose","fgets","fputs","strlen","strcat","substring","stov","strzone","strunzone"}}, {"FRIK_FILE", 11, NULL, {"stof", "fopen","fclose","fgets","fputs","strlen","strcat","substring","stov","strzone","strunzone"}},
{"FTE_CALLTIMEOFDAY", 1, NULL, {"calltimeofday"}}, {"FTE_CALLTIMEOFDAY", 1, NULL, {"calltimeofday"}},
{"FTE_FORCEINFOKEY", 1, NULL, {"forceinfokey"}}, {"FTE_FORCEINFOKEY", 1, NULL, {"forceinfokey"}},
{"FTE_GFX_QUAKE3SHADERS"}, {"FTE_GFX_QUAKE3SHADERS"},
{"FTE_ISBACKBUFFERED", 1, NULL, {"isbackbuffered"}}, {"FTE_ISBACKBUFFERED", 1, NULL, {"isbackbuffered"}},
#ifndef NOMEDIA #ifndef NOMEDIA
{"FTE_MEDIA_AVI"}, //playfilm supports avi files. {"FTE_MEDIA_AVI"}, //playfilm supports avi files.
@ -6169,6 +6169,7 @@ lh_extension_t QSG_Extensions[] = {
#ifdef SVCHAT #ifdef SVCHAT
{"FTE_NPCCHAT", 1, NULL, {"chat"}}, //server looks at chat files. It automagically branches through calling qc functions as requested. {"FTE_NPCCHAT", 1, NULL, {"chat"}}, //server looks at chat files. It automagically branches through calling qc functions as requested.
#endif #endif
{"FTE_QC_MATCHCLIENTNAME", 1, NULL, {"matchclient"}},
{"FTE_SOLID_LADDER"}, //part of a worthy hl implementation. Allows a simple trigger to remove effects of gravity (solid 20) {"FTE_SOLID_LADDER"}, //part of a worthy hl implementation. Allows a simple trigger to remove effects of gravity (solid 20)
//eperimental advanced strings functions. //eperimental advanced strings functions.
@ -6176,7 +6177,7 @@ lh_extension_t QSG_Extensions[] = {
{"FTE_STRINGS", 18, NULL, {"stof", "strlen","strcat","substring","stov","strzone","strunzone", {"FTE_STRINGS", 18, NULL, {"stof", "strlen","strcat","substring","stov","strzone","strunzone",
"strstrofs", "str2chr", "chr2str", "strconv", "infoadd", "infoget", "strncmp", "strcasecmp", "strncasecmp"}}, "strstrofs", "str2chr", "chr2str", "strconv", "infoadd", "infoget", "strncmp", "strcasecmp", "strncasecmp"}},
{"FTE_TE_STANDARDEFFECTBUILTINS", 16, NULL, {"te_gunshot", "te_spike", "te_superspike", "te_explosion", "te_tarexplosion", "te_wizspike", "te_knightspike", "te_lavasplash", {"FTE_TE_STANDARDEFFECTBUILTINS", 16, NULL, {"te_gunshot", "te_spike", "te_superspike", "te_explosion", "te_tarexplosion", "te_wizspike", "te_knightspike", "te_lavasplash",
"te_teleport", "te_explosion2", "te_lightning1", "te_lightning2", "te_lightning3", "te_beam", "te_lightningblood", "te_bloodqw"}}, "te_teleport", "te_explosion2", "te_lightning1", "te_lightning2", "te_lightning3", "te_beam", "te_lightningblood", "te_bloodqw"}},
{"HYDR_WRITESTRING2", 1, NULL, {"writestring2"}}, {"HYDR_WRITESTRING2", 1, NULL, {"writestring2"}},
@ -6191,7 +6192,7 @@ lh_extension_t QSG_Extensions[] = {
{"ZQ_MOVETYPE_NOCLIP"}, {"ZQ_MOVETYPE_NOCLIP"},
{"ZQ_MOVETYPE_NONE"}, {"ZQ_MOVETYPE_NONE"},
// {"ZQ_QC_PARTICLE"}, //particle builtin works in QW ( we don't mimic ZQ fully though) // {"ZQ_QC_PARTICLE"}, //particle builtin works in QW ( we don't mimic ZQ fully though)
{"ZQ_QC_STRINGS", 7, NULL, {"stof", "strlen","strcat","substring","stov","strzone","strunzone"}} //a trimmed down FRIK_FILE. {"ZQ_QC_STRINGS", 7, NULL, {"stof", "strlen","strcat","substring","stov","strzone","strunzone"}} //a trimmed down FRIK_FILE.
}; };
@ -8820,6 +8821,34 @@ void PF_runclientphys(progfuncs_t *prinst, struct globalvars_s *pr_globals)
PM_PlayerMove(sv.gamespeed); PM_PlayerMove(sv.gamespeed);
} }
//entity(string match [, float matchnum]) matchclient = #241;
void PF_matchclient(progfuncs_t *prinst, struct globalvars_s *pr_globals)
{
int clnum=-1;
char *name = PR_GetStringOfs(prinst, OFS_PARM0);
int matchnum = G_FLOAT(OFS_PARM1);
client_t *cl;
if (*prinst->callargc < 2)
{
SV_GetClientForString(name, &clnum);
G_INT(OFS_RETURN) = clnum;
return;
}
while((cl = SV_GetClientForString(name, &clnum)))
{
if (!matchnum)
{ //this is the one that matches
G_INT(OFS_RETURN) = clnum;
return;
}
matchnum--;
}
G_INT(OFS_RETURN) = 0; //world
}
BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"fixme", PF_Fixme, 0, 0, 0}, {"fixme", PF_Fixme, 0, 0, 0},
{"ignore", PF_Ignore, 0, 0, 0}, {"ignore", PF_Ignore, 0, 0, 0},
@ -9126,6 +9155,8 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"isbackbuffered", PF_isbackbuffered, 0, 0, 0, 234}, {"isbackbuffered", PF_isbackbuffered, 0, 0, 0, 234},
{"te_bloodqw", PF_te_bloodqw, 0, 0, 0, 239}, {"te_bloodqw", PF_te_bloodqw, 0, 0, 0, 239},
{"matchclientname", PF_matchclient, 0, 0, 0, 241},
//end fte extras //end fte extras
//DP extras //DP extras