RingRacers/src/menus/options-data-erase-profile.c
toaster 6c6306889a M_StartMessage revamp
Immense 25-file diff, so spun off into its own branch.
- Improved appearance
    - Not just a big block of text on a blue background
    - Well, OK, the main part is, but some stuff has been spun out into its own fields
        - Title text
        - Text and button prompt for Yes/No or OK
    - Slides with pow on and off the screen
- Disabled MM_EVENTHANDLER, which has always been dog but got considerably worse after newmenus to the point nothing's using it anymore
    - Required in order to reduce the reliance on FUNCPTRCAST, which prevents Eidolon from compiling some stuff because it's not valid C++
2023-06-09 19:23:36 +01:00

109 lines
2.4 KiB
C

/// \file menus/options-data-erase-profile.c
/// \brief Erase Profile Menu
#include "../k_menu.h"
#include "../s_sound.h"
#include "../f_finale.h"
menuitem_t OPTIONS_DataProfileErase[] =
{
{IT_NOTHING | IT_KEYHANDLER, NULL, NULL, NULL, {.routine = M_HandleProfileErase}, 0, 0},
};
menu_t OPTIONS_DataProfileEraseDef = {
sizeof (OPTIONS_DataProfileErase) / sizeof (menuitem_t),
&OPTIONS_DataEraseDef,
0,
OPTIONS_DataProfileErase,
48, 80,
SKINCOLOR_BLACK, 0,
0,
"SHWDN2", // Danger.
2, 5,
M_DrawProfileErase,
M_OptionsTick,
NULL,
NULL,
NULL
};
// Check if we have any profile loaded.
void M_CheckProfileData(INT32 choice)
{
UINT8 np = PR_GetNumProfiles();
(void) choice;
if (np < 2)
{
S_StartSound(NULL, sfx_s3k7b);
M_StartMessage("Profile Erase", "There are no custom profiles.\n", NULL, MM_NOTHING, NULL, NULL);
return;
}
optionsmenu.eraseprofilen = 1;
M_SetupNextMenu(&OPTIONS_DataProfileEraseDef, false);
}
static void M_EraseProfileResponse(INT32 choice)
{
if (choice == MA_YES)
{
S_StartSound(NULL, sfx_itrole); // bweh heh heh
PR_DeleteProfile(optionsmenu.eraseprofilen);
// Did we bust our current profile..!?
if (cv_currprofile.value == -1)
{
F_StartIntro();
M_ClearMenus(true);
}
else if (optionsmenu.eraseprofilen > PR_GetNumProfiles()-1)
{
optionsmenu.eraseprofilen--;
}
}
}
void M_HandleProfileErase(INT32 choice)
{
const UINT8 pid = 0;
const UINT8 np = PR_GetNumProfiles()-1;
(void) choice;
if (menucmd[pid].dpad_ud > 0)
{
S_StartSound(NULL, sfx_s3k5b);
optionsmenu.eraseprofilen++;
if (optionsmenu.eraseprofilen > np)
optionsmenu.eraseprofilen = 1;
M_SetMenuDelay(pid);
}
else if (menucmd[pid].dpad_ud < 0)
{
S_StartSound(NULL, sfx_s3k5b);
if (optionsmenu.eraseprofilen == 1)
optionsmenu.eraseprofilen = np;
else
optionsmenu.eraseprofilen--;
M_SetMenuDelay(pid);
}
else if (M_MenuBackPressed(pid))
{
M_GoBack(0);
M_SetMenuDelay(pid);
}
else if (M_MenuConfirmPressed(pid))
{
if (optionsmenu.eraseprofilen == cv_currprofile.value)
M_StartMessage("Profile Erase", "Your ""\x85""current profile""\x80"" will be erased.\nAre you sure you want to proceed?\nDeleting this profile will also\nreturn you to the title screen.\n", &M_EraseProfileResponse, MM_YESNO, NULL, NULL);
else
M_StartMessage("Profile Erase", "This profile will be erased.\nAre you sure you want to proceed?\n", &M_EraseProfileResponse, MM_YESNO, NULL, NULL);
M_SetMenuDelay(pid);
}
}