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

Go to the source code of this file.

Functions

float CheckFirstRunButton (entity me)
void firstRun_setLanguage (entity me)
void XonoticFirstRunDialog_fill (entity me)
bool XonoticFirstRunDialog_shouldShow ()

Function Documentation

◆ CheckFirstRunButton()

float CheckFirstRunButton ( entity me)

Definition at line 16 of file dialog_firstrun.qc.

17{
18 if(cvar_string("_cl_name") != cvar_defstring("_cl_name"))
19 return 1;
20
21 if(cvar_string("_menu_prvm_language") != prvm_language)
22 return 1; // OK will then reopen the dialog in another language
23
24 if(cvar_string("cl_allow_uid2name") != "-1")
25 return 1;
26
27 return 0;
28}
string prvm_language
Definition i18n.qh:8
const string cvar_string(string name)
const string cvar_defstring(string name)

References cvar_defstring(), cvar_string(), entity(), and prvm_language.

Referenced by XonoticFirstRunDialog_fill().

◆ firstRun_setLanguage()

void firstRun_setLanguage ( entity me)

Definition at line 30 of file dialog_firstrun.qc.

31{
32 if(prvm_language != cvar_string("_menu_prvm_language"))
33 localcmd("\nprvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart\n");
34}
void localcmd(string command,...)

References cvar_string(), entity(), localcmd(), and prvm_language.

Referenced by XonoticFirstRunDialog_fill().

◆ XonoticFirstRunDialog_fill()

void XonoticFirstRunDialog_fill ( entity me)

Definition at line 36 of file dialog_firstrun.qc.

37{
38 entity e;
39 entity label, box;
40
41 me.TR(me);
42 me.TR(me);
43 me.TDempty(me, 1);
44 me.TD(me, 2, 4, e = makeXonoticTextLabel(0, _("Welcome to Xonotic, please select your language preference and enter your player name to get started. You can change these options later through the menu system.")));
45 e.allowWrap = true;
46 e.allowWrap_spacing = 0.5;
47 me.TR(me);
48
49 me.TR(me);
50 me.TR(me);
51 me.TD(me, 1, 0.5, me.playerNameLabel = makeXonoticTextLabel(0, _("Name:")));
52 me.playerNameLabelAlpha = me.playerNameLabel.alpha;
53 me.TD(me, 1, 3.25, label = makeXonoticTextLabel(0, string_null));
54 label.allowCut = true;
55 label.allowColors = true;
56 label.alpha = 1;
57 me.TR(me);
58 me.TD(me, 1, 3.75, box = makeXonoticInputBox_T(1, "_cl_name",
59 _("Name under which you will appear in the game")));
60 box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
61 box.maxLength = -127; // negative means encoded length in bytes
62 box.saveImmediately = false; // Sorry, can't do this, it spams "name" commands.
63 box.enableClearButton = false;
64 label.textEntity = box;
65 me.TR(me);
66 me.TD(me, 5, 1.25, e = makeXonoticColorpicker(box));
67 me.TD(me, 5, 2.5, e = makeXonoticCharmap(box));
68 me.TR(me);
69 me.TR(me);
70 me.TR(me);
71 me.TR(me);
72
73 me.gotoRC(me, 3, 4); me.setFirstColumn(me, me.currentColumn);
74 me.TR(me);
75 me.TD(me, 1, 2, e = makeXonoticTextLabel(0, _("Text language:")));
76 me.TR(me);
77 me.TD(me, 6, 2, e = makeXonoticLanguageList());
78 e.name = "languageselector_firstrun";
79 e.setLanguage = firstRun_setLanguage;
80 me.TR(me);
81 me.TR(me);
82
83 me.gotoRC(me, me.rows - 4, 0); me.setFirstColumn(me, me.currentColumn);
84 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, _("Allow player statistics to use your nickname at stats.xonotic.org?")));
85
86 me.gotoRC(me, me.rows - 3, 0);
87 me.TDempty(me, 1.5);
88 me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "1", _("Yes")));
89 me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "0", _("No")));
90 me.TD(me, 1, 1, e = makeXonoticRadioButton(1, "cl_allow_uid2name", "-1", _("Undecided")));
91 me.TR(me);
92 me.TD(me, 1, me.columns, e = makeXonoticTextLabel(0.5, _("Player statistics are enabled by default, you can change this in the Profile menu")));
93
94 // because of the language selector, this is a menu_restart!
95 me.gotoRC(me, me.rows - 1, 0);
96 me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart", COMMANDBUTTON_APPLY));
98}
entity makeXonoticCharmap(entity controlledInputBox)
Definition charmap.qc:32
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
entity makeXonoticColorpicker(entity theTextbox)
Definition colorpicker.qc:5
entity makeXonoticCommandButton(string theText, vector theColor, string theCommand, int theFlags)
#define COMMANDBUTTON_APPLY
float CheckFirstRunButton(entity me)
void firstRun_setLanguage(entity me)
entity makeXonoticLanguageList()
void setDependentWeird(entity e, float(entity) func)
Definition util.qc:249
string string_null
Definition nil.qh:9
entity makeXonoticTextLabel(float theAlign, string theText)
Definition textlabel.qc:3
entity makeXonoticInputBox_T(bool doEditColorCodes, string theCvar, string theTooltip)
Definition inputbox.qc:3
entity makeXonoticRadioButton(float theGroup, string theCvar, string theValue, string theText)

References CheckFirstRunButton(), COMMANDBUTTON_APPLY, entity(), firstRun_setLanguage(), makeXonoticCharmap(), makeXonoticColorpicker(), makeXonoticCommandButton(), makeXonoticInputBox_T(), makeXonoticLanguageList(), makeXonoticRadioButton(), makeXonoticTextLabel(), setDependentWeird(), and string_null.

◆ XonoticFirstRunDialog_shouldShow()

bool XonoticFirstRunDialog_shouldShow ( )

Definition at line 11 of file dialog_firstrun.qc.

12{
13 return cvar_string("_cl_name") == cvar_defstring("_cl_name");
14}

References cvar_defstring(), and cvar_string().