semifix to cl_standardmsg
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1475 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
f024485827
commit
278e33f99e
1 changed files with 29 additions and 1 deletions
|
@ -3332,11 +3332,13 @@ void CL_PrintChat(player_info_t *plr, char *rawmsg, char *msg, int plrflags)
|
||||||
|
|
||||||
// CL_PrintStandardMessage: takes non-chat net messages and performs name coloring
|
// CL_PrintStandardMessage: takes non-chat net messages and performs name coloring
|
||||||
// NOTE: msg is considered destroyable
|
// NOTE: msg is considered destroyable
|
||||||
|
char acceptedchars[] = {'.', '?', '!', '\'', ',', ':', ' ', '\0'};
|
||||||
void CL_PrintStandardMessage(char *msg)
|
void CL_PrintStandardMessage(char *msg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
player_info_t *p;
|
player_info_t *p;
|
||||||
extern cvar_t cl_standardmsg;
|
extern cvar_t cl_standardmsg;
|
||||||
|
char *begin = msg;
|
||||||
|
|
||||||
// search for player names in message
|
// search for player names in message
|
||||||
for (i = 0, p = cl.players; i < MAX_CLIENTS; p++, i++)
|
for (i = 0, p = cl.players; i < MAX_CLIENTS; p++, i++)
|
||||||
|
@ -3352,8 +3354,33 @@ void CL_PrintStandardMessage(char *msg)
|
||||||
name = Info_ValueForKey (p->userinfo, "name");
|
name = Info_ValueForKey (p->userinfo, "name");
|
||||||
len = strlen(name);
|
len = strlen(name);
|
||||||
v = strstr(msg, name);
|
v = strstr(msg, name);
|
||||||
if (v) // name found
|
while (v)
|
||||||
{
|
{
|
||||||
|
// name parsing rules
|
||||||
|
if (v != begin && *(v-1) != ' ') // must be space before name
|
||||||
|
{
|
||||||
|
v = strstr(NULL, name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char aftername = *(v + len);
|
||||||
|
|
||||||
|
// search for accepted chars in char after name in msg
|
||||||
|
for (i = 0; i < sizeof(acceptedchars); i++)
|
||||||
|
{
|
||||||
|
if (acceptedchars[i] == aftername)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeof(acceptedchars) == i)
|
||||||
|
{
|
||||||
|
v = strstr(NULL, name);
|
||||||
|
continue; // no accepted char found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*v = 0; // cut off message
|
*v = 0; // cut off message
|
||||||
con_ormask = 0;
|
con_ormask = 0;
|
||||||
// print msg chunk
|
// print msg chunk
|
||||||
|
@ -3372,6 +3399,7 @@ void CL_PrintStandardMessage(char *msg)
|
||||||
// print name
|
// print name
|
||||||
con_ormask = ormask;
|
con_ormask = ormask;
|
||||||
Con_Printf("^%c%s^7", c, name);
|
Con_Printf("^%c%s^7", c, name);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue