From: TimePath Date: Wed, 28 Oct 2015 01:49:46 +0000 (+1100) Subject: It begins X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ecae359a1ceb7f1884262cbf5e5d45ec3dca8ad7;p=xonotic%2Fxonotic-data.pk3dir.git It begins --- diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 7403d2835..b1fa777a4 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -3688,6 +3688,12 @@ void HUD_PressedKeys(void) 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) @@ -3761,14 +3767,26 @@ 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 diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 0f84b7fd8..8062d8e75 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -950,7 +950,32 @@ void CSQC_Parse_Print(string strMessage) 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. diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 811e7007c..1eaba9694 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -1548,7 +1548,12 @@ void Local_Notification(int net_type, int net_name, ...count) case MSG_INFO: { - print( + #ifdef CSQC + void(string) echo = CSQC_Parse_Print; + #else + void(string, ...) echo = print; + #endif + echo( Local_Notification_sprintf( notif.nent_string, notif.nent_args, diff --git a/qcsrc/common/sounds/all.inc b/qcsrc/common/sounds/all.inc index 8a7dbbca3..a18aff55e 100644 --- a/qcsrc/common/sounds/all.inc +++ b/qcsrc/common/sounds/all.inc @@ -269,6 +269,7 @@ SOUND(TYPEHIT, "misc/typehit.wav"); SOUND(SPAWN, "misc/spawn.ogg"); SOUND(TALK, "misc/talk.wav"); +SOUND(TALK2, "misc/talk2.wav"); SOUND(TELEPORT, "misc/teleport.ogg");