drawpic_aspect_skin(pos + eX * keysize.x * 2, ((pressedkeys & KEY_RIGHT) ? "key_right_inv.tga" : "key_right.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
}
+entity chatlines;
+STATIC_INIT(chatlines) { chatlines = LL_NEW(); }
+CLASS(ChatEntry, Object)
+ ATTRIB(ChatEntry, m_text, string, string_null)
+ENDCLASS(ChatEntry)
+
// Handle chat as a panel (#12)
//
void HUD_Chat(void)
cvar_set("con_chatwidth", ftos(mySize.x/vid_conwidth));
cvar_set("con_chat", ftos(floor(mySize.y/autocvar_con_chatsize - 0.5)));
+ vector chatsize = '1 1 0' * autocvar_con_chatsize;
+
+ int n = 0;
+ int oldy = pos.y;
+ LL_EACH(chatlines, true, LAMBDA(
+ float a = 1;
+ string s = textShortenToWidth(it.m_text, mySize.x, chatsize, stringwidth_colors);
+ drawcolorcodedstring(pos, s, chatsize, a, DRAWFLAG_NORMAL);
+ pos.y += chatsize.y;
+ n = i;
+ ));
+ drawcolorcodedstring(pos, ftos(n), chatsize, 1, DRAWFLAG_NORMAL);
+ pos.y = oldy;
+
if(autocvar__hud_configure)
{
- vector chatsize;
- chatsize = '1 1 0' * autocvar_con_chatsize;
cvar_set("con_chatrect_x", "9001"); // over 9000, we'll fake it instead for more control over theAlpha and such
- float i, a;
- for(i = 0; i < autocvar_con_chat; ++i)
+ for(int i = 0; i < autocvar_con_chat; ++i)
{
+ float a;
if(i == autocvar_con_chat - 1)
a = panel_fg_alpha;
else
if(autocvar_developer_csqcentities)
LOG_INFOF("CSQC_Parse_Print(\"%s\")\n", strMessage);
- print(ColorTranslateRGB(strMessage));
+ for (int i = 0, n = tokenizebyseparator(strMessage, "\n"); i < n; ++i)
+ {
+ string s = ColorTranslateRGB(argv(i));
+ int c = str2chr(s, 0);
+ if (c == 1 || c == 3) {
+ s = substring(s, 1, -1);
+ if (c == 1) {
+ entity snd;
+ if (str2chr(s, 0) == '\r') {
+ s = substring(s, 1, -1);
+ snd = SND_TALK2;
+ } else {
+ snd = SND_TALK;
+ }
+ sound(self, CH_INFO, snd, VOL_BASE, ATTEN_NONE);
+ }
+ s = strcat("^3", s);
+ ChatEntry e = NEW(ChatEntry);
+ e.m_text = strzone(s);
+ LL_PUSH(chatlines, e);
+ print(s, "\n");
+ } else {
+ s = strcat("^7", s);
+ print(s, "\n");
+ }
+ }
}
// CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.