Add envelope icon, add sounds

This commit is contained in:
Sally Coolatta 2020-08-22 04:54:08 -04:00
parent 98f586a2f9
commit 3c128660b4
8 changed files with 72 additions and 16 deletions

View file

@ -46,6 +46,7 @@
#include "lua_script.h" #include "lua_script.h"
#include "lua_hook.h" #include "lua_hook.h"
#include "k_kart.h" #include "k_kart.h"
#include "s_sound.h" // sfx_syfail
#ifdef CLIENT_LOADINGSCREEN #ifdef CLIENT_LOADINGSCREEN
// cl loading screen // cl loading screen
@ -3130,6 +3131,9 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
#endif #endif
} }
if (msg != KICK_MSG_PLAYER_QUIT)
S_StartSound(NULL, sfx_syfail); // he he he
switch (msg) switch (msg)
{ {
case KICK_MSG_GO_AWAY: case KICK_MSG_GO_AWAY:

View file

@ -268,6 +268,9 @@ static void DRPC_HandleJoinRequest(const DiscordUser *requestUser)
{ {
discordRequestList = newRequest; discordRequestList = newRequest;
} }
// Made it to the end, request was valid, so play the request sound :)
S_StartSound(NULL, sfx_requst);
} }
/*-------------------------------------------------- /*--------------------------------------------------
@ -375,16 +378,6 @@ void DRPC_RecieveDiscordInfo(UINT8 **p, INT32 playernum)
discordInfo.everyoneCanInvite = (boolean)READUINT8(*p); discordInfo.everyoneCanInvite = (boolean)READUINT8(*p);
DRPC_UpdatePresence(); DRPC_UpdatePresence();
if (DRPC_InvitesAreAllowed() == false)
{
// Flush the request list, if it still exists
while (discordRequestList != NULL)
{
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_IGNORE);
DRPC_RemoveRequest(discordRequestList);
}
}
} }
#ifdef HAVE_CURL #ifdef HAVE_CURL
@ -514,6 +507,8 @@ void DRPC_UpdatePresence(void)
char charimg[4+SKINNAMESIZE+1]; char charimg[4+SKINNAMESIZE+1];
char charname[11+SKINNAMESIZE+1]; char charname[11+SKINNAMESIZE+1];
boolean joinSecretSet = false;
DiscordRichPresence discordPresence; DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence)); memset(&discordPresence, 0, sizeof(discordPresence));
@ -564,6 +559,8 @@ void DRPC_UpdatePresence(void)
char *xorjoin = DRPC_XORIPString(join); char *xorjoin = DRPC_XORIPString(join);
discordPresence.joinSecret = xorjoin; discordPresence.joinSecret = xorjoin;
free(xorjoin); free(xorjoin);
joinSecretSet = true;
} }
} }
} }
@ -724,6 +721,16 @@ void DRPC_UpdatePresence(void)
discordPresence.smallImageText = charname; // Character name discordPresence.smallImageText = charname; // Character name
} }
if (joinSecretSet == false)
{
// Not able to join? Flush the request list, if it exists.
while (discordRequestList != NULL)
{
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_IGNORE);
DRPC_RemoveRequest(discordRequestList);
}
}
Discord_UpdatePresence(&discordPresence); Discord_UpdatePresence(&discordPresence);
} }

View file

@ -11334,18 +11334,23 @@ static boolean confirmAccept = false;
static void M_HandleDiscordRequests(INT32 choice) static void M_HandleDiscordRequests(INT32 choice)
{ {
if (confirmDelay > 0)
return;
switch (choice) switch (choice)
{ {
case KEY_ESCAPE:
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_NO);
confirmAccept = false;
confirmDelay = confirmLength;
break;
case KEY_ENTER: case KEY_ENTER:
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_YES); Discord_Respond(discordRequestList->userID, DISCORD_REPLY_YES);
confirmAccept = true; confirmAccept = true;
confirmDelay = confirmLength; confirmDelay = confirmLength;
S_StartSound(NULL, sfx_s3k63);
break;
case KEY_ESCAPE:
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_NO);
confirmAccept = false;
confirmDelay = confirmLength;
S_StartSound(NULL, sfx_s3kb2);
break; break;
} }
} }

View file

@ -81,6 +81,10 @@
#include "ogl_sdl.h" #include "ogl_sdl.h"
#endif #endif
#ifdef HAVE_DISCORDRPC
#include "../discord.h"
#endif
// maximum number of windowed modes (see windowedModes[][]) // maximum number of windowed modes (see windowedModes[][])
#define MAXWINMODES (18) #define MAXWINMODES (18)
@ -1387,6 +1391,11 @@ void I_FinishUpdate(void)
if (cv_showping.value && netgame && consoleplayer != serverplayer) if (cv_showping.value && netgame && consoleplayer != serverplayer)
SCR_DisplayLocalPing(); SCR_DisplayLocalPing();
#ifdef HAVE_DISCORDRPC
if (discordRequestList != NULL)
ST_AskToJoinEnvelope();
#endif
if (rendermode == render_soft && screens[0]) if (rendermode == render_soft && screens[0])
{ {
SDL_Rect rect; SDL_Rect rect;

View file

@ -816,6 +816,8 @@ sfxinfo_t S_sfx[NUMSFX] =
{"mkuma", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Trigger Happy Havoc Monokuma {"mkuma", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Trigger Happy Havoc Monokuma
{"toada", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Arid Sands Toad scream {"toada", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Arid Sands Toad scream
{"bsnipe", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Banana sniping {"bsnipe", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Banana sniping
{"requst", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Got a Discord join request
{"syfail", false, 96, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Funny sync failure
{"itfree", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // :shitsfree: {"itfree", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // :shitsfree:
{"dbgsal", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Debug notification {"dbgsal", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Debug notification

View file

@ -891,6 +891,8 @@ typedef enum
sfx_mkuma, sfx_mkuma,
sfx_toada, sfx_toada,
sfx_bsnipe, sfx_bsnipe,
sfx_requst,
sfx_syfail,
sfx_itfree, sfx_itfree,
sfx_dbgsal, sfx_dbgsal,

View file

@ -129,6 +129,11 @@ static patch_t *gotbflag;
static patch_t *hud_tv1; static patch_t *hud_tv1;
static patch_t *hud_tv2; static patch_t *hud_tv2;
#ifdef HAVE_DISCORDRPC
// Discord Rich Presence
static patch_t *envelope;
#endif
// SRB2kart // SRB2kart
hudinfo_t hudinfo[NUMHUDITEMS] = hudinfo_t hudinfo[NUMHUDITEMS] =
@ -349,6 +354,11 @@ void ST_LoadGraphics(void)
// Midnight Channel: // Midnight Channel:
hud_tv1 = W_CachePatchName("HUD_TV1", PU_HUDGFX); hud_tv1 = W_CachePatchName("HUD_TV1", PU_HUDGFX);
hud_tv2 = W_CachePatchName("HUD_TV2", PU_HUDGFX); hud_tv2 = W_CachePatchName("HUD_TV2", PU_HUDGFX);
#ifdef HAVE_DISCORDRPC
// Discord Rich Presence
envelope = W_CachePatchName("K_REQUES", PU_HUDGFX);
#endif
} }
// made separate so that skins code can reload custom face graphics // made separate so that skins code can reload custom face graphics
@ -2080,6 +2090,18 @@ static void ST_MayonakaStatic(void)
V_DrawFixedPatch(320<<FRACBITS, 142<<FRACBITS, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_FLIP|flag, hud_tv2, NULL); V_DrawFixedPatch(320<<FRACBITS, 142<<FRACBITS, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_FLIP|flag, hud_tv2, NULL);
} }
#ifdef HAVE_DISCORDRPC
void ST_AskToJoinEnvelope(void)
{
const tic_t freq = TICRATE/2;
if ((leveltime % freq) < freq/2)
return;
V_DrawFixedPatch(296*FRACUNIT, 2*FRACUNIT, FRACUNIT, V_SNAPTOTOP|V_SNAPTORIGHT, envelope, NULL);
}
#endif
void ST_Drawer(void) void ST_Drawer(void)
{ {
UINT8 i; UINT8 i;

View file

@ -29,6 +29,11 @@ void ST_Ticker(void);
// Called when naming a replay. // Called when naming a replay.
void ST_DrawDemoTitleEntry(void); void ST_DrawDemoTitleEntry(void);
#ifdef HAVE_DISCORDRPC
// Called when you have Discord asks
void ST_AskToJoinEnvelope(void);
#endif
// Called by main loop. // Called by main loop.
void ST_Drawer(void); void ST_Drawer(void);