quakec/source/menu/menu_main.qc

96 lines
3.1 KiB
C++
Raw Normal View History

2024-10-16 04:38:47 +00:00
string menu_main_buttons[5] = {"mm_start", "mm_coop", "mm_options", "mm_credits", "mm_quit"};
2024-09-13 02:35:09 +00:00
string() Menu_Main_GetDashboardName =
{
switch(running_platform) {
case PLATFORM_WIN: return "Windows";
2024-10-20 17:56:33 +00:00
case PLATFORM_MAC: return "macOS";
2024-09-13 02:35:09 +00:00
case PLATFORM_LIN: return "Linux";
case PLATFORM_XBX: return "Xbox Dashboard";
case PLATFORM_AND: return "Android";
case PLATFORM_BSD: return "BSD";
case PLATFORM_IOS: return "iOS";
case PLATFORM_DOS: return "DOS";
default: return "System";
}
return "System";
};
2024-10-16 04:38:47 +00:00
string(string prev_id) Menu_Main_GetNextButton =
{
if (prev_id == "")
return menu_main_buttons[0];
string ret = menu_main_buttons[0];
for(float i = 0; i < menu_main_buttons.length; i++) {
if (menu_main_buttons[i] == prev_id) {
if (i + 1 >= menu_main_buttons.length)
break;
ret = menu_main_buttons[i + 1];
break;
}
}
// Wrap around to first if we selected Quit and this is WASM.
if (running_platform == PLATFORM_WEB && ret == "mm_quit")
ret = menu_main_buttons[0];
return ret;
};
string(string next_id) Menu_Main_GetPreviousButton =
{
if (next_id == "")
return menu_main_buttons[menu_main_buttons.length - 1];
string ret = menu_main_buttons[menu_main_buttons.length - 1];
for(float i = menu_main_buttons.length - 1; i > 0; i--) {
if (menu_main_buttons[i] == next_id) {
if (i - 1 < 0)
break;
ret = menu_main_buttons[i - 1];
break;
}
}
// Wrap around to first if we selected Quit and this is WASM.
if (running_platform == PLATFORM_WEB && ret == "mm_quit")
ret = menu_main_buttons[menu_main_buttons.length - 1];
return ret;
};
2024-09-13 02:35:09 +00:00
void() Menu_Main =
{
Menu_DrawBackground();
Menu_DrawTitle("MAIN MENU");
Menu_DrawBuildDate();
Menu_Button(1, "mm_start", "SOLO", "Play Solo.") ? Menu_StartSolo() : 0;
2024-11-10 15:56:17 +00:00
Menu_Button(2, "mm_coop", "COOPERATIVE", "Play with up to Four Players.") ? current_menu = MENU_COOP : 0;
2024-09-13 02:35:09 +00:00
Menu_DrawDivider(3);
Menu_Button(3.25, "mm_options", "CONFIGURATION", "Tweak Game related Options.") ? current_menu = MENU_OPTIONS : 0;
2024-09-14 02:59:18 +00:00
//Menu_Button(4.25, "mm_achievements", "ACHIEVEMENTS", "View Achievement Progress.") ? localcmd("\n") : 0;
Menu_GreyButton(4.25, "ACHIEVEMENTS");
2024-09-13 02:35:09 +00:00
Menu_DrawDivider(5.25);
2024-09-14 02:59:18 +00:00
Menu_Button(5.50, "mm_credits", "CREDITS", "NZ:P Team + Special Thanks.") ? current_menu = MENU_CREDITS : 0;
2024-09-13 02:35:09 +00:00
// Don't have a Quit Game button on WASM
if (running_platform != PLATFORM_WEB) {
Menu_DrawDivider(6.50);
Menu_Button(6.75, "mm_quit", "QUIT GAME", sprintf("Return to %s.", Menu_Main_GetDashboardName())) ? localcmd("quit\n") : 0;
}
Menu_SocialBadge(1, "soc_youtube", "youtube.com/@nzpteam", 2);
2024-10-20 17:56:33 +00:00
Menu_SocialBadge(2, "soc_mastadon", "twitter.com/nzpteam", 3); // FIXME: Move to Mastadon
2024-09-13 02:35:09 +00:00
Menu_SocialBadge(3, "soc_patreon", "patreon.com/cypressimplex", 4);
2024-10-20 17:56:33 +00:00
Menu_SocialBadge(4, "soc_matrix", "discord.nzp.gay", 1); // FIXME: Move to Matrix
2024-09-13 02:35:09 +00:00
sui_pop_frame();
2024-11-10 15:56:17 +00:00
};