Merge branch 'master' into miami

# Conflicts:
#	src/audio/AudioLogic.cpp
#	src/audio/AudioManager.h
This commit is contained in:
Sergeanur 2020-06-30 19:12:06 +03:00
commit 8045bec6a5
3 changed files with 18 additions and 24 deletions

View File

@ -166,7 +166,7 @@ cAudioManager::PostInitialiseGameSpecificSetup()
m_sMissionAudio.m_nSampleIndex[0] = NO_SAMPLE; m_sMissionAudio.m_nSampleIndex[0] = NO_SAMPLE;
m_sMissionAudio.m_nLoadingStatus[0] = LOADING_STATUS_NOT_LOADED; m_sMissionAudio.m_nLoadingStatus[0] = LOADING_STATUS_NOT_LOADED;
m_sMissionAudio.m_nPlayStatus[0] = PLAY_STATUS_STOPPED; m_sMissionAudio.m_nPlayStatus[0] = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22[0] = 0; m_sMissionAudio.m_bIsPlaying[0] = false;
m_sMissionAudio.m_bIsPlayed[0] = false; m_sMissionAudio.m_bIsPlayed[0] = false;
m_sMissionAudio.m_bPredefinedProperties[0] = true; m_sMissionAudio.m_bPredefinedProperties[0] = true;
m_sMissionAudio.m_nMissionAudioCounter[0] = 0; m_sMissionAudio.m_nMissionAudioCounter[0] = 0;
@ -175,7 +175,7 @@ cAudioManager::PostInitialiseGameSpecificSetup()
m_sMissionAudio.m_nSampleIndex[1] = NO_SAMPLE; m_sMissionAudio.m_nSampleIndex[1] = NO_SAMPLE;
m_sMissionAudio.m_nLoadingStatus[1] = LOADING_STATUS_NOT_LOADED; m_sMissionAudio.m_nLoadingStatus[1] = LOADING_STATUS_NOT_LOADED;
m_sMissionAudio.m_nPlayStatus[1] = PLAY_STATUS_STOPPED; m_sMissionAudio.m_nPlayStatus[1] = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22[1] = 0; m_sMissionAudio.m_bIsPlaying[1] = false;
m_sMissionAudio.m_bIsPlayed[1] = false; m_sMissionAudio.m_bIsPlayed[1] = false;
m_sMissionAudio.m_bPredefinedProperties[1] = true; m_sMissionAudio.m_bPredefinedProperties[1] = true;
m_sMissionAudio.m_nMissionAudioCounter[1] = 0; m_sMissionAudio.m_nMissionAudioCounter[1] = 0;
@ -1077,15 +1077,15 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params)
} }
break; break;
case 'F': case 'F':
if (automobile->m_aWheelState[VEHWHEEL_FRONT_LEFT] == WHEEL_STATE_SPINNING) if (automobile->m_aWheelState[CARWHEEL_FRONT_LEFT] == WHEEL_STATE_SPINNING)
traction += 0.1f; traction += 0.1f;
if (automobile->m_aWheelState[VEHWHEEL_REAR_LEFT] == WHEEL_STATE_SPINNING) if (automobile->m_aWheelState[CARWHEEL_FRONT_RIGHT] == WHEEL_STATE_SPINNING)
traction += 0.1f; traction += 0.1f;
break; break;
case 'R': case 'R':
if (automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] == WHEEL_STATE_SPINNING) if (automobile->m_aWheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SPINNING)
traction += 0.1f; traction += 0.1f;
if (automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] == WHEEL_STATE_SPINNING) if (automobile->m_aWheelState[CARWHEEL_REAR_RIGHT] == WHEEL_STATE_SPINNING)
traction += 0.1f; traction += 0.1f;
break; break;
} }
@ -1366,12 +1366,12 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
lostTraction = true; lostTraction = true;
break; break;
case 'F': case 'F':
if ((automobile->m_aWheelState[VEHWHEEL_FRONT_LEFT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[VEHWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL) && if ((automobile->m_aWheelState[CARWHEEL_FRONT_LEFT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[CARWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL) &&
(automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) (automobile->m_aWheelState[CARWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[CARWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL))
lostTraction = true; lostTraction = true;
break; break;
case 'R': case 'R':
if ((automobile->m_aWheelState[VEHWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL) || (automobile->m_aWheelState[VEHWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) if ((automobile->m_aWheelState[CARWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL) || (automobile->m_aWheelState[CARWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL))
lostTraction = true; lostTraction = true;
break; break;
} }
@ -2550,10 +2550,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
AddSampleToRequestedQueue(); AddSampleToRequestedQueue();
} }
if (FindPlayerVehicle() == params->m_pVehicle) { if (FindPlayerVehicle() == params->m_pVehicle) {
if (Pads[0].GetAccelerate() <= Pads[0].GetBrake()) padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake());
padAccelerate = Pads[0].GetBrake();
else
padAccelerate = Pads[0].GetAccelerate();
padRelativeAccerate = padAccelerate / 255; padRelativeAccerate = padAccelerate / 255;
emittingVol = (100.f * padRelativeAccerate) + 15; emittingVol = (100.f * padRelativeAccerate) + 15;
m_sQueueSample.m_nFrequency = (3000.f * padRelativeAccerate) + 6000; m_sQueueSample.m_nFrequency = (3000.f * padRelativeAccerate) + 6000;
@ -2592,10 +2589,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams *params)
m_sQueueSample.m_bRequireReflection = false; m_sQueueSample.m_bRequireReflection = false;
} else { } else {
if (FindPlayerVehicle() == params->m_pVehicle) { if (FindPlayerVehicle() == params->m_pVehicle) {
if (Pads[0].GetAccelerate() <= Pads[0].GetBrake()) padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake());
padAccelerate = Pads[0].GetBrake();
else
padAccelerate = Pads[0].GetAccelerate();
if (padAccelerate <= 20) { if (padAccelerate <= 20) {
emittingVol = 45 - 45 * padAccelerate / 40; emittingVol = 45 - 45 * padAccelerate / 40;
m_sQueueSample.m_nFrequency = 100 * padAccelerate + 11025; m_sQueueSample.m_nFrequency = 100 * padAccelerate + 11025;
@ -5645,7 +5639,7 @@ cAudioManager::PreloadMissionAudio(uint8 slot, Const char *name)
m_sMissionAudio.m_nSampleIndex[slot] = missionAudioSfx; m_sMissionAudio.m_nSampleIndex[slot] = missionAudioSfx;
m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_NOT_LOADED; m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_NOT_LOADED;
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED; m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22[slot] = 0; m_sMissionAudio.m_bIsPlaying[slot] = false;
m_sMissionAudio.m_nMissionAudioCounter[slot] = m_nTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000; m_sMissionAudio.m_nMissionAudioCounter[slot] = m_nTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000;
m_sMissionAudio.m_nMissionAudioCounter[slot] *= 4; m_sMissionAudio.m_nMissionAudioCounter[slot] *= 4;
m_sMissionAudio.m_bIsPlayed[slot] = false; m_sMissionAudio.m_bIsPlayed[slot] = false;
@ -5726,7 +5720,7 @@ cAudioManager::ClearMissionAudio(uint8 slot)
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE; m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_NOT_LOADED; m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_NOT_LOADED;
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED; m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
m_sMissionAudio.field_22[slot] = 0; m_sMissionAudio.m_bIsPlaying[slot] = false;
m_sMissionAudio.m_bIsPlayed[slot] = false; m_sMissionAudio.m_bIsPlayed[slot] = false;
m_sMissionAudio.m_bPredefinedProperties[slot] = true; m_sMissionAudio.m_bPredefinedProperties[slot] = true;
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
@ -5828,7 +5822,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
} }
} }
} else if (m_sMissionAudio.field_22[slot]) { } else if (m_sMissionAudio.m_bIsPlaying[slot]) {
if (SampleManager.IsStreamPlaying(slot + 1) || m_nUserPause || m_nPreviousUserPause) { if (SampleManager.IsStreamPlaying(slot + 1) || m_nUserPause || m_nPreviousUserPause) {
if (m_nUserPause) if (m_nUserPause)
SampleManager.PauseStream(1, slot + 1); SampleManager.PauseStream(1, slot + 1);
@ -5870,7 +5864,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
break; break;
nCheckPlayingDelay[slot] = 0; nCheckPlayingDelay[slot] = 0;
} }
m_sMissionAudio.field_22[slot] = 1; m_sMissionAudio.m_bIsPlaying[slot] = true;
} }
break; break;
default: default:

View File

@ -437,7 +437,7 @@ cAudioManager::ServiceSoundEffects()
} }
ClearActiveSamples(); ClearActiveSamples();
} }
m_nActiveSampleQueue = m_nActiveSampleQueue != 1; m_nActiveSampleQueue = m_nActiveSampleQueue == 1 ? 0 : 1;
ProcessReverb(); ProcessReverb();
ProcessSpecial(); ProcessSpecial();
ClearRequestedQueue(); ClearRequestedQueue();
@ -687,7 +687,7 @@ cAudioManager::AddReleasingSounds()
{ {
bool toProcess[44]; // why not 27? bool toProcess[44]; // why not 27?
int8 queue = m_nActiveSampleQueue == 0; int8 queue = m_nActiveSampleQueue == 0 ? 1 : 0;
for (int32 i = 0; i < m_SampleRequestQueuesStatus[queue]; i++) { for (int32 i = 0; i < m_SampleRequestQueuesStatus[queue]; i++) {
tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]]; tSound &sample = m_asSamples[queue][m_abSampleQueueIndexTable[queue][i]];

View File

@ -108,7 +108,7 @@ public:
int32 m_nSampleIndex[MISSION_AUDIO_SLOTS]; int32 m_nSampleIndex[MISSION_AUDIO_SLOTS];
uint8 m_nLoadingStatus[MISSION_AUDIO_SLOTS]; uint8 m_nLoadingStatus[MISSION_AUDIO_SLOTS];
uint8 m_nPlayStatus[MISSION_AUDIO_SLOTS]; uint8 m_nPlayStatus[MISSION_AUDIO_SLOTS];
uint8 field_22[MISSION_AUDIO_SLOTS]; // todo find a name bool m_bIsPlaying[MISSION_AUDIO_SLOTS];
int32 m_nMissionAudioCounter[MISSION_AUDIO_SLOTS]; int32 m_nMissionAudioCounter[MISSION_AUDIO_SLOTS];
bool m_bIsPlayed[MISSION_AUDIO_SLOTS]; bool m_bIsPlayed[MISSION_AUDIO_SLOTS];
bool m_bIsMobile[MISSION_AUDIO_SLOTS]; bool m_bIsMobile[MISSION_AUDIO_SLOTS];