Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
textslider.qc File Reference
#include "textslider.qh"
Include dependency graph for textslider.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

entity makeXonoticTextSlider (string theCvar)
entity makeXonoticTextSlider_T (string theCvar, string theTooltip)
void XonoticTextSlider_configureXonoticTextSlider (entity me, string theCvar, string theTooltip)
void XonoticTextSlider_configureXonoticTextSliderValues (entity me)
void XonoticTextSlider_loadCvars (entity me)
void XonoticTextSlider_saveCvars (entity me)
void XonoticTextSlider_setValue (entity me, float val, bool allowAnim)
void XonoticTextSlider_setValueSpace (entity me, float val)

Function Documentation

◆ makeXonoticTextSlider()

entity makeXonoticTextSlider ( string theCvar)

Definition at line 10 of file textslider.qc.

11{
12 return makeXonoticTextSlider_T(theCvar, string_null);
13}
string string_null
Definition nil.qh:9
entity makeXonoticTextSlider_T(string theCvar, string theTooltip)
Definition textslider.qc:3

References entity(), makeXonoticTextSlider_T(), and string_null.

Referenced by dialog_hudpanel_main_settings(), XonoticGameModelSettingsTab_fill(), and XonoticHUDExitDialog_fill().

◆ makeXonoticTextSlider_T()

entity makeXonoticTextSlider_T ( string theCvar,
string theTooltip )

Definition at line 3 of file textslider.qc.

4{
5 entity me;
7 me.configureXonoticTextSlider(me, theCvar, theTooltip);
8 return me;
9}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define NEW(cname,...)
Definition oo.qh:117

References entity(), and NEW.

Referenced by makeXonoticTextSlider().

◆ XonoticTextSlider_configureXonoticTextSlider()

void XonoticTextSlider_configureXonoticTextSlider ( entity me,
string theCvar,
string theTooltip )

Definition at line 14 of file textslider.qc.

15{
16 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
17 me.controlledCvar = (theCvar) ? theCvar : string_null;
18 // me.loadCvars(me); // don't load it yet
19 setZonedTooltip(me, theTooltip, theCvar);
20}
void setZonedTooltip(entity e, string theTooltip, string theCvar)
Definition util.qc:257

References entity(), setZonedTooltip(), and string_null.

◆ XonoticTextSlider_configureXonoticTextSliderValues()

void XonoticTextSlider_configureXonoticTextSliderValues ( entity me)

Definition at line 95 of file textslider.qc.

96{
97 me.configureTextSliderValues(me, string_null);
98 me.loadCvars(me);
99}

References entity(), and string_null.

◆ XonoticTextSlider_loadCvars()

void XonoticTextSlider_loadCvars ( entity me)

Definition at line 34 of file textslider.qc.

35{
36 if (!me.controlledCvar)
37 return;
38
39 float n = tokenize_console(me.controlledCvar);
40 string s = cvar_string(argv(0));
41 float i;
42 for(i = 1; i < n; ++i)
43 s = strcat(s, " ", cvar_string(argv(i)));
44 me.setValueFromIdentifier(me, s, false);
45 if(me.value < 0 && n > 1)
46 {
47 // if it failed: check if all cvars have the same value
48 // if yes, try its value as 1-word identifier
49 for(i = 1; i < n; ++i)
50 if(cvar_string(argv(i)) != cvar_string(argv(i-1)))
51 break;
52 if(i >= n)
53 me.setValueFromIdentifier(me, cvar_string(argv(0)), false);
54 }
55}
#define tokenize_console
const string cvar_string(string name)
string argv(float n)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References argv(), cvar_string(), entity(), strcat(), and tokenize_console.

◆ XonoticTextSlider_saveCvars()

void XonoticTextSlider_saveCvars ( entity me)

Definition at line 56 of file textslider.qc.

57{
58 if (!me.controlledCvar)
59 return;
60
61 if(me.value >= 0 && me.value < me.nValues)
62 {
63 float n = tokenize_console(me.controlledCvar);
64 if(n == 1)
65 {
66 // this is a special case to allow spaces in the identifiers
67 cvar_set(argv(0), me.getIdentifier(me));
68 CheckSendCvars(me, argv(0));
69 }
70 else
71 {
72 float i;
73 float m = tokenize_console(strcat(me.controlledCvar, " ", me.getIdentifier(me)));
74 if(m == n + 1)
75 {
76 for(i = 0; i < n; ++i)
77 {
78 cvar_set(argv(i), argv(n));
79 CheckSendCvars(me, argv(i));
80 }
81 }
82 else if(m == n * 2)
83 {
84 for(i = 0; i < n; ++i)
85 {
86 cvar_set(argv(i), argv(i + n));
87 CheckSendCvars(me, argv(i));
88 }
89 }
90 else
91 error("XonoticTextSlider: invalid identifier ", me.getIdentifier(me), " does not match cvar list ", me.controlledCvar);
92 }
93 }
94}
void CheckSendCvars(entity me, string cvarnamestring)
Definition util.qc:825
void cvar_set(string name, string value)
#define error
Definition pre.qh:6

References argv(), CheckSendCvars(), cvar_set(), entity(), error, strcat(), and tokenize_console.

◆ XonoticTextSlider_setValue()

void XonoticTextSlider_setValue ( entity me,
float val,
bool allowAnim )

Definition at line 21 of file textslider.qc.

22{
23 if(val != me.value)
24 {
25 SUPER(XonoticTextSlider).setValue(me, val, allowAnim);
26 me.saveCvars(me);
27 }
28}
#define SUPER(cname)
Definition oo.qh:231

References entity(), and SUPER.

◆ XonoticTextSlider_setValueSpace()

void XonoticTextSlider_setValueSpace ( entity me,
float val )

Definition at line 29 of file textslider.qc.

30{
31 me.valueSpace = val;
32 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
33}

References entity().