Xonotic
dialog_multiplayer_create_mutators.qc File Reference
#include "dialog_multiplayer_create_mutators.qh"
#include <common/weapons/_all.qh>
#include "weaponarenacheckbox.qh"
#include "checkbox.qh"
#include "slider.qh"
#include "textlabel.qh"
#include "checkbox_slider_invalid.qh"
#include "radiobutton.qh"
#include "button.qh"
+ Include dependency graph for dialog_multiplayer_create_mutators.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

float checkCompatibility_newtoys (entity me)
 
float checkCompatibility_pinata (entity me)
 
float checkCompatibility_weaponarena_weapon (entity me)
 
float checkCompatibility_weaponstay (entity me)
 
 void (entity) refilter
 
string WeaponArenaString ()
 
void XonoticMutatorsDialog_close (entity me)
 
void XonoticMutatorsDialog_fill (entity me)
 
void XonoticMutatorsDialog_showNotify (entity me)
 
string XonoticMutatorsDialog_toString (entity me)
 

Variables

string weaponarenastring
 
string weaponarenastring_cvar
 

Function Documentation

◆ checkCompatibility_newtoys()

float checkCompatibility_newtoys ( entity  me)

Definition at line 128 of file dialog_multiplayer_create_mutators.qc.

References cvar(), and cvar_string().

129 {
130  if(cvar("g_instagib"))
131  return 0;
132  if(cvar_string("g_weaponarena") == "most")
133  return 1;
134  if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
135  return 1;
136  if(cvar_string("g_weaponarena") != "0")
137  return 0;
138  return 1;
139 }
+ Here is the call graph for this function:

◆ checkCompatibility_pinata()

float checkCompatibility_pinata ( entity  me)

Definition at line 110 of file dialog_multiplayer_create_mutators.qc.

References cvar(), and cvar_string().

Referenced by checkCompatibility_weaponstay().

111 {
112  if(cvar("g_instagib"))
113  return 0;
114  if(cvar("g_nix"))
115  return 0;
116  if(cvar("g_overkill"))
117  return 0;
118  if(cvar("g_melee_only"))
119  return 0;
120  if(cvar_string("g_weaponarena") != "0")
121  return 0;
122  return 1;
123 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkCompatibility_weaponarena_weapon()

float checkCompatibility_weaponarena_weapon ( entity  me)

Definition at line 140 of file dialog_multiplayer_create_mutators.qc.

References cvar(), and cvar_string().

141 {
142  if(cvar("g_instagib"))
143  return 0;
144  if(cvar_string("g_weaponarena") == "most")
145  return 0;
146  if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
147  return 0;
148  if(cvar_string("g_weaponarena") == "0")
149  return 0;
150  if(cvar_string("g_balance_blaster_weaponstartoverride") == "0")
151  return 0;
152  return 1;
153 }
+ Here is the call graph for this function:

◆ checkCompatibility_weaponstay()

float checkCompatibility_weaponstay ( entity  me)

Definition at line 124 of file dialog_multiplayer_create_mutators.qc.

References checkCompatibility_pinata().

125 {
126  return checkCompatibility_pinata(me);
127 }
float checkCompatibility_pinata(entity me)
+ Here is the call graph for this function:

◆ void()

void ( entity  )

◆ WeaponArenaString()

string WeaponArenaString ( )

Definition at line 20 of file dialog_multiplayer_create_mutators.qc.

References cvar_string().

21 {
22  string s;
23  float n;
24  s = cvar_string("g_weaponarena");
25  if(s == "0")
26  return "";
27  if(s == "all" || s == "1")
28  return _("All Weapons Arena");
29  if(s == "most")
30  return _("Most Weapons Arena");
31  if(s == weaponarenastring_cvar)
32  return weaponarenastring;
33 
35 
36  n = tokenize_console(s);
37  s = "";
38  for(int j = 0; j < n; ++j)
39  {
40  Weapon wep = Weapon_from_name(argv(j));
41  if(wep != WEP_Null)
42  {
43  s = cons_mid(s, " & ", wep.m_name);
44  }
45  }
46  s = sprintf(_("%s Arena"), s);
47 
49 
50  return weaponarenastring;
51 }
string m_name
M: wepname : human readable name.
Definition: weapon.qh:78
#define strcpy(this, s)
Definition: string.qh:49
ERASEABLE string cons_mid(string a, string mid, string b)
Definition: string.qh:265
#define tokenize_console
Definition: dpextensions.qh:24
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
Definition: weapon.qh:41
Weapon Weapon_from_name(string s)
Definition: all.qh:134
+ Here is the call graph for this function:

◆ XonoticMutatorsDialog_close()

void XonoticMutatorsDialog_close ( entity  me)

Definition at line 310 of file dialog_multiplayer_create_mutators.qc.

References SUPER.

311 {
312  if(me.refilterEntity)
313  me.refilterEntity.refilter(me.refilterEntity);
314  SUPER(XonoticMutatorsDialog).close(me);
315 }
#define SUPER(cname)
Definition: oo.qh:219

◆ XonoticMutatorsDialog_fill()

void XonoticMutatorsDialog_fill ( entity  me)

Definition at line 155 of file dialog_multiplayer_create_mutators.qc.

References entity(), and makeXonoticTextLabel().

156 {
157  entity e, s, w;
158  float i, j;
159  me.TR(me);
160  me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
161  me.TR(me);
162  me.TDempty(me, 0.2);
163  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
164  _("Enable dodging (quick acceleration in a given direction). Double-tap a directional key to dodge")));
165  me.TR(me);
166  me.TDempty(me, 0.2);
167  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_touchexplode", _("Touch explode"),
168  _("An explosion occurs when two players collide")));
169  me.TR(me);
170  me.TDempty(me, 0.2);
171  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
172  _("All players are almost invisible")));
173  me.TR(me);
174  me.TDempty(me, 0.2);
175  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_buffs", _("Buffs"),
176  _("Enable buff pickups (random bonuses like Medic, Invisible, etc.) on the maps that support it")));
177  e.cvarOffValue = "-1"; // TODO: make this a radio button?
178  me.TR(me);
179  me.TDempty(me, 0.2);
180  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
181  _("Only possible to inflict damage on your enemy while they're airborne")));
182  me.TR(me);
183  me.TDempty(me, 0.2);
184  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
185  _("Damage done to your enemy gets added to your own health")));
186  setDependent(e, "g_instagib", 0, 0);
187  me.TR(me);
188  me.TDempty(me, 0.2);
189  s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
190  _("Amount of health below which players start bleeding out (health rots and they can't jump)"));
191  me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
192  setDependent(e, "g_instagib", 0, 0);
193  me.TR(me);
194  me.TDempty(me, 0.4);
195  me.TD(me, 1, 1.6, s);
196  me.TR(me);
197  me.TDempty(me, 0.2);
198  s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
199  _("Make things fall to the ground slower (percentage of normal gravity)"));
200  s.valueDigits = 0;
201  s.valueDisplayMultiplier = 0.125; // show gravity in percent
202  me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
203  e.savedValue = 200; // good on silvercity
204  me.TR(me);
205  me.TDempty(me, 0.4);
206  me.TD(me, 1, 1.6, s);
207  me.TR(me);
208  me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
209  me.TR(me);
210  me.TDempty(me, 0.2);
211  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling Hook"),
212  _("Players spawn with the grappling hook. Press the 'hook' key to use it")));
213  me.TR(me);
214  me.TDempty(me, 0.2);
215  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jetpack"),
216  _("Players spawn with the jetpack. Double-tap 'jump' or press the 'jetpack' key to use it")));
217  me.TR(me);
218  me.TDempty(me, 0.2);
219  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_invincible_projectiles", _("Invincible Projectiles"),
220  _("Projectiles can't be destroyed. However, you can still explode Electro orbs with the Electro primary fire")));
221  setDependent(e, "g_instagib", 0, 0);
222  me.TR(me);
223  me.TDempty(me, 0.2);
224  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_new_toys", _("New Toys"),
225  _("Some weapon spawns will be randomly replaced with new weapons: Heavy Laser Assault Cannon, Mine Layer, Rifle, T.A.G. Seeker")));
227  me.TR(me);
228  me.TDempty(me, 0.2);
229  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_rocket_flying", _("Rocket Flying"),
230  _("Devastator rockets can be detonated instantly (otherwise, there's a short delay). This allows players to fire and detonate a Devastator rocket while in the air for a strong mid-air boost even while moving fast")));
231  setDependent(e, "g_instagib", 0, 0);
232  me.TR(me);
233  me.TDempty(me, 0.2);
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")));
237  me.TR(me);
238  me.TDempty(me, 0.2);
239  me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_weapon_stay", _("Weapons stay"),
240  _("Weapons stay after they are picked up")));
242  me.TR(me);
243 
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)")));
246  string weaponarena_tooltip = strzone(_("Players will be given a set of weapons at spawn as well as unlimited ammo, without weapon pickups"));
247  me.TR(me);
248  me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon arenas:")));
249  me.TR(me);
250  me.TDempty(me, 0.2);
251  me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Custom weapons"), weaponarena_tooltip));
252  e.cvarValueIsAnotherCvar = true;
253  e.cvarOffValue = "0";
254 
255  me.TDempty(me, 0.1); // fix initial position
256  for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
257  {
258  w = REGISTRY_GET(Weapons, i);
259  if (w.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK))
260  continue;
261  if ((j % 3) == 0)
262  {
263  me.TR(me);
264  me.TDempty(me, 0.4);
265  }
266  me.TD(me, 1, 1.2, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
268  ++j;
269  }
270 
271  me.TR(me);
272  me.TDempty(me, 0.2);
273  me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"), weaponarena_tooltip));
274  e.cvarOffValue = "0";
275  me.TR(me);
276  me.TDempty(me, 0.2);
277  me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"), weaponarena_tooltip));
278  e.cvarOffValue = "0";
279  me.TR(me);
280  me.TD(me, 1, 4, makeXonoticTextLabel(0, _("Special arenas:")));
281  me.TR(me);
282  me.TDempty(me, 0.2);
283  me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
284  _("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.")));
285  e.cvarOffValue = "0";
286  me.TR(me);
287  me.TDempty(me, 0.2);
288  me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
289  _("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.")));
290  e.cvarOffValue = "0";
291  me.TR(me);
292  me.TDempty(me, 0.4);
293  me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
294  _("Always carry the blaster as an additional weapon in Nix")));
295  setDependent(e, "g_nix", 1, 1);
296  me.TR(me);
297  me.TDempty(me, 0.2);
298  me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_balance_blaster_weaponstartoverride", "0", _("No start weapons"), "-"));
299  e.cvarOffValue = "-1";
300  makeMulti(e, "g_balance_shotgun_weaponstartoverride g_balance_machinegun_weaponstartoverride g_balance_devastator_weaponstartoverride g_balance_minelayer_weaponstartoverride g_balance_electro_weaponstartoverride g_balance_crylink_weaponstartoverride g_balance_hagar_weaponstartoverride g_balance_porto_weaponstartoverride g_balance_vaporizer_weaponstartoverride g_balance_hook_weaponstartoverride g_balance_rifle_weaponstartoverride g_balance_fireball_weaponstartoverride g_balance_seeker_weaponstartoverride g_balance_tuba_weaponstartoverride g_balance_arc_weaponstartoverride g_balance_vortex_weaponstartoverride g_balance_mortar_weaponstartoverride");
301 
302  me.gotoRC(me, me.rows - 1, 0);
303  me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
304  e.onClick = Dialog_Close;
305  e.onClickEntity = me;
306 }
string string_null
Definition: nil.qh:9
const int WEP_FIRST
Definition: all.qh:304
entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, string theText)
Definition: radiobutton.qc:10
entity makeXonoticWeaponarenaCheckBox(string theWeapon, string theText)
entity() spawn
#define REGISTRY_GET(id, i)
Definition: registry.qh:43
entity makeXonoticTextLabel(float theAlign, string theText)
Definition: textlabel.qc:3
entity makeXonoticRadioButton_T(float theGroup, string theCvar, string theValue, string theText, string theTooltip)
Definition: radiobutton.qc:3
float checkCompatibility_pinata(entity me)
#define WEP_LAST
Definition: all.qh:305
const int WEP_FLAG_HIDDEN
Definition: weapon.qh:200
float checkCompatibility_weaponstay(entity me)
entity makeXonoticSlider_T(float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
Definition: slider.qc:3
entity makeXonoticCheckBox_T(float isInverted, string theCvar, string theText, string theTooltip)
Definition: checkbox.qc:3
entity makeXonoticSliderCheckBox(float theOffValue, float isInverted, entity theControlledSlider, string theText)
const int WEP_FLAG_SPECIALATTACK
Definition: weapon.qh:211
float checkCompatibility_newtoys(entity me)
float checkCompatibility_weaponarena_weapon(entity me)
+ Here is the call graph for this function:

◆ XonoticMutatorsDialog_showNotify()

void XonoticMutatorsDialog_showNotify ( entity  me)

Definition at line 12 of file dialog_multiplayer_create_mutators.qc.

References loadAllCvars(), and SUPER.

13 {
14  SUPER(XonoticMutatorsDialog).showNotify(me);
15  loadAllCvars(me);
16 }
#define SUPER(cname)
Definition: oo.qh:219
+ Here is the call graph for this function:

◆ XonoticMutatorsDialog_toString()

string XonoticMutatorsDialog_toString ( entity  me)

Definition at line 53 of file dialog_multiplayer_create_mutators.qc.

References cons_mid(), and cvar().

54 {
55  string s = "";
56  if(cvar("g_dodging"))
57  s = cons_mid(s, ", ", _("Dodging"));
58  if(cvar("g_instagib"))
59  s = cons_mid(s, ", ", _("InstaGib"));
60  if(cvar("g_new_toys"))
61  s = cons_mid(s, ", ", _("New Toys"));
62  if(cvar("g_nix"))
63  s = cons_mid(s, ", ", _("NIX"));
64  if(cvar("g_rocket_flying"))
65  s = cons_mid(s, ", ", _("Rocket Flying"));
66  if(cvar("g_invincible_projectiles"))
67  s = cons_mid(s, ", ", _("Invincible Projectiles"));
68  if(cvar_string("g_weaponarena") != "0")
69  s = cons_mid(s, ", ", WeaponArenaString());
70  else if(cvar("g_balance_blaster_weaponstartoverride") == 0)
71  s = cons_mid(s, ", ", _("No start weapons"));
72  if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
73  s = cons_mid(s, ", ", _("Low gravity"));
74  if(cvar("g_cloaked"))
75  s = cons_mid(s, ", ", _("Cloaked"));
76  if(cvar("g_grappling_hook"))
77  s = cons_mid(s, ", ", _("Hook"));
78  if(cvar("g_midair"))
79  s = cons_mid(s, ", ", _("Midair"));
80  if(cvar("g_melee_only"))
81  s = cons_mid(s, ", ", _("Melee only"));
82  if(cvar("g_vampire"))
83  s = cons_mid(s, ", ", _("Vampire"));
84  if(cvar("g_pinata"))
85  s = cons_mid(s, ", ", _("Piñata"));
86  if(cvar("g_weapon_stay"))
87  s = cons_mid(s, ", ", _("Weapons stay"));
88  if(cvar("g_bloodloss") > 0)
89  s = cons_mid(s, ", ", _("Blood loss"));
90  if(cvar("g_jetpack"))
91  s = cons_mid(s, ", ", _("Jetpack"));
92  if(cvar("g_buffs") > 0)
93  s = cons_mid(s, ", ", _("Buffs"));
94  if(cvar("g_overkill"))
95  s = cons_mid(s, ", ", _("Overkill"));
96  if(cvar("g_powerups") == 0)
97  s = cons_mid(s, ", ", _("No powerups"));
98  if(cvar("g_powerups") > 0)
99  s = cons_mid(s, ", ", _("Powerups"));
100  if(cvar("g_touchexplode") > 0)
101  s = cons_mid(s, ", ", _("Touch explode"));
102  if(cvar("g_walljump"))
103  s = cons_mid(s, ", ", _("Wall jumping"));
104  if(s == "")
105  return ZCTX(_("MUT^None"));
106  else
107  return s;
108 }
ERASEABLE string cons_mid(string a, string mid, string b)
Definition: string.qh:265
#define ZCTX(s)
Definition: i18n.qh:68
string WeaponArenaString()
+ Here is the call graph for this function:

Variable Documentation

◆ weaponarenastring

string weaponarenastring

Definition at line 18 of file dialog_multiplayer_create_mutators.qc.

◆ weaponarenastring_cvar

string weaponarenastring_cvar

Definition at line 19 of file dialog_multiplayer_create_mutators.qc.