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 FOREACH(Weapons, it != WEP_Null, {
41 if(argv(j) == it.netname)
42 s = cons_mid(s, " & ", it.m_name);
45 s = sprintf(_("%s Arena"), s);
47 strcpy(weaponarenastring, s);
49 return weaponarenastring;
52 string XonoticMutatorsDialog_toString(entity me)
56 s = cons_mid(s, ", ", _("Dodging"));
57 if(cvar("g_instagib"))
58 s = cons_mid(s, ", ", _("InstaGib"));
59 if(cvar("g_new_toys"))
60 s = cons_mid(s, ", ", _("New Toys"));
62 s = cons_mid(s, ", ", _("NIX"));
63 if(cvar("g_rocket_flying"))
64 s = cons_mid(s, ", ", _("Rocket Flying"));
65 if(cvar("g_invincible_projectiles"))
66 s = cons_mid(s, ", ", _("Invincible Projectiles"));
67 if(cvar_string("g_weaponarena") != "0")
68 s = cons_mid(s, ", ", WeaponArenaString());
69 else if(cvar("g_balance_blaster_weaponstartoverride") == 0)
70 s = cons_mid(s, ", ", _("No start weapons"));
71 if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
72 s = cons_mid(s, ", ", _("Low gravity"));
74 s = cons_mid(s, ", ", _("Cloaked"));
75 if(cvar("g_grappling_hook"))
76 s = cons_mid(s, ", ", _("Hook"));
78 s = cons_mid(s, ", ", _("Midair"));
79 if(cvar("g_melee_only"))
80 s = cons_mid(s, ", ", _("Melee only"));
82 s = cons_mid(s, ", ", _("Vampire"));
84 s = cons_mid(s, ", ", _("Piñata"));
85 if(cvar("g_weapon_stay"))
86 s = cons_mid(s, ", ", _("Weapons stay"));
87 if(cvar("g_bloodloss") > 0)
88 s = cons_mid(s, ", ", _("Blood loss"));
90 s = cons_mid(s, ", ", _("Jet pack"));
91 if(cvar("g_buffs") > 0)
92 s = cons_mid(s, ", ", _("Buffs"));
93 if(cvar("g_overkill"))
94 s = cons_mid(s, ", ", _("Overkill"));
95 if(cvar("g_powerups") == 0)
96 s = cons_mid(s, ", ", _("No powerups"));
97 if(cvar("g_powerups") > 0)
98 s = cons_mid(s, ", ", _("Powerups"));
99 if(cvar("g_touchexplode") > 0)
100 s = cons_mid(s, ", ", _("Touch explode"));
101 if(cvar("g_walljump"))
102 s = cons_mid(s, ", ", _("Wall jumping"));
104 return ZCTX(_("MUT^None"));
109 float checkCompatibility_pinata(entity me)
111 if(cvar("g_instagib"))
115 if(cvar("g_overkill"))
117 if(cvar("g_melee_only"))
119 if(cvar_string("g_weaponarena") != "0")
123 float checkCompatibility_weaponstay(entity me)
125 return checkCompatibility_pinata(me);
127 float checkCompatibility_newtoys(entity me)
129 if(cvar("g_instagib"))
131 if(cvar_string("g_weaponarena") == "most")
133 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
135 if(cvar_string("g_weaponarena") != "0")
139 float checkCompatibility_weaponarena_weapon(entity me)
141 if(cvar("g_instagib"))
143 if(cvar_string("g_weaponarena") == "most")
145 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
147 if(cvar_string("g_weaponarena") == "0")
149 if(cvar_string("g_balance_blaster_weaponstartoverride") == "0")
154 void XonoticMutatorsDialog_fill(entity me)
159 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
162 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
163 _("Enable dodging")));
166 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
169 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
170 _("All players are almost invisible")));
173 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
174 e.cvarOffValue = "-1"; // TODO: make this a radio button?
177 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
178 _("Only possible to inflict damage on your enemy while they're airborne")));
181 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
182 _("Damage done to your enemy gets added to your own health")));
183 setDependent(e, "g_instagib", 0, 0);
186 s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
187 _("Amount of health below which your player gets stunned because of blood loss"));
188 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
189 setDependent(e, "g_instagib", 0, 0);
192 me.TD(me, 1, 1.6, s);
195 s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
196 _("Make things fall to the ground slower, lower value means lower gravity"));
198 s.valueDisplayMultiplier = 0.125; // show gravity in percent
199 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
200 e.savedValue = 200; // good on silvercity
203 me.TD(me, 1, 1.6, s);
205 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
208 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling hook"),
209 _("Players spawn with the grappling hook")));
212 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jet pack"),
213 _("Players spawn with the jetpack")));
216 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
217 setDependent(e, "g_instagib", 0, 0);
220 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
221 setDependentWeird(e, checkCompatibility_newtoys);
224 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
225 setDependent(e, "g_instagib", 0, 0);
228 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_pinata", _("Piñata"),
229 _("Players will drop all weapons they possessed when they are killed")));
230 setDependentWeird(e, checkCompatibility_pinata);
233 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_weapon_stay", _("Weapons stay"),
234 _("Weapons stay after they are picked up")));
235 setDependentWeird(e, checkCompatibility_weaponstay);
238 me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
239 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
240 string weaponarena_tooltip = strzone(_("Players will be given a set of weapons at spawn as well as unlimited ammo, without weapon pickups"));
242 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon arenas:")));
245 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Custom weapons"), weaponarena_tooltip));
246 e.cvarValueIsAnotherCvar = true;
247 e.cvarOffValue = "0";
249 me.TDempty(me, 0.1); // fix initial position
250 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
253 if(w.spawnflags & WEP_FLAG_HIDDEN)
262 me.TD(me, 1, 1.7, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
263 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
269 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"), weaponarena_tooltip));
270 e.cvarOffValue = "0";
273 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"), weaponarena_tooltip));
274 e.cvarOffValue = "0";
276 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
279 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
280 _("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.")));
281 e.cvarOffValue = "0";
284 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
285 _("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.")));
286 e.cvarOffValue = "0";
289 me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
290 _("Always carry the blaster as an additional weapon in Nix")));
291 setDependent(e, "g_nix", 1, 1);
294 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_balance_blaster_weaponstartoverride", "0", _("No start weapons"), "-"));
295 e.cvarOffValue = "-1";
296 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");
298 me.gotoRC(me, me.rows - 1, 0);
299 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
300 e.onClick = Dialog_Close;
301 e.onClickEntity = me;
304 .void(entity) refilter;
306 void XonoticMutatorsDialog_close(entity me)
308 if(me.refilterEntity)
309 me.refilterEntity.refilter(me.refilterEntity);
310 SUPER(XonoticMutatorsDialog).close(me);