Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
ui_powerups.qc
Go to the documentation of this file.
1#include "ui_powerups.qh"
2
3#include "powerups.qh"
4
8
10{
12 me.configureDialog(me);
13 return me;
14}
15
17{
19 entity e;
20 for (int i = 0; i < me.parent.toggleableItemsCount; ++i) // reload cvars for the RadioButtons
21 {
22 e = me.parent.(toggleableItems[i]);
23 e.loadCvars(e);
24 }
25}
26
28{
29 entity e;
30
31 me.TR(me);
32 me.TD(me, 1, 4 * 0.3, e = makeXonoticRadioButton(1, me.message, "0", _("Disable")));
34 me.TD(me, 1, 4 * 0.4, e = makeXonoticRadioButton(1, me.message, "-1", _("Dependent on gametype")));
36 me.TD(me, 1, 4 * 0.3, e = makeXonoticRadioButton(1, me.message, "1", _("Always enable")));
38
39 me.TR(me);
40 me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Allow maps to spawn:")));
41 string name;
42 int cols = 3;
43 int c = 0;
44 FOREACH(Items, it.instanceOfPowerup && it.netname != "extralife",
45 {
46 if (c % cols == 0)
47 {
48 me.TR(me);
49 me.TDempty(me, 0.2);
50 }
51 ++c;
52 switch (it.netname) // TODO: rename the cvars, or change the .netname
53 {
54 case "fuel_regen":
55 name = "fuelregen";
56 break;
57 case "invincible":
58 name = "shield";
59 break;
60 default:
61 name = it.netname;
62 break;
63 }
64 me.TD(me, 1, (4 - 0.2) / cols, e = makeXonoticCheckBox(0, strzone(strcat("g_powerups_", name)), strzone(it.m_name)));
65 });
66
67 me.TR(me);
68 me.TR(me);
69 me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Drop on death")));
70 me.TR(me);
71 me.TDempty(me, 0.2);
72 me.TD(me, 1, (4 - 0.2) / 3, e = makeXonoticRadioButton(2, "g_powerups_drop_ondeath", "0", _("Disabled")));
73 me.TD(me, 1, (4 - 0.2) / 3, e = makeXonoticRadioButton(2, "g_powerups_drop_ondeath", "1", _("Timer continues")));
74 me.TD(me, 1, (4 - 0.2) / 3, e = makeXonoticRadioButton(2, "g_powerups_drop_ondeath", "2", _("Timer pauses")));
75 me.TR(me);
76 me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Allow dropping")));
77 me.TR(me);
78 me.TDempty(me, 0.2);
79 me.TD(me, 1, (4 - 0.2) / 3, e = makeXonoticRadioButton(3, "g_powerups_drop", "0", _("Disabled")));
80 me.TD(me, 1, (4 - 0.2) / 3, e = makeXonoticRadioButton(3, "g_powerups_drop", "1", _("Timer continues")));
81 me.TD(me, 1, (4 - 0.2) / 3, e = makeXonoticRadioButton(3, "g_powerups_drop", "2", _("Timer pauses")));
82
83 me.TR(me);
84 me.TR(me);
85 me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "g_buffs_replace_powerups", _("Replace powerups with buffs")));
87 setDependent(e, "g_buffs", 1, 1);
88}
89
91#include "powerup/strength.qh"
92
94{
95 return sprintf(_("Enable powerup pickups (powerful bonuses like %s and %s) on the maps that support them."), COLORED_NAME(ITEM_Strength), COLORED_NAME(ITEM_Invisibility));
96}
98{
99 bool can_enable = !(cvar("g_buffs") == 1 && cvar("g_buffs_replace_powerups"));
100 if (is_already_enabled)
101 return can_enable && cvar(me.message);
102 return can_enable;
103}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:189
#define FOREACH(list, cond, body)
Definition iter.qh:19
void setDependent(entity e, string theCvarName, float theCvarMin, float theCvarMax)
Definition util.qc:180
string name
Definition menu.qh:30
float cvar(string name)
string strzone(string s)
void Mutators_add_RadioButton(entity me, entity e)
Definition mutatortab.qc:41
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define NEW(cname,...)
Definition oo.qh:120
#define METHOD(cname, name, prototype)
Definition oo.qh:274
entity makeXonoticTextLabel(float theAlign, string theText)
Definition textlabel.qc:3
void MutatorPowerupsReplace_CheckBox_saveCvars(entity me)
entity makeXonoticMutatorPowerupsTab()
Definition ui_powerups.qc:9
void XonoticMutatorPowerupsTab_fill(entity me)
entity makeXonoticCheckBox(float isInverted, string theCvar, string theText)
Definition checkbox.qc:28
void XonoticCheckBox_saveCvars(entity me)
Definition checkbox.qc:73
entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, string theText)
Definition radiobutton.qc:9