]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_game_hud.qc
Merge branch 'master' into Mario/showspecs
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_game_hud.qc
1 #include "dialog_settings_game_hud.qh"
2
3 #include "../item/modalcontroller.qh"
4 #include "mainwindow.qh"
5 #include "textlabel.qh"
6 #include "slider.qh"
7 #include "slider_sbfadetime.qh"
8 #include "checkbox.qh"
9 #include "button.qh"
10
11 void HUDSetup_Check_Gamestatus(entity me, entity btn)
12 {
13         if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))) // we're not in a match, ask the player if they want to start one anyway
14         {
15                 DialogOpenButton_Click(me, main.hudconfirmDialog);
16         }
17         else // already in a match, lets just cut to the point and open up the hud editor directly
18         {
19                 HUDSetup_Start(me, btn);
20         }
21 }
22 void XonoticGameHUDSettingsTab_showNotify(entity me)
23 {
24         loadAllCvars(me);
25 }
26 entity makeXonoticGameHUDSettingsTab()
27 {
28         entity me;
29         me = NEW(XonoticGameHUDSettingsTab);
30         me.configureDialog(me);
31         return me;
32 }
33
34 void XonoticGameHUDSettingsTab_fill(entity me)
35 {
36         entity e;
37
38         // todo:
39         // threshold: hud_damage_pain_threshold_lower_health
40         // scoreboard_alpha*
41
42         me.TR(me);
43                 me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Scoreboard")));
44         me.TR(me);
45         me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Alpha:")));
46         me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "scoreboard_alpha_bg"));
47         me.TR(me);
48                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Fading speed:")));
49                 me.TD(me, 1, 2, e = makeXonoticScoreboardFadeTimeSlider());
50         me.TR(me);
51                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Side padding:")));
52                 me.TD(me, 1, 2, e = makeXonoticSlider(0.05, 0.3, 0.01, "scoreboard_offset_left"));
53                         makeMulti(e, "scoreboard_offset_right");
54
55         me.TR(me);
56         //me.TR(me);
57                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "scoreboard_respawntime_decimals", _("Show decimals in respawn countdown")));
58         me.TR(me);
59                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "scoreboard_accuracy", _("Show accuracy underneath scoreboard")));
60
61         me.TR(me);
62         me.TR(me);
63                 me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Waypoints")));
64         me.TR(me);
65                 me.TD(me, 1, 3, e = makeXonoticCheckBox_T(1, "cl_hidewaypoints", _("Display waypoint markers for objectives on the map"),
66                         _("Show various gametype specific waypoints")));
67         me.TR(me);
68                 me.TDempty(me, 0.2);
69                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Alpha:")));
70                         setDependent(e, "cl_hidewaypoints", 0, 0);
71                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0.1, 1, 0.05, "g_waypointsprite_alpha",
72                         _("Control transparency of the waypoints")));
73                         setDependent(e, "cl_hidewaypoints", 0, 0);
74         me.TR(me);
75                 me.TDempty(me, 0.2);
76                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Fontsize:")));
77                         setDependent(e, "cl_hidewaypoints", 0, 0);
78                 me.TD(me, 1, 2, e = makeXonoticSlider(5, 16, 1, "g_waypointsprite_fontsize"));
79                         setDependent(e, "cl_hidewaypoints", 0, 0);
80         me.TR(me);
81                 me.TDempty(me, 0.2);
82                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Edge offset:")));
83                         setDependent(e, "cl_hidewaypoints", 0, 0);
84                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0, 0.3, 0.01, "g_waypointsprite_edgeoffset_bottom", "-"));
85                         makeMulti(e, "g_waypointsprite_edgeoffset_top g_waypointsprite_edgeoffset_left g_waypointsprite_edgeoffset_right");
86                         setDependent(e, "cl_hidewaypoints", 0, 0);
87
88         me.TR(me);
89         //me.TR(me);
90                 me.TDempty(me, 0.2);
91                 me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(0.25, 1, "g_waypointsprite_crosshairfadealpha", _("Fade when near the crosshair")));
92                         setDependent(e, "cl_hidewaypoints", 0, 0);
93
94         #if 0
95         me.TR(me);
96                 me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Damage")));
97         me.TR(me);
98                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Overlay:")));
99                 me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "hud_damage"));
100         me.TR(me);
101                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Factor:")));
102                         setDependent(e, "hud_damage", 0.001, 100);
103                 me.TD(me, 1, 2, e = makeXonoticSlider(0.025, 0.1, 0.025, "hud_damage_factor"));
104                         setDependent(e, "hud_damage", 0.001, 100);
105         me.TR(me);
106                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Fade rate:")));
107                         setDependent(e, "hud_damage", 0.001, 100);
108                 me.TD(me, 1, 2, e = makeXonoticSlider(0.25, 1, 0.05, "hud_damage_fade_rate"));
109                         setDependent(e, "hud_damage", 0.001, 100);
110         me.TR(me);
111         #endif
112
113         me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
114                 me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Player Names")));
115         me.TR(me);
116                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_shownames", _("Show names above players")));
117
118         me.TR(me);
119                 me.TDempty(me, 0.2);
120                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Alpha:")));
121                         setDependent(e, "hud_shownames", 1, 1);
122                 me.TD(me, 1, 2, e = makeXonoticSlider(0.1, 1, 0.05, "hud_shownames_alpha"));
123                         setDependent(e, "hud_shownames", 1, 1);
124         me.TR(me);
125                 me.TDempty(me, 0.2);
126                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Fontsize:")));
127                         setDependent(e, "hud_shownames", 1, 1);
128                 me.TD(me, 1, 2, e = makeXonoticSlider(5, 16, 1, "hud_shownames_fontsize"));
129                         setDependent(e, "hud_shownames", 1, 1);
130         me.TR(me);
131                 me.TDempty(me, 0.2);
132                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Max distance:")));
133                         setDependent(e, "hud_shownames", 1, 1);
134                 me.TD(me, 1, 2, e = makeXonoticSlider(2000, 10000, 500, "hud_shownames_maxdistance"));
135                         setDependent(e, "hud_shownames", 1, 1);
136         me.TR(me);
137                 me.TDempty(me, 0.2);
138                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Decolorize:")));
139                         setDependent(e, "hud_shownames", 1, 1);
140                 me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_shownames_decolorize"));
141                         e.addValue(e, _("Never"), "0");
142                         e.addValue(e, _("Teamplay"), "1");
143                         e.addValue(e, _("Always"), "2");
144                         e.configureXonoticTextSliderValues(e);
145                         setDependent(e, "hud_shownames", 1, 1);
146
147         me.TR(me);
148         //me.TR(me);
149                 me.TDempty(me, 0.2);
150                 me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(25, 0, "hud_shownames_crosshairdistance", _("Only when near crosshair")));
151                         setDependent(e, "hud_shownames", 1, 1);
152         me.TR(me);
153                 me.TDempty(me, 0.2);
154                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "hud_shownames_status", _("Display health and armor")));
155                         setDependent(e, "hud_shownames", 1, 1);
156
157         me.TR(me);
158         me.TR(me);
159                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Damage overlay:")));
160                 me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "hud_damage"));
161         me.TR(me);
162                 me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "hud_dynamic_follow", _("Dynamic HUD"),
163                         _("HUD moves around following player's movement")));
164         me.TR(me);
165                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_dynamic_shake", _("Shake the HUD when hurt")));
166         me.TR(me);
167         me.TR(me);
168                 me.TDempty(me, 0.5);
169                 me.TD(me, 1, 2, e = makeXonoticButton(_("Enter HUD editor"), '0 0 0'));
170                         e.onClick = HUDSetup_Check_Gamestatus;
171                         e.onClickEntity = me;
172                 // TODO: show hud config name with text here
173 }