Merge pull request #388 from ShFil119/audio16

Yet another audio PR
This commit is contained in:
Sergeanur 2020-04-12 11:46:48 +03:00 committed by GitHub
commit d804ad48b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 270 additions and 242 deletions

View file

@ -151,7 +151,7 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
m_sQueueSample.m_bVolume =
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
m_sQueueSample.m_counter = counter;
m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = false;
@ -164,7 +164,7 @@ cAudioManager::SetUpLoopingCollisionSound(cAudioCollision *col, uint8 counter)
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
m_sQueueSample.m_bReleasingSoundFlag = 0;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
@ -270,7 +270,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
break;
}
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16);
m_sQueueSample.m_counter = counter++;
m_sQueueSample.m_nCounter = counter++;
if(counter >= 255) counter = 28;
m_sQueueSample.m_vecPos = col->m_vecPosition;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
@ -282,7 +282,7 @@ cAudioManager::SetUpOneShotCollisionSound(cAudioCollision *col)
m_sQueueSample.m_nLoopEnd = -1;
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
m_sQueueSample.m_bReleasingSoundFlag = 1;
m_sQueueSample.m_bReleasingSoundFlag = true;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();

File diff suppressed because it is too large Load diff

View file

@ -138,7 +138,7 @@ class tSound
{
public:
int32 m_nEntityIndex;
int32 m_counter;
int32 m_nCounter;
int32 m_nSampleIndex;
uint8 m_bBankIndex;
bool m_bIs2D;
@ -170,8 +170,8 @@ public:
bool m_bRequireReflection; // Used for oneshots
uint8 m_bOffset;
int32 m_nReleasingVolumeDivider;
uint8 m_bIsProcessed;
uint8 m_bLoopEnded;
bool m_bIsProcessed;
bool m_bLoopEnded;
uint8 field_82;
uint8 field_83;
int32 calculatedVolume;
@ -244,14 +244,14 @@ class cMissionAudio
{
public:
CVector m_vecPos;
uint8 field_12;
bool m_bPredefinedProperties;
uint8 gap_13[3];
int m_nSampleIndex;
uint8 m_bLoadingStatus;
uint8 m_bPlayStatus;
uint8 field_22;
uint8 field_23;
int field_24;
int32 m_nMissionAudioCounter;
bool m_bIsPlayed;
uint8 field_29;
uint8 field_30;
@ -328,7 +328,7 @@ public:
int32 m_nBridgeEntity;
cMissionAudio m_sMissionAudio;
int32 m_anRandomTable[5];
uint8 field_19192; // time?
uint8 m_bTimeSpent;
uint8 m_bUserPause;
uint8 m_bPreviousUserPause;
uint8 field_19195; // unused

View file

@ -125,7 +125,7 @@ void
cAudioManager::DoPoliceRadioCrackle()
{
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
m_sQueueSample.m_counter = 0;
m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
m_sQueueSample.m_bBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_bIs2D = true;
@ -136,7 +136,7 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_bEmittingVolume = m_sQueueSample.m_bVolume;
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE);
m_sQueueSample.m_bReleasingSoundFlag = 0;
m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bOffset = 63;
m_sQueueSample.m_nReleasingVolumeDivider = 3;
@ -147,17 +147,20 @@ cAudioManager::DoPoliceRadioCrackle()
void
cAudioManager::ServicePoliceRadio()
{
int32 wantedLevel = 0; // bug?;
int32 wantedLevel = 0; // uninitialized variable
static uint32 nLastSeen = 300;
if (!m_bIsInitialised) return;
if(!m_bIsInitialised) return;
if (!m_bUserPause) {
if(!m_bUserPause) {
bool crimeReport = SetupCrimeReport();
#ifdef FIX_BUGS // Crash at 0x5fe6ef
if(!FindPlayerPed() || !FindPlayerPed()->m_pWanted) return;
#endif
wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel;
if (!crimeReport) {
if (wantedLevel) {
if (nLastSeen) {
if(!crimeReport) {
if(wantedLevel) {
if(nLastSeen) {
--nLastSeen;
} else {
nLastSeen = m_anRandomTable[1] % 1000 + 2000;