summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/CopPed.cpp46
-rw-r--r--src/peds/CopPed.h2
2 files changed, 42 insertions, 6 deletions
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index 6c9eb276..9160319b 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -18,6 +18,7 @@
#include "Camera.h"
#include "PedPlacement.h"
#include "Ropes.h"
+#include "Stinger.h"
CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
{
@@ -92,14 +93,17 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
m_nHassleTimer = 0;
field_61C = 0;
field_624 = 0;
+ m_pStinger = new CStinger;
if (m_pPointGunAt)
- m_pPointGunAt->CleanUpOldReference((CEntity**)&m_pPointGunAt);
+ m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
m_pPointGunAt = nil;
}
CCopPed::~CCopPed()
{
ClearPursuit();
+ m_pStinger->Remove();
+ delete m_pStinger;
}
// --MIAMI: Done
@@ -597,7 +601,7 @@ CCopPed::CopAI(void)
}
}
-// --MIAMI: Done except commented things
+// --MIAMI: Done
void
CCopPed::ProcessControl(void)
{
@@ -607,15 +611,13 @@ CCopPed::ProcessControl(void)
CPed::ProcessControl();
if (m_bThrowsSpikeTrap) {
- // TODO(Miami)
- /*
if (CGame::currArea != AREA_MALL)
ProcessStingerCop();
- */
return;
}
- // TODO(Miami): CStinger::Process
+ if (m_pStinger && m_pStinger->bIsDeployed && m_pStinger->m_nSpikeState == STINGERSTATE_DEPLOYED && CGame::currArea != AREA_MALL)
+ m_pStinger->Process();
if (bWasPostponed)
return;
@@ -854,4 +856,36 @@ CCopPed::ProcessHeliSwat(void)
SetInTheAir();
bKnockedUpIntoAir = true;
}
+}
+
+// --MIAMI: Done
+void
+CCopPed::ProcessStingerCop(void)
+{
+ if (m_pStinger->bIsDeployed || FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike())) {
+ if (m_pStinger->bIsDeployed) {
+ m_pStinger->Process();
+ } else {
+ CVector2D vehDist = GetPosition() - FindPlayerVehicle()->GetPosition();
+ CVector2D dirVehGoing = FindPlayerVehicle()->m_vecMoveSpeed;
+ if (vehDist.MagnitudeSqr() < sq(30.0f)) {
+ if (dirVehGoing.MagnitudeSqr() > 0.0f) {
+ vehDist.Normalise();
+ dirVehGoing.Normalise();
+ if (DotProduct2D(vehDist, dirVehGoing) > 0.8f) {
+ float angle = (CrossProduct2D(vehDist, dirVehGoing - vehDist) < 0.0f ?
+ FindPlayerVehicle()->GetForward().Heading() - HALFPI :
+ HALFPI + FindPlayerVehicle()->GetForward().Heading());
+
+ SetHeading(angle);
+ m_fRotationCur = angle;
+ m_fRotationDest = angle;
+ m_pStinger->Deploy(this);
+ }
+ }
+ }
+ }
+ } else {
+ ClearPursuit();
+ }
} \ No newline at end of file
diff --git a/src/peds/CopPed.h b/src/peds/CopPed.h
index edec145e..190d619e 100644
--- a/src/peds/CopPed.h
+++ b/src/peds/CopPed.h
@@ -30,6 +30,7 @@ public:
uintptr m_nRopeID;
uint32 m_nHassleTimer;
uint32 field_61C;
+ class CStinger *m_pStinger;
int32 field_624;
int8 field_628;
@@ -44,6 +45,7 @@ public:
void ScanForCrimes(void);
void CopAI(void);
void ProcessHeliSwat(void);
+ void ProcessStingerCop(void);
};
#ifndef PED_SKIN