From 788baf6299d898df0d604f8a96ac341d79669559 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Mon, 22 May 2017 11:28:21 +0200 Subject: [PATCH] cleanup sound --- source/src/audiomanager.cpp | 5 ++--- source/src/sound.h | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/src/audiomanager.cpp b/source/src/audiomanager.cpp index f901dbba..579288ec 100644 --- a/source/src/audiomanager.cpp +++ b/source/src/audiomanager.cpp @@ -427,12 +427,11 @@ void voicecom(char *sound, char *text) static int last = 0; if(!last || lastmillis-last > 2000) { - extern int voicecomsounds; defformatstring(soundpath)("voicecom/%s", sound); int s = audiomgr.findsound(soundpath, 0, gamesounds); - if(s < 0 || s < S_AFFIRMATIVE || s >= S_NULL) return; + if(!valid_voicecom(s)) return; if(voicecomsounds>0) audiomgr.playsound(s, SP_HIGH); - if(s >= S_NICESHOT) // public + if(valid_voicecom_public(s)) // public { addmsg(SV_VOICECOM, "ri", s); toserver(text); diff --git a/source/src/sound.h b/source/src/sound.h index 1d7e2511..7e7e24c2 100644 --- a/source/src/sound.h +++ b/source/src/sound.h @@ -69,12 +69,16 @@ enum S_THANKS2, S_AWESOME1, S_AWESOME2, +// end: voicecoms S_ITEMHELMET, // begin: Sounds for AssaultCube v1.1.0.4 onwards S_HEARTBEAT, S_KTFSCORE, S_NULL }; +#define valid_voicecom(x) ((x) >= S_AFFIRMATIVE && (x) <= S_AWESOME2) // all voicecoms +#define valid_voicecom_public(x) ((x) >= S_NICESHOT && (x) <= S_AWESOME2) // voicecoms always sent to all players + // hardcoded music enum @@ -446,6 +450,7 @@ extern vector gamesounds, mapsounds; extern ov_callbacks oggcallbacks; extern int soundvol; extern int audiodebug; +extern int voicecomsounds; extern audiomanager audiomgr;