ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
ATTRIB(XonoticFirstRunDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
ATTRIB(XonoticFirstRunDialog, intendedWidth, float, 0.6)
- ATTRIB(XonoticFirstRunDialog, rows, float, 11)
+ ATTRIB(XonoticFirstRunDialog, rows, float, 14)
ATTRIB(XonoticFirstRunDialog, columns, float, 3)
ATTRIB(XonoticFirstRunDialog, name, string, "FirstRun")
ATTRIB(XonoticFirstRunDialog, playerNameLabel, entity, NULL)
#endif
#ifdef IMPLEMENTATION
+float CheckFirstRunButton(entity me)
+{
+ if(cvar_string("_cl_name") != "Player")
+ return 1;
+ if(cvar_string("prvm_language") != prvm_language)
+ return 1; // OK will then reopen the dialog in another language
+ return 0;
+}
+
void XonoticFirstRunDialog_fill(entity me)
{
entity e;
me.TD(me, 2, 3, e = makeXonoticTextLabel(0, _("Please answer a few initial questions to enhance the game experience.")));
e.allowWrap = 1;
me.TR(me);
+ me.TR(me);
+ me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Text language:")));
+ me.TR(me);
+ me.TD(me, 3, 3, e = makeXonoticLanguageList());
+ e.name = "languageselector_firstrun";
+ e.doubleClickCommand = "saveconfig; menu_restart; togglemenu";
+ me.TR(me);
+ me.TR(me);
+
me.TR(me);
me.TD(me, 1, 0.5, me.playerNameLabel = makeXonoticTextLabel(0, _("Name:")));
me.playerNameLabelAlpha = me.playerNameLabel.alpha;
me.TR(me);
me.TR(me);
me.TR(me);
- me.TR(me);
- me.TR(me);
// because of the language selector, this is a menu_restart!
me.gotoRC(me, me.rows - 1, 0);
me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "saveconfig; menu_restart; togglemenu", COMMANDBUTTON_APPLY));
- setDependentStringNotEqual(e, "_cl_name", "Player");
+ setDependentWeird(e, CheckFirstRunButton);
}
#endif
METHOD(XonoticLanguageList, languageParameter, string(entity, float, float))
ATTRIB(XonoticLanguageList, name, string, "languageselector") // change this to make it noninteractive (for first run dialog)
+ ATTRIB(XonoticLanguageList, doubleClickCommand, string, "menu_restart\ntogglemenu\ndefer 0.1 \"menu_cmd languageselect\"")
ENDCLASS(XonoticLanguageList)
entity makeXonoticLanguageList();
void XonoticLanguageList_clickListBoxItem(entity me, float i, vector where)
{
- if(me.name != "languageselector")
- return;
if(i == me.lastClickedLanguage)
if(time < me.lastClickedTime + 0.3)
{
float XonoticLanguageList_keyDown(entity me, float scan, float ascii, float shift)
{
- if(me.name != "languageselector")
- return SUPER(XonoticLanguageList).keyDown(me, scan, ascii, shift);
if(scan == K_ENTER || scan == K_KP_ENTER) {
me.setLanguage(me);
return 1;
void XonoticLanguageList_setLanguage(entity me)
{
- if(me.name != "languageselector")
- return;
- localcmd("\nmenu_restart\ntogglemenu\ndefer 0.1 \"menu_cmd languageselect\"\n");
+ localcmd(sprintf("\n%s\n", me.doubleClickCommand));
}
string XonoticLanguageList_languageParameter(entity me, float i, float key)