]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
Merge branch 'master' into terencehill/welcome_dialog_translatable
[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;
24         s = cvar_string("g_weaponarena");
25         if(s == "0" || s == "") return "";
26         if(s == "all" || s == "1") return _("All Weapons Arena");
27         if(s == "all_available") return _("All Available Weapons Arena");
28         if(s == "most") return _("Most Weapons Arena");
29         if(s == "most_available") return _("Most Available Weapons Arena");
30         if(s == "devall") return "Dev All Weapons Arena"; // development option, do not translate
31         if(s == "devall_available") return "Dev All Available Weapons Arena"; // development option, do not translate
32         if(s == weaponarenastring_cvar)
33                 return weaponarenastring;
34
35         strcpy(weaponarenastring_cvar, s);
36
37         n = tokenize_console(s);
38         s = "";
39         for(int j = 0; j < n; ++j)
40         {
41                 Weapon wep = Weapon_from_name(argv(j));
42                 if(wep != WEP_Null)
43                 {
44                         s = cons_mid(s, " & ", wep.m_name);
45                 }
46         }
47         if (s != "")
48                 s = sprintf(_("%s Arena"), s);
49         else
50                 s = _("No Weapons Arena");
51
52         strcpy(weaponarenastring, s);
53
54         return weaponarenastring;
55 }
56
57 string XonoticMutatorsDialog_toString(entity me)
58 {
59         string s = build_mutator_list("");
60         if(cvar_string("g_weaponarena") != "0")
61                 s = cons_mid(s, ", ", WeaponArenaString());
62         if(s == "")
63                 return ZCTX(_("MUT^None"));
64         else
65                 return s;
66 }
67
68 float checkCompatibility_pinata(entity me)
69 {
70         if(cvar("g_instagib"))
71                 return 0;
72         if(cvar("g_nix"))
73                 return 0;
74         if(cvar("g_overkill"))
75                 return 0;
76         if(cvar("g_melee_only"))
77                 return 0;
78         if(cvar_string("g_weaponarena") != "0")
79                 return 0;
80         return 1;
81 }
82 float checkCompatibility_weaponstay(entity me)
83 {
84         return checkCompatibility_pinata(me);
85 }
86 float checkCompatibility_newtoys(entity me)
87 {
88         if(cvar("g_instagib"))
89                 return 0;
90         if(cvar_string("g_weaponarena") == "most")
91                 return 1;
92         if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
93                 return 1;
94         if(cvar_string("g_weaponarena") != "0")
95                 return 0;
96         return 1;
97 }
98 float checkCompatibility_weaponarena_weapon(entity me)
99 {
100         if(cvar("g_instagib"))
101                 return 0;
102         if(cvar_string("g_weaponarena") == "most")
103                 return 0;
104         if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
105                 return 0;
106         if(cvar_string("g_weaponarena") == "0")
107                 return 0;
108         if(cvar_string("g_balance_blaster_weaponstartoverride") == "0")
109                 return 0;
110         return 1;
111 }
112
113 void XonoticMutatorsDialog_fill(entity me)
114 {
115         entity e, s, w;
116         float i, j;
117         me.TR(me);
118                 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
119         me.TR(me);
120                 me.TDempty(me, 0.2);
121                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
122                         _("Enable dodging (quick acceleration in a given direction). Double-tap a directional key to dodge")));
123         me.TR(me);
124                 me.TDempty(me, 0.2);
125                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_touchexplode", _("Touch explode"),
126                         _("An explosion occurs when two players collide")));
127         me.TR(me);
128                 me.TDempty(me, 0.2);
129                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
130                         _("All players are almost invisible")));
131         me.TR(me);
132                 me.TDempty(me, 0.2);
133                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_buffs", _("Buffs"),
134                         _("Enable buff pickups (random bonuses like Medic, Invisible, etc.) on the maps that support it")));
135                         e.cvarOffValue = "-1"; // TODO: make this a radio button?
136         me.TR(me);
137                 me.TDempty(me, 0.2);
138                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
139                         _("Only possible to inflict damage on your enemy while they're airborne")));
140         me.TR(me);
141                 me.TDempty(me, 0.2);
142                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
143                         _("Damage done to your enemy gets added to your own health")));
144                         setDependent(e, "g_instagib", 0, 0);
145         me.TR(me);
146                 me.TDempty(me, 0.2);
147                 s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
148                         _("Amount of health below which players start bleeding out (health rots and they can't jump)"));
149                 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
150                         setDependent(e, "g_instagib", 0, 0);
151         me.TR(me);
152                 me.TDempty(me, 0.4);
153                 me.TD(me, 1, 1.6, s);
154         me.TR(me);
155                 me.TDempty(me, 0.2);
156                 s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
157                         _("Make things fall to the ground slower (percentage of normal gravity)"));
158                         s.valueDigits = 0;
159                         s.valueDisplayMultiplier = 0.125; // show gravity in percent
160                 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
161                         e.savedValue = 200; // good on silvercity
162         me.TR(me);
163                 me.TDempty(me, 0.4);
164                 me.TD(me, 1, 1.6, s);
165         me.TR(me);
166                 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
167         me.TR(me);
168                 me.TDempty(me, 0.2);
169                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling Hook"),
170                         _("Players spawn with the grappling hook. Press the 'hook' key to use it")));
171         me.TR(me);
172                 me.TDempty(me, 0.2);
173                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jetpack"),
174                         _("Players spawn with the jetpack. Double-tap 'jump' or press the 'jetpack' key to use it")));
175         me.TR(me);
176                 me.TDempty(me, 0.2);
177                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_invincible_projectiles", _("Invincible Projectiles"),
178                         _("Projectiles can't be destroyed. However, you can still explode Electro orbs with the Electro primary fire")));
179                         setDependent(e, "g_instagib", 0, 0);
180         me.TR(me);
181                 me.TDempty(me, 0.2);
182                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_new_toys", _("New Toys"),
183                         _("Some weapon spawns will be randomly replaced with new weapons: Heavy Laser Assault Cannon, Mine Layer, Rifle, T.A.G. Seeker")));
184                         setDependentWeird(e, checkCompatibility_newtoys);
185         me.TR(me);
186                 me.TDempty(me, 0.2);
187                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_rocket_flying", _("Rocket Flying"),
188                         _("Devastator rockets can be detonated instantly (otherwise, there's a short delay). This allows players to fire and detonate a Devastator rocket while in the air for a strong mid-air boost even while moving fast")));
189                         setDependent(e, "g_instagib", 0, 0);
190         me.TR(me);
191                 me.TDempty(me, 0.2);
192                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_pinata", _("PiƱata"),
193                         _("Players will drop all weapons they possessed when they are killed")));
194                         setDependentWeird(e, checkCompatibility_pinata);
195         me.TR(me);
196                 me.TDempty(me, 0.2);
197                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_weapon_stay", _("Weapons stay"),
198                         _("Weapons stay after they are picked up")));
199                         setDependentWeird(e, checkCompatibility_weaponstay);
200         me.TR(me);
201
202         me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
203                 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
204         string weaponarena_tooltip = strzone(_("Players will be given a set of weapons at spawn as well as unlimited ammo, without weapon pickups"));
205         me.TR(me);
206                 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon arenas:")));
207         me.TR(me);
208                 me.TDempty(me, 0.2);
209                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Custom weapons"), weaponarena_tooltip));
210                         e.cvarValueIsAnotherCvar = true;
211                         e.cvarOffValue = "0";
212
213                 me.TDempty(me, 0.1); // fix initial position
214         for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
215         {
216                 w = REGISTRY_GET(Weapons, i);
217                 if (w.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK))
218                         continue;
219                 if ((j % 3) == 0)
220                 {
221                         me.TR(me);
222                         me.TDempty(me, 0.4);
223                 }
224                 me.TD(me, 1, 1.2, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
225                         setDependentWeird(e, checkCompatibility_weaponarena_weapon);
226                 ++j;
227         }
228
229         me.TR(me);
230                 me.TDempty(me, 0.2);
231                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"), weaponarena_tooltip));
232                         e.cvarOffValue = "0";
233         me.TR(me);
234                 me.TDempty(me, 0.2);
235                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"), weaponarena_tooltip));
236                         e.cvarOffValue = "0";
237         me.TR(me);
238                 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
239         me.TR(me);
240                 me.TDempty(me, 0.2);
241                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
242                         _("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.")));
243                         e.cvarOffValue = "0";
244         me.TR(me);
245                 me.TDempty(me, 0.2);
246                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
247                         _("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.")));
248                         e.cvarOffValue = "0";
249         me.TR(me);
250                 me.TDempty(me, 0.4);
251                 me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
252                         _("Always carry the blaster as an additional weapon in Nix")));
253                         setDependent(e, "g_nix", 1, 1);
254         me.TR(me);
255                 me.TDempty(me, 0.2);
256                 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_balance_blaster_weaponstartoverride", "0", _("No start weapons"), "-"));
257                         e.cvarOffValue = "-1";
258                         makeMulti(e, "g_balance_shotgun_weaponstartoverride g_balance_machinegun_weaponstartoverride g_balance_devastator_weaponstartoverride g_balance_minelayer_weaponstartoverride g_balance_electro_weaponstartoverride g_balance_crylink_weaponstartoverride g_balance_hagar_weaponstartoverride g_balance_porto_weaponstartoverride g_balance_vaporizer_weaponstartoverride g_balance_hook_weaponstartoverride g_balance_rifle_weaponstartoverride g_balance_fireball_weaponstartoverride g_balance_seeker_weaponstartoverride g_balance_tuba_weaponstartoverride g_balance_arc_weaponstartoverride g_balance_vortex_weaponstartoverride g_balance_mortar_weaponstartoverride");
259
260         me.gotoRC(me, me.rows - 1, 0);
261                 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
262                         e.onClick = Dialog_Close;
263                         e.onClickEntity = me;
264 }
265
266 .void(entity) refilter;
267
268 void XonoticMutatorsDialog_close(entity me)
269 {
270         if(me.refilterEntity)
271                 me.refilterEntity.refilter(me.refilterEntity);
272         SUPER(XonoticMutatorsDialog).close(me);
273 }