From: Rudolf Polzer Date: Thu, 9 Feb 2012 14:59:40 +0000 (+0100) Subject: get rid of defer use for menu_restarts X-Git-Tag: xonotic-v0.6.0~74^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6bdf5c65553a806c0ba0cf2051d0c9b0e3c4fa4e;p=xonotic%2Fxonotic-data.pk3dir.git get rid of defer use for menu_restarts --- diff --git a/qcsrc/menu/command/menu_cmd.qc b/qcsrc/menu/command/menu_cmd.qc index 0e0df0589..f6312931f 100644 --- a/qcsrc/menu/command/menu_cmd.qc +++ b/qcsrc/menu/command/menu_cmd.qc @@ -65,19 +65,19 @@ void GameCommand(string theCommand) if(argv(0) == "skinselect") { - m_goto_skin_selector(); + m_goto("skinselector"); return; } if(argv(0) == "languageselect") { - m_goto_language_selector(); + m_goto("languageselector"); return; } if(argv(0) == "videosettings") { - m_goto_video_settings(); + m_goto("videosettings"); return; } diff --git a/qcsrc/menu/menu.qc b/qcsrc/menu/menu.qc index 45f3f14b6..42b40568b 100644 --- a/qcsrc/menu/menu.qc +++ b/qcsrc/menu/menu.qc @@ -124,6 +124,7 @@ void UpdateConWidthHeight() } } +string m_goto_buffer; void m_init_delayed() { float fh, glob, n, i; @@ -197,6 +198,13 @@ void m_init_delayed() m_sync(); + if(m_goto_buffer) + { + m_goto(m_goto_buffer); + strunzone(m_goto_buffer); + m_goto_buffer = string_null; + } + if(Menu_Active) m_display(); // delayed menu display } @@ -926,11 +934,18 @@ void m_goto(string itemname) { entity e; if(!menuInitialized) + { + if(m_goto_buffer) + strunzone(m_goto_buffer); + m_goto_buffer = strzone(itemname); return; + } if(itemname == "") // this can be called by GameCommand { if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) + { m_hide(); + } else { m_activate_window(main.mainNexposee); @@ -951,27 +966,3 @@ void m_goto(string itemname) } } } - -void m_goto_skin_selector() -{ - if(!menuInitialized) - return; - // TODO add code to switch back to the skin selector (no idea how to do it now) - m_goto("skinselector"); -} - -void m_goto_language_selector() -{ - if(!menuInitialized) - return; - // TODO add code to switch back to the language selector (no idea how to do it now) - m_goto("languageselector"); -} - -void m_goto_video_settings() -{ - if(!menuInitialized) - return; - // TODO add code to switch back to the video settings (no idea how to do it now) - m_goto("videosettings"); -} diff --git a/qcsrc/menu/menu.qh b/qcsrc/menu/menu.qh index ab812437a..641ddf7d1 100644 --- a/qcsrc/menu/menu.qh +++ b/qcsrc/menu/menu.qh @@ -26,9 +26,6 @@ entity main; void m_hide(); void m_display(); void m_goto(string name); -void m_goto_skin_selector(); -void m_goto_language_selector(); -void m_goto_video_settings(); .string name; entity keyGrabber; diff --git a/qcsrc/menu/xonotic/dialog_settings_video.c b/qcsrc/menu/xonotic/dialog_settings_video.c index c0fddcc5b..57bbc3cd2 100644 --- a/qcsrc/menu/xonotic/dialog_settings_video.c +++ b/qcsrc/menu/xonotic/dialog_settings_video.c @@ -140,6 +140,6 @@ void XonoticVideoSettingsTab_fill(entity me) } me.gotoRC(me, me.rows - 1, 0); - me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "menu_cmd sync; vid_restart; menu_restart; defer 0.1 \"menu_cmd videosettings\"", COMMANDBUTTON_APPLY)); + me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "menu_cmd sync; vid_restart; menu_restart; menu_cmd videosettings", COMMANDBUTTON_APPLY)); } #endif diff --git a/qcsrc/menu/xonotic/languagelist.c b/qcsrc/menu/xonotic/languagelist.c index 9b9a148cc..5f6226f49 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, "prvm_language \"$_menu_prvm_language\"\nmenu_restart\ndefer 0.1 \"menu_cmd languageselect\"") + ATTRIB(XonoticLanguageList, doubleClickCommand, string, "prvm_language \"$_menu_prvm_language\"\nmenu_restart\nmenu_cmd languageselect") ENDCLASS(XonoticLanguageList) entity makeXonoticLanguageList(); diff --git a/qcsrc/menu/xonotic/skinlist.c b/qcsrc/menu/xonotic/skinlist.c index b636336b1..fdb07870a 100644 --- a/qcsrc/menu/xonotic/skinlist.c +++ b/qcsrc/menu/xonotic/skinlist.c @@ -175,7 +175,7 @@ void XonoticSkinList_drawListBoxItem(entity me, float i, vector absSize, float i void XonoticSkinList_setSkin(entity me) { me.saveCvars(me); - localcmd("\nmenu_restart\ndefer 0.1 \"menu_cmd skinselect\"\n"); + localcmd("\nmenu_restart\nmenu_cmd skinselect\n"); } void SetSkin_Click(entity btn, entity me)