1 #include "../../common/weapons/weapons.qh"
3 #ifndef DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
4 #define DIALOG_MULTIPLAYER_CREATE_MUTATORS_H
5 CLASS(XonoticMutatorsDialog, XonoticDialog)
6 METHOD(XonoticMutatorsDialog, toString, string(entity))
7 METHOD(XonoticMutatorsDialog, fill, void(entity))
8 METHOD(XonoticMutatorsDialog, showNotify, void(entity))
9 METHOD(XonoticMutatorsDialog, close, void(entity))
10 ATTRIB(XonoticMutatorsDialog, title, string, _("Mutators"))
11 ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
12 ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
13 ATTRIB(XonoticMutatorsDialog, rows, float, 20)
14 ATTRIB(XonoticMutatorsDialog, columns, float, 6)
15 ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
16 ENDCLASS(XonoticMutatorsDialog)
20 void XonoticMutatorsDialog_showNotify(entity me)
25 string weaponarenastring;
26 string weaponarenastring_cvar;
27 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 for(j = WEP_FIRST; j <= WEP_LAST; ++j)
54 e = get_weaponinfo(j);
55 if(argv(i) == e.netname)
56 s = strcat(s, " & ", e.message);
59 s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
61 weaponarenastring = strzone(s);
63 return weaponarenastring;
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 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(cvar("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(0, "g_dodging", _("Dodging")));
172 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_touchexplode", _("Touch explode")));
175 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_cloaked", _("Cloaked")));
178 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_buffs", _("Buffs")));
181 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_midair", _("Midair")));
184 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_vampire", _("Vampire")));
185 setDependent(e, "g_instagib", 0, 0);
188 s = makeXonoticSlider(10, 50, 1, "g_bloodloss");
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(80, 400, 8, "sv_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(0, "g_grappling_hook", _("Grappling hook")));
211 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_jetpack", _("Jet pack")));
214 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
215 setDependent(e, "g_instagib", 0, 0);
218 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
219 setDependentWeird(e, checkCompatibility_newtoys);
222 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
223 setDependent(e, "g_instagib", 0, 0);
226 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_pinata", _("Piñata")));
227 setDependentWeird(e, checkCompatibility_pinata);
230 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_weapon_stay", _("Weapons stay")));
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(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:")));
238 e.getCvarValueFromCvar = true;
239 e.cvarOffValue = "0";
240 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
242 w = get_weaponinfo(i);
243 if(w.spawnflags & WEP_FLAG_HIDDEN)
248 me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.message)));
249 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
254 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "most", _("Most weapons")));
255 e.cvarOffValue = "0";
258 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "all", _("All weapons")));
259 e.cvarOffValue = "0";
261 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
264 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_instagib", "1", _("InstaGib")));
265 e.cvarOffValue = "0";
268 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_nix", "1", _("NIX")));
269 e.cvarOffValue = "0";
272 me.TD(me, 1, 1.6, e = makeXonoticCheckBox(0, "g_nix_with_blaster", _("with blaster")));
273 setDependent(e, "g_nix", 1, 1);
276 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_balance_blaster_weaponstart", "0", _("No start weapons")));
277 e.cvarOffValue = "-1";
278 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");
280 me.gotoRC(me, me.rows - 1, 0);
281 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
282 e.onClick = Dialog_Close;
283 e.onClickEntity = me;
286 void XonoticMutatorsDialog_close(entity me)
288 if(me.refilterEntity)
289 me.refilterEntity.refilter(me.refilterEntity);
290 SUPER(XonoticMutatorsDialog).close(me);