|
|
|
@@ -6037,53 +6037,55 @@ cPedComments::Add(tPedComment *com)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint8 index;
|
|
|
|
uint8 index;
|
|
|
|
|
|
|
|
|
|
|
|
if (m_nCommentsInBank[m_nActiveBank] >= NUM_PED_COMMENTS_SLOTS) {
|
|
|
|
// copypasted priority check from cAudioManager::AddSampleToRequestedQueue
|
|
|
|
index = m_nIndexMap[m_nActiveBank][NUM_PED_COMMENTS_SLOTS - 1];
|
|
|
|
|
|
|
|
if (m_asPedComments[m_nActiveBank][index].m_nVolume > com->m_nVolume)
|
|
|
|
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;
|
|
|
|
return;
|
|
|
|
} else
|
|
|
|
} 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;
|
|
|
|
uint8 i = 0;
|
|
|
|
if (index != 0) {
|
|
|
|
if (index != 0) {
|
|
|
|
for (i = 0; i < index; i++) {
|
|
|
|
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;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (i < index)
|
|
|
|
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
|
|
|
|
void
|
|
|
|
cPedComments::Process()
|
|
|
|
cPedComments::Process()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int sampleIndex;
|
|
|
|
uint32 sampleIndex;
|
|
|
|
uint8 actualUsedBank;
|
|
|
|
uint8 queue;
|
|
|
|
tPedComment *comment;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (AudioManager.m_bIsPaused) return;
|
|
|
|
if (AudioManager.m_bIsPaused) return;
|
|
|
|
|
|
|
|
|
|
|
|
if (m_nCommentsInBank[m_nActiveBank]) {
|
|
|
|
if (m_nPedCommentCount[m_nActiveQueue]) {
|
|
|
|
sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex;
|
|
|
|
sampleIndex = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nSampleIndex;
|
|
|
|
switch (SampleManager.IsPedCommentLoaded(sampleIndex)) // yes, this was a switch
|
|
|
|
switch (SampleManager.IsPedCommentLoaded(sampleIndex)) // yes, this was a switch
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case FALSE:
|
|
|
|
case FALSE:
|
|
|
|
SampleManager.LoadPedComment(sampleIndex);
|
|
|
|
SampleManager.LoadPedComment(sampleIndex);
|
|
|
|
// BUG? no break, VC has break in here
|
|
|
|
// BUG? no break, VC has break in here
|
|
|
|
case TRUE:
|
|
|
|
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_nCounter = 0;
|
|
|
|
AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex;
|
|
|
|
AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex;
|
|
|
|
AudioManager.m_sQueueSample.m_nBankIndex = SFX_BANK_PED_COMMENTS;
|
|
|
|
AudioManager.m_sQueueSample.m_nBankIndex = SFX_BANK_PED_COMMENTS;
|
|
|
|
AudioManager.m_sQueueSample.m_nPriority = 3;
|
|
|
|
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_nVolume = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nVolume;
|
|
|
|
AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance;
|
|
|
|
AudioManager.m_sQueueSample.m_fDistance = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_fDistance;
|
|
|
|
AudioManager.m_sQueueSample.m_nLoopCount = 1;
|
|
|
|
AudioManager.m_sQueueSample.m_nLoopCount = 1;
|
|
|
|
#ifndef GTA_PS2
|
|
|
|
#ifndef GTA_PS2
|
|
|
|
AudioManager.m_sQueueSample.m_nLoopStart = 0;
|
|
|
|
AudioManager.m_sQueueSample.m_nLoopStart = 0;
|
|
|
|
@@ -6091,7 +6093,7 @@ cPedComments::Process()
|
|
|
|
#endif // !GTA_PS2
|
|
|
|
#endif // !GTA_PS2
|
|
|
|
#ifdef EXTERNAL_3D_SOUND
|
|
|
|
#ifdef EXTERNAL_3D_SOUND
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
#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
|
|
|
|
#else
|
|
|
|
AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
|
|
|
|
AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME;
|
|
|
|
#endif // FIX_BUGS
|
|
|
|
#endif // FIX_BUGS
|
|
|
|
@@ -6142,7 +6144,7 @@ cPedComments::Process()
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
AudioManager.m_sQueueSample.m_bStatic = TRUE;
|
|
|
|
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) {
|
|
|
|
if (sampleIndex >= SFX_AMMU_D && sampleIndex <= SFX_AMMU_F) {
|
|
|
|
AudioManager.m_sQueueSample.m_bReverb = FALSE;
|
|
|
|
AudioManager.m_sQueueSample.m_bReverb = FALSE;
|
|
|
|
@@ -6172,33 +6174,32 @@ cPedComments::Process()
|
|
|
|
if (CTimer::GetIsSlowMotionActive())
|
|
|
|
if (CTimer::GetIsSlowMotionActive())
|
|
|
|
AudioManager.m_sQueueSample.m_nFrequency >>= 1;
|
|
|
|
AudioManager.m_sQueueSample.m_nFrequency >>= 1;
|
|
|
|
#endif
|
|
|
|
#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();
|
|
|
|
AudioManager.AddSampleToRequestedQueue();
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Switch bank
|
|
|
|
// Switch queue
|
|
|
|
if (m_nActiveBank == 0) {
|
|
|
|
if (m_nActiveQueue == 0) {
|
|
|
|
actualUsedBank = 0;
|
|
|
|
queue = 0;
|
|
|
|
m_nActiveBank = 1;
|
|
|
|
m_nActiveQueue = 1;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
actualUsedBank = 1;
|
|
|
|
queue = 1;
|
|
|
|
m_nActiveBank = 0;
|
|
|
|
m_nActiveQueue = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
comment = m_asPedComments[actualUsedBank];
|
|
|
|
for (uint8 i = 0; i < m_nPedCommentCount[queue]; i++) {
|
|
|
|
for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) {
|
|
|
|
if (m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]].m_nProcess > 0) {
|
|
|
|
if (m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess > 0) {
|
|
|
|
m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]].m_nProcess--;
|
|
|
|
m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess--;
|
|
|
|
Add(&m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]]);
|
|
|
|
Add(&comment[m_nIndexMap[actualUsedBank][i]]);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (uint32 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++) {
|
|
|
|
// clear queue
|
|
|
|
m_nIndexMap[actualUsedBank][i] = NUM_PED_COMMENTS_SLOTS;
|
|
|
|
for (uint8 i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
|
|
|
|
}
|
|
|
|
m_aPedCommentOrderList[queue][i] = NUM_PED_COMMENTS_SLOTS;
|
|
|
|
m_nCommentsInBank[actualUsedBank] = 0;
|
|
|
|
m_nPedCommentCount[queue] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma endregion
|
|
|
|
#pragma endregion
|
|
|
|
|