ProcessEscalators + some fixes

This commit is contained in:
Roman Masanin 2020-09-22 19:32:05 +03:00
parent a9c3fdd63f
commit b2e3d90734
2 changed files with 56 additions and 10 deletions

View File

@ -39,6 +39,7 @@
#include "sampman.h" #include "sampman.h"
#include "Bike.h" #include "Bike.h"
#include "WindModifiers.h" #include "WindModifiers.h"
#include "Fluff.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
@ -400,7 +401,7 @@ cAudioManager::ProcessEntity(int32 id)
case AUDIOTYPE_ESCALATOR: case AUDIOTYPE_ESCALATOR:
if (!m_nUserPause) { if (!m_nUserPause) {
m_sQueueSample.m_bReverbFlag = true; m_sQueueSample.m_bReverbFlag = true;
//ProcessEscalators(); //TODO ProcessEscalators();
} }
break; break;
case AUDIOTYPE_EXTRA_SOUNDS: case AUDIOTYPE_EXTRA_SOUNDS:
@ -3072,6 +3073,7 @@ cAudioManager::ProcessHelicopter(cVehicleParams *params)
return true; return true;
} }
//TODO use it in ProcessVehicle
void void
cAudioManager::ProcessPlane(cVehicleParams *params) cAudioManager::ProcessPlane(cVehicleParams *params)
{ {
@ -4557,12 +4559,14 @@ cAudioManager::ProcessWaterCannon(int32)
} }
} }
//positon of arcade machines
CVector aVecExtraSoundPosition[] = { {-1042.546, 88.793999, 11.324}, {-1004.476, 181.69701, 11.324} }; CVector aVecExtraSoundPosition[] = { {-1042.546, 88.793999, 11.324}, {-1004.476, 181.69701, 11.324} };
void void
cAudioManager::ProcessExtraSounds() cAudioManager::ProcessExtraSounds()
{ {
const float extraSoundIntensity = 18; const float extraSoundIntensity = 18.0f;
const uint8 extraSoundVolume = 50;
float distance; float distance;
@ -4574,22 +4578,22 @@ cAudioManager::ProcessExtraSounds()
m_sQueueSample.m_fDistance = Sqrt(distance); m_sQueueSample.m_fDistance = Sqrt(distance);
else else
m_sQueueSample.m_fDistance = 0.0f; m_sQueueSample.m_fDistance = 0.0f;
m_sQueueSample.m_nVolume = ComputeVolume(50, 18.0f, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(extraSoundVolume, extraSoundIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) { if (m_sQueueSample.m_nVolume != 0) {
this->m_sQueueSample.m_nCounter = i; this->m_sQueueSample.m_nCounter = i;
this->m_sQueueSample.m_nSampleIndex = SFX_ARCADE; this->m_sQueueSample.m_nSampleIndex = SFX_ARCADE;
this->m_sQueueSample.m_nBankIndex = 0; this->m_sQueueSample.m_nBankIndex = SFX_BANK_0;
this->m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARCADE); this->m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARCADE);
this->m_sQueueSample.m_bIs2D = false; this->m_sQueueSample.m_bIs2D = false;
this->m_sQueueSample.m_nLoopCount = 0; this->m_sQueueSample.m_nLoopCount = 0;
this->m_sQueueSample.m_bReleasingSoundFlag = false; this->m_sQueueSample.m_bReleasingSoundFlag = false;
this->m_sQueueSample.m_nReleasingVolumeModificator = 4; this->m_sQueueSample.m_nReleasingVolumeModificator = 4;
this->m_sQueueSample.m_fSpeedMultiplier = 3.0; this->m_sQueueSample.m_fSpeedMultiplier = 3.0f;
this->m_sQueueSample.m_nEmittingVolume = 50; this->m_sQueueSample.m_nEmittingVolume = extraSoundVolume;
this->m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_ARCADE); this->m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_ARCADE);
this->m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_ARCADE); this->m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_ARCADE);
this->m_sQueueSample.m_bReverbFlag = true; this->m_sQueueSample.m_bReverbFlag = true;
this->m_sQueueSample.m_fSoundIntensity = 18.0f; this->m_sQueueSample.m_fSoundIntensity = extraSoundIntensity;
this->m_sQueueSample.m_bRequireReflection = false; this->m_sQueueSample.m_bRequireReflection = false;
this->m_sQueueSample.m_nReleasingVolumeDivider = 3; this->m_sQueueSample.m_nReleasingVolumeDivider = 3;
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
@ -4598,6 +4602,48 @@ cAudioManager::ProcessExtraSounds()
} }
} }
void
cAudioManager::ProcessEscalators()
{
const float escalatorsSoundIntensity = 30.0f;
const uint8 escalatorsSoundVolume = 26;
float distance;
for (int i = 0; i < CEscalators::NumEscalators; i++) {
if (!CEscalators::aEscalators[i].m_bIsActive)
continue;
m_sQueueSample.m_vecPos = CEscalators::aEscalators[i].m_midPoint;
distance = GetDistanceSquared(m_sQueueSample.m_vecPos);
if (distance < SQR(escalatorsSoundIntensity)) {
if (distance > 0.0)
m_sQueueSample.m_fDistance = Sqrt(distance);
else
m_sQueueSample.m_fDistance = 0.0f;
m_sQueueSample.m_nVolume = ComputeVolume(escalatorsSoundVolume, escalatorsSoundIntensity, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
this->m_sQueueSample.m_nSampleIndex = SFX_BOAT_V12_LOOP;
this->m_sQueueSample.m_nBankIndex = SFX_BANK_0;
this->m_sQueueSample.m_nFrequency = i * 50 % 250 + 3973;
this->m_sQueueSample.m_nReleasingVolumeModificator = 3;
this->m_sQueueSample.m_fSpeedMultiplier = 3.0f;
this->m_sQueueSample.m_nReleasingVolumeDivider = 5;
this->m_sQueueSample.m_fSoundIntensity = escalatorsSoundIntensity;
this->m_sQueueSample.m_nCounter = i;
this->m_sQueueSample.m_bIs2D = false;
this->m_sQueueSample.m_nLoopCount = 0;
this->m_sQueueSample.m_nEmittingVolume = escalatorsSoundVolume;
this->m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_BOAT_V12_LOOP);
this->m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_BOAT_V12_LOOP);
this->m_sQueueSample.m_bReverbFlag = true;
this->m_sQueueSample.m_bReleasingSoundFlag = false;
this->m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
}
}
}
}
#pragma region SCRIPT_OBJECTS #pragma region SCRIPT_OBJECTS
const int SCRIPT_OBJECT_INTENSITY_S = 30; const int SCRIPT_OBJECT_INTENSITY_S = 30;
const int SCRIPT_OBJECT_INTENSITY_L = 80; const int SCRIPT_OBJECT_INTENSITY_L = 80;

View File

@ -90,15 +90,15 @@ class CEscalator
CVector m_pos2; CVector m_pos2;
CVector m_pos3; CVector m_pos3;
CMatrix m_matrix; CMatrix m_matrix;
bool m_bIsActive;
bool m_bIsMovingDown; bool m_bIsMovingDown;
int32 m_stepsCount; int32 m_stepsCount;
float m_lowerEnd; float m_lowerEnd;
float m_upperEnd; float m_upperEnd;
CVector m_midPoint;
float m_radius; float m_radius;
CObject *m_pSteps[24]; CObject *m_pSteps[24];
public: public:
bool m_bIsActive;//TODO also recheck!
CVector m_midPoint;
CEscalator(); CEscalator();
void Update(void); void Update(void);
void SwitchOff(void); void SwitchOff(void);
@ -107,8 +107,8 @@ public:
class CEscalators class CEscalators
{ {
static CEscalator aEscalators[NUM_ESCALATORS];
public: public:
static CEscalator aEscalators[NUM_ESCALATORS];//TODO need recheck this!
static int32 NumEscalators; static int32 NumEscalators;
static void Init(void); static void Init(void);
static void Update(void); static void Update(void);