options: data & manual

This commit is contained in:
SinnamonLat 2021-11-26 16:36:15 +01:00
parent 6bea4a393a
commit c377ea1186
4 changed files with 359 additions and 21 deletions

View file

@ -234,6 +234,26 @@ extern menuitem_t OPTIONS_ServerAdvanced[];
extern menu_t OPTIONS_ServerAdvancedDef;
#endif
extern menuitem_t OPTIONS_Data[];
extern menu_t OPTIONS_DataDef;
extern menuitem_t OPTIONS_DataScreenshot[];
extern menu_t OPTIONS_DataScreenshotDef;
extern menuitem_t OPTIONS_DataAddon[];
extern menu_t OPTIONS_DataAddonDef;
extern menuitem_t OPTIONS_DataReplay[];
extern menu_t OPTIONS_DataReplayDef;
#ifdef HAVE_DISCORDRPC
extern menuitem_t OPTIONS_DataDiscord[];
extern menu_t OPTIONS_DataDiscordDef;
#endif
extern menuitem_t OPTIONS_DataErase[];
extern menu_t OPTIONS_DataEraseDef;
// PAUSE
extern menuitem_t PAUSE_Main[];
extern menu_t PAUSE_MainDef;
@ -241,6 +261,10 @@ extern menu_t PAUSE_MainDef;
extern menuitem_t MISC_Addons[];
extern menu_t MISC_AddonsDef;
// MANUAL
extern menuitem_t MISC_Manual[];
extern menu_t MISC_ManualDef;
// We'll need this since we're gonna have to dynamically enable and disable options depending on which state we're in.
typedef enum
{
@ -327,8 +351,6 @@ extern menu_t MessageDef;
void M_StartMessage(const char *string, void *routine, menumessagetype_t itemtype);
void M_StopMessage(INT32 choice);
void M_HandleImageDef(INT32 choice);
void M_QuitResponse(INT32 ch);
void M_QuitSRB2(INT32 choice);
@ -506,15 +528,16 @@ extern struct optionsmenu_s {
INT32 vidm_column_size;
modedesc_t modedescs[MAXMODEDESCS];
UINT8 erasecontext;
} optionsmenu;
void M_InitOptions(INT32 choice); // necessary for multiplayer since there's some options we won't want to access
void M_OptionsTick(void);
boolean M_OptionsInputs(INT32 ch);
boolean M_OptionsQuit(void); // resets buttons when you quit the options.
void M_HandleItemToggles(INT32 choice); // For item toggling
void M_EraseData(INT32 choice); // For data erasing
// video modes menu (resolution)
@ -571,6 +594,9 @@ boolean M_AddonsRefresh(void);
void M_HandleAddons(INT32 choice);
char *M_AddonsHeaderPath(void);
void M_Manual(INT32 choice);
void M_HandleImageDef(INT32 choice);
// M_MENUDRAW.C
// flags for text highlights
@ -648,4 +674,19 @@ void M_DrawAddons(void);
NULL\
}
#define IMAGEDEF(source)\
{\
sizeof(source) / sizeof(menuitem_t),\
NULL,\
0,\
source,\
0, 0,\
1, 10,\
M_DrawImageDef,\
NULL,\
NULL,\
NULL\
}
#endif //__K_MENU__

View file

@ -9,6 +9,9 @@
#include "s_sound.h" // sounds consvars
#include "g_game.h" // cv_chatnotifications
#include "console.h" // console cvars
#include "filesrch.h" // addons cvars
#include "m_misc.h" // screenshot cvars
#include "discord.h" // discord rpc cvars
// ==========================================================================
// ORGANIZATION START.
@ -320,10 +323,10 @@ menuitem_t OPTIONS_Main[] =
NULL, &OPTIONS_ServerDef, 0, 0},
{IT_STRING | IT_SUBMENU, "Data Options", "Miscellaneous data options such as the screenshot format.",
NULL, NULL, 0, 0},
NULL, &OPTIONS_DataDef, 0, 0},
{IT_STRING | IT_SUBMENU, "Tricks & Secrets", "Those who bother reading a game manual always get the edge over those who don't!",
NULL, NULL, 0, 0},
{IT_STRING | IT_CALL, "Tricks & Secrets", "Those who bother reading a game manual always get the edge over those who don't!",
NULL, M_Manual, 0, 0},
};
menu_t OPTIONS_MainDef = {
@ -429,7 +432,7 @@ menuitem_t OPTIONS_VideoOGL[] =
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, NULL, 0, 0},
{IT_SPACE | IT_NOTHING | IT_STRING, "OPTIONS BELOW ARE OPENGL ONLY!", "Watch people get confused anyway!!",
{IT_HEADER, "OPTIONS BELOW ARE OPENGL ONLY!", "Watch people get confused anyway!!",
NULL, NULL, 0, 0},
{IT_STRING | IT_CVAR, "3D Models", "Use 3D models instead of sprites when applicable.",
@ -803,7 +806,7 @@ menu_t OPTIONS_ServerDef = {
menuitem_t OPTIONS_ServerAdvanced[] =
{
{IT_STRING | IT_CVAR | IT_CV_STRING, "Server Browser Address", "Default is \'https://ms.kartkew.org/ms/api\'",
{IT_STRING | IT_CVAR | IT_CV_STRING, "Server Browser Address", "Default is \'https://ms.kartkrew.org/ms/api\'",
NULL, &cv_masterserver, 0, 0},
{IT_STRING | IT_CVAR, "Resynch. Attempts", "How many times to attempt sending data to desynchronized players.",
@ -857,6 +860,221 @@ menu_t OPTIONS_ServerAdvancedDef = {
};
#endif
menuitem_t OPTIONS_Data[] =
{
{IT_STRING | IT_SUBMENU, "Screenshot Options...", "Set options relative to screenshot and GIF capture.",
NULL, &OPTIONS_DataScreenshotDef, 0, 0},
{IT_STRING | IT_SUBMENU, "Addon Options...", "Set options relative to the addons menu.",
NULL, &OPTIONS_DataAddonDef, 0, 0},
{IT_STRING | IT_SUBMENU, "Replay Options...", "Set options relative to replays.",
NULL, &OPTIONS_DataReplayDef, 0, 0},
#ifdef HAVE_DISCORDRPC
{IT_STRING | IT_SUBMENU, "Discord Options...", "Set options relative to Discord Rich Presence.",
NULL, &OPTIONS_DataDiscordDef, 0, 0},
#endif
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, NULL, 0, 0},
// escape sequences don't like any letter from A to E following them... So let's also put E as an escape sequence lol. E is 69 (nice) which is 45 in hex.
{IT_STRING | IT_SUBMENU, "\x85\x45rase Data...", "Erase specific data. Be careful, what's deleted is gone forever!",
NULL, &OPTIONS_DataEraseDef, 0, 0},
};
menu_t OPTIONS_DataDef = {
sizeof (OPTIONS_Data) / sizeof (menuitem_t),
&OPTIONS_MainDef,
0,
OPTIONS_Data,
48, 80,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
NULL,
};
menuitem_t OPTIONS_DataAddon[] =
{
{IT_HEADER, "MENU", NULL,
NULL, NULL, 0, 0},
{IT_STRING | IT_CVAR, "Location", "Where to start searching addons from in the menu.",
NULL, &cv_addons_option, 0, 0},
{IT_STRING | IT_CVAR | IT_CV_STRING, "Custom Folder", "Specify which folder to start searching from if the location is set to custom.",
NULL, &cv_addons_folder, 24, 0},
{IT_STRING | IT_CVAR, "Identify Addons via", "Set whether to consider the extension or contents of a file.",
NULL, &cv_addons_md5, 0, 0},
{IT_STRING | IT_CVAR, "Show Unsupported Files", "Sets whether non-addon files should be shown.",
NULL, &cv_addons_showall, 0, 0},
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, NULL, 0, 0},
{IT_HEADER, "SEARCH", NULL,
NULL, NULL, 0, 0},
{IT_STRING | IT_CVAR, "Matching", "Set where to check for the text pattern when looking up addons via name.",
NULL, &cv_addons_search_type, 0, 0},
{IT_STRING | IT_CVAR, "Case Sensitivity", "Set whether to consider the case when searching for addons..",
NULL, &cv_addons_search_case, 0, 0},
};
menu_t OPTIONS_DataAddonDef = {
sizeof (OPTIONS_DataAddon) / sizeof (menuitem_t),
&OPTIONS_DataDef,
0,
OPTIONS_DataAddon,
48, 80,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
NULL,
};
menuitem_t OPTIONS_DataScreenshot[] =
{
{IT_HEADER, "SCREENSHOTS (F8)", NULL,
NULL, NULL, 0, 0},
{IT_STRING | IT_CVAR, "Storage Location", "Sets where to store screenshots.",
NULL, &cv_screenshot_option, 0, 0},
{IT_STRING | IT_CVAR | IT_CV_STRING, "Custom Folder", "Specify which folder to save screenshots in.",
NULL, &cv_screenshot_folder, 24, 0},
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, NULL, 0, 0},
{IT_HEADER, "GIF RECORDING (F9)", NULL,
NULL, NULL, 0, 0},
{IT_STRING | IT_CVAR, "Storage Location", "Sets where to store GIFs",
NULL, &cv_movie_option, 0, 0},
{IT_STRING | IT_CVAR | IT_CV_STRING, "Custom Folder", "Specify which folder to save GIFs in.",
NULL, &cv_movie_folder, 24, 0},
};
menu_t OPTIONS_DataScreenshotDef = {
sizeof (OPTIONS_DataScreenshot) / sizeof (menuitem_t),
&OPTIONS_DataDef,
0,
OPTIONS_DataScreenshot,
48, 80,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
NULL,
};
menuitem_t OPTIONS_DataReplay[] =
{
{IT_STRING | IT_CVAR, "Rich Presence", "Allow Discord to display game info on your status.",
NULL, &cv_discordrp, 0, 0},
{IT_STRING | IT_CVAR, "Synch. Check Interval", "How often to check for synchronization while playing back a replay.",
NULL, &cv_netdemosyncquality, 0, 0},
};
menu_t OPTIONS_DataReplayDef = {
sizeof (OPTIONS_DataReplay) / sizeof (menuitem_t),
&OPTIONS_DataDef,
0,
OPTIONS_DataReplay,
48, 80,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
NULL,
};
#ifdef HAVE_DISCORDRPC
menuitem_t OPTIONS_DataDiscord[] =
{
{IT_STRING | IT_CVAR, "Record Replays", "Select when to save replays.",
NULL, &cv_recordmultiplayerdemos, 0, 0},
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, NULL, 0, 0},
{IT_HEADER, "RICH PRESENCE SETTINGS", NULL,
NULL, NULL, 0, 0},
{IT_STRING | IT_CVAR, "Streamer Mode", "Prevents the logging of some account information such as your tag in the console.",
NULL, &cv_discordstreamer, 0, 0},
{IT_STRING | IT_CVAR, "Allow Ask to Join", "Allow other people to request joining your game from Discord.",
NULL, &cv_discordasks, 0, 0},
{IT_STRING | IT_CVAR, "Allow Invites", "Set who is allowed to generate Discord invites to your game.",
NULL, &cv_discordinvites, 0, 0},
};
menu_t OPTIONS_DataDiscordDef = {
sizeof (OPTIONS_DataDiscord) / sizeof (menuitem_t),
&OPTIONS_DataDef,
0,
OPTIONS_DataDiscord,
48, 80,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
NULL,
};
#endif
menuitem_t OPTIONS_DataErase[] =
{
{IT_STRING | IT_CALL, "Erase Time Attack Data", "Be careful! What's deleted is gone forever!",
NULL, M_EraseData, 0, 0},
{IT_STRING | IT_CALL, "Erase Unlockable Data", "Be careful! What's deleted is gone forever!",
NULL, M_EraseData, 0, 0},
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, NULL, 0, 0},
{IT_STRING | IT_CALL, "\x85\x45rase all Data", "Be careful! What's deleted is gone forever!",
NULL, M_EraseData, 0, 0},
};
menu_t OPTIONS_DataEraseDef = {
sizeof (OPTIONS_DataErase) / sizeof (menuitem_t),
&OPTIONS_DataDef,
0,
OPTIONS_DataErase,
48, 80,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
NULL,
};
// -------------------
// In-game/pause menus
// -------------------
@ -968,6 +1186,26 @@ menu_t PAUSE_PlaybackMenuDef = {
// Other misc menus:
// Manual
menuitem_t MISC_Manual[] = {
{IT_NOTHING | IT_KEYHANDLER, "MANUAL00", NULL, NULL, M_HandleImageDef, 0, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL01", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL02", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL03", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL04", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL05", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL06", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL07", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL08", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL09", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL10", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL11", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL12", NULL, NULL, M_HandleImageDef, 1, 0},
{IT_NOTHING | IT_KEYHANDLER, "MANUAL99", NULL, NULL, M_HandleImageDef, 0, 0},
};
menu_t MISC_ManualDef = IMAGEDEF(MISC_Manual);
// Addons menu! (Just a straight port for now)
menuitem_t MISC_AddonsMenu[] =
{

View file

@ -1797,13 +1797,13 @@ void M_DrawGenericOptions(void)
/* FALLTHRU */
case IT_DYLITLSPACE:
case IT_SPACE:
y += SMALLLINEHEIGHT;
y += (currentMenu->menuitems[i].mvar1 ? : SMALLLINEHEIGHT);
break;
case IT_GRAYPATCH:
if (currentMenu->menuitems[i].patch && currentMenu->menuitems[i].patch[0])
V_DrawMappedPatch(x, y, 0,
W_CachePatchName(currentMenu->menuitems[i].patch,PU_CACHE), graymap);
y += LINEHEIGHT;
y += (currentMenu->menuitems[i].mvar1 ? : SMALLLINEHEIGHT);
break;
case IT_TRANSTEXT:
if (currentMenu->menuitems[i].mvar1)
@ -2591,4 +2591,4 @@ void M_DrawAddons(void)
if (modifiedgame)
V_DrawSmallScaledPatch(x, y + 4, 0, addonsp[NUM_EXT+2]);
}
}

View file

@ -323,10 +323,10 @@ static void Dummystaff_OnChange(void)
void Screenshot_option_Onchange(void)
{
#if 0
OP_ScreenshotOptionsMenu[op_screenshot_folder].status =
// Screenshot opt is at #3, 0 based array obv.
OPTIONS_DataScreenshot[2].status =
(cv_screenshot_option.value == 3 ? IT_CVAR|IT_STRING|IT_CV_STRING : IT_DISABLED);
#endif
}
void Moviemode_mode_Onchange(void)
@ -356,18 +356,17 @@ void Moviemode_mode_Onchange(void)
void Moviemode_option_Onchange(void)
{
#if 0
OP_ScreenshotOptionsMenu[op_movie_folder].status =
// opt 7 in a 0 based array, you get the idea...
OPTIONS_DataScreenshot[6].status =
(cv_movie_option.value == 3 ? IT_CVAR|IT_STRING|IT_CV_STRING : IT_DISABLED);
#endif
}
void Addons_option_Onchange(void)
{
#if 0
OP_AddonsOptionsMenu[op_addons_folder].status =
// Option 2 will always be the textbar.
// (keep in mind this is a 0 indexed array and the first element is a header...)
OPTIONS_DataAddon[2].status =
(cv_addons_option.value == 3 ? IT_CVAR|IT_STRING|IT_CV_STRING : IT_DISABLED);
#endif
}
void M_SortServerList(void)
@ -399,6 +398,50 @@ void M_SortServerList(void)
#endif
}
static void M_EraseDataResponse(INT32 ch)
{
UINT8 i;
if (ch != 'y' && ch != KEY_ENTER)
return;
S_StartSound(NULL, sfx_itrole); // bweh heh heh
// Delete the data
if (optionsmenu.erasecontext == 2)
{
// SRB2Kart: This actually needs to be done FIRST, so that you don't immediately regain playtime/matches secrets
totalplaytime = 0;
matchesplayed = 0;
for (i = 0; i < PWRLV_NUMTYPES; i++)
vspowerlevel[i] = PWRLVRECORD_START;
}
if (optionsmenu.erasecontext != 1)
G_ClearRecords();
if (optionsmenu.erasecontext != 0)
M_ClearSecrets();
F_StartIntro();
M_ClearMenus(true);
}
void M_EraseData(INT32 choice)
{
const char *eschoice, *esstr = M_GetText("Are you sure you want to erase\n%s?\n\n(Press 'Y' to confirm)\n");
optionsmenu.erasecontext = (UINT8)choice;
if (choice == 0)
eschoice = M_GetText("Time Attack data");
else if (choice == 1)
eschoice = M_GetText("Secrets data");
else
eschoice = M_GetText("ALL game data");
M_StartMessage(va(esstr, eschoice),M_EraseDataResponse,MM_YESNO);
}
// =========================================================================
// BASIC MENU HANDLING
// =========================================================================
@ -2960,8 +3003,15 @@ void M_InitOptions(INT32 choice)
optionsmenu.toptx = 0;
optionsmenu.topty = 0;
// So that pause doesn't go to the main menu...
OPTIONS_MainDef.prevMenu = currentMenu;
// This will disable or enable the textboxes of the affected menus before we get to them.
Screenshot_option_Onchange();
Moviemode_mode_Onchange();
Moviemode_option_Onchange();
Addons_option_Onchange();
M_SetupNextMenu(&OPTIONS_MainDef, false);
}
@ -3937,3 +3987,12 @@ void M_HandleAddons(INT32 choice)
M_ClearMenus(true);
}
}
// Opening manual
void M_Manual(INT32 choice)
{
(void)choice;
MISC_ManualDef.prevMenu = (choice == INT32_MAX ? NULL : currentMenu);
M_SetupNextMenu(&MISC_ManualDef, true);
}