X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fchat.qc;h=d46aa81b8269a29960a4b6a5b475b3fc44d4b6b4;hp=02df4ed6290f1af6398b64e8b016cc699dd1b218;hb=7069dc3f41678554d089db582ccf16da1f8874a5;hpb=935976d2b23b527a6dda9f8309972f0334bfc829 diff --git a/qcsrc/client/hud/panel/chat.qc b/qcsrc/client/hud/panel/chat.qc index 02df4ed62..d46aa81b8 100644 --- a/qcsrc/client/hud/panel/chat.qc +++ b/qcsrc/client/hud/panel/chat.qc @@ -1,4 +1,15 @@ -/** Handle chat as a panel (#12) */ +#include "chat.qh" + +#include +#include + +// Chat (#12) + +void HUD_Chat_Export(int fh) +{ + // allow saving cvars that aesthetically change the panel into hud skin files +} + void HUD_Chat() { if(!autocvar__hud_configure) @@ -20,7 +31,7 @@ void HUD_Chat() } } - HUD_Panel_UpdateCvars(); + HUD_Panel_LoadCvars(); if(intermission == 2) { @@ -41,19 +52,19 @@ void HUD_Chat() panel_bg = strcat(hud_skin_path, "/border_default"); if(precache_pic(panel_bg) == "") panel_bg = "gfx/hud/default/border_default"; - if(panel.current_panel_bg) - strunzone(panel.current_panel_bg); - panel.current_panel_bg = strzone(panel_bg); + strcpy(panel.current_panel_bg, panel_bg); chat_panel_modified = true; } - panel_bg_alpha = max(0.75, panel_bg_alpha); // force an theAlpha of at least 0.75 + panel_bg_alpha = max(0.75, panel_bg_alpha); } vector pos, mySize; pos = panel_pos; mySize = panel_size; - HUD_Panel_DrawBg(1); + // chat messages don't scale properly since they are displayed directly by the engine + HUD_Scale_Disable(); + HUD_Panel_DrawBg(); if(panel_bg_padding) { @@ -72,17 +83,13 @@ void HUD_Chat() 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) + vector chatsize = '1 1 0' * autocvar_con_chatsize; + cvar_set("con_chatrect_x", "9001"); // over 9000, we'll fake it instead for more control over alpha and such + string str = textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors); + for(int i = 0; i < autocvar_con_chat; ++i) { - if(i == autocvar_con_chat - 1) - a = panel_fg_alpha; - else - a = panel_fg_alpha * floor(((i + 1) * 7 + autocvar_con_chattime)/45); - drawcolorcodedstring(pos, textShortenToWidth(_("^3Player^7: This is the chat area."), mySize.x, chatsize, stringwidth_colors), chatsize, a, DRAWFLAG_NORMAL); + // engine displays chat text at full alpha + drawcolorcodedstring(pos, str, chatsize, 1, DRAWFLAG_NORMAL); pos.y += chatsize.y; } }