SOC the Discord menus
Thanks nep for making rich presence build again lol
This commit is contained in:
parent
802a86422d
commit
8471ecabd8
5 changed files with 55 additions and 62 deletions
|
|
@ -716,7 +716,6 @@ const char *const MENUTYPES_LIST[] = {
|
|||
"MP_OFFLINESERVER",
|
||||
"SP_GRANDPRIX",
|
||||
"MISC_REPLAYHUT",
|
||||
"MISC_DISCORDREQUESTS",
|
||||
"CHANGESPECTATE",
|
||||
"MISC_REPLAYSTART",
|
||||
"PLAYBACK",
|
||||
|
|
@ -724,6 +723,11 @@ const char *const MENUTYPES_LIST[] = {
|
|||
"OP_GAMEHUD",
|
||||
"OP_VISUAL",
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
"OP_DISCORD",
|
||||
"MISC_DISCORDREQUESTS",
|
||||
#endif
|
||||
|
||||
"SPECIAL"
|
||||
};
|
||||
|
||||
|
|
@ -814,6 +818,9 @@ struct menu_routine_s const MENU_ROUTINES[] = {
|
|||
{ "CHANGECONTROL", &M_ChangeControl },
|
||||
{ "ASSIGNJOYSTICK", &M_AssignJoystick },
|
||||
{ "HANDLEMONITORTOGGLES", &M_HandleMonitorToggles },
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
{ "HANDLEDISCORDREQUESTS", &M_HandleDiscordRequests },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
@ -841,6 +848,9 @@ struct menu_drawer_s const MENU_DRAWERS[] = {
|
|||
{ "DRAWCONTROL", &M_DrawControl },
|
||||
{ "DRAWJOYSTICK", &M_DrawJoystick },
|
||||
{ "DRAWMONITORTOGGLES", &M_DrawMonitorToggles },
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
{ "DRAWDISCORDREQUESTS", &M_DrawDiscordRequests },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -234,6 +234,15 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
|
|||
readfollower(f);
|
||||
continue;
|
||||
}
|
||||
// sigh... menu hack
|
||||
else if (fastcmp(word, "DISCORDONLY"))
|
||||
{
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
continue;
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
word2 = strtok(NULL, " ");
|
||||
if (word2) {
|
||||
|
|
|
|||
|
|
@ -312,6 +312,20 @@ void DRPC_RemoveRequest(discordRequest_t *removeRequest)
|
|||
Z_Free(removeRequest);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
static boolean comregistered = false;
|
||||
static void COM_DiscordTest_f(void)
|
||||
{
|
||||
DiscordUser test = {
|
||||
.username = "Jeffma Balls",
|
||||
.discriminator = "6942",
|
||||
.userId = "69420694206942069",
|
||||
.avatar = NULL, // doesn't matter
|
||||
};
|
||||
DRPC_HandleJoinRequest(&test);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*--------------------------------------------------
|
||||
void DRPC_Init(void)
|
||||
|
||||
|
|
@ -334,6 +348,14 @@ void DRPC_Init(void)
|
|||
Discord_Initialize(DISCORD_APPID, &handlers, 1, NULL);
|
||||
I_AddExitFunc(DRPC_Shutdown);
|
||||
DRPC_UpdatePresence();
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (!comregistered)
|
||||
{
|
||||
COM_AddCommand("discordtest", COM_DiscordTest_f);
|
||||
comregistered = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DRPC_Shutdown(void)
|
||||
|
|
|
|||
48
src/m_menu.c
48
src/m_menu.c
|
|
@ -204,12 +204,6 @@ menu_t FreeslotTest;
|
|||
// the haxor message menu
|
||||
menu_t MessageDef;
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
menu_t MISC_DiscordRequestsDef;
|
||||
static void M_HandleDiscordRequests(INT32 choice);
|
||||
static void M_DrawDiscordRequests(void);
|
||||
#endif
|
||||
|
||||
#define lsheadingheight 16
|
||||
|
||||
// Sky Room
|
||||
|
|
@ -499,13 +493,6 @@ consvar_t cv_dummygpdifficulty = CVAR_INIT ("dummygpdifficulty", "Normal", CV_HI
|
|||
consvar_t cv_dummygpencore = CVAR_INIT ("dummygpencore", "Off", CV_HIDEN, CV_OnOff, NULL);
|
||||
consvar_t cv_dummygpcup = CVAR_INIT ("dummygpcup", "TEMP", CV_HIDEN, dummygpcup_cons_t, NULL);
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
static menuitem_t MISC_DiscordRequestsMenu[] =
|
||||
{
|
||||
{IT_KEYHANDLER|IT_NOTHING, NULL, "", {.routine = M_HandleDiscordRequests}, 0},
|
||||
};
|
||||
#endif
|
||||
|
||||
static tic_t playback_last_menu_interaction_leveltime = 0;
|
||||
|
||||
static menuitem_t MP_ConnectMenu[] =
|
||||
|
|
@ -535,37 +522,10 @@ enum
|
|||
FIRSTSERVERLINE
|
||||
};
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
static menuitem_t OP_DiscordOptionsMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CVAR, NULL, "Rich Presence", {.cvar = &cv_discordrp}, 10},
|
||||
|
||||
{IT_HEADER, NULL, "Rich Presence Settings", {NULL}, 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Streamer Mode", {.cvar = &cv_discordstreamer}, 40},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Allow Ask To Join", {.cvar = &cv_discordasks}, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Allow Invites", {.cvar = &cv_discordinvites}, 70},
|
||||
};
|
||||
#endif
|
||||
|
||||
// ==========================================================================
|
||||
// ALL MENU DEFINITIONS GO HERE
|
||||
// ==========================================================================
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
menu_t MISC_DiscordRequestsDef = {
|
||||
MN_NONE,
|
||||
NULL,
|
||||
sizeof (MISC_DiscordRequestsMenu)/sizeof (menuitem_t),
|
||||
&MPauseDef,
|
||||
MISC_DiscordRequestsMenu,
|
||||
M_DrawDiscordRequests,
|
||||
0, 0,
|
||||
0,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
//
|
||||
// M_GetGametypeColor
|
||||
//
|
||||
|
|
@ -690,10 +650,6 @@ void M_OpenGLOptionsMenu(INT32 choice)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(MN_NONE, NULL, OP_DiscordOptionsMenu, &OP_DataOptionsDef, 30, 30);
|
||||
#endif
|
||||
|
||||
// ==========================================================================
|
||||
// CVAR ONCHANGE EVENTS GO HERE
|
||||
// ==========================================================================
|
||||
|
|
@ -9326,7 +9282,7 @@ static const tic_t confirmLength = 3*TICRATE/4;
|
|||
static tic_t confirmDelay = 0;
|
||||
static boolean confirmAccept = false;
|
||||
|
||||
static void M_HandleDiscordRequests(INT32 choice)
|
||||
void M_HandleDiscordRequests(INT32 choice)
|
||||
{
|
||||
if (confirmDelay > 0)
|
||||
return;
|
||||
|
|
@ -9382,7 +9338,7 @@ static void M_DrawSticker(INT32 x, INT32 y, INT32 width, INT32 flags, boolean is
|
|||
V_DrawFixedPatch((x + width)*FRACUNIT, y*FRACUNIT, FRACUNIT, flags|V_FLIP, stickerEnd, NULL);
|
||||
}
|
||||
|
||||
static void M_DrawDiscordRequests(void)
|
||||
void M_DrawDiscordRequests(void)
|
||||
{
|
||||
discordRequest_t *curRequest = discordRequestList;
|
||||
UINT8 *colormap;
|
||||
|
|
|
|||
26
src/m_menu.h
26
src/m_menu.h
|
|
@ -151,7 +151,6 @@ typedef enum
|
|||
MN_MP_OFFLINESERVER,
|
||||
MN_SP_GRANDPRIX,
|
||||
MN_MISC_REPLAYHUT,
|
||||
MN_MISC_DISCORDREQUESTS,
|
||||
MN_CHANGESPECTATE,
|
||||
MN_MISC_REPLAYSTART,
|
||||
MN_PLAYBACK,
|
||||
|
|
@ -159,6 +158,11 @@ typedef enum
|
|||
MN_OP_GAMEHUD,
|
||||
MN_OP_VISUAL,
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
MN_OP_DISCORD,
|
||||
MN_MISC_DISCORDREQUESTS,
|
||||
#endif
|
||||
|
||||
MN_SPECIAL,
|
||||
|
||||
MN_FIRSTFREESLOT,
|
||||
|
|
@ -473,6 +477,9 @@ void M_ResetControls(INT32 choice);
|
|||
void M_ChangeControl(INT32 choice);
|
||||
void M_AssignJoystick(INT32 choice);
|
||||
void M_HandleMonitorToggles(INT32 choice);
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
void M_HandleDiscordRequests(INT32 choice);
|
||||
#endif
|
||||
|
||||
void M_DrawGenericMenu(void);
|
||||
void M_DrawCenteredMenu(void);
|
||||
|
|
@ -497,6 +504,9 @@ void M_DrawMusicTest(void);
|
|||
void M_DrawControl(void);
|
||||
void M_DrawJoystick(void);
|
||||
void M_DrawMonitorToggles(void);
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
void M_DrawDiscordRequests(void);
|
||||
#endif
|
||||
|
||||
// Maybe this goes here????? Who knows.
|
||||
boolean M_MouseNeeded(void);
|
||||
|
|
@ -646,20 +656,6 @@ UINT16 M_GetColorAfter(UINT16 color);
|
|||
void M_InitPlayerSetupColors(void);
|
||||
void M_FreePlayerSetupColors(void);
|
||||
|
||||
// These defines make it a little easier to make menus
|
||||
#define DEFAULTMENUSTYLE(id, header, source, prev, x, y)\
|
||||
{\
|
||||
id,\
|
||||
header,\
|
||||
sizeof(source)/sizeof(menuitem_t),\
|
||||
prev,\
|
||||
source,\
|
||||
M_DrawGenericMenu,\
|
||||
x, y,\
|
||||
0,\
|
||||
NULL\
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue