Merge branch 'new-menus' into profiles

This commit is contained in:
Sally Coolatta 2021-12-04 15:47:11 -05:00
commit 8cbaad4e4f
5 changed files with 488 additions and 29 deletions

View file

@ -126,6 +126,7 @@ typedef struct menu_s
menuitem_t *menuitems; // menu items
INT16 x, y; // x, y of menu
INT16 extra1, extra2; // Can be whatever really! Options menu uses extra1 for bg colour.
INT16 transitionID; // only transition if IDs match
INT16 transitionTics; // tics for transitions out
@ -200,6 +201,19 @@ extern menu_t PLAY_BattleGamemodesDef;
extern menuitem_t OPTIONS_Main[];
extern menu_t OPTIONS_MainDef;
// We'll need this since we're gonna have to dynamically enable and disable options depending on which state we're in.
typedef enum
{
mopt_controls = 0,
mopt_video,
mopt_sound,
mopt_hud,
mopt_gameplay,
mopt_server,
mopt_data,
mopt_manual,
} mopt_e;
extern menuitem_t OPTIONS_Video[];
extern menu_t OPTIONS_VideoDef;
@ -234,6 +248,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 +275,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
{
@ -329,8 +367,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);
@ -508,15 +544,23 @@ extern struct optionsmenu_s {
INT32 vidm_column_size;
modedesc_t modedescs[MAXMODEDESCS];
UINT8 erasecontext;
// background:
INT16 currcolour;
INT16 lastcolour;
tic_t fade;
} 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_OptionsChangeBGColour(INT16 newcolour); // changes the background colour for options
void M_HandleItemToggles(INT32 choice); // For item toggling
void M_EraseData(INT32 choice); // For data erasing
// video modes menu (resolution)
@ -573,6 +617,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
@ -643,6 +690,7 @@ void M_DrawAddons(void);
0,\
source,\
0, 0,\
0, 0, \
1, 10,\
M_DrawKartGamemodeMenu,\
NULL,\
@ -650,4 +698,20 @@ void M_DrawAddons(void);
NULL\
}
#define IMAGEDEF(source)\
{\
sizeof(source) / sizeof(menuitem_t),\
NULL,\
0,\
source,\
0, 0,\
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.
@ -59,6 +62,7 @@ menu_t PLAY_CharSelectDef = {
PLAY_CharSelect,
0, 0,
0, 0,
0, 0,
M_DrawCharacterSelect,
M_CharacterSelectTick,
M_CharacterSelectQuit,
@ -120,6 +124,7 @@ menu_t PLAY_CupSelectDef = {
0,
PLAY_CupSelect,
0, 0,
0, 0,
2, 10,
M_DrawCupSelect,
M_CupSelectTick,
@ -138,6 +143,7 @@ menu_t PLAY_LevelSelectDef = {
0,
PLAY_LevelSelect,
0, 0,
0, 0,
2, 10,
M_DrawLevelSelect,
M_LevelSelectTick,
@ -159,6 +165,7 @@ menu_t PLAY_TimeAttackDef = {
0,
PLAY_TimeAttack,
0, 0,
0, 0,
2, 10,
M_DrawTimeAttack,
NULL,
@ -201,6 +208,7 @@ menu_t PLAY_MP_OptSelectDef = {
0,
PLAY_MP_OptSelect,
0, 0,
0, 0,
-1, 1,
M_DrawMPOptSelect,
M_MPOptSelectTick,
@ -236,6 +244,7 @@ menu_t PLAY_MP_HostDef = {
0,
PLAY_MP_Host,
0, 0,
0, 0,
-1, 1, // 1 frame transition.... This is really just because I don't want the black fade when we press esc, hehe
M_DrawMPHost,
M_MPOptSelectTick, // This handles the unfolding options
@ -271,6 +280,7 @@ menu_t PLAY_MP_JoinIPDef = {
0,
PLAY_MP_JoinIP,
0, 0,
0, 0,
-1, 1, // 1 frame transition.... This is really just because I don't want the black fade when we press esc, hehe
M_DrawMPJoinIP,
M_MPOptSelectTick, // This handles the unfolding options
@ -291,6 +301,7 @@ menu_t PLAY_MP_RoomSelectDef = {
PLAY_MP_RoomSelect,
0, 0,
0, 0,
0, 0,
M_DrawMPRoomSelect,
M_MPRoomSelectTick,
NULL,
@ -301,7 +312,7 @@ menu_t PLAY_MP_RoomSelectDef = {
menuitem_t OPTIONS_Main[] =
{
{IT_STRING | IT_SUBMENU, "Control Setup", "Remap keys & buttons to your likings.",
{IT_STRING | IT_TRANSTEXT, "Profile Setup", "Remap keys & buttons to your likings.",
NULL, NULL, 0, 0},
{IT_STRING | IT_SUBMENU, "Video Options", "Change video settings such as the resolution.",
@ -320,18 +331,20 @@ 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},
};
// For options menu, the 'extra1' field will determine the background colour to use for... the background! (What a concept!)
menu_t OPTIONS_MainDef = {
sizeof (OPTIONS_Main) / sizeof (menuitem_t),
&MainDef,
0,
OPTIONS_Main,
0, 0,
SKINCOLOR_SLATE, 0,
2, 10,
M_DrawOptions,
M_OptionsTick,
@ -392,6 +405,7 @@ menu_t OPTIONS_VideoDef = {
0,
OPTIONS_Video,
32, 80,
SKINCOLOR_PLAGUE, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
@ -412,6 +426,7 @@ menu_t OPTIONS_VideoModesDef = {
0,
OPTIONS_VideoModes,
48, 80,
SKINCOLOR_PLAGUE, 0,
2, 10,
M_DrawVideoModes,
M_OptionsTick,
@ -429,7 +444,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.",
@ -469,6 +484,7 @@ menu_t OPTIONS_VideoOGLDef = {
0,
OPTIONS_VideoOGL,
32, 80,
SKINCOLOR_PLAGUE, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
@ -531,6 +547,7 @@ menu_t OPTIONS_SoundDef = {
0,
OPTIONS_Sound,
48, 80,
SKINCOLOR_THUNDER, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
@ -585,6 +602,7 @@ menu_t OPTIONS_HUDDef = {
0,
OPTIONS_HUD,
48, 80,
SKINCOLOR_SUNSLAM, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
@ -633,6 +651,7 @@ menu_t OPTIONS_HUDOnlineDef = {
0,
OPTIONS_HUDOnline,
48, 80,
SKINCOLOR_SUNSLAM, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
@ -685,6 +704,7 @@ menu_t OPTIONS_GameplayDef = {
0,
OPTIONS_Gameplay,
48, 80,
SKINCOLOR_SCARLET, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
@ -729,6 +749,7 @@ menu_t OPTIONS_GameplayItemsDef = {
0,
OPTIONS_GameplayItems,
0, 75,
SKINCOLOR_SCARLET, 0,
2, 10,
M_DrawItemToggles,
M_OptionsTick,
@ -792,6 +813,7 @@ menu_t OPTIONS_ServerDef = {
0,
OPTIONS_Server,
48, 70, // This menu here is slightly higher because there's a lot of options...
SKINCOLOR_VIOLET, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
@ -803,7 +825,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.",
@ -849,6 +871,7 @@ menu_t OPTIONS_ServerAdvancedDef = {
0,
OPTIONS_ServerAdvanced,
48, 70, // This menu here is slightly higher because there's a lot of options...
SKINCOLOR_VIOLET, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
@ -857,6 +880,229 @@ 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,
SKINCOLOR_BLUEBERRY, 0,
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,
SKINCOLOR_BLUEBERRY, 0,
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,
SKINCOLOR_BLUEBERRY, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
NULL,
};
menuitem_t OPTIONS_DataReplay[] =
{
#ifdef HAVE_DISCORDRPC
{IT_STRING | IT_CVAR, "Rich Presence", "Allow Discord to display game info on your status.",
NULL, &cv_discordrp, 0, 0},
#endif
{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,
SKINCOLOR_BLUEBERRY, 0,
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,
SKINCOLOR_BLUEBERRY, 0,
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,
SKINCOLOR_BLUEBERRY, 0,
2, 10,
M_DrawGenericOptions,
M_OptionsTick,
NULL,
NULL,
};
// -------------------
// In-game/pause menus
// -------------------
@ -909,6 +1155,7 @@ menu_t PAUSE_MainDef = {
0,
PAUSE_Main,
0, 0,
0, 0,
1, 10, // For transition with some menus!
M_DrawPause,
M_PauseTick,
@ -959,6 +1206,7 @@ menu_t PAUSE_PlaybackMenuDef = {
PAUSE_PlaybackMenu,
BASEVIDWIDTH/2 - 88, 2,
0, 0,
0, 0,
M_DrawPlaybackMenu,
NULL,
NULL,
@ -968,6 +1216,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[] =
{
@ -982,6 +1250,7 @@ menu_t MISC_AddonsDef = {
MISC_AddonsMenu,
50, 28,
0, 0,
0, 0,
M_DrawAddons,
NULL,
NULL,

View file

@ -1652,10 +1652,34 @@ void M_DrawMPRoomSelect(void)
// OPTIONS MENU
// Draws the cogs and also the options background!
static void M_DrawOptionsCogs(void)
{
patch_t *back[3] = {W_CachePatchName("OPT_BAK1", PU_CACHE), W_CachePatchName("OPT_BAK2", PU_CACHE), W_CachePatchName("OPT_BAK3", PU_CACHE)};
V_DrawFixedPatch(0, 0, FRACUNIT, 0, back[(optionsmenu.ticker/10) %3], NULL);
// the background isn't drawn outside of being in the main menu state.
if (gamestate == GS_MENU)
{
patch_t *back[3] = {W_CachePatchName("OPT_BG1", PU_CACHE), W_CachePatchName("OPT_BG2", PU_CACHE), W_CachePatchName("OPT_BG3", PU_CACHE)};
INT32 tflag = 0;
UINT8 *c;
UINT8 *c2; // colormap for the one we're changing
if (optionsmenu.fade)
{
c2 = R_GetTranslationColormap(TC_DEFAULT, optionsmenu.lastcolour, GTC_CACHE);
V_DrawFixedPatch(0, 0, FRACUNIT, 0, back[(optionsmenu.ticker/10) %3], c2);
// prepare fade flag:
tflag = min(V_90TRANS, (optionsmenu.fade)<<V_ALPHASHIFT);
}
c = R_GetTranslationColormap(TC_DEFAULT, optionsmenu.currcolour, GTC_CACHE);
V_DrawFixedPatch(0, 0, FRACUNIT, tflag, back[(optionsmenu.ticker/10) %3], c);
}
else
{
patch_t *back_pause[3] = {W_CachePatchName("OPT_BAK1", PU_CACHE), W_CachePatchName("OPT_BAK2", PU_CACHE), W_CachePatchName("OPT_BAK3", PU_CACHE)};
V_DrawFixedPatch(0, 0, FRACUNIT, V_MODULATE, back_pause[(optionsmenu.ticker/10) %3], NULL);
}
}
void M_DrawOptionsMovingButton(void)
@ -1682,16 +1706,20 @@ void M_DrawOptions(void)
{
INT32 py = y - (itemOn*48);
INT32 px = x - menutransition.tics*64;
INT32 tflag = 0;
if (i == itemOn)
c = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PLAGUE, GTC_CACHE);
else
c = R_GetTranslationColormap(TC_DEFAULT, SKINCOLOR_BLACK, GTC_CACHE);
if (currentMenu->menuitems[i].status & IT_TRANSTEXT)
tflag = V_TRANSLUCENT;
if (!(menutransition.tics && i == itemOn))
{
V_DrawFixedPatch(px*FRACUNIT, py*FRACUNIT, FRACUNIT, 0, buttback, c);
V_DrawCenteredGamemodeString(px-3, py - 16, V_ALLOWLOWERCASE, (i == itemOn ? c : NULL), currentMenu->menuitems[i].text);
V_DrawCenteredGamemodeString(px-3, py - 16, V_ALLOWLOWERCASE|tflag, (i == itemOn ? c : NULL), currentMenu->menuitems[i].text);
}
y += 48;
@ -1797,13 +1825,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)
@ -2076,7 +2104,7 @@ void M_DrawItemToggles(void)
if (shitsfree)
shitsfree--;
V_DrawCenteredString(BASEVIDWIDTH/2, currentMenu->y, highlightflags, va("* %s *", currentMenu->menuitems[itemOn].text));
V_DrawCenteredString(BASEVIDWIDTH/2 + menutransition.tics*48, currentMenu->y, highlightflags, va("* %s *", currentMenu->menuitems[itemOn].text));
}
@ -2591,4 +2619,4 @@ void M_DrawAddons(void)
if (modifiedgame)
V_DrawSmallScaledPatch(x, y + 4, 0, addonsp[NUM_EXT+2]);
}
}

View file

@ -325,10 +325,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)
@ -358,18 +358,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)
@ -401,6 +400,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
// =========================================================================
@ -1450,6 +1493,7 @@ menu_t MessageDef =
0, // lastOn, flags (TO HACK)
MessageMenu, // menuitem_t ->
0, 0, // x, y (TO HACK)
0, 0, // extra1, extra2
0, 0, // transition tics
M_DrawMessageMenu, // drawing routine ->
NULL, // ticker routine
@ -2031,7 +2075,7 @@ static void M_MPConfirmCharacterSelection(void)
// colour
// (convert the number that's saved to a string we can use)
col = setup_player[i].color;
itoa(col, colstr, 10);
sprintf(colstr, "%d", col);
strcpy(cmd, commandnames[i][1]);
strcat(cmd, colstr);
@ -2782,7 +2826,15 @@ void M_InitOptions(INT32 choice)
{
(void)choice;
// @TODO: Change options when you do them from a netgame.
OPTIONS_MainDef.menuitems[mopt_gameplay].status = IT_STRING | IT_SUBMENU;
OPTIONS_MainDef.menuitems[mopt_server].status = IT_STRING | IT_SUBMENU;
// disable gameplay & server options if you aren't an admin in netgames. (GS_MENU check maybe unecessary but let's not take any chances)
if (netgame && gamestate != GS_MENU && !IsPlayerAdmin(consoleplayer))
{
OPTIONS_MainDef.menuitems[mopt_gameplay].status = IT_STRING | IT_TRANSTEXT;
OPTIONS_MainDef.menuitems[mopt_server].status = IT_STRING | IT_TRANSTEXT;
}
optionsmenu.ticker = 0;
optionsmenu.offset = 0;
@ -2792,11 +2844,31 @@ void M_InitOptions(INT32 choice)
optionsmenu.toptx = 0;
optionsmenu.topty = 0;
// BG setup:
optionsmenu.currcolour = OPTIONS_MainDef.extra1;
optionsmenu.lastcolour = 0;
optionsmenu.fade = 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);
}
// Prepares changing the colour of the background
void M_OptionsChangeBGColour(INT16 newcolour)
{
optionsmenu.fade = 10;
optionsmenu.lastcolour = optionsmenu.currcolour;
optionsmenu.currcolour = newcolour;
}
boolean M_OptionsQuit(void)
{
optionsmenu.toptx = 140-1;
@ -2819,7 +2891,7 @@ void M_OptionsTick(void)
optionsmenu.opty = optionsmenu.topty; // Avoid awkward 1 px errors.
}
// Garbage:
// Move the button for cool animations
if (currentMenu == &OPTIONS_MainDef)
{
M_OptionsQuit(); // ...So now this is used here.
@ -2830,6 +2902,14 @@ void M_OptionsTick(void)
optionsmenu.topty = 50;
}
// Handle the background stuff:
if (optionsmenu.fade)
optionsmenu.fade--;
// change the colour if we aren't matching the current menu colour
if (optionsmenu.currcolour != currentMenu->extra1)
M_OptionsChangeBGColour(currentMenu->extra1);
}
boolean M_OptionsInputs(INT32 ch)
@ -2841,6 +2921,7 @@ boolean M_OptionsInputs(INT32 ch)
{
optionsmenu.offset += 48;
M_NextOpt();
S_StartSound(NULL, sfx_menu1);
if (itemOn == 0)
optionsmenu.offset -= currentMenu->numitems*48;
@ -2851,6 +2932,7 @@ boolean M_OptionsInputs(INT32 ch)
{
optionsmenu.offset -= 48;
M_PrevOpt();
S_StartSound(NULL, sfx_menu1);
if (itemOn == currentMenu->numitems-1)
optionsmenu.offset += currentMenu->numitems*48;
@ -2859,6 +2941,10 @@ boolean M_OptionsInputs(INT32 ch)
}
case KEY_ENTER:
{
if (currentMenu->menuitems[itemOn].status & IT_TRANSTEXT)
return true; // No.
optionsmenu.optx = 140;
optionsmenu.opty = 70; // Default position for the currently selected option.
@ -3232,6 +3318,7 @@ boolean M_PauseInputs(INT32 ch)
case KEY_UPARROW:
{
pausemenu.offset -= 50; // Each item is spaced by 50 px
S_StartSound(NULL, sfx_menu1);
M_PrevOpt();
return true;
}
@ -3239,6 +3326,7 @@ boolean M_PauseInputs(INT32 ch)
case KEY_DOWNARROW:
{
pausemenu.offset += 50; // Each item is spaced by 50 px
S_StartSound(NULL, sfx_menu1);
M_NextOpt();
return true;
}
@ -3769,3 +3857,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);
}

View file

@ -181,9 +181,10 @@ static char returnWadPath[256];
#include "../m_argv.h"
#include "../k_menu.h"
#include "../r_main.h" // Frame interpolation/uncapped
#include "../k_menu.h"
#ifdef MAC_ALERT
#include "macosx/mac_alert.h"
#endif