Merge branch 'master' into terencehill/newpanelhud
authorterencehill <piuntn@gmail.com>
Sun, 31 Oct 2010 00:09:34 +0000 (02:09 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 31 Oct 2010 00:09:34 +0000 (02:09 +0200)
Conflicts:
qcsrc/client/autocvars.qh
qcsrc/client/hud.qh

1  2 
qcsrc/client/View.qc
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/scoreboard.qc

Simple merge
@@@ -465,70 -459,68 +465,70 @@@ void HUD_Panel_ExportCfg(string cfgname
                float i;
                for (i = 0; i < HUD_PANEL_NUM; ++i)
                {
-                       HUD_Panel_GetName(i)
+                       HUD_Panel_GetName(i);
  
 -                      fputs(fh, strcat("seta hud_panel_", panel_name, " ", cvar_string(strcat("hud_panel_", panel_name)), "\n"));
 -                      fputs(fh, strcat("seta hud_panel_", panel_name, "_pos \"", cvar_string(strcat("hud_panel_", panel_name, "_pos")), "\"", "\n"));
 -                      fputs(fh, strcat("seta hud_panel_", panel_name, "_size \"", cvar_string(strcat("hud_panel_", panel_name, "_size")), "\"", "\n"));
 -                      fputs(fh, strcat("seta hud_panel_", panel_name, "_bg \"", cvar_string(strcat("hud_panel_", panel_name, "_bg")), "\"", "\n"));
 -                      fputs(fh, strcat("seta hud_panel_", panel_name, "_bg_color \"", cvar_string(strcat("hud_panel_", panel_name, "_bg_color")), "\"", "\n"));
 -                      fputs(fh, strcat("seta hud_panel_", panel_name, "_bg_color_team \"", cvar_string(strcat("hud_panel_", panel_name, "_bg_color_team")), "\"", "\n"));
 -                      fputs(fh, strcat("seta hud_panel_", panel_name, "_bg_alpha \"", cvar_string(strcat("hud_panel_", panel_name, "_bg_alpha")), "\"", "\n"));
 -                      fputs(fh, strcat("seta hud_panel_", panel_name, "_bg_border \"", cvar_string(strcat("hud_panel_", panel_name, "_bg_border")), "\"", "\n"));
 -                      fputs(fh, strcat("seta hud_panel_", panel_name, "_bg_padding \"", cvar_string(strcat("hud_panel_", panel_name, "_bg_padding")), "\"", "\n"));
 +                      HUD_Write_PanelCvar_n("");
 +                      HUD_Write_PanelCvar_q("_pos");
 +                      HUD_Write_PanelCvar_q("_size");
 +                      HUD_Write_PanelCvar_q("_bg");
 +                      HUD_Write_PanelCvar_q("_bg_color");
 +                      HUD_Write_PanelCvar_q("_bg_color_team");
 +                      HUD_Write_PanelCvar_q("_bg_alpha");
 +                      HUD_Write_PanelCvar_q("_bg_border");
 +                      HUD_Write_PanelCvar_q("_bg_padding");
                        switch(i) {
                                case HUD_PANEL_WEAPONS:
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_complainbubble \"", cvar_string(strcat("hud_panel_", panel_name, "_complainbubble")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_complainbubble_padding \"", cvar_string(strcat("hud_panel_", panel_name, "_complainbubble_padding")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_complainbubble_color_outofammo \"", cvar_string(strcat("hud_panel_", panel_name, "_complainbubble_color_outofammo")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_complainbubble_color_donthave \"", cvar_string(strcat("hud_panel_", panel_name, "_complainbubble_color_donthave")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_complainbubble_color_unavailable \"", cvar_string(strcat("hud_panel_", panel_name, "_complainbubble_color_unavailable")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_ammo_color \"", cvar_string(strcat("hud_panel_", panel_name, "_ammo_color")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_ammo_alpha \"", cvar_string(strcat("hud_panel_", panel_name, "_ammo_alpha")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_aspect \"", cvar_string(strcat("hud_panel_", panel_name, "_aspect")), "\"", "\n"));
 +                                      HUD_Write_PanelCvar_q("_complainbubble");
 +                                      HUD_Write_PanelCvar_q("_complainbubble_padding");
 +                                      HUD_Write_PanelCvar_q("_complainbubble_color_outofammo");
 +                                      HUD_Write_PanelCvar_q("_complainbubble_color_donthave");
 +                                      HUD_Write_PanelCvar_q("_complainbubble_color_unavailable");
 +                                      HUD_Write_PanelCvar_q("_ammo_color");
 +                                      HUD_Write_PanelCvar_q("_ammo_alpha");
 +                                      HUD_Write_PanelCvar_q("_aspect");
                                        break;
                                case HUD_PANEL_AMMO:
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_onlycurrent \"", cvar_string(strcat("hud_panel_", panel_name, "_onlycurrent")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_iconalign \"", cvar_string(strcat("hud_panel_", panel_name, "_iconalign")), "\"", "\n"));
 +                                      HUD_Write_PanelCvar_q("_onlycurrent");
 +                                      HUD_Write_PanelCvar_q("_iconalign");
                                        break;
                                case HUD_PANEL_POWERUPS:
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_flip \"", cvar_string(strcat("hud_panel_", panel_name, "_flip")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_iconalign \"", cvar_string(strcat("hud_panel_", panel_name, "_iconalign")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_baralign \"", cvar_string(strcat("hud_panel_", panel_name, "_baralign")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_progressbar \"", cvar_string(strcat("hud_panel_", panel_name, "_progressbar")), "\"", "\n"));
 +                                      HUD_Write_PanelCvar_q("_flip");
 +                                      HUD_Write_PanelCvar_q("_iconalign");
 +                                      HUD_Write_PanelCvar_q("_baralign");
 +                                      HUD_Write_PanelCvar_q("_progressbar");
                                        break;
                                case HUD_PANEL_HEALTHARMOR:
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_flip \"", cvar_string(strcat("hud_panel_", panel_name, "_flip")), "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_iconalign \"", cvar_string(strcat("hud_panel_", panel_name, "_iconalign")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_baralign \"", cvar_string(strcat("hud_panel_", panel_name, "_baralign")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_progressbar \"", cvar_string(strcat("hud_panel_", panel_name, "_progressbar")), "\"", "\n"));
 +                                      HUD_Write_PanelCvar_q("_flip");
 +                                      HUD_Write_PanelCvar_q("_iconalign");
 +                                      HUD_Write_PanelCvar_q("_baralign");
 +                                      HUD_Write_PanelCvar_q("_progressbar");
                                        break;
                                case HUD_PANEL_NOTIFY:
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_flip \"", cvar_string(strcat("hud_panel_", panel_name, "_flip")), "\"", "\n"));
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_print \"", cvar_string(strcat("hud_panel_", panel_name, "_print")), "\"", "\n"));
 +                                      HUD_Write_PanelCvar_q("_flip");
 +                                      HUD_Write_PanelCvar_q("_print");
                                        break;
                                case HUD_PANEL_RADAR:
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_foreground_alpha \"", cvar_string(strcat("hud_panel_", panel_name, "_foreground_alpha")), "\"", "\n"));
 +                                      HUD_Write_PanelCvar_q("_foreground_alpha");
                                        break;
                                case HUD_PANEL_VOTE:
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_alreadyvoted_alpha \"", cvar_string(strcat("hud_panel_", panel_name, "_alreadyvoted_alpha")), "\"", "\n"));
 +                                      HUD_Write_PanelCvar_q("_alreadyvoted_alpha");
                                        break;
                                case HUD_PANEL_PRESSEDKEYS:
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_aspect \"", cvar_string(strcat("hud_panel_", panel_name, "_aspect")), "\"", "\n"));
 +                                      HUD_Write_PanelCvar_q("_aspect");
                                        break;
                                case HUD_PANEL_INFOMESSAGES:
 -                                      fputs(fh, strcat("seta hud_panel_", panel_name, "_flip \"", cvar_string(strcat("hud_panel_", panel_name, "_flip")), "\"", "\n"));
 +                                      HUD_Write_PanelCvar_q("_flip");
                                        break;
                        }
 -                      fputs(fh, "\n");
 +                      HUD_Write("\n");
                }
 -              fputs(fh, strcat("menu_sync", "\n")); // force the menu to reread the cvars, so that the dialogs are updated
 +              HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
  
                print("^2Successfully exported to hud_", autocvar_hud_skin, "_", cfgname, ".cfg! (Note: It's saved in data/data/)\n");
 +              fclose(fh);
        }
 -      fclose(fh);
 +      else
 +              print("^1Couldn't write to hud_", autocvar_hud_skin, "_", cfgname, ".cfg\n");
  }
  
  const float hlBorderSize = 4;
@@@ -97,14 -88,16 +88,16 @@@ var string panel_bg_padding_str
  // Little help for the poor people who have to make sense of this: Start from the bottom ;)
  
  #define HUD_Panel_GetProgressBarColor(item) \
 -              progressbar_color = autocvar_hud_progressbar_##item##_color
++              progressbar_color = stov(cvar_string("hud_progressbar_##item##_color"))
+ #define HUD_Panel_GetProgressBarColorForString(item) \
  switch(item) {\
-       case "strength": progressbar_color = stov(cvar_string("hud_progressbar_strength_color")); break;\
-       case "shield": progressbar_color = stov(cvar_string("hud_progressbar_shield_color")); break;\
-       case "health": progressbar_color = stov(cvar_string("hud_progressbar_health_color")); break;\
-       case "armor": progressbar_color = stov(cvar_string("hud_progressbar_armor_color")); break;\
-       case "fuel": progressbar_color = stov(cvar_string("hud_progressbar_fuel_color")); break;\
-       case "nexball": progressbar_color = stov(cvar_string("hud_progressbar_nexball_color")); break;\
- }
+       case "strength": HUD_Panel_GetProgressBarColor(strength); break;\
+       case "shield": HUD_Panel_GetProgressBarColor(shield); break;\
+       case "health": HUD_Panel_GetProgressBarColor(health); break;\
+       case "armor": HUD_Panel_GetProgressBarColor(armor); break;\
+       case "fuel": HUD_Panel_GetProgressBarColor(fuel); break;\
+       case "nexball": HUD_Panel_GetProgressBarColor(nexball); break;\
+ } ENDS_WITH_CURLY_BRACE
  
  // Get value for panel_bg: if "" fetch default, else use panel_bg_str
  // comment on last line of macro: // we probably want to see a background in config mode at all times...
Simple merge