mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Start of reimplementing the discord requests menu
- It's pretty barebones so far, more stuff has yet to be done - Updated to use the current method of checking if a memu button is pressed TODO: Port the menu drawer TODO: Fix confirm delay handling
This commit is contained in:
parent
ffe7c4f296
commit
cd59a4d34f
4 changed files with 94 additions and 1 deletions
15
src/k_menu.h
15
src/k_menu.h
|
|
@ -427,6 +427,10 @@ extern menu_t MISC_StatisticsDef;
|
||||||
extern menuitem_t MISC_SoundTest[];
|
extern menuitem_t MISC_SoundTest[];
|
||||||
extern menu_t MISC_SoundTestDef;
|
extern menu_t MISC_SoundTestDef;
|
||||||
|
|
||||||
|
#ifdef HAVE_DISCORDRPC
|
||||||
|
extern menu_t MISC_DiscordRequestsDef;
|
||||||
|
#endif
|
||||||
|
|
||||||
// We'll need this since we're gonna have to dynamically enable and disable options depending on which state we're in.
|
// We'll need this since we're gonna have to dynamically enable and disable options depending on which state we're in.
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
@ -1232,6 +1236,17 @@ void M_SoundTest(INT32 choice);
|
||||||
void M_DrawSoundTest(void);
|
void M_DrawSoundTest(void);
|
||||||
consvar_t *M_GetSoundTestVolumeCvar(void);
|
consvar_t *M_GetSoundTestVolumeCvar(void);
|
||||||
|
|
||||||
|
#ifdef HAVE_DISCORDRPC
|
||||||
|
extern struct discordrequestmenu_s {
|
||||||
|
tic_t confirmDelay;
|
||||||
|
boolean confirmAccept;
|
||||||
|
boolean removeRequest;
|
||||||
|
} discordrequestmenu;
|
||||||
|
|
||||||
|
void M_DiscordRequests(INT32 choice);
|
||||||
|
void M_DiscordRequestHandler(INT32 choice);
|
||||||
|
#endif
|
||||||
|
|
||||||
// These defines make it a little easier to make menus
|
// These defines make it a little easier to make menus
|
||||||
#define DEFAULTMENUSTYLE(source, prev, x, y)\
|
#define DEFAULTMENUSTYLE(source, prev, x, y)\
|
||||||
{\
|
{\
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ target_sources(SRB2SDL2 PRIVATE
|
||||||
gametype.c
|
gametype.c
|
||||||
manual.c
|
manual.c
|
||||||
sound-test.c
|
sound-test.c
|
||||||
|
discord-requests.c
|
||||||
message-box.c
|
message-box.c
|
||||||
pause-game.c
|
pause-game.c
|
||||||
pause-replay.c
|
pause-replay.c
|
||||||
|
|
|
||||||
66
src/menus/transient/discord-requests.c
Normal file
66
src/menus/transient/discord-requests.c
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
/// \file menus/transient/discord-requests.c
|
||||||
|
/// \brief Discord Requests menu
|
||||||
|
|
||||||
|
#ifdef HAVE_DISCORDRPC
|
||||||
|
#include "../../k_menu.h"
|
||||||
|
#include "../../s_sound.h"
|
||||||
|
#include "../../discord.h"
|
||||||
|
|
||||||
|
struct discordrequestmenu_s discordrequestmenu;
|
||||||
|
|
||||||
|
static menuitem_t MISC_DiscordRequests[] =
|
||||||
|
{
|
||||||
|
{IT_NOTHING | IT_KEYHANDLER, NULL, NULL, NULL, {.routine = M_DiscordRequestHandler}, 0, 0},
|
||||||
|
};
|
||||||
|
|
||||||
|
menu_t MISC_DiscordRequestsDef = {
|
||||||
|
sizeof(MISC_DiscordRequests) / sizeof(menuitem_t),
|
||||||
|
&PAUSE_MainDef,
|
||||||
|
0,
|
||||||
|
MISC_DiscordRequests,
|
||||||
|
0, 0,
|
||||||
|
0, 0,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
0, 0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
void M_DiscordRequestHandler(INT32 choice)
|
||||||
|
{
|
||||||
|
const UINT8 pid = 0;
|
||||||
|
(void)choice;
|
||||||
|
|
||||||
|
if (M_MenuConfirmPressed(pid))
|
||||||
|
{
|
||||||
|
M_SetMenuDelay(pid);
|
||||||
|
|
||||||
|
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_YES);
|
||||||
|
discordrequestmenu.confirmAccept = true;
|
||||||
|
discordrequestmenu.confirmDelay = menucmd[pid].delay;
|
||||||
|
S_StartSound(NULL, sfx_s3k63);
|
||||||
|
}
|
||||||
|
else if (M_MenuBackPressed(pid))
|
||||||
|
{
|
||||||
|
M_SetMenuDelay(pid);
|
||||||
|
|
||||||
|
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_NO);
|
||||||
|
discordrequestmenu.confirmAccept = false;
|
||||||
|
discordrequestmenu.confirmDelay = menucmd[pid].delay;
|
||||||
|
S_StartSound(NULL, sfx_s3kb2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void M_DiscordRequests(INT32 choice)
|
||||||
|
{
|
||||||
|
(void)choice;
|
||||||
|
|
||||||
|
MISC_SoundTestDef.prevMenu = currentMenu;
|
||||||
|
M_SetupNextMenu(&MISC_DiscordRequestsDef, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // HAVE_DISCORDRPC
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
#include "../../m_cond.h"
|
#include "../../m_cond.h"
|
||||||
#include "../../s_sound.h"
|
#include "../../s_sound.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_DISCORDRPC
|
||||||
|
#include "../../discord.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ESC pause menu
|
// ESC pause menu
|
||||||
// Since there's no descriptions to each item, we'll use the descriptions as the names of the patches we want to draw for each option :)
|
// Since there's no descriptions to each item, we'll use the descriptions as the names of the patches we want to draw for each option :)
|
||||||
|
|
||||||
|
|
@ -32,7 +36,7 @@ menuitem_t PAUSE_Main[] =
|
||||||
|
|
||||||
#ifdef HAVE_DISCORDRPC
|
#ifdef HAVE_DISCORDRPC
|
||||||
{IT_STRING | IT_CALL, "DISCORD REQUESTS", "M_ICODIS",
|
{IT_STRING | IT_CALL, "DISCORD REQUESTS", "M_ICODIS",
|
||||||
NULL, {NULL}, 0, 0},
|
NULL, {.routine = M_DiscordRequests}, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{IT_STRING | IT_CALL, "RESUME GAME", "M_ICOUNP",
|
{IT_STRING | IT_CALL, "RESUME GAME", "M_ICOUNP",
|
||||||
|
|
@ -189,6 +193,13 @@ void M_OpenPauseMenu(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_DISCORDRPC
|
||||||
|
if (discordRequestList)
|
||||||
|
{
|
||||||
|
PAUSE_Main[mpause_discordrequests].status = IT_STRING | IT_CALL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
G_ResetAllDeviceRumbles();
|
G_ResetAllDeviceRumbles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue