shithub: choc

Download patch

ref: 5160ceb4512b8bb5839df898a4aff0c6779578c5
parent: dcf2c6a09c97c284b6cdff8c791cce8fe03fd69d
author: James Haley <[email protected]>
date: Fri Feb 20 15:01:02 EST 2015

Strife sound priority fix

The Strife binary has another priority check in the first loop inside
S_GetChannel. TODO: Does DOS Doom have this as well? Find out.

Resolves issue #506.

--- a/src/strife/s_sound.c
+++ b/src/strife/s_sound.c
@@ -277,7 +277,7 @@
     channel_t*        c;
 
     // Find an open channel
-     for (cnum=0 ; cnum<snd_channels ; cnum++)
+    for (cnum=0 ; cnum<snd_channels ; cnum++)
     {
         if (!channels[cnum].sfxinfo)
         {
@@ -286,6 +286,11 @@
         else if (origin && channels[cnum].origin == origin &&
                  (isvoice || cnum != i_voicehandle)) // haleyjd
         {
+            // haleyjd 20150220: [STRIFE] missing sound channel priority check
+            // Is a higher priority sound by same origin already playing?
+            if(!isvoice && sfxinfo->priority > channels[cnum].sfxinfo->priority)
+                return -1;
+
             S_StopChannel(cnum);
             break;
         }