diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-11-19 20:12:20 +0100 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2020-11-19 20:12:20 +0100 |
commit | 9e45feb4fa0a841b1d059bcab8507fd80708d6e7 (patch) | |
tree | 4a26483c7755ef8dd41b4215efb62a27384fd5fd /src/peds/CivilianPed.cpp | |
parent | Merge pull request #822 from aap/master (diff) | |
download | re3-9e45feb4fa0a841b1d059bcab8507fd80708d6e7.tar re3-9e45feb4fa0a841b1d059bcab8507fd80708d6e7.tar.gz re3-9e45feb4fa0a841b1d059bcab8507fd80708d6e7.tar.bz2 re3-9e45feb4fa0a841b1d059bcab8507fd80708d6e7.tar.lz re3-9e45feb4fa0a841b1d059bcab8507fd80708d6e7.tar.xz re3-9e45feb4fa0a841b1d059bcab8507fd80708d6e7.tar.zst re3-9e45feb4fa0a841b1d059bcab8507fd80708d6e7.zip |
Diffstat (limited to '')
-rw-r--r-- | src/peds/CivilianPed.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp index 2d782a73..401d2e67 100644 --- a/src/peds/CivilianPed.cpp +++ b/src/peds/CivilianPed.cpp @@ -424,3 +424,45 @@ CCivilianPed::ProcessControl(void) if (m_moved.Magnitude() > 0.0f) Avoid(); } + +// It's "CPhoneInfo::ProcessNearestFreePhone" in PC IDB but that's not true, someone made it up. +bool +CPed::RunToReportCrime(eCrimeType crimeToReport) +{ +#ifdef PEDS_REPORT_CRIMES_ON_PHONE + if (bRunningToPhone) { + if (!isPhoneAvailable(m_phoneId)) { + m_phoneId = -1; + bIsRunning = false; + ClearSeek(); // clears bRunningToPhone + return false; + } + + return true; + } +#else + // They changed true into false to make this function unusable. So running to phone actually starts but first frame after that cancels it. + if (m_nPedState == PED_SEEK_POS) + return false; +#endif + + CVector pos = GetPosition(); + int phoneId = gPhoneInfo.FindNearestFreePhone(&pos); + + if (phoneId == -1) + return false; + + CPhone *phone = &gPhoneInfo.m_aPhones[phoneId]; +#ifndef PEDS_REPORT_CRIMES_ON_PHONE + if (phone->m_nState != PHONE_STATE_FREE) + return false; +#endif + + bRunningToPhone = true; + SetSeek(phone->m_pEntity->GetMatrix() * -phone->m_pEntity->GetForward(), 1.0f); // original: phone.m_vecPos, 0.3f + SetMoveState(PEDMOVE_RUN); + bIsRunning = true; // not there in original + m_phoneId = phoneId; + m_crimeToReportOnPhone = crimeToReport; + return true; +}
\ No newline at end of file |