mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-25 10:53:43 +00:00
Make ped comments update position and volume
This commit is contained in:
parent
6110f74ad6
commit
ceb65eafa5
4 changed files with 109 additions and 75 deletions
|
@ -6077,96 +6077,110 @@ cPedComments::Process()
|
||||||
|
|
||||||
if (m_nCommentsInBank[m_nActiveBank]) {
|
if (m_nCommentsInBank[m_nActiveBank]) {
|
||||||
sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex;
|
sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex;
|
||||||
if (!SampleManager.IsPedCommentLoaded(sampleIndex))
|
switch (SampleManager.IsPedCommentLoaded(sampleIndex)) // yes, this was a switch
|
||||||
|
{
|
||||||
|
case FALSE:
|
||||||
SampleManager.LoadPedComment(sampleIndex);
|
SampleManager.LoadPedComment(sampleIndex);
|
||||||
|
// BUG? no break, VC has break in here
|
||||||
AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex;
|
case TRUE:
|
||||||
AudioManager.m_sQueueSample.m_nCounter = 0;
|
AudioManager.m_sQueueSample.m_nEntityIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nEntityIndex;
|
||||||
AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex;
|
AudioManager.m_sQueueSample.m_nCounter = 0;
|
||||||
AudioManager.m_sQueueSample.m_nBankIndex = SFX_BANK_PED_COMMENTS;
|
AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex;
|
||||||
AudioManager.m_sQueueSample.m_nPriority = 3;
|
AudioManager.m_sQueueSample.m_nBankIndex = SFX_BANK_PED_COMMENTS;
|
||||||
AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nVolume;
|
AudioManager.m_sQueueSample.m_nPriority = 3;
|
||||||
AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance;
|
AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nVolume;
|
||||||
AudioManager.m_sQueueSample.m_nLoopCount = 1;
|
AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance;
|
||||||
|
AudioManager.m_sQueueSample.m_nLoopCount = 1;
|
||||||
#ifndef GTA_PS2
|
#ifndef GTA_PS2
|
||||||
AudioManager.m_sQueueSample.m_nLoopStart = 0;
|
AudioManager.m_sQueueSample.m_nLoopStart = 0;
|
||||||
AudioManager.m_sQueueSample.m_nLoopEnd = -1;
|
AudioManager.m_sQueueSample.m_nLoopEnd = -1;
|
||||||
#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_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][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
|
||||||
#endif // EXTERNAL_3D_SOUND
|
#endif // EXTERNAL_3D_SOUND
|
||||||
AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f;
|
#ifdef ATTACH_PED_COMMENTS_TO_ENTITIES
|
||||||
switch (sampleIndex) {
|
// let's disable doppler because if sounds funny as the sound moves
|
||||||
case SFX_POLICE_HELI_1:
|
// originally position of ped comment doesn't change so this has no effect anyway
|
||||||
case SFX_POLICE_HELI_2:
|
AudioManager.m_sQueueSample.m_fSpeedMultiplier = 0.0f;
|
||||||
case SFX_POLICE_HELI_3:
|
#else
|
||||||
#ifdef FIX_BUGS
|
AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f;
|
||||||
case SFX_POLICE_HELI_4:
|
|
||||||
case SFX_POLICE_HELI_5:
|
|
||||||
case SFX_POLICE_HELI_6:
|
|
||||||
case SFX_POLICE_HELI_7:
|
|
||||||
case SFX_POLICE_HELI_8:
|
|
||||||
case SFX_POLICE_HELI_9:
|
|
||||||
case SFX_POLICE_HELI_10:
|
|
||||||
case SFX_POLICE_HELI_11:
|
|
||||||
case SFX_POLICE_HELI_12:
|
|
||||||
case SFX_POLICE_HELI_13:
|
|
||||||
case SFX_POLICE_HELI_14:
|
|
||||||
case SFX_POLICE_HELI_15:
|
|
||||||
case SFX_POLICE_HELI_16:
|
|
||||||
case SFX_POLICE_HELI_17:
|
|
||||||
case SFX_POLICE_HELI_18:
|
|
||||||
case SFX_POLICE_HELI_19:
|
|
||||||
case SFX_POLICE_HELI_20:
|
|
||||||
case SFX_POLICE_HELI_21:
|
|
||||||
case SFX_POLICE_HELI_22:
|
|
||||||
case SFX_POLICE_HELI_23:
|
|
||||||
case SFX_POLICE_HELI_24:
|
|
||||||
case SFX_POLICE_HELI_25:
|
|
||||||
case SFX_POLICE_HELI_26:
|
|
||||||
case SFX_POLICE_HELI_27:
|
|
||||||
case SFX_POLICE_HELI_28:
|
|
||||||
case SFX_POLICE_HELI_29:
|
|
||||||
#endif
|
#endif
|
||||||
AudioManager.m_sQueueSample.m_MaxDistance = 400.0f;
|
switch (sampleIndex) {
|
||||||
break;
|
case SFX_POLICE_HELI_1:
|
||||||
default:
|
case SFX_POLICE_HELI_2:
|
||||||
AudioManager.m_sQueueSample.m_MaxDistance = 50.0f;
|
case SFX_POLICE_HELI_3:
|
||||||
break;
|
#ifdef FIX_BUGS
|
||||||
}
|
case SFX_POLICE_HELI_4:
|
||||||
AudioManager.m_sQueueSample.m_bStatic = TRUE;
|
case SFX_POLICE_HELI_5:
|
||||||
AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos;
|
case SFX_POLICE_HELI_6:
|
||||||
|
case SFX_POLICE_HELI_7:
|
||||||
|
case SFX_POLICE_HELI_8:
|
||||||
|
case SFX_POLICE_HELI_9:
|
||||||
|
case SFX_POLICE_HELI_10:
|
||||||
|
case SFX_POLICE_HELI_11:
|
||||||
|
case SFX_POLICE_HELI_12:
|
||||||
|
case SFX_POLICE_HELI_13:
|
||||||
|
case SFX_POLICE_HELI_14:
|
||||||
|
case SFX_POLICE_HELI_15:
|
||||||
|
case SFX_POLICE_HELI_16:
|
||||||
|
case SFX_POLICE_HELI_17:
|
||||||
|
case SFX_POLICE_HELI_18:
|
||||||
|
case SFX_POLICE_HELI_19:
|
||||||
|
case SFX_POLICE_HELI_20:
|
||||||
|
case SFX_POLICE_HELI_21:
|
||||||
|
case SFX_POLICE_HELI_22:
|
||||||
|
case SFX_POLICE_HELI_23:
|
||||||
|
case SFX_POLICE_HELI_24:
|
||||||
|
case SFX_POLICE_HELI_25:
|
||||||
|
case SFX_POLICE_HELI_26:
|
||||||
|
case SFX_POLICE_HELI_27:
|
||||||
|
case SFX_POLICE_HELI_28:
|
||||||
|
case SFX_POLICE_HELI_29:
|
||||||
|
#endif
|
||||||
|
AudioManager.m_sQueueSample.m_MaxDistance = 400.0f;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
AudioManager.m_sQueueSample.m_MaxDistance = 50.0f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
AudioManager.m_sQueueSample.m_bStatic = TRUE;
|
||||||
|
AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][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;
|
||||||
#ifdef AUDIO_REFLECTIONS
|
#ifdef AUDIO_REFLECTIONS
|
||||||
AudioManager.m_sQueueSample.m_bReflections = FALSE;
|
AudioManager.m_sQueueSample.m_bReflections = FALSE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
} else if (sampleIndex >= SFX_POLICE_HELI_1 && sampleIndex <= SFX_POLICE_HELI_29) {
|
}
|
||||||
AudioManager.m_sQueueSample.m_bReverb = TRUE;
|
else if (sampleIndex >= SFX_POLICE_HELI_1 && sampleIndex <= SFX_POLICE_HELI_29) {
|
||||||
|
AudioManager.m_sQueueSample.m_bReverb = TRUE;
|
||||||
#ifdef AUDIO_REFLECTIONS
|
#ifdef AUDIO_REFLECTIONS
|
||||||
AudioManager.m_sQueueSample.m_bReflections = FALSE;
|
AudioManager.m_sQueueSample.m_bReflections = FALSE;
|
||||||
#endif // AUDIO_REFLECTIONS
|
#endif // AUDIO_REFLECTIONS
|
||||||
#endif // FIX_BUGS
|
#endif // FIX_BUGS
|
||||||
} else {
|
}
|
||||||
AudioManager.m_sQueueSample.m_bReverb = TRUE;
|
else {
|
||||||
|
AudioManager.m_sQueueSample.m_bReverb = TRUE;
|
||||||
#ifdef AUDIO_REFLECTIONS
|
#ifdef AUDIO_REFLECTIONS
|
||||||
AudioManager.m_sQueueSample.m_bReflections = TRUE;
|
AudioManager.m_sQueueSample.m_bReflections = TRUE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioManager.m_sQueueSample.m_bIs2D = FALSE;
|
AudioManager.m_sQueueSample.m_bIs2D = FALSE;
|
||||||
AudioManager.m_sQueueSample.m_nFrequency =
|
AudioManager.m_sQueueSample.m_nFrequency =
|
||||||
SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) + AudioManager.RandomDisplacement(750);
|
SampleManager.GetSampleBaseFrequency(AudioManager.m_sQueueSample.m_nSampleIndex) + AudioManager.RandomDisplacement(750);
|
||||||
if (CTimer::GetIsSlowMotionActive())
|
if (CTimer::GetIsSlowMotionActive())
|
||||||
AudioManager.m_sQueueSample.m_nFrequency /= 2;
|
AudioManager.m_sQueueSample.m_nFrequency /= 2;
|
||||||
m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1;
|
m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1;
|
||||||
AudioManager.AddSampleToRequestedQueue();
|
AudioManager.AddSampleToRequestedQueue();
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch bank
|
// Switch bank
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "sampman.h"
|
#include "sampman.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
#include "Entity.h"
|
||||||
|
|
||||||
cAudioManager AudioManager;
|
cAudioManager AudioManager;
|
||||||
|
|
||||||
|
@ -903,6 +904,24 @@ cAudioManager::ProcessActiveQueues()
|
||||||
SampleManager.SetChannelVolume(j, sample.m_nVolume);
|
SampleManager.SetChannelVolume(j, sample.m_nVolume);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef ATTACH_PED_COMMENTS_TO_ENTITIES
|
||||||
|
if (sample.m_nCounter <= 255 && sample.m_nSampleIndex >= SAMPLEBANK_PED_START && sample.m_nSampleIndex <= SAMPLEBANK_PED_END) {
|
||||||
|
CEntity* entity = (CEntity*)GetEntityPointer(sample.m_nEntityIndex);
|
||||||
|
if (entity && m_asAudioEntities[sample.m_nEntityIndex].m_nType == AUDIOTYPE_PHYSICAL) {
|
||||||
|
sample.m_vecPos = entity->GetPosition();
|
||||||
|
sample.m_fDistance = Sqrt(GetDistanceSquared(sample.m_vecPos));
|
||||||
|
uint8 vol;
|
||||||
|
if (CWorld::GetIsLineOfSightClear(TheCamera.GetPosition(), sample.m_vecPos, true, false, false, false, false, false))
|
||||||
|
vol = MAX_VOLUME;
|
||||||
|
else
|
||||||
|
vol = 31;
|
||||||
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
|
sample.m_nEmittingVolume = vol;
|
||||||
|
#endif
|
||||||
|
sample.m_nVolume = ComputeVolume(vol, sample.m_MaxDistance, sample.m_fDistance);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
position2 = sample.m_fDistance;
|
position2 = sample.m_fDistance;
|
||||||
position1 = m_asActiveSamples[j].m_fDistance;
|
position1 = m_asActiveSamples[j].m_fDistance;
|
||||||
m_asActiveSamples[j].m_fDistance = sample.m_fDistance;
|
m_asActiveSamples[j].m_fDistance = sample.m_fDistance;
|
||||||
|
|
|
@ -23,7 +23,7 @@ VALIDATE_SIZE(cAMCrime, 20);
|
||||||
class cPoliceRadioQueue
|
class cPoliceRadioQueue
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int32 m_aSamples[POLICE_RADIO_QUEUE_MAX_SAMPLES];
|
uint32 m_aSamples[POLICE_RADIO_QUEUE_MAX_SAMPLES];
|
||||||
uint8 m_nSamplesInQueue;
|
uint8 m_nSamplesInQueue;
|
||||||
uint8 m_nAddOffset;
|
uint8 m_nAddOffset;
|
||||||
uint8 m_nRemoveOffset;
|
uint8 m_nRemoveOffset;
|
||||||
|
|
|
@ -438,6 +438,7 @@ enum Config {
|
||||||
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||||
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
|
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
|
||||||
#define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused
|
#define PAUSE_RADIO_IN_FRONTEND // pause radio when game is paused
|
||||||
|
#define ATTACH_PED_COMMENTS_TO_ENTITIES // ped comments coordinates would update following ped entity
|
||||||
#define MULTITHREADED_AUDIO // for streams. requires C++11 or later
|
#define MULTITHREADED_AUDIO // for streams. requires C++11 or later
|
||||||
|
|
||||||
#ifdef AUDIO_OPUS
|
#ifdef AUDIO_OPUS
|
||||||
|
|
Loading…
Reference in a new issue