mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-26 04:11:18 +00:00
Add envelope icon, add sounds
This commit is contained in:
parent
98f586a2f9
commit
3c128660b4
8 changed files with 72 additions and 16 deletions
|
@ -46,6 +46,7 @@
|
|||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
#include "k_kart.h"
|
||||
#include "s_sound.h" // sfx_syfail
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
// cl loading screen
|
||||
|
@ -3130,6 +3131,9 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
|
|||
#endif
|
||||
}
|
||||
|
||||
if (msg != KICK_MSG_PLAYER_QUIT)
|
||||
S_StartSound(NULL, sfx_syfail); // he he he
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case KICK_MSG_GO_AWAY:
|
||||
|
|
|
@ -268,6 +268,9 @@ static void DRPC_HandleJoinRequest(const DiscordUser *requestUser)
|
|||
{
|
||||
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);
|
||||
|
||||
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
|
||||
|
@ -514,6 +507,8 @@ void DRPC_UpdatePresence(void)
|
|||
char charimg[4+SKINNAMESIZE+1];
|
||||
char charname[11+SKINNAMESIZE+1];
|
||||
|
||||
boolean joinSecretSet = false;
|
||||
|
||||
DiscordRichPresence discordPresence;
|
||||
memset(&discordPresence, 0, sizeof(discordPresence));
|
||||
|
||||
|
@ -564,6 +559,8 @@ void DRPC_UpdatePresence(void)
|
|||
char *xorjoin = DRPC_XORIPString(join);
|
||||
discordPresence.joinSecret = xorjoin;
|
||||
free(xorjoin);
|
||||
|
||||
joinSecretSet = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -724,6 +721,16 @@ void DRPC_UpdatePresence(void)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
17
src/m_menu.c
17
src/m_menu.c
|
@ -11334,18 +11334,23 @@ static boolean confirmAccept = false;
|
|||
|
||||
static void M_HandleDiscordRequests(INT32 choice)
|
||||
{
|
||||
if (confirmDelay > 0)
|
||||
return;
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case KEY_ESCAPE:
|
||||
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_NO);
|
||||
confirmAccept = false;
|
||||
confirmDelay = confirmLength;
|
||||
break;
|
||||
|
||||
case KEY_ENTER:
|
||||
Discord_Respond(discordRequestList->userID, DISCORD_REPLY_YES);
|
||||
confirmAccept = true;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,10 @@
|
|||
#include "ogl_sdl.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "../discord.h"
|
||||
#endif
|
||||
|
||||
// maximum number of windowed modes (see windowedModes[][])
|
||||
#define MAXWINMODES (18)
|
||||
|
||||
|
@ -1387,6 +1391,11 @@ void I_FinishUpdate(void)
|
|||
if (cv_showping.value && netgame && consoleplayer != serverplayer)
|
||||
SCR_DisplayLocalPing();
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (discordRequestList != NULL)
|
||||
ST_AskToJoinEnvelope();
|
||||
#endif
|
||||
|
||||
if (rendermode == render_soft && screens[0])
|
||||
{
|
||||
SDL_Rect rect;
|
||||
|
|
|
@ -816,6 +816,8 @@ sfxinfo_t S_sfx[NUMSFX] =
|
|||
{"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
|
||||
{"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:
|
||||
{"dbgsal", false, 255, 8, -1, NULL, 0, -1, -1, LUMPERROR}, // Debug notification
|
||||
|
||||
|
|
|
@ -891,6 +891,8 @@ typedef enum
|
|||
sfx_mkuma,
|
||||
sfx_toada,
|
||||
sfx_bsnipe,
|
||||
sfx_requst,
|
||||
sfx_syfail,
|
||||
sfx_itfree,
|
||||
sfx_dbgsal,
|
||||
|
||||
|
|
|
@ -129,6 +129,11 @@ static patch_t *gotbflag;
|
|||
static patch_t *hud_tv1;
|
||||
static patch_t *hud_tv2;
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
// Discord Rich Presence
|
||||
static patch_t *envelope;
|
||||
#endif
|
||||
|
||||
// SRB2kart
|
||||
|
||||
hudinfo_t hudinfo[NUMHUDITEMS] =
|
||||
|
@ -349,6 +354,11 @@ void ST_LoadGraphics(void)
|
|||
// Midnight Channel:
|
||||
hud_tv1 = W_CachePatchName("HUD_TV1", 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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
UINT8 i;
|
||||
|
|
|
@ -29,6 +29,11 @@ void ST_Ticker(void);
|
|||
// Called when naming a replay.
|
||||
void ST_DrawDemoTitleEntry(void);
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
// Called when you have Discord asks
|
||||
void ST_AskToJoinEnvelope(void);
|
||||
#endif
|
||||
|
||||
// Called by main loop.
|
||||
void ST_Drawer(void);
|
||||
|
||||
|
|
Loading…
Reference in a new issue