Merge branch 'discord-rp-intro-fix' into 'master'

Minor Discord RP fixes

See merge request KartKrew/Kart!2195
This commit is contained in:
James R. 2024-04-02 00:43:30 +00:00
commit 98becc03ae
3 changed files with 47 additions and 5 deletions

View file

@ -631,8 +631,11 @@ void DRPC_UpdatePresence(void)
case GT_SPECIAL: case GT_SPECIAL:
case GT_VERSUS: case GT_VERSUS:
{ {
// You're using command line. // When/if these are accessible outside of
// Just patch over this for now. // 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; gs = DISCORD_GS_GRANDPRIX;
break; break;
} }
@ -655,15 +658,26 @@ void DRPC_UpdatePresence(void)
break; break;
} }
case GS_TITLESCREEN: case GS_TITLESCREEN:
case GS_INTRO:
{ {
gs = DISCORD_GS_TITLE; gs = DISCORD_GS_TITLE;
break; break;
} }
case GS_CREDITS: case GS_CREDITS:
case GS_EVALUATION:
{ {
gs = DISCORD_GS_CREDITS; gs = DISCORD_GS_CREDITS;
break; break;
} }
case GS_MENU:
{
if (menuactive && currentMenu == &EXTRAS_EggTVDef)
{
gs = DISCORD_GS_REPLAY;
break;
}
}
/* FALLTHRU */
default: default:
{ {
gs = DISCORD_GS_MENU; gs = DISCORD_GS_MENU;
@ -737,7 +751,7 @@ void DRPC_UpdatePresence(void)
{ {
case DISCORD_GS_REPLAY: case DISCORD_GS_REPLAY:
{ {
discordPresence.state = "Watching Replay"; discordPresence.state = "Watching Replays";
break; break;
} }
case DISCORD_GS_TITLE: case DISCORD_GS_TITLE:
@ -807,7 +821,7 @@ void DRPC_UpdatePresence(void)
snprintf(detailstr, 128, "Grand Prix%s | %s", snprintf(detailstr, 128, "Grand Prix%s | %s",
roundstr, roundstr,
grandprixinfo.masterbots ? "Master" : kartspeed_cons_t[grandprixinfo.gamespeed + 1].strvalue grandprixinfo.masterbots ? "Master" : gpdifficulty_cons_t[grandprixinfo.gamespeed].strvalue
); );
discordPresence.details = detailstr; discordPresence.details = detailstr;
} }
@ -852,6 +866,9 @@ void DRPC_UpdatePresence(void)
} }
// Gametype image // 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) switch (gs)
{ {
case DISCORD_GS_CUSTOM: case DISCORD_GS_CUSTOM:
@ -906,7 +923,7 @@ void DRPC_UpdatePresence(void)
case DISCORD_GS_REPLAY: case DISCORD_GS_REPLAY:
{ {
discordPresence.largeImageKey = "gs_replay"; discordPresence.largeImageKey = "gs_replay";
discordPresence.largeImageText = "Watching Replay"; discordPresence.largeImageText = "Watching Replays";
break; break;
} }
case DISCORD_GS_TITLE: case DISCORD_GS_TITLE:

View file

@ -18,6 +18,10 @@
#include "m_cond.h" #include "m_cond.h"
#include "music.h" #include "music.h"
#ifdef HAVE_DISCORDRPC
#include "discord.h"
#endif
#ifdef PC_DOS #ifdef PC_DOS
#include <stdio.h> // for snprintf #include <stdio.h> // for snprintf
int snprintf(char *str, size_t n, const char *fmt, ...); int snprintf(char *str, size_t n, const char *fmt, ...);
@ -819,6 +823,11 @@ void M_StartControlPanel(void)
itemOn = currentMenu->lastOn; itemOn = currentMenu->lastOn;
M_UpdateMenuBGImage(true); M_UpdateMenuBGImage(true);
#ifdef HAVE_DISCORDRPC
// currentMenu changed during GS_MENU
DRPC_UpdatePresence();
#endif
} }
else else
{ {
@ -940,6 +949,14 @@ void M_SetupNextMenu(menu_t *menudef, boolean notransition)
M_UpdateMenuBGImage(false); M_UpdateMenuBGImage(false);
M_PlayMenuJam(); M_PlayMenuJam();
#ifdef HAVE_DISCORDRPC
if (gamestate == GS_MENU)
{
// currentMenu changed during GS_MENU
DRPC_UpdatePresence();
}
#endif
} }
void M_GoBack(INT32 choice) void M_GoBack(INT32 choice)

View file

@ -14,6 +14,10 @@
#include "../k_menu.h" #include "../k_menu.h"
#include "../s_sound.h" #include "../s_sound.h"
#ifdef HAVE_DISCORDRPC
#include "../discord.h"
#endif
using namespace srb2::menus::egg_tv; using namespace srb2::menus::egg_tv;
namespace namespace
@ -132,6 +136,10 @@ void M_EggTV(INT32 choice)
g_egg_tv = std::make_unique<EggTV>(); g_egg_tv = std::make_unique<EggTV>();
M_SetupNextMenu(&EXTRAS_EggTVDef, false); M_SetupNextMenu(&EXTRAS_EggTVDef, false);
#ifdef HAVE_DISCORDRPC
DRPC_UpdatePresence();
#endif
} }
void M_EggTV_RefreshButtonLabels() void M_EggTV_RefreshButtonLabels()