Fix cAudioManager::AddReleasingSounds

This commit is contained in:
Sergeanur 2019-10-27 15:15:39 +02:00
parent f090708a90
commit 80b85a417c

View File

@ -415,47 +415,47 @@ cAudioManager::AddReleasingSounds()
{ {
bool toProcess[44]; bool toProcess[44];
for(int32 i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; i++) { int8 queue = m_bActiveSampleQueue == 0;
tActiveSample &sample =
m_asSamples[!m_bActiveSampleQueue][m_abSampleQueueIndexTable[!m_bActiveSampleQueue][i]]; for(int32 i = 0; i < m_bSampleRequestQueuesStatus[queue]; i++) {
if(!m_asSamples[!m_bActiveSampleQueue][m_abSampleQueueIndexTable[!m_bActiveSampleQueue][i]] tActiveSample &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]];
.m_bLoopEnded) { if (sample.m_bLoopEnded) continue;
toProcess[i] = false;
for(int32 j = 0; j < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; j++) { toProcess[i] = false;
if(sample.m_nEntityIndex == for(int32 j = 0; j < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue]; j++) {
m_asSamples[m_bActiveSampleQueue] if(sample.m_nEntityIndex ==
[m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]] m_asSamples[m_bActiveSampleQueue]
.m_nEntityIndex && [m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]]
sample.m_counter == m_asSamples[m_bActiveSampleQueue] .m_nEntityIndex &&
[m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]] sample.m_counter == m_asSamples[m_bActiveSampleQueue]
.m_counter) { [m_abSampleQueueIndexTable[m_bActiveSampleQueue][j]]
toProcess[i] = true; .m_counter) {
break; toProcess[i] = true;
} break;
} }
if(!toProcess[i]) { }
if(sample.m_counter <= 255u || !sample.m_bLoopsRemaining) { if(!toProcess[i]) {
if(!sample.field_76) continue; if(sample.m_counter <= 255u || !sample.m_bLoopsRemaining) {
if(!sample.m_nLoopCount) { if(!sample.field_76) continue;
if(sample.field_88 == -1) { if(!sample.m_nLoopCount) {
sample.field_88 = sample.m_bVolume / sample.field_76; if(sample.field_88 == -1) {
if(sample.field_88 <= 0) sample.field_88 = 1; sample.field_88 = sample.m_bVolume / sample.field_76;
} if(sample.field_88 <= 0) sample.field_88 = 1;
if(sample.m_bVolume <= sample.field_88) {
sample.field_76 = 0;
continue;
}
sample.m_bVolume -= sample.field_88;
} }
--sample.field_76; if(sample.m_bVolume <= sample.field_88) {
if(field_2) { sample.field_76 = 0;
if(sample.field_16 < 20) ++sample.field_16; continue;
} }
sample.field_56 = 0; sample.m_bVolume -= sample.field_88;
} }
memcpy(&m_sQueueSample, &sample, 92); --sample.field_76;
AddSampleToRequestedQueue(); if(field_2) {
if(sample.field_16 < 20) ++sample.field_16;
}
sample.field_56 = 0;
} }
memcpy(&m_sQueueSample, &sample, sizeof(sample));
AddSampleToRequestedQueue();
} }
} }
} }