From 43d09e46ada4ac047b00b53f6c584ac9184e3358 Mon Sep 17 00:00:00 2001 From: erysdren Date: Tue, 12 Nov 2024 10:14:48 -0600 Subject: [PATCH] MENU: use functions to start solo and coop games --- source/menu/m_menu.qc | 12 ++++++++++++ source/menu/menu_coop.qc | 2 +- source/menu/menu_main.qc | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/source/menu/m_menu.qc b/source/menu/m_menu.qc index 1005b30..c12ad5e 100644 --- a/source/menu/m_menu.qc +++ b/source/menu/m_menu.qc @@ -647,6 +647,18 @@ void(string id, vector pos, vector size, __inout vector scrollofs, float num_ser sui_list_view_end(); }; +void() Menu_StartCoop = +{ + localcmd("sv_public 2\n"); + current_menu = MENU_COOPSTOCK; +}; + +void() Menu_StartSolo = +{ + localcmd("sv_public 0\n"); + current_menu = MENU_SOLO; +}; + struct name_command { string name; string command; diff --git a/source/menu/menu_coop.qc b/source/menu/menu_coop.qc index 96e92e6..d60c5f0 100644 --- a/source/menu/menu_coop.qc +++ b/source/menu/menu_coop.qc @@ -171,7 +171,7 @@ void() Menu_Coop_Create = Menu_PasswordInput("ccm_password", 3, server_password, server_password_cursor); Menu_DrawDivider(4); - Menu_Button(4.25, "ccm_choosemap", "CHOOSE MAP", "Select a Map to start the Game.") ? current_menu = MENU_COOPSTOCK : 0; + Menu_Button(4.25, "ccm_choosemap", "CHOOSE MAP", "Select a Map to start the Game.") ? Menu_StartCoop() : 0; Menu_Button(-1, "ccm_back", "BACK", "Return to Co-Op Menu.") ? current_menu = MENU_COOP : 0; diff --git a/source/menu/menu_main.qc b/source/menu/menu_main.qc index 4ee2df3..aeb684c 100644 --- a/source/menu/menu_main.qc +++ b/source/menu/menu_main.qc @@ -71,7 +71,7 @@ void() Menu_Main = Menu_DrawTitle("MAIN MENU"); Menu_DrawBuildDate(); - Menu_Button(1, "mm_start", "SOLO", "Play Solo.") ? current_menu = MENU_SOLO : 0; + Menu_Button(1, "mm_start", "SOLO", "Play Solo.") ? Menu_StartSolo() : 0; Menu_Button(2, "mm_coop", "COOPERATIVE", "Play with up to Four Players.") ? current_menu = MENU_COOP : 0; Menu_DrawDivider(3); Menu_Button(3.25, "mm_options", "CONFIGURATION", "Tweak Game related Options.") ? current_menu = MENU_OPTIONS : 0;