1 #include "../../common/weapons/weapons.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()
33 s = cvar_string("g_weaponarena");
36 if(s == "all" || s == "1")
37 return _("All Weapons Arena");
39 return _("Most Weapons Arena");
40 if(s == weaponarenastring_cvar)
41 return weaponarenastring;
43 strunzone(weaponarenastring);
44 if(weaponarenastring_cvar)
45 strunzone(weaponarenastring_cvar);
47 weaponarenastring_cvar = strzone(s);
49 n = tokenize_console(s);
51 for(i = 0; i < n; ++i)
53 for(j = WEP_FIRST; j <= WEP_LAST; ++j)
55 e = get_weaponinfo(j);
56 if(argv(i) == e.netname)
57 s = strcat(s, " & ", e.message);
60 s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
62 weaponarenastring = strzone(s);
64 return weaponarenastring;
67 string XonoticMutatorsDialog_toString(entity me)
72 s = strcat(s, ", ", _("Dodging"));
73 if(cvar("g_instagib"))
74 s = strcat(s, ", ", _("InstaGib"));
75 if(cvar("g_new_toys"))
76 s = strcat(s, ", ", _("New Toys"));
78 s = strcat(s, ", ", _("NIX"));
79 if(cvar("g_rocket_flying"))
80 s = strcat(s, ", ", _("Rocket Flying"));
81 if(cvar("g_invincible_projectiles"))
82 s = strcat(s, ", ", _("Invincible Projectiles"));
83 if(cvar_string("g_weaponarena") != "0")
84 s = strcat(s, ", ", WeaponArenaString());
85 if(cvar("g_balance_blaster_weaponstart") == 0)
86 s = strcat(s, ", ", _("No start weapons"));
87 if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
88 s = strcat(s, ", ", _("Low gravity"));
90 s = strcat(s, ", ", _("Cloaked"));
91 if(cvar("g_grappling_hook"))
92 s = strcat(s, ", ", _("Hook"));
94 s = strcat(s, ", ", _("Midair"));
96 s = strcat(s, ", ", _("Vampire"));
98 s = strcat(s, ", ", _("Piñata"));
99 if(cvar("g_weapon_stay"))
100 s = strcat(s, ", ", _("Weapons stay"));
101 if(cvar("g_bloodloss") > 0)
102 s = strcat(s, ", ", _("Blood loss"));
103 if(cvar("g_jetpack"))
104 s = strcat(s, ", ", _("Jet pack"));
106 s = strcat(s, ", ", _("Buffs"));
107 if(cvar("g_overkill"))
108 s = strcat(s, ", ", _("Overkill"));
109 if(cvar("g_powerups") == 0)
110 s = strcat(s, ", ", _("No powerups"));
111 if(cvar("g_powerups") > 0)
112 s = strcat(s, ", ", _("Powerups"));
113 if(cvar("g_touchexplode") > 0)
114 s = strcat(s, ", ", _("Touch explode"));
116 return ZCTX(_("MUT^None"));
118 return substring(s, 2, strlen(s) - 2);
121 float checkCompatibility_pinata(entity me)
123 if(cvar("g_instagib"))
127 if(cvar_string("g_weaponarena") != "0")
131 float checkCompatibility_weaponstay(entity me)
133 return checkCompatibility_pinata(me);
135 float checkCompatibility_newtoys(entity me)
137 if(cvar("g_instagib"))
139 if(cvar_string("g_weaponarena") == "most")
141 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
143 if(cvar_string("g_weaponarena") != "0")
147 float checkCompatibility_weaponarena_weapon(entity me)
149 if(cvar("g_instagib"))
151 if(cvar_string("g_weaponarena") == "most")
153 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
155 if(cvar_string("g_weaponarena") == "0")
157 if(cvar_string("g_balance_blaster_weaponstart") == "0")
162 void XonoticMutatorsDialog_fill(entity me)
167 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
170 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_dodging", _("Dodging")));
173 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
176 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_cloaked", _("Cloaked")));
179 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
182 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_midair", _("Midair")));
185 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_vampire", _("Vampire")));
186 setDependent(e, "g_instagib", 0, 0);
189 s = makeXonoticSlider(10, 50, 1, "g_bloodloss");
190 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
191 setDependent(e, "g_instagib", 0, 0);
194 me.TD(me, 1, 1.6, s);
197 s = makeXonoticSlider(80, 400, 8, "sv_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(0, "g_grappling_hook", _("Grappling hook")));
212 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_jetpack", _("Jet pack")));
215 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
216 setDependent(e, "g_instagib", 0, 0);
219 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
220 setDependentWeird(e, checkCompatibility_newtoys);
223 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
224 setDependent(e, "g_instagib", 0, 0);
227 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_pinata", _("Piñata")));
228 setDependentWeird(e, checkCompatibility_pinata);
231 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_weapon_stay", _("Weapons stay")));
232 setDependentWeird(e, checkCompatibility_weaponstay);
235 me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
236 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
238 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:")));
239 e.getCvarValueFromCvar = true;
240 e.cvarOffValue = "0";
241 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
243 w = get_weaponinfo(i);
244 if(w.spawnflags & WEP_FLAG_HIDDEN)
249 me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.message)));
250 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
255 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "most", _("Most weapons")));
256 e.cvarOffValue = "0";
259 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "all", _("All weapons")));
260 e.cvarOffValue = "0";
262 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
265 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_instagib", "1", _("InstaGib")));
266 e.cvarOffValue = "0";
269 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_nix", "1", _("NIX")));
270 e.cvarOffValue = "0";
273 me.TD(me, 1, 1.6, e = makeXonoticCheckBox(0, "g_nix_with_blaster", _("with blaster")));
274 setDependent(e, "g_nix", 1, 1);
277 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_balance_blaster_weaponstart", "0", _("No start weapons")));
278 e.cvarOffValue = "-1";
279 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");
281 me.gotoRC(me, me.rows - 1, 0);
282 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
283 e.onClick = Dialog_Close;
284 e.onClickEntity = me;
287 void XonoticMutatorsDialog_close(entity me)
289 if(me.refilterEntity)
290 me.refilterEntity.refilter(me.refilterEntity);
291 SUPER(XonoticMutatorsDialog).close(me);