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");
27 if(s == "all" || s == "1")
28 return _("All Weapons Arena");
30 return _("Most Weapons Arena");
31 if(s == weaponarenastring_cvar)
32 return weaponarenastring;
34 strcpy(weaponarenastring_cvar, s);
36 n = tokenize_console(s);
38 for(int j = 0; j < n; ++j)
40 Weapon wep = Weapon_from_name(argv(j));
43 s = cons_mid(s, " & ", wep.m_name);
46 s = sprintf(_("%s Arena"), s);
48 strcpy(weaponarenastring, s);
50 return weaponarenastring;
53 string XonoticMutatorsDialog_toString(entity me)
55 string s = build_mutator_list("");
56 if(cvar_string("g_weaponarena") != "0")
57 s = cons_mid(s, ", ", WeaponArenaString());
59 return ZCTX(_("MUT^None"));
64 float checkCompatibility_pinata(entity me)
66 if(cvar("g_instagib"))
70 if(cvar("g_overkill"))
72 if(cvar("g_melee_only"))
74 if(cvar_string("g_weaponarena") != "0")
78 float checkCompatibility_weaponstay(entity me)
80 return checkCompatibility_pinata(me);
82 float checkCompatibility_newtoys(entity me)
84 if(cvar("g_instagib"))
86 if(cvar_string("g_weaponarena") == "most")
88 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
90 if(cvar_string("g_weaponarena") != "0")
94 float checkCompatibility_weaponarena_weapon(entity me)
96 if(cvar("g_instagib"))
98 if(cvar_string("g_weaponarena") == "most")
100 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
102 if(cvar_string("g_weaponarena") == "0")
104 if(cvar_string("g_balance_blaster_weaponstartoverride") == "0")
109 void XonoticMutatorsDialog_fill(entity me)
114 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
117 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
118 _("Enable dodging (quick acceleration in a given direction). Double-tap a directional key to dodge")));
121 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_touchexplode", _("Touch explode"),
122 _("An explosion occurs when two players collide")));
125 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
126 _("All players are almost invisible")));
129 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_buffs", _("Buffs"),
130 _("Enable buff pickups (random bonuses like Medic, Invisible, etc.) on the maps that support it")));
131 e.cvarOffValue = "-1"; // TODO: make this a radio button?
134 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
135 _("Only possible to inflict damage on your enemy while they're airborne")));
138 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
139 _("Damage done to your enemy gets added to your own health")));
140 setDependent(e, "g_instagib", 0, 0);
143 s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
144 _("Amount of health below which players start bleeding out (health rots and they can't jump)"));
145 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
146 setDependent(e, "g_instagib", 0, 0);
149 me.TD(me, 1, 1.6, s);
152 s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
153 _("Make things fall to the ground slower (percentage of normal gravity)"));
155 s.valueDisplayMultiplier = 0.125; // show gravity in percent
156 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
157 e.savedValue = 200; // good on silvercity
160 me.TD(me, 1, 1.6, s);
162 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
165 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling Hook"),
166 _("Players spawn with the grappling hook. Press the 'hook' key to use it")));
169 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jetpack"),
170 _("Players spawn with the jetpack. Double-tap 'jump' or press the 'jetpack' key to use it")));
173 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_invincible_projectiles", _("Invincible Projectiles"),
174 _("Projectiles can't be destroyed. However, you can still explode Electro orbs with the Electro primary fire")));
175 setDependent(e, "g_instagib", 0, 0);
178 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_new_toys", _("New Toys"),
179 _("Some weapon spawns will be randomly replaced with new weapons: Heavy Laser Assault Cannon, Mine Layer, Rifle, T.A.G. Seeker")));
180 setDependentWeird(e, checkCompatibility_newtoys);
183 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_rocket_flying", _("Rocket Flying"),
184 _("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")));
185 setDependent(e, "g_instagib", 0, 0);
188 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_pinata", _("PiƱata"),
189 _("Players will drop all weapons they possessed when they are killed")));
190 setDependentWeird(e, checkCompatibility_pinata);
193 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_weapon_stay", _("Weapons stay"),
194 _("Weapons stay after they are picked up")));
195 setDependentWeird(e, checkCompatibility_weaponstay);
198 me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
199 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
200 string weaponarena_tooltip = strzone(_("Players will be given a set of weapons at spawn as well as unlimited ammo, without weapon pickups"));
202 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon arenas:")));
205 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Custom weapons"), weaponarena_tooltip));
206 e.cvarValueIsAnotherCvar = true;
207 e.cvarOffValue = "0";
209 me.TDempty(me, 0.1); // fix initial position
210 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
212 w = REGISTRY_GET(Weapons, i);
213 if (w.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK))
220 me.TD(me, 1, 1.2, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
221 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
227 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"), weaponarena_tooltip));
228 e.cvarOffValue = "0";
231 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"), weaponarena_tooltip));
232 e.cvarOffValue = "0";
234 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
237 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
238 _("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.")));
239 e.cvarOffValue = "0";
242 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
243 _("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.")));
244 e.cvarOffValue = "0";
247 me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
248 _("Always carry the blaster as an additional weapon in Nix")));
249 setDependent(e, "g_nix", 1, 1);
252 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_balance_blaster_weaponstartoverride", "0", _("No start weapons"), "-"));
253 e.cvarOffValue = "-1";
254 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");
256 me.gotoRC(me, me.rows - 1, 0);
257 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
258 e.onClick = Dialog_Close;
259 e.onClickEntity = me;
262 .void(entity) refilter;
264 void XonoticMutatorsDialog_close(entity me)
266 if(me.refilterEntity)
267 me.refilterEntity.refilter(me.refilterEntity);
268 SUPER(XonoticMutatorsDialog).close(me);