From b921ea7e7b605073ce7c686bf7f5057a601d7d8d Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 31 Mar 2024 00:27:21 -0400 Subject: [PATCH] Minor Discord RP fixes - Fix GS_INTRO not being Title Screen - Fix GS_EVALUATION not being Credits - Use Watching Replays while browsing Egg TV menu - Use GP difficulty names instead of speed names during GP --- src/discord.c | 27 ++++++++++++++++++++++----- src/k_menufunc.c | 17 +++++++++++++++++ src/menus/extras-egg-tv.cpp | 8 ++++++++ 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/src/discord.c b/src/discord.c index a4ca79fba..07b1b638f 100644 --- a/src/discord.c +++ b/src/discord.c @@ -631,8 +631,11 @@ void DRPC_UpdatePresence(void) case GT_SPECIAL: case GT_VERSUS: { - // You're using command line. - // Just patch over this for now. + // When/if these are accessible outside of + // Grand Prix or Time Attack, then these + // should get their own images. + // But right now, you're just using command line. + // Just patch over it for now. gs = DISCORD_GS_GRANDPRIX; break; } @@ -655,15 +658,26 @@ void DRPC_UpdatePresence(void) break; } case GS_TITLESCREEN: + case GS_INTRO: { gs = DISCORD_GS_TITLE; break; } case GS_CREDITS: + case GS_EVALUATION: { gs = DISCORD_GS_CREDITS; break; } + case GS_MENU: + { + if (menuactive && currentMenu == &EXTRAS_EggTVDef) + { + gs = DISCORD_GS_REPLAY; + break; + } + } + /* FALLTHRU */ default: { gs = DISCORD_GS_MENU; @@ -737,7 +751,7 @@ void DRPC_UpdatePresence(void) { case DISCORD_GS_REPLAY: { - discordPresence.state = "Watching Replay"; + discordPresence.state = "Watching Replays"; break; } case DISCORD_GS_TITLE: @@ -807,7 +821,7 @@ void DRPC_UpdatePresence(void) snprintf(detailstr, 128, "Grand Prix%s | %s", roundstr, - grandprixinfo.masterbots ? "Master" : kartspeed_cons_t[grandprixinfo.gamespeed + 1].strvalue + grandprixinfo.masterbots ? "Master" : gpdifficulty_cons_t[grandprixinfo.gamespeed].strvalue ); discordPresence.details = detailstr; } @@ -852,6 +866,9 @@ void DRPC_UpdatePresence(void) } // Gametype image + // I am REALLY REALLY sad that there isn't enough room in a + // single Rich Presence app to handle enough images for all + // of the maps... switch (gs) { case DISCORD_GS_CUSTOM: @@ -906,7 +923,7 @@ void DRPC_UpdatePresence(void) case DISCORD_GS_REPLAY: { discordPresence.largeImageKey = "gs_replay"; - discordPresence.largeImageText = "Watching Replay"; + discordPresence.largeImageText = "Watching Replays"; break; } case DISCORD_GS_TITLE: diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 8a73bbe4e..9eac51b27 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -18,6 +18,10 @@ #include "m_cond.h" #include "music.h" +#ifdef HAVE_DISCORDRPC +#include "discord.h" +#endif + #ifdef PC_DOS #include // for snprintf int snprintf(char *str, size_t n, const char *fmt, ...); @@ -818,6 +822,11 @@ void M_StartControlPanel(void) itemOn = currentMenu->lastOn; M_UpdateMenuBGImage(true); + +#ifdef HAVE_DISCORDRPC + // currentMenu changed during GS_MENU + DRPC_UpdatePresence(); +#endif } else { @@ -939,6 +948,14 @@ void M_SetupNextMenu(menu_t *menudef, boolean notransition) M_UpdateMenuBGImage(false); M_PlayMenuJam(); + +#ifdef HAVE_DISCORDRPC + if (gamestate == GS_MENU) + { + // currentMenu changed during GS_MENU + DRPC_UpdatePresence(); + } +#endif } void M_GoBack(INT32 choice) diff --git a/src/menus/extras-egg-tv.cpp b/src/menus/extras-egg-tv.cpp index 9b9885c15..ca070cb6a 100644 --- a/src/menus/extras-egg-tv.cpp +++ b/src/menus/extras-egg-tv.cpp @@ -14,6 +14,10 @@ #include "../k_menu.h" #include "../s_sound.h" +#ifdef HAVE_DISCORDRPC +#include "../discord.h" +#endif + using namespace srb2::menus::egg_tv; namespace @@ -132,6 +136,10 @@ void M_EggTV(INT32 choice) g_egg_tv = std::make_unique(); M_SetupNextMenu(&EXTRAS_EggTVDef, false); + +#ifdef HAVE_DISCORDRPC + DRPC_UpdatePresence(); +#endif } void M_EggTV_RefreshButtonLabels()