summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio/AudioLogic.cpp71
-rw-r--r--src/audio/AudioManager.cpp6
-rw-r--r--src/audio/AudioManager.h20
-rw-r--r--src/core/config.h1
4 files changed, 48 insertions, 50 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 29c89ded..1ae06e19 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -6037,53 +6037,55 @@ cPedComments::Add(tPedComment *com)
{
uint8 index;
- if (m_nCommentsInBank[m_nActiveBank] >= NUM_PED_COMMENTS_SLOTS) {
- index = m_nIndexMap[m_nActiveBank][NUM_PED_COMMENTS_SLOTS - 1];
- if (m_asPedComments[m_nActiveBank][index].m_nVolume > com->m_nVolume)
+ // copypasted priority check from cAudioManager::AddSampleToRequestedQueue
+
+ if (m_nPedCommentCount[m_nActiveQueue] >= NUM_PED_COMMENTS_SLOTS) {
+ index = m_aPedCommentOrderList[m_nActiveQueue][NUM_PED_COMMENTS_SLOTS - 1];
+ if (m_aPedCommentQueue[m_nActiveQueue][index].m_nVolume > com->m_nVolume)
return;
} else
- index = m_nCommentsInBank[m_nActiveBank]++;
+ index = m_nPedCommentCount[m_nActiveQueue]++;
- m_asPedComments[m_nActiveBank][index] = *com;
+ m_aPedCommentQueue[m_nActiveQueue][index] = *com;
+ // this bit is basically copypasted cAudioManager::AddDetailsToRequestedOrderList
uint8 i = 0;
if (index != 0) {
for (i = 0; i < index; i++) {
- if (m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][i]].m_nVolume < m_asPedComments[m_nActiveBank][index].m_nVolume)
+ if (m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][i]].m_nVolume < m_aPedCommentQueue[m_nActiveQueue][index].m_nVolume)
break;
}
if (i < index)
- memmove(&m_nIndexMap[m_nActiveBank][i + 1], &m_nIndexMap[m_nActiveBank][i], NUM_PED_COMMENTS_SLOTS - 1 - i);
+ memmove(&m_aPedCommentOrderList[m_nActiveQueue][i + 1], &m_aPedCommentOrderList[m_nActiveQueue][i], NUM_PED_COMMENTS_SLOTS - 1 - i);
}
- m_nIndexMap[m_nActiveBank][i] = index;
+ m_aPedCommentOrderList[m_nActiveQueue][i] = index;
}
void
cPedComments::Process()
{
- int sampleIndex;
- uint8 actualUsedBank;
- tPedComment *comment;
+ uint32 sampleIndex;
+ uint8 queue;
if (AudioManager.m_bIsPaused) return;
- if (m_nCommentsInBank[m_nActiveBank]) {
- sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex;
+ if (m_nPedCommentCount[m_nActiveQueue]) {
+ sampleIndex = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nSampleIndex;
switch (SampleManager.IsPedCommentLoaded(sampleIndex)) // yes, this was a switch
{
case FALSE:
SampleManager.LoadPedComment(sampleIndex);
// BUG? no break, VC has break in here
case TRUE:
- AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex;
+ AudioManager.m_sQueueSample.m_nEntityIndex = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nEntityIndex;
AudioManager.m_sQueueSample.m_nCounter = 0;
AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex;
AudioManager.m_sQueueSample.m_nBankIndex = SFX_BANK_PED_COMMENTS;
AudioManager.m_sQueueSample.m_nPriority = 3;
- AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nVolume;
- AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance;
+ AudioManager.m_sQueueSample.m_nVolume = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nVolume;
+ AudioManager.m_sQueueSample.m_fDistance = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_fDistance;
AudioManager.m_sQueueSample.m_nLoopCount = 1;
#ifndef GTA_PS2
AudioManager.m_sQueueSample.m_nLoopStart = 0;
@@ -6091,7 +6093,7 @@ cPedComments::Process()
#endif // !GTA_PS2
#ifdef EXTERNAL_3D_SOUND
#ifdef FIX_BUGS
- AudioManager.m_sQueueSample.m_nEmittingVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEmittingVolume;
+ AudioManager.m_sQueueSample.m_nEmittingVolume = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nEmittingVolume;
#else
AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
#endif // FIX_BUGS
@@ -6142,7 +6144,7 @@ cPedComments::Process()
break;
}
AudioManager.m_sQueueSample.m_bStatic = TRUE;
- AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos;
+ AudioManager.m_sQueueSample.m_vecPos = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_vecPos;
if (sampleIndex >= SFX_AMMU_D && sampleIndex <= SFX_AMMU_F) {
AudioManager.m_sQueueSample.m_bReverb = FALSE;
@@ -6172,33 +6174,32 @@ cPedComments::Process()
if (CTimer::GetIsSlowMotionActive())
AudioManager.m_sQueueSample.m_nFrequency >>= 1;
#endif
- m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1;
+ m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nProcess = -1;
AudioManager.AddSampleToRequestedQueue();
default:
break;
}
}
- // Switch bank
- if (m_nActiveBank == 0) {
- actualUsedBank = 0;
- m_nActiveBank = 1;
+ // Switch queue
+ if (m_nActiveQueue == 0) {
+ queue = 0;
+ m_nActiveQueue = 1;
} else {
- actualUsedBank = 1;
- m_nActiveBank = 0;
- }
- comment = m_asPedComments[actualUsedBank];
- for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) {
- if (m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess > 0) {
- m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess--;
- Add(&comment[m_nIndexMap[actualUsedBank][i]]);
+ queue = 1;
+ m_nActiveQueue = 0;
+ }
+ for (uint8 i = 0; i < m_nPedCommentCount[queue]; i++) {
+ if (m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]].m_nProcess > 0) {
+ m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]].m_nProcess--;
+ Add(&m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]]);
}
}
- for (uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) {
- m_nIndexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS;
- }
- m_nCommentsInBank[actualUsedBank] = 0;
+ // clear queue
+ for (uint8 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
+ m_aPedCommentOrderList[queue][i] = NUM_PED_COMMENTS_SLOTS;
+ m_nPedCommentCount[queue] = 0;
}
#pragma endregion
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 493e3abb..b115195d 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -658,9 +658,8 @@ cAudioManager::AddSampleToRequestedQueue()
sampleIndex = m_aRequestedOrderList[m_nActiveQueue][m_nActiveSamples - 1];
if (m_aRequestedQueue[m_nActiveQueue][sampleIndex].m_nFinalPriority <= finalPriority)
return;
- } else {
+ } else
m_nRequestedCount[m_nActiveQueue]++;
- }
#if GTA_VERSION < GTA3_PC_10
if (m_sQueueSample.m_bStatic) {
if (m_sQueueSample.m_nLoopCount > 0)
@@ -708,9 +707,8 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
m_aRequestedQueue[m_nActiveQueue][sample].m_nFinalPriority)
break;
}
- if (i < sample) {
+ if (i < sample)
memmove(&m_aRequestedOrderList[m_nActiveQueue][i + 1], &m_aRequestedOrderList[m_nActiveQueue][i], m_nActiveSamples - i - 1);
- }
}
m_aRequestedOrderList[m_nActiveQueue][i] = sample;
}
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 529b23aa..01f7bb23 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -107,22 +107,22 @@ VALIDATE_SIZE(tPedComment, 28);
class cPedComments
{
public:
- tPedComment m_asPedComments[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
- uint8 m_nIndexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
- uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS];
- uint8 m_nActiveBank;
+ tPedComment m_aPedCommentQueue[NUM_SOUND_QUEUES][NUM_PED_COMMENTS_SLOTS];
+ uint8 m_aPedCommentOrderList[NUM_SOUND_QUEUES][NUM_PED_COMMENTS_SLOTS];
+ uint8 m_nPedCommentCount[NUM_SOUND_QUEUES];
+ uint8 m_nActiveQueue;
cPedComments()
{
for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
- for (int j = 0; j < NUM_PED_COMMENTS_BANKS; j++) {
- m_asPedComments[j][i].m_nProcess = -1;
- m_nIndexMap[j][i] = NUM_PED_COMMENTS_SLOTS;
+ for (int j = 0; j < NUM_SOUND_QUEUES; j++) {
+ m_aPedCommentQueue[j][i].m_nProcess = -1;
+ m_aPedCommentOrderList[j][i] = NUM_PED_COMMENTS_SLOTS;
}
- for (int i = 0; i < NUM_PED_COMMENTS_BANKS; i++)
- m_nCommentsInBank[i] = 0;
- m_nActiveBank = 0;
+ for (int i = 0; i < NUM_SOUND_QUEUES; i++)
+ m_nPedCommentCount[i] = 0;
+ m_nActiveQueue = 0;
}
void Add(tPedComment *com);
void Process();
diff --git a/src/core/config.h b/src/core/config.h
index 35e076bb..9f1981be 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -126,7 +126,6 @@ enum Config {
NUMINVISIBLEENTITIES = 150,
NUM_AUDIOENTITY_EVENTS = 4,
- NUM_PED_COMMENTS_BANKS = 2,
NUM_PED_COMMENTS_SLOTS = 20,
NUM_SOUND_QUEUES = 2,