mirror of
https://github.com/halpz/re3.git
synced 2024-12-26 18:15:27 +00:00
Enable Stinger
This commit is contained in:
parent
0640ec7f5a
commit
16e10d788a
|
@ -51,6 +51,7 @@ CStinger::Init(CPed *pPed)
|
||||||
}
|
}
|
||||||
bIsDeployed = true;
|
bIsDeployed = true;
|
||||||
m_vPos = pPed->GetPosition();
|
m_vPos = pPed->GetPosition();
|
||||||
|
m_vPos.z -= 1.0f;
|
||||||
m_fMax_Z = Atan2(-pPed->GetForward().x, pPed->GetForward().y) + HALFPI;
|
m_fMax_Z = Atan2(-pPed->GetForward().x, pPed->GetForward().y) + HALFPI;
|
||||||
|
|
||||||
for (i = 0; i < NUM_STINGER_SEGMENTS; i++) {
|
for (i = 0; i < NUM_STINGER_SEGMENTS; i++) {
|
||||||
|
@ -61,7 +62,7 @@ CStinger::Init(CPed *pPed)
|
||||||
CVector2D fwd2d(pPed->GetForward().x, pPed->GetForward().y);
|
CVector2D fwd2d(pPed->GetForward().x, pPed->GetForward().y);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(m_vPositions); i++)
|
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_nSpikeState = STINGERSTATE_NONE;
|
||||||
m_nTimeOfDeploy = CTimer::GetTimeInMilliseconds();
|
m_nTimeOfDeploy = CTimer::GetTimeInMilliseconds();
|
||||||
|
|
|
@ -11,16 +11,17 @@ public:
|
||||||
|
|
||||||
#define NUM_STINGER_SEGMENTS (12)
|
#define NUM_STINGER_SEGMENTS (12)
|
||||||
|
|
||||||
|
enum {
|
||||||
|
STINGERSTATE_NONE = 0,
|
||||||
|
STINGERSTATE_DEPLOYING,
|
||||||
|
STINGERSTATE_DEPLOYED,
|
||||||
|
STINGERSTATE_UNDEPLOYING,
|
||||||
|
STINGERSTATE_REMOVE,
|
||||||
|
};
|
||||||
|
|
||||||
class CStinger
|
class CStinger
|
||||||
{
|
{
|
||||||
enum {
|
public:
|
||||||
STINGERSTATE_NONE = 0,
|
|
||||||
STINGERSTATE_DEPLOYING,
|
|
||||||
STINGERSTATE_DEPLOYED,
|
|
||||||
STINGERSTATE_UNDEPLOYING,
|
|
||||||
STINGERSTATE_REMOVE,
|
|
||||||
};
|
|
||||||
|
|
||||||
bool bIsDeployed;
|
bool bIsDeployed;
|
||||||
uint32 m_nTimeOfDeploy;
|
uint32 m_nTimeOfDeploy;
|
||||||
CVector m_vPos;
|
CVector m_vPos;
|
||||||
|
@ -30,7 +31,6 @@ class CStinger
|
||||||
CStingerSegment *pSpikes[NUM_STINGER_SEGMENTS];
|
CStingerSegment *pSpikes[NUM_STINGER_SEGMENTS];
|
||||||
class CPed *pOwner;
|
class CPed *pOwner;
|
||||||
uint8 m_nSpikeState;
|
uint8 m_nSpikeState;
|
||||||
public:
|
|
||||||
CStinger();
|
CStinger();
|
||||||
void Init(CPed *pPed);
|
void Init(CPed *pPed);
|
||||||
void Remove();
|
void Remove();
|
||||||
|
|
|
@ -95,7 +95,7 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
|
||||||
field_624 = 0;
|
field_624 = 0;
|
||||||
m_pStinger = new CStinger;
|
m_pStinger = new CStinger;
|
||||||
if (m_pPointGunAt)
|
if (m_pPointGunAt)
|
||||||
m_pPointGunAt->CleanUpOldReference((CEntity**)&m_pPointGunAt);
|
m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
|
||||||
m_pPointGunAt = nil;
|
m_pPointGunAt = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ CCopPed::CopAI(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --MIAMI: Done except commented things
|
// --MIAMI: Done
|
||||||
void
|
void
|
||||||
CCopPed::ProcessControl(void)
|
CCopPed::ProcessControl(void)
|
||||||
{
|
{
|
||||||
|
@ -611,15 +611,13 @@ CCopPed::ProcessControl(void)
|
||||||
CPed::ProcessControl();
|
CPed::ProcessControl();
|
||||||
|
|
||||||
if (m_bThrowsSpikeTrap) {
|
if (m_bThrowsSpikeTrap) {
|
||||||
// TODO(Miami)
|
|
||||||
/*
|
|
||||||
if (CGame::currArea != AREA_MALL)
|
if (CGame::currArea != AREA_MALL)
|
||||||
ProcessStingerCop();
|
ProcessStingerCop();
|
||||||
*/
|
|
||||||
return;
|
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)
|
if (bWasPostponed)
|
||||||
return;
|
return;
|
||||||
|
@ -858,4 +856,36 @@ CCopPed::ProcessHeliSwat(void)
|
||||||
SetInTheAir();
|
SetInTheAir();
|
||||||
bKnockedUpIntoAir = true;
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -45,6 +45,7 @@ public:
|
||||||
void ScanForCrimes(void);
|
void ScanForCrimes(void);
|
||||||
void CopAI(void);
|
void CopAI(void);
|
||||||
void ProcessHeliSwat(void);
|
void ProcessHeliSwat(void);
|
||||||
|
void ProcessStingerCop(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef PED_SKIN
|
#ifndef PED_SKIN
|
||||||
|
|
Loading…
Reference in a new issue