Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
dialog_multiplayer_create_mutators.qc
Go to the documentation of this file.
3
5#include "checkbox.qh"
6#include "slider.qh"
7#include "textlabel.qh"
9#include "radiobutton.qh"
10#include "button.qh"
11
17
19{
20 if(cvar("g_instagib"))
21 return 0;
22 if(cvar("g_nix"))
23 return 0;
24 if(cvar("g_overkill"))
25 return 0;
26 if(cvar("g_melee_only"))
27 return 0;
28 if(cvar_string("g_weaponarena") != "0")
29 return 0;
30 return 1;
31}
37{
38 if(cvar("g_instagib"))
39 return 0;
40 if(cvar_string("g_weaponarena") == "most")
41 return 1;
42 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
43 return 1;
44 if(cvar_string("g_weaponarena") != "0")
45 return 0;
46 return 1;
47}
49{
50 if(!cvar("g_new_toys"))
51 return 0;
53}
55{
56 if(cvar("g_instagib"))
57 return 0;
58 if(cvar_string("g_weaponarena") == "most")
59 return 0;
60 if(cvar_string("g_weaponarena") == "all" || cvar_string("g_weaponarena") == "1")
61 return 0;
62 if(cvar_string("g_weaponarena") == "0")
63 return 0;
64 if(cvar_string("g_balance_blaster_weaponstartoverride") == "0")
65 return 0;
66 return 1;
67}
68
70{
71 entity e, s, w;
72 float i, j;
73 me.TR(me);
74 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Gameplay mutators:")));
75 me.TR(me);
76 me.TDempty(me, 0.2);
77 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_dodging", _("Dodging"),
78 _("Enable dodging (quick acceleration in a given direction). Double-tap a directional key to dodge")));
79 me.TR(me);
80 me.TDempty(me, 0.2);
81 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_touchexplode", _("Touch explode"),
82 _("An explosion occurs when two players collide")));
83 me.TR(me);
84 me.TDempty(me, 0.2);
85 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_cloaked", _("Cloaked"),
86 _("All players are almost invisible")));
87 me.TR(me);
88 me.TDempty(me, 0.2);
89 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_buffs", _("Buffs"),
90 _("Enable buff pickups (random bonuses like Medic, Invisible, etc.) on the maps that support it")));
91 e.cvarOffValue = "-1"; // TODO: make this a radio button?
92 me.TR(me);
93 me.TDempty(me, 0.2);
94 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_midair", _("Midair"),
95 _("Only possible to inflict damage on your enemy while they're airborne")));
96 me.TR(me);
97 me.TDempty(me, 0.2);
98 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_vampire", _("Vampire"),
99 _("Damage done to your enemy gets added to your own health")));
100 setDependent(e, "g_instagib", 0, 0);
101 me.TR(me);
102 me.TDempty(me, 0.2);
103 s = makeXonoticSlider_T(10, 50, 1, "g_bloodloss",
104 _("Amount of health below which players start bleeding out (health rots and they can't jump)"));
105 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(0, 1, s, _("Blood loss")));
106 setDependent(e, "g_instagib", 0, 0);
107 me.TR(me);
108 me.TDempty(me, 0.4);
109 me.TD(me, 1, 1.6, s);
110 me.TR(me);
111 me.TDempty(me, 0.2);
112 s = makeXonoticSlider_T(80, 400, 8, "sv_gravity",
113 _("Make things fall to the ground slower (percentage of normal gravity)"));
114 s.valueDigits = 0;
115 s.valueDisplayMultiplier = 0.125; // show gravity in percent
116 me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(800, 1, s, _("Low gravity")));
117 e.savedValue = 200; // good on silvercity
118 me.TR(me);
119 me.TDempty(me, 0.4);
120 me.TD(me, 1, 1.6, s);
121 me.TR(me);
122 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon & item mutators:")));
123 me.TR(me);
124 me.TDempty(me, 0.2);
125 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_grappling_hook", _("Grappling Hook"),
126 _("Players spawn with the grappling hook. Press the 'hook' key to use it")));
127 me.TR(me);
128 me.TDempty(me, 0.2);
129 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_jetpack", _("Jetpack"),
130 _("Players spawn with the jetpack. Double-tap 'jump' or press the 'jetpack' key to use it")));
131 me.TR(me);
132 me.TDempty(me, 0.2);
133 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_invincible_projectiles", _("Invincible Projectiles"),
134 _("Projectiles can't be destroyed. However, you can still explode Electro orbs with the Electro primary fire")));
135 setDependent(e, "g_instagib", 0, 0);
136 me.TR(me);
137 me.TDempty(me, 0.2);
138 me.TD(me, 1, 1.8 / 2, e = makeXonoticCheckBox_T(0, "g_new_toys", _("New Toys"),
139 _("Allow maps to spawn additional weapons (new toys)")));
141 me.TD(me, 1, 1.8 / 2, e = makeXonoticTextLabel(0, _("Replacement:")));
143 string nta_tooltip = _("Automatically replace some normal weapons of the map with their corresponding additional weapons");
144 me.TR(me);
145 me.TDempty(me, 0.4);
146 me.TD(me, 1, 1.6 / 3, e = makeXonoticRadioButton_T(3, "g_new_toys_autoreplace", "0", _("Never"), nta_tooltip));
148 me.TD(me, 1, 1.6 / 3, e = makeXonoticRadioButton_T(3, "g_new_toys_autoreplace", "1", _("Always"), nta_tooltip));
150 me.TD(me, 1, 1.6 / 3, e = makeXonoticRadioButton_T(3, "g_new_toys_autoreplace", "2", _("Randomly"), nta_tooltip));
152 me.TR(me);
153 me.TDempty(me, 0.2);
154 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_rocket_flying", _("Rocket Flying"),
155 _("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")));
156 setDependent(e, "g_instagib", 0, 0);
157 me.TR(me);
158 me.TDempty(me, 0.2);
159 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_pinata", _("PiƱata"),
160 _("Players will drop all weapons they possessed when they are killed")));
162 me.TR(me);
163 me.TDempty(me, 0.2);
164 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "g_weapon_stay", _("Weapons stay"),
165 _("Weapons stay after they are picked up")));
167 me.TR(me);
168
169 me.gotoRC(me, 0, 2); me.setFirstColumn(me, me.currentColumn);
170 me.TD(me, 1, 2, e = makeXonoticRadioButton(1, string_null, string_null, _("Regular (no arena)")));
171 string weaponarena_tooltip = _("Players will be given a set of weapons at spawn as well as unlimited ammo, without weapon pickups");
172 me.TR(me);
173 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Weapon arenas:")));
174 me.TR(me);
175 me.TDempty(me, 0.2);
176 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "menu_weaponarena", _("Custom weapons"), weaponarena_tooltip));
177 e.cvarValueIsAnotherCvar = true;
178 e.cvarOffValue = "0";
179
180 me.TDempty(me, 0.1); // fix initial position
181 for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
182 {
183 w = REGISTRY_GET(Weapons, i);
184 if (w.spawnflags & WEP_FLAG_HIDDEN)
185 continue;
186 if ((j % 3) == 0)
187 {
188 me.TR(me);
189 me.TDempty(me, 0.4);
190 }
191 me.TD(me, 1, 1.2, e = makeXonoticWeaponarenaCheckBox(strzone(w.netname), strzone(w.m_name)));
193 ++j;
194 }
195
196 me.TR(me);
197 me.TDempty(me, 0.2);
198 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "most", _("Most weapons"), weaponarena_tooltip));
199 e.cvarOffValue = "0";
200 me.TR(me);
201 me.TDempty(me, 0.2);
202 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_weaponarena", "all", _("All weapons"), weaponarena_tooltip));
203 e.cvarOffValue = "0";
204 me.TR(me);
205 me.TD(me, 1, 2, makeXonoticTextLabel(0, _("Special arenas:")));
206 me.TR(me);
207 me.TDempty(me, 0.2);
208 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
209 _("Players will be given only one weapon, which can instantly kill the opponent with a single shot. If the player runs out of ammo, they will have 10 seconds to find some or if they fail to do so, face death. The secondary fire mode does not inflict any damage but is good for doing trickjumps.")));
210 e.cvarOffValue = "0";
211 me.TR(me);
212 me.TDempty(me, 0.2);
213 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
214 _("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.")));
215 e.cvarOffValue = "0";
216 me.TR(me);
217 me.TDempty(me, 0.4);
218 me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
219 _("Always carry the blaster as an additional weapon in Nix")));
220 setDependent(e, "g_nix", 1, 1);
221 me.TR(me);
222 me.TDempty(me, 0.2);
223 me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_balance_blaster_weaponstartoverride", "0", _("No start weapons"), "-"));
224 e.cvarOffValue = "-1";
225 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");
226
227 me.gotoRC(me, me.rows - 1, 0);
228 me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0'));
229 e.onClick = Dialog_Close;
230 e.onClickEntity = me;
231}
232
233.void(entity) refilter;
234
236{
237 if(me.refilterEntity)
238 me.refilterEntity.refilter(me.refilterEntity);
239 SUPER(XonoticMutatorsDialog).close(me);
240}
entity makeXonoticSliderCheckBox(float theOffValue, float isInverted, entity theControlledSlider, string theText)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void XonoticMutatorsDialog_fill(entity me)
void XonoticMutatorsDialog_close(entity me)
float checkCompatibility_newtoys(entity me)
float checkCompatibility_weaponstay(entity me)
float checkCompatibility_pinata(entity me)
void XonoticMutatorsDialog_showNotify(entity me)
float checkCompatibility_weaponarena_weapon(entity me)
float checkCompatibility_newtoys_autoreplace(entity me)
Weapons
Definition guide.qh:113
void Dialog_Close(entity button, entity me)
Definition dialog.qc:7
entity makeXonoticButton(string theText, vector theColor)
Definition button.qc:10
void setDependentWeird(entity e, float(entity) func)
Definition util.qc:249
void loadAllCvars(entity root)
Definition util.qc:53
void makeMulti(entity e, string otherCvars)
Definition util.qc:92
void setDependent(entity e, string theCvarName, float theCvarMin, float theCvarMax)
Definition util.qc:180
float cvar(string name)
const string cvar_string(string name)
string strzone(string s)
string string_null
Definition nil.qh:9
#define SUPER(cname)
Definition oo.qh:231
#define REGISTRY_GET(id, i)
Definition registry.qh:43
entity makeXonoticTextLabel(float theAlign, string theText)
Definition textlabel.qc:3
entity makeXonoticWeaponarenaCheckBox(string theWeapon, string theText)
#define WEP_LAST
Definition all.qh:327
const int WEP_FIRST
Definition all.qh:326
const int WEP_FLAG_HIDDEN
Definition weapon.qh:216
entity makeXonoticCheckBox_T(float isInverted, string theCvar, string theText, string theTooltip)
Definition checkbox.qc:3
entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, string theText)
entity makeXonoticRadioButton_T(float theGroup, string theCvar, string theValue, string theText, string theTooltip)
Definition radiobutton.qc:3
entity makeXonoticSlider_T(float theValueMin, float theValueMax, float theValueStep, string theCvar, string theTooltip)
Definition slider.qc:3