mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-01 20:30:57 +00:00
cl_parsesay --- parse $\ (fake); $[, $]; $R $G $B $Y (ocrana leds);
Note that this cvar is different from QWF's cl_parsesay. cl_nofake --- unhide fake messages from other players
This commit is contained in:
parent
03846c9bec
commit
66a91044bb
4 changed files with 86 additions and 4 deletions
|
@ -30,7 +30,10 @@
|
|||
|
||||
extern cvar_t *cl_deadbodyfilter;
|
||||
extern cvar_t *cl_gibfilter;
|
||||
extern cvar_t *cl_parsesay;
|
||||
extern cvar_t *cl_nofake;
|
||||
|
||||
// FIXME: prefix these with TP_ or Team_ ?
|
||||
void CL_InitTeamplay (void);
|
||||
void CL_BestWeaponImpulse (void);
|
||||
char *CL_ParseSay (char *);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "console.h"
|
||||
#include "cmd.h"
|
||||
#include "msg.h"
|
||||
#include "teamplay.h"
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
|
@ -59,11 +60,31 @@ void Cmd_ForwardToServer (void)
|
|||
if (cls.demoplayback)
|
||||
return; // not really connected
|
||||
|
||||
|
||||
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
||||
SZ_Print (&cls.netchan.message, Cmd_Argv(0));
|
||||
if (Cmd_Argc() > 1)
|
||||
{
|
||||
SZ_Print (&cls.netchan.message, " ");
|
||||
|
||||
if (!strcasecmp(Cmd_Argv(0), "say") ||
|
||||
!strcasecmp(Cmd_Argv(0), "say_team"))
|
||||
{
|
||||
char *s;
|
||||
s = CL_ParseSay(Cmd_Args());
|
||||
if (*s && *s < 32 && *s != 10)
|
||||
{
|
||||
// otherwise the server would eat leading characters
|
||||
// less than 32 or greater than 127
|
||||
SZ_Print (&cls.netchan.message, "\"");
|
||||
SZ_Print (&cls.netchan.message, s);
|
||||
SZ_Print (&cls.netchan.message, "\"");
|
||||
}
|
||||
else
|
||||
SZ_Print (&cls.netchan.message, s);
|
||||
return;
|
||||
}
|
||||
|
||||
SZ_Print (&cls.netchan.message, Cmd_Args());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "msg.h"
|
||||
#include "pmove.h"
|
||||
#include "sbar.h"
|
||||
#include "teamplay.h"
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
@ -1175,12 +1176,20 @@ void CL_ParseServerMessage (void)
|
|||
|
||||
case svc_print:
|
||||
i = MSG_ReadByte ();
|
||||
s = MSG_ReadString ();
|
||||
if (i == PRINT_CHAT)
|
||||
{
|
||||
S_LocalSound ("misc/talk.wav");
|
||||
// TODO: cl_nofake 2 -- accept fake messages from teammates
|
||||
char *p;
|
||||
if (cl_nofake->value) {
|
||||
for (p = s; *p; p++)
|
||||
if (*p == 13)
|
||||
*p = '#';
|
||||
}
|
||||
con_ormask = 128;
|
||||
S_LocalSound ("misc/talk.wav");
|
||||
}
|
||||
Con_Printf ("%s", MSG_ReadString ());
|
||||
Con_Printf ("%s", s);
|
||||
con_ormask = 0;
|
||||
break;
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
cvar_t *cl_deadbodyfilter;
|
||||
cvar_t *cl_gibfilter;
|
||||
cvar_t *cl_parsesay;
|
||||
cvar_t *cl_nofake;
|
||||
|
||||
|
||||
void CL_BestWeaponImpulse (void)
|
||||
|
@ -92,8 +94,55 @@ void CL_BestWeaponImpulse (void)
|
|||
}
|
||||
|
||||
|
||||
char *CL_ParseSay (char *s)
|
||||
{
|
||||
static char buf[1024];
|
||||
int i;
|
||||
char c;
|
||||
|
||||
if (!cl_parsesay->value)
|
||||
return s;
|
||||
|
||||
i = 0;
|
||||
|
||||
while (*s && i < sizeof(buf)-1)
|
||||
{
|
||||
if (*s == '$')
|
||||
{
|
||||
c = 0;
|
||||
switch (s[1])
|
||||
{
|
||||
case '\\': c = 13; break; // fake message
|
||||
case '[': c = 0x90; break; // colored brackets
|
||||
case ']': c = 0x91; break;
|
||||
case 'G': c = 0x86; break; // ocrana leds
|
||||
case 'R': c = 0x87; break;
|
||||
case 'Y': c = 0x88; break;
|
||||
case 'B': c = 0x89; break;
|
||||
}
|
||||
|
||||
if (c)
|
||||
{
|
||||
buf[i++] = c;
|
||||
s += 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: parse team messages (%l, %a, %h, etc)
|
||||
|
||||
buf[i++] = *s++;
|
||||
}
|
||||
buf[i] = 0;
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
void CL_InitTeamplay (void)
|
||||
{
|
||||
cl_deadbodyfilter = Cvar_Get("cl_deadbodyfilter", "0", CVAR_NONE, "None");
|
||||
cl_gibfilter = Cvar_Get("cl_gibfilter", "0", CVAR_NONE, "None");
|
||||
cl_deadbodyfilter = Cvar_Get("cl_deadbodyfilter", "0", CVAR_NONE, "Hide dead player models");
|
||||
cl_gibfilter = Cvar_Get("cl_gibfilter", "0", CVAR_NONE, "Hide gibs");
|
||||
cl_parsesay = Cvar_Get("cl_parsesay", "0", CVAR_NONE, "None");
|
||||
cl_nofake = Cvar_Get("cl_nofake", "0", CVAR_NONE, "Unhide fake messages");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue