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, name, string, _("Mutators"))
9 ATTRIB(XonoticMutatorsDialog, color, vector, SKINCOLOR_DIALOG_MUTATORS)
10 ATTRIB(XonoticMutatorsDialog, intendedWidth, float, 0.9)
11 ATTRIB(XonoticMutatorsDialog, rows, float, 19)
12 ATTRIB(XonoticMutatorsDialog, columns, float, 6)
13 ATTRIB(XonoticMutatorsDialog, refilterEntity, entity, NULL)
14 ENDCLASS(XonoticMutatorsDialog)
18 void XonoticMutatorsDialog_showNotify(entity me)
23 string weaponarenastring;
24 string weaponarenastring_cvar;
25 string WeaponArenaString()
30 s = cvar_string("g_weaponarena");
34 return _("All Weapons Arena");
36 return _("Most Weapons Arena");
37 if(s == weaponarenastring_cvar)
38 return weaponarenastring;
40 strunzone(weaponarenastring);
41 if(weaponarenastring_cvar)
42 strunzone(weaponarenastring_cvar);
44 weaponarenastring_cvar = strzone(s);
46 n = tokenize_console(s);
48 for(i = 0; i < n; ++i)
50 for(j = WEP_FIRST; j <= WEP_LAST; ++j)
52 e = get_weaponinfo(j);
53 if(argv(i) == e.netname)
54 s = strcat(s, " & ", e.message);
57 s = sprintf(_("%s Arena"), substring(s, 3, strlen(s) - 3));
59 weaponarenastring = strzone(s);
61 return weaponarenastring;
64 string XonoticMutatorsDialog_toString(entity me)
69 s = strcat(s, ", ", _("Dodging"));
70 if(cvar("g_minstagib"))
71 s = strcat(s, ", ", _("MinstaGib"));
72 if(cvar("g_new_toys"))
73 s = strcat(s, ", ", _("New Toys"));
75 s = strcat(s, ", ", _("NIX"));
76 if(cvar("g_rocket_flying"))
77 s = strcat(s, ", ", _("Rocket Flying"));
78 if(cvar("g_invincible_projectiles"))
79 s = strcat(s, ", ", _("Invincible Projectiles"));
80 if(cvar_string("g_weaponarena") != "0")
81 s = strcat(s, ", ", WeaponArenaString());
82 if(cvar("g_start_weapon_laser") == 0)
83 s = strcat(s, ", ", _("No start weapons"));
84 if(cvar("sv_gravity") < 800)
85 s = strcat(s, ", ", _("Low gravity"));
87 s = strcat(s, ", ", _("Cloaked"));
88 if(cvar("g_grappling_hook"))
89 s = strcat(s, ", ", _("Hook"));
91 s = strcat(s, ", ", _("Midair"));
93 s = strcat(s, ", ", _("Vampire"));
95 s = strcat(s, ", ", _("Piñata"));
96 if(cvar("g_weapon_stay"))
97 s = strcat(s, ", ", _("Weapons stay"));
98 if(cvar("g_bloodloss") > 0)
99 s = strcat(s, ", ", _("Blood loss"));
100 if(cvar("g_jetpack"))
101 s = strcat(s, ", ", _("Jet pack"));
102 if(cvar("g_powerups") == 0)
103 s = strcat(s, ", ", _("No powerups"));
104 if(cvar("g_powerups") > 0)
105 s = strcat(s, ", ", _("Powerups"));
107 return ZCTX(_("MUT^None"));
109 return substring(s, 2, strlen(s) - 2);
112 float checkCompatibility_pinata(entity me)
114 if(cvar("g_minstagib"))
118 if(cvar_string("g_weaponarena") != "0")
122 float checkCompatibility_weaponstay(entity me)
124 return checkCompatibility_pinata(me);
126 float checkCompatibility_newtoys(entity me)
128 if(cvar("g_minstagib"))
130 if(cvar_string("g_weaponarena") == "most")
132 if(cvar_string("g_weaponarena") == "all")
134 if(cvar_string("g_weaponarena") != "0")
138 float checkCompatibility_weaponarena_weapon(entity me)
140 if(cvar("g_minstagib"))
142 if(cvar_string("g_weaponarena") == "most")
144 if(cvar_string("g_weaponarena") == "all")
146 if(cvar_string("g_weaponarena") == "0")
148 if(cvar_string("g_start_weapon_laser") == "0")
153 void XonoticMutatorsDialog_fill(entity me)
158 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
161 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_dodging", _("Dodging")));
164 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_cloaked", _("Cloaked")));
167 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_midair", _("Midair")));
170 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_vampire", _("Vampire")));
173 s = makeXonoticSlider(10, 50, 1, "g_bloodloss");
174 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
175 setDependent(e, "g_minstagib", 0, 0);
178 me.TD(me, 1, 1.6, s);
181 s = makeXonoticSlider(80, 400, 8, "sv_gravity");
183 s.valueDisplayMultiplier = 0.125; // show gravity in percent
184 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
185 e.savedValue = 200; // good on silvercity
188 me.TD(me, 1, 1.6, s);
190 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
193 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_grappling_hook", _("Grappling hook")));
196 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_jetpack", _("Jet pack")));
199 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
202 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
203 setDependentWeird(e, checkCompatibility_newtoys);
206 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
209 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_pinata", _("Piñata")));
210 setDependentWeird(e, checkCompatibility_pinata);
213 me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_weapon_stay", _("Weapons stay")));
214 setDependentWeird(e, checkCompatibility_weaponstay);
217 me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
218 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
220 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, "g_weaponarena", "menu_weaponarena", _("Weapon arenas:")));
221 e.getCvarValueFromCvar = TRUE;
222 e.cvarOffValue = "0";
223 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
225 w = get_weaponinfo(i);
226 if(w.spawnflags & WEP_FLAG_HIDDEN)
231 me.TD(me, 1, 1.8, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.message)));
232 setDependentWeird(e, checkCompatibility_weaponarena_weapon);
237 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_weaponarena", "most", _("Most weapons")));
238 e.cvarOffValue = "0";
241 me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
244 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_minstagib", "1", _("MinstaGib")));
245 e.cvarOffValue = "0";
248 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_nix", "1", _("NIX")));
249 e.cvarOffValue = "0";
252 me.TD(me, 1, 1.6, e = makeXonoticCheckBox(0, "g_nix_with_laser", _("with laser")));
253 setDependent(e, "g_nix", 1, 1);
256 me.TD(me, 1, 1.8, e = makeXonoticRadioButton(1, "g_start_weapon_laser", "0", _("No start weapons")));
257 e.cvarOffValue = "-1";
258 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_porto g_start_weapon_minstanex g_start_weapon_hook g_start_weapon_hlac g_start_weapon_rifle g_start_weapon_fireball g_start_weapon_seeker g_start_weapon_tuba");
260 me.gotoRC(me, me.rows - 1, 0);
261 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
262 e.onClick = Dialog_Close;
263 e.onClickEntity = me;
266 void XonoticMutatorsDialog_close(entity me)
268 if(me.refilterEntity)
269 me.refilterEntity.refilter(me.refilterEntity);
270 SUPER(XonoticMutatorsDialog).close(me);