diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-09-30 14:19:37 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-09-30 14:19:37 +0200 |
commit | 60681884533b79a08ed5574a257df7707d858a4d (patch) | |
tree | 76fd83d4b13d5d7c743acc57801b7b8e4fc4a795 /src/control | |
parent | now fixed properly (diff) | |
parent | Merge pull request #721 from theR4K/miamiUpstream (diff) | |
download | re3-60681884533b79a08ed5574a257df7707d858a4d.tar re3-60681884533b79a08ed5574a257df7707d858a4d.tar.gz re3-60681884533b79a08ed5574a257df7707d858a4d.tar.bz2 re3-60681884533b79a08ed5574a257df7707d858a4d.tar.lz re3-60681884533b79a08ed5574a257df7707d858a4d.tar.xz re3-60681884533b79a08ed5574a257df7707d858a4d.tar.zst re3-60681884533b79a08ed5574a257df7707d858a4d.zip |
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/PathFind.cpp | 7 | ||||
-rw-r--r-- | src/control/PathFind.h | 1 | ||||
-rw-r--r-- | src/control/RoadBlocks.cpp | 10 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp index f8bc2df6..81d87b05 100644 --- a/src/control/PathFind.cpp +++ b/src/control/PathFind.cpp @@ -1869,6 +1869,13 @@ CPathFind::TakeWidthIntoAccountForWandering(CPathNode* nextNode, uint16 random) return CVector(newX, newY, pos.z); } +void +CPathFind::TakeWidthIntoAccountForCoors(CPathNode* node1, CPathNode* node2, uint16 random, float* x, float* y) +{ + *x += (Min(node1->width, node2->width) * ((random % 16) - 7)); + *y += (Min(node1->width, node2->width) * (((random / 16) % 16) - 7)); +} + CPathNode* CPathFind::GetNode(int16 index) { diff --git a/src/control/PathFind.h b/src/control/PathFind.h index 2896237a..013d9d31 100644 --- a/src/control/PathFind.h +++ b/src/control/PathFind.h @@ -255,6 +255,7 @@ public: void Load(uint8 *buf, uint32 size); static CVector TakeWidthIntoAccountForWandering(CPathNode*, uint16); + static void TakeWidthIntoAccountForCoors(CPathNode*, CPathNode*, uint16, float*, float*); CPathNode *GetNode(int16 index); int16 GetIndex(CPathNode *node); diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp index e8630bde..e7831b82 100644 --- a/src/control/RoadBlocks.cpp +++ b/src/control/RoadBlocks.cpp @@ -92,10 +92,16 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType pCopPed->SetIdle(); pCopPed->bKindaStayInSamePlace = true; pCopPed->bNotAllowedToDuck = false; - pCopPed->bCrouchWhenShooting = roadBlockType != 2; + pCopPed->m_nExtendedRangeTimer = CTimer::GetTimeInMilliseconds() + 10000; + pCopPed->m_nRoadblockVeh = pVehicle; + pCopPed->m_nRoadblockVeh->RegisterReference((CEntity**)&pCopPed->m_nRoadblockVeh); + pCopPed->bCrouchWhenShooting = roadBlockType == 2 ? false : true; if (pEntityToAttack) { + if (pCopPed->m_pPointGunAt) + pCopPed->m_pPointGunAt->CleanUpOldReference(&pCopPed->m_pPointGunAt); pCopPed->m_pPointGunAt = pEntityToAttack; - pEntityToAttack->RegisterReference(&pCopPed->m_pPointGunAt); + if (pEntityToAttack) + pEntityToAttack->RegisterReference(&pCopPed->m_pPointGunAt); pCopPed->SetAttack(pEntityToAttack); } pCopPed->m_pMyVehicle = pVehicle; |