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 strunzone(weaponarenastring);
35 if(weaponarenastring_cvar)
36 strunzone(weaponarenastring_cvar);
38 weaponarenastring_cvar = strzone(s);
40 n = tokenize_console(s);
42 for(int j = 0; j < n; ++j)
44 FOREACH(Weapons, it != WEP_Null, {
45 if(argv(j) == it.netname)
46 s = cons_mid(s, " & ", it.m_name);
49 s = sprintf(_("%s Arena"), s);
51 weaponarenastring = strzone(s);
53 return weaponarenastring;
56 string XonoticMutatorsDialog_toString(entity me)
61 s = strcat(s, ", ", _("Dodging"));
62 if(cvar("g_instagib"))
63 s = strcat(s, ", ", _("InstaGib"));
64 if(cvar("g_new_toys"))
65 s = strcat(s, ", ", _("New Toys"));
67 s = strcat(s, ", ", _("NIX"));
68 if(cvar("g_rocket_flying"))
69 s = strcat(s, ", ", _("Rocket Flying"));
70 if(cvar("g_invincible_projectiles"))
71 s = strcat(s, ", ", _("Invincible Projectiles"));
72 if(cvar_string("g_weaponarena") != "0")
73 s = strcat(s, ", ", WeaponArenaString());
74 else if(cvar("g_balance_blaster_weaponstartoverride") == 0)
75 s = strcat(s, ", ", _("No start weapons"));
76 if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
77 s = strcat(s, ", ", _("Low gravity"));
79 s = strcat(s, ", ", _("Cloaked"));
80 if(cvar("g_grappling_hook"))
81 s = strcat(s, ", ", _("Hook"));
83 s = strcat(s, ", ", _("Midair"));
85 s = strcat(s, ", ", _("Vampire"));
87 s = strcat(s, ", ", _("Piñata"));
88 if(cvar("g_weapon_stay"))
89 s = strcat(s, ", ", _("Weapons stay"));
90 if(cvar("g_bloodloss") > 0)
91 s = strcat(s, ", ", _("Blood loss"));
93 s = strcat(s, ", ", _("Jet pack"));
94 if(cvar("g_buffs") > 0)
95 s = strcat(s, ", ", _("Buffs"));
96 if(cvar("g_overkill"))
97 s = strcat(s, ", ", _("Overkill"));
98 if(cvar("g_powerups") == 0)
99 s = strcat(s, ", ", _("No powerups"));
100 if(cvar("g_powerups") > 0)
101 s = strcat(s, ", ", _("Powerups"));
102 if(cvar("g_touchexplode") > 0)
103 s = strcat(s, ", ", _("Touch explode"));
105 return ZCTX(_("MUT^None"));
107 return substring(s, 2, strlen(s) - 2);
110 float checkCompatibility_pinata(entity me)
112 if(cvar("g_instagib"))
116 if(cvar_string("g_weaponarena") != "0")
120 float checkCompatibility_weaponstay(entity me)
122 return checkCompatibility_pinata(me);
124 float checkCompatibility_newtoys(entity me)
126 if(cvar("g_instagib"))
128 if(cvar_string("g_weaponarena") == "most")
130 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
132 if(cvar_string("g_weaponarena") != "0")
136 float checkCompatibility_weaponarena_weapon(entity me)
138 if(cvar("g_instagib"))
140 if(cvar_string("g_weaponarena") == "most")
142 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
144 if(cvar_string("g_weaponarena") == "0")
146 if(cvar_string("g_balance_blaster_weaponstartoverride") == "0")
151 void XonoticMutatorsDialog_fill(entity me)
156 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
159 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
160 _("Enable dodging")));
163 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
166 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
167 _("All players are almost invisible")));
170 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
173 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
174 _("Only possible to inflict damage on your enemy while he's airborne")));
177 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
178 _("Damage done to your enemy gets added to your own health")));
179 setDependent(e, "g_instagib", 0, 0);
182 s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
183 _("Amount of health below which your player gets stunned because of blood loss"));
184 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
185 setDependent(e, "g_instagib", 0, 0);
188 me.TD(me, 1, 1.6, s);
191 s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
192 _("Make things fall to the ground slower, lower value means lower gravity"));
194 s.valueDisplayMultiplier = 0.125; // show gravity in percent
195 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
196 e.savedValue = 200; // good on silvercity
199 me.TD(me, 1, 1.6, s);
201 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
204 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling hook"),
205 _("Players spawn with the grappling hook")));
208 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jet pack"),
209 _("Players spawn with the jetpack")));
212 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
213 setDependent(e, "g_instagib", 0, 0);
216 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
217 setDependentWeird(e, checkCompatibility_newtoys);
220 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
221 setDependent(e, "g_instagib", 0, 0);
224 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_pinata", _("Piñata"),
225 _("Players will drop all weapons they possessed when they are killed")));
226 setDependentWeird(e, checkCompatibility_pinata);
229 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_weapon_stay", _("Weapons stay"),
230 _("Weapons stay after they are picked up")));
231 setDependentWeird(e, checkCompatibility_weaponstay);
234 me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
235 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
237 me.TD(me, 1, 2, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:"),
238 _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
239 e.cvarValueIsAnotherCvar = true;
240 e.cvarOffValue = "0";
241 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
244 if(w.spawnflags & WEP_FLAG_HIDDEN)
249 me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
250 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
255 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"),
256 _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
257 e.cvarOffValue = "0";
260 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"),
261 _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
262 e.cvarOffValue = "0";
264 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
267 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
268 _("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.")));
269 e.cvarOffValue = "0";
272 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
273 _("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.")));
274 e.cvarOffValue = "0";
277 me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
278 _("Always carry the blaster as an additional weapon in Nix")));
279 setDependent(e, "g_nix", 1, 1);
282 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_balance_blaster_weaponstartoverride", "0", _("No start weapons"), "-"));
283 e.cvarOffValue = "-1";
284 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");
286 me.gotoRC(me, me.rows - 1, 0);
287 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
288 e.onClick = Dialog_Close;
289 e.onClickEntity = me;
292 .void(entity) refilter;
294 void XonoticMutatorsDialog_close(entity me)
296 if(me.refilterEntity)
297 me.refilterEntity.refilter(me.refilterEntity);
298 SUPER(XonoticMutatorsDialog).close(me);