mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-25 10:13:42 +00:00
Audio: refactoring, type fixes, renaming cAudioManager fields
This commit is contained in:
parent
9ecca45bf3
commit
ee93e4bc7d
8 changed files with 230 additions and 240 deletions
|
@ -18,7 +18,7 @@ cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface
|
|||
CVector v1;
|
||||
CVector v2;
|
||||
|
||||
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause ||
|
||||
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_bIsPaused ||
|
||||
(velocity < 0.0016f && collisionPower < 0.01f))
|
||||
return;
|
||||
|
||||
|
|
|
@ -215,9 +215,9 @@ cAudioManager::ResetAudioLogicTimers(uint32 timer)
|
|||
gAirportNextTime = timer;
|
||||
gDocksNextTime = timer;
|
||||
gCinemaNextTime = timer;
|
||||
for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) {
|
||||
if (m_asAudioEntities[m_anAudioEntityIndices[i]].m_nType == AUDIOTYPE_PHYSICAL) {
|
||||
CPed *ped = (CPed *)m_asAudioEntities[m_anAudioEntityIndices[i]].m_pEntity;
|
||||
for (uint32 i = 0; i < m_nAudioEntitiesCount; i++) {
|
||||
if (m_asAudioEntities[m_aAudioEntityOrderList[i]].m_nType == AUDIOTYPE_PHYSICAL) {
|
||||
CPed *ped = (CPed *)m_asAudioEntities[m_aAudioEntityOrderList[i]].m_pEntity;
|
||||
if (ped->IsPed()) {
|
||||
ped->m_lastSoundStart = timer;
|
||||
ped->m_soundStart = timer + m_anRandomTable[0] % 3000;
|
||||
|
@ -278,14 +278,14 @@ cAudioManager::CalculateDistance(bool8 &distCalculated, float dist)
|
|||
void
|
||||
cAudioManager::ProcessSpecial()
|
||||
{
|
||||
if (m_nUserPause) {
|
||||
if (!m_nPreviousUserPause) {
|
||||
if (m_bIsPaused) {
|
||||
if (!m_bWasPaused) {
|
||||
MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND);
|
||||
SampleManager.SetEffectsFadeVolume(MAX_VOLUME);
|
||||
SampleManager.SetMusicFadeVolume(MAX_VOLUME);
|
||||
}
|
||||
} else {
|
||||
if (m_nPreviousUserPause) {
|
||||
if (m_bWasPaused) {
|
||||
MusicManager.StopFrontEndTrack();
|
||||
MusicManager.ChangeMusicMode(MUSICMODE_GAME);
|
||||
}
|
||||
|
@ -304,43 +304,43 @@ cAudioManager::ProcessEntity(int32 id)
|
|||
m_sQueueSample.m_nEntityIndex = id;
|
||||
switch (m_asAudioEntities[id].m_nType) {
|
||||
case AUDIOTYPE_PHYSICAL:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessPhysical(id);
|
||||
}
|
||||
break;
|
||||
case AUDIOTYPE_EXPLOSION:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessExplosions(id);
|
||||
}
|
||||
break;
|
||||
case AUDIOTYPE_FIRE:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessFires(id);
|
||||
}
|
||||
break;
|
||||
case AUDIOTYPE_WEATHER:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessWeather(id);
|
||||
}
|
||||
break;
|
||||
case AUDIOTYPE_CRANE:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessCrane();
|
||||
}
|
||||
break;
|
||||
case AUDIOTYPE_SCRIPTOBJECT:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessScriptObject(id);
|
||||
}
|
||||
break;
|
||||
case AUDIOTYPE_BRIDGE:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessBridge();
|
||||
}
|
||||
|
@ -350,23 +350,23 @@ cAudioManager::ProcessEntity(int32 id)
|
|||
ProcessFrontEnd();
|
||||
break;
|
||||
case AUDIOTYPE_PROJECTILE:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessProjectiles();
|
||||
}
|
||||
break;
|
||||
case AUDIOTYPE_GARAGE:
|
||||
if (!m_nUserPause)
|
||||
if (!m_bIsPaused)
|
||||
ProcessGarages();
|
||||
break;
|
||||
case AUDIOTYPE_FIREHYDRANT:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessFireHydrant();
|
||||
}
|
||||
break;
|
||||
case AUDIOTYPE_WATERCANNON:
|
||||
if (!m_nUserPause) {
|
||||
if (!m_bIsPaused) {
|
||||
m_sQueueSample.m_bReverb = TRUE;
|
||||
ProcessWaterCannon(id);
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ const tVehicleSampleData aVehicleSettings[MAX_CARS] = {
|
|||
|
||||
bool8 bPlayerJustEnteredCar;
|
||||
|
||||
const bool8 hornPatternsArray[8][44] = {
|
||||
const bool8 HornPattern[8][44] = {
|
||||
{FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE,
|
||||
FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE},
|
||||
{FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
|
||||
|
@ -679,7 +679,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params)
|
|||
const int rainOnVehicleIntensity = 22;
|
||||
if (params.m_fDistance < SQR(rainOnVehicleIntensity) && CWeather::Rain > 0.01f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) {
|
||||
CVehicle *veh = params.m_pVehicle;
|
||||
++veh->m_bRainAudioCounter;
|
||||
veh->m_bRainAudioCounter++;
|
||||
if (veh->m_bRainAudioCounter >= 2) {
|
||||
veh->m_bRainAudioCounter = 0;
|
||||
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
|
||||
|
@ -960,7 +960,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params)
|
|||
} else {
|
||||
switch (transmission->nDriveType) {
|
||||
case '4':
|
||||
for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
|
||||
for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
|
||||
if (automobile->m_aWheelState[i] == WHEEL_STATE_SPINNING)
|
||||
traction += 0.05f;
|
||||
}
|
||||
|
@ -1125,10 +1125,10 @@ cAudioManager::ProcessCesna(cVehicleParams& params)
|
|||
if (FindPlayerVehicle() == params.m_pVehicle) {
|
||||
if (params.m_nIndex == DODO) {
|
||||
if (Pads[0].GetAccelerate() <= 0) {
|
||||
if (nAccel != 0)
|
||||
--nAccel;
|
||||
if (nAccel > 0)
|
||||
nAccel--;
|
||||
} else if (nAccel < 60) {
|
||||
++nAccel;
|
||||
nAccel++;
|
||||
}
|
||||
AddPlayerCarSample(85 * (60 - nAccel) / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_IDLE, SFX_BANK_0, 52, TRUE);
|
||||
AddPlayerCarSample(85 * nAccel / 60 + 20, 8500 * nAccel / 60 + 17000, SFX_CESNA_REV, SFX_BANK_0, 2, TRUE);
|
||||
|
@ -1193,7 +1193,6 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
|
|||
float time;
|
||||
int baseFreq;
|
||||
uint8 vol;
|
||||
int gearNr;
|
||||
int32 freq;
|
||||
|
||||
int freqModifier;
|
||||
|
@ -1213,7 +1212,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
|
|||
static uint8 CurrentPretendGear = 1;
|
||||
static bool8 bLostTractionLastFrame = FALSE;
|
||||
static bool8 bHandbrakeOnLastFrame = FALSE;
|
||||
static int32 nCruising = 0;
|
||||
static uint32 nCruising = 0;
|
||||
static bool8 bAccelSampleStopped = TRUE;
|
||||
|
||||
lostTraction = FALSE;
|
||||
|
@ -1249,7 +1248,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
|
|||
wheelInUseCounter = 0;
|
||||
for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
|
||||
if (automobile->m_aWheelState[i] != WHEEL_STATE_NORMAL)
|
||||
++wheelInUseCounter;
|
||||
wheelInUseCounter++;
|
||||
}
|
||||
if (wheelInUseCounter > 2)
|
||||
lostTraction = TRUE;
|
||||
|
@ -1305,19 +1304,35 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
|
|||
if (gasPedalAudio > 0.05f) {
|
||||
freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000;
|
||||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq /= 2;
|
||||
freq >>= 1;
|
||||
AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1), engineSoundType, 63,
|
||||
FALSE);
|
||||
}
|
||||
}
|
||||
freq = (10000.f * gasPedalAudio) + 22050;
|
||||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq /= 2;
|
||||
freq >>= 1;
|
||||
AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1), SFX_BANK_0, 52, TRUE);
|
||||
|
||||
CurrentPretendGear = Max(1, currentGear);
|
||||
} else if (nCruising > 0) {
|
||||
PlayCruising:
|
||||
bAccelSampleStopped = TRUE;
|
||||
if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction ||
|
||||
currentGear < params.m_pTransmission->nNumberOfGears - 1) {
|
||||
nCruising = 0;
|
||||
} else {
|
||||
if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f < automobile->m_fVelocityChangeForAudio) {
|
||||
if (nCruising < 800)
|
||||
nCruising++;
|
||||
} else if (nCruising > 3)
|
||||
nCruising--;
|
||||
freq = 27 * nCruising + freqModifier + 22050;
|
||||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq >>= 1;
|
||||
AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, TRUE);
|
||||
}
|
||||
} else {
|
||||
while (nCruising == 0) {
|
||||
if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction ||
|
||||
currentGear < 2 && velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs
|
||||
if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction) {
|
||||
|
@ -1326,16 +1341,16 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
|
|||
automobile->m_fGasPedalAudio *= 0.6f;
|
||||
}
|
||||
freqModifier = 0;
|
||||
baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000;
|
||||
baseFreq = (15000 * automobile->m_fGasPedalAudio) + 14000;
|
||||
vol = (25.0f * automobile->m_fGasPedalAudio) + 60;
|
||||
} else {
|
||||
baseFreq = (8000.f * accelerationMultipler) + 16000;
|
||||
baseFreq = (8000 * accelerationMultipler) + 16000;
|
||||
vol = (25.0f * accelerationMultipler) + 60;
|
||||
automobile->m_fGasPedalAudio = accelerationMultipler;
|
||||
}
|
||||
freq = freqModifier + baseFreq;
|
||||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq /= 2;
|
||||
freq >>= 1;
|
||||
if (channelUsed) {
|
||||
SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
bAccelSampleStopped = TRUE;
|
||||
|
@ -1347,12 +1362,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
|
|||
m_sQueueSample.m_nPan = ComputePan(m_sQueueSample.m_fDistance, &pos);
|
||||
#endif
|
||||
if (bAccelSampleStopped) {
|
||||
if (CurrentPretendGear != 1 || currentGear != 2) {
|
||||
gearNr = currentGear - 1;
|
||||
if (gearNr < 1)
|
||||
gearNr = 1;
|
||||
CurrentPretendGear = gearNr;
|
||||
}
|
||||
if (CurrentPretendGear != 1 || currentGear != 2)
|
||||
CurrentPretendGear = Max(1, currentGear - 1);
|
||||
processedAccelSampleStopped = TRUE;
|
||||
bAccelSampleStopped = FALSE;
|
||||
}
|
||||
|
@ -1360,10 +1371,10 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
|
|||
if (!channelUsed) {
|
||||
if (!processedAccelSampleStopped) {
|
||||
if (CurrentPretendGear < params.m_pTransmission->nNumberOfGears - 1)
|
||||
++CurrentPretendGear;
|
||||
CurrentPretendGear++;
|
||||
else {
|
||||
nCruising = 1;
|
||||
break; // while was used just for this fucking place
|
||||
goto PlayCruising;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1390,7 +1401,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
|
|||
#endif
|
||||
freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050;
|
||||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq /= 2;
|
||||
freq >>= 1;
|
||||
#ifdef USE_TIME_SCALE_FOR_AUDIO
|
||||
SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq * CTimer::GetTimeScale());
|
||||
#else
|
||||
|
@ -1405,26 +1416,6 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *
|
|||
SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (nCruising != 0) {
|
||||
bAccelSampleStopped = TRUE;
|
||||
if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction ||
|
||||
currentGear < params.m_pTransmission->nNumberOfGears - 1) {
|
||||
nCruising = 0;
|
||||
} else {
|
||||
if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f < automobile->m_fVelocityChangeForAudio) {
|
||||
if (nCruising < 800)
|
||||
++nCruising;
|
||||
} else if (nCruising > 3) {
|
||||
--nCruising;
|
||||
}
|
||||
freq = 27 * nCruising + freqModifier + 22050;
|
||||
if (engineSoundType == SFX_BANK_TRUCK)
|
||||
freq /= 2;
|
||||
AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
LastAccel = accelerateState;
|
||||
|
||||
|
@ -1449,7 +1440,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params)
|
|||
if (automobile->m_nWheelsOnGround == 0)
|
||||
return TRUE;
|
||||
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
|
||||
for (int32 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
|
||||
for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) {
|
||||
if (automobile->m_aWheelState[i] == WHEEL_STATE_NORMAL || automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_MISSING)
|
||||
continue;
|
||||
transmission = params.m_pTransmission;
|
||||
|
@ -1584,7 +1575,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params)
|
|||
automobile->m_nCarHornTimer = Min(44, automobile->m_nCarHornTimer);
|
||||
if (automobile->m_nCarHornTimer == 44)
|
||||
automobile->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7;
|
||||
if (!hornPatternsArray[automobile->m_nCarHornPattern][44 - automobile->m_nCarHornTimer])
|
||||
if (!HornPattern[automobile->m_nCarHornPattern][44 - automobile->m_nCarHornTimer])
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1751,7 +1742,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params)
|
|||
|
||||
automobile = (CAutomobile *)params.m_pVehicle;
|
||||
CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
|
||||
for (int32 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) {
|
||||
for (uint8 i = 0; i < ARRAY_SIZE(automobile->Doors); i++) {
|
||||
if (automobile->Damage.GetDoorStatus(i) == DOOR_STATUS_SWINGING) {
|
||||
doorState = automobile->Doors[i].m_nDoorState;
|
||||
if (doorState == DOORST_OPEN || doorState == DOORST_CLOSED) {
|
||||
|
@ -2296,7 +2287,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params)
|
|||
m_sQueueSample.m_nPriority = 1;
|
||||
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
|
||||
m_sQueueSample.m_MaxDistance = 40.0f;
|
||||
++CrunchOffset;
|
||||
CrunchOffset++;
|
||||
maxDist = SQR(SOUND_INTENSITY);
|
||||
emittingVol = m_anRandomTable[4] % 20 + 55;
|
||||
CrunchOffset %= 2;
|
||||
|
@ -3197,7 +3188,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms)
|
|||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||
m_sQueueSample.m_nCounter = iSound;
|
||||
narrowSoundRange = TRUE;
|
||||
++iSound;
|
||||
iSound++;
|
||||
m_sQueueSample.m_nPriority = 3;
|
||||
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
|
||||
m_sQueueSample.m_MaxDistance = 30.0f;
|
||||
|
@ -3566,15 +3557,14 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms)
|
|||
AddSampleToRequestedQueue();
|
||||
if (stereo) {
|
||||
m_sQueueSample.m_nPan = 127;
|
||||
++m_sQueueSample.m_nSampleIndex;
|
||||
m_sQueueSample.m_nSampleIndex++;
|
||||
if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] != SOUND_WEAPON_SHOT_FIRED ||
|
||||
weapon->m_eWeaponType != WEAPONTYPE_FLAMETHROWER) {
|
||||
m_sQueueSample.m_nCounter = iSound++;
|
||||
if (iSound > 60)
|
||||
iSound = 21;
|
||||
} else {
|
||||
++m_sQueueSample.m_nCounter;
|
||||
}
|
||||
} else
|
||||
m_sQueueSample.m_nCounter++;
|
||||
AddSampleToRequestedQueue();
|
||||
}
|
||||
}
|
||||
|
@ -6051,19 +6041,17 @@ cPedComments::Add(tPedComment *com)
|
|||
index = m_nIndexMap[m_nActiveBank][NUM_PED_COMMENTS_SLOTS - 1];
|
||||
if (m_asPedComments[m_nActiveBank][index].m_nVolume > com->m_nVolume)
|
||||
return;
|
||||
} else {
|
||||
} else
|
||||
index = m_nCommentsInBank[m_nActiveBank]++;
|
||||
}
|
||||
|
||||
m_asPedComments[m_nActiveBank][index] = *com;
|
||||
|
||||
uint32 i = 0;
|
||||
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_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][i]].m_nVolume < m_asPedComments[m_nActiveBank][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);
|
||||
|
@ -6079,7 +6067,7 @@ cPedComments::Process()
|
|||
uint8 actualUsedBank;
|
||||
tPedComment *comment;
|
||||
|
||||
if (AudioManager.m_nUserPause) return;
|
||||
if (AudioManager.m_bIsPaused) return;
|
||||
|
||||
if (m_nCommentsInBank[m_nActiveBank]) {
|
||||
sampleIndex = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex;
|
||||
|
@ -6202,7 +6190,7 @@ cPedComments::Process()
|
|||
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;
|
||||
m_asPedComments[actualUsedBank][m_nIndexMap[actualUsedBank][i]].m_nProcess--;
|
||||
Add(&comment[m_nIndexMap[actualUsedBank][i]]);
|
||||
}
|
||||
}
|
||||
|
@ -6361,7 +6349,7 @@ cAudioManager::ProcessWaterCannon(int32)
|
|||
{
|
||||
const float SOUND_INTENSITY = 30.0f;
|
||||
|
||||
for (int32 i = 0; i < NUM_WATERCANNONS; i++) {
|
||||
for (uint32 i = 0; i < NUM_WATERCANNONS; i++) {
|
||||
if (CWaterCannons::aCannons[i].m_nId) {
|
||||
m_sQueueSample.m_vecPos = CWaterCannons::aCannons[0].m_avecPos[CWaterCannons::aCannons[i].m_nCur];
|
||||
float distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos);
|
||||
|
@ -8033,7 +8021,7 @@ cAudioManager::ProcessFrontEnd()
|
|||
SET_SOUND_REFLECTION(FALSE);
|
||||
AddSampleToRequestedQueue();
|
||||
if (stereo) {
|
||||
++m_sQueueSample.m_nSampleIndex;
|
||||
m_sQueueSample.m_nSampleIndex++;
|
||||
m_sQueueSample.m_nCounter = iSound++;
|
||||
m_sQueueSample.m_nPan = 127 - m_sQueueSample.m_nPan;
|
||||
AddSampleToRequestedQueue();
|
||||
|
@ -8099,7 +8087,7 @@ cAudioManager::ProcessProjectiles()
|
|||
const int molotovVolume = 50;
|
||||
uint8 emittingVol;
|
||||
|
||||
for (int32 i = 0; i < NUM_PROJECTILES; i++) {
|
||||
for (uint8 i = 0; i < NUM_PROJECTILES; i++) {
|
||||
if (CProjectileInfo::GetProjectileInfo(i)->m_bInUse) {
|
||||
switch (CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) {
|
||||
case WEAPONTYPE_ROCKETLAUNCHER:
|
||||
|
@ -8158,7 +8146,11 @@ cAudioManager::ProcessGarages()
|
|||
|
||||
static uint8 iSound = 32;
|
||||
|
||||
for (uint32 i = 0; i < CGarages::NumGarages; ++i) {
|
||||
#ifdef FIX_BUGS
|
||||
for (uint32 i = 0; i < CGarages::NumGarages; i++) {
|
||||
#else
|
||||
for (uint8 i = 0; i < CGarages::NumGarages; i++) {
|
||||
#endif
|
||||
if (CGarages::aGarages[i].m_eGarageType == GARAGE_NONE)
|
||||
continue;
|
||||
entity = CGarages::aGarages[i].m_pDoor1;
|
||||
|
@ -8223,7 +8215,7 @@ cAudioManager::ProcessGarages()
|
|||
break;
|
||||
}
|
||||
}
|
||||
for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; ++j) {
|
||||
for (j = 0; j < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; j++) {
|
||||
switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[j]) {
|
||||
case SOUND_GARAGE_DOOR_CLOSED:
|
||||
case SOUND_GARAGE_DOOR_OPENED:
|
||||
|
@ -8465,7 +8457,7 @@ const MissionAudioData MissionAudioNameSfxAssoc[] = {
|
|||
int32
|
||||
FindMissionAudioSfx(const char *name)
|
||||
{
|
||||
for (uint32 i = 0; MissionAudioNameSfxAssoc[i].m_pName != nil; ++i) {
|
||||
for (uint32 i = 0; MissionAudioNameSfxAssoc[i].m_pName != nil; i++) {
|
||||
if (!CGeneral::faststricmp(MissionAudioNameSfxAssoc[i].m_pName, name))
|
||||
return MissionAudioNameSfxAssoc[i].m_nId;
|
||||
}
|
||||
|
@ -8597,7 +8589,7 @@ cAudioManager::ProcessMissionAudio()
|
|||
nFramesForPretendPlaying = 0;
|
||||
nCheckPlayingDelay = 0;
|
||||
nFramesUntilFailedLoad = 0;
|
||||
} else if (!m_nUserPause) {
|
||||
} else if (!m_bIsPaused) {
|
||||
if (++nFramesForPretendPlaying < 120) {
|
||||
m_nMissionAudioPlayStatus = PLAY_STATUS_PLAYING;
|
||||
} else {
|
||||
|
@ -8612,7 +8604,7 @@ cAudioManager::ProcessMissionAudio()
|
|||
if (MissionScriptAudioUsesPoliceChannel(m_nMissionAudioSampleIndex)) {
|
||||
SetMissionScriptPoliceAudio(m_nMissionAudioSampleIndex);
|
||||
} else {
|
||||
if (m_nUserPause)
|
||||
if (m_bIsPaused)
|
||||
SampleManager.PauseStream(TRUE, 1);
|
||||
if (m_bIsMissionAudio2D) {
|
||||
SampleManager.SetStreamedVolumeAndPan(80, 63, TRUE, 1);
|
||||
|
@ -8641,9 +8633,9 @@ cAudioManager::ProcessMissionAudio()
|
|||
break;
|
||||
}
|
||||
if (MissionScriptAudioUsesPoliceChannel(m_nMissionAudioSampleIndex)) {
|
||||
if (!m_nUserPause) {
|
||||
if (nCheckPlayingDelay) {
|
||||
--nCheckPlayingDelay;
|
||||
if (!m_bIsPaused) {
|
||||
if (nCheckPlayingDelay > 0) {
|
||||
nCheckPlayingDelay--;
|
||||
} else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED || m_nMissionAudioFramesToPlay-- == 0) {
|
||||
m_nMissionAudioPlayStatus = PLAY_STATUS_FINISHED;
|
||||
m_nMissionAudioSampleIndex = NO_SAMPLE;
|
||||
|
@ -8652,8 +8644,8 @@ cAudioManager::ProcessMissionAudio()
|
|||
}
|
||||
}
|
||||
} else if (m_bIsMissionAudioPlaying) {
|
||||
if (SampleManager.IsStreamPlaying(1) || m_nUserPause || m_nPreviousUserPause) {
|
||||
if (m_nUserPause)
|
||||
if (SampleManager.IsStreamPlaying(1) || m_bIsPaused || m_bWasPaused) {
|
||||
if (m_bIsPaused)
|
||||
SampleManager.PauseStream(TRUE, 1);
|
||||
else
|
||||
SampleManager.PauseStream(FALSE, 1);
|
||||
|
@ -8664,7 +8656,7 @@ cAudioManager::ProcessMissionAudio()
|
|||
m_nMissionAudioFramesToPlay = 0;
|
||||
}
|
||||
} else {
|
||||
if (m_nUserPause)
|
||||
if (m_bIsPaused)
|
||||
break;
|
||||
if (nCheckPlayingDelay--) {
|
||||
if (!SampleManager.IsStreamPlaying(1))
|
||||
|
|
|
@ -24,9 +24,9 @@ cAudioManager::cAudioManager()
|
|||
m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT;
|
||||
m_nTimeSpent = TIME_SPENT;
|
||||
m_nActiveSamples = NUM_CHANNELS_GENERIC;
|
||||
m_nActiveSampleQueue = 1;
|
||||
m_nActiveQueue = 1;
|
||||
ClearRequestedQueue();
|
||||
m_nActiveSampleQueue = 0;
|
||||
m_nActiveQueue = 0;
|
||||
ClearRequestedQueue();
|
||||
ClearActiveSamples();
|
||||
GenerateIntegerRandomNumberTable();
|
||||
|
@ -35,11 +35,11 @@ cAudioManager::cAudioManager()
|
|||
m_bDynamicAcousticModelingStatus = TRUE;
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < NUM_AUDIOENTITIES; i++) {
|
||||
for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
|
||||
m_asAudioEntities[i].m_bIsUsed = FALSE;
|
||||
m_anAudioEntityIndices[i] = NUM_AUDIOENTITIES;
|
||||
m_aAudioEntityOrderList[i] = NUM_AUDIOENTITIES;
|
||||
}
|
||||
m_nAudioEntitiesTotal = 0;
|
||||
m_nAudioEntitiesCount = 0;
|
||||
m_FrameCounter = 0;
|
||||
m_bReduceReleasingPriority = FALSE;
|
||||
m_bTimerJustReset = FALSE;
|
||||
|
@ -64,7 +64,7 @@ cAudioManager::Initialise()
|
|||
if (m_nActiveSamples <= 1) {
|
||||
Terminate();
|
||||
} else {
|
||||
--m_nActiveSamples;
|
||||
m_nActiveSamples--;
|
||||
#else
|
||||
{
|
||||
m_nActiveSamples = NUM_CHANNELS_GENERIC;
|
||||
|
@ -86,10 +86,10 @@ cAudioManager::Terminate()
|
|||
|
||||
for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
|
||||
m_asAudioEntities[i].m_bIsUsed = FALSE;
|
||||
m_anAudioEntityIndices[i] = ARRAY_SIZE(m_anAudioEntityIndices);
|
||||
m_aAudioEntityOrderList[i] = ARRAY_SIZE(m_aAudioEntityOrderList);
|
||||
}
|
||||
|
||||
m_nAudioEntitiesTotal = 0;
|
||||
m_nAudioEntitiesCount = 0;
|
||||
m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
|
||||
PreTerminateGameSpecificShutdown();
|
||||
|
||||
|
@ -115,8 +115,8 @@ cAudioManager::Service()
|
|||
m_bTimerJustReset = FALSE;
|
||||
}
|
||||
if (m_bIsInitialised) {
|
||||
m_nPreviousUserPause = m_nUserPause;
|
||||
m_nUserPause = CTimer::GetIsUserPaused();
|
||||
m_bWasPaused = m_bIsPaused;
|
||||
m_bIsPaused = CTimer::GetIsUserPaused();
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
UpdateReflections();
|
||||
#endif
|
||||
|
@ -138,12 +138,12 @@ cAudioManager::CreateEntity(eAudioType type, void *entity)
|
|||
#ifdef FIX_BUGS
|
||||
// since sound could still play after entity deletion let's make sure we don't override one that is in use
|
||||
// find all the free entity IDs that are being used by queued samples
|
||||
int32 stillUsedEntities[NUM_CHANNELS_GENERIC * NUM_SOUNDS_SAMPLES_BANKS];
|
||||
int32 stillUsedEntities[NUM_CHANNELS_GENERIC * NUM_SOUND_QUEUES];
|
||||
uint32 stillUsedEntitiesCount = 0;
|
||||
|
||||
for (uint8 i = 0; i < NUM_SOUNDS_SAMPLES_BANKS; i++)
|
||||
for (uint8 j = 0; j < m_SampleRequestQueuesStatus[i]; j++) {
|
||||
tSound &sound = m_asSamples[i][m_abSampleQueueIndexTable[i][j]];
|
||||
for (uint8 i = 0; i < NUM_SOUND_QUEUES; i++)
|
||||
for (uint8 j = 0; j < m_nRequestedCount[i]; j++) {
|
||||
tSound &sound = m_aRequestedQueue[i][m_aRequestedOrderList[i][j]];
|
||||
if (sound.m_nEntityIndex < 0) continue;
|
||||
if (!m_asAudioEntities[sound.m_nEntityIndex].m_bIsUsed) {
|
||||
bool found = false;
|
||||
|
@ -159,7 +159,7 @@ cAudioManager::CreateEntity(eAudioType type, void *entity)
|
|||
}
|
||||
#endif
|
||||
|
||||
for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) {
|
||||
for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
|
||||
if (!m_asAudioEntities[i].m_bIsUsed) {
|
||||
#ifdef FIX_BUGS
|
||||
// skip if ID is still used by queued sample
|
||||
|
@ -184,7 +184,7 @@ cAudioManager::CreateEntity(eAudioType type, void *entity)
|
|||
m_asAudioEntities[i].m_awAudioEvent[2] = SOUND_NO_SOUND;
|
||||
m_asAudioEntities[i].m_awAudioEvent[3] = SOUND_NO_SOUND;
|
||||
m_asAudioEntities[i].m_AudioEvents = 0;
|
||||
m_anAudioEntityIndices[m_nAudioEntitiesTotal++] = i;
|
||||
m_aAudioEntityOrderList[m_nAudioEntitiesCount++] = i;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -196,11 +196,11 @@ cAudioManager::DestroyEntity(int32 id)
|
|||
{
|
||||
if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) {
|
||||
m_asAudioEntities[id].m_bIsUsed = FALSE;
|
||||
for (int32 i = 0; i < m_nAudioEntitiesTotal; ++i) {
|
||||
if (id == m_anAudioEntityIndices[i]) {
|
||||
for (uint32 i = 0; i < m_nAudioEntitiesCount; i++) {
|
||||
if (id == m_aAudioEntityOrderList[i]) {
|
||||
if (i < NUM_AUDIOENTITIES - 1)
|
||||
memmove(&m_anAudioEntityIndices[i], &m_anAudioEntityIndices[i + 1], NUM_AUDIOENTITY_EVENTS * (m_nAudioEntitiesTotal - (i + 1)));
|
||||
m_anAudioEntityIndices[--m_nAudioEntitiesTotal] = NUM_AUDIOENTITIES;
|
||||
memmove(&m_aAudioEntityOrderList[i], &m_aAudioEntityOrderList[i + 1], NUM_AUDIOENTITY_EVENTS * (m_nAudioEntitiesCount - (i + 1)));
|
||||
m_aAudioEntityOrderList[--m_nAudioEntitiesCount] = NUM_AUDIOENTITIES;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -257,13 +257,13 @@ cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
|
|||
if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) {
|
||||
entity.m_awAudioEvent[i] = sound;
|
||||
entity.m_afVolume[i] = vol;
|
||||
++entity.m_AudioEvents;
|
||||
entity.m_AudioEvents++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (OneShotPriority[entity.m_awAudioEvent[i]] > OneShotPriority[sound])
|
||||
break;
|
||||
++i;
|
||||
i++;
|
||||
}
|
||||
if (i < NUM_AUDIOENTITY_EVENTS - 1) {
|
||||
memmove(&entity.m_awAudioEvent[i + 1], &entity.m_awAudioEvent[i], (NUM_AUDIOENTITY_EVENTS - 1 - i) * NUM_AUDIOENTITY_EVENTS / 2);
|
||||
|
@ -272,7 +272,7 @@ cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol)
|
|||
entity.m_awAudioEvent[i] = sound;
|
||||
entity.m_afVolume[i] = vol;
|
||||
if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent))
|
||||
++entity.m_AudioEvents;
|
||||
entity.m_AudioEvents++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,14 +317,14 @@ cAudioManager::ResetTimers(uint32 time)
|
|||
m_bTimerJustReset = TRUE;
|
||||
m_nTimer = time;
|
||||
ClearRequestedQueue();
|
||||
if (m_nActiveSampleQueue) {
|
||||
m_nActiveSampleQueue = 0;
|
||||
if (m_nActiveQueue) {
|
||||
m_nActiveQueue = 0;
|
||||
ClearRequestedQueue();
|
||||
m_nActiveSampleQueue = 1;
|
||||
m_nActiveQueue = 1;
|
||||
} else {
|
||||
m_nActiveSampleQueue = 1;
|
||||
m_nActiveQueue = 1;
|
||||
ClearRequestedQueue();
|
||||
m_nActiveSampleQueue = 0;
|
||||
m_nActiveQueue = 0;
|
||||
}
|
||||
ClearActiveSamples();
|
||||
ClearMissionAudio();
|
||||
|
@ -344,7 +344,7 @@ cAudioManager::DestroyAllGameCreatedEntities()
|
|||
cAudioScriptObject *entity;
|
||||
|
||||
if (m_bIsInitialised) {
|
||||
for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) {
|
||||
for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) {
|
||||
if (m_asAudioEntities[i].m_bIsUsed) {
|
||||
switch (m_asAudioEntities[i].m_nType) {
|
||||
case AUDIOTYPE_PHYSICAL:
|
||||
|
@ -422,13 +422,13 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
|
|||
#else
|
||||
if (!m_bIsInitialised)
|
||||
return -1;
|
||||
for (uint8 i = 0; i < m_nActiveSamples + 1; ++i)
|
||||
for (uint8 i = 0; i < m_nActiveSamples + 1; i++)
|
||||
SampleManager.StopChannel(i);
|
||||
ClearRequestedQueue();
|
||||
if (m_nActiveSampleQueue == 0)
|
||||
m_nActiveSampleQueue = 1;
|
||||
if (m_nActiveQueue == 0)
|
||||
m_nActiveQueue = 1;
|
||||
else
|
||||
m_nActiveSampleQueue = 0;
|
||||
m_nActiveQueue = 0;
|
||||
ClearRequestedQueue();
|
||||
ClearActiveSamples();
|
||||
int8 current = SampleManager.SetCurrent3DProvider(which);
|
||||
|
@ -436,7 +436,7 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
|
|||
#ifdef EXTERNAL_3D_SOUND
|
||||
m_nActiveSamples = SampleManager.GetMaximumSupportedChannels();
|
||||
if (m_nActiveSamples > 1)
|
||||
--m_nActiveSamples;
|
||||
m_nActiveSamples--;
|
||||
#endif
|
||||
}
|
||||
return current;
|
||||
|
@ -514,23 +514,23 @@ cAudioManager::ServiceSoundEffects()
|
|||
if(CTimer::GetLogicalFramesPassed() != 0)
|
||||
#endif
|
||||
m_bReduceReleasingPriority = (m_FrameCounter++ % 5) == 0;
|
||||
if (m_nUserPause && !m_nPreviousUserPause) {
|
||||
if (m_bIsPaused && !m_bWasPaused) {
|
||||
for (int32 i = 0; i < NUM_CHANNELS; i++)
|
||||
SampleManager.StopChannel(i);
|
||||
|
||||
ClearRequestedQueue();
|
||||
if (m_nActiveSampleQueue) {
|
||||
m_nActiveSampleQueue = 0;
|
||||
if (m_nActiveQueue) {
|
||||
m_nActiveQueue = 0;
|
||||
ClearRequestedQueue();
|
||||
m_nActiveSampleQueue = 1;
|
||||
m_nActiveQueue = 1;
|
||||
} else {
|
||||
m_nActiveSampleQueue = 1;
|
||||
m_nActiveQueue = 1;
|
||||
ClearRequestedQueue();
|
||||
m_nActiveSampleQueue = 0;
|
||||
m_nActiveQueue = 0;
|
||||
}
|
||||
ClearActiveSamples();
|
||||
}
|
||||
m_nActiveSampleQueue = m_nActiveSampleQueue == 1 ? 0 : 1;
|
||||
m_nActiveQueue = m_nActiveQueue == 1 ? 0 : 1;
|
||||
ProcessReverb();
|
||||
ProcessSpecial();
|
||||
ClearRequestedQueue();
|
||||
|
@ -547,7 +547,7 @@ cAudioManager::ServiceSoundEffects()
|
|||
#ifdef AUDIO_OAL
|
||||
SampleManager.Service();
|
||||
#endif
|
||||
for (int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; ++i) {
|
||||
for (int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; i++) {
|
||||
cAudioScriptObject *object = (cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity;
|
||||
delete object;
|
||||
m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity = nil;
|
||||
|
@ -636,9 +636,9 @@ cAudioManager::RandomDisplacement(uint32 seed)
|
|||
void
|
||||
cAudioManager::InterrogateAudioEntities()
|
||||
{
|
||||
for (int32 i = 0; i < m_nAudioEntitiesTotal; i++) {
|
||||
ProcessEntity(m_anAudioEntityIndices[i]);
|
||||
m_asAudioEntities[m_anAudioEntityIndices[i]].m_AudioEvents = 0;
|
||||
for (uint32 i = 0; i < m_nAudioEntitiesCount; i++) {
|
||||
ProcessEntity(m_aAudioEntityOrderList[i]);
|
||||
m_asAudioEntities[m_aAudioEntityOrderList[i]].m_AudioEvents = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -653,13 +653,13 @@ cAudioManager::AddSampleToRequestedQueue()
|
|||
|
||||
if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
|
||||
finalPriority = m_sQueueSample.m_nPriority * (MAX_VOLUME - m_sQueueSample.m_nVolume);
|
||||
sampleIndex = m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
|
||||
sampleIndex = m_nRequestedCount[m_nActiveQueue];
|
||||
if (sampleIndex >= m_nActiveSamples) {
|
||||
sampleIndex = m_abSampleQueueIndexTable[m_nActiveSampleQueue][m_nActiveSamples - 1];
|
||||
if (m_asSamples[m_nActiveSampleQueue][sampleIndex].m_nFinalPriority <= finalPriority)
|
||||
sampleIndex = m_aRequestedOrderList[m_nActiveQueue][m_nActiveSamples - 1];
|
||||
if (m_aRequestedQueue[m_nActiveQueue][sampleIndex].m_nFinalPriority <= finalPriority)
|
||||
return;
|
||||
} else {
|
||||
++m_SampleRequestQueuesStatus[m_nActiveSampleQueue];
|
||||
m_nRequestedCount[m_nActiveQueue]++;
|
||||
}
|
||||
#if GTA_VERSION < GTA3_PC_10
|
||||
if (m_sQueueSample.m_bStatic) {
|
||||
|
@ -688,7 +688,7 @@ cAudioManager::AddSampleToRequestedQueue()
|
|||
m_sQueueSample.m_bReverb = FALSE;
|
||||
#endif
|
||||
|
||||
m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample;
|
||||
m_aRequestedQueue[m_nActiveQueue][sampleIndex] = m_sQueueSample;
|
||||
|
||||
AddDetailsToRequestedOrderList(sampleIndex);
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
|
@ -704,15 +704,15 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
|
|||
uint32 i = 0;
|
||||
if (sample != 0) {
|
||||
for (; i < sample; i++) {
|
||||
if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nFinalPriority >
|
||||
m_asSamples[m_nActiveSampleQueue][sample].m_nFinalPriority)
|
||||
if (m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]].m_nFinalPriority >
|
||||
m_aRequestedQueue[m_nActiveQueue][sample].m_nFinalPriority)
|
||||
break;
|
||||
}
|
||||
if (i < sample) {
|
||||
memmove(&m_abSampleQueueIndexTable[m_nActiveSampleQueue][i + 1], &m_abSampleQueueIndexTable[m_nActiveSampleQueue][i], m_nActiveSamples - i - 1);
|
||||
memmove(&m_aRequestedOrderList[m_nActiveQueue][i + 1], &m_aRequestedOrderList[m_nActiveQueue][i], m_nActiveSamples - i - 1);
|
||||
}
|
||||
}
|
||||
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
|
||||
m_aRequestedOrderList[m_nActiveQueue][i] = sample;
|
||||
}
|
||||
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
|
@ -810,17 +810,17 @@ cAudioManager::AddReleasingSounds()
|
|||
bool8 toProcess[44];
|
||||
#endif
|
||||
|
||||
int8 queue = m_nActiveSampleQueue == 0 ? 1 : 0;
|
||||
uint8 queue = m_nActiveQueue == 0 ? 1 : 0;
|
||||
|
||||
for (int32 i = 0; i < m_SampleRequestQueuesStatus[queue]; i++) {
|
||||
tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]];
|
||||
for (uint8 i = 0; i < m_nRequestedCount[queue]; i++) {
|
||||
tSound &sample = m_aRequestedQueue[queue][m_aRequestedOrderList[queue][i]];
|
||||
if (sample.m_bIsPlayingFinished)
|
||||
continue;
|
||||
|
||||
toProcess[i] = FALSE;
|
||||
for (int32 j = 0; j < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; j++) {
|
||||
if (sample.m_nEntityIndex == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nEntityIndex &&
|
||||
sample.m_nCounter == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nCounter) {
|
||||
for (uint8 j = 0; j < m_nRequestedCount[m_nActiveQueue]; j++) {
|
||||
if (sample.m_nEntityIndex == m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][j]].m_nEntityIndex &&
|
||||
sample.m_nCounter == m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][j]].m_nCounter) {
|
||||
toProcess[i] = TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -954,18 +954,18 @@ cAudioManager::ProcessActiveQueues()
|
|||
#endif
|
||||
|
||||
#ifdef USE_TIME_SCALE_FOR_AUDIO
|
||||
float timeScale = m_nUserPause ? 1.0f : CTimer::GetTimeScale();
|
||||
float timeScale = m_bIsPaused ? 1.0f : CTimer::GetTimeScale();
|
||||
#endif
|
||||
|
||||
for (int32 i = 0; i < m_nActiveSamples; i++) {
|
||||
m_asSamples[m_nActiveSampleQueue][i].m_bIsBeingPlayed = FALSE;
|
||||
for (uint8 i = 0; i < m_nActiveSamples; i++) {
|
||||
m_aRequestedQueue[m_nActiveQueue][i].m_bIsBeingPlayed = FALSE;
|
||||
m_asActiveSamples[i].m_bIsBeingPlayed = FALSE;
|
||||
}
|
||||
|
||||
for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
|
||||
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
||||
for (uint8 i = 0; i < m_nRequestedCount[m_nActiveQueue]; i++) {
|
||||
tSound &sample = m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]];
|
||||
if (sample.m_nSampleIndex != NO_SAMPLE) {
|
||||
for (int32 j = 0; j < m_nActiveSamples; j++) {
|
||||
for (uint8 j = 0; j < m_nActiveSamples; j++) {
|
||||
if (sample.m_nEntityIndex == m_asActiveSamples[j].m_nEntityIndex && sample.m_nCounter == m_asActiveSamples[j].m_nCounter &&
|
||||
sample.m_nSampleIndex == m_asActiveSamples[j].m_nSampleIndex) {
|
||||
if (sample.m_nLoopCount > 0) {
|
||||
|
@ -1052,15 +1052,15 @@ cAudioManager::ProcessActiveQueues()
|
|||
}
|
||||
}
|
||||
}
|
||||
for (int32 i = 0; i < m_nActiveSamples; i++) {
|
||||
for (uint8 i = 0; i < m_nActiveSamples; i++) {
|
||||
if (m_asActiveSamples[i].m_nSampleIndex != NO_SAMPLE && !m_asActiveSamples[i].m_bIsBeingPlayed) {
|
||||
SampleManager.StopChannel(i);
|
||||
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
|
||||
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
|
||||
}
|
||||
}
|
||||
for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
|
||||
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
||||
for (uint8 i = 0; i < m_nRequestedCount[m_nActiveQueue]; i++) {
|
||||
tSound &sample = m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]];
|
||||
if (!sample.m_bIsBeingPlayed && !sample.m_bIsPlayingFinished && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
if (sample.m_nCounter > 255 && sample.m_nLoopCount > 0 && sample.m_nReflectionDelay > 0) { // check if reflection
|
||||
|
@ -1154,10 +1154,9 @@ cAudioManager::ProcessActiveQueues()
|
|||
void
|
||||
cAudioManager::ClearRequestedQueue()
|
||||
{
|
||||
for (int32 i = 0; i < m_nActiveSamples; i++) {
|
||||
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = m_nActiveSamples;
|
||||
}
|
||||
m_SampleRequestQueuesStatus[m_nActiveSampleQueue] = 0;
|
||||
for (uint8 i = 0; i < m_nActiveSamples; i++)
|
||||
m_aRequestedOrderList[m_nActiveQueue][i] = m_nActiveSamples;
|
||||
m_nRequestedCount[m_nActiveQueue] = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1212,17 +1211,16 @@ cAudioManager::LoadBankIfNecessary(uint8 bank)
|
|||
void
|
||||
cAudioManager::GenerateIntegerRandomNumberTable()
|
||||
{
|
||||
for (int32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++) {
|
||||
for (uint32 i = 0; i < ARRAY_SIZE(m_anRandomTable); i++)
|
||||
m_anRandomTable[i] = myrand();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EXTERNAL_3D_SOUND
|
||||
void
|
||||
cAudioManager::AdjustSamplesVolume()
|
||||
{
|
||||
for (int i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
|
||||
tSound *pSample = &m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
||||
for (uint8 i = 0; i < m_nRequestedCount[m_nActiveQueue]; i++) {
|
||||
tSound *pSample = &m_aRequestedQueue[m_nActiveQueue][m_aRequestedOrderList[m_nActiveQueue][i]];
|
||||
|
||||
if (!pSample->m_bIs2D)
|
||||
pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_MaxDistance, pSample->m_fDistance);
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
bool8 m_bIsBeingPlayed; // Set to TRUE when the sound was added or changed on current frame to avoid it being overwritten
|
||||
bool8 m_bIsPlayingFinished; // Not sure about the name. Set to TRUE when sampman channel becomes free
|
||||
#if GTA_VERSION < GTA3_PC_10
|
||||
int32 unk; // Only on PS2, used by static non-looped sounds (AFAIK)
|
||||
int32 unk; // (inherited from GTA 2) Only on PS2, used by static non-looped sounds (AFAIK)
|
||||
// Looks like it's keeping a number of frames left to play with the purpose of setting m_bIsPlayingFinished=TRUE once value reaches 0
|
||||
// Default value is -3 for whatever reason
|
||||
#endif
|
||||
|
@ -219,16 +219,16 @@ public:
|
|||
#endif
|
||||
float m_fSpeedOfSound;
|
||||
bool8 m_bTimerJustReset;
|
||||
int32 m_nTimer;
|
||||
uint32 m_nTimer;
|
||||
tSound m_sQueueSample;
|
||||
uint8 m_nActiveSampleQueue;
|
||||
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC];
|
||||
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC];
|
||||
uint8 m_SampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
|
||||
uint8 m_nActiveQueue;
|
||||
tSound m_aRequestedQueue[NUM_SOUND_QUEUES][NUM_CHANNELS_GENERIC];
|
||||
uint8 m_aRequestedOrderList[NUM_SOUND_QUEUES][NUM_CHANNELS_GENERIC];
|
||||
uint8 m_nRequestedCount[NUM_SOUND_QUEUES];
|
||||
tSound m_asActiveSamples[NUM_CHANNELS_GENERIC];
|
||||
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
|
||||
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES];
|
||||
int32 m_nAudioEntitiesTotal;
|
||||
uint32 m_aAudioEntityOrderList[NUM_AUDIOENTITIES];
|
||||
uint32 m_nAudioEntitiesCount;
|
||||
#ifdef AUDIO_REFLECTIONS
|
||||
CVector m_avecReflectionsPos[MAX_REFLECTIONS];
|
||||
float m_afReflectionsDistances[MAX_REFLECTIONS];
|
||||
|
@ -253,13 +253,13 @@ public:
|
|||
uint8 m_nMissionAudioLoadingStatus;
|
||||
uint8 m_nMissionAudioPlayStatus;
|
||||
bool8 m_bIsMissionAudioPlaying;
|
||||
int32 m_nMissionAudioFramesToPlay;
|
||||
int32 m_nMissionAudioFramesToPlay; // possibly unsigned
|
||||
bool8 m_bIsMissionAudioAllowedToPlay;
|
||||
|
||||
int32 m_anRandomTable[5];
|
||||
uint8 m_nTimeSpent;
|
||||
bool8 m_nUserPause;
|
||||
bool8 m_nPreviousUserPause;
|
||||
bool8 m_bIsPaused;
|
||||
bool8 m_bWasPaused;
|
||||
uint32 m_FrameCounter;
|
||||
|
||||
cAudioManager();
|
||||
|
|
|
@ -363,14 +363,14 @@ cMusicManager::GetRadioInCar(void)
|
|||
CVehicle *veh = FindPlayerVehicle();
|
||||
if (veh != nil){
|
||||
if (UsesPoliceRadio(veh)) {
|
||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
|
||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_bIsPaused))
|
||||
return POLICE_RADIO;
|
||||
return m_nRadioInCar;
|
||||
} else return veh->m_nRadioStation;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
|
||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_bIsPaused))
|
||||
return RADIO_OFF;
|
||||
return m_nRadioInCar;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ cMusicManager::ResetMusicAfterReload()
|
|||
|
||||
|
||||
void
|
||||
cMusicManager::ResetTimers(int32 time)
|
||||
cMusicManager::ResetTimers(uint32 time)
|
||||
{
|
||||
m_bResetTimers = TRUE;
|
||||
m_nResetTime = time;
|
||||
|
@ -469,7 +469,7 @@ cMusicManager::ServiceFrontEndMode()
|
|||
switch (m_nNextTrack)
|
||||
{
|
||||
case STREAMED_SOUND_MISSION_COMPLETED:
|
||||
if (!AudioManager.m_nUserPause)
|
||||
if (!AudioManager.m_bIsPaused)
|
||||
ChangeMusicMode(MUSICMODE_GAME);
|
||||
break;
|
||||
case STREAMED_SOUND_GAME_COMPLETED:
|
||||
|
@ -543,7 +543,7 @@ cMusicManager::ServiceGameMode()
|
|||
nFramesSinceCutsceneEnded = -1;
|
||||
}
|
||||
|
||||
if (AudioManager.m_nPreviousUserPause)
|
||||
if (AudioManager.m_bWasPaused)
|
||||
m_bPreviousPlayerInCar = FALSE;
|
||||
if (!m_bPlayerInCar) {
|
||||
if (m_bPreviousPlayerInCar) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
void ResetMusicAfterReload();
|
||||
|
||||
void ResetTimers(int32);
|
||||
void ResetTimers(uint32);
|
||||
void Service();
|
||||
void ServiceFrontEndMode();
|
||||
void ServiceGameMode();
|
||||
|
|
|
@ -149,7 +149,7 @@ cAudioManager::ServicePoliceRadio()
|
|||
|
||||
if(!m_bIsInitialised) return;
|
||||
|
||||
if(!m_nUserPause) {
|
||||
if(!m_bIsPaused) {
|
||||
bool8 crimeReport = SetupCrimeReport();
|
||||
#ifdef FIX_BUGS // Crash at 0x5fe6ef
|
||||
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
|
||||
|
@ -188,14 +188,14 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
|||
|
||||
if (!m_bIsInitialised) return;
|
||||
|
||||
if (m_nUserPause) {
|
||||
if (m_bIsPaused) {
|
||||
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING &&
|
||||
SampleManager.IsStreamPlaying(1)) {
|
||||
SampleManager.PauseStream(TRUE, 1);
|
||||
}
|
||||
} else {
|
||||
if (m_nPreviousUserPause && g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES &&
|
||||
if (m_bWasPaused && g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES &&
|
||||
bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
|
||||
SampleManager.PauseStream(FALSE, 1);
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ enum Config {
|
|||
NUM_PED_COMMENTS_BANKS = 2,
|
||||
NUM_PED_COMMENTS_SLOTS = 20,
|
||||
|
||||
NUM_SOUNDS_SAMPLES_BANKS = 2,
|
||||
NUM_SOUND_QUEUES = 2,
|
||||
NUM_AUDIOENTITIES = 200,
|
||||
|
||||
NUM_SCRIPT_MAX_ENTITIES = 40,
|
||||
|
|
Loading…
Reference in a new issue