]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
Remove a comment that is no longer true
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_multiplayer_create_mutators.qc
1 #include "dialog_multiplayer_create_mutators.qh"
2 #include <common/weapons/_all.qh>
3
4 #include "weaponarenacheckbox.qh"
5 #include "checkbox.qh"
6 #include "slider.qh"
7 #include "textlabel.qh"
8 #include "checkbox_slider_invalid.qh"
9 #include "radiobutton.qh"
10 #include "button.qh"
11
12 void XonoticMutatorsDialog_showNotify(entity me)
13 {
14         SUPER(XonoticMutatorsDialog).showNotify(me);
15         loadAllCvars(me);
16 }
17
18 string weaponarenastring;
19 string weaponarenastring_cvar;
20 string WeaponArenaString()
21 {
22         string s;
23         float n, i;
24         s = cvar_string("g_weaponarena");
25         if(s == "0")
26                 return "";
27         if(s == "all" || s == "1")
28                 return _("All Weapons Arena");
29         if(s == "most")
30                 return _("Most Weapons Arena");
31         if(s == weaponarenastring_cvar)
32                 return weaponarenastring;
33         if(weaponarenastring)
34                 strunzone(weaponarenastring);
35         if(weaponarenastring_cvar)
36                 strunzone(weaponarenastring_cvar);
37
38         weaponarenastring_cvar = strzone(s);
39
40         n = tokenize_console(s);
41         s = "";
42         for(i = 0; i < n; ++i)
43         {
44                 FOREACH(Weapons, it != WEP_Null, LAMBDA(
45                         if(argv(i) == it.netname)
46                                 s = strcat(s, " & ", it.m_name);
47                 ));
48         }
49         s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
50
51         weaponarenastring = strzone(s);
52
53         return weaponarenastring;
54 }
55
56 AUTOCVAR(g_grappling_hook, bool, _("let players spawn with the grappling hook which allows them to pull themselves up"));
57
58 string XonoticMutatorsDialog_toString(entity me)
59 {
60         string s;
61         s = "";
62         if(cvar("g_dodging"))
63                 s = strcat(s, ", ", _("Dodging"));
64         if(cvar("g_instagib"))
65                 s = strcat(s, ", ", _("InstaGib"));
66         if(cvar("g_new_toys"))
67                 s = strcat(s, ", ", _("New Toys"));
68         if(cvar("g_nix"))
69                 s = strcat(s, ", ", _("NIX"));
70         if(cvar("g_rocket_flying"))
71                 s = strcat(s, ", ", _("Rocket Flying"));
72         if(cvar("g_invincible_projectiles"))
73                 s = strcat(s, ", ", _("Invincible Projectiles"));
74         if(cvar_string("g_weaponarena") != "0")
75                 s = strcat(s, ", ", WeaponArenaString());
76         else if(cvar("g_balance_blaster_weaponstart") == 0)
77                 s = strcat(s, ", ", _("No start weapons"));
78         if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
79                 s = strcat(s, ", ", _("Low gravity"));
80         if(cvar("g_cloaked"))
81                 s = strcat(s, ", ", _("Cloaked"));
82         if(autocvar_g_grappling_hook)
83                 s = strcat(s, ", ", _("Hook"));
84         if(cvar("g_midair"))
85                 s = strcat(s, ", ", _("Midair"));
86         if(cvar("g_vampire"))
87                 s = strcat(s, ", ", _("Vampire"));
88         if(cvar("g_pinata"))
89                 s = strcat(s, ", ", _("Piñata"));
90         if(cvar("g_weapon_stay"))
91                 s = strcat(s, ", ", _("Weapons stay"));
92         if(cvar("g_bloodloss") > 0)
93                 s = strcat(s, ", ", _("Blood loss"));
94         if(cvar("g_jetpack"))
95                 s = strcat(s, ", ", _("Jet pack"));
96         if(cvar("g_buffs"))
97                 s = strcat(s, ", ", _("Buffs"));
98         if(cvar("g_overkill"))
99                 s = strcat(s, ", ", _("Overkill"));
100         if(cvar("g_powerups") == 0)
101                 s = strcat(s, ", ", _("No powerups"));
102         if(cvar("g_powerups") > 0)
103                 s = strcat(s, ", ", _("Powerups"));
104         if(cvar("g_touchexplode") > 0)
105                 s = strcat(s, ", ", _("Touch explode"));
106         if(s == "")
107                 return ZCTX(_("MUT^None"));
108         else
109                 return substring(s, 2, strlen(s) - 2);
110 }
111
112 float checkCompatibility_pinata(entity me)
113 {
114         if(cvar("g_instagib"))
115                 return 0;
116         if(cvar("g_nix"))
117                 return 0;
118         if(cvar_string("g_weaponarena") != "0")
119                 return 0;
120         return 1;
121 }
122 float checkCompatibility_weaponstay(entity me)
123 {
124         return checkCompatibility_pinata(me);
125 }
126 float checkCompatibility_newtoys(entity me)
127 {
128         if(cvar("g_instagib"))
129                 return 0;
130         if(cvar_string("g_weaponarena") == "most")
131                 return 1;
132         if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
133                 return 1;
134         if(cvar_string("g_weaponarena") != "0")
135                 return 0;
136         return 1;
137 }
138 float checkCompatibility_weaponarena_weapon(entity me)
139 {
140         if(cvar("g_instagib"))
141                 return 0;
142         if(cvar_string("g_weaponarena") == "most")
143                 return 0;
144         if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
145                 return 0;
146         if(cvar_string("g_weaponarena") == "0")
147                 return 0;
148         if(cvar_string("g_balance_blaster_weaponstart") == "0")
149                 return 0;
150         return 1;
151 }
152
153 void XonoticMutatorsDialog_fill(entity me)
154 {
155         entity e, s, w;
156         float i, j;
157         me.TR(me);
158                 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
159         me.TR(me);
160                 me.TDempty(me, 0.2);
161                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
162                         _("Enable dodging")));
163         me.TR(me);
164                 me.TDempty(me, 0.2);
165                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
166         me.TR(me);
167                 me.TDempty(me, 0.2);
168                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
169                         _("All players are almost invisible")));
170         me.TR(me);
171                 me.TDempty(me, 0.2);
172                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
173         me.TR(me);
174                 me.TDempty(me, 0.2);
175                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
176                         _("Only possible to inflict damage on your enemy while he's airborne")));
177         me.TR(me);
178                 me.TDempty(me, 0.2);
179                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
180                         _("Damage done to your enemy gets added to your own health")));
181                         setDependent(e, "g_instagib", 0, 0);
182         me.TR(me);
183                 me.TDempty(me, 0.2);
184                 s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
185                         _("Amount of health below which your player gets stunned because of blood loss"));
186                 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
187                         setDependent(e, "g_instagib", 0, 0);
188         me.TR(me);
189                 me.TDempty(me, 0.4);
190                 me.TD(me, 1, 1.6, s);
191         me.TR(me);
192                 me.TDempty(me, 0.2);
193                 s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
194                         _("Make things fall to the ground slower, lower value means lower gravity"));
195                         s.valueDigits = 0;
196                         s.valueDisplayMultiplier = 0.125; // show gravity in percent
197                 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
198                         e.savedValue = 200; // good on silvercity
199         me.TR(me);
200                 me.TDempty(me, 0.4);
201                 me.TD(me, 1, 1.6, s);
202         me.TR(me);
203                 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
204         me.TR(me);
205                 me.TDempty(me, 0.2);
206                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling hook"),
207                         _("Players spawn with the grappling hook")));
208         me.TR(me);
209                 me.TDempty(me, 0.2);
210                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jet pack"),
211                         _("Players spawn with the jetpack")));
212         me.TR(me);
213                 me.TDempty(me, 0.2);
214                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
215                         setDependent(e, "g_instagib", 0, 0);
216         me.TR(me);
217                 me.TDempty(me, 0.2);
218                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
219                         setDependentWeird(e, checkCompatibility_newtoys);
220         me.TR(me);
221                 me.TDempty(me, 0.2);
222                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
223                         setDependent(e, "g_instagib", 0, 0);
224         me.TR(me);
225                 me.TDempty(me, 0.2);
226                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_pinata", _("Piñata"),
227                         _("Players will drop all weapons they possessed when they are killed")));
228                         setDependentWeird(e, checkCompatibility_pinata);
229         me.TR(me);
230                 me.TDempty(me, 0.2);
231                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_weapon_stay", _("Weapons stay"),
232                         _("Weapons stay after they are picked up")));
233                         setDependentWeird(e, checkCompatibility_weaponstay);
234         me.TR(me);
235
236         me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
237                 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
238         me.TR(me);
239                 me.TD(me, 1, 2, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:"),
240                         _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
241                         e.cvarValueIsAnotherCvar = true;
242                         e.cvarOffValue = "0";
243         for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
244         {
245                 w = Weapons_from(i);
246                 if(w.spawnflags & WEP_FLAG_HIDDEN)
247                         continue;
248                 if((j & 1) == 0)
249                         me.TR(me);
250                 me.TDempty(me, 0.2);
251                 me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
252                         setDependentWeird(e, checkCompatibility_weaponarena_weapon);
253                 ++j;
254         }
255         me.TR(me);
256                 me.TDempty(me, 0.2);
257                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"),
258                         _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
259                         e.cvarOffValue = "0";
260         me.TR(me);
261                 me.TDempty(me, 0.2);
262                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"),
263                         _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
264                         e.cvarOffValue = "0";
265         me.TR(me);
266                 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
267         me.TR(me);
268                 me.TDempty(me, 0.2);
269                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
270                         _("Players will be given only one weapon, which can instantly kill the opponent with a single shot. If the player runs out of ammo, he will have 10 seconds to find some or if he fails to do so, face death. The secondary fire mode does not inflict any damage but is good for doing trickjumps.")));
271                         e.cvarOffValue = "0";
272         me.TR(me);
273                 me.TDempty(me, 0.2);
274                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
275                         _("No items Xonotic - instead of pickup items, everyone plays with the same weapon. After some time, a countdown will start, after which everyone will switch to another weapon.")));
276                         e.cvarOffValue = "0";
277         me.TR(me);
278                 me.TDempty(me, 0.4);
279                 me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
280                         _("Always carry the blaster as an additional weapon in Nix")));
281                         setDependent(e, "g_nix", 1, 1);
282         me.TR(me);
283                 me.TDempty(me, 0.2);
284                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_balance_blaster_weaponstart", "0", _("No start weapons"), "-"));
285                         e.cvarOffValue = "-1";
286                         makeMulti(e, "g_balance_shotgun_weaponstart g_balance_machinegun_weaponstart g_balance_devastator_weaponstart g_balance_minelayer_weaponstart g_balance_electro_weaponstart g_balance_crylink_weaponstart g_balance_hagar_weaponstart g_balance_porto_weaponstart g_balance_vaporizer_weaponstart g_balance_hook_weaponstart g_balance_rifle_weaponstart g_balance_fireball_weaponstart g_balance_seeker_weaponstart g_balance_tuba_weaponstart g_balance_arc_weaponstart g_balance_vortex_weaponstart g_balance_mortar_weaponstart");
287
288         me.gotoRC(me, me.rows - 1, 0);
289                 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
290                         e.onClick = Dialog_Close;
291                         e.onClickEntity = me;
292 }
293
294 .void(entity) refilter;
295
296 void XonoticMutatorsDialog_close(entity me)
297 {
298         if(me.refilterEntity)
299                 me.refilterEntity.refilter(me.refilterEntity);
300         SUPER(XonoticMutatorsDialog).close(me);
301 }