summaryrefslogtreecommitdiff
path: root/src/peds/CopPed.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-03 15:57:57 +0200
committeraap <aap@papnet.eu>2020-05-03 16:09:37 +0200
commit702da55ec9d0e8e02df25a26390a113e452676e3 (patch)
tree9c86a1700aa54b929cd1015c9b9aa975a2d75336 /src/peds/CopPed.cpp
parentff4af35292e82e03c7160a3c85e2296655057deb (diff)
implemented most of vice city path system
Diffstat (limited to 'src/peds/CopPed.cpp')
-rw-r--r--src/peds/CopPed.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index 7cea902d..8bfd807f 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -73,7 +73,7 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
// VC also initializes in here, but as nil
#ifdef FIX_BUGS
- m_wRoadblockNode = -1;
+ m_nRoadblockNode = -1;
#endif
}
@@ -305,9 +305,9 @@ CCopPed::CopAI(void)
m_bZoneDisabled = true;
m_bIsDisabledCop = true;
#ifdef FIX_BUGS
- m_wRoadblockNode = -1;
+ m_nRoadblockNode = -1;
#else
- m_wRoadblockNode = 0;
+ m_nRoadblockNode = 0;
#endif
bKindaStayInSamePlace = true;
bIsRunning = false;
@@ -424,9 +424,15 @@ CCopPed::CopAI(void)
// VC checks for != nil compared to buggy behaviour of III. I check for != -1 here.
#ifdef VC_PED_PORTS
float dotProd;
- if (m_wRoadblockNode != -1) {
- CTreadable *roadBlockRoad = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[m_wRoadblockNode]];
+ if (m_nRoadblockNode != -1) {
+#ifndef MIAMI
+ CTreadable *roadBlockRoad = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[m_nRoadblockNode]];
dotProd = DotProduct2D(playerOrHisVeh->GetPosition() - roadBlockRoad->GetPosition(), GetPosition() - roadBlockRoad->GetPosition());
+#else
+ // TODO: check this, i'm only getting this compile here....
+ CPathNode *roadBlockNode = &ThePaths.m_pathNodes[CRoadBlocks::RoadBlockNodes[m_nRoadblockNode]];
+ dotProd = DotProduct2D(playerOrHisVeh->GetPosition() - roadBlockNode->GetPosition(), GetPosition() - roadBlockNode->GetPosition());
+#endif
} else
dotProd = -1.0f;
@@ -437,10 +443,10 @@ CCopPed::CopAI(void)
float copRoadDotProd, targetRoadDotProd;
#else
float copRoadDotProd = 1.0f, targetRoadDotProd = 1.0f;
- if (m_wRoadblockNode != -1)
+ if (m_nRoadblockNode != -1)
#endif
{
- CTreadable* roadBlockRoad = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[m_wRoadblockNode]];
+ CTreadable* roadBlockRoad = ThePaths.m_mapObjects[CRoadBlocks::RoadBlockObjects[m_nRoadblockNode]];
CVector2D roadFwd = roadBlockRoad->GetForward();
copRoadDotProd = DotProduct2D(GetPosition() - roadBlockRoad->GetPosition(), roadFwd);
targetRoadDotProd = DotProduct2D(playerOrHisVeh->GetPosition() - roadBlockRoad->GetPosition(), roadFwd);