This commit is contained in:
Roman Masanin 2020-10-18 23:03:03 +03:00
parent 1e3aabf654
commit 0594ed5b46
3 changed files with 71 additions and 20 deletions

View file

@ -40,6 +40,7 @@
#include "Bike.h" #include "Bike.h"
#include "WindModifiers.h" #include "WindModifiers.h"
#include "Fluff.h" #include "Fluff.h"
#include "Script.h"
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
@ -251,15 +252,14 @@ cAudioManager::ResetAudioLogicTimers(uint32 timer)
void void
cAudioManager::ProcessReverb() const cAudioManager::ProcessReverb() const
{ {
if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
for (uint32 i = 0; i <
#ifdef FIX_BUGS #ifdef FIX_BUGS
channels const uint32 numChannels = channels;
#else #else
28 const uint32 numChannels = 28;
#endif #endif
;
i++) { if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) {
for (uint32 i = 0; i < numChannels; i++) {
if (m_asActiveSamples[i].m_bReverbFlag) if (m_asActiveSamples[i].m_bReverbFlag)
SampleManager.SetChannelReverbFlag(i, 1); SampleManager.SetChannelReverbFlag(i, 1);
} }
@ -297,25 +297,67 @@ CVehicle *cAudioManager::FindVehicleOfPlayer()
return vehicle; return vehicle;
} }
void
cAudioManager::ProcessPlayerMood()
{
CPlayerPed* playerPed;
uint32* lastMisstonPassedTime;
uint32 curTime = CTimer::GetTimeInMilliseconds();
if (m_nPlayerMoodTimer <= curTime) {
playerPed = FindPlayerPed();
if (playerPed != nil) {
#ifdef 0
if (playerPed->m_pWanted->m_nWantedLevel > 3) {
m_nPlayerMood = 2;
return;
}
if (playerPed->m_pWanted->m_nWantedLevel > 1) {
m_nPlayerMood = 1;
return;
}
#endif
if (playerPed->m_pWanted->m_nWantedLevel > 1) {
m_nPlayerMood = (playerPed->m_pWanted->m_nWantedLevel > 3) ? 2 : 1;
return;
}
lastMisstonPassedTime = CTheScripts::GetLastMissionPassedTime();
if (*lastMisstonPassedTime != -1) {
if (curTime < *lastMisstonPassedTime) {
*lastMisstonPassedTime = curTime;
return;
}
if (curTime < *lastMisstonPassedTime + 180000) {
m_nPlayerMood = 3;
return;
}
}
m_nPlayerMood = 0;
}
}
}
void void
cAudioManager::ProcessSpecial() cAudioManager::ProcessSpecial()
{ {
CPlayerPed* playerPed;
if (m_nUserPause) { if (m_nUserPause) {
if (!m_nPreviousUserPause) { if (!m_nPreviousUserPause) {
MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND);
SampleManager.SetEffectsFadeVolume(MAX_VOLUME); SampleManager.SetEffectsFadeVolume(MAX_VOLUME);
SampleManager.SetMusicFadeVolume(MAX_VOLUME); SampleManager.SetMusicFadeVolume(MAX_VOLUME);
} }
} else { } else {
if (m_nPreviousUserPause) { if (!CReplay::IsPlayingBack())
MusicManager.StopFrontEndTrack(); ProcessPlayerMood();
MusicManager.ChangeMusicMode(MUSICMODE_GAME); playerPed = FindPlayerPed();
} if (playerPed != nil) {
CPlayerPed *playerPed = FindPlayerPed(); if (playerPed->m_audioEntityId >= 0 && m_asAudioEntities[playerPed->m_audioEntityId].m_bIsUsed) {
if (playerPed) { if (playerPed->m_nPedState != PED_ENTER_CAR && playerPed->m_nPedState != PED_CARJACK) {
const PedState &state = playerPed->m_nPedState; if(!playerPed->bInVehicle&& CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == nil)
if (state != PED_ENTER_CAR && state != PED_STEAL_CAR && !playerPed->bInVehicle) SampleManager.StopChannel(m_nActiveSamples);
SampleManager.StopChannel(m_nActiveSamples); }
}
} }
} }
} }
@ -3902,7 +3944,7 @@ cAudioManager::ProcessPed(CPhysical *ped)
m_sQueueSample.m_vecPos = ped->GetPosition(); m_sQueueSample.m_vecPos = ped->GetPosition();
// params.m_bDistanceCalculated = false; //params.m_bDistanceCalculated = false;
params.m_pPed = (CPed *)ped; params.m_pPed = (CPed *)ped;
params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
ProcessPedOneShots(&params); ProcessPedOneShots(&params);
@ -6855,6 +6897,12 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
} }
} }
void
cAudioManager::ProcessModelHeliVehicle(cVehicleParams* params)
{
}
void void
cAudioManager::ProcessMissionAudio() cAudioManager::ProcessMissionAudio()
{ {

View file

@ -339,19 +339,21 @@ public:
void ProcessLoopingScriptObject(uint8 sound); // void ProcessLoopingScriptObject(uint8 sound); //
void ProcessMissionAudio(); // void ProcessMissionAudio(); //
void ProcessMissionAudioSlot(uint8 slot); // void ProcessMissionAudioSlot(uint8 slot); //
void ProcessModelHeliVehicle(cVehicleParams* params); //
void ProcessModelVehicle(cVehicleParams *params); // done void ProcessModelVehicle(cVehicleParams *params); // done
void ProcessOneShotScriptObject(uint8 sound); // void ProcessOneShotScriptObject(uint8 sound); //
void ProcessPed(CPhysical *ped); // void ProcessPed(CPhysical *ped); // done
void ProcessPedOneShots(cPedParams *params); // void ProcessPedOneShots(cPedParams *params); //
void ProcessPhysical(int32 id); // done void ProcessPhysical(int32 id); // done
void ProcessPlane(cVehicleParams *params); // done void ProcessPlane(cVehicleParams *params); // done
void ProcessPlayerMood(); // done(need redo pointer)
void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh); // done void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh); // done
void ProcessProjectiles(); // done void ProcessProjectiles(); // done
void ProcessRainOnVehicle(cVehicleParams *params); // done void ProcessRainOnVehicle(cVehicleParams *params); // done
void ProcessReverb() const; // void ProcessReverb() const; // done
bool ProcessReverseGear(cVehicleParams *params); // done bool ProcessReverseGear(cVehicleParams *params); // done
void ProcessScriptObject(int32 id); // done void ProcessScriptObject(int32 id); // done
void ProcessSpecial(); void ProcessSpecial(); // done
#ifdef GTA_TRAIN #ifdef GTA_TRAIN
bool ProcessTrainNoise(cVehicleParams *params); bool ProcessTrainNoise(cVehicleParams *params);
#endif #endif

View file

@ -381,6 +381,7 @@ private:
public: public:
static void RemoveThisPed(CPed* pPed); static void RemoveThisPed(CPed* pPed);
static uint32* GetLastMissionPassedTime() { return &LastMissionPassedTime; }
#ifdef MISSION_SWITCHER #ifdef MISSION_SWITCHER
static void SwitchToMission(int32 mission); static void SwitchToMission(int32 mission);
#endif #endif