From 0594ed5b4631ed779d946fced1e189c10cc0e5c5 Mon Sep 17 00:00:00 2001 From: Roman Masanin <36927roma@gmail.com> Date: Sun, 18 Oct 2020 23:03:03 +0300 Subject: [PATCH] peds --- src/audio/AudioLogic.cpp | 82 +++++++++++++++++++++++++++++++--------- src/audio/AudioManager.h | 8 ++-- src/control/Script.h | 1 + 3 files changed, 71 insertions(+), 20 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 3712f49b..dcaf4dcb 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -40,6 +40,7 @@ #include "Bike.h" #include "WindModifiers.h" #include "Fluff.h" +#include "Script.h" const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); @@ -251,15 +252,14 @@ cAudioManager::ResetAudioLogicTimers(uint32 timer) void cAudioManager::ProcessReverb() const { - if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) { - for (uint32 i = 0; i < #ifdef FIX_BUGS - channels + const uint32 numChannels = channels; #else - 28 + const uint32 numChannels = 28; #endif - ; - i++) { + + if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) { + for (uint32 i = 0; i < numChannels; i++) { if (m_asActiveSamples[i].m_bReverbFlag) SampleManager.SetChannelReverbFlag(i, 1); } @@ -297,25 +297,67 @@ CVehicle *cAudioManager::FindVehicleOfPlayer() 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 cAudioManager::ProcessSpecial() { + CPlayerPed* playerPed; + if (m_nUserPause) { if (!m_nPreviousUserPause) { - MusicManager.ChangeMusicMode(MUSICMODE_FRONTEND); SampleManager.SetEffectsFadeVolume(MAX_VOLUME); SampleManager.SetMusicFadeVolume(MAX_VOLUME); } } else { - if (m_nPreviousUserPause) { - MusicManager.StopFrontEndTrack(); - MusicManager.ChangeMusicMode(MUSICMODE_GAME); - } - CPlayerPed *playerPed = FindPlayerPed(); - if (playerPed) { - const PedState &state = playerPed->m_nPedState; - if (state != PED_ENTER_CAR && state != PED_STEAL_CAR && !playerPed->bInVehicle) - SampleManager.StopChannel(m_nActiveSamples); + if (!CReplay::IsPlayingBack()) + ProcessPlayerMood(); + playerPed = FindPlayerPed(); + if (playerPed != nil) { + if (playerPed->m_audioEntityId >= 0 && m_asAudioEntities[playerPed->m_audioEntityId].m_bIsUsed) { + if (playerPed->m_nPedState != PED_ENTER_CAR && playerPed->m_nPedState != PED_CARJACK) { + if(!playerPed->bInVehicle&& CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == nil) + SampleManager.StopChannel(m_nActiveSamples); + } + } } } } @@ -3902,7 +3944,7 @@ cAudioManager::ProcessPed(CPhysical *ped) m_sQueueSample.m_vecPos = ped->GetPosition(); - // params.m_bDistanceCalculated = false; + //params.m_bDistanceCalculated = false; params.m_pPed = (CPed *)ped; params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); ProcessPedOneShots(¶ms); @@ -6855,6 +6897,12 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) } } +void +cAudioManager::ProcessModelHeliVehicle(cVehicleParams* params) +{ + +} + void cAudioManager::ProcessMissionAudio() { diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 80607b35..7b2e01ae 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -339,19 +339,21 @@ public: void ProcessLoopingScriptObject(uint8 sound); // void ProcessMissionAudio(); // void ProcessMissionAudioSlot(uint8 slot); // + void ProcessModelHeliVehicle(cVehicleParams* params); // void ProcessModelVehicle(cVehicleParams *params); // done void ProcessOneShotScriptObject(uint8 sound); // - void ProcessPed(CPhysical *ped); // + void ProcessPed(CPhysical *ped); // done void ProcessPedOneShots(cPedParams *params); // void ProcessPhysical(int32 id); // done void ProcessPlane(cVehicleParams *params); // done + void ProcessPlayerMood(); // done(need redo pointer) void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh); // done void ProcessProjectiles(); // done void ProcessRainOnVehicle(cVehicleParams *params); // done - void ProcessReverb() const; // + void ProcessReverb() const; // done bool ProcessReverseGear(cVehicleParams *params); // done void ProcessScriptObject(int32 id); // done - void ProcessSpecial(); + void ProcessSpecial(); // done #ifdef GTA_TRAIN bool ProcessTrainNoise(cVehicleParams *params); #endif diff --git a/src/control/Script.h b/src/control/Script.h index c7218847..ac11f967 100644 --- a/src/control/Script.h +++ b/src/control/Script.h @@ -381,6 +381,7 @@ private: public: static void RemoveThisPed(CPed* pPed); + static uint32* GetLastMissionPassedTime() { return &LastMissionPassedTime; } #ifdef MISSION_SWITCHER static void SwitchToMission(int32 mission); #endif