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

Go to the source code of this file.

Functions

entity makeXonoticCheckBox (float isInverted, string theCvar, string theText)
entity makeXonoticCheckBox_T (float isInverted, string theCvar, string theText, string theTooltip)
entity makeXonoticCheckBoxEx (float theYesValue, float theNoValue, string theCvar, string theText)
entity makeXonoticCheckBoxEx_T (float theYesValue, float theNoValue, string theCvar, string theText, string theTooltip)
void XonoticCheckBox_configureXonoticCheckBox (entity me, float theYesValue, float theNoValue, string theCvar, string theText, string theTooltip)
void XonoticCheckBox_loadCvars (entity me)
void XonoticCheckBox_saveCvars (entity me)
void XonoticCheckBox_setChecked (entity me, bool val)

Function Documentation

◆ makeXonoticCheckBox()

entity makeXonoticCheckBox ( float isInverted,
string theCvar,
string theText )

Definition at line 28 of file checkbox.qc.

29{
30 return makeXonoticCheckBox_T(isInverted, theCvar, theText, string_null);
31}
string string_null
Definition nil.qh:9
entity makeXonoticCheckBox_T(float isInverted, string theCvar, string theText, string theTooltip)
Definition checkbox.qc:3

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

Referenced by XonoticCheckBox::ATTRIB(), dialog_hudpanel_main_checkbox(), dialog_hudpanel_main_settings(), XonoticAudioSettingsTab_fill(), XonoticCvarsDialog_fill(), XonoticDamageTextSettings_fill(), XonoticDemoBrowserTab_fill(), XonoticEffectsSettingsTab_fill(), XonoticGameCrosshairSettingsTab_fill(), XonoticGameHUDSettingsTab_fill(), XonoticGameModelSettingsTab_fill(), XonoticGameViewSettingsTab_fill(), XonoticGameWeaponsSettingsTab_fill(), XonoticHUDAmmoDialog_fill(), XonoticHUDCenterprintDialog_fill(), XonoticHUDChatDialog_fill(), XonoticHUDCheckpointsDialog_fill(), XonoticHUDEngineInfoDialog_fill(), XonoticHUDExitDialog_fill(), XonoticHUDHealthArmorDialog_fill(), XonoticHUDItemsTimeDialog_fill(), XonoticHUDModIconsDialog_fill(), XonoticHUDNotificationDialog_fill(), XonoticHUDPhysicsDialog_fill(), XonoticHUDPowerupsDialog_fill(), XonoticHUDPressedKeysDialog_fill(), XonoticHUDQuickMenuDialog_fill(), XonoticHUDStrafeHUDDialog_fill(), XonoticHUDTimerDialog_fill(), XonoticHUDWeaponsDialog_fill(), XonoticInputSettingsTab_fill(), XonoticMiscSettingsTab_fill(), XonoticMusicPlayerTab_fill(), XonoticProfileTab_fill(), XonoticServerListTab_fill(), XonoticUserSettingsTab_fill(), and XonoticVideoSettingsTab_fill().

◆ makeXonoticCheckBox_T()

entity makeXonoticCheckBox_T ( float isInverted,
string theCvar,
string theText,
string theTooltip )

Definition at line 3 of file checkbox.qc.

4{
5 float m, n;
6 if(isInverted > 1)
7 {
8 n = isInverted - 1;
9 m = -n;
10 }
11 else if(isInverted < -1)
12 {
13 n = isInverted + 1;
14 m = -n;
15 }
16 else if(isInverted == 1)
17 {
18 n = 1;
19 m = 0;
20 }
21 else
22 {
23 n = 0;
24 m = 1;
25 }
26 return makeXonoticCheckBoxEx_T(m, n, theCvar, theText, theTooltip);
27}
entity makeXonoticCheckBoxEx_T(float theYesValue, float theNoValue, string theCvar, string theText, string theTooltip)
Definition checkbox.qc:33

References entity(), and makeXonoticCheckBoxEx_T().

Referenced by XonoticCheckBox::ATTRIB(), makeXonoticCheckBox(), XonoticAudioSettingsTab_fill(), XonoticEffectsSettingsTab_fill(), XonoticGameCrosshairSettingsTab_fill(), XonoticGameHUDSettingsTab_fill(), XonoticGameMessageSettingsTab_fill(), XonoticGameViewSettingsTab_fill(), XonoticGameWeaponsSettingsTab_fill(), XonoticHUDStrafeHUDDialog_fill(), XonoticInputSettingsTab_fill(), XonoticMiscSettingsTab_fill(), XonoticMutatorsDialog_fill(), XonoticServerCreateTab_fill(), XonoticServerListTab_fill(), XonoticUserSettingsTab_fill(), and XonoticVideoSettingsTab_fill().

◆ makeXonoticCheckBoxEx()

◆ makeXonoticCheckBoxEx_T()

entity makeXonoticCheckBoxEx_T ( float theYesValue,
float theNoValue,
string theCvar,
string theText,
string theTooltip )

Definition at line 33 of file checkbox.qc.

34{
36 me.configureXonoticCheckBox(me, theYesValue, theNoValue, theCvar, theText, theTooltip);
37 return me;
38}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define NEW(cname,...)
Definition oo.qh:117

References entity(), and NEW.

Referenced by XonoticCheckBox::ATTRIB(), makeXonoticCheckBox_T(), makeXonoticCheckBoxEx(), XonoticAudioSettingsTab_fill(), XonoticEffectsSettingsTab_fill(), XonoticGameMessageSettingsTab_fill(), XonoticGameViewSettingsTab_fill(), and XonoticHUDExitDialog_fill().

◆ XonoticCheckBox_configureXonoticCheckBox()

void XonoticCheckBox_configureXonoticCheckBox ( entity me,
float theYesValue,
float theNoValue,
string theCvar,
string theText,
string theTooltip )

Definition at line 44 of file checkbox.qc.

45{
46 me.yesValue = theYesValue;
47 me.noValue = theNoValue;
48 me.checked = false;
49 me.controlledCvar = (theCvar) ? theCvar : string_null;
50 me.loadCvars(me);
51 setZonedTooltip(me, theTooltip, theCvar);
52 me.configureCheckBox(me, theText, me.fontSize, me.image);
53}
void setZonedTooltip(entity e, string theTooltip, string theCvar)
Definition util.qc:257

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

◆ XonoticCheckBox_loadCvars()

void XonoticCheckBox_loadCvars ( entity me)

Definition at line 64 of file checkbox.qc.

65{
66 if (!me.controlledCvar)
67 return;
68
69 float m = (me.yesValue + me.noValue) * 0.5;
70 float d = (cvar(me.controlledCvar) - m) / (me.yesValue - m);
71 me.checked = (d > 0);
72}
float cvar(string name)

References cvar(), and entity().

◆ XonoticCheckBox_saveCvars()

void XonoticCheckBox_saveCvars ( entity me)

Definition at line 73 of file checkbox.qc.

74{
75 if (!me.controlledCvar)
76 return;
77
78 if(me.checked)
79 cvar_set(me.controlledCvar, ftos_mindecimals(me.yesValue));
80 else
81 cvar_set(me.controlledCvar, ftos_mindecimals(me.noValue));
82
83 CheckSendCvars(me, me.controlledCvar);
84}
void CheckSendCvars(entity me, string cvarnamestring)
Definition util.qc:825
void cvar_set(string name, string value)
ERASEABLE string ftos_mindecimals(float number)
Converts a number to a string with the minimum number of decimals It assumes that an extreme accuracy...
Definition string.qh:497

References CheckSendCvars(), cvar_set(), entity(), and ftos_mindecimals().

◆ XonoticCheckBox_setChecked()

void XonoticCheckBox_setChecked ( entity me,
bool val )

Definition at line 54 of file checkbox.qc.

55{
56 if(val != me.checked)
57 {
58 me.checked = val;
59 me.saveCvars(me);
60 if(me.linkedCheckBox)
61 me.linkedCheckBox.loadCvars(me.linkedCheckBox);
62 }
63}

References entity().