From: Rudolf Polzer Date: Mon, 30 Jan 2012 15:54:42 +0000 (+0100) Subject: latch prvm_language changes from menu X-Git-Tag: xonotic-v0.6.0~74^2~12^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=57c658ba50dd3d752e25137be6d0a49b5daf1c9c;p=xonotic%2Fxonotic-data.pk3dir.git latch prvm_language changes from menu --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 06ddd852a..cb5be0877 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -86,6 +86,7 @@ vid_fullscreen 1 vid_width 1024 vid_height 768 vid_pixelheight 1 +set _menu_prvm_language "" set _menu_vid_width "$vid_width" set _menu_vid_height "$vid_height" set _menu_vid_pixelheight "$vid_pixelheight" diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index baa0bb90f..e80247338 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -30,6 +30,7 @@ void m_init() { cvar_set("_menu_alpha", "0"); prvm_language = strzone(cvar_string("prvm_language")); + cvar_set("_menu_prvm_language", prvm_language); check_unacceptable_compiler_bugs(); diff --git a/qcsrc/menu/xonotic/dialog_firstrun.c b/qcsrc/menu/xonotic/dialog_firstrun.c index 95273901a..67b886ec9 100644 --- a/qcsrc/menu/xonotic/dialog_firstrun.c +++ b/qcsrc/menu/xonotic/dialog_firstrun.c @@ -69,7 +69,7 @@ void XonoticFirstRunDialog_fill(entity me) me.TR(me); me.TD(me, 6, 2, e = makeXonoticLanguageList()); e.name = "languageselector_firstrun"; - e.doubleClickCommand = "saveconfig; menu_restart; togglemenu"; + e.doubleClickCommand = "prvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart; togglemenu"; me.TR(me); me.TR(me); @@ -84,7 +84,7 @@ void XonoticFirstRunDialog_fill(entity 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)); + me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "prvm_language \"$_menu_prvm_language\"; saveconfig; menu_restart; togglemenu", COMMANDBUTTON_APPLY)); setDependentWeird(e, CheckFirstRunButton); } #endif diff --git a/qcsrc/menu/xonotic/languagelist.c b/qcsrc/menu/xonotic/languagelist.c index 0ea54dbca..c4b2122b6 100644 --- a/qcsrc/menu/xonotic/languagelist.c +++ b/qcsrc/menu/xonotic/languagelist.c @@ -27,7 +27,7 @@ CLASS(XonoticLanguageList) EXTENDS(XonoticListBox) 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\"") + ATTRIB(XonoticLanguageList, doubleClickCommand, string, "prvm_language \"$_menu_prvm_language\"\nmenu_restart\ntogglemenu\ndefer 0.1 \"menu_cmd languageselect\"") ENDCLASS(XonoticLanguageList) entity makeXonoticLanguageList(); @@ -85,7 +85,7 @@ void XonoticLanguageList_loadCvars(entity me) { string s; float i, n; - s = cvar_string("prvm_language"); + s = cvar_string("_menu_prvm_language"); n = me.nItems; // default to English @@ -107,11 +107,14 @@ void XonoticLanguageList_loadCvars(entity me) break; } } + + // save it off (turning anything unknown into "en") + me.saveCvars(me); } void XonoticLanguageList_saveCvars(entity me) { - cvar_set("prvm_language", me.languageParameter(me, me.selectedItem, LANGPARM_ID)); + cvar_set("_menu_prvm_language", me.languageParameter(me, me.selectedItem, LANGPARM_ID)); } void XonoticLanguageList_clickListBoxItem(entity me, float i, vector where)