// localcmd("alias order \"cmd order $*\""); enable if ctf-command thingy is used
//registercmd("ctf_menu");
registercmd("ons_map");
+ registercmd("hud_configure");
+ registercmd("hud_save");
//registercmd("menu_action");
registercmd("+button3");
local string strCmd;
strCmd = argv(0);
- if(strCmd == "+button4") { // zoom
+ if(strCmd == "hud_configure") { // config hud
+ cvar_set("_hud_configure", ftos(!cvar("_hud_configure")));
+ return true;
+ } else if(strCmd == "hud_save") { // save hud config
+ if(argv(1) == "" || argv(2)) {
+ print("Usage:\n");
+ print("hud_save configname (saves to hud_skinname_configname.cfg)\n");
+ }
+ else
+ HUD_Panel_ExportCfg(argv(1));
+ return true;
+ } else if(strCmd == "+button4") { // zoom
// return false, because the message shall be sent to the server anyway (for demos/speccing)
if(ignore_plus_zoom)
{
}
}
+// Save the config
+void HUD_Panel_ExportCfg(string cfgname)
+{
+ float fh;
+ fh = fopen(strcat("hud_", hud_skin, "_", cfgname, ".cfg"), FILE_WRITE);
+ if(fh >= 0)
+ {
+ float i;
+ for (i = 0; i < panel_cnt; ++i)
+ {
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), " ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i))))));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_pos \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_pos")), "\""));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_size \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_size")), "\""));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg")), "\""));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_color \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_color")), "\""));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_alpha ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_bg_alpha")))));
+ fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_border ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_bg_border")))));
+ fputs(fh, "");
+ }
+
+ print("^2Successfully exported to hud_", hud_skin, "_", cfgname, ".cfg");
+ }
+ fclose(fh);
+}
+
vector HUD_Panel_CheckLimitSize(float id, vector mySize)
{
switch(id) {
hud_fontsize = HUD_GetFontsize("hud_fontsize");
hud_fontsize_spec = HUD_GetFontsize("hud_fontsize_spec");
+ //hud_configure = cvar("_hud_configure");
+ hud_skin = cvar_string("hud_skin");
+
+ // Drawing stuff
if(cvar_string("hud_dock") != "0")
drawpic('0 0 0', strcat("gfx/hud/", cvar_string("hud_dock")), eX * vid_conwidth + eY * vid_conheight, stov(cvar_string("hud_dock_color")), cvar("hud_dock_alpha"), DRAWFLAG_NORMAL);