From 67cdd9d883562b3ae8dc11c1445c565de0607d06 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 2 Jan 2013 22:33:32 +0000 Subject: [PATCH] gameexec.c: factor code for "ifnosounds" into sounds.c: A_CheckAnySoundPlaying. git-svn-id: https://svn.eduke32.com/eduke32@3365 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gameexec.c | 18 ++---------------- polymer/eduke32/source/sounds.c | 17 +++++++++++++++++ polymer/eduke32/source/sounds.h | 1 + 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index c431a1a32..3d93e6433 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -5084,22 +5084,8 @@ nullquote: case CON_IFNOSOUNDS: { - int32_t j = MAXSOUNDS-1; - for (; j>=0; j--) - { - int32_t k = 0; - - for (; k is playing any sound. +int32_t A_CheckAnySoundPlaying(int32_t i) +{ + int32_t j; + + for (j=g_maxSoundPos; j>=0; j--) + { + int32_t k; + + for (k=0; k g_maxSoundPos || num < 0) return 0; diff --git a/polymer/eduke32/source/sounds.h b/polymer/eduke32/source/sounds.h index 1dd8d1e1b..84235919b 100644 --- a/polymer/eduke32/source/sounds.h +++ b/polymer/eduke32/source/sounds.h @@ -75,6 +75,7 @@ extern int32_t g_numEnvSoundsPlaying,g_maxSoundPos; int32_t A_CheckSoundPlaying(int32_t i,int32_t num); int32_t A_PlaySound(uint32_t num,int32_t i); void S_Callback(uint32_t num); +int32_t A_CheckAnySoundPlaying(int32_t i); int32_t S_CheckSoundPlaying(int32_t i,int32_t num); void S_Cleanup(void); void S_ClearSoundLocks(void);