2 CLASS(XonoticPlayerSettingsTab) EXTENDS(XonoticTab)
3 METHOD(XonoticPlayerSettingsTab, fill, void(entity))
4 METHOD(XonoticPlayerSettingsTab, draw, void(entity))
5 ATTRIB(XonoticPlayerSettingsTab, title, string, "Player Setup")
6 ATTRIB(XonoticPlayerSettingsTab, intendedWidth, float, 0.9)
7 ATTRIB(XonoticPlayerSettingsTab, rows, float, 22)
8 ATTRIB(XonoticPlayerSettingsTab, columns, float, 6.5)
9 ATTRIB(XonoticPlayerSettingsTab, playerNameLabel, entity, NULL)
10 ATTRIB(XonoticPlayerSettingsTab, playerNameLabelAlpha, float, 0)
11 ENDCLASS(XonoticPlayerSettingsTab)
12 entity makeXonoticPlayerSettingsTab();
14 void HUDSetup_Join_Click(entity me, entity btn);
19 entity makeXonoticPlayerSettingsTab()
22 me = spawnXonoticPlayerSettingsTab();
23 me.configureDialog(me);
26 void XonoticPlayerSettingsTab_draw(entity me)
28 if(cvar_string("_cl_name") == "Player")
29 me.playerNameLabel.alpha = ((mod(time * 2, 2) < 1) ? 1 : 0);
31 me.playerNameLabel.alpha = me.playerNameLabelAlpha;
32 SUPER(XonoticPlayerSettingsTab).draw(me);
34 void XonoticPlayerSettingsTab_fill(entity me)
36 entity e, pms, sl, label, e0, box;
40 me.TD(me, 1, 0.5, me.playerNameLabel = makeXonoticTextLabel(0, "Name:"));
41 me.playerNameLabelAlpha = me.playerNameLabel.alpha;
42 me.TD(me, 1, 2.5, label = makeXonoticTextLabel(0, string_null));
44 label.allowColors = 1;
47 me.TD(me, 1, 3.0, box = makeXonoticInputBox(1, "_cl_name"));
48 box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
50 label.textEntity = box;
52 me.TD(me, 5, 1, e = makeXonoticColorpicker(box));
53 me.TD(me, 5, 2, e = makeXonoticCharmap(box));
60 me.gotoRC(me, 8, 0.0);
61 pms = makeXonoticPlayerModelSelector();
62 me.TD(me, 1, 0.6, e = makeXonoticTextLabel(1, "Model:"));
63 me.TD(me, 1, 0.3, e = makeXonoticButton("<<", '0 0 0'));
64 e.onClick = PlayerModelSelector_Prev_Click;
65 e.onClickEntity = pms;
66 me.TD(me, me.rows - me.currentRow - 1, 1.8, pms);
67 me.TD(me, 1, 0.3, e = makeXonoticButton(">>", '0 0 0'));
68 e.onClick = PlayerModelSelector_Next_Click;
69 e.onClickEntity = pms;
73 n = 16 - !cvar("developer");
75 for(i = 0; i < n; ++i)
77 me.gotoRC(me, r + i * m, 0.1);
78 me.TDNoMargin(me, m, 0.2, e = makeXonoticColorButton(1, 0, i), '0 1 0');
80 for(i = 0; i < n; ++i)
82 me.gotoRC(me, r + i * m, 0.4);
83 me.TDNoMargin(me, m, 0.2, e = makeXonoticColorButton(2, 1, i), '0 1 0');
86 me.gotoRC(me, 0, 3.5); me.setFirstColumn(me, me.currentColumn);
87 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Field of view:"));
88 me.TD(me, 1, 2, e = makeXonoticSlider(60, 130, 1, "fov"));
90 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Damage kick:"));
91 me.TD(me, 1, 2, e = makeXonoticSlider(0, 0.5, 0.05, "v_kicktime"));
93 sl = makeXonoticSlider(0.45, 0.75, 0.01, "cl_bobcycle");
94 me.TD(me, 1, 1, e = makeXonoticSliderCheckBox(0, 1, sl, "View bobbing:"));
95 makeMulti(sl, "cl_bob2cycle");
98 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Zoom factor:"));
99 me.TD(me, 1, 2, e = makeXonoticSlider(2, 16, 0.5, "cl_zoomfactor"));
101 sl = makeXonoticSlider(1, 8, 0.5, "cl_zoomspeed");
102 me.TD(me, 1, 1, e = makeXonoticSliderCheckBox(-1, 1, sl, "Zoom speed:"));
105 me.TD(me, 1, 1.5, e = makeXonoticButton("Weapon settings...", '0 0 0'));
106 e.onClick = DialogOpenButton_Click;
107 e.onClickEntity = main.weaponsDialog;
108 me.TD(me, 1, 1.5, e0 = makeXonoticTextLabel(0, string_null));
109 e0.textEntity = main.weaponsDialog;
112 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Crosshair:"));
113 me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "crosshair_per_weapon", "Per weapon"));
116 for(i = 1; i <= 10; ++i) {
117 me.TDNoMargin(me, 1, 2 / 10, e = makeXonoticCrosshairButton(3, i), '1 1 0');
118 setDependent(e, "crosshair_per_weapon", 0, 0);
120 // show a larger preview of the selected crosshair
122 me.TDNoMargin(me, 2, 2 / 5, e = makeXonoticCrosshairButton(4, -1), '1 1 0'); // crosshair -1 makes this a preview
123 setDependent(e, "crosshair_per_weapon", 0, 0);
126 for(i = 11; i <= 20; ++i) {
127 me.TDNoMargin(me, 1, 2 / 10, e = makeXonoticCrosshairButton(3, i), '1 1 0');
128 setDependent(e, "crosshair_per_weapon", 0, 0);
132 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Crosshair size:"));
133 me.TD(me, 1, 1.8, e = makeXonoticSlider(0.10, 1.5, 0.05, "crosshair_size"));
136 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Crosshair alpha:"));
137 me.TD(me, 1, 1.8, e = makeXonoticSlider(0, 1, 0.1, "crosshair_alpha"));
140 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Crosshair color:"));
141 me.TD(me, 2, 1.8, e = makeXonoticColorpickerString("crosshair_color", "crosshair_color"));
142 setDependent(e, "crosshair_color_per_weapon", 0, 0);
145 me.TD(me, 1, 0.7, e = makeXonoticCheckBox(0, "crosshair_color_per_weapon", "Per weapon"));
147 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_dot", "Enable centered dot"));
150 me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, "Size:"));
151 me.TD(me, 1, 0.9, e = makeXonoticSlider(0.2, 2, 0.1, "crosshair_dot_size"));
152 setDependent(e, "crosshair_dot", 1, 1);
153 me.TD(me, 1, 0.5, e = makeXonoticTextLabel(0, "Alpha:"));
154 me.TD(me, 1, 0.9, e = makeXonoticSlider(0.10, 1, 0.1, "crosshair_dot_alpha"));
155 setDependent(e, "crosshair_dot", 1, 1);
157 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Hit test:"));
158 me.TD(me, 1, 2/3, e = makeXonoticRadioButton(5, "crosshair_hittest", "0", "None"));
159 me.TD(me, 1, 2/3, e = makeXonoticRadioButton(5, "crosshair_hittest", "1", "TrueAim"));
160 me.TD(me, 1, 2/3, e = makeXonoticRadioButton(5, "crosshair_hittest", "1.25", "Enemies"));
164 me.TD(me, 1, 2.2, e = makeXonoticButton("Waypoints setup...", '0 0 0'));
165 e.onClick = DialogOpenButton_Click;
166 e.onClickEntity = main.waypointDialog;
170 me.TD(me, 1, 2.2, e = makeXonoticButton("Enter HUD editor", '0 0 0'));
171 e.onClick = HUDSetup_Join_Click;
172 e.onClickEntity = me;
175 #ifdef ALLOW_FORCEMODELS
176 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Force models:"));
177 me.TD(me, 1, 2/3, e = makeXonoticRadioButton(6, string_null, string_null, "None"));
178 me.TD(me, 1, 2/3, e = makeXonoticRadioButton(6, "cl_forceplayermodelsfromxonotic", string_null, "Custom"));
179 me.TD(me, 1, 2/3, e = makeXonoticRadioButton(6, "cl_forceplayermodels", string_null, "All"));
181 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_gentle", "Disable gore effects"));
183 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Gibs:"));
184 me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_nogibs"));
185 e.addValue(e, "None", "1");
186 e.addValue(e, "Few", "0.75");
187 e.addValue(e, "Many", "0.5");
188 e.addValue(e, "Lots", "0");
189 e.configureXonoticTextSliderValues(e);
190 setDependent(e, "cl_gentle", 0, 0);
192 me.gotoRC(me, me.rows - 1, 0);
193 me.TD(me, 1, me.columns, makeXonoticCommandButton("Apply immediately", '0 0 0', "color -1 -1;name \"$_cl_name\";cl_cmd sendcvar cl_weaponpriority;sendcvar cl_zoomfactor;sendcvar cl_zoomspeed;sendcvar cl_autoswitch;sendcvar cl_shownames;sendcvar cl_forceplayermodelsfromxonotic;sendcvar cl_forceplayermodels;playermodel $_cl_playermodel;playerskin $_cl_playerskin", COMMANDBUTTON_APPLY));
195 void HUDSetup_Join_Click(entity me, entity btn)
197 if(! (gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
199 localcmd("map hudsetup/hudsetup", "\n");
202 localcmd("togglemenu 0\n");
203 localcmd("_hud_configure 1", "\n");