2 CLASS(XonoticMutatorsDialog) EXTENDS(XonoticDialog)
3 METHOD(XonoticMutatorsDialog, toString, string(entity))
4 METHOD(XonoticMutatorsDialog, fill, void(entity))
5 METHOD(XonoticMutatorsDialog, showNotify, void(entity))
6 METHOD(XonoticMutatorsDialog, close, void(entity))
7 ATTRIB(XonoticMutatorsDialog, title, string, _("Mutators"))
8 ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
9 ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
10 ATTRIB(XonoticMutatorsDialog, rows, float, 19)
11 ATTRIB(XonoticMutatorsDialog, columns, float, 6)
12 ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
13 ENDCLASS(XonoticMutatorsDialog)
17 void XonoticMutatorsDialog_showNotify(entity me)
22 string weaponarenastring;
23 string weaponarenastring_cvar;
24 string WeaponArenaString()
29 s = cvar_string("g_weaponarena");
33 return _("All Weapons Arena");
35 return _("Most Weapons Arena");
36 if(s == weaponarenastring_cvar)
37 return weaponarenastring;
39 strunzone(weaponarenastring);
40 if(weaponarenastring_cvar)
41 strunzone(weaponarenastring_cvar);
43 weaponarenastring_cvar = strzone(s);
45 n = tokenize_console(s);
47 for(i = 0; i < n; ++i)
49 for(j = WEP_FIRST; j <= WEP_LAST; ++j)
51 e = get_weaponinfo(j);
52 if(argv(i) == e.netname)
53 s = strcat(s, " & ", e.message);
56 s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
58 weaponarenastring = strzone(s);
60 return weaponarenastring;
63 string XonoticMutatorsDialog_toString(entity me)
68 s = strcat(s, ", ", _("Dodging"));
69 if(cvar("g_minstagib"))
70 s = strcat(s, ", ", _("MinstaGib"));
71 if(cvar("g_new_toys"))
72 s = strcat(s, ", ", _("New Toys"));
74 s = strcat(s, ", ", _("NIX"));
75 if(cvar("g_rocket_flying"))
76 s = strcat(s, ", ", _("Rocket Flying"));
77 if(cvar("g_invincible_projectiles"))
78 s = strcat(s, ", ", _("Invincible Projectiles"));
79 if(cvar_string("g_weaponarena") != "0")
80 s = strcat(s, ", ", WeaponArenaString());
81 if(cvar("g_start_weapon_laser") == 0)
82 s = strcat(s, ", ", _("No start weapons"));
83 if(cvar("sv_gravity") < 800)
84 s = strcat(s, ", ", _("Low gravity"));
86 s = strcat(s, ", ", _("Cloaked"));
87 if(cvar("g_grappling_hook"))
88 s = strcat(s, ", ", _("Hook"));
90 s = strcat(s, ", ", _("Midair"));
92 s = strcat(s, ", ", _("Vampire"));
94 s = strcat(s, ", ", _("Piñata"));
95 if(cvar("g_weapon_stay"))
96 s = strcat(s, ", ", _("Weapons stay"));
97 if(cvar("g_bloodloss") > 0)
98 s = strcat(s, ", ", _("Blood loss"));
100 s = strcat(s, ", ", _("Jet pack"));
101 if(cvar("g_powerups") == 0)
102 s = strcat(s, ", ", _("No powerups"));
103 if(cvar("g_powerups") > 0)
104 s = strcat(s, ", ", _("Powerups"));
106 return ZCTX(_("MUT^None"));
108 return substring(s, 2, strlen(s) - 2);
111 float checkCompatibility_pinata(entity me)
113 if(cvar("g_minstagib"))
117 if(cvar_string("g_weaponarena") != "0")
121 float checkCompatibility_weaponstay(entity me)
123 return checkCompatibility_pinata(me);
125 float checkCompatibility_newtoys(entity me)
127 if(cvar("g_minstagib"))
129 if(cvar_string("g_weaponarena") == "most")
131 if(cvar_string("g_weaponarena") == "all")
133 if(cvar_string("g_weaponarena") != "0")
137 float checkCompatibility_weaponarena_weapon(entity me)
139 if(cvar("g_minstagib"))
141 if(cvar_string("g_weaponarena") == "most")
143 if(cvar_string("g_weaponarena") == "all")
145 if(cvar_string("g_weaponarena") == "0")
147 if(cvar_string("g_start_weapon_laser") == "0")
152 void XonoticMutatorsDialog_fill(entity me)
157 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
160 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_dodging", _("Dodging")));
163 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_cloaked", _("Cloaked")));
166 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_midair", _("Midair")));
169 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_vampire", _("Vampire")));
172 s = makeXonoticSlider(10, 50, 1, "g_bloodloss");
173 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
174 setDependent(e, "g_minstagib", 0, 0);
177 me.TD(me, 1, 1.6, s);
180 s = makeXonoticSlider(80, 400, 8, "sv_gravity");
182 s.valueDisplayMultiplier = 0.125; // show gravity in percent
183 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
184 e.savedValue = 200; // good on silvercity
187 me.TD(me, 1, 1.6, s);
189 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
192 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_grappling_hook", _("Grappling hook")));
195 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_jetpack", _("Jet pack")));
198 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
201 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
202 setDependentWeird(e, checkCompatibility_newtoys);
205 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
208 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_pinata", _("Piñata")));
209 setDependentWeird(e, checkCompatibility_pinata);
212 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_weapon_stay", _("Weapons stay")));
213 setDependentWeird(e, checkCompatibility_weaponstay);
216 me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
217 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
219 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:")));
220 e.getCvarValueFromCvar = TRUE;
221 e.cvarOffValue = "0";
222 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
224 w = get_weaponinfo(i);
225 if(w.spawnflags & WEP_FLAG_HIDDEN)
230 me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.message)));
231 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
236 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
239 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_minstagib", string_null, _("MinstaGib")));
242 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_nix", string_null, _("NIX")));
245 me.TD(me, 1, 1.6, e = makeXonoticCheckBox(0, "g_nix_with_laser", _("with laser")));
246 setDependent(e, "g_nix", 1, 1);
249 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "most", _("Most weapons")));
250 e.cvarOffValue = "0";
253 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_start_weapon_laser", "0", _("No start weapons")));
254 e.cvarOffValue = "-1";
255 makeMulti(e, "g_start_weapon_shotgun g_start_weapon_uzi g_start_weapon_grenadelauncher g_start_weapon_minelayer g_start_weapon_electro g_start_weapon_crylink g_start_weapon_nex g_start_weapon_hagar g_start_weapon_rocketlauncher g_start_weapon_rifle g_start_weapon_hlac g_start_weapon_seeker g_start_weapon_minstanex g_start_weapon_hook g_start_weapon_porto g_start_weapon_tuba g_start_weapon_minelayer");
257 me.gotoRC(me, me.rows - 1, 0);
258 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
259 e.onClick = Dialog_Close;
260 e.onClickEntity = me;
263 void XonoticMutatorsDialog_close(entity me)
265 if(me.refilterEntity)
266 me.refilterEntity.refilter(me.refilterEntity);
267 SUPER(XonoticMutatorsDialog).close(me);