From 66538686e2e20e72eb4332600557de9c8d0c8d96 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 15 Aug 2007 03:05:14 +0000 Subject: [PATCH] Better sound fix git-svn-id: https://svn.eduke32.com/eduke32@554 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/actors.c | 4 +--- polymer/eduke32/source/sounds.c | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 756bda20a..7634147b7 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -1239,9 +1239,7 @@ static void movefx(void) if (p == myconnectindex && ps[p].cursectnum == s->sectnum) { j = s->lotag+((unsigned)global_random%(s->hitag+1)); - if (j < NUM_SOUNDS && sounds[j]) - sound(j); - else OSD_Printf("WARNING: invalid sound #%d\n",j); + sound(j); T5 = 26*40 + (global_random%(26*40)); } } diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index a9597204b..9308b4f57 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -414,6 +414,12 @@ void sound(int num) if (VoiceToggle==0 && (soundm[num]&4)) return; if ((soundm[num]&8) && ud.lockout) return; if (FX_VoiceAvailable(soundpr[num]) == 0) return; + if (num > NUM_SOUNDS-1 || !sounds[num]) + { + OSD_Printf("WARNING: invalid sound #%d\n",num); + return; + } + pitchs = soundps[num]; pitche = soundpe[num];