1
0
Fork 0
forked from fte/fteqw

playing with teamplay code and plugins

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@265 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2004-09-30 22:42:34 +00:00
parent 9cf99374db
commit b08fe6561b
3 changed files with 107 additions and 65 deletions

View file

@ -98,6 +98,8 @@ cvar_t bottomcolor = {"bottomcolor", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t rate = {"rate", "2500", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t rate = {"rate", "2500", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t noaim = {"noaim", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t noaim = {"noaim", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t msg = {"msg", "1", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; cvar_t msg = {"msg", "1", NULL, CVAR_ARCHIVE | CVAR_USERINFO};
cvar_t cl_nofake = {"cl_nofake", "2"};
cvar_t cl_chatsound = {"cl_chatsound", "1"};
cvar_t cl_item_bobbing = {"cl_model_bobbing", "0"}; cvar_t cl_item_bobbing = {"cl_model_bobbing", "0"};
@ -2037,6 +2039,9 @@ void CL_Init (void)
Cvar_Register (&msg, cl_controlgroup); Cvar_Register (&msg, cl_controlgroup);
Cvar_Register (&noaim, cl_controlgroup); Cvar_Register (&noaim, cl_controlgroup);
Cvar_Register (&cl_nofake, cl_controlgroup);
Cvar_Register (&cl_chatsound, cl_controlgroup);
Cvar_Register (&requiredownloads, cl_controlgroup); Cvar_Register (&requiredownloads, cl_controlgroup);
Cvar_Register (&cl_standardchat, cl_controlgroup); Cvar_Register (&cl_standardchat, cl_controlgroup);
Cvar_Register (&cl_nopext, cl_controlgroup); Cvar_Register (&cl_nopext, cl_controlgroup);
@ -2349,7 +2354,9 @@ void Host_Frame (float time)
POP3_Think(); POP3_Think();
#endif #endif
#ifdef PLUGINS
Plug_Tick(); Plug_Tick();
#endif
// decide the simulation time // decide the simulation time
realtime += time; realtime += time;
@ -2384,11 +2391,9 @@ void Host_Frame (float time)
return; // framerate is too high return; // framerate is too high
*/ */
if (!CL_FilterTime(realtime - oldrealtime))
{
Mod_Think(); Mod_Think();
if (!CL_FilterTime(realtime - oldrealtime))
return; return;
}
host_frametime = realtime - oldrealtime; host_frametime = realtime - oldrealtime;
oldrealtime = realtime; oldrealtime = realtime;
@ -2640,6 +2645,10 @@ void Host_Init (quakeparms_t *parms)
UI_Init(); UI_Init();
#ifdef PLUGINS
Plug_Init();
#endif
Con_TPrintf (TL_NL); Con_TPrintf (TL_NL);
#ifdef VERSION3PART #ifdef VERSION3PART
@ -2661,8 +2670,6 @@ Con_TPrintf (TL_NL);
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. "
"\n" "\n"
"See the GNU General Public License for more details.\n"); "See the GNU General Public License for more details.\n");
Plug_Init();
} }

View file

@ -2429,19 +2429,6 @@ void CL_SetStat (int pnum, int stat, int value)
if ( (value & (1<<j)) && !(cl.stats[pnum][stat] & (1<<j))) if ( (value & (1<<j)) && !(cl.stats[pnum][stat] & (1<<j)))
cl.item_gettime[pnum][j] = cl.time; cl.item_gettime[pnum][j] = cl.time;
} }
if (stat == STAT_HEALTH && cl.stats[pnum][stat] != value)
{
if (value <= 0 && cl.stats[pnum][stat] > 0)
{
if (Cmd_AliasExist("f_death", RESTRICT_LOCAL))
Cbuf_AddText("f_death\n", RESTRICT_LOCAL);
}
if (value > 0 && cl.stats[pnum][stat] <= 0)
{
if (Cmd_AliasExist("f_spawn", RESTRICT_LOCAL))
Cbuf_AddText("f_spawn\n", RESTRICT_LOCAL);
}
}
if (stat == STAT_VIEWHEIGHT && cls.z_ext & Z_EXT_VIEWHEIGHT) if (stat == STAT_VIEWHEIGHT && cls.z_ext & Z_EXT_VIEWHEIGHT)
cl.viewheight[pnum] = value; cl.viewheight[pnum] = value;
@ -2454,6 +2441,9 @@ void CL_SetStat (int pnum, int stat, int value)
} }
cl.stats[pnum][stat] = value; cl.stats[pnum][stat] = value;
if (pnum == 0)
TP_StatChanged(stat, value);
} }
/* /*
@ -3098,15 +3088,12 @@ void CLQ2_ParseMuzzleFlash2 (void)
int getplayerid(char *msg); int getplayerid(char *msg);
int build_number( void ); int build_number( void );
//return if we want to print the message.
qboolean CL_ParseChat(char *text) qboolean CL_ParseChat(char *text)
{ {
extern cvar_t cl_chatsound, cl_nofake;
char *s; char *s;
qboolean sameteam;
int fromid;
static float versionresponsetime;
static float modifiedresponsetime;
static float skinsresponsetime;
static float serverresponsetime;
s = strchr(text, ':'); //Hmm.. FIXME: Can a player's name contain a ':'?... I think the answer is a yes... Hmmm.. problematic eh? s = strchr(text, ':'); //Hmm.. FIXME: Can a player's name contain a ':'?... I think the answer is a yes... Hmmm.. problematic eh?
if (!s || s[1] != ' ') //wasn't a real chat... if (!s || s[1] != ' ') //wasn't a real chat...
return true; return true;
@ -3114,6 +3101,13 @@ qboolean CL_ParseChat(char *text)
Sys_ServerActivity(); //chat always flashes the screen.. Sys_ServerActivity(); //chat always flashes the screen..
//check f_ stuff //check f_ stuff
if (!strncmp(s+2, "f_", 2))
{
static float versionresponsetime;
static float modifiedresponsetime;
static float skinsresponsetime;
static float serverresponsetime;
if (!strncmp(s+2, "f_version", 9) && versionresponsetime < Sys_DoubleTime()) //respond to it. if (!strncmp(s+2, "f_version", 9) && versionresponsetime < Sys_DoubleTime()) //respond to it.
{ {
ValidationPrintVersion(text); ValidationPrintVersion(text);
@ -3134,34 +3128,57 @@ qboolean CL_ParseChat(char *text)
Validation_Skins(); Validation_Skins();
skinsresponsetime = Sys_DoubleTime() + 5; skinsresponsetime = Sys_DoubleTime() + 5;
} }
if (!strncmp(s+2, "f_", 2)) //stop now. No parsing of 'f_' commands. None at all. Nope. Don't even try it.
return true; return true;
}
Validation_CheckIfResponse(text); Validation_CheckIfResponse(text);
fromid = getplayerid(text);
if (!stricmp(Info_ValueForKey(cl.players[fromid].userinfo, "team"), Info_ValueForKey(cls.userinfo, "team")))
sameteam = true;
else
sameteam = false;
if (Cmd_FilterMessage(text, sameteam))
{
int flags;
int offset=0;
qboolean suppress_talksound;
char *p;
flags = TP_CategorizeMessage (s, &offset);
if (flags == 2 && !TP_FilterMessage(s + offset))
return false; return false;
if (sameteam)
Cmd_MessageTrigger(s, 0);
suppress_talksound = false;
if (flags == 2)
suppress_talksound = TP_CheckSoundTrigger (s + offset);
if (!cl_chatsound.value || // no sound at all
(cl_chatsound.value == 2 && flags != 2)) // only play sound in mm2
suppress_talksound = true;
if (!suppress_talksound)
S_LocalSound ("misc/talk.wav");
if (cl_nofake.value == 1 || (cl_nofake.value == 2 && flags != 2)) {
for (p = s; *p; p++)
if (*p == 13 || (*p == 10 && p[1]))
*p = ' ';
}
}
return true; return true;
} }
char printtext[1024]; char printtext[1024];
void CL_ParsePrint(char *msg) void CL_ParsePrint(char *msg, int level)
{ {
strncat(printtext, msg, sizeof(printtext)-1); strncat(printtext, msg, sizeof(printtext)-1);
while((msg = strchr(printtext, '\n'))) while((msg = strchr(printtext, '\n')))
{ {
*msg = '\0'; *msg = '\0';
if (level != PRINT_CHAT)
Stats_ParsePrintLine(printtext); Stats_ParsePrintLine(printtext);
TP_SearchForMsgTriggers(msg, level);
msg++; msg++;
memmove(printtext, msg, strlen(msg)+1); memmove(printtext, msg, strlen(msg)+1);
@ -3319,8 +3336,8 @@ void CL_ParseServerMessage (void)
{ {
if (CL_ParseChat(s)) if (CL_ParseChat(s))
{ {
if (!TP_SoundTrigger(s)) CL_ParsePrint(s, i);
S_LocalSound ("misc/talk.wav");
if (!cl_standardchat.value) if (!cl_standardchat.value)
Con_TPrintf (TL_CSPECIALPRINT, getplayerchatcolour(s)%6+'1', s); //don't ever print it in white. Con_TPrintf (TL_CSPECIALPRINT, getplayerchatcolour(s)%6+'1', s); //don't ever print it in white.
else else
@ -3333,7 +3350,7 @@ void CL_ParseServerMessage (void)
} }
else else
{ {
CL_ParsePrint(s); CL_ParsePrint(s, i);
Con_TPrintf (TL_ST, Translate(s)); Con_TPrintf (TL_ST, Translate(s));
} }
break; break;
@ -3755,12 +3772,15 @@ void CLQ2_ParseServerMessage (void)
{ {
S_LocalSound ("misc/talk.wav"); S_LocalSound ("misc/talk.wav");
con_ormask = 0x8000; con_ormask = 0x8000;
CL_ParseChat(s); if (CL_ParseChat(s))
{
CL_ParsePrint(s, i);
Con_TPrintf (TL_CSPECIALPRINT, getplayerchatcolour(s)%6+'1', s); Con_TPrintf (TL_CSPECIALPRINT, getplayerchatcolour(s)%6+'1', s);
} }
}
else else
{ {
CL_ParsePrint(s); CL_ParsePrint(s, i);
Con_TPrintf (TL_ST, Translate(s)); Con_TPrintf (TL_ST, Translate(s));
} }
con_ormask = 0; con_ormask = 0;
@ -3876,8 +3896,19 @@ void CLNQ_ParseServerMessage (void)
case svc_print: case svc_print:
s = MSG_ReadString (); s = MSG_ReadString ();
CL_ParsePrint(s); if (*s == 1 || *s == 2)
{
if (CL_ParseChat(s+1))
{
CL_ParsePrint(s+1, 3);
Con_TPrintf (TL_ST, Translate(s)); Con_TPrintf (TL_ST, Translate(s));
}
}
else
{
CL_ParsePrint(s, 3);
Con_TPrintf (TL_ST, Translate(s));
}
con_ormask = 0; con_ormask = 0;
break; break;

View file

@ -909,10 +909,11 @@ void M_Draw (int uimenu)
case m_complex: case m_complex:
M_Complex_Draw (); M_Complex_Draw ();
break; break;
#ifdef PLUGINS
case m_plugin: case m_plugin:
Plug_Menu_Event (0, (int)(realtime*1000)); Plug_Menu_Event (0, (int)(realtime*1000));
break; break;
#endif
} }
if (m_entersound) if (m_entersound)
@ -958,10 +959,11 @@ void M_Keydown (int key)
case m_complex: case m_complex:
M_Complex_Key (key); M_Complex_Key (key);
return; return;
#ifdef PLUGINS
case m_plugin: case m_plugin:
Plug_Menu_Event (1, key); Plug_Menu_Event (1, key);
return; return;
#endif
} }
} }
@ -973,9 +975,11 @@ void M_Keyup (int key)
case m_xwindows: case m_xwindows:
XWindows_Keyup(key); XWindows_Keyup(key);
return; return;
#ifdef PLUGINS
case m_plugin: case m_plugin:
Plug_Menu_Event (2, key); Plug_Menu_Event (2, key);
return; return;
#endif
default: default:
break; break;
} }