From 82bfdf9ccc27a6976f1b4d69fcf0236eb8a26008 Mon Sep 17 00:00:00 2001
From: Sally Coolatta <tehrealsalt@gmail.com>
Date: Thu, 27 Aug 2020 20:10:25 -0400
Subject: [PATCH] Add join/leave notification sounds

---
 src/d_clisrv.c | 7 ++++++-
 src/sounds.c   | 2 ++
 src/sounds.h   | 2 ++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/d_clisrv.c b/src/d_clisrv.c
index e952d4492..0b38ee083 100644
--- a/src/d_clisrv.c
+++ b/src/d_clisrv.c
@@ -3363,7 +3363,9 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum)
 #endif
 	}
 
-	if (msg != KICK_MSG_PLAYER_QUIT)
+	if (msg == KICK_MSG_PLAYER_QUIT)
+		S_StartSound(NULL, sfx_leave); // intended leave
+	else
 		S_StartSound(NULL, sfx_syfail); // he he he
 
 	switch (msg)
@@ -3780,6 +3782,9 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum)
 
 	if (netgame)
 	{
+		if (node != mynode)
+			S_StartSound(NULL, sfx_join);
+
 		if (server && cv_showjoinaddress.value)
 		{
 			const char *address;
diff --git a/src/sounds.c b/src/sounds.c
index 40ef0f7f2..9285a2a87 100644
--- a/src/sounds.c
+++ b/src/sounds.c
@@ -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
+  {"join",   false,  96,  8, -1, NULL, 0,        -1,  -1, LUMPERROR}, // Player joined server
+  {"leave",  false,  96,  8, -1, NULL, 0,        -1,  -1, LUMPERROR}, // Player left server
   {"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:
diff --git a/src/sounds.h b/src/sounds.h
index 2a7169190..4091081b5 100644
--- a/src/sounds.h
+++ b/src/sounds.h
@@ -891,6 +891,8 @@ typedef enum
 	sfx_mkuma,
 	sfx_toada,
 	sfx_bsnipe,
+	sfx_join,
+	sfx_leave,
 	sfx_requst,
 	sfx_syfail,
 	sfx_itfree,
-- 
GitLab