From 898462152cdefb508348da5d2ec2381d06ab4c88 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 13 Jan 2013 16:40:36 +0000 Subject: [PATCH] Fix MUSICANDSFX ambient sounds (bit 2) playing only one instance. This is done by introducing an additional internal bit, meaning "play only one instance". It is set for all sounds which have bit 1 ("repeat in the sound system") set at definesound time, but not those that set bit 1 temporarily (see r3336). git-svn-id: https://svn.eduke32.com/eduke32@3393 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gamedef.c | 10 ++++++++-- polymer/eduke32/source/sounds.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 4c177be39..8e3682194 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -2122,7 +2122,9 @@ void C_DefineSound(int32_t sndidx, const char *fn, int32_t args[5]) snd->ps = args[0]; snd->pe = args[1]; snd->pr = args[2]; - snd->m = args[3]; + snd->m = args[3] & ~32; + if (args[3] & 1) + snd->m |= 32; snd->vo = args[4]; if (sndidx > g_maxSoundPos) @@ -5743,8 +5745,12 @@ repeatcase: g_sounds[k].pe = *(g_scriptPtr-1); C_GetNextValue(LABEL_DEFINE); g_sounds[k].pr = *(g_scriptPtr-1); + C_GetNextValue(LABEL_DEFINE); - g_sounds[k].m = *(g_scriptPtr-1); + g_sounds[k].m = *(g_scriptPtr-1) & ~32; + if (*(g_scriptPtr-1) & 1) + g_sounds[k].m |= 32; + C_GetNextValue(LABEL_DEFINE); g_sounds[k].vo = *(g_scriptPtr-1); g_scriptPtr -= 5; diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index 767811e5f..233d460a1 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -657,7 +657,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos) if (g_sounds[num].m&1) { - if (g_sounds[num].num > 0) + if ((g_sounds[num].m&32) && g_sounds[num].num > 0) { g_soundlocks[num]--; return -1;