1 #include "dialog_multiplayer_create_mutators.qh"
2 #include <common/weapons/_all.qh>
4 #include "weaponarenacheckbox.qh"
7 #include "textlabel.qh"
8 #include "checkbox_slider_invalid.qh"
9 #include "radiobutton.qh"
12 void XonoticMutatorsDialog_showNotify(entity me)
14 SUPER(XonoticMutatorsDialog).showNotify(me);
18 string weaponarenastring;
19 string weaponarenastring_cvar;
20 string WeaponArenaString()
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;
35 strcpy(weaponarenastring_cvar, s);
37 n = tokenize_console(s);
39 for(int j = 0; j < n; ++j)
41 Weapon wep = Weapon_from_name(argv(j));
44 s = cons_mid(s, " & ", wep.m_name);
48 s = sprintf(_("%s Arena"), s);
50 s = _("No Weapons Arena");
52 strcpy(weaponarenastring, s);
54 return weaponarenastring;
57 string XonoticMutatorsDialog_toString(entity me)
59 string s = build_mutator_list("");
60 if(cvar_string("g_weaponarena") != "0")
61 s = cons_mid(s, ", ", WeaponArenaString());
63 return ZCTX(_("MUT^None"));
68 float checkCompatibility_pinata(entity me)
70 if(cvar("g_instagib"))
74 if(cvar("g_overkill"))
76 if(cvar("g_melee_only"))
78 if(cvar_string("g_weaponarena") != "0")
82 float checkCompatibility_weaponstay(entity me)
84 return checkCompatibility_pinata(me);
86 float checkCompatibility_newtoys(entity me)
88 if(cvar("g_instagib"))
90 if(cvar_string("g_weaponarena") == "most")
92 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
94 if(cvar_string("g_weaponarena") != "0")
98 float checkCompatibility_weaponarena_weapon(entity me)
100 if(cvar("g_instagib"))
102 if(cvar_string("g_weaponarena") == "most")
104 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
106 if(cvar_string("g_weaponarena") == "0")
108 if(cvar_string("g_balance_blaster_weaponstartoverride") == "0")
113 void XonoticMutatorsDialog_fill(entity me)
118 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
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")));
125 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_touchexplode", _("Touch explode"),
126 _("An explosion occurs when two players collide")));
129 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
130 _("All players are almost invisible")));
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?
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")));
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);
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);
153 me.TD(me, 1, 1.6, s);
156 s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
157 _("Make things fall to the ground slower (percentage of normal gravity)"));
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
164 me.TD(me, 1, 1.6, s);
166 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
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")));
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")));
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);
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);
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);
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);
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);
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"));
206 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon arenas:")));
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";
213 me.TDempty(me, 0.1); // fix initial position
214 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
216 w = REGISTRY_GET(Weapons, i);
217 if (w.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK))
224 me.TD(me, 1, 1.2, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
225 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
231 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"), weaponarena_tooltip));
232 e.cvarOffValue = "0";
235 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"), weaponarena_tooltip));
236 e.cvarOffValue = "0";
238 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
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";
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";
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);
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");
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;
266 .void(entity) refilter;
268 void XonoticMutatorsDialog_close(entity me)
270 if(me.refilterEntity)
271 me.refilterEntity.refilter(me.refilterEntity);
272 SUPER(XonoticMutatorsDialog).close(me);