1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-26 18:15:27 +00:00

Enable Stinger

This commit is contained in:
eray orçunus 2020-09-01 21:10:35 +03:00
parent 0640ec7f5a
commit 16e10d788a
4 changed files with 48 additions and 16 deletions

View file

@ -51,6 +51,7 @@ CStinger::Init(CPed *pPed)
}
bIsDeployed = true;
m_vPos = pPed->GetPosition();
m_vPos.z -= 1.0f;
m_fMax_Z = Atan2(-pPed->GetForward().x, pPed->GetForward().y) + HALFPI;
for (i = 0; i < NUM_STINGER_SEGMENTS; i++) {
@ -61,7 +62,7 @@ CStinger::Init(CPed *pPed)
CVector2D fwd2d(pPed->GetForward().x, pPed->GetForward().y);
for (i = 0; i < ARRAY_SIZE(m_vPositions); i++)
m_vPositions[i] = fwd2d * Sin(DEGTORAD(i));
m_vPositions[i] = fwd2d * 1.8f * Sin(DEGTORAD(i));
m_nSpikeState = STINGERSTATE_NONE;
m_nTimeOfDeploy = CTimer::GetTimeInMilliseconds();

View file

@ -11,16 +11,17 @@ public:
#define NUM_STINGER_SEGMENTS (12)
enum {
STINGERSTATE_NONE = 0,
STINGERSTATE_DEPLOYING,
STINGERSTATE_DEPLOYED,
STINGERSTATE_UNDEPLOYING,
STINGERSTATE_REMOVE,
};
class CStinger
{
enum {
STINGERSTATE_NONE = 0,
STINGERSTATE_DEPLOYING,
STINGERSTATE_DEPLOYED,
STINGERSTATE_UNDEPLOYING,
STINGERSTATE_REMOVE,
};
public:
bool bIsDeployed;
uint32 m_nTimeOfDeploy;
CVector m_vPos;
@ -30,7 +31,6 @@ class CStinger
CStingerSegment *pSpikes[NUM_STINGER_SEGMENTS];
class CPed *pOwner;
uint8 m_nSpikeState;
public:
CStinger();
void Init(CPed *pPed);
void Remove();

View file

@ -95,7 +95,7 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
field_624 = 0;
m_pStinger = new CStinger;
if (m_pPointGunAt)
m_pPointGunAt->CleanUpOldReference((CEntity**)&m_pPointGunAt);
m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
m_pPointGunAt = nil;
}
@ -601,7 +601,7 @@ CCopPed::CopAI(void)
}
}
// --MIAMI: Done except commented things
// --MIAMI: Done
void
CCopPed::ProcessControl(void)
{
@ -611,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;
@ -859,3 +857,35 @@ CCopPed::ProcessHeliSwat(void)
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();
}
}

View file

@ -45,6 +45,7 @@ public:
void ScanForCrimes(void);
void CopAI(void);
void ProcessHeliSwat(void);
void ProcessStingerCop(void);
};
#ifndef PED_SKIN