Allow game invites with DEVELOP builds of the game

- Preliminary work so that the feature can be tested later down the line when the menu is reimplemented
- Made sure any secret revealing presence info is guarded behind a non-DEVELOP build check
This commit is contained in:
SteelT 2023-05-09 17:55:12 -04:00
parent d1ec068e84
commit ffe7c4f296

View file

@ -356,7 +356,7 @@ static void DRPC_GotServerIP(UINT32 address)
--------------------------------------------------*/ --------------------------------------------------*/
static const char *DRPC_GetServerIP(void) static const char *DRPC_GetServerIP(void)
{ {
const char *address; const char *address;
// If you're connected // If you're connected
if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL) if (I_GetNodeAddress && (address = I_GetNodeAddress(servernode)) != NULL)
@ -403,15 +403,16 @@ static void DRPC_EmptyRequests(void)
--------------------------------------------------*/ --------------------------------------------------*/
void DRPC_UpdatePresence(void) void DRPC_UpdatePresence(void)
{ {
char detailstr[48+1];
#ifdef USEMAPIMG #ifdef USEMAPIMG
char mapimg[8+1]; char mapimg[8+1];
#endif #endif
#ifndef DEVELOP
char detailstr[48+1];
char mapname[5+21+21+2+1]; char mapname[5+21+21+2+1];
char charimg[4+SKINNAMESIZE+1]; char charimg[4+SKINNAMESIZE+1];
char charname[11+SKINNAMESIZE+1]; char charname[11+SKINNAMESIZE+1];
#endif
boolean joinSecretSet = false; boolean joinSecretSet = false;
@ -437,10 +438,6 @@ void DRPC_UpdatePresence(void)
discordPresence.largeImageKey = "miscdevelop"; discordPresence.largeImageKey = "miscdevelop";
discordPresence.largeImageText = "No peeking!"; discordPresence.largeImageText = "No peeking!";
discordPresence.state = "Development EXE"; discordPresence.state = "Development EXE";
DRPC_EmptyRequests();
Discord_UpdatePresence(&discordPresence);
return;
#endif // DEVELOP #endif // DEVELOP
// Server info // Server info
@ -462,6 +459,7 @@ void DRPC_UpdatePresence(void)
} }
} }
#ifndef DEVELOP
if (cv_advertise.value) if (cv_advertise.value)
{ {
discordPresence.state = "Public"; discordPresence.state = "Public";
@ -470,6 +468,7 @@ void DRPC_UpdatePresence(void)
{ {
discordPresence.state = "Private"; discordPresence.state = "Private";
} }
#endif // DEVELOP
discordPresence.partyId = server_context; // Thanks, whoever gave us Mumble support, for implementing the EXACT thing Discord wanted for this field! discordPresence.partyId = server_context; // Thanks, whoever gave us Mumble support, for implementing the EXACT thing Discord wanted for this field!
discordPresence.partySize = D_NumPlayers(); // Players in server discordPresence.partySize = D_NumPlayers(); // Players in server
@ -482,6 +481,7 @@ void DRPC_UpdatePresence(void)
// so that you don't ever end up using bad information from another server. // so that you don't ever end up using bad information from another server.
memset(&discordInfo, 0, sizeof(discordInfo)); memset(&discordInfo, 0, sizeof(discordInfo));
#ifndef DEVELOP
// Offline info // Offline info
if (Playing()) if (Playing())
discordPresence.state = "Offline"; discordPresence.state = "Offline";
@ -489,8 +489,10 @@ void DRPC_UpdatePresence(void)
discordPresence.state = "Watching Replay"; discordPresence.state = "Watching Replay";
else else
discordPresence.state = "Menu"; discordPresence.state = "Menu";
#endif // DEVELOP
} }
#ifndef DEVELOP
// Gametype info // Gametype info
if ((gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING) && Playing()) if ((gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING) && Playing())
{ {
@ -642,6 +644,7 @@ void DRPC_UpdatePresence(void)
snprintf(charname, 28, "Character: %s", skins[players[consoleplayer].skin].realname); snprintf(charname, 28, "Character: %s", skins[players[consoleplayer].skin].realname);
discordPresence.smallImageText = charname; // Character name discordPresence.smallImageText = charname; // Character name
} }
#endif // DEVELOP
if (joinSecretSet == false) if (joinSecretSet == false)
{ {