summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-09-27 01:36:49 +0200
committereray orçunus <erayorcunus@gmail.com>2020-09-27 01:36:49 +0200
commita5d6c952a7be243a4c20b6aad47116dce0e51625 (patch)
treedf4dd2067111b7c42038ca6189ac0ae6db11d9d6 /src/control
parentUse enums in aVehicleSettings (diff)
downloadre3-a5d6c952a7be243a4c20b6aad47116dce0e51625.tar
re3-a5d6c952a7be243a4c20b6aad47116dce0e51625.tar.gz
re3-a5d6c952a7be243a4c20b6aad47116dce0e51625.tar.bz2
re3-a5d6c952a7be243a4c20b6aad47116dce0e51625.tar.lz
re3-a5d6c952a7be243a4c20b6aad47116dce0e51625.tar.xz
re3-a5d6c952a7be243a4c20b6aad47116dce0e51625.tar.zst
re3-a5d6c952a7be243a4c20b6aad47116dce0e51625.zip
Diffstat (limited to '')
-rw-r--r--src/control/PathFind.cpp7
-rw-r--r--src/control/PathFind.h1
-rw-r--r--src/control/RoadBlocks.cpp10
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;