-#if defined(CSQC)
- #include "../dpdefs/csprogsdefs.qh"
- #include "defs.qh"
- #include "../dpdefs/keycodes.qh"
- #include "../common/constants.qh"
- #include "autocvars.qh"
- #include "hud.qh"
-#elif defined(MENUQC)
-#elif defined(SVQC)
-#endif
+#include "hud_config.qh"
+#include "_all.qh"
+
+#include "hud.qh"
+
+#include "../common/constants.qh"
+
+#include "../dpdefs/keycodes.qh"
#define HUD_Write(s) fputs(fh, s)
HUD_Write("\n");
// common cvars for all panels
- int i;
- for (i = 0; i < HUD_PANEL_NUM; ++i)
+ for (int i = 0; i < hud_panels_COUNT; ++i)
{
- panel = hud_panel[i];
+ panel = hud_panels[i];
HUD_Write_PanelCvar_n("");
HUD_Write_PanelCvar_q("_pos");
HUD_Write_PanelCvar_q("_bg_alpha");
HUD_Write_PanelCvar_q("_bg_border");
HUD_Write_PanelCvar_q("_bg_padding");
- switch(i) {
+ switch(panel) {
case HUD_PANEL_WEAPONS:
HUD_Write_PanelCvar_q("_accuracy");
HUD_Write_PanelCvar_q("_label");
HUD_Write_PanelCvar_q("_timeout_speed_in");
HUD_Write_PanelCvar_q("_timeout_speed_out");
HUD_Write_PanelCvar_q("_onlyowned");
+ HUD_Write_PanelCvar_q("_noncurrent_alpha");
+ HUD_Write_PanelCvar_q("_noncurrent_scale");
break;
case HUD_PANEL_AMMO:
HUD_Write_PanelCvar_q("_onlycurrent");
HUD_Write_PanelCvar_q("_text");
break;
case HUD_PANEL_POWERUPS:
- HUD_Write_PanelCvar_q("_flip");
HUD_Write_PanelCvar_q("_iconalign");
HUD_Write_PanelCvar_q("_baralign");
HUD_Write_PanelCvar_q("_progressbar");
- HUD_Write_PanelCvar_q("_progressbar_strength");
- HUD_Write_PanelCvar_q("_progressbar_shield");
HUD_Write_PanelCvar_q("_text");
break;
case HUD_PANEL_HEALTHARMOR:
HUD_Write_PanelCvar_q("_fade_subsequent_minfontsize");
HUD_Write_PanelCvar_q("_fade_minfontsize");
break;
+ case HUD_PANEL_ITEMSTIME:
+ HUD_Write_PanelCvar_q("_iconalign");
+ HUD_Write_PanelCvar_q("_progressbar");
+ HUD_Write_PanelCvar_q("_progressbar_name");
+ HUD_Write_PanelCvar_q("_progressbar_reduced");
+ HUD_Write_PanelCvar_q("_text");
+ HUD_Write_PanelCvar_q("_ratio");
+ HUD_Write_PanelCvar_q("_dynamicsize");
+ case HUD_PANEL_QUICKMENU:
+ HUD_Write_PanelCvar_q("_align");
+ break;
}
HUD_Write("\n");
}
HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
- printf(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
+ LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
fclose(fh);
}
else
- printf(_("^1Couldn't write to %s\n"), filename);
+ LOG_INFOF(_("^1Couldn't write to %s\n"), filename);
}
void HUD_Configure_Exit_Force()
vector myCenter, targCenter;
vector myTarget = myPos;
int i;
- for (i = 0; i < HUD_PANEL_NUM; ++i) {
- panel = hud_panel[i];
+ for (i = 0; i < hud_panels_COUNT; ++i) {
+ panel = hud_panels[i];
+ if(panel == HUD_PANEL(MAPVOTE)) continue;
if(panel == highlightedPanel) continue;
HUD_Panel_UpdatePosSize();
if(!panel_enabled) continue;
vector dist;
float ratio = mySize.x/mySize.y;
int i;
- for (i = 0; i < HUD_PANEL_NUM; ++i) {
- panel = hud_panel[i];
+ for (i = 0; i < hud_panels_COUNT; ++i) {
+ panel = hud_panels[i];
+ if(panel == HUD_PANEL(MAPVOTE)) continue;
if(panel == highlightedPanel) continue;
HUD_Panel_UpdatePosSize();
if(!panel_enabled) continue;
{
panel = highlightedPanel;
HUD_Panel_UpdatePosSize();
- vector resizeorigin;
- resizeorigin = panel_click_resizeorigin;
+ vector resizeorigin = panel_click_resizeorigin;
vector myPos;
// minimum panel size cap
if (hudShiftState & S_ALT) // resize
{
- highlightedAction = 1;
if(nPrimary == K_UPARROW)
resizeCorner = 1;
else if(nPrimary == K_RIGHTARROW)
}
else // move
{
- highlightedAction = 2;
vector pos;
pos = panel_pos;
if(nPrimary == K_UPARROW)
}
}
-const int S_MOUSE1 = 1;
-const int S_MOUSE2 = 2;
-const int S_MOUSE3 = 4;
-int mouseClicked;
-int prevMouseClicked; // previous state
-float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks
-vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks
-
void HUD_Panel_EnableMenu();
-entity tab_panels[HUD_PANEL_MAX];
+entity tab_panels[hud_panels_MAX];
entity tab_panel;
vector tab_panel_pos;
float tab_backward;
void reset_tab_panels()
{
int i;
- for(i = 0; i < HUD_PANEL_NUM; ++i)
+ for(i = 0; i < hud_panels_COUNT; ++i)
tab_panels[i] = world;
}
float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
if (!menu_enabled)
cvar_set("_hud_configure", "0");
}
- else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // select and highlight another panel
+ else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel
{
if (bInputType == 1 || mouseClicked)
return true;
- //FIXME: if a panel is highlighted, has the same pos_x and lays in the same level
- //of other panels then next consecutive ctrl-tab will select the highlighted panel too
- //(it should only after every other panel of the hud)
- //It's a minor bug anyway, we can live with it
+ // FIXME minor bug: if a panel is highlighted, has the same pos_x and
+ // lays in the same level of another panel then the next consecutive
+ // CTRL TAB presses will reselect once more the highlighted panel
entity starting_panel;
entity old_tab_panel = tab_panel;
k=0;
while(++k)
{
- for(i = 0; i < HUD_PANEL_NUM; ++i)
+ for(i = 0; i < hud_panels_COUNT; ++i)
{
- panel = hud_panel[i];
+ panel = hud_panels[i];
+ if(panel == HUD_PANEL(MAPVOTE))
+ continue;
if (panel == tab_panels[i] || panel == starting_panel)
continue;
HUD_Panel_UpdatePosSize();
highlightedPanel_backup = world;
}
}
+ else if(nPrimary == 's' && hudShiftState & S_CTRL) // save config
+ {
+ if (bInputType == 1 || mouseClicked)
+ return true;
+ localcmd("hud save myconfig\n");
+ }
else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
{
if (bInputType == 1)
if (highlightedPanel)
HUD_Panel_EnableMenu();
}
- else if(hit_con_bind)
+ else if(hit_con_bind || nPrimary == K_PAUSE)
return false;
return true;
float HUD_Panel_Check_Mouse_Pos(float allow_move)
{
int i, j = 0;
- while(j < HUD_PANEL_NUM)
+ while(j < hud_panels_COUNT)
{
i = panel_order[j];
j += 1;
- panel = hud_panel[i];
+ panel = hud_panels[i];
+ if(panel == HUD_PANEL(MAPVOTE)) continue;
HUD_Panel_UpdatePosSize();
float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
int i;
int place = -1;
// find out where in the array our current id is, save into place
- for(i = 0; i < HUD_PANEL_NUM; ++i)
+ for(i = 0; i < hud_panels_COUNT; ++i)
{
if(panel_order[i] == id)
{
}
// place last if we didn't find a place for it yet (probably new panel, or screwed up cvar)
if(place == -1)
- place = HUD_PANEL_NUM - 1;
+ place = hud_panels_COUNT - 1;
// move all ids up by one step in the array until "place"
for(i = place; i > 0; --i)
// let's save them into the cvar by some strcat trickery
string s = "";
- for(i = 0; i < HUD_PANEL_NUM; ++i)
+ for(i = 0; i < hud_panels_COUNT; ++i)
{
s = strcat(s, ftos(panel_order[i]), " ");
}
{
int i, j = 0;
- while(j < HUD_PANEL_NUM)
+ while(j < hud_panels_COUNT)
{
i = panel_order[j];
j += 1;
- panel = hud_panel[i];
+ panel = hud_panels[i];
+ if(panel == HUD_PANEL(MAPVOTE))
+ continue;
HUD_Panel_UpdatePosSize();
float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
// move
if(allow_move && mousepos.x > panel_pos.x && mousepos.y > panel_pos.y && mousepos.x < panel_pos.x + panel_size.x && mousepos.y < panel_pos.y + panel_size.y)
{
- highlightedPanel = hud_panel[i];
+ highlightedPanel = hud_panels[i];
HUD_Panel_FirstInDrawQ(i);
highlightedAction = 1;
panel_click_distance = mousepos - panel_pos;
// resize from topleft border
else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
{
- highlightedPanel = hud_panel[i];
+ highlightedPanel = hud_panels[i];
HUD_Panel_FirstInDrawQ(i);
highlightedAction = 2;
resizeCorner = 1;
// resize from topright border
else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
{
- highlightedPanel = hud_panel[i];
+ highlightedPanel = hud_panels[i];
HUD_Panel_FirstInDrawQ(i);
highlightedAction = 2;
resizeCorner = 2;
// resize from bottomleft border
else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + panel_size.y + border)
{
- highlightedPanel = hud_panel[i];
+ highlightedPanel = hud_panels[i];
HUD_Panel_FirstInDrawQ(i);
highlightedAction = 2;
resizeCorner = 3;
// resize from bottomright border
else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + panel_size.y + border)
{
- highlightedPanel = hud_panel[i];
+ highlightedPanel = hud_panels[i];
HUD_Panel_FirstInDrawQ(i);
highlightedAction = 2;
resizeCorner = 4;
}
else
{
+ if(prevMouseClicked)
+ highlightedAction = 0;
if(menu_enabled == 2)
mouse_over_panel = 0;
else
if(autocvar_hud_cursormode)
setcursormode(1);
hudShiftState = 0;
- for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
- hud_panel[panel_order[i]].update_time = time;
+ for(i = hud_panels_COUNT - 1; i >= 0; --i)
+ hud_panels[panel_order[i]].update_time = time;
}
// NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled