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
This commit is contained in:
Sally Coolatta 2024-03-31 00:27:21 -04:00
parent 193c85a418
commit b921ea7e7b
3 changed files with 47 additions and 5 deletions

View file

@ -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:

View file

@ -18,6 +18,10 @@
#include "m_cond.h"
#include "music.h"
#ifdef HAVE_DISCORDRPC
#include "discord.h"
#endif
#ifdef PC_DOS
#include <stdio.h> // 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)

View file

@ -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<EggTV>();
M_SetupNextMenu(&EXTRAS_EggTVDef, false);
#ifdef HAVE_DISCORDRPC
DRPC_UpdatePresence();
#endif
}
void M_EggTV_RefreshButtonLabels()