1 #include "../../common/weapons/all.qh"
3 #ifndef DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
4 #define DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
6 CLASS(XonoticMutatorsDialog, XonoticDialog)
7 METHOD(XonoticMutatorsDialog, toString, string(entity));
8 METHOD(XonoticMutatorsDialog, fill, void(entity));
9 METHOD(XonoticMutatorsDialog, showNotify, void(entity));
10 METHOD(XonoticMutatorsDialog, close, void(entity));
11 ATTRIB(XonoticMutatorsDialog, title, string, _("Mutators"))
12 ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
13 ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
14 ATTRIB(XonoticMutatorsDialog, rows, float, 20)
15 ATTRIB(XonoticMutatorsDialog, columns, float, 6)
16 ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
17 ENDCLASS(XonoticMutatorsDialog)
21 void XonoticMutatorsDialog_showNotify(entity me)
26 string weaponarenastring;
27 string weaponarenastring_cvar;
28 string WeaponArenaString()
32 s = cvar_string("g_weaponarena");
35 if(s == "all" || s == "1")
36 return _("All Weapons Arena");
38 return _("Most Weapons Arena");
39 if(s == weaponarenastring_cvar)
40 return weaponarenastring;
42 strunzone(weaponarenastring);
43 if(weaponarenastring_cvar)
44 strunzone(weaponarenastring_cvar);
46 weaponarenastring_cvar = strzone(s);
48 n = tokenize_console(s);
50 for(i = 0; i < n; ++i)
52 FOREACH(Weapons, it != WEP_Null, LAMBDA(
53 if(argv(i) == it.netname)
54 s = strcat(s, " & ", it.m_name);
57 s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
59 weaponarenastring = strzone(s);
61 return weaponarenastring;
64 AUTOCVAR(g_grappling_hook, bool, _("let players spawn with the grappling hook which allows them to pull themselves up"));
66 string XonoticMutatorsDialog_toString(entity me)
71 s = strcat(s, ", ", _("Dodging"));
72 if(cvar("g_instagib"))
73 s = strcat(s, ", ", _("InstaGib"));
74 if(cvar("g_new_toys"))
75 s = strcat(s, ", ", _("New Toys"));
77 s = strcat(s, ", ", _("NIX"));
78 if(cvar("g_rocket_flying"))
79 s = strcat(s, ", ", _("Rocket Flying"));
80 if(cvar("g_invincible_projectiles"))
81 s = strcat(s, ", ", _("Invincible Projectiles"));
82 if(cvar_string("g_weaponarena") != "0")
83 s = strcat(s, ", ", WeaponArenaString());
84 else if(cvar("g_balance_blaster_weaponstart") == 0)
85 s = strcat(s, ", ", _("No start weapons"));
86 if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
87 s = strcat(s, ", ", _("Low gravity"));
89 s = strcat(s, ", ", _("Cloaked"));
90 if(autocvar_g_grappling_hook)
91 s = strcat(s, ", ", _("Hook"));
93 s = strcat(s, ", ", _("Midair"));
95 s = strcat(s, ", ", _("Vampire"));
97 s = strcat(s, ", ", _("Piñata"));
98 if(cvar("g_weapon_stay"))
99 s = strcat(s, ", ", _("Weapons stay"));
100 if(cvar("g_bloodloss") > 0)
101 s = strcat(s, ", ", _("Blood loss"));
102 if(cvar("g_jetpack"))
103 s = strcat(s, ", ", _("Jet pack"));
105 s = strcat(s, ", ", _("Buffs"));
106 if(cvar("g_overkill"))
107 s = strcat(s, ", ", _("Overkill"));
108 if(cvar("g_powerups") == 0)
109 s = strcat(s, ", ", _("No powerups"));
110 if(cvar("g_powerups") > 0)
111 s = strcat(s, ", ", _("Powerups"));
112 if(cvar("g_touchexplode") > 0)
113 s = strcat(s, ", ", _("Touch explode"));
115 return ZCTX(_("MUT^None"));
117 return substring(s, 2, strlen(s) - 2);
120 float checkCompatibility_pinata(entity me)
122 if(cvar("g_instagib"))
126 if(cvar_string("g_weaponarena") != "0")
130 float checkCompatibility_weaponstay(entity me)
132 return checkCompatibility_pinata(me);
134 float checkCompatibility_newtoys(entity me)
136 if(cvar("g_instagib"))
138 if(cvar_string("g_weaponarena") == "most")
140 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
142 if(cvar_string("g_weaponarena") != "0")
146 float checkCompatibility_weaponarena_weapon(entity me)
148 if(cvar("g_instagib"))
150 if(cvar_string("g_weaponarena") == "most")
152 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
154 if(cvar_string("g_weaponarena") == "0")
156 if(cvar_string("g_balance_blaster_weaponstart") == "0")
161 void XonoticMutatorsDialog_fill(entity me)
166 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
169 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
170 _("Enable dodging")));
173 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
176 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
177 _("All players are almost invisible")));
180 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
183 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
184 _("Only possible to inflict damage on your enemy while he's airborne")));
187 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
188 _("Damage done to your enemy gets added to your own health")));
189 setDependent(e, "g_instagib", 0, 0);
192 s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
193 _("Amount of health below which your player gets stunned because of blood loss"));
194 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
195 setDependent(e, "g_instagib", 0, 0);
198 me.TD(me, 1, 1.6, s);
201 s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
202 _("Make things fall to the ground slower, lower value means lower gravity"));
204 s.valueDisplayMultiplier = 0.125; // show gravity in percent
205 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
206 e.savedValue = 200; // good on silvercity
209 me.TD(me, 1, 1.6, s);
211 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
214 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling hook"),
215 _("Players spawn with the grappling hook")));
218 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jet pack"),
219 _("Players spawn with the jetpack")));
222 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
223 setDependent(e, "g_instagib", 0, 0);
226 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
227 setDependentWeird(e, checkCompatibility_newtoys);
230 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
231 setDependent(e, "g_instagib", 0, 0);
234 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_pinata", _("Piñata"),
235 _("Players will drop all weapons they possessed when they are killed")));
236 setDependentWeird(e, checkCompatibility_pinata);
239 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_weapon_stay", _("Weapons stay"),
240 _("Weapons stay after they are picked up")));
241 setDependentWeird(e, checkCompatibility_weaponstay);
244 me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
245 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
247 me.TD(me, 1, 2, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:"),
248 _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
249 e.cvarValueIsAnotherCvar = true;
250 e.cvarOffValue = "0";
251 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
254 if(w.spawnflags & WEP_FLAG_HIDDEN)
259 me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
260 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
265 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"),
266 _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
267 e.cvarOffValue = "0";
270 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"),
271 _("Selecting a weapon arena will give all players that weapon at spawn as well as unlimited ammo, and disable all other weapon pickups.")));
272 e.cvarOffValue = "0";
274 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
277 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
278 _("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.")));
279 e.cvarOffValue = "0";
282 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
283 _("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.")));
284 e.cvarOffValue = "0";
287 me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
288 _("Always carry the blaster as an additional weapon in Nix")));
289 setDependent(e, "g_nix", 1, 1);
292 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_balance_blaster_weaponstart", "0", _("No start weapons"), "-"));
293 e.cvarOffValue = "-1";
294 makeMulti(e, "g_balance_shotgun_weaponstart g_balance_machinegun_weaponstart g_balance_devastator_weaponstart g_balance_minelayer_weaponstart g_balance_electro_weaponstart g_balance_crylink_weaponstart g_balance_hagar_weaponstart g_balance_porto_weaponstart g_balance_vaporizer_weaponstart g_balance_hook_weaponstart g_balance_rifle_weaponstart g_balance_fireball_weaponstart g_balance_seeker_weaponstart g_balance_tuba_weaponstart g_balance_arc_weaponstart g_balance_vortex_weaponstart g_balance_mortar_weaponstart");
296 me.gotoRC(me, me.rows - 1, 0);
297 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
298 e.onClick = Dialog_Close;
299 e.onClickEntity = me;
302 void XonoticMutatorsDialog_close(entity me)
304 if(me.refilterEntity)
305 me.refilterEntity.refilter(me.refilterEntity);
306 SUPER(XonoticMutatorsDialog).close(me);