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
#define E5_FRAME16 (1<<21)
// unused
#define E5_UNUSED22 (1<<22)
#define E5_COLORMOD (1<<22)
// bits >= (1<<24)
#define E5_EXTEND3 (1<<23)
@ -783,6 +783,8 @@ entity_state_t *CL_FindOldPacketEntity(int num)
// bits2 > 0
#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;
void DP5_ParseDelta(entity_state_t *s)
{
@ -798,6 +800,12 @@ void DP5_ParseDelta(entity_state_t *s)
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)
{
int num;
@ -885,24 +893,24 @@ void DP5_ParseDelta(entity_state_t *s)
}
if (bits & E5_LIGHT)
{
MSG_ReadShort();
MSG_ReadShort();
MSG_ReadShort();
MSG_ReadShort();
MSG_ReadByte();
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();
s->light[0] = MSG_ReadShort();
s->light[1] = MSG_ReadShort();
s->light[2] = MSG_ReadShort();
s->light[3] = MSG_ReadShort();
s->lightstyle = MSG_ReadByte();
s->lightpflags = MSG_ReadByte();
}
if (bits & E5_GLOW)
{
s->glowsize = MSG_ReadByte();
s->glowcolour = MSG_ReadByte();
}
if (bits & E5_COLORMOD)
{
MSG_ReadByte();
MSG_ReadByte();
MSG_ReadByte();
}
}
int cl_latestframenum;

View file

@ -155,13 +155,14 @@ char *svc_nqstrings[] =
"nqsvc_finale", // [string] music [string] text
"nqsvc_cdtrack", // [qbyte] track [qbyte] looptrack
"nqsvc_sellscreen",
"nqsvc_cutscene",
"nqsvc_cutscene", //34
"NEW PROTOCOL",
"NEW PROTOCOL",
"NEW PROTOCOL",
"NEW PROTOCOL",
"NEW PROTOCOL",
"NEW PROTOCOL", //40
"NEW PROTOCOL",
"NEW PROTOCOL",
"NEW PROTOCOL",
@ -170,7 +171,17 @@ char *svc_nqstrings[] =
"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;
@ -1525,6 +1536,8 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
nq_dp_protocol = 5;
sizeofcoord = 4;
sizeofangle = 2;
Con_DPrintf("DP5 protocols\n");
}
else if (protover == DP6_PROTOCOL_VERSION)
{
@ -1534,6 +1547,8 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
sizeofangle = 2;
cls.z_ext = Z_EXT_VIEWHEIGHT;
Con_DPrintf("DP6 protocols\n");
}
else if (protover == DP7_PROTOCOL_VERSION)
{
@ -1543,11 +1558,17 @@ void CLNQ_ParseServerData(void) //Doesn't change gamedir - use with caution.
sizeofangle = 2;
cls.z_ext = Z_EXT_VIEWHEIGHT;
Con_DPrintf("DP7 protocols\n");
}
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);
}
else
{
Con_DPrintf("Standard NQ protocols\n");
}
if (MSG_ReadByte() > MAX_CLIENTS)
{
@ -1718,11 +1739,13 @@ Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
#define DEFAULT_VIEWHEIGHT 22
void CLNQ_ParseClientdata (int bits)
void CLNQ_ParseClientdata (void)
{
int i;
bits &= 0xffff;
unsigned int bits;
bits = MSG_ReadShort();
if (bits & DPSU_EXTEND1)
bits |= (MSG_ReadByte() << 16);
@ -4175,7 +4198,7 @@ void CLNQ_ParseServerMessage (void)
j = MSG_ReadLong ();
CL_SetStat (0, i, j);
break;
case 51://svc_updatestat:
case svcdp_updatestatbyte:
i = MSG_ReadByte ();
j = MSG_ReadByte ();
CL_SetStat (0, i, j);
@ -4187,8 +4210,7 @@ void CLNQ_ParseServerMessage (void)
break;
case svc_clientdata:
i = MSG_ReadShort ();
CLNQ_ParseClientdata (i);
CLNQ_ParseClientdata ();
break;
case svc_sound:

View file

@ -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?
//QW svcs
#define svc_smallkick 34 // set client punchangle to 2
#define svc_bigkick 35 // set client punchangle to 4
@ -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_setinfo 51 // setinfo on a client
#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 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 svcdp_spawnbaseline2 55
//FTE extended svcs
#ifdef PEXT_VIEW2
#define svc_view2 56
#endif
@ -206,8 +207,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svc_lightstylecol 57
#endif
#define svcdp_entities 57
#ifdef PEXT_BULLETENS
#define svc_bulletentext 58
#endif
@ -246,6 +245,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#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

View file

@ -5083,24 +5083,24 @@ void PF_infokey (progfuncs_t *prinst, struct globalvars_s *pr_globals)
}
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));
else if (!strcmp(key, "ping"))
{
int ping = SV_CalcPing (&svs.clients[e1-1]);
sprintf(ov, "%d", ping);
value = ov;
}
sprintf(ov, "%d", SV_CalcPing (&svs.clients[e1-1]));
else if (!strcmp(key, "*userid"))
sprintf(ov, "%d", svs.clients[e1-1].userid);
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.
{
rankstats_t rs;
if (!svs.clients[e1-1].rankid)
value = "";
else if (Rank_GetPlayerStats(svs.clients[e1-1].rankid, &rs))
{
sprintf(ov, "%d", rs.trustlevel);
value = ov;
}
else
value = "";
}
@ -6169,6 +6169,7 @@ lh_extension_t QSG_Extensions[] = {
#ifdef SVCHAT
{"FTE_NPCCHAT", 1, NULL, {"chat"}}, //server looks at chat files. It automagically branches through calling qc functions as requested.
#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)
//eperimental advanced strings functions.
@ -8820,6 +8821,34 @@ void PF_runclientphys(progfuncs_t *prinst, struct globalvars_s *pr_globals)
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
{"fixme", PF_Fixme, 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},
{"te_bloodqw", PF_te_bloodqw, 0, 0, 0, 239},
{"matchclientname", PF_matchclient, 0, 0, 0, 241},
//end fte extras
//DP extras