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 9 of file textslider.qc.

10{
11 return makeXonoticTextSlider_T(theCvar, string_null);
12}
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{
6 me.configureXonoticTextSlider(me, theCvar, theTooltip);
7 return me;
8}
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 13 of file textslider.qc.

14{
15 me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
16 me.controlledCvar = (theCvar) ? theCvar : string_null;
17 // me.loadCvars(me); // don't load it yet
18 setZonedTooltip(me, theTooltip, theCvar);
19}
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 94 of file textslider.qc.

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

References entity(), and string_null.

◆ XonoticTextSlider_loadCvars()

void XonoticTextSlider_loadCvars ( entity me)

Definition at line 33 of file textslider.qc.

34{
35 if (!me.controlledCvar)
36 return;
37
38 float n = tokenize_console(me.controlledCvar);
39 string s = cvar_string(argv(0));
40 float i;
41 for(i = 1; i < n; ++i)
42 s = strcat(s, " ", cvar_string(argv(i)));
43 me.setValueFromIdentifier(me, s, false);
44 if(me.value < 0 && n > 1)
45 {
46 // if it failed: check if all cvars have the same value
47 // if yes, try its value as 1-word identifier
48 for(i = 1; i < n; ++i)
49 if(cvar_string(argv(i)) != cvar_string(argv(i-1)))
50 break;
51 if(i >= n)
52 me.setValueFromIdentifier(me, cvar_string(argv(0)), false);
53 }
54}
#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 55 of file textslider.qc.

56{
57 if (!me.controlledCvar)
58 return;
59
60 if(me.value >= 0 && me.value < me.nValues)
61 {
62 float n = tokenize_console(me.controlledCvar);
63 if(n == 1)
64 {
65 // this is a special case to allow spaces in the identifiers
66 cvar_set(argv(0), me.getIdentifier(me));
67 CheckSendCvars(me, argv(0));
68 }
69 else
70 {
71 float i;
72 float m = tokenize_console(strcat(me.controlledCvar, " ", me.getIdentifier(me)));
73 if(m == n + 1)
74 {
75 for(i = 0; i < n; ++i)
76 {
77 cvar_set(argv(i), argv(n));
78 CheckSendCvars(me, argv(i));
79 }
80 }
81 else if(m == n * 2)
82 {
83 for(i = 0; i < n; ++i)
84 {
85 cvar_set(argv(i), argv(i + n));
86 CheckSendCvars(me, argv(i));
87 }
88 }
89 else
90 error("XonoticTextSlider: invalid identifier ", me.getIdentifier(me), " does not match cvar list ", me.controlledCvar);
91 }
92 }
93}
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 20 of file textslider.qc.

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

References entity(), and SUPER.

◆ XonoticTextSlider_setValueSpace()

void XonoticTextSlider_setValueSpace ( entity me,
float val )

Definition at line 28 of file textslider.qc.

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

References entity().