MENU: use functions to start solo and coop games

This commit is contained in:
erysdren 2024-11-12 10:14:48 -06:00
parent e02d043a66
commit 43d09e46ad
3 changed files with 14 additions and 2 deletions

View file

@ -647,6 +647,18 @@ void(string id, vector pos, vector size, __inout vector scrollofs, float num_ser
sui_list_view_end(); 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 { struct name_command {
string name; string name;
string command; string command;

View file

@ -171,7 +171,7 @@ void() Menu_Coop_Create =
Menu_PasswordInput("ccm_password", 3, server_password, server_password_cursor); Menu_PasswordInput("ccm_password", 3, server_password, server_password_cursor);
Menu_DrawDivider(4); 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; Menu_Button(-1, "ccm_back", "BACK", "Return to Co-Op Menu.") ? current_menu = MENU_COOP : 0;

View file

@ -71,7 +71,7 @@ void() Menu_Main =
Menu_DrawTitle("MAIN MENU"); Menu_DrawTitle("MAIN MENU");
Menu_DrawBuildDate(); 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_Button(2, "mm_coop", "COOPERATIVE", "Play with up to Four Players.") ? current_menu = MENU_COOP : 0;
Menu_DrawDivider(3); Menu_DrawDivider(3);
Menu_Button(3.25, "mm_options", "CONFIGURATION", "Tweak Game related Options.") ? current_menu = MENU_OPTIONS : 0; Menu_Button(3.25, "mm_options", "CONFIGURATION", "Tweak Game related Options.") ? current_menu = MENU_OPTIONS : 0;