X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fchat.qc;h=972848260dcc94ab74d4c5fafa735517782d2625;hb=b315da9882695b2add6461b55ffa3621161c717d;hp=5f309d0b0224bd4c019f9f4d51b29a9f851368a9;hpb=04eab4332c011c1bb8cde236055daf8b6bcd311c;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hud/panel/chat.qc b/qcsrc/client/hud/panel/chat.qc index 5f309d0b0..972848260 100644 --- a/qcsrc/client/hud/panel/chat.qc +++ b/qcsrc/client/hud/panel/chat.qc @@ -1,11 +1,14 @@ #include "chat.qh" -#include -#include -#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) @@ -71,11 +74,19 @@ void HUD_Chat() if (!autocvar_con_chatrect) cvar_set("con_chatrect", "1"); - cvar_set("con_chatrect_x", ftos(pos.x/vid_conwidth)); - cvar_set("con_chatrect_y", ftos(pos.y/vid_conheight)); - - cvar_set("con_chatwidth", ftos(mySize.x/vid_conwidth)); - cvar_set("con_chat", ftos(floor(mySize.y/autocvar_con_chatsize - 0.5))); + // can't use a name ending with _x, _y and _z for a float autocvar as for autocvar specs + // it prevents ambiguity with component names of vector autocvars + if (cvar_string("con_chatrect_x") != ftos(pos.x / vid_conwidth)) + cvar_set("con_chatrect_x", ftos(pos.x / vid_conwidth)); + if (cvar_string("con_chatrect_y") != ftos(pos.y / vid_conheight)) + cvar_set("con_chatrect_y", ftos(pos.y / vid_conheight)); + // can't use direct comparison here, it would always returns true even if + // both arguments are equal because con_chatwidth is saved with cvar_set + //if (autocvar_con_chatwidth != mySize.x / vid_conwidth) + if (fabs(autocvar_con_chatwidth - mySize.x / vid_conwidth) > 0.00001) + cvar_set("con_chatwidth", ftos(mySize.x / vid_conwidth)); + if (autocvar_con_chat != floor(mySize.y / autocvar_con_chatsize - 0.5)) + cvar_set("con_chat", ftos(floor(mySize.y / autocvar_con_chatsize - 0.5))); if(autocvar__hud_configure) {