mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 20:30:02 +00:00
commit
85d845c5ce
|
@ -149,27 +149,58 @@ cAudioManager::PostInitialiseGameSpecificSetup()
|
||||||
m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1);
|
m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1);
|
||||||
if (m_nPoliceChannelEntity >= 0)
|
if (m_nPoliceChannelEntity >= 0)
|
||||||
SetEntityStatus(m_nPoliceChannelEntity, 1);
|
SetEntityStatus(m_nPoliceChannelEntity, 1);
|
||||||
|
#ifdef GTA_BRIDGE
|
||||||
m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void *)1);
|
m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void*)1);
|
||||||
if (m_nBridgeEntity >= 0)
|
if (m_nBridgeEntity >= 0)
|
||||||
SetEntityStatus(m_nBridgeEntity, 1);
|
SetEntityStatus(m_nBridgeEntity, 1);
|
||||||
|
#endif // GTA_BRIDGE
|
||||||
|
m_nEscalatorEntity = CreateEntity(AUDIOTYPE_ESCALATOR, (void*)1);
|
||||||
|
if (m_nEscalatorEntity >= 0)
|
||||||
|
SetEntityStatus(m_nEscalatorEntity, 1);
|
||||||
|
|
||||||
|
m_nExtraSoundsEntity = CreateEntity(AUDIOTYPE_EXTRA_SOUNDS, (void*)1);
|
||||||
|
if (m_nExtraSoundsEntity >= 0)
|
||||||
|
SetEntityStatus(m_nExtraSoundsEntity, 1);
|
||||||
|
|
||||||
|
|
||||||
|
m_sMissionAudio.m_nSampleIndex[0] = NO_SAMPLE;
|
||||||
|
m_sMissionAudio.m_nLoadingStatus[0] = LOADING_STATUS_NOT_LOADED;
|
||||||
|
m_sMissionAudio.m_nPlayStatus[0] = PLAY_STATUS_STOPPED;
|
||||||
|
m_sMissionAudio.field_22[0] = 0;
|
||||||
|
m_sMissionAudio.m_bIsPlayed[0] = false;
|
||||||
|
m_sMissionAudio.m_bPredefinedProperties[0] = true;
|
||||||
|
m_sMissionAudio.m_nMissionAudioCounter[0] = 0;
|
||||||
|
m_sMissionAudio.m_bIsMobile[0] = false;
|
||||||
|
field_5538 = 127;
|
||||||
|
m_sMissionAudio.m_nSampleIndex[1] = NO_SAMPLE;
|
||||||
|
m_sMissionAudio.m_nLoadingStatus[1] = LOADING_STATUS_NOT_LOADED;
|
||||||
|
m_sMissionAudio.m_nPlayStatus[1] = PLAY_STATUS_STOPPED;
|
||||||
|
m_sMissionAudio.field_22[1] = 0;
|
||||||
|
m_sMissionAudio.m_bIsPlayed[1] = false;
|
||||||
|
m_sMissionAudio.m_bPredefinedProperties[1] = true;
|
||||||
|
m_sMissionAudio.m_nMissionAudioCounter[1] = 0;
|
||||||
|
m_sMissionAudio.m_bIsMobile[1] = false;
|
||||||
|
field_5538 = 127;
|
||||||
|
|
||||||
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
|
|
||||||
m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED;
|
|
||||||
m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED;
|
|
||||||
m_sMissionAudio.field_22 = 0;
|
|
||||||
m_sMissionAudio.m_bIsPlayed = false;
|
|
||||||
m_sMissionAudio.m_bPredefinedProperties = true;
|
|
||||||
m_sMissionAudio.m_nMissionAudioCounter = 0;
|
|
||||||
ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds());
|
ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds());
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
cAudioManager::PreTerminateGameSpecificShutdown()
|
cAudioManager::PreTerminateGameSpecificShutdown()
|
||||||
{
|
{
|
||||||
|
#ifdef GTA_BRIDGE
|
||||||
if (m_nBridgeEntity >= 0) {
|
if (m_nBridgeEntity >= 0) {
|
||||||
DestroyEntity(m_nBridgeEntity);
|
DestroyEntity(m_nBridgeEntity);
|
||||||
m_nBridgeEntity = AEHANDLE_NONE;
|
m_nBridgeEntity = AEHANDLE_NONE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
if (m_nEscalatorEntity >= 0) {
|
||||||
|
DestroyEntity(m_nEscalatorEntity);
|
||||||
|
m_nEscalatorEntity = AEHANDLE_NONE;
|
||||||
|
}
|
||||||
|
if (m_nExtraSoundsEntity >= 0) {
|
||||||
|
DestroyEntity(m_nExtraSoundsEntity);
|
||||||
|
m_nExtraSoundsEntity = AEHANDLE_NONE;
|
||||||
|
}
|
||||||
if (m_nPoliceChannelEntity >= 0) {
|
if (m_nPoliceChannelEntity >= 0) {
|
||||||
DestroyEntity(m_nPoliceChannelEntity);
|
DestroyEntity(m_nPoliceChannelEntity);
|
||||||
m_nPoliceChannelEntity = AEHANDLE_NONE;
|
m_nPoliceChannelEntity = AEHANDLE_NONE;
|
||||||
|
@ -223,7 +254,8 @@ cAudioManager::ResetAudioLogicTimers(uint32 timer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClearMissionAudio();
|
ClearMissionAudio(0);
|
||||||
|
ClearMissionAudio(1);
|
||||||
SampleManager.StopChannel(policeChannel);
|
SampleManager.StopChannel(policeChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5203,7 +5235,7 @@ cAudioManager::ProcessBridgeOneShots()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma region MISSION_AUDIO
|
#pragma region MISSION_AUDIO
|
||||||
bool g_bMissionAudioLoadFailed;
|
bool g_bMissionAudioLoadFailed[MISSION_AUDIO_SLOTS];
|
||||||
|
|
||||||
struct MissionAudioData {
|
struct MissionAudioData {
|
||||||
const char *m_pName;
|
const char *m_pName;
|
||||||
|
@ -5605,77 +5637,104 @@ cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::PreloadMissionAudio(Const char *name)
|
cAudioManager::PreloadMissionAudio(uint8 slot, Const char *name)
|
||||||
{
|
{
|
||||||
if (m_bIsInitialised) {
|
if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS) {
|
||||||
int32 missionAudioSfx = FindMissionAudioSfx(name);
|
int32 missionAudioSfx = FindMissionAudioSfx(name);
|
||||||
if (missionAudioSfx != NO_SAMPLE) {
|
if (missionAudioSfx != NO_SAMPLE) {
|
||||||
m_sMissionAudio.m_nSampleIndex = missionAudioSfx;
|
m_sMissionAudio.m_nSampleIndex[slot] = missionAudioSfx;
|
||||||
m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED;
|
m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_NOT_LOADED;
|
||||||
m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED;
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
|
||||||
m_sMissionAudio.field_22 = 0;
|
m_sMissionAudio.field_22[slot] = 0;
|
||||||
m_sMissionAudio.m_nMissionAudioCounter = m_nTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000;
|
m_sMissionAudio.m_nMissionAudioCounter[slot] = m_nTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000;
|
||||||
m_sMissionAudio.m_nMissionAudioCounter *= 4;
|
m_sMissionAudio.m_nMissionAudioCounter[slot] *= 4;
|
||||||
m_sMissionAudio.m_bIsPlayed = false;
|
m_sMissionAudio.m_bIsPlayed[slot] = false;
|
||||||
m_sMissionAudio.m_bPredefinedProperties = 1;
|
m_sMissionAudio.m_bPredefinedProperties[slot] = true;
|
||||||
g_bMissionAudioLoadFailed = false;
|
g_bMissionAudioLoadFailed[slot] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8
|
uint8
|
||||||
cAudioManager::GetMissionAudioLoadingStatus() const
|
cAudioManager::GetMissionAudioLoadingStatus(uint8 slot) const
|
||||||
{
|
{
|
||||||
if (m_bIsInitialised)
|
if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS)
|
||||||
return m_sMissionAudio.m_nLoadingStatus;
|
return m_sMissionAudio.m_nLoadingStatus[slot];
|
||||||
|
|
||||||
return LOADING_STATUS_LOADED;
|
return LOADING_STATUS_LOADED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::SetMissionAudioLocation(float x, float y, float z)
|
cAudioManager::SetMissionAudioLocation(uint8 slot, float x, float y, float z)
|
||||||
{
|
{
|
||||||
if (m_bIsInitialised) {
|
if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS) {
|
||||||
m_sMissionAudio.m_bPredefinedProperties = false;
|
m_sMissionAudio.m_bPredefinedProperties[slot] = false;
|
||||||
m_sMissionAudio.m_vecPos = CVector(x, y, z);
|
m_sMissionAudio.m_vecPos[slot] = CVector(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::PlayLoadedMissionAudio()
|
cAudioManager::PlayLoadedMissionAudio(uint8 slot)
|
||||||
{
|
{
|
||||||
if (m_bIsInitialised && m_sMissionAudio.m_nSampleIndex != NO_SAMPLE && m_sMissionAudio.m_nLoadingStatus == LOADING_STATUS_LOADED &&
|
if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS && m_sMissionAudio.m_nSampleIndex[slot] != NO_SAMPLE && m_sMissionAudio.m_nLoadingStatus[slot] == LOADING_STATUS_LOADED &&
|
||||||
m_sMissionAudio.m_nPlayStatus == PLAY_STATUS_STOPPED)
|
m_sMissionAudio.m_nPlayStatus[slot] == PLAY_STATUS_STOPPED)
|
||||||
m_sMissionAudio.m_bIsPlayed = true;
|
m_sMissionAudio.m_bIsPlayed[slot] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cAudioManager::IsMissionAudioSampleFinished()
|
cAudioManager::ShouldDuckMissionAudio(uint8 slot) const
|
||||||
{
|
{
|
||||||
if (m_bIsInitialised)
|
if (IsMissionAudioSamplePlaying(slot))
|
||||||
return m_sMissionAudio.m_nPlayStatus == PLAY_STATUS_FINISHED;
|
return m_sMissionAudio.m_nSampleIndex[slot] != STREAMED_SOUND_MISSION_ROK2_01;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static int32 cPretendFrame = 1;
|
bool
|
||||||
|
cAudioManager::IsMissionAudioSamplePlaying(uint8 slot) const
|
||||||
|
{
|
||||||
|
if (m_bIsInitialised) {
|
||||||
|
if (slot < MISSION_AUDIO_SLOTS)
|
||||||
|
return m_sMissionAudio.m_nPlayStatus[slot] == PLAY_STATUS_PLAYING;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
static int32 cPretendFrame[MISSION_AUDIO_SLOTS] = { 1, 1 };
|
||||||
|
|
||||||
return (cPretendFrame++ & 63) == 0;
|
return (cPretendFrame[slot]++ % 64) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
cAudioManager::IsMissionAudioSampleFinished(uint8 slot)
|
||||||
|
{
|
||||||
|
if (m_bIsInitialised) {
|
||||||
|
if (slot < MISSION_AUDIO_SLOTS)
|
||||||
|
return m_sMissionAudio.m_nPlayStatus[slot] == PLAY_STATUS_FINISHED;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32 cPretendFrame[MISSION_AUDIO_SLOTS] = { 1, 1 };
|
||||||
|
|
||||||
|
return (cPretendFrame[slot]++ % 64) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::ClearMissionAudio()
|
cAudioManager::ClearMissionAudio(uint8 slot)
|
||||||
{
|
{
|
||||||
if (m_bIsInitialised) {
|
if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS) {
|
||||||
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
|
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
|
||||||
m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_NOT_LOADED;
|
m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_NOT_LOADED;
|
||||||
m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_STOPPED;
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
|
||||||
m_sMissionAudio.field_22 = 0;
|
m_sMissionAudio.field_22[slot] = 0;
|
||||||
m_sMissionAudio.m_bIsPlayed = false;
|
m_sMissionAudio.m_bIsPlayed[slot] = false;
|
||||||
m_sMissionAudio.m_bPredefinedProperties = true;
|
m_sMissionAudio.m_bPredefinedProperties[slot] = true;
|
||||||
m_sMissionAudio.m_nMissionAudioCounter = 0;
|
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::ProcessMissionAudio()
|
cAudioManager::ProcessMissionAudioSlot(uint8 slot)
|
||||||
{
|
{
|
||||||
float dist;
|
float dist;
|
||||||
uint8 emittingVol;
|
uint8 emittingVol;
|
||||||
|
@ -5683,104 +5742,135 @@ cAudioManager::ProcessMissionAudio()
|
||||||
float distSquared;
|
float distSquared;
|
||||||
CVector vec;
|
CVector vec;
|
||||||
|
|
||||||
static uint8 nCheckPlayingDelay = 0;
|
static uint8 nCheckPlayingDelay[MISSION_AUDIO_SLOTS] = { 0, 0 };
|
||||||
static uint8 nFramesUntilFailedLoad = 0;
|
static uint8 nFramesUntilFailedLoad[MISSION_AUDIO_SLOTS] = { 0, 0 };
|
||||||
static uint8 nFramesForPretendPlaying = 0;
|
static uint8 nFramesForPretendPlaying[MISSION_AUDIO_SLOTS] = { 0, 0 };
|
||||||
|
|
||||||
if (!m_bIsInitialised) return;
|
if (m_sMissionAudio.m_nSampleIndex[slot] == NO_SAMPLE) return;
|
||||||
if (m_sMissionAudio.m_nSampleIndex == NO_SAMPLE) return;
|
|
||||||
|
|
||||||
switch (m_sMissionAudio.m_nLoadingStatus) {
|
switch (m_sMissionAudio.m_nLoadingStatus[slot]) {
|
||||||
case LOADING_STATUS_NOT_LOADED:
|
case LOADING_STATUS_NOT_LOADED:
|
||||||
SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex, 1);
|
SampleManager.PreloadStreamedFile(m_sMissionAudio.m_nSampleIndex[slot], slot + 1);
|
||||||
m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED;
|
m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_LOADED;
|
||||||
nFramesUntilFailedLoad = 0;
|
nFramesUntilFailedLoad[slot] = 0;
|
||||||
break;
|
break;
|
||||||
case LOADING_STATUS_LOADED:
|
case LOADING_STATUS_LOADED:
|
||||||
if (!m_sMissionAudio.m_bIsPlayed)
|
if (!m_sMissionAudio.m_bIsPlayed[slot])
|
||||||
return;
|
return;
|
||||||
if (g_bMissionAudioLoadFailed) {
|
if (g_bMissionAudioLoadFailed[slot]) {
|
||||||
if (m_bTimerJustReset) {
|
if (m_bTimerJustReset) {
|
||||||
ClearMissionAudio();
|
ClearMissionAudio(slot);
|
||||||
SampleManager.StopStreamedFile(1);
|
SampleManager.StopStreamedFile(slot + 1);
|
||||||
nFramesForPretendPlaying = 0;
|
nFramesForPretendPlaying[slot] = 0;
|
||||||
nCheckPlayingDelay = 0;
|
nCheckPlayingDelay[slot] = 0;
|
||||||
nFramesUntilFailedLoad = 0;
|
nFramesUntilFailedLoad[slot] = 0;
|
||||||
} else if (!m_nUserPause) {
|
} else if (!m_nUserPause) {
|
||||||
if (++nFramesForPretendPlaying < 120) {
|
if (++nFramesForPretendPlaying[slot] < 120) {
|
||||||
m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING;
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING;
|
||||||
} else {
|
} else {
|
||||||
m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED;
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED;
|
||||||
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
|
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch (m_sMissionAudio.m_nPlayStatus) {
|
switch (m_sMissionAudio.m_nPlayStatus[slot]) {
|
||||||
case PLAY_STATUS_STOPPED:
|
case PLAY_STATUS_STOPPED:
|
||||||
if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) {
|
if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex[slot])) {
|
||||||
SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex);
|
SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex[slot]);
|
||||||
} else {
|
} else {
|
||||||
if (m_nUserPause)
|
if (m_nUserPause)
|
||||||
SampleManager.PauseStream(1, 1);
|
SampleManager.PauseStream(1, slot + 1);
|
||||||
if (m_sMissionAudio.m_bPredefinedProperties) {
|
if (m_sMissionAudio.m_bPredefinedProperties) {
|
||||||
SampleManager.SetStreamedVolumeAndPan(80, 63, 1, 1);
|
if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL)
|
||||||
|
SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1);
|
||||||
|
else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR)
|
||||||
|
SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1);
|
||||||
|
else
|
||||||
|
SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1);
|
||||||
} else {
|
} else {
|
||||||
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos);
|
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]);
|
||||||
if (distSquared >= SQR(50.0f)) {
|
if (distSquared >= SQR(80.0f)) {
|
||||||
emittingVol = 0;
|
emittingVol = 0;
|
||||||
pan = 63;
|
pan = 63;
|
||||||
} else {
|
} else {
|
||||||
dist = Sqrt(distSquared);
|
emittingVol = 80;
|
||||||
emittingVol = ComputeVolume(80, 50.0f, dist);
|
if (distSquared > 0.0f) {
|
||||||
TranslateEntity(&m_sMissionAudio.m_vecPos, &vec);
|
dist = Sqrt(distSquared);
|
||||||
pan = ComputePan(50.f, &vec);
|
emittingVol = ComputeVolume(80, 80.0f, dist);
|
||||||
|
}
|
||||||
|
TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec);
|
||||||
|
pan = ComputePan(80.f, &vec);
|
||||||
}
|
}
|
||||||
SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, 1);
|
SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1);
|
||||||
}
|
}
|
||||||
SampleManager.StartPreloadedStreamedFile(1);
|
SampleManager.StartPreloadedStreamedFile(slot + 1);
|
||||||
}
|
}
|
||||||
m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_PLAYING;
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING;
|
||||||
nCheckPlayingDelay = 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)
|
||||||
|
m_sMissionAudio.m_bIsMobile[slot] = true;
|
||||||
break;
|
break;
|
||||||
case PLAY_STATUS_PLAYING:
|
case PLAY_STATUS_PLAYING:
|
||||||
if (m_bTimerJustReset) {
|
if (m_bTimerJustReset) {
|
||||||
ClearMissionAudio();
|
ClearMissionAudio(slot);
|
||||||
SampleManager.StopStreamedFile(1);
|
SampleManager.StopStreamedFile(slot + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex)) {
|
if (MissionScriptAudioUsesPoliceChannel(m_sMissionAudio.m_nSampleIndex[slot])) {
|
||||||
if (!m_nUserPause) {
|
if (!m_nUserPause) {
|
||||||
if (nCheckPlayingDelay) {
|
if (nCheckPlayingDelay[slot]) {
|
||||||
--nCheckPlayingDelay;
|
--nCheckPlayingDelay[slot];
|
||||||
} else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED || m_sMissionAudio.m_nMissionAudioCounter-- == 0) {
|
} else if (GetMissionScriptPoliceAudioPlayingStatus() == PLAY_STATUS_FINISHED || m_sMissionAudio.m_nMissionAudioCounter[slot]-- == 0) {
|
||||||
m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED;
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED;
|
||||||
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
|
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
|
||||||
SampleManager.StopStreamedFile(1);
|
SampleManager.StopStreamedFile(slot + 1);
|
||||||
m_sMissionAudio.m_nMissionAudioCounter = 0;
|
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (m_sMissionAudio.field_22) {
|
} else if (m_sMissionAudio.field_22[slot]) {
|
||||||
if (SampleManager.IsStreamPlaying(1) || m_nUserPause || m_nPreviousUserPause) {
|
if (SampleManager.IsStreamPlaying(slot + 1) || m_nUserPause || m_nPreviousUserPause) {
|
||||||
if (m_nUserPause)
|
if (m_nUserPause)
|
||||||
SampleManager.PauseStream(1, 1);
|
SampleManager.PauseStream(1, slot + 1);
|
||||||
else
|
else
|
||||||
SampleManager.PauseStream(0, 1);
|
{
|
||||||
|
SampleManager.PauseStream(0, slot + 1);
|
||||||
|
if (!m_sMissionAudio.m_bPredefinedProperties) {
|
||||||
|
distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]);
|
||||||
|
if (distSquared >= SQR(80.0f)) {
|
||||||
|
emittingVol = 0;
|
||||||
|
pan = 63;
|
||||||
|
} else {
|
||||||
|
emittingVol = 127;
|
||||||
|
if (distSquared > 0.0f) {
|
||||||
|
dist = Sqrt(distSquared);
|
||||||
|
emittingVol = ComputeVolume(127, 80.0f, dist);
|
||||||
|
}
|
||||||
|
TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec);
|
||||||
|
pan = ComputePan(80.f, &vec);
|
||||||
|
}
|
||||||
|
SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_ROK2_01) {
|
||||||
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED;
|
||||||
} else {
|
} else {
|
||||||
m_sMissionAudio.m_nPlayStatus = PLAY_STATUS_FINISHED;
|
m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED;
|
||||||
m_sMissionAudio.m_nSampleIndex = NO_SAMPLE;
|
if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A)
|
||||||
SampleManager.StopStreamedFile(1);
|
m_sMissionAudio.m_bIsMobile[slot] = false;
|
||||||
m_sMissionAudio.m_nMissionAudioCounter = 0;
|
m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE;
|
||||||
|
SampleManager.StopStreamedFile(slot + 1);
|
||||||
|
m_sMissionAudio.m_nMissionAudioCounter[slot] = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_nUserPause)
|
if (m_nUserPause)
|
||||||
break;
|
break;
|
||||||
if (nCheckPlayingDelay--) {
|
if (nCheckPlayingDelay[slot]--) {
|
||||||
if (!SampleManager.IsStreamPlaying(1))
|
if (!SampleManager.IsStreamPlaying(slot + 1))
|
||||||
break;
|
break;
|
||||||
nCheckPlayingDelay = 0;
|
nCheckPlayingDelay[slot] = 0;
|
||||||
}
|
}
|
||||||
m_sMissionAudio.field_22 = 1;
|
m_sMissionAudio.field_22[slot] = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -5788,15 +5878,32 @@ cAudioManager::ProcessMissionAudio()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LOADING_STATUS_FAILED:
|
case LOADING_STATUS_FAILED:
|
||||||
if (++nFramesUntilFailedLoad >= 90) {
|
if (++nFramesUntilFailedLoad[slot] >= 90) {
|
||||||
nFramesForPretendPlaying = 0;
|
nFramesForPretendPlaying[slot] = 0;
|
||||||
g_bMissionAudioLoadFailed = true;
|
g_bMissionAudioLoadFailed[slot] = true;
|
||||||
nFramesUntilFailedLoad = 0;
|
nFramesUntilFailedLoad[slot] = 0;
|
||||||
m_sMissionAudio.m_nLoadingStatus = LOADING_STATUS_LOADED;
|
m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_LOADED;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cAudioManager::ProcessMissionAudio()
|
||||||
|
{
|
||||||
|
if (!m_bIsInitialised) return;
|
||||||
|
|
||||||
|
for (int i = 0; i < MISSION_AUDIO_SLOTS; i++)
|
||||||
|
ProcessMissionAudioSlot(i);
|
||||||
|
|
||||||
|
if (m_sMissionAudio.m_bIsMobile[0] || m_sMissionAudio.m_bIsMobile[1])
|
||||||
|
field_5538 = 64;
|
||||||
|
else if (field_5538 < 127) {
|
||||||
|
field_5538 += 5;
|
||||||
|
if (field_5538 > 127)
|
||||||
|
field_5538 = 127;
|
||||||
|
}
|
||||||
|
}
|
||||||
#pragma endregion All the mission audio stuff
|
#pragma endregion All the mission audio stuff
|
|
@ -257,7 +257,8 @@ cAudioManager::ResetTimers(uint32 time)
|
||||||
m_nActiveSampleQueue = 0;
|
m_nActiveSampleQueue = 0;
|
||||||
}
|
}
|
||||||
ClearActiveSamples();
|
ClearActiveSamples();
|
||||||
ClearMissionAudio();
|
ClearMissionAudio(0);
|
||||||
|
ClearMissionAudio(1);
|
||||||
SampleManager.StopChannel(policeChannel);
|
SampleManager.StopChannel(policeChannel);
|
||||||
SampleManager.SetEffectsFadeVolume(0);
|
SampleManager.SetEffectsFadeVolume(0);
|
||||||
SampleManager.SetMusicFadeVolume(0);
|
SampleManager.SetMusicFadeVolume(0);
|
||||||
|
@ -280,7 +281,7 @@ cAudioManager::DestroyAllGameCreatedEntities()
|
||||||
case AUDIOTYPE_PHYSICAL:
|
case AUDIOTYPE_PHYSICAL:
|
||||||
case AUDIOTYPE_EXPLOSION:
|
case AUDIOTYPE_EXPLOSION:
|
||||||
case AUDIOTYPE_WEATHER:
|
case AUDIOTYPE_WEATHER:
|
||||||
case AUDIOTYPE_CRANE:
|
//case AUDIOTYPE_CRANE:
|
||||||
case AUDIOTYPE_GARAGE:
|
case AUDIOTYPE_GARAGE:
|
||||||
case AUDIOTYPE_FIREHYDRANT:
|
case AUDIOTYPE_FIREHYDRANT:
|
||||||
DestroyEntity(i);
|
DestroyEntity(i);
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
uint8 m_nLoopsRemaining;
|
uint8 m_nLoopsRemaining;
|
||||||
bool m_bRequireReflection; // Used for oneshots
|
bool m_bRequireReflection; // Used for oneshots
|
||||||
uint8 m_nOffset;
|
uint8 m_nOffset;
|
||||||
|
uint8 field_4C;
|
||||||
int32 m_nReleasingVolumeDivider;
|
int32 m_nReleasingVolumeDivider;
|
||||||
bool m_bIsProcessed;
|
bool m_bIsProcessed;
|
||||||
bool m_bLoopEnded;
|
bool m_bLoopEnded;
|
||||||
|
@ -35,7 +36,7 @@ public:
|
||||||
int8 m_nVolumeChange;
|
int8 m_nVolumeChange;
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(tSound, 92);
|
VALIDATE_SIZE(tSound, 96);
|
||||||
|
|
||||||
class CPhysical;
|
class CPhysical;
|
||||||
class CAutomobile;
|
class CAutomobile;
|
||||||
|
@ -95,19 +96,24 @@ VALIDATE_SIZE(cPedComments, 1164);
|
||||||
|
|
||||||
class CEntity;
|
class CEntity;
|
||||||
|
|
||||||
|
#define MISSION_AUDIO_SLOTS (2)
|
||||||
|
|
||||||
|
// So instead of doing cMissionAudio [2] they've added [2] to every field of the struct...
|
||||||
|
// Only someone with a VERY EXTRAORDINARY mind could have come up with that
|
||||||
class cMissionAudio
|
class cMissionAudio
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CVector m_vecPos;
|
CVector m_vecPos[MISSION_AUDIO_SLOTS];
|
||||||
bool m_bPredefinedProperties;
|
bool m_bPredefinedProperties[MISSION_AUDIO_SLOTS];
|
||||||
int32 m_nSampleIndex;
|
int32 m_nSampleIndex[MISSION_AUDIO_SLOTS];
|
||||||
uint8 m_nLoadingStatus;
|
uint8 m_nLoadingStatus[MISSION_AUDIO_SLOTS];
|
||||||
uint8 m_nPlayStatus;
|
uint8 m_nPlayStatus[MISSION_AUDIO_SLOTS];
|
||||||
uint8 field_22; // todo find a name
|
uint8 field_22[MISSION_AUDIO_SLOTS]; // todo find a name
|
||||||
int32 m_nMissionAudioCounter;
|
int32 m_nMissionAudioCounter[MISSION_AUDIO_SLOTS];
|
||||||
bool m_bIsPlayed;
|
bool m_bIsPlayed[MISSION_AUDIO_SLOTS];
|
||||||
|
bool m_bIsMobile[MISSION_AUDIO_SLOTS];
|
||||||
};
|
};
|
||||||
VALIDATE_SIZE(cMissionAudio, 32);
|
VALIDATE_SIZE(cMissionAudio, 0x38);
|
||||||
|
|
||||||
// name made up
|
// name made up
|
||||||
class cAudioScriptObjectManager
|
class cAudioScriptObjectManager
|
||||||
|
@ -188,6 +194,14 @@ public:
|
||||||
CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS];
|
CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS];
|
||||||
float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS];
|
float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS];
|
||||||
cAudioScriptObjectManager m_sAudioScriptObjectManager;
|
cAudioScriptObjectManager m_sAudioScriptObjectManager;
|
||||||
|
|
||||||
|
// miami
|
||||||
|
uint8 field_4B30;
|
||||||
|
uint8 m_bPlayerMood;
|
||||||
|
uint32 field_4B34;
|
||||||
|
uint8 field_rest[4];
|
||||||
|
uint8 field_4B3C;
|
||||||
|
|
||||||
cPedComments m_sPedComments;
|
cPedComments m_sPedComments;
|
||||||
int32 m_nFireAudioEntity;
|
int32 m_nFireAudioEntity;
|
||||||
int32 m_nWaterCannonEntity;
|
int32 m_nWaterCannonEntity;
|
||||||
|
@ -197,13 +211,19 @@ public:
|
||||||
int32 m_nCollisionEntity;
|
int32 m_nCollisionEntity;
|
||||||
cAudioCollisionManager m_sCollisionManager;
|
cAudioCollisionManager m_sCollisionManager;
|
||||||
int32 m_nProjectileEntity;
|
int32 m_nProjectileEntity;
|
||||||
|
#ifdef GTA_BRIDGE
|
||||||
int32 m_nBridgeEntity;
|
int32 m_nBridgeEntity;
|
||||||
|
#endif
|
||||||
|
int32 m_nEscalatorEntity;
|
||||||
|
int32 m_nExtraSoundsEntity;
|
||||||
cMissionAudio m_sMissionAudio;
|
cMissionAudio m_sMissionAudio;
|
||||||
|
uint8 field_5538; // something related to phone dialogues
|
||||||
int32 m_anRandomTable[5];
|
int32 m_anRandomTable[5];
|
||||||
uint8 m_nTimeSpent;
|
uint8 m_nTimeSpent;
|
||||||
uint8 m_nUserPause;
|
uint8 m_nUserPause;
|
||||||
uint8 m_nPreviousUserPause;
|
uint8 m_nPreviousUserPause;
|
||||||
uint32 m_FrameCounter;
|
uint32 m_FrameCounter;
|
||||||
|
uint32 field_5554;
|
||||||
|
|
||||||
cAudioManager();
|
cAudioManager();
|
||||||
~cAudioManager();
|
~cAudioManager();
|
||||||
|
@ -213,7 +233,8 @@ public:
|
||||||
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
|
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
|
||||||
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
|
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
|
||||||
int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; }
|
int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; }
|
||||||
bool IsMissionAudioSamplePlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; }
|
bool IsMissionAudioSamplePlaying(uint8 slot) const;// { return m_sMissionAudio.m_nPlayStatus == 1; }
|
||||||
|
bool ShouldDuckMissionAudio(uint8 slot) const;
|
||||||
|
|
||||||
// "Should" be in alphabetic order, except "getXTalkSfx"
|
// "Should" be in alphabetic order, except "getXTalkSfx"
|
||||||
void AddDetailsToRequestedOrderList(uint8 sample);
|
void AddDetailsToRequestedOrderList(uint8 sample);
|
||||||
|
@ -227,7 +248,7 @@ public:
|
||||||
void CalculateDistance(bool &condition, float dist);
|
void CalculateDistance(bool &condition, float dist);
|
||||||
bool CheckForAnAudioFileOnCD() const;
|
bool CheckForAnAudioFileOnCD() const;
|
||||||
void ClearActiveSamples();
|
void ClearActiveSamples();
|
||||||
void ClearMissionAudio();
|
void ClearMissionAudio(uint8 slot);
|
||||||
void ClearRequestedQueue();
|
void ClearRequestedQueue();
|
||||||
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
|
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
|
||||||
float speedMultiplier) const;
|
float speedMultiplier) const;
|
||||||
|
@ -253,7 +274,7 @@ public:
|
||||||
float GetCollisionRatio(float a, float b, float c, float d) const;
|
float GetCollisionRatio(float a, float b, float c, float d) const;
|
||||||
float GetDistanceSquared(const CVector &v) const;
|
float GetDistanceSquared(const CVector &v) const;
|
||||||
int32 GetJumboTaxiFreq() const;
|
int32 GetJumboTaxiFreq() const;
|
||||||
uint8 GetMissionAudioLoadingStatus() const;
|
uint8 GetMissionAudioLoadingStatus(uint8 slot) const;
|
||||||
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
|
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
|
||||||
uint8 GetNum3DProvidersAvailable() const;
|
uint8 GetNum3DProvidersAvailable() const;
|
||||||
int32 GetPedCommentSfx(CPed *ped, int32 sound);
|
int32 GetPedCommentSfx(CPed *ped, int32 sound);
|
||||||
|
@ -270,12 +291,12 @@ public:
|
||||||
void InitialisePoliceRadioZones();
|
void InitialisePoliceRadioZones();
|
||||||
void InterrogateAudioEntities();
|
void InterrogateAudioEntities();
|
||||||
bool IsAudioInitialised() const;
|
bool IsAudioInitialised() const;
|
||||||
bool IsMissionAudioSampleFinished();
|
bool IsMissionAudioSampleFinished(uint8 slot);
|
||||||
bool IsMP3RadioChannelAvailable() const;
|
bool IsMP3RadioChannelAvailable() const;
|
||||||
|
|
||||||
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
|
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
|
||||||
|
|
||||||
void PlayLoadedMissionAudio();
|
void PlayLoadedMissionAudio(uint8 slot);
|
||||||
void PlayOneShot(int32 index, int16 sound, float vol);
|
void PlayOneShot(int32 index, int16 sound, float vol);
|
||||||
void PlaySuspectLastSeen(float x, float y, float z);
|
void PlaySuspectLastSeen(float x, float y, float z);
|
||||||
void PlayerJustGotInCar() const;
|
void PlayerJustGotInCar() const;
|
||||||
|
@ -283,7 +304,7 @@ public:
|
||||||
void PostInitialiseGameSpecificSetup();
|
void PostInitialiseGameSpecificSetup();
|
||||||
void PostTerminateGameSpecificShutdown();
|
void PostTerminateGameSpecificShutdown();
|
||||||
void PreInitialiseGameSpecificSetup() const;
|
void PreInitialiseGameSpecificSetup() const;
|
||||||
void PreloadMissionAudio(Const char *name);
|
void PreloadMissionAudio(uint8 slot, Const char *name);
|
||||||
void PreTerminateGameSpecificShutdown();
|
void PreTerminateGameSpecificShutdown();
|
||||||
/// processX - main logic of adding new sounds
|
/// processX - main logic of adding new sounds
|
||||||
void ProcessActiveQueues();
|
void ProcessActiveQueues();
|
||||||
|
@ -316,6 +337,7 @@ public:
|
||||||
void ProcessJumboTaxi();
|
void ProcessJumboTaxi();
|
||||||
void ProcessLoopingScriptObject(uint8 sound);
|
void ProcessLoopingScriptObject(uint8 sound);
|
||||||
void ProcessMissionAudio();
|
void ProcessMissionAudio();
|
||||||
|
void ProcessMissionAudioSlot(uint8 slot);
|
||||||
void ProcessModelCarEngine(cVehicleParams *params);
|
void ProcessModelCarEngine(cVehicleParams *params);
|
||||||
void ProcessOneShotScriptObject(uint8 sound);
|
void ProcessOneShotScriptObject(uint8 sound);
|
||||||
void ProcessPed(CPhysical *ped);
|
void ProcessPed(CPhysical *ped);
|
||||||
|
@ -366,7 +388,7 @@ public:
|
||||||
void SetEffectsMasterVolume(uint8 volume) const;
|
void SetEffectsMasterVolume(uint8 volume) const;
|
||||||
void SetEntityStatus(int32 id, uint8 status);
|
void SetEntityStatus(int32 id, uint8 status);
|
||||||
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
|
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
|
||||||
void SetMissionAudioLocation(float x, float y, float z);
|
void SetMissionAudioLocation(uint8 slot, float x, float y, float z);
|
||||||
void SetMissionScriptPoliceAudio(int32 sfx) const;
|
void SetMissionScriptPoliceAudio(int32 sfx) const;
|
||||||
void SetMonoMode(uint8); // todo (mobile)
|
void SetMonoMode(uint8); // todo (mobile)
|
||||||
void SetMusicFadeVol(uint8 volume) const;
|
void SetMusicFadeVol(uint8 volume) const;
|
||||||
|
@ -400,7 +422,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef AUDIO_MSS
|
#ifdef AUDIO_MSS
|
||||||
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern cAudioManager AudioManager;
|
extern cAudioManager AudioManager;
|
||||||
|
|
|
@ -290,39 +290,39 @@ cDMAudio::StopCutSceneMusic(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::PreloadMissionAudio(Const char *missionAudio)
|
cDMAudio::PreloadMissionAudio(uint8 slot, Const char *missionAudio)
|
||||||
{
|
{
|
||||||
AudioManager.PreloadMissionAudio(missionAudio);
|
AudioManager.PreloadMissionAudio(slot, missionAudio);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8
|
uint8
|
||||||
cDMAudio::GetMissionAudioLoadingStatus(void)
|
cDMAudio::GetMissionAudioLoadingStatus(uint8 slot)
|
||||||
{
|
{
|
||||||
return AudioManager.GetMissionAudioLoadingStatus();
|
return AudioManager.GetMissionAudioLoadingStatus(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::SetMissionAudioLocation(float x, float y, float z)
|
cDMAudio::SetMissionAudioLocation(uint8 slot, float x, float y, float z)
|
||||||
{
|
{
|
||||||
AudioManager.SetMissionAudioLocation(x, y, z);
|
AudioManager.SetMissionAudioLocation(slot, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::PlayLoadedMissionAudio(void)
|
cDMAudio::PlayLoadedMissionAudio(uint8 slot)
|
||||||
{
|
{
|
||||||
AudioManager.PlayLoadedMissionAudio();
|
AudioManager.PlayLoadedMissionAudio(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
cDMAudio::IsMissionAudioSampleFinished(void)
|
cDMAudio::IsMissionAudioSampleFinished(uint8 slot)
|
||||||
{
|
{
|
||||||
return AudioManager.IsMissionAudioSampleFinished();
|
return AudioManager.IsMissionAudioSampleFinished(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::ClearMissionAudio(void)
|
cDMAudio::ClearMissionAudio(uint8 slot)
|
||||||
{
|
{
|
||||||
AudioManager.ClearMissionAudio();
|
AudioManager.ClearMissionAudio(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8
|
uint8
|
||||||
|
|
|
@ -76,12 +76,12 @@ public:
|
||||||
void PlayPreloadedCutSceneMusic(void);
|
void PlayPreloadedCutSceneMusic(void);
|
||||||
void StopCutSceneMusic(void);
|
void StopCutSceneMusic(void);
|
||||||
|
|
||||||
void PreloadMissionAudio(Const char *missionAudio);
|
void PreloadMissionAudio(uint8 slot, Const char *missionAudio);
|
||||||
uint8 GetMissionAudioLoadingStatus(void);
|
uint8 GetMissionAudioLoadingStatus(uint8 slot);
|
||||||
void SetMissionAudioLocation(float x, float y, float z);
|
void SetMissionAudioLocation(uint8 slot, float x, float y, float z);
|
||||||
void PlayLoadedMissionAudio(void);
|
void PlayLoadedMissionAudio(uint8 slot);
|
||||||
bool IsMissionAudioSampleFinished(void);
|
bool IsMissionAudioSampleFinished(uint8 slot);
|
||||||
void ClearMissionAudio(void);
|
void ClearMissionAudio(uint8 slot);
|
||||||
|
|
||||||
uint8 GetRadioInCar(void);
|
uint8 GetRadioInCar(void);
|
||||||
void SetRadioInCar(uint32 radio);
|
void SetRadioInCar(uint32 radio);
|
||||||
|
|
|
@ -524,7 +524,7 @@ cMusicManager::ServiceGameMode()
|
||||||
} else if (dist >= 100.0f) {
|
} else if (dist >= 100.0f) {
|
||||||
int8 volume = ((45.0f - (Sqrt(dist) - 10.0f)) / 45.0f * 100.0f);
|
int8 volume = ((45.0f - (Sqrt(dist) - 10.0f)) / 45.0f * 100.0f);
|
||||||
int8 pan;
|
int8 pan;
|
||||||
if (AudioManager.IsMissionAudioSamplePlaying())
|
if (AudioManager.ShouldDuckMissionAudio(0) || AudioManager.ShouldDuckMissionAudio(1))
|
||||||
volume /= 4;
|
volume /= 4;
|
||||||
if (volume != 0) {
|
if (volume != 0) {
|
||||||
CVector trVec;
|
CVector trVec;
|
||||||
|
@ -536,7 +536,7 @@ cMusicManager::ServiceGameMode()
|
||||||
if (gRetuneCounter)
|
if (gRetuneCounter)
|
||||||
volume /= 4;
|
volume /= 4;
|
||||||
SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0);
|
SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0);
|
||||||
} else if (AudioManager.IsMissionAudioSamplePlaying()) {
|
} else if (AudioManager.ShouldDuckMissionAudio(0) || AudioManager.ShouldDuckMissionAudio(1)) {
|
||||||
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
|
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
|
||||||
} else if (gRetuneCounter) {
|
} else if (gRetuneCounter) {
|
||||||
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
|
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
|
||||||
|
@ -544,7 +544,7 @@ cMusicManager::ServiceGameMode()
|
||||||
SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0);
|
SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (AudioManager.IsMissionAudioSamplePlaying()) {
|
} else if (AudioManager.ShouldDuckMissionAudio(0) || AudioManager.ShouldDuckMissionAudio(1)) {
|
||||||
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
|
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
|
||||||
nFramesSinceCutsceneEnded = 0;
|
nFramesSinceCutsceneEnded = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -830,7 +830,7 @@ cMusicManager::ServiceAnnouncement()
|
||||||
|
|
||||||
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
|
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
|
||||||
if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) {
|
if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) {
|
||||||
SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0);
|
SampleManager.SetStreamedVolumeAndPan((AudioManager.IsMissionAudioSamplePlaying(0) || AudioManager.IsMissionAudioSamplePlaying(1)) ? 25 : 100, 63, 0, 0);
|
||||||
m_bAnnouncementInProgress = true;
|
m_bAnnouncementInProgress = true;
|
||||||
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
|
m_nPreviousStreamedSound = m_nCurrentStreamedSound;
|
||||||
m_nCurrentStreamedSound = m_nAnnouncement;
|
m_nCurrentStreamedSound = m_nAnnouncement;
|
||||||
|
@ -903,7 +903,7 @@ cMusicManager::ChangeRadioChannel()
|
||||||
return false;
|
return false;
|
||||||
if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0))
|
if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0))
|
||||||
return false;
|
return false;
|
||||||
SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0);
|
SampleManager.SetStreamedVolumeAndPan((AudioManager.IsMissionAudioSamplePlaying(0) || AudioManager.IsMissionAudioSamplePlaying(1)) ? 25 : 100, 63, 0, 0);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1267,18 +1267,21 @@ enum AudioEntityHandle {
|
||||||
enum eAudioType : int32
|
enum eAudioType : int32
|
||||||
{
|
{
|
||||||
AUDIOTYPE_PHYSICAL = 0,
|
AUDIOTYPE_PHYSICAL = 0,
|
||||||
AUDIOTYPE_EXPLOSION = 1,
|
AUDIOTYPE_EXPLOSION,
|
||||||
AUDIOTYPE_FIRE = 2,
|
AUDIOTYPE_FIRE,
|
||||||
AUDIOTYPE_WEATHER = 3,
|
AUDIOTYPE_WEATHER,
|
||||||
AUDIOTYPE_CRANE = 4,
|
AUDIOTYPE_SCRIPTOBJECT,
|
||||||
AUDIOTYPE_SCRIPTOBJECT = 5,
|
#ifdef GTA_BRIDGE
|
||||||
AUDIOTYPE_BRIDGE = 6,
|
AUDIOTYPE_BRIDGE,
|
||||||
AUDIOTYPE_COLLISION = 7,
|
#endif
|
||||||
AUDIOTYPE_FRONTEND = 8,
|
AUDIOTYPE_COLLISION,
|
||||||
AUDIOTYPE_PROJECTILE = 9,
|
AUDIOTYPE_FRONTEND,
|
||||||
AUDIOTYPE_GARAGE = 10,
|
AUDIOTYPE_PROJECTILE,
|
||||||
AUDIOTYPE_FIREHYDRANT = 11,
|
AUDIOTYPE_GARAGE,
|
||||||
AUDIOTYPE_WATERCANNON = 12,
|
AUDIOTYPE_FIREHYDRANT,
|
||||||
AUDIOTYPE_POLICERADIO = 13,
|
AUDIOTYPE_WATERCANNON,
|
||||||
TOTAL_AUDIO_TYPES = 14,
|
AUDIOTYPE_ESCALATOR,
|
||||||
|
AUDIOTYPE_EXTRA_SOUNDS,
|
||||||
|
AUDIOTYPE_POLICERADIO,
|
||||||
|
TOTAL_AUDIO_TYPES,
|
||||||
};
|
};
|
||||||
|
|
|
@ -105,7 +105,7 @@ enum
|
||||||
#define MAX2DCHANNELS 1
|
#define MAX2DCHANNELS 1
|
||||||
#define CHANNEL2D MAXCHANNELS
|
#define CHANNEL2D MAXCHANNELS
|
||||||
|
|
||||||
#define MAX_STREAMS 2
|
#define MAX_STREAMS 3
|
||||||
|
|
||||||
#define DIGITALRATE 32000
|
#define DIGITALRATE 32000
|
||||||
#define DIGITALBITS 16
|
#define DIGITALBITS 16
|
||||||
|
|
|
@ -193,15 +193,15 @@ CGameLogic::Update()
|
||||||
pPlayerInfo.m_nBustedAudioStatus = BUSTEDAUDIO_LOADING;
|
pPlayerInfo.m_nBustedAudioStatus = BUSTEDAUDIO_LOADING;
|
||||||
char name[12];
|
char name[12];
|
||||||
sprintf(name, pPlayerInfo.m_nCurrentBustedAudio >= 10 ? "bust_%d" : "bust_0%d", pPlayerInfo.m_nCurrentBustedAudio);
|
sprintf(name, pPlayerInfo.m_nCurrentBustedAudio >= 10 ? "bust_%d" : "bust_0%d", pPlayerInfo.m_nCurrentBustedAudio);
|
||||||
DMAudio.ClearMissionAudio(); // TODO(MIAMI): argument is 0
|
DMAudio.ClearMissionAudio(0);
|
||||||
DMAudio.PreloadMissionAudio(name); // TODO(MIAMI): argument is 0
|
DMAudio.PreloadMissionAudio(0, name);
|
||||||
pPlayerInfo.m_nCurrentBustedAudio = pPlayerInfo.m_nCurrentBustedAudio % 28 + 1; // enum? const? TODO
|
pPlayerInfo.m_nCurrentBustedAudio = pPlayerInfo.m_nCurrentBustedAudio % 28 + 1; // enum? const? TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 4000 &&
|
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 4000 &&
|
||||||
pPlayerInfo.m_nBustedAudioStatus == BUSTEDAUDIO_LOADING &&
|
pPlayerInfo.m_nBustedAudioStatus == BUSTEDAUDIO_LOADING &&
|
||||||
DMAudio.GetMissionAudioLoadingStatus() == 1) { // TODO: argument is 0
|
DMAudio.GetMissionAudioLoadingStatus(0) == 1) {
|
||||||
DMAudio.PlayLoadedMissionAudio(); // TODO: argument is 0
|
DMAudio.PlayLoadedMissionAudio(0);
|
||||||
pPlayerInfo.m_nBustedAudioStatus = BUSTEDAUDIO_DONE;
|
pPlayerInfo.m_nBustedAudioStatus = BUSTEDAUDIO_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -318,8 +318,8 @@ void CMissionCleanup::Process()
|
||||||
//CSpecialFX::bLiftCam = false;
|
//CSpecialFX::bLiftCam = false;
|
||||||
//CSpecialFX::bVideoCam = false;
|
//CSpecialFX::bVideoCam = false;
|
||||||
//CTimeCycle::StopExtraColour(0);
|
//CTimeCycle::StopExtraColour(0);
|
||||||
// TODO(MIAMI): change this to loop when it supports parameters
|
for (int i = 0; i < MISSION_AUDIO_SLOTS; i++)
|
||||||
DMAudio.ClearMissionAudio();
|
DMAudio.ClearMissionAudio(i);
|
||||||
CWeather::ReleaseWeather();
|
CWeather::ReleaseWeather();
|
||||||
for (int i = 0; i < NUM_OF_SPECIAL_CHARS; i++)
|
for (int i = 0; i < NUM_OF_SPECIAL_CHARS; i++)
|
||||||
CStreaming::SetMissionDoesntRequireSpecialChar(i);
|
CStreaming::SetMissionDoesntRequireSpecialChar(i);
|
||||||
|
@ -8662,42 +8662,24 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
strncpy(str, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
|
strncpy(str, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
|
||||||
for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++)
|
for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++)
|
||||||
str[i] = tolower(str[i]);
|
str[i] = tolower(str[i]);
|
||||||
static bool bShowed = false;
|
|
||||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||||
if (!bShowed) {
|
DMAudio.PreloadMissionAudio(ScriptParams[0] - 1, str);
|
||||||
debug("LOAD_MISSION_AUDIO not implemented\n");
|
|
||||||
bShowed = true;
|
|
||||||
}
|
|
||||||
//DMAudio.PreloadMissionAudio(str);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_HAS_MISSION_AUDIO_LOADED:
|
case COMMAND_HAS_MISSION_AUDIO_LOADED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
static bool bShowed = false;
|
UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus(ScriptParams[0] - 1) == 1);
|
||||||
if (!bShowed) {
|
|
||||||
debug("HAS_MISSION_AUDIO_LOADED not implemented, default to TRUE\n");
|
|
||||||
bShowed = true;
|
|
||||||
}
|
|
||||||
UpdateCompareFlag(true);
|
|
||||||
//UpdateCompareFlag(DMAudio.GetMissionAudioLoadingStatus() == 1);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_PLAY_MISSION_AUDIO:
|
case COMMAND_PLAY_MISSION_AUDIO:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
debug("PLAY_MISSION_AUDIO doesn't support parameter yet, skipping\n");
|
DMAudio.PlayLoadedMissionAudio(ScriptParams[0] - 1);
|
||||||
//DMAudio.PlayLoadedMissionAudio();
|
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_HAS_MISSION_AUDIO_FINISHED:
|
case COMMAND_HAS_MISSION_AUDIO_FINISHED:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
static bool bShowed = false;
|
UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished(ScriptParams[0] - 1));
|
||||||
if (!bShowed) {
|
|
||||||
debug("HAS_MISSION_AUDIO_FINISHED not implemented, default to TRUE\n");
|
|
||||||
bShowed = true;
|
|
||||||
}
|
|
||||||
UpdateCompareFlag(true);
|
|
||||||
//UpdateCompareFlag(DMAudio.IsMissionAudioSampleFinished());
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING:
|
case COMMAND_GET_CLOSEST_CAR_NODE_WITH_HEADING:
|
||||||
|
@ -8735,12 +8717,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 4);
|
CollectParameters(&m_nIp, 4);
|
||||||
CVector pos = *(CVector*)&ScriptParams[1];
|
CVector pos = *(CVector*)&ScriptParams[1];
|
||||||
static bool bShowed = false;
|
DMAudio.SetMissionAudioLocation(ScriptParams[0] - 1, pos.x, pos.y, pos.z);
|
||||||
if (!bShowed) {
|
|
||||||
debug("SET_MISSION_AUDIO_POSITION not implemented\n");
|
|
||||||
bShowed = true;
|
|
||||||
}
|
|
||||||
//DMAudio.SetMissionAudioLocation(pos.x, pos.y, pos.z);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_ACTIVATE_SAVE_MENU:
|
case COMMAND_ACTIVATE_SAVE_MENU:
|
||||||
|
|
|
@ -126,9 +126,9 @@ enum Config {
|
||||||
|
|
||||||
NUM_SOUNDS_SAMPLES_BANKS = 2,
|
NUM_SOUNDS_SAMPLES_BANKS = 2,
|
||||||
NUM_SOUNDS_SAMPLES_SLOTS = 27,
|
NUM_SOUNDS_SAMPLES_SLOTS = 27,
|
||||||
NUM_AUDIOENTITIES = 200,
|
NUM_AUDIOENTITIES = 250,
|
||||||
|
|
||||||
NUM_AUDIO_REFLECTIONS = 5,
|
NUM_AUDIO_REFLECTIONS = 8,
|
||||||
NUM_SCRIPT_MAX_ENTITIES = 40,
|
NUM_SCRIPT_MAX_ENTITIES = 40,
|
||||||
|
|
||||||
NUM_GARAGE_STORED_CARS = 4,
|
NUM_GARAGE_STORED_CARS = 4,
|
||||||
|
|
|
@ -84,9 +84,6 @@ void CCranes::AddThisOneCrane(CEntity* pEntity)
|
||||||
pCrane->m_nTimeForNextCheck = 0;
|
pCrane->m_nTimeForNextCheck = 0;
|
||||||
pCrane->m_nCraneState = CCrane::IDLE;
|
pCrane->m_nCraneState = CCrane::IDLE;
|
||||||
pCrane->m_bWasMilitaryCrane = false;
|
pCrane->m_bWasMilitaryCrane = false;
|
||||||
pCrane->m_nAudioEntity = DMAudio.CreateEntity(AUDIOTYPE_CRANE, &aCranes[NumCranes]);
|
|
||||||
if (pCrane->m_nAudioEntity >= 0)
|
|
||||||
DMAudio.SetEntityStatus(pCrane->m_nAudioEntity, 1);
|
|
||||||
pCrane->m_bIsTop = (MODELID_CRANE_1 != pEntity->GetModelIndex());
|
pCrane->m_bIsTop = (MODELID_CRANE_1 != pEntity->GetModelIndex());
|
||||||
#if 0
|
#if 0
|
||||||
// Is this used to avoid military crane?
|
// Is this used to avoid military crane?
|
||||||
|
@ -669,11 +666,11 @@ void CCranes::Load(uint8* buf, uint32 size)
|
||||||
if (pCrane->m_pVehiclePickedUp != nil)
|
if (pCrane->m_pVehiclePickedUp != nil)
|
||||||
pCrane->m_pVehiclePickedUp = CPools::GetVehiclePool()->GetSlot((uintptr)pCrane->m_pVehiclePickedUp - 1);
|
pCrane->m_pVehiclePickedUp = CPools::GetVehiclePool()->GetSlot((uintptr)pCrane->m_pVehiclePickedUp - 1);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < NUM_CRANES; i++) {
|
/*for (int i = 0; i < NUM_CRANES; i++) {
|
||||||
aCranes[i].m_nAudioEntity = DMAudio.CreateEntity(AUDIOTYPE_CRANE, &aCranes[i]);
|
aCranes[i].m_nAudioEntity = DMAudio.CreateEntity(AUDIOTYPE_CRANE, &aCranes[i]);
|
||||||
if (aCranes[i].m_nAudioEntity != 0)
|
if (aCranes[i].m_nAudioEntity != 0)
|
||||||
DMAudio.SetEntityStatus(aCranes[i].m_nAudioEntity, 1);
|
DMAudio.SetEntityStatus(aCranes[i].m_nAudioEntity, 1);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
VALIDATESAVEBUF(size);
|
VALIDATESAVEBUF(size);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue