if ( active_minigame.minigame_flags & C4_TURN_WIN )
{
vector winfs = hud_fontsize*2;
- string playername = "";
+ string pname = "";
FOREACH_MINIGAME_ENTITY(e)
if ( e.classname == "minigame_player" &&
e.team == (active_minigame.minigame_flags & C4_TURN_TEAM) )
- playername = entcs_GetName(e.minigame_playerslot-1);
+ pname = entcs_GetName(e.minigame_playerslot-1);
vector win_pos = pos+eY*(mySize_y-winfs_y)/2;
vector win_sz;
win_sz = minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
- sprintf("%s^7 won the game!",playername),
+ sprintf("%s^7 won the game!",pname),
winfs, 0, DRAWFLAG_NORMAL, 0.5);
drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE);
minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
- sprintf("%s^7 won the game!",playername),
+ sprintf("%s^7 won the game!",pname),
winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5);
}
}
if ( active_minigame.minigame_flags & NMM_TURN_WIN )
{
vector winfs = hud_fontsize*2;
- string playername = "";
+ string pname = "";
FOREACH_MINIGAME_ENTITY(e)
if ( e.classname == "minigame_player" &&
e.team == (active_minigame.minigame_flags & NMM_TURN_TEAM) )
- playername = entcs_GetName(e.minigame_playerslot-1);
+ pname = entcs_GetName(e.minigame_playerslot-1);
vector win_pos = pos+eY*(mySize_y-winfs_y)/2;
vector win_sz;
win_sz = minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
- sprintf("%s^7 won the game!",playername),
+ sprintf("%s^7 won the game!",pname),
winfs, 0, DRAWFLAG_NORMAL, 0.5);
drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE);
minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
- sprintf("%s^7 won the game!",playername),
+ sprintf("%s^7 won the game!",pname),
winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5);
}
}
if ( active_minigame.minigame_flags & PP_TURN_WIN )
{
vector winfs = hud_fontsize*2;
- string playername = "";
+ string pname = "";
FOREACH_MINIGAME_ENTITY(e)
if ( e.classname == "minigame_player" &&
e.team == (active_minigame.minigame_flags & PP_TURN_TEAM) )
- playername = entcs_GetName(e.minigame_playerslot-1);
+ pname = entcs_GetName(e.minigame_playerslot-1);
vector win_pos = pos+eY*(mySize_y-winfs_y)/2;
vector win_sz;
win_sz = minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
- sprintf("%s^7 won the game!",playername),
+ sprintf("%s^7 won the game!",pname),
winfs, 0, DRAWFLAG_NORMAL, 0.5);
drawfill(win_pos-eY*hud_fontsize_y,win_sz+2*eY*hud_fontsize_y,'1 1 1',0.5,DRAWFLAG_ADDITIVE);
minigame_drawcolorcodedstring_wrapped(mySize_x,win_pos,
- sprintf("%s^7 won the game!",playername),
+ sprintf("%s^7 won the game!",pname),
winfs, panel_fg_alpha, DRAWFLAG_NORMAL, 0.5);
}
}
}
// decolorizes and team colors the player name when needed
-string playername(entity p)
+string playername(entity p, bool team_colorize)
{
string t;
- if (teamplay && !intermission_running && IS_PLAYER(p))
+ if (team_colorize && teamplay && !intermission_running && IS_PLAYER(p))
{
t = Team_ColorCode(p.team);
return strcat(t, strdecolorize(p.netname));
}
else
- return p.netname;
+ return ColorTranslateRGB(p.netname);
}
float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done?
void play2(entity e, string filename);
-string playername(entity p);
+string playername(entity p, bool team_colorize);
void precache();
string namestr = "";
if (source)
- namestr = autocvar_g_chat_teamcolors ? playername(source) : source.netname;
+ namestr = playername(source, autocvar_g_chat_teamcolors);
string colorprefix = (strdecolorize(namestr) == namestr) ? "^3" : "^7";
msgstr = strcat(msgstr, msgin);
cmsgstr = strcat(colorstr, colorprefix, namestr, "^3 tells you:\n^7", msgin);
if(autocvar_g_chat_teamcolors)
- privatemsgprefix = strcat("\{1}\{13}* ^3You tell ", playername(privatesay), ": ^7");
+ privatemsgprefix = strcat("\{1}\{13}* ^3You tell ", playername(privatesay, true), ": ^7");
else
privatemsgprefix = strcat("\{1}\{13}* ^3You tell ", privatesay.netname, ": ^7");
}
}
if(flood)
- LOG_INFO("NOTE: ", playername(source), "^7 is flooding.\n");
+ LOG_INFO("NOTE: ", playername(source, true), "^7 is flooding.\n");
// build sourcemsgstr by cutting off a prefix and replacing it by the other one
if(privatesay)
if (source) {
sprint(source, sourcemsgstr);
dedicated_print(msgstr); // send to server console too
- MX_Say(strcat(playername(source), "^7: ", msgin));
+ MX_Say(strcat(playername(source, true), "^7: ", msgin));
}
FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != source && !MUTATOR_CALLHOOK(ChatMessageTo, it, source), sprint(it, msgstr));
}