7 #include <common/campaign_common.qh>
8 #include <common/constants.qh>
9 #include <common/gamemodes/_mod.qh>
10 #include <common/util.qh>
11 #include <common/command/_mod.qh>
13 float GL_CheckExtension(string ext)
15 return strhasword(cvar_string("gl_info_extensions"), ext);
18 float GL_Have_TextureCompression()
20 return GL_CheckExtension("GL_EXT_texture_compression_s3tc");
23 .entity parent, firstChild, nextSibling;
24 void forAllDescendants(entity root, void(entity, entity) funcPre, void(entity, entity) funcPost, entity pass)
26 depthfirst(root, parent, firstChild, nextSibling, funcPre, funcPost, pass);
29 .string controlledCvar;
30 void SUB_Null_ee(entity e1, entity e2)
34 .void(entity) saveCvars;
35 void saveCvarsOf(entity ignore, entity e)
41 .void(entity) loadCvars;
42 void loadCvarsOf(entity ignore, entity e)
47 void saveAllCvars(entity root)
49 forAllDescendants(root, saveCvarsOf, SUB_Null_ee, NULL);
51 void loadAllCvars(entity root)
53 forAllDescendants(root, loadCvarsOf, SUB_Null_ee, NULL);
56 .string controlledCvars_Multi;
57 .void(entity me) saveCvars_Multi;
58 string getCvarsMulti(entity me)
60 if (me.controlledCvars_Multi)
61 return me.controlledCvars_Multi;
64 void saveCvarsMulti(entity me)
69 me.saveCvars_Multi(me);
70 s = cvar_string(me.controlledCvar);
72 n = tokenize_console(me.controlledCvars_Multi);
73 for(i = 0; i < n; ++i)
75 // cvars prefixed with ! get saved with the inverted value
76 if(substring(argv(i), 0, 1) == "!")
78 cvarname = substring(argv(i), 1, strlen(argv(i)));
79 cvar_set(cvarname, ((s == "0") ? "1" : "0"));
84 cvar_set(cvarname, s);
87 CheckSendCvars(me, cvarname);
90 void makeMulti(entity e, string otherCvars)
92 e.controlledCvars_Multi = otherCvars;
93 e.saveCvars_Multi = e.saveCvars;
94 e.saveCvars = saveCvarsMulti;
97 .void(entity me) saveCvars_Callback;
98 .entity saveCvars_Callback_ent;
99 .void(entity me, entity cb) saveCvars_Callback_func;
100 void saveCvarsCallback(entity me)
102 me.saveCvars_Callback(me);
103 me.saveCvars_Callback_func(me.saveCvars_Callback_ent, me);
105 void makeCallback(entity e, entity cbent, void(entity, entity) cbfunc)
107 e.saveCvars_Callback = e.saveCvars;
108 e.saveCvars = saveCvarsCallback;
109 e.saveCvars_Callback_ent = cbent;
110 e.saveCvars_Callback_func = cbfunc;
113 .void(entity) draw_setDependent;
114 .string cvar_setDependent;
115 .float cvarMin_setDependent;
116 .float cvarMax_setDependent;
117 .string cvar2_setDependent;
118 .float cvar2Min_setDependent;
119 .float cvar2Max_setDependent;
120 .string cvar3_setDependent;
121 .float cvar3Min_setDependent;
122 .float cvar3Max_setDependent;
123 .float op_setDependent;
124 .string cvarString_setDependent;
125 .string cvarValue_setDependent;
126 .float(entity) func_setDependent;
128 void setDependent_Check(entity e)
130 bool disabled_prev = e.disabled;
133 if(e.func_setDependent)
135 e.disabled = !(e.func_setDependent(e));
137 else if(e.cvarString_setDependent)
139 s = cvar_string(e.cvarString_setDependent);
140 e.disabled = (cvar_string(e.cvarString_setDependent) == e.cvarValue_setDependent);
144 if(e.cvar_setDependent)
146 f = cvar(e.cvar_setDependent);
147 if(e.cvarMin_setDependent <= e.cvarMax_setDependent)
148 e.disabled = ((f < e.cvarMin_setDependent) || (f > e.cvarMax_setDependent));
150 e.disabled = ((f >= e.cvarMax_setDependent) && (f <= e.cvarMin_setDependent));
152 if(e.cvar2_setDependent)
154 f = cvar(e.cvar2_setDependent);
155 if(e.cvar2Min_setDependent <= e.cvar2Max_setDependent)
156 e.disabled = (e.disabled + ((f < e.cvar2Min_setDependent) || (f > e.cvar2Max_setDependent)) > e.op_setDependent);
158 e.disabled = (e.disabled + ((f >= e.cvar2Max_setDependent) && (f <= e.cvar2Min_setDependent)) > e.op_setDependent);
160 if(e.cvar3_setDependent)
162 f = cvar(e.cvar3_setDependent);
163 if(e.cvar3Min_setDependent <= e.cvar3Max_setDependent)
164 e.disabled = (e.disabled + ((f < e.cvar3Min_setDependent) || (f > e.cvar3Max_setDependent)) > e.op_setDependent);
166 e.disabled = (e.disabled + ((f >= e.cvar3Max_setDependent) && (f <= e.cvar3Min_setDependent)) > e.op_setDependent);
169 if (disabled_prev != e.disabled && e.loadCvars)
172 void setDependent_Draw(entity e)
174 setDependent_Check(e);
175 e.draw_setDependent(e);
178 void setDependent(entity e, string theCvarName, float theCvarMin, float theCvarMax)
180 e.draw_setDependent = e.draw;
181 e.cvar_setDependent = theCvarName;
182 e.cvarMin_setDependent = theCvarMin;
183 e.cvarMax_setDependent = theCvarMax;
184 e.cvar2_setDependent = string_null;
185 e.cvar3_setDependent = string_null;
186 e.func_setDependent = func_null;
187 e.draw = setDependent_Draw;
188 setDependent_Check(e);
190 void setDependentStringNotEqual(entity e, string theCvarName, string theCvarValue)
192 e.draw_setDependent = e.draw;
193 e.cvarString_setDependent = theCvarName;
194 e.cvarValue_setDependent = theCvarValue;
195 e.cvar_setDependent = string_null;
196 e.cvar2_setDependent = string_null;
197 e.cvar3_setDependent = string_null;
198 e.func_setDependent = func_null;
199 e.draw = setDependent_Draw;
200 setDependent_Check(e);
202 void setDependentAND(entity e, string theCvarName, float theCvarMin, float theCvarMax, string theCvar2Name, float theCvar2Min, float theCvar2Max)
204 e.draw_setDependent = e.draw;
205 e.cvar_setDependent = theCvarName;
206 e.cvarMin_setDependent = theCvarMin;
207 e.cvarMax_setDependent = theCvarMax;
208 e.cvar2_setDependent = theCvar2Name;
209 e.cvar2Min_setDependent = theCvar2Min;
210 e.cvar2Max_setDependent = theCvar2Max;
211 e.cvar3_setDependent = string_null;
212 e.op_setDependent = 0;
213 e.func_setDependent = func_null;
214 e.draw = setDependent_Draw;
215 setDependent_Check(e);
217 void setDependentOR(entity e, string theCvarName, float theCvarMin, float theCvarMax, string theCvar2Name, float theCvar2Min, float theCvar2Max)
219 e.draw_setDependent = e.draw;
220 e.cvar_setDependent = theCvarName;
221 e.cvarMin_setDependent = theCvarMin;
222 e.cvarMax_setDependent = theCvarMax;
223 e.cvar2_setDependent = theCvar2Name;
224 e.cvar2Min_setDependent = theCvar2Min;
225 e.cvar2Max_setDependent = theCvar2Max;
226 e.cvar3_setDependent = string_null;
227 e.op_setDependent = 1;
228 e.func_setDependent = func_null;
229 e.draw = setDependent_Draw;
230 setDependent_Check(e);
232 void setDependentAND3(entity e, string theCvarName, float theCvarMin, float theCvarMax, string theCvar2Name, float theCvar2Min, float theCvar2Max, string theCvar3Name, float theCvar3Min, float theCvar3Max)
234 e.draw_setDependent = e.draw;
235 e.cvar_setDependent = theCvarName;
236 e.cvarMin_setDependent = theCvarMin;
237 e.cvarMax_setDependent = theCvarMax;
238 e.cvar2_setDependent = theCvar2Name;
239 e.cvar2Min_setDependent = theCvar2Min;
240 e.cvar2Max_setDependent = theCvar2Max;
241 e.cvar3_setDependent = theCvar3Name;
242 e.cvar3Min_setDependent = theCvar3Min;
243 e.cvar3Max_setDependent = theCvar3Max;
244 e.op_setDependent = 0;
245 e.func_setDependent = func_null;
246 e.draw = setDependent_Draw;
247 setDependent_Check(e);
249 void setDependentWeird(entity e, float(entity) func)
251 e.draw_setDependent = e.draw;
252 e.func_setDependent = func;
253 e.draw = setDependent_Draw;
254 setDependent_Check(e);
257 void setZonedTooltip(entity e, string theTooltip, string theCvar)
259 if(theTooltip == "") // no tooltip, use cvar description then
261 if(theCvar != "" && prvm_language == "en")
263 string t = cvar_description(theCvar);
264 if(t != "" && t != "custom cvar")
268 else if(theTooltip == "-") // no cvar description as tooltip
270 theTooltip = string_null;
274 e.tooltip = (theTooltip != "") ? strzone(theTooltip) : string_null;
277 void clearTooltip(entity e)
279 setZonedTooltip(e, string_null, string_null);
282 // URI SYSTEM ////////////////////////////////////////////////////////
284 float _Nex_ExtResponseSystem_Queried;
285 string _Nex_ExtResponseSystem_UpdateTo;
286 string _Nex_ExtResponseSystem_UpdateToURL;
287 string _Nex_ExtResponseSystem_Packs;
288 float _Nex_ExtResponseSystem_PacksStep;
290 /** engine callback */
291 void URI_Get_Callback(float id, float status, string data)
293 if(url_URI_Get_Callback(id, status, data))
297 else if (id == URI_GET_DISCARD)
301 else if (id >= URI_GET_CURL && id <= URI_GET_CURL_END)
304 Curl_URI_Get_Callback(id, status, data);
306 else if (id == URI_GET_UPDATENOTIFICATION)
308 UpdateNotification_URI_Get_Callback(id, status, data);
312 LOG_INFOF("Received HTTP request data for an invalid id %d.", id);
316 void DisableServerBackwardsCompatibility()
318 cvar_set("gameversion_min", ftos(100 * floor(cvar("gameversion") / 100)));
321 void UpdateNotification_URI_Get_Callback(float id, float status, string data)
325 if(_Nex_ExtResponseSystem_UpdateTo)
327 LOG_TRACE("error: UpdateNotification_URI_Get_Callback has been called before");
332 LOG_TRACEF("error receiving update notification: status is %d", status);
335 if(substring(data, 0, 1) == "<")
337 LOG_TRACE("error: received HTML instead of an update notification");
340 if(strstrofs(data, "\r", 0) != -1)
342 LOG_TRACE("error: received carriage returns from update notification server");
349 n = tokenizebyseparator(data, "\n");
354 string un_version = "";
355 string un_download = "";
357 string un_bannedservers = "";
358 string un_emergency_pk3s = "";
359 string un_promoted = "";
360 string un_recommended = "";
361 string un_compatexpire = "";
363 for(i = 0; i < n; ++i)
365 s = substring(argv(i), 2, -1);
366 if(s == "") { continue; } // ignore empty lines
368 switch(substring(argv(i), 0, 1))
392 APPEND_TO_STRING(un_bannedservers, " ", s);
397 if(cvar("menu_updatecheck_getpacks"))
398 APPEND_TO_STRING(un_emergency_pk3s, " ", s);
403 APPEND_TO_STRING(un_promoted, " ", s);
408 APPEND_TO_STRING(un_recommended, " ", s);
416 if(vercmp(cvar_string("g_xonoticversion"), un_version) < 0)
419 _Nex_ExtResponseSystem_UpdateTo = strzone(un_version);
420 if(un_download) { LOG_INFO(_("Update can be downloaded at:"), "\n", un_download); }
421 if(un_url) { _Nex_ExtResponseSystem_UpdateToURL = strzone(un_url); }
422 DisableServerBackwardsCompatibility();
424 else if(cvar_string("g_xonoticversion") == un_version)
426 if(un_compatexpire != "")
428 string curdate = strftime(false, "%Y%m%d%H%M%S");
429 if (strcmp(curdate, un_compatexpire) >= 0)
430 DisableServerBackwardsCompatibility();
435 if(un_bannedservers != "")
437 _Nex_ExtResponseSystem_BannedServers = strzone(un_bannedservers);
438 _Nex_ExtResponseSystem_BannedServersNeedsRefresh = 1;
441 if(un_emergency_pk3s != "")
443 _Nex_ExtResponseSystem_Packs = strzone(un_emergency_pk3s);
444 _Nex_ExtResponseSystem_PacksStep = 1;
447 if(un_promoted != "")
449 _Nex_ExtResponseSystem_PromotedServers = strzone(un_promoted);
450 _Nex_ExtResponseSystem_PromotedServersNeedsRefresh = 1;
453 if(un_recommended != "")
455 _Nex_ExtResponseSystem_RecommendedServers = strzone(un_recommended);
456 _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh = 1;
460 // END OF URI SYSTEM ////////////////////////////////////////////////////////
464 if(!_Nex_ExtResponseSystem_Queried)
466 _Nex_ExtResponseSystem_Queried = 1;
470 cvar_set("cl_startcount", ftos(startcnt = cvar("cl_startcount") + 1));
472 // for privacy, munge the start count a little
473 startcnt = floor((floor(startcnt / 10) + random()) * 10);
474 uri = sprintf("http://update.xonotic.org/checkupdate.txt?version=%s&cnt=%d", uri_escape(cvar_string("g_xonoticversion")), startcnt);
475 uri_get(uri, URI_GET_UPDATENOTIFICATION);
478 if(_Nex_ExtResponseSystem_PacksStep > 0)
482 n = tokenize_console(_Nex_ExtResponseSystem_Packs);
484 for(i = 0; i+1 < n; i += 2)
486 if(fexists(argv(i+1)))
489 if(_Nex_ExtResponseSystem_PacksStep == 1) // first run
490 localcmd("\ncurl --pak \"", argv(i), "\"\n");
494 if(_Nex_ExtResponseSystem_PacksStep == 2)
497 cvar_set("_menu_initialized", "0");
498 // HACK: cause m_hide call on next start
499 localcmd("\nmenu_restart\n");
501 _Nex_ExtResponseSystem_PacksStep = 0;
504 _Nex_ExtResponseSystem_PacksStep = 2;
509 bool show_propermenu = false;
517 show_propermenu = true;
521 MapInfo_Cache_Create();
523 if(!_MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 1))
525 draw_reset_cropped();
527 sz = eX * 0.025 + eY * 0.025 * (draw_scale.x / draw_scale.y);
528 draw_CenterText('0.5 0.5 0' - 1.25 * sz.y * eY, _("Autogenerating mapinfo for newly added maps..."), sz, '1 1 1', 1, 0);
530 boxA = '0.05 0.5 0' + 0.25 * sz.y * eY;
531 boxB = '0.95 0.5 0' + 1.25 * sz.y * eY;
532 draw_Fill(boxA, boxB - boxA, '1 1 1', 1);
536 draw_Fill(boxA, boxB - boxA, '0.1 0.1 0.1', 1);
538 boxB_x = boxA_x * (1 - MapInfo_progress) + boxB_x * MapInfo_progress;
539 draw_Fill(boxA, boxB - boxA, '0 0 1', 1);
546 string campaign_name_previous;
547 float campaign_won_previous;
548 void postMenuDraw() {}
549 void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize);
550 .entity winnerDialog;
553 vector fs, sz = '0 0 0', line, mid;
557 if(_Nex_ExtResponseSystem_UpdateTo != "" && !(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
559 // TODO rather turn this into a dialog
560 fs = ((1/draw_scale.x) * eX + (1/draw_scale.y) * eY) * 12;
564 l1 = sprintf("Jeff pay 4 new weapons for %s", _Nex_ExtResponseSystem_UpdateTo);
566 l1 = sprintf(_("Update to %s now!"), _Nex_ExtResponseSystem_UpdateTo);
567 l2 = "http://www.xonotic.org/";
568 if(_Nex_ExtResponseSystem_UpdateToURL)
569 l2 = _Nex_ExtResponseSystem_UpdateToURL;
571 sz_x = draw_TextWidth(" ", 0, fs) + max(
572 draw_TextWidth(l1, 0, fs),
573 draw_TextWidth(l2, 0, fs)
577 draw_alpha = bound(0, sin(time * 0.112 - 0.3) * 10, 1);
578 mid = eX * (0.5 + 0.5 * (1 - sz.x) * cos(time * 0.071))
579 + eY * (0.5 + 0.5 * (1 - sz.y) * sin(time * 0.071));
581 draw_Fill(mid - 0.5 * sz, sz, '1 1 0', 1);
582 draw_CenterText(mid - 1 * line, l1, fs, '1 0 0', 1, 0);
583 draw_CenterText(mid - 0 * line, l2, fs, '0 0 1', 1, 0);
585 if (!campaign_name_previous)
586 campaign_name_previous = strzone(strcat(campaign_name, "x")); // force unequal
587 if(campaign_name == campaign_name_previous)
589 if(cvar(strcat("g_campaign", campaign_name, "_won")))
591 if(!campaign_won_previous)
594 DialogOpenButton_Click_withCoords(NULL, main.winnerDialog, '0 0 0', eX * conwidth + eY * conheight);
596 campaign_won_previous = 1;
599 campaign_won_previous = 0;
603 strcpy(campaign_name_previous, campaign_name);
604 campaign_won_previous = cvar(strcat("g_campaign", campaign_name, "_won"));
608 string resolvemod(string m)
611 return getcurrentmod();
616 float updateCompression()
618 float have_dds, have_jpg, have_tga;
620 have_dds = (fexists("dds/particles/particlefont.dds"));
621 have_jpg = (fexists("particles/particlefont.jpg"));
622 have_tga = (fexists("particles/particlefont.tga"));
623 can_dds = GL_Have_TextureCompression();
624 if(have_dds && (have_jpg || have_tga))
626 // both? Let's only use good quality precompressed files
627 // but ONLY if we actually support it!
630 // these builds are meant to have GOOD quality, so let's not compress non-skinframes
631 cvar_set("gl_texturecompression", "0");
634 //cvar_set("gl_texturecompression", cvar_string("r_texture_dds_load"));
639 cvar_set("gl_texturecompression", "0");
640 cvar_set("r_texture_dds_load", "0");
646 // DDS only? We probably always want texture compression
647 cvar_set("gl_texturecompression", "1");
648 cvar_set("r_texture_dds_load", "1");
650 LOG_INFO(_("^1ERROR: Texture compression is required but not supported.\n^1Expect visual problems."));
655 // TGA only? Allow runtime compression
658 cvar_set("gl_texturecompression", cvar_string("r_texture_dds_load"));
663 cvar_set("gl_texturecompression", "0");
664 cvar_set("r_texture_dds_load", "0");
670 // note: include only those that should be in the menu!
672 GAMETYPE(MAPINFO_TYPE_DEATHMATCH) \
673 GAMETYPE(MAPINFO_TYPE_TEAM_DEATHMATCH) \
674 GAMETYPE(MAPINFO_TYPE_CTF) \
675 GAMETYPE(MAPINFO_TYPE_CA) \
676 GAMETYPE(MAPINFO_TYPE_FREEZETAG) \
677 GAMETYPE(MAPINFO_TYPE_KEEPAWAY) \
678 GAMETYPE(MAPINFO_TYPE_KEYHUNT) \
679 GAMETYPE(MAPINFO_TYPE_LMS) \
680 GAMETYPE(MAPINFO_TYPE_DOMINATION) \
681 GAMETYPE(MAPINFO_TYPE_NEXBALL) \
682 GAMETYPE(MAPINFO_TYPE_ONSLAUGHT) \
683 GAMETYPE(MAPINFO_TYPE_ASSAULT) \
684 /* GAMETYPE(MAPINFO_TYPE_DUEL) */ \
685 /* GAMETYPE(MAPINFO_TYPE_INVASION) */ \
688 // hidden gametypes come last so indexing always works correctly
689 #define HIDDEN_GAMETYPES \
690 GAMETYPE(MAPINFO_TYPE_RACE) \
691 GAMETYPE(MAPINFO_TYPE_CTS) \
694 Gametype GameType_GetID(int cnt)
697 #define GAMETYPE(it) { if (i++ == cnt) return it; }
704 int GameType_GetCount()
707 int dev = cvar("developer");
708 #define GAMETYPE(id) ++i;
711 #define GAMETYPE(it) { if (dev > 0) ++i; }
717 int GameType_GetTotalCount()
720 #define GAMETYPE(id) ++i;
727 string GameType_GetName(int cnt)
729 Gametype i = GameType_GetID(cnt);
730 return i ? MapInfo_Type_ToText(i) : "";
733 string GameType_GetIcon(int cnt)
735 Gametype i = GameType_GetID(cnt);
736 return i ? strcat("gametype_", MapInfo_Type_ToString(i)) : "";
740 .void(entity, float, float, entity) TD;
741 .void(entity, float) TDempty;
742 .void(entity, float, float) gotoRC;
743 entity makeXonoticTextLabel(float theAlign, string theText);
744 entity makeXonoticTextSlider(string);
745 .void(entity, string, string) addValue;
746 .void(entity) configureXonoticTextSliderValues;
747 entity makeXonoticColorpickerString(string theCvar, string theDefaultCvar);
748 entity makeXonoticCheckBoxString(string, string, string, string);
749 entity makeXonoticCheckBox(float, string, string);
752 void dialog_hudpanel_main_checkbox(entity me, string panelname)
758 me.TD(me, 1, 2.5, e = makeXonoticCheckBox(0, strzone(strcat("hud_panel_", panelname)), _("Enable")));
761 void dialog_hudpanel_main_settings(entity me, string panelname)
766 me.gotoRC(me, me.currentRow + 1.5, 0);
767 me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Background:")));
768 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg"))));
769 e.addValue(e, _("Default"), "");
770 e.addValue(e, _("Disable"), "0");
771 e.addValue(e, strzone(strcat("border_", panelname)), strzone(strcat("border_", panelname)));
772 e.configureXonoticTextSliderValues(e);
775 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Color:")));
776 me.TD(me, 2, 2.6, e = makeXonoticColorpickerString(strzone(strcat("hud_panel_", panelname, "_bg_color")), "hud_panel_bg_color"));
777 setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_bg_color")), "");
780 me.TD(me, 1, 1.0, e = makeXonoticCheckBoxString("", "1 1 1", strzone(strcat("hud_panel_", panelname, "_bg_color")), _("Use default")));
783 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Border size:")));
784 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_border"))));
785 e.addValue(e, _("Default"), "");
786 e.addValue(e, _("Disable"), "0");
787 for(i = 1; i <= 10; ++i)
788 e.addValue(e, strzone(ftos_decimals(i * 2, 0)), strzone(ftos(i * 2)));
789 e.configureXonoticTextSliderValues(e);
792 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Alpha:")));
793 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_alpha"))));
794 e.addValue(e, _("Default"), "");
795 for(i = 1; i <= 10; ++i)
796 e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
797 e.configureXonoticTextSliderValues(e);
800 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Team Color:")));
801 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_color_team"))));
802 e.addValue(e, _("Default"), "");
803 e.addValue(e, _("Disable"), "0");
804 for(i = 1; i <= 10; ++i)
805 e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
806 e.configureXonoticTextSliderValues(e);
809 me.TD(me, 1, 3.6, e = makeXonoticCheckBox(0, "hud_configure_teamcolorforced", _("Test team color in configure mode")));
812 me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Padding:")));
813 me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_padding"))));
814 e.addValue(e, _("Default"), "");
815 for(i = 0; i <= 10; ++i)
816 e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5)));
817 e.configureXonoticTextSliderValues(e);
820 float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha)
822 if(startAlpha < targetAlpha)
823 currentAlpha = min(currentAlpha + frametime * 0.5, targetAlpha);
825 currentAlpha = max(currentAlpha - frametime * 0.5, targetAlpha);
829 void CheckSendCvars(entity me, string cvarnamestring)
833 if(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))
835 LOG_INFOF("Sending cvar: %s -> %s", cvarnamestring, cvar_string(cvarnamestring));
836 cmd(sprintf("\nsendcvar %s\n", cvarnamestring));