1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-10-18 22:11:05 +00:00
This commit is contained in:
Sergeanur 2021-06-24 21:50:09 +03:00
parent 3ebc475494
commit 74867af2e7
10 changed files with 118 additions and 100 deletions

View file

@ -727,22 +727,22 @@ const eSfxSample aEngineSounds[][2] = {
bool8 bPlayerJustEnteredCar; bool8 bPlayerJustEnteredCar;
const bool8 hornPatternsArray[8][44] = { const bool8 hornPatternsArray[8][44] = {
{false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false}, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
{false, false, true, true, true, false, false, false, false, true, true, true, true, false, false, false, false, true, true, true, true, false, {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE,
false, false, false, false, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, false, false}, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE},
{false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, 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, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE},
{false, false, true, true, true, true, true, false, false, false, false, true, true, true, true, false, false, false, false, true, true, true, {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE,
true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, true, true, true, true, true, false, false}, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE},
{false, false, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, false, false, false, {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
{false, false, false, false, false, false, false, false, false, false, true, true, false, false, false, false, true, true, false, false, false, false, {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE,
true, true, true, false, false, false, false, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false}, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
{false, false, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, true, true, {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE,
false, false, false, false, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, false, false}, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE},
{false, false, true, true, true, true, false, false, false, false, true, true, true, true, true, false, false, false, false, true, true, true, {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE,
true, true, true, false, false, false, false, false, false, false, false, false, false, false, false, false, true, true, true, true, false, false} TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE}
}; };
void cAudioManager::ProcessVehicle(CVehicle* veh) void cAudioManager::ProcessVehicle(CVehicle* veh)
@ -1762,6 +1762,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
engineSoundType = aVehicleSettings[params.m_nIndex].m_nBank; engineSoundType = aVehicleSettings[params.m_nIndex].m_nBank;
soundOffset = gBankStartOffset[engineSoundType] - gBankStartOffset[CAR_SFX_BANKS_OFFSET]; soundOffset = gBankStartOffset[engineSoundType] - gBankStartOffset[CAR_SFX_BANKS_OFFSET];
//soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET); //soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET);
noGearBox = FALSE;
switch (engineSoundType) { switch (engineSoundType) {
case SFX_BANK_PONTIAC: case SFX_BANK_PONTIAC:
gearSoundLength = 2526; gearSoundLength = 2526;
@ -1880,7 +1881,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
freq /= 2; freq /= 2;
if (params.m_pVehicle->bIsDrowning) if (params.m_pVehicle->bIsDrowning)
vol /= 4; vol /= 4;
AddPlayerCarSample(vol, freq, aEngineSounds[engineSoundType - CAR_SFX_BANKS_OFFSET][0], SFX_BANK_0, 52, true); AddPlayerCarSample(vol, freq, aEngineSounds[engineSoundType - CAR_SFX_BANKS_OFFSET][0], SFX_BANK_0, 52, TRUE);
CurrentPretendGear = Max(1, currentGear); CurrentPretendGear = Max(1, currentGear);
} }
@ -1915,7 +1916,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh
} }
if (params.m_pVehicle->bIsDrowning) if (params.m_pVehicle->bIsDrowning)
vol /= 4; vol /= 4;
AddPlayerCarSample(vol, freq, aEngineSounds[engineSoundType - CAR_SFX_BANKS_OFFSET][1], SFX_BANK_0, 2, true); AddPlayerCarSample(vol, freq, aEngineSounds[engineSoundType - CAR_SFX_BANKS_OFFSET][1], SFX_BANK_0, 2, TRUE);
} else { } else {
TranslateEntity(&m_sQueueSample.m_vecPos, &pos); TranslateEntity(&m_sQueueSample.m_vecPos, &pos);
if (bAccelSampleStopped) { if (bAccelSampleStopped) {
@ -3224,19 +3225,18 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params)
// m_sQueueSample.m_nCounter = 33; // m_sQueueSample.m_nCounter = 33;
// m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR; // m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR;
// m_sQueueSample.m_nBankIndex = SFX_BANK_0; // m_sQueueSample.m_nBankIndex = SFX_BANK_0;
// m_sQueueSample.m_bIs2D = false; // m_sQueueSample.m_bIs2D = FALSE;
// m_sQueueSample.m_nReleasingVolumeModificator = 5; // m_sQueueSample.m_nReleasingVolumeModificator = 5;
// m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987; // m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987;
// m_sQueueSample.m_nLoopCount = 0; // m_sQueueSample.m_nLoopCount = 0;
// m_sQueueSample.m_nEmittingVolume = emittingVol; // m_sQueueSample.m_nEmittingVolume = emittingVol;
// m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); // SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex)
// m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
// m_sQueueSample.m_fSpeedMultiplier = 6.0f; // m_sQueueSample.m_fSpeedMultiplier = 6.0f;
// m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; // m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
// m_sQueueSample.m_bReleasingSoundFlag = false; // m_sQueueSample.m_bReleasingSoundFlag = FALSE;
// m_sQueueSample.m_nReleasingVolumeDivider = 3; // m_sQueueSample.m_nReleasingVolumeDivider = 3;
// m_sQueueSample.m_bReverbFlag = true; // m_sQueueSample.m_bReverbFlag = TRUE;
// m_sQueueSample.m_bRequireReflection = false; // m_sQueueSample.m_bRequireReflection = FALSE;
// AddSampleToRequestedQueue(); // AddSampleToRequestedQueue();
// } // }
//} //}
@ -7776,7 +7776,7 @@ cAudioManager::GetGenericFemaleTalkSfx(CPed *ped, int16 sound)
{ {
return NO_SAMPLE; return NO_SAMPLE;
//uint32 sfx; //uint32 sfx;
//m_bGenericSfx = true; //m_bGenericSfx = TRUE;
//switch(sound) { //switch(sound) {
//case SOUND_PED_DEATH: GetPhrase(sfx, ped->m_lastComment, SFX_GENERIC_FEMALE_DEATH_1, 22); break; //case SOUND_PED_DEATH: GetPhrase(sfx, ped->m_lastComment, SFX_GENERIC_FEMALE_DEATH_1, 22); break;
//case SOUND_PED_BULLET_HIT: //case SOUND_PED_BULLET_HIT:
@ -8137,17 +8137,16 @@ cAudioManager::ProcessExtraSounds()
// m_sQueueSample.m_nSampleIndex = SFX_ARCADE; // m_sQueueSample.m_nSampleIndex = SFX_ARCADE;
// m_sQueueSample.m_nBankIndex = SFX_BANK_0; // m_sQueueSample.m_nBankIndex = SFX_BANK_0;
// m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARCADE); // m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARCADE);
// m_sQueueSample.m_bIs2D = false; // m_sQueueSample.m_bIs2D = FALSE;
// m_sQueueSample.m_nLoopCount = 0; // m_sQueueSample.m_nLoopCount = 0;
// m_sQueueSample.m_bReleasingSoundFlag = false; // m_sQueueSample.m_bReleasingSoundFlag = FALSE;
// m_sQueueSample.m_nReleasingVolumeModificator = 4; // m_sQueueSample.m_nReleasingVolumeModificator = 4;
// m_sQueueSample.m_fSpeedMultiplier = 3.0f; // m_sQueueSample.m_fSpeedMultiplier = 3.0f;
// m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; // m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME;
// m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_ARCADE); // SET_LOOP_OFFSETS(SFX_ARCADE)
// m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_ARCADE); // m_sQueueSample.m_bReverbFlag = TRUE;
// m_sQueueSample.m_bReverbFlag = true;
// m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; // m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
// m_sQueueSample.m_bRequireReflection = false; // m_sQueueSample.m_bRequireReflection = FALSE;
// m_sQueueSample.m_nReleasingVolumeDivider = 3; // m_sQueueSample.m_nReleasingVolumeDivider = 3;
// AddSampleToRequestedQueue(); // AddSampleToRequestedQueue();
// } // }
@ -8304,8 +8303,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
// m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PHONE_RING); // m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PHONE_RING);
// m_sQueueSample.m_nReleasingVolumeModificator = 1; // m_sQueueSample.m_nReleasingVolumeModificator = 1;
// m_sQueueSample.m_fSpeedMultiplier = 2.0f; // m_sQueueSample.m_fSpeedMultiplier = 2.0f;
// m_sQueueSample.m_bIs2D = false; // m_sQueueSample.m_bIs2D = FALSE;
// m_sQueueSample.m_bRequireReflection = false; // m_sQueueSample.m_bRequireReflection = FALSE;
// break; // break;
case SCRIPT_SOUND_GLASS_BREAK_L: case SCRIPT_SOUND_GLASS_BREAK_L:
m_sQueueSample.m_fSoundIntensity = 60.0f; m_sQueueSample.m_fSoundIntensity = 60.0f;
@ -8905,15 +8904,15 @@ cAudioManager::ProcessFrontEnd()
radioDial = m_sQueueSample.m_nSampleIndex; radioDial = m_sQueueSample.m_nSampleIndex;
break; break;
case SOUND_FRONTEND_HIGHLIGHT_OPTION: case SOUND_FRONTEND_HIGHLIGHT_OPTION:
//stereo = true; //stereo = TRUE;
m_sQueueSample.m_nSampleIndex = SFX_FE_HIGHLIGHT; m_sQueueSample.m_nSampleIndex = SFX_FE_HIGHLIGHT;
break; break;
case SOUND_FRONTEND_ENTER_OR_ADJUST: case SOUND_FRONTEND_ENTER_OR_ADJUST:
//stereo = true; //stereo = TRUE;
m_sQueueSample.m_nSampleIndex = SFX_FE_SELECT; m_sQueueSample.m_nSampleIndex = SFX_FE_SELECT;
break; break;
case SOUND_FRONTEND_BACK: case SOUND_FRONTEND_BACK:
//stereo = true; //stereo = TRUE;
m_sQueueSample.m_nSampleIndex = SFX_FE_BACK; m_sQueueSample.m_nSampleIndex = SFX_FE_BACK;
break; break;
case SOUND_FRONTEND_FAIL: case SOUND_FRONTEND_FAIL:
@ -11381,7 +11380,7 @@ cAudioManager::ClearMissionAudio(uint8 slot)
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
m_sMissionAudio.m_bIsMobile[slot] = FALSE; m_sMissionAudio.m_bIsMobile[slot] = FALSE;
//SampleManager.StopStreamedFile(slot + 1); //SampleManager.StopStreamedFile(slot + 1);
SampleManager.StopChannel(slot + 29); SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1);
} }
} }
@ -11404,8 +11403,8 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
case LOADING_STATUS_NOT_LOADED: case LOADING_STATUS_NOT_LOADED:
//SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex[slot], slot + 1); //SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex[slot], slot + 1);
SampleManager.LoadPedComment(m_sMissionAudio.m_nSampleIndex[slot]); SampleManager.LoadPedComment(m_sMissionAudio.m_nSampleIndex[slot]);
SampleManager.InitialiseChannel(slot + 29, m_sMissionAudio.m_nSampleIndex[slot], SFX_BANK_PED_COMMENTS); SampleManager.InitialiseChannel(slot + CHANNEL_MISSION_AUDIO_1, m_sMissionAudio.m_nSampleIndex[slot], SFX_BANK_PED_COMMENTS);
SampleManager.SetChannelFrequency(slot + 29, SampleManager.GetSampleBaseFrequency(m_sMissionAudio.m_nSampleIndex[slot])); SampleManager.SetChannelFrequency(slot + CHANNEL_MISSION_AUDIO_1, SampleManager.GetSampleBaseFrequency(m_sMissionAudio.m_nSampleIndex[slot]));
m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_LOADED; m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_LOADED;
nFramesUntilFailedLoad[slot] = 0; nFramesUntilFailedLoad[slot] = 0;
break; break;
@ -11415,7 +11414,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
if (g_bMissionAudioLoadFailed[slot]) { if (g_bMissionAudioLoadFailed[slot]) {
if (m_bTimerJustReset) { if (m_bTimerJustReset) {
ClearMissionAudio(slot); ClearMissionAudio(slot);
SampleManager.StopChannel(slot + 29); SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1);
//SampleManager.StopStreamedFile(slot + 1); //SampleManager.StopStreamedFile(slot + 1);
nFramesForPretendPlaying[slot] = 0; nFramesForPretendPlaying[slot] = 0;
nCheckPlayingDelay[slot] = 0; nCheckPlayingDelay[slot] = 0;
@ -11436,16 +11435,16 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex[slot]); SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex[slot]);
} else { } else {
if(m_nUserPause) if(m_nUserPause)
// SampleManager.PauseStream(1, slot + 1); // SampleManager.PauseStream(TRUE, slot + 1);
SampleManager.StopChannel(slot + 29); SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1);
if (m_sMissionAudio.m_bPredefinedProperties[slot]) { if (m_sMissionAudio.m_bPredefinedProperties[slot]) {
//if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL) //if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL)
// SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1); // SampleManager.SetStreamedVolumeAndPan(80, 0, TRUE, slot + 1);
//else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR) //else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR)
// SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1); // SampleManager.SetStreamedVolumeAndPan(80, 127, TRUE, slot + 1);
//else //else
SampleManager.SetChannelPan(slot + 29, 63); SampleManager.SetChannelPan(slot + CHANNEL_MISSION_AUDIO_1, 63);
SampleManager.SetChannelVolume(slot + 29, 127); SampleManager.SetChannelVolume(slot + CHANNEL_MISSION_AUDIO_1, 127);
//SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1); //SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1);
} else { } else {
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]); distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]);
@ -11461,23 +11460,23 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec); TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec);
pan = ComputePan(80.f, &vec); pan = ComputePan(80.f, &vec);
} }
SampleManager.SetChannelPan(slot + 29, pan); SampleManager.SetChannelPan(slot + CHANNEL_MISSION_AUDIO_1, pan);
SampleManager.SetChannelVolume(slot + 29, emittingVol); SampleManager.SetChannelVolume(slot + CHANNEL_MISSION_AUDIO_1, emittingVol);
//SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1); //SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1);
} }
//SampleManager.StartPreloadedStreamedFile(slot + 1); //SampleManager.StartPreloadedStreamedFile(slot + 1);
SampleManager.StartChannel(slot + 29); SampleManager.StartChannel(slot + CHANNEL_MISSION_AUDIO_1);
} }
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING; m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING;
nCheckPlayingDelay[slot] = 30; nCheckPlayingDelay[slot] = 30;
//if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A) //if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
// m_sMissionAudio.m_bIsMobile[slot] = true; // m_sMissionAudio.m_bIsMobile[slot] = TRUE;
break; break;
case PLAY_STATUS_PLAYING: case PLAY_STATUS_PLAYING:
if (m_bTimerJustReset) { if (m_bTimerJustReset) {
ClearMissionAudio(slot); ClearMissionAudio(slot);
//SampleManager.StopStreamedFile(slot + 1); //SampleManager.StopStreamedFile(slot + 1);
SampleManager.StopChannel(slot + 29); SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1);
break; break;
} }
if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex[slot])) { if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex[slot])) {
@ -11488,20 +11487,20 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED; m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED;
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE; m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
//SampleManager.StopStreamedFile(slot + 1); //SampleManager.StopStreamedFile(slot + 1);
SampleManager.StopChannel(slot + 29); SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1);
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
} }
} }
} else if (m_sMissionAudio.m_bIsPlaying[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(SampleManager.GetChannelUsedFlag(slot + 29) || m_nUserPause || m_nPreviousUserPause) { if(SampleManager.GetChannelUsedFlag(slot + CHANNEL_MISSION_AUDIO_1) || m_nUserPause || m_nPreviousUserPause) {
if(m_nUserPause) if(m_nUserPause)
//SampleManager.PauseStream(1, slot + 1); //SampleManager.PauseStream(TRUE, slot + 1);
SampleManager.StopChannel(slot + 29); SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1);
else else
{ {
//SampleManager.PauseStream(0, slot + 1); //SampleManager.PauseStream(FALSE, slot + 1);
//SampleManager.StartChannel(slot + 29); //SampleManager.StartChannel(slot + CHANNEL_MISSION_AUDIO_1);
if (!m_sMissionAudio.m_bPredefinedProperties[slot]) { if (!m_sMissionAudio.m_bPredefinedProperties[slot]) {
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]); distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]);
if (distSquared >= SQR(80.0f)) { if (distSquared >= SQR(80.0f)) {
@ -11516,8 +11515,8 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec); TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec);
pan = ComputePan(80.f, &vec); pan = ComputePan(80.f, &vec);
} }
SampleManager.SetChannelPan(slot + 29, pan); SampleManager.SetChannelPan(slot + CHANNEL_MISSION_AUDIO_1, pan);
SampleManager.SetChannelVolume(slot + 29, emittingVol); SampleManager.SetChannelVolume(slot + CHANNEL_MISSION_AUDIO_1, emittingVol);
//SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1); //SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1);
} }
} }
@ -11526,10 +11525,10 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
} else { } else {
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED; m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED;
//if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A) //if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
// m_sMissionAudio.m_bIsMobile[slot] = false; // m_sMissionAudio.m_bIsMobile[slot] = FALSE;
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE; m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
//SampleManager.StopStreamedFile(slot + 1); //SampleManager.StopStreamedFile(slot + 1);
SampleManager.StopChannel(slot + 29); SampleManager.StopChannel(slot + CHANNEL_MISSION_AUDIO_1);
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
} }
} else { } else {
@ -11537,7 +11536,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
break; break;
if (nCheckPlayingDelay[slot]--) { if (nCheckPlayingDelay[slot]--) {
//if (!SampleManager.IsStreamPlaying(slot + 1)) //if (!SampleManager.IsStreamPlaying(slot + 1))
if (!SampleManager.GetChannelUsedFlag(slot + 29)) if (!SampleManager.GetChannelUsedFlag(slot + CHANNEL_MISSION_AUDIO_1))
break; break;
nCheckPlayingDelay[slot] = 0; nCheckPlayingDelay[slot] = 0;
} }

View file

@ -273,6 +273,8 @@ cAudioManager::ResetTimers(uint32 time)
ClearMissionAudio(0); ClearMissionAudio(0);
ClearMissionAudio(1); ClearMissionAudio(1);
SampleManager.StopChannel(CHANNEL_POLICE_RADIO); SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
SampleManager.StopChannel(CHANNEL_MISSION_AUDIO_1);
SampleManager.StopChannel(CHANNEL_MISSION_AUDIO_2);
SampleManager.SetEffectsFadeVolume(0); SampleManager.SetEffectsFadeVolume(0);
SampleManager.SetMusicFadeVolume(0); SampleManager.SetMusicFadeVolume(0);
MusicManager.ResetMusicAfterReload(); MusicManager.ResetMusicAfterReload();

View file

@ -471,7 +471,7 @@ public:
void ProcessScriptObject(int32 id); // done void ProcessScriptObject(int32 id); // done
void ProcessSpecial(); // done void ProcessSpecial(); // done
#ifdef GTA_TRAIN #ifdef GTA_TRAIN
bool ProcessTrainNoise(cVehicleParams &params); //done(bcs not exists in VC) bool8 ProcessTrainNoise(cVehicleParams &params); //done(bcs not exists in VC)
#endif #endif
void ProcessVehicle(CVehicle *vehicle); // done void ProcessVehicle(CVehicle *vehicle); // done
bool8 ProcessVehicleDoors(cVehicleParams &params); // done bool8 ProcessVehicleDoors(cVehicleParams &params); // done
@ -549,7 +549,24 @@ public:
#endif #endif
}; };
//#ifdef AUDIO_MSS /*
Manual loop points are not on PS2 so let's have these macros to avoid massive ifndefs.
Setting these manually was pointless anyway since they never change from sdt values.
What were they thinking?
*/
#ifndef GTA_PS2
#define RESET_LOOP_OFFSETS \
m_sQueueSample.m_nLoopStart = 0; \
m_sQueueSample.m_nLoopEnd = -1;
#define SET_LOOP_OFFSETS(sample) \
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(sample); \
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(sample);
#else
#define RESET_LOOP_OFFSETS
#define SET_LOOP_OFFSETS(sample)
#endif
//#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS)
//static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error"); //static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
//#endif //#endif
What were they thinking? What were they thinking?

View file

@ -1368,7 +1368,7 @@ cMusicManager::UsesPoliceRadio(CVehicle *veh)
bool8 bool8
cMusicManager::UsesTaxiRadio(CVehicle *veh) cMusicManager::UsesTaxiRadio(CVehicle *veh)
{ {
if (veh->GetModelIndex() != MI_CABBIE) return false; if (veh->GetModelIndex() != MI_CABBIE) return FALSE;
return CTheScripts::bPlayerHasMetDebbieHarry; return CTheScripts::bPlayerHasMetDebbieHarry;
} }

View file

@ -141,7 +141,7 @@ enum eAudioType
#ifdef GTA_PS2 #ifdef GTA_PS2
enum enum
{ {
NUM_CHANNELS_GENERIC = 42, NUM_CHANNELS_GENERIC = 40,
CHANNEL_POLICE_RADIO = NUM_CHANNELS_GENERIC, CHANNEL_POLICE_RADIO = NUM_CHANNELS_GENERIC,
CHANNEL_MISSION_AUDIO_1, CHANNEL_MISSION_AUDIO_1,
CHANNEL_MISSION_AUDIO_2, CHANNEL_MISSION_AUDIO_2,
@ -152,11 +152,13 @@ enum
enum enum
{ {
#ifdef PS2_AUDIO_CHANNELS #ifdef PS2_AUDIO_CHANNELS
NUM_CHANNELS_GENERIC = 42, NUM_CHANNELS_GENERIC = 40,
#else #else
NUM_CHANNELS_GENERIC = 27, NUM_CHANNELS_GENERIC = 20,
#endif #endif
CHANNEL_POLICE_RADIO, CHANNEL_POLICE_RADIO,
CHANNEL_MISSION_AUDIO_1,
CHANNEL_MISSION_AUDIO_2,
NUM_CHANNELS NUM_CHANNELS
}; };
#endif #endif

View file

@ -1786,8 +1786,8 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
b2d = TRUE; b2d = TRUE;
break; break;
@ -1817,8 +1817,8 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
b2d = TRUE; b2d = TRUE;
break; break;
@ -1919,8 +1919,8 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
nChannelVolume[nChannel] = vol; nChannelVolume[nChannel] = vol;
@ -1948,8 +1948,8 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
#ifndef FIX_BUGS #ifndef FIX_BUGS
if ( opened_samples[nChannel - MAXCHANNELS] ) // BUG if ( opened_samples[nChannel - MAXCHANNELS] ) // BUG
@ -1971,8 +1971,8 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
b2d = TRUE; b2d = TRUE;
break; break;
@ -1999,8 +1999,8 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
b2d = TRUE; b2d = TRUE;
break; break;
@ -2027,8 +2027,8 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
b2d = TRUE; b2d = TRUE;
break; break;
@ -2055,8 +2055,8 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel)
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
b2d = TRUE; b2d = TRUE;
break; break;
@ -2088,8 +2088,8 @@ cSampleManager::StartChannel(uint32 nChannel)
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
b2d = TRUE; b2d = TRUE;
break; break;
@ -2116,8 +2116,8 @@ cSampleManager::StopChannel(uint32 nChannel)
switch ( nChannel ) switch ( nChannel )
{ {
case CHANNEL_POLICE_RADIO: case CHANNEL_POLICE_RADIO:
case CHANNEL2D+1: case CHANNEL_MISSION_AUDIO_1:
case CHANNEL2D+2: case CHANNEL_MISSION_AUDIO_2:
{ {
b2d = TRUE; b2d = TRUE;
break; break;

View file

@ -215,7 +215,6 @@ add_providers()
static void static void
release_existing() release_existing()
{ {
for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ )
if ( IsFXSupported() ) if ( IsFXSupported() )
{ {
if ( alIsEffect(ALEffect) ) if ( alIsEffect(ALEffect) )
@ -280,7 +279,6 @@ set_new_provider(int index)
//SampleManager.SetSpeakerConfig(speaker_type); //SampleManager.SetSpeakerConfig(speaker_type);
aChannel[CHANNEL2D+i].Init(CHANNEL2D+i, true);
if ( IsFXSupported() ) if ( IsFXSupported() )
{ {
for ( int32 i = 0; i < MAXCHANNELS; i++ ) for ( int32 i = 0; i < MAXCHANNELS; i++ )
@ -1653,7 +1651,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
void void
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume) cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
{ {
ASSERT( nChannel < CHANNEL2D ); ASSERT( nChannel < MAXCHANNELS );
uint32 vol = nVolume; uint32 vol = nVolume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
@ -1674,7 +1672,7 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
void void
cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ) cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ)
{ {
ASSERT( nChannel < CHANNEL2D ); ASSERT( nChannel < MAXCHANNELS );
aChannel[nChannel].SetPosition(-fX, fY, fZ); aChannel[nChannel].SetPosition(-fX, fY, fZ);
} }
@ -1682,17 +1680,17 @@ cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float
void void
cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin) cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
{ {
ASSERT( nChannel < CHANNEL2D ); ASSERT( nChannel < MAXCHANNELS );
aChannel[nChannel].SetDistances(fMax, fMin); aChannel[nChannel].SetDistances(fMax, fMin);
} }
void void
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
{ {
ASSERT(nChannel >= CHANNEL2D ); ASSERT( nChannel >= MAXCHANNELS );
ASSERT( nChannel < NUM_CHANNELS ); ASSERT( nChannel < NUM_CHANNELS );
if(nChannel >= CHANNEL2D) if( nChannel >= CHANNEL_POLICE_RADIO )
{ {
uint32 vol = nVolume; uint32 vol = nVolume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
@ -1714,10 +1712,10 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
void void
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan) cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
{ {
ASSERT(nChannel >= CHANNEL2D); ASSERT( nChannel >= MAXCHANNELS );
ASSERT( nChannel < NUM_CHANNELS ); ASSERT( nChannel < NUM_CHANNELS );
if ( nChannel >= CHANNEL2D ) if ( nChannel >= CHANNEL_POLICE_RADIO )
{ {
aChannel[nChannel].SetPan(nPan); aChannel[nChannel].SetPan(nPan);
} }

View file

@ -2104,7 +2104,7 @@ void CMissionCleanup::Process()
CWorld::Players[0].m_bDriveByAllowed = true; CWorld::Players[0].m_bDriveByAllowed = true;
CPad::GetPad(0)->unk_B4 = 1.0f; CPad::GetPad(0)->unk_B4 = 1.0f;
CPad::GetPad(0)->unk_B8 = 0.5f; CPad::GetPad(0)->unk_B8 = 0.5f;
DMAudio.ShutUpPlayerTalking(0); DMAudio.ShutUpPlayerTalking(FALSE);
CVehicle::bDisableRemoteDetonation = false; CVehicle::bDisableRemoteDetonation = false;
CVehicle::bDisableRemoteDetonationOnContact = false; CVehicle::bDisableRemoteDetonationOnContact = false;
CTheScripts::RiotIntensity = 0; CTheScripts::RiotIntensity = 0;

View file

@ -1396,7 +1396,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, 0); DMAudio.PlayFrontEndTrack(GET_INTEGER_PARAM(0) + STREAMED_SOUND_MISSION_COMPLETED - 1, FALSE);
//DMAudio.SaveAnnouncementsWhenMissionPassedPlayed(); // TODO! //DMAudio.SaveAnnouncementsWhenMissionPassedPlayed(); // TODO!
return 0; return 0;
} }

View file

@ -399,7 +399,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
// Audio // Audio
#define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS #define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS
//#define AUDIO_CACHE // cache sound lengths to speed up the cold boot //#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 43 (PC has 28 originally) #define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 41 (PSP and mobile have 21 originally)
//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds) //#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
//#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