mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
Show game speed and encore
This commit is contained in:
parent
27654ffb6a
commit
c76c1b8420
2 changed files with 32 additions and 14 deletions
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#endif
|
#endif // HAVE_CURL
|
||||||
|
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "d_clisrv.h"
|
#include "d_clisrv.h"
|
||||||
|
@ -44,7 +44,7 @@ struct SelfIPbuffer
|
||||||
|
|
||||||
#define IP_SIZE 16
|
#define IP_SIZE 16
|
||||||
static char self_ip[IP_SIZE];
|
static char self_ip[IP_SIZE];
|
||||||
#endif
|
#endif // HAVE_CURL
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
static void DRPC_HandleReady(const DiscordUser *user)
|
static void DRPC_HandleReady(const DiscordUser *user)
|
||||||
|
@ -167,7 +167,7 @@ static size_t DRPC_WriteServerIP(char *s, size_t size, size_t n, void *userdata)
|
||||||
|
|
||||||
return size*n;
|
return size*n;
|
||||||
}
|
}
|
||||||
#endif
|
#endif // HAVE_CURL
|
||||||
|
|
||||||
/*--------------------------------------------------
|
/*--------------------------------------------------
|
||||||
static const char *DRPC_GetServerIP(void)
|
static const char *DRPC_GetServerIP(void)
|
||||||
|
@ -241,7 +241,7 @@ static const char *DRPC_GetServerIP(void)
|
||||||
if (self_ip[0])
|
if (self_ip[0])
|
||||||
return self_ip;
|
return self_ip;
|
||||||
else
|
else
|
||||||
#endif
|
#endif // HAVE_CURL
|
||||||
return NULL; // Could not get your IP for whatever reason, so we cannot do Discord invites
|
return NULL; // Could not get your IP for whatever reason, so we cannot do Discord invites
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,6 +252,8 @@ static const char *DRPC_GetServerIP(void)
|
||||||
--------------------------------------------------*/
|
--------------------------------------------------*/
|
||||||
void DRPC_UpdatePresence(void)
|
void DRPC_UpdatePresence(void)
|
||||||
{
|
{
|
||||||
|
char detailstr[48+1];
|
||||||
|
|
||||||
char mapimg[8+1];
|
char mapimg[8+1];
|
||||||
char mapname[5+21+21+2+1];
|
char mapname[5+21+21+2+1];
|
||||||
|
|
||||||
|
@ -269,6 +271,18 @@ void DRPC_UpdatePresence(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
#ifdef DEVELOP
|
||||||
|
// This way, we can use the invite feature in-dev, but not have snoopers seeing any potential secrets! :P
|
||||||
|
discordPresence.largeImageKey = "miscdevelop";
|
||||||
|
discordPresence.largeImageText = "Nope.";
|
||||||
|
discordPresence.state = "Shh! We're testing!";
|
||||||
|
|
||||||
|
Discord_UpdatePresence(&discordPresence);
|
||||||
|
return;
|
||||||
|
#endif // DEVELOP
|
||||||
|
*/
|
||||||
|
|
||||||
// Server info
|
// Server info
|
||||||
if (netgame)
|
if (netgame)
|
||||||
{
|
{
|
||||||
|
@ -309,7 +323,14 @@ void DRPC_UpdatePresence(void)
|
||||||
if (modeattacking)
|
if (modeattacking)
|
||||||
discordPresence.details = "Time Attack";
|
discordPresence.details = "Time Attack";
|
||||||
else
|
else
|
||||||
discordPresence.details = gametype_cons_t[gametype].strvalue;
|
{
|
||||||
|
snprintf(detailstr, 48, "%s%s%s",
|
||||||
|
gametype_cons_t[gametype].strvalue,
|
||||||
|
(gametype == GT_RACE) ? va(" | %s", kartspeed_cons_t[gamespeed].strvalue) : "",
|
||||||
|
(encoremode == true) ? " | Encore" : ""
|
||||||
|
);
|
||||||
|
discordPresence.details = detailstr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION) // Map info
|
if (gamestate == GS_LEVEL || gamestate == GS_INTERMISSION) // Map info
|
||||||
|
@ -324,7 +345,7 @@ void DRPC_UpdatePresence(void)
|
||||||
else if (mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
|
else if (mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU)
|
||||||
{
|
{
|
||||||
// Hell map, use the method that got you here :P
|
// Hell map, use the method that got you here :P
|
||||||
discordPresence.largeImageKey = "maphell";
|
discordPresence.largeImageKey = "miscdice";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -339,12 +360,9 @@ void DRPC_UpdatePresence(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(mapname, 48, "Map: %s%s%s",
|
// Map name on tool tip
|
||||||
mapheaderinfo[gamemap-1]->lvlttl,
|
snprintf(mapname, 48, "Map: %s", G_BuildMapTitle(gamemap));
|
||||||
(strlen(mapheaderinfo[gamemap-1]->zonttl) > 0) ? va(" %s",mapheaderinfo[gamemap-1]->zonttl) : // SRB2kart
|
discordPresence.largeImageText = mapname;
|
||||||
((mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " Zone"),
|
|
||||||
(strlen(mapheaderinfo[gamemap-1]->actnum) > 0) ? va(" %s",mapheaderinfo[gamemap-1]->actnum) : "");
|
|
||||||
discordPresence.largeImageText = mapname; // Map name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Playing())
|
if (Playing())
|
||||||
|
@ -447,4 +465,4 @@ void DRPC_UpdatePresence(void)
|
||||||
Discord_UpdatePresence(&discordPresence);
|
Discord_UpdatePresence(&discordPresence);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // HAVE_DISCORDRPC
|
||||||
|
|
|
@ -6389,7 +6389,7 @@ void G_BeginRecording(void)
|
||||||
|
|
||||||
// Full replay title
|
// Full replay title
|
||||||
demo_p += 64;
|
demo_p += 64;
|
||||||
snprintf(demo.titlename, 64, "%s - %s", G_BuildMapTitle(gamemap), modeattacking ? "Record Attack" : connectedservername);
|
snprintf(demo.titlename, 64, "%s - %s", G_BuildMapTitle(gamemap), modeattacking ? "Time Attack" : connectedservername);
|
||||||
|
|
||||||
// demo checksum
|
// demo checksum
|
||||||
demo_p += 16;
|
demo_p += 16;
|
||||||
|
|
Loading…
Reference in a new issue