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 = Weapons_fromstr(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)
57 s = cons_mid(s, ", ", _("Dodging"));
58 if(cvar("g_instagib"))
59 s = cons_mid(s, ", ", _("InstaGib"));
60 if(cvar("g_new_toys"))
61 s = cons_mid(s, ", ", _("New Toys"));
63 s = cons_mid(s, ", ", _("NIX"));
64 if(cvar("g_rocket_flying"))
65 s = cons_mid(s, ", ", _("Rocket Flying"));
66 if(cvar("g_invincible_projectiles"))
67 s = cons_mid(s, ", ", _("Invincible Projectiles"));
68 if(cvar_string("g_weaponarena") != "0")
69 s = cons_mid(s, ", ", WeaponArenaString());
70 else if(cvar("g_balance_blaster_weaponstartoverride") == 0)
71 s = cons_mid(s, ", ", _("No start weapons"));
72 if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
73 s = cons_mid(s, ", ", _("Low gravity"));
75 s = cons_mid(s, ", ", _("Cloaked"));
76 if(cvar("g_grappling_hook"))
77 s = cons_mid(s, ", ", _("Hook"));
79 s = cons_mid(s, ", ", _("Midair"));
80 if(cvar("g_melee_only"))
81 s = cons_mid(s, ", ", _("Melee only"));
83 s = cons_mid(s, ", ", _("Vampire"));
85 s = cons_mid(s, ", ", _("Piñata"));
86 if(cvar("g_weapon_stay"))
87 s = cons_mid(s, ", ", _("Weapons stay"));
88 if(cvar("g_bloodloss") > 0)
89 s = cons_mid(s, ", ", _("Blood loss"));
91 s = cons_mid(s, ", ", _("Jetpack"));
92 if(cvar("g_buffs") > 0)
93 s = cons_mid(s, ", ", _("Buffs"));
94 if(cvar("g_overkill"))
95 s = cons_mid(s, ", ", _("Overkill"));
96 if(cvar("g_powerups") == 0)
97 s = cons_mid(s, ", ", _("No powerups"));
98 if(cvar("g_powerups") > 0)
99 s = cons_mid(s, ", ", _("Powerups"));
100 if(cvar("g_touchexplode") > 0)
101 s = cons_mid(s, ", ", _("Touch explode"));
102 if(cvar("g_walljump"))
103 s = cons_mid(s, ", ", _("Wall jumping"));
105 return ZCTX(_("MUT^None"));
110 float checkCompatibility_pinata(entity me)
112 if(cvar("g_instagib"))
116 if(cvar("g_overkill"))
118 if(cvar("g_melee_only"))
120 if(cvar_string("g_weaponarena") != "0")
124 float checkCompatibility_weaponstay(entity me)
126 return checkCompatibility_pinata(me);
128 float checkCompatibility_newtoys(entity me)
130 if(cvar("g_instagib"))
132 if(cvar_string("g_weaponarena") == "most")
134 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
136 if(cvar_string("g_weaponarena") != "0")
140 float checkCompatibility_weaponarena_weapon(entity me)
142 if(cvar("g_instagib"))
144 if(cvar_string("g_weaponarena") == "most")
146 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
148 if(cvar_string("g_weaponarena") == "0")
150 if(cvar_string("g_balance_blaster_weaponstartoverride") == "0")
155 void XonoticMutatorsDialog_fill(entity me)
160 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
163 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
164 _("Enable dodging")));
167 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
170 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
171 _("All players are almost invisible")));
174 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
175 e.cvarOffValue = "-1"; // TODO: make this a radio button?
178 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
179 _("Only possible to inflict damage on your enemy while they're airborne")));
182 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
183 _("Damage done to your enemy gets added to your own health")));
184 setDependent(e, "g_instagib", 0, 0);
187 s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
188 _("Amount of health below which your player gets stunned because of blood loss"));
189 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
190 setDependent(e, "g_instagib", 0, 0);
193 me.TD(me, 1, 1.6, s);
196 s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
197 _("Make things fall to the ground slower, lower value means lower gravity"));
199 s.valueDisplayMultiplier = 0.125; // show gravity in percent
200 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
201 e.savedValue = 200; // good on silvercity
204 me.TD(me, 1, 1.6, s);
206 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
209 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling hook"),
210 _("Players spawn with the grappling hook")));
213 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jetpack"),
214 _("Players spawn with the jetpack")));
217 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
218 setDependent(e, "g_instagib", 0, 0);
221 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
222 setDependentWeird(e, checkCompatibility_newtoys);
225 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
226 setDependent(e, "g_instagib", 0, 0);
229 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_pinata", _("Piñata"),
230 _("Players will drop all weapons they possessed when they are killed")));
231 setDependentWeird(e, checkCompatibility_pinata);
234 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_weapon_stay", _("Weapons stay"),
235 _("Weapons stay after they are picked up")));
236 setDependentWeird(e, checkCompatibility_weaponstay);
239 me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
240 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
241 string weaponarena_tooltip = strzone(_("Players will be given a set of weapons at spawn as well as unlimited ammo, without weapon pickups"));
243 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon arenas:")));
246 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Custom weapons"), weaponarena_tooltip));
247 e.cvarValueIsAnotherCvar = true;
248 e.cvarOffValue = "0";
250 me.TDempty(me, 0.1); // fix initial position
251 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
254 if(w.spawnflags & WEP_FLAG_HIDDEN)
261 me.TD(me, 1, 1.2, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
262 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
268 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"), weaponarena_tooltip));
269 e.cvarOffValue = "0";
272 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"), weaponarena_tooltip));
273 e.cvarOffValue = "0";
275 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
278 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
279 _("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.")));
280 e.cvarOffValue = "0";
283 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
284 _("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.")));
285 e.cvarOffValue = "0";
288 me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
289 _("Always carry the blaster as an additional weapon in Nix")));
290 setDependent(e, "g_nix", 1, 1);
293 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_balance_blaster_weaponstartoverride", "0", _("No start weapons"), "-"));
294 e.cvarOffValue = "-1";
295 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");
297 me.gotoRC(me, me.rows - 1, 0);
298 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
299 e.onClick = Dialog_Close;
300 e.onClickEntity = me;
303 .void(entity) refilter;
305 void XonoticMutatorsDialog_close(entity me)
307 if(me.refilterEntity)
308 me.refilterEntity.refilter(me.refilterEntity);
309 SUPER(XonoticMutatorsDialog).close(me);