From: Mario Date: Mon, 30 Jan 2017 04:35:23 +0000 (+1000) Subject: Add a file parameter to quickmenu, to allow loading different menus with different... X-Git-Tag: xonotic-v0.8.2~257 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bb12a18bafa6e3cd4f0304d2856a87887c8c9287;p=xonotic%2Fxonotic-data.pk3dir.git Add a file parameter to quickmenu, to allow loading different menus with different binds --- diff --git a/qcsrc/client/commands/cl_cmd.qc b/qcsrc/client/commands/cl_cmd.qc index 631090cc1..f79578471 100644 --- a/qcsrc/client/commands/cl_cmd.qc +++ b/qcsrc/client/commands/cl_cmd.qc @@ -248,7 +248,7 @@ void LocalCommand_handlevote(int request, int argc) bool QuickMenu_IsOpened(); void QuickMenu_Close(); -bool QuickMenu_Open(string mode, string submenu); +bool QuickMenu_Open(string mode, string submenu, string file); bool HUD_MinigameMenu_IsOpened(); void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger); @@ -278,15 +278,17 @@ void LocalCommand_hud(int request, int argc) { if (argv(2) == "help") { - LOG_INFO(" quickmenu [[default | file | \"\"] submenu]\n"); + LOG_INFO(" quickmenu [[default | file | \"\"] submenu file]\n"); LOG_INFO("Called without options (or with \"\") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.\n"); LOG_INFO("A submenu name can be given to open the quickmenu directly in a submenu; it requires to specify 'default', 'file' or '\"\"' option.\n"); + LOG_INFO("A file name can also be given to open a different quickmenu\n"); return; } + string file = ((argv(4) == "") ? autocvar_hud_panel_quickmenu_file : argv(4)); if (QuickMenu_IsOpened()) QuickMenu_Close(); else - QuickMenu_Open(argv(2), argv(3)); // mode, submenu + QuickMenu_Open(argv(2), argv(3), file); // mode, submenu return; } diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index e242ae895..0940b0261 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -64,14 +64,14 @@ void QuickMenu_Page_ClearEntry(int i) float QuickMenu_Page_Load(string target_submenu, float new_page); void QuickMenu_Default(string submenu); -bool QuickMenu_Open(string mode, string submenu) +bool QuickMenu_Open(string mode, string submenu, string file) { int fh = -1; string s; if(mode == "") { - if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0") + if(file == "" || file == "0") mode = "default"; else mode = "file"; @@ -79,13 +79,13 @@ bool QuickMenu_Open(string mode, string submenu) if(mode == "file") { - if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0") + if(file == "" || file == "0") LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n"); else { - fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ); + fh = fopen(file, FILE_READ); if(fh < 0) - LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", autocvar_hud_panel_quickmenu_file); + LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", file); } if(fh < 0) mode = "default"; diff --git a/qcsrc/server/race.qh b/qcsrc/server/race.qh index 6419afb73..472827efa 100644 --- a/qcsrc/server/race.qh +++ b/qcsrc/server/race.qh @@ -47,6 +47,7 @@ void race_SendNextCheckpoint(entity e, float spec); void race_PreparePlayer(entity this); void race_send_recordtime(float msg); void race_send_speedaward(float msg); +void race_setTime(string map, float t, string myuid, string mynetname, entity e, bool showmessage); float speedaward_speed; string speedaward_holder;