summaryrefslogtreecommitdiffstats
path: root/src/peds/Ped.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/peds/Ped.cpp')
-rw-r--r--src/peds/Ped.cpp570
1 files changed, 159 insertions, 411 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index b7623a33..6a3df18b 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -38,8 +38,7 @@
#include "WindModifiers.h"
#include "CutsceneShadow.h"
#include "Clock.h"
-
-// --MIAMI: file done
+#include "Wanted.h"
CPed *gapTempPedList[50];
uint16 gnNumTempPedList;
@@ -61,7 +60,6 @@ void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((
float gfTommyFatness = 1.0f;
-// --MIAMI: Done
CPed::CPed(uint32 pedType) : m_pedIK(this)
{
#ifdef USE_CUTSCENE_SHADOW_FOR_PED
@@ -113,15 +111,15 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_attackTimer = 0;
m_timerUnused = 0;
m_lookTimer = 0;
- m_standardTimer = 0;
+ m_chatTimer = 0;
m_shootTimer = 0;
- m_hitRecoverTimer = 0;
+ m_carJackTimer = 0;
m_duckAndCoverTimer = 0;
m_moved = CVector2D(0.0f, 0.0f);
m_fRotationCur = 0.0f;
m_headingRate = 15.0f;
m_fRotationDest = 0.0f;
- m_vehEnterType = CAR_DOOR_LF;
+ m_vehDoor = CAR_DOOR_LF;
m_walkAroundType = 0;
m_pCurrentPhysSurface = nil;
m_vecOffsetFromPhysSurface = CVector(0.0f, 0.0f, 0.0f);
@@ -264,9 +262,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bVehExitWillBeInstant = false;
bHasAlreadyBeenRecorded = false;
bFallenDown = false;
-#ifdef PED_SKIN
bDontAcceptIKLookAts = false;
-#endif
bReachedAttractorHeadingTarget = false;
bTurnedAroundOnAttractor = false;
#ifdef KANGAROO_CHEAT
@@ -321,7 +317,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bCanGiveUpSunbathing = true;
m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this);
- DMAudio.SetEntityStatus(m_audioEntityId, 1);
+ DMAudio.SetEntityStatus(m_audioEntityId, true);
m_fearFlags = CPedType::GetThreats(m_nPedType);
m_threatEntity = nil;
m_eventOrThreat = CVector2D(0.0f, 0.0f);
@@ -365,16 +361,13 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_vehicleInAccident = nil;
m_attractor = nil;
m_positionInQueue = -1;
-#ifdef PED_SKIN
m_pWeaponModel = nil;
-#endif
m_delayedSoundID = -1;
m_delayedSoundTimer = 0;
CPopulation::UpdatePedCount((ePedType)m_nPedType, false);
m_lastComment = UINT32_MAX;
}
-// --MIAMI: Done
CPed::~CPed(void)
{
#ifdef USE_CUTSCENE_SHADOW_FOR_PED
@@ -385,7 +378,7 @@ CPed::~CPed(void)
GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
CRadar::ClearBlipForEntity(BLIP_CHAR, CPools::GetPedPool()->GetIndex(this));
if (InVehicle()){
- uint8 door_flag = GetCarDoorFlag(m_vehEnterType);
+ uint8 door_flag = GetCarDoorFlag(m_vehDoor);
if (m_pMyVehicle->pDriver == this)
m_pMyVehicle->pDriver = nil;
else {
@@ -411,7 +404,6 @@ CPed::~CPed(void)
DMAudio.DestroyEntity(m_audioEntityId);
}
-// --MIAMI: Done
void
CPed::Initialise(void)
{
@@ -422,7 +414,6 @@ CPed::Initialise(void)
debug("CPed ready\n");
}
-// --MIAMI: Done
void
CPed::SetModelIndex(uint32 mi)
{
@@ -438,8 +429,7 @@ CPed::SetModelIndex(uint32 mi)
if (!CanUseTorsoWhenLooking())
m_pedIK.m_flags |= CPedIK::LOOKAROUND_HEAD_ONLY;
- // This is a mistake by R*, velocity is CVector, whereas m_vecAnimMoveDelta is CVector2D.
- (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = (CVector*) &m_vecAnimMoveDelta;
+ (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity2d = &m_vecAnimMoveDelta;
if(modelInfo->GetHitColModel() == nil)
modelInfo->CreateHitColModelSkinned(GetClump());
@@ -455,21 +445,18 @@ CPed::SetModelIndex(uint32 mi)
#endif
}
-// --MIAMI: Done
void
CPed::SetPedStats(ePedStats pedStat)
{
m_pedStats = CPedStats::ms_apPedStats[pedStat];
}
-// --MIAMI: Done
void
CPed::DeleteRwObject()
{
CEntity::DeleteRwObject();
}
-// --MIAMI: Done
void
CPed::BuildPedLists(void)
{
@@ -545,7 +532,6 @@ CPed::BuildPedLists(void)
}
}
-// --MIAMI: Done
bool
CPed::OurPedCanSeeThisOne(CEntity *target, bool shootablesDoBlock)
{
@@ -567,7 +553,6 @@ CPed::OurPedCanSeeThisOne(CEntity *target, bool shootablesDoBlock)
colpoint, ent, true, false, false, shootablesDoBlock, false, false, false, shootablesDoBlock);
}
-// --MIAMI: Done
// Some kind of binary sort
void
CPed::SortPeds(CPed **list, int min, int max)
@@ -605,14 +590,12 @@ CPed::SortPeds(CPed **list, int min, int max)
SortPeds(list, right, max);
}
-// --MIAMI: Done
void
CPed::SetMoveState(eMoveState state)
{
m_nMoveState = state;
}
-// --MIAMI: Done
void
CPed::SetMoveAnim(void)
{
@@ -634,7 +617,7 @@ CPed::SetMoveAnim(void)
if (!animAssoc) {
animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_FIGHT_IDLE);
if (!animAssoc)
- animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_CROUCHRELOAD);
+ animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_MELEE_IDLE_FIGHTMODE);
if (animAssoc && m_nPedState == PED_FIGHT)
return;
@@ -726,7 +709,6 @@ CPed::SetMoveAnim(void)
}
}
-// --MIAMI: Done
void
CPed::StopNonPartialAnims(void)
{
@@ -738,7 +720,6 @@ CPed::StopNonPartialAnims(void)
}
}
-// --MIAMI: Done
void
CPed::RestartNonPartialAnims(void)
{
@@ -750,7 +731,6 @@ CPed::RestartNonPartialAnims(void)
}
}
-// --MIAMI: Done
void
CPed::SetStoredState(void)
{
@@ -769,7 +749,6 @@ CPed::SetStoredState(void)
}
}
-// --MIAMI: Done
void
CPed::RestorePreviousState(void)
{
@@ -812,8 +791,7 @@ CPed::RestorePreviousState(void)
SetWanderPath(m_nPedState == PED_FOLLOW_PATH ? m_nPathDir : CGeneral::GetRandomNumber() & 7);
break;
default:
- PedState oldState = m_nLastPedState;
- SetPedState(oldState);
+ SetPedState(m_nLastPedState);
SetMoveState((eMoveState) m_nPrevMoveState);
break;
}
@@ -821,7 +799,6 @@ CPed::RestorePreviousState(void)
}
}
-// --MIAMI: Done
uint32
CPed::ScanForThreats(void)
{
@@ -853,14 +830,18 @@ CPed::ScanForThreats(void)
}
}
- CPed *deadPed = nil;
+ CPed *deadPed;
if (fearFlags & PED_FLAG_DEADPEDS && CharCreatedBy != MISSION_CHAR
- && (deadPed = CheckForDeadPeds()) != nil && (deadPed->GetPosition() - ourPos).MagnitudeSqr() < sq(20.0f)) {
+ && (deadPed = CheckForDeadPeds()) != nil && (deadPed->GetPosition() - ourPos).MagnitudeSqr() < sq(20.0f)
+#ifdef FIX_BUGS
+ && !deadPed->bIsInWater
+#endif
+ ) {
m_pEventEntity = deadPed;
m_pEventEntity->RegisterReference((CEntity **) &m_pEventEntity);
return PED_FLAG_DEADPEDS;
} else {
- uint32 flagsOfSomePed = 0;
+ uint32 flagsOfNearPed = 0;
CPed *pedToFearFrom = nil;
bool weSawOurEnemy = false;
@@ -873,10 +854,11 @@ CPed::ScanForThreats(void)
continue;
}
- // BUG: Explained at the same occurence of this bug above. Fixed at the bottom of the function.
- flagsOfSomePed = CPedType::GetFlag(m_nearPeds[i]->m_nPedType);
+ // BUG: Putting this here will result in returning the flags of farthest ped to us, since m_nearPeds is sorted by distance.
+ // Fixed at the bottom of the function.
+ flagsOfNearPed = CPedType::GetFlag(m_nearPeds[i]->m_nPedType);
- if (flagsOfSomePed & fearFlags) {
+ if (flagsOfNearPed & fearFlags) {
if (m_nearPeds[i]->m_fHealth > 0.0f) {
if (OurPedCanSeeThisOne(m_nearPeds[i], !!bIgnoreThreatsBehindObjects)) {
if (m_nearPeds[i]->m_nPedState == PED_ATTACK) {
@@ -944,8 +926,8 @@ CPed::ScanForThreats(void)
if (driver) {
// BUG: Same bug as above. Fixed at the bottom of function.
- flagsOfSomePed = CPedType::GetFlag(driver->m_nPedType);
- if (CPedType::GetFlag(driver->m_nPedType) & fearFlags) {
+ flagsOfNearPed = CPedType::GetFlag(driver->m_nPedType);
+ if (flagsOfNearPed & fearFlags) {
if (driver->m_fHealth > 0.0f && OurPedCanSeeThisOne(nearVeh->pDriver)) {
// FIX: Taken from VC
@@ -968,16 +950,15 @@ CPed::ScanForThreats(void)
#ifdef FIX_BUGS
if (pedToFearFrom)
- flagsOfSomePed = CPedType::GetFlag(((CPed*)m_threatEntity)->m_nPedType);
+ flagsOfNearPed = CPedType::GetFlag(((CPed*)m_threatEntity)->m_nPedType);
else
- flagsOfSomePed = 0;
+ flagsOfNearPed = 0;
#endif
- return flagsOfSomePed;
+ return flagsOfNearPed;
}
}
-// --MIAMI: Done
void
CPed::ScanForDelayedResponseThreats(void)
{
@@ -997,7 +978,6 @@ CPed::ScanForDelayedResponseThreats(void)
m_threatCheckTimer = 0;
}
-// --MIAMI: Done
void
CPed::CheckThreatValidity(void)
{
@@ -1013,7 +993,6 @@ CPed::CheckThreatValidity(void)
m_threatFlags = 0;
}
-// --MIAMI: Done
bool
CPed::CanUseTorsoWhenLooking(void)
{
@@ -1024,7 +1003,6 @@ CPed::CanUseTorsoWhenLooking(void)
return false;
}
-// --MIAMI: Done
void
CPed::SetLookFlag(float direction, bool keepTryingToLook, bool cancelPrevious)
{
@@ -1041,7 +1019,6 @@ CPed::SetLookFlag(float direction, bool keepTryingToLook, bool cancelPrevious)
}
}
-// --MIAMI: Done
void
CPed::SetLookFlag(CEntity *target, bool keepTryingToLook, bool cancelPrevious)
{
@@ -1059,7 +1036,6 @@ CPed::SetLookFlag(CEntity *target, bool keepTryingToLook, bool cancelPrevious)
}
}
-// --MIAMI: Done
void
CPed::ClearLookFlag(void) {
if (bIsLooking) {
@@ -1081,7 +1057,6 @@ CPed::ClearLookFlag(void) {
}
}
-// --MIAMI: Done
void
CPed::MoveHeadToLook(void)
{
@@ -1160,7 +1135,6 @@ CPed::MoveHeadToLook(void)
}
}
-// --MIAMI: Done
void
CPed::RestoreHeadPosition(void)
{
@@ -1174,7 +1148,6 @@ CPed::RestoreHeadPosition(void)
}
}
-// --MIAMI: Done
void
CPed::SetAimFlag(float angle)
{
@@ -1188,13 +1161,12 @@ CPed::SetAimFlag(float angle)
if (bIsDucking)
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
- if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm)
+ if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM))
m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM;
else
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
}
-// --MIAMI: Done
void
CPed::SetAimFlag(CEntity *to)
{
@@ -1211,7 +1183,6 @@ CPed::SetAimFlag(CEntity *to)
m_lookTimer = 0;
}
-// --MIAMI: Done
void
CPed::ClearAimFlag(void)
{
@@ -1226,7 +1197,6 @@ CPed::ClearAimFlag(void)
((CPlayerPed*)this)->m_fFPSMoveHeading = 0.0f;
}
-// --MIAMI: Done
void
CPed::AimGun(void)
{
@@ -1259,7 +1229,6 @@ CPed::AimGun(void)
}
}
-// --MIAMI: Done
void
CPed::RestoreGunPosition(void)
{
@@ -1274,14 +1243,12 @@ CPed::RestoreGunPosition(void)
}
}
-// --MIAMI: Done
bool
CPed::CanWeRunAndFireWithWeapon(void)
{
- return CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm;
+ return CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM);
}
-// --MIAMI: Done
void
CPed::ScanForInterestingStuff(void)
{
@@ -1299,7 +1266,8 @@ CPed::ScanForInterestingStuff(void)
if (LookForInterestingNodes())
return;
- if (m_nPedType == PEDTYPE_CRIMINAL && m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) {
+ if (m_nPedType == PEDTYPE_CRIMINAL && m_carJackTimer < CTimer::GetTimeInMilliseconds()) {
+ // Find a car to steal or a ped to mug if we haven't already decided to steal a car
if (CGeneral::GetRandomNumber() % 100 < 10) {
int mostExpensiveVehAround = -1;
int bestMonetaryValue = 0;
@@ -1322,10 +1290,10 @@ CPed::ScanForInterestingStuff(void)
}
if (bestMonetaryValue > 2000 && mostExpensiveVehAround != -1 && vehicles[mostExpensiveVehAround]) {
SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, vehicles[mostExpensiveVehAround]);
- m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000;
+ m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
return;
}
- m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000;
+ m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
} else if (m_objective != OBJECTIVE_MUG_CHAR && !(CGeneral::GetRandomNumber() & 7)) {
CPed *charToMug = nil;
for (int i = 0; i < m_numNearPeds; ++i) {
@@ -1347,13 +1315,13 @@ CPed::ScanForInterestingStuff(void)
if (charToMug)
SetObjective(OBJECTIVE_MUG_CHAR, charToMug);
- m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000;
+ m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
}
}
if (m_nPedState == PED_WANDER_PATH) {
if (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.5f) {
- if (CTimer::GetTimeInMilliseconds() > m_standardTimer) {
+ if (CTimer::GetTimeInMilliseconds() > m_chatTimer) {
for (int i = 0; i < m_numNearPeds; i ++) {
if (m_nearPeds[i] && m_nearPeds[i]->m_nPedState == PED_WANDER_PATH) {
if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() < 1.8f
@@ -1369,12 +1337,11 @@ CPed::ScanForInterestingStuff(void)
}
}
} else {
- m_standardTimer = CTimer::GetTimeInMilliseconds() + 200;
+ m_chatTimer = CTimer::GetTimeInMilliseconds() + 200;
}
}
}
-// --MIAMI: Done
bool
CPed::WillChat(CPed *stranger)
{
@@ -1400,7 +1367,6 @@ CPed::WillChat(CPed *stranger)
return true;
}
-// --MIAMI: Done
void
CPed::CalculateNewVelocity(void)
{
@@ -1467,7 +1433,7 @@ CPed::CalculateNewVelocity(void)
fightAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_IDLE_TIRED);
if(!fightAssoc)
- fightAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WEAPON_CROUCHRELOAD);
+ fightAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_MELEE_IDLE_FIGHTMODE);
if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc && !bIsDucking) {
LimbOrientation newUpperLegs;
@@ -1492,7 +1458,6 @@ CPed::CalculateNewVelocity(void)
}
}
-// --MIAMI: Done
float
CPed::WorkOutHeadingForMovingFirstPerson(float offset)
{
@@ -1516,7 +1481,6 @@ CPed::WorkOutHeadingForMovingFirstPerson(float offset)
return CGeneral::LimitRadianAngle(offset + angle);
}
-// --MIAMI: Done
void
CPed::UpdatePosition(void)
{
@@ -1584,7 +1548,6 @@ CPed::UpdatePosition(void)
m_vecMoveSpeed.y += velocityChange.y;
}
-// --MIAMI: Done
void
CPed::CalculateNewOrientation(void)
{
@@ -1594,7 +1557,6 @@ CPed::CalculateNewOrientation(void)
SetHeading(m_fRotationCur);
}
-// --MIAMI: Done
void
CPed::ClearAll(void)
{
@@ -1602,7 +1564,7 @@ CPed::ClearAll(void)
return;
SetPedState(PED_NONE);
- m_nMoveState = PEDMOVE_NONE;
+ SetMoveState(PEDMOVE_NONE);
m_pSeekTarget = nil;
m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f);
m_fleeFromPos = CVector2D(0.0f, 0.0f);
@@ -1618,7 +1580,6 @@ CPed::ClearAll(void)
m_pCollidingEntity = nil;
}
-// --MIAMI: Done
void
CPed::ProcessBuoyancy(void)
{
@@ -1737,7 +1698,6 @@ CPed::ProcessBuoyancy(void)
bTouchingWater = false;
}
-// --MIAMI: Done?
void
CPed::ProcessControl(void)
{
@@ -1771,11 +1731,7 @@ CPed::ProcessControl(void)
if (m_nPedState != PED_ARRESTED) {
if (m_nPedState == PED_DEAD) {
DeadPedMakesTyresBloody();
-#ifndef VC_PED_PORTS
- if (CGame::nastyGame) {
-#else
if (CGame::nastyGame && !bIsInWater) {
-#endif
uint32 remainingBloodyFpTime = CTimer::GetTimeInMilliseconds() - m_bloodyFootprintCountOrDeathTime;
float timeDependentDist;
if (remainingBloodyFpTime >= 2000) {
@@ -2332,11 +2288,7 @@ CPed::ProcessControl(void)
ApplyMoveForce(forceDir);
}
- if ((bIsInTheAir && !DyingOrDead())
-#ifdef VC_PED_PORTS
- || (!bIsStanding && !bWasStanding && m_nPedState == PED_FALL)
-#endif
- ) {
+ if ((bIsInTheAir && !DyingOrDead()) || (!bIsStanding && !bWasStanding && m_nPedState == PED_FALL)) {
if (m_nPedStateTimer > 0 && m_nPedStateTimer <= 1000) {
forceDir = GetPosition() - m_vecHitLastPos;
} else {
@@ -2357,11 +2309,7 @@ CPed::ProcessControl(void)
if (m_nCollisionRecords == 1 && m_aCollisionRecords[0] != nil && m_aCollisionRecords[0]->IsBuilding()
&& m_nPedStateTimer > 50.0f / (2.0f * adjustedTs) && m_nPedStateTimer * 1.0f / 250.0f > Abs(forceDir.z)) {
offsetToCheck.x = -forceDir.y;
-#ifdef VC_PED_PORTS
offsetToCheck.z = 1.0f;
-#else
- offsetToCheck.z = 0.0f;
-#endif
offsetToCheck.y = forceDir.x;
offsetToCheck.Normalise();
@@ -2386,7 +2334,6 @@ CPed::ProcessControl(void)
} else {
obstacleForFlyingOtherDirZ = 501.0f;
}
-#ifdef VC_PED_PORTS
uint8 flyDir = 0;
float feetZ = GetPosition().z - FEET_OFFSET;
if ((obstacleForFlyingZ <= feetZ || obstacleForFlyingOtherDirZ >= 500.0f) && (obstacleForFlyingZ <= feetZ || obstacleForFlyingOtherDirZ <= feetZ)) {
@@ -2403,7 +2350,6 @@ CPed::ProcessControl(void)
SetLanding();
bIsStanding = true;
}
-#endif
if (obstacleForFlyingZ < obstacleForFlyingOtherDirZ) {
offsetToCheck *= -1.0f;
}
@@ -2424,12 +2370,6 @@ CPed::ProcessControl(void)
}
bIsInTheAir = false;
} else if (m_vecDamageNormal.z > 0.4f) {
-#ifndef VC_PED_PORTS
- forceDir = m_vecDamageNormal;
- forceDir.z = 0.0f;
- forceDir.Normalise();
- ApplyMoveForce(2.0f * forceDir);
-#else
if (m_nPedState == PED_JUMP) {
if (m_nWaitTimer <= 2000) {
if (m_nWaitTimer < 1000)
@@ -2446,7 +2386,6 @@ CPed::ProcessControl(void)
} else {
ApplyMoveForce(-4.0f * forceDir);
}
-#endif
}
} else if ((CTimer::GetFrameCounter() + m_randomSeed % 256 + 3) & 7) {
if (IsPlayer() && m_nPedState != PED_JUMP && pad0->JumpJustDown()) {
@@ -2502,17 +2441,12 @@ CPed::ProcessControl(void)
offsetToCheck.z += 0.5f;
if (CWorld::ProcessVerticalLine(offsetToCheck, GetPosition().z - FEET_OFFSET, foundCol, foundEnt, true, true, false, true, false, false, nil)) {
-#ifdef VC_PED_PORTS
if (!bHeadStuckInCollision || FEET_OFFSET + foundCol.point.z < GetPosition().z) {
GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
GetMatrix().UpdateRW();
if (bHeadStuckInCollision)
bHeadStuckInCollision = false;
}
-#else
- GetMatrix().GetPosition().z = FEET_OFFSET + foundCol.point.z;
- GetMatrix().UpdateRW();
-#endif
SetLanding();
bIsStanding = true;
}
@@ -2614,6 +2548,48 @@ CPed::ProcessControl(void)
if (m_nWaitState != WAITSTATE_FALSE)
Wait();
+#ifdef CANCELLABLE_CAR_ENTER
+ static bool cancelJack = false;
+ if (IsPlayer()) {
+ if (EnteringCar() && m_pVehicleAnim) {
+ CPad *pad = CPad::GetPad(0);
+
+ if (!pad->ArePlayerControlsDisabled()) {
+ int vehAnim = m_pVehicleAnim->animId;
+
+ int16 padWalkX = pad->GetPedWalkLeftRight();
+ int16 padWalkY = pad->GetPedWalkUpDown();
+ if (Abs(padWalkX) > 0.0f || Abs(padWalkY) > 0.0f) {
+ if (vehAnim == ANIM_CAR_OPEN_LHS || vehAnim == ANIM_CAR_OPEN_RHS || vehAnim == ANIM_COACH_OPEN_L || vehAnim == ANIM_COACH_OPEN_R ||
+ vehAnim == ANIM_VAN_OPEN_L || vehAnim == ANIM_VAN_OPEN) {
+
+ if (!m_pMyVehicle->pDriver) {
+ cancelJack = false;
+ bCancelEnteringCar = true;
+ } else
+ cancelJack = true;
+ } else if (vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f) {
+ cancelJack = true;
+ } else if (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS) {
+ bCancelEnteringCar = true;
+ cancelJack = false;
+ }
+ }
+ if (cancelJack && vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f && m_pVehicleAnim->GetTimeLeft() < 0.78f) {
+ cancelJack = false;
+ QuitEnteringCar();
+ RestorePreviousObjective();
+ }
+ if (cancelJack && (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS)) {
+ cancelJack = false;
+ bCancelEnteringCar = true;
+ }
+ }
+ } else
+ cancelJack = false;
+ }
+#endif
+
switch (m_nPedState) {
case PED_IDLE:
Idle();
@@ -2632,83 +2608,9 @@ CPed::ProcessControl(void)
case PED_WANDER_PATH:
WanderPath();
break;
- case PED_SEEK_POS:
- case PED_SEEK_ENTITY:
- case PED_PURSUE:
- case PED_SNIPER_MODE:
- case PED_ROCKET_MODE:
- case PED_DUMMY:
- case PED_FACE_PHONE:
- case PED_MAKE_CALL:
- case PED_MUG:
- case PED_AI_CONTROL:
- case PED_FOLLOW_ROUTE:
- case PED_CPR:
- case PED_SOLICIT:
- case PED_STEP_AWAY:
- case PED_SUN_BATHE:
- case PED_FLASH:
- case PED_JOG:
- case PED_UNKNOWN:
- case PED_STATES_NO_AI:
- case PED_ABSEIL:
- case PED_SIT:
- case PED_JUMP:
- case PED_STAGGER:
- case PED_DIVE_AWAY:
- case PED_STATES_NO_ST:
- case PED_ARREST_PLAYER:
- case PED_PASSENGER:
- case PED_TAXI_PASSENGER:
- case PED_OPEN_DOOR:
- case PED_DEAD:
- case PED_DRAG_FROM_CAR:
- case PED_STEAL_CAR:
- case PED_EXIT_CAR:
- break;
case PED_ENTER_CAR:
case PED_CARJACK:
{
-#ifdef CANCELLABLE_CAR_ENTER
- if (!IsPlayer() || !m_pVehicleAnim)
- break;
-
- CPad *pad = CPad::GetPad(0);
-
- if (pad->ArePlayerControlsDisabled())
- break;
-
- int vehAnim = m_pVehicleAnim->animId;
-
- static bool cancelJack = false;
- int16 padWalkX = pad->GetPedWalkLeftRight();
- int16 padWalkY = pad->GetPedWalkUpDown();
- if (Abs(padWalkX) > 0.0f || Abs(padWalkY) > 0.0f) {
- if (vehAnim == ANIM_CAR_OPEN_LHS || vehAnim == ANIM_CAR_OPEN_RHS || vehAnim == ANIM_COACH_OPEN_L || vehAnim == ANIM_COACH_OPEN_R ||
- vehAnim == ANIM_VAN_OPEN_L || vehAnim == ANIM_VAN_OPEN) {
-
- if (!m_pMyVehicle->pDriver) {
- cancelJack = false;
- bCancelEnteringCar = true;
- } else
- cancelJack = true;
- } else if (vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f) {
- cancelJack = true;
- } else if (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS) {
- bCancelEnteringCar = true;
- cancelJack = false;
- }
- }
- if (cancelJack && vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f && m_pVehicleAnim->GetTimeLeft() < 0.78f) {
- cancelJack = false;
- QuitEnteringCar();
- RestorePreviousObjective();
- }
- if (cancelJack && (vehAnim == ANIM_CAR_PULLOUT_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_LHS || vehAnim == ANIM_CAR_PULLOUT_LOW_RHS || vehAnim == ANIM_CAR_PULLOUT_RHS)) {
- cancelJack = false;
- bCancelEnteringCar = true;
- }
-#endif
break;
}
case PED_FLEE_POS:
@@ -2729,19 +2631,19 @@ CPed::ProcessControl(void)
Flee();
break;
case PED_FOLLOW_PATH:
- CPed::FollowPath();
+ FollowPath();
break;
case PED_PAUSE:
- CPed::Pause();
+ Pause();
break;
case PED_ATTACK:
- CPed::Attack();
+ Attack();
break;
case PED_FIGHT:
- CPed::Fight();
+ Fight();
break;
case PED_CHAT:
- CPed::Chat();
+ Chat();
break;
case PED_AIM_GUN:
if (m_pPointGunAt && m_pPointGunAt->IsPed()
@@ -2936,7 +2838,6 @@ CPed::ProcessControl(void)
ServiceTalking();
}
-// --MIAMI: Done
int32
CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
{
@@ -3142,7 +3043,6 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
return ourCollidedSpheres;
}
-// --MIAMI: Done
static void
particleProduceFootSplash(CPed *ped, CVector const &pos, float size, int times)
{
@@ -3156,7 +3056,6 @@ particleProduceFootSplash(CPed *ped, CVector const &pos, float size, int times)
}
}
-// --MIAMI: Done
static void
particleProduceFootDust(CPed *ped, CVector const &pos, float size, int times)
{
@@ -3183,7 +3082,6 @@ particleProduceFootDust(CPed *ped, CVector const &pos, float size, int times)
}
}
-// --MIAMI: Done
void
CPed::PlayFootSteps(void)
{
@@ -3442,7 +3340,6 @@ CPed::PlayFootSteps(void)
}
}
-// --MIAMI: Done
// Actually GetLocalDirectionTo(Turn/Look)
int
CPed::GetLocalDirection(const CVector2D &posOffset)
@@ -3458,14 +3355,12 @@ CPed::GetLocalDirection(const CVector2D &posOffset)
return direction;
}
-// --MIAMI: Done
bool
CPed::SetDirectionToWalkAroundVehicle(CVehicle* veh)
{
return SetFollowPath(m_vecSeekPos, 0.0f, m_nMoveState, veh, m_pedInObjective, m_nMoveState == PEDMOVE_WALK ? 2000 : 250);
}
-// --MIAMI: Done
void
CPed::SetDirectionToWalkAroundObject(CEntity *obj)
{
@@ -3714,7 +3609,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
if (Abs(angleDiffBtwObjCenterAndForward) >= objTopRightHeading) {
if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) {
if ((angleDiffBtwObjCenterAndForward <= 0.0f || objUpsideDown) && (angleDiffBtwObjCenterAndForward < 0.0f || !objUpsideDown)) {
- if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) {
+ if (goingToEnterCar && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)) {
m_walkAroundType = 0;
} else {
if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) >= 0.0f) {
@@ -3732,7 +3627,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
}
}
} else {
- if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) {
+ if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)) {
m_walkAroundType = 0;
} else {
if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) <= 0.0f) {
@@ -3750,7 +3645,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
}
}
}
- } else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)
+ } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)
|| CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) < 0.0f) {
if (entityOnTopLeftOfObj == 1 || entityOnTopLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) {
m_walkAroundType = 3;
@@ -3758,7 +3653,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} else if (entityOnTopRightOfObj == 1 || entityOnTopRightOfObj && !entityOnTopLeftOfObj && !entityOnBottomLeftOfObj) {
m_walkAroundType = 4;
}
- } else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)
+ } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)
|| CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) > 0.0f) {
if (entityOnBottomLeftOfObj == 1 || entityOnBottomLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) {
m_walkAroundType = 2;
@@ -3781,10 +3676,10 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
if (Abs(angleDiffBtwObjCenterAndForward) < objTopRightHeading) {
if (goingToEnterCar) {
if (goingToEnterCarAndItsVan) {
- if (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR)
+ if (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR)
return;
}
- if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) {
+ if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) {
m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI);
localPosToHead.x = adjustedColMax.x;
localPosToHead.z = 0.0f;
@@ -3813,9 +3708,9 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} else {
if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) {
if (angleDiffBtwObjCenterAndForward <= 0.0f) {
- if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR) {
+ if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR) {
if (goingToEnterCar) {
- if (m_vehEnterType == CAR_DOOR_RF || (m_vehEnterType == CAR_DOOR_RR && !goingToEnterCarAndItsVan))
+ if (m_vehDoor == CAR_DOOR_RF || (m_vehDoor == CAR_DOOR_RR && !goingToEnterCarAndItsVan))
return;
}
if (m_walkAroundType == 4 || m_walkAroundType == 3
@@ -3837,14 +3732,14 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
localPosToHead.z = 0.0f;
localPosToHead.y = adjustedColMin.y;
}
- } else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR)) {
+ } else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR)) {
m_fRotationDest = CGeneral::LimitRadianAngle(PI + dirToSet);
localPosToHead.x = adjustedColMin.x;
localPosToHead.z = 0.0f;
localPosToHead.y = adjustedColMin.y;
} else {
if (goingToEnterCar) {
- if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR && !goingToEnterCarAndItsVan)
+ if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR && !goingToEnterCarAndItsVan)
return;
}
if (m_walkAroundType == 1 || m_walkAroundType == 2
@@ -3862,8 +3757,8 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
}
}
} else {
- if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR)) {
- if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) {
+ if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR)) {
+ if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) {
m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI);
localPosToHead.x = adjustedColMax.x;
@@ -3918,7 +3813,6 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
m_nPedStateTimer = CTimer::GetTimeInMilliseconds() + 280.0f * dist * checkIntervalInTime;
}
-// --MIAMI: Done
bool
CPed::IsPedInControl(void)
{
@@ -3927,14 +3821,12 @@ CPed::IsPedInControl(void)
&& m_fHealth > 0.0f;
}
-// --MIAMI: Done
bool
CPed::IsPedShootable(void)
{
return m_nPedState <= PED_STATES_NO_ST;
}
-// --MIAMI: Done
bool
CPed::UseGroundColModel(void)
{
@@ -3944,7 +3836,6 @@ CPed::UseGroundColModel(void)
m_nPedState == PED_DEAD;
}
-// --MIAMI: Done
bool
CPed::CanPedReturnToState(void)
{
@@ -3952,14 +3843,12 @@ CPed::CanPedReturnToState(void)
m_nPedState != PED_FIGHT && m_nPedState != PED_STEP_AWAY && m_nPedState != PED_SNIPER_MODE && m_nPedState != PED_LOOK_ENTITY;
}
-// --MIAMI: Done
bool
CPed::CanSetPedState(void)
{
return !DyingOrDead() && m_nPedState != PED_ARRESTED && !EnteringCar() && m_nPedState != PED_STEAL_CAR;
}
-// --MIAMI: Done
bool
CPed::CanStrafeOrMouseControl(void)
{
@@ -3971,7 +3860,6 @@ CPed::CanStrafeOrMouseControl(void)
m_nPedState == PED_ATTACK || m_nPedState == PED_FIGHT || m_nPedState == PED_AIM_GUN || m_nPedState == PED_JUMP || m_nPedState == PED_ANSWER_MOBILE;
}
-// --MIAMI: Done
void
CPed::PedSetPreviousStateCB(CAnimBlendAssociation* assoc, void* arg)
{
@@ -3980,7 +3868,6 @@ CPed::PedSetPreviousStateCB(CAnimBlendAssociation* assoc, void* arg)
ped->m_pVehicleAnim = nil;
}
-// --MIAMI: Done
void
CPed::PedGetupCB(CAnimBlendAssociation* animAssoc, void* arg)
{
@@ -4016,7 +3903,6 @@ CPed::PedGetupCB(CAnimBlendAssociation* animAssoc, void* arg)
ped->bGetUpAnimStarted = false;
}
-// --MIAMI: Done
void
CPed::PedLandCB(CAnimBlendAssociation* animAssoc, void* arg)
{
@@ -4029,7 +3915,6 @@ CPed::PedLandCB(CAnimBlendAssociation* animAssoc, void* arg)
ped->RestorePreviousState();
}
-// --MIAMI: Done
void
CPed::PedStaggerCB(CAnimBlendAssociation* animAssoc, void* arg)
{
@@ -4040,7 +3925,6 @@ CPed::PedStaggerCB(CAnimBlendAssociation* animAssoc, void* arg)
// nothing
*/
}
-// --MIAMI: Done
void
CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
{
@@ -4131,12 +4015,9 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
} else if (ped->m_objective == OBJECTIVE_NONE && ped->CharCreatedBy != MISSION_CHAR && ped->m_nPedState == PED_IDLE && !ped->IsPlayer()) {
ped->SetWanderPath(CGeneral::GetRandomNumberInRange(0.0f, 8.0f));
}
- }
-#ifdef VC_PED_PORTS
- else if (ped->m_nPedState == PED_DRIVING) {
+ } else if (ped->m_nPedState == PED_DRIVING) {
ped->m_nPedState = PED_IDLE;
}
-#endif
if (animAssoc)
animAssoc->blendDelta = -1000.0f;
@@ -4160,13 +4041,15 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
}
if (veh && veh->IsBike())
// BUG?
- veh->m_nGettingOutFlags &= ~GetBikeDoorFlag(ped->m_vehEnterType);
+ veh->m_nGettingOutFlags &= ~GetBikeDoorFlag(ped->m_vehDoor);
else
- veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType);
+ veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehDoor);
if (veh->pDriver == ped) {
veh->RemoveDriver();
+#ifndef FIX_BUGS // RemoveDriver does it anyway
veh->SetStatus(STATUS_ABANDONED);
+#endif
if (veh->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
veh->m_nDoorLock = CARLOCK_UNLOCKED;
if (ped->m_nPedType == PEDTYPE_COP && veh->IsLawEnforcementVehicle())
@@ -4182,7 +4065,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->bIsBus && !veh->IsUpsideDown() && !veh->IsOnItsSide()) {
float angleAfterExit;
- if (ped->m_vehEnterType == CAR_DOOR_LF) {
+ if (ped->m_vehDoor == CAR_DOOR_LF) {
angleAfterExit = HALFPI + veh->GetForward().Heading();
} else {
angleAfterExit = veh->GetForward().Heading() - HALFPI;
@@ -4222,7 +4105,6 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->bHeldHostageInCar = false;
}
-// --MIAMI: Done
void
CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
{
@@ -4233,7 +4115,7 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
uint8 exitFlags = 0;
quickJackedAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), ANIM_CAR_QJACKED);
if (dragAssoc && dragAssoc->animId == ANIM_BIKE_HIT && ped->m_pMyVehicle) {
- if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_RF) {
+ if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_RF) {
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_BIKE_FALL_OFF, 100.0f);
ped->m_pMyVehicle->m_nGettingOutFlags &= ~(CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF);
} else {
@@ -4255,9 +4137,9 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
vehicle = ped->m_pMyVehicle;
if (vehicle && vehicle->IsBike())
- exitFlags = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehEnterType);
+ exitFlags = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehDoor);
else
- exitFlags = GetCarDoorFlag(ped->m_vehEnterType);
+ exitFlags = GetCarDoorFlag(ped->m_vehDoor);
if (vehicle)
vehicle->m_nGettingOutFlags &= ~exitFlags;
@@ -4299,7 +4181,6 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
ped->bVehExitWillBeInstant = false;
}
-// --MIAMI: Done
void
CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
{
@@ -4478,7 +4359,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
} else if (veh->bIsBus) {
veh->AddPassenger(ped);
} else {
- switch (ped->m_vehEnterType) {
+ switch (ped->m_vehDoor) {
case CAR_DOOR_RF:
veh->AddPassenger(ped, 0);
break;
@@ -4508,9 +4389,9 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
int8 doorFlag;
if (veh->IsBike()) {
- doorFlag = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehEnterType);
+ doorFlag = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehDoor);
} else {
- doorFlag = GetEnterCarDoorFlag(ped->m_vehEnterType, veh->m_nNumMaxPassengers);
+ doorFlag = GetEnterCarDoorFlag(ped->m_vehDoor, veh->m_nNumMaxPassengers);
}
veh->m_nGettingInFlags &= ~doorFlag;
@@ -4558,7 +4439,6 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->bChangedSeat = true;
}
-// --MIAMI: Done
bool
CPed::CanBeDeleted(void)
{
@@ -4577,7 +4457,6 @@ CPed::CanBeDeleted(void)
}
}
-//--MIAMI: done
bool
CPed::CanBeDeletedEvenInVehicle(void)
{
@@ -4593,7 +4472,6 @@ CPed::CanBeDeletedEvenInVehicle(void)
}
}
-// --MIAMI: Done
void
CPed::AddWeaponModel(int id)
{
@@ -4621,7 +4499,6 @@ RemoveAllModelCB(RwObject *object, void *data)
return object;
}
-// --MIAMI: Done
void
CPed::RemoveWeaponModel(int modelId)
{
@@ -4649,7 +4526,6 @@ CPed::RemoveWeaponModel(int modelId)
m_wepModelID = -1;
}
-// --MIAMI: Done
void
CPed::RequestDelayedWeapon()
{
@@ -4669,7 +4545,6 @@ CPed::RequestDelayedWeapon()
}
}
-// --MIAMI: Done
void
CPed::GiveDelayedWeapon(eWeaponType weapon, uint32 ammo)
{
@@ -4691,7 +4566,6 @@ CPed::GiveDelayedWeapon(eWeaponType weapon, uint32 ammo)
}
}
-// --MIAMI: Done
int32
CPed::GiveWeapon(eWeaponType weaponType, uint32 ammo, bool unused)
{
@@ -4728,14 +4602,12 @@ CPed::GiveWeapon(eWeaponType weaponType, uint32 ammo, bool unused)
return slot;
}
-// --MIAMI: Done
int
CPed::GetWeaponSlot(eWeaponType weaponType)
{
return CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot;
}
-// --MIAMI: Done
void
CPed::SetCurrentWeapon(int slot)
{
@@ -4758,14 +4630,12 @@ CPed::SetCurrentWeapon(int slot)
}
}
-// --MIAMI: Done
void
CPed::SetCurrentWeapon(eWeaponType weaponType)
{
SetCurrentWeapon(CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot);
}
-// --MIAMI: Done
void
CPed::GrantAmmo(eWeaponType weaponType, uint32 ammo)
{
@@ -4786,7 +4656,6 @@ CPed::GrantAmmo(eWeaponType weaponType, uint32 ammo)
GetWeapon(slot).m_eWeaponState = WEAPONSTATE_READY;
}
-// --MIAMI: Done
void
CPed::SetAmmo(eWeaponType weaponType, uint32 ammo)
{
@@ -4811,7 +4680,6 @@ CPed::SetAmmo(eWeaponType weaponType, uint32 ammo)
GetWeapon(slot).m_eWeaponState = WEAPONSTATE_READY;
}
-// --MIAMI: Done
void
CPed::ClearWeapons(void)
{
@@ -4822,7 +4690,6 @@ CPed::ClearWeapons(void)
SetCurrentWeapon(WEAPONTYPE_UNARMED);
}
-// --MIAMI: Done
void
CPed::RemoveWeaponWhenEnteringVehicle(void)
{
@@ -4835,14 +4702,13 @@ CPed::RemoveWeaponWhenEnteringVehicle(void)
RemoveWeaponModel(ourWeapon->m_nModelId);
}
}
-// --MIAMI: Done, but enumarate weapon slots
void
CPed::ReplaceWeaponWhenExitingVehicle(void)
{
eWeaponType weaponType = GetWeapon()->m_eWeaponType;
// If it's Uzi, we may have stored weapon. Uzi is the only gun we can use in car.
- if (IsPlayer() && GetWeaponSlot(weaponType) == 5) {
+ if (IsPlayer() && GetWeaponSlot(weaponType) == WEAPONSLOT_SUBMACHINEGUN) {
if (m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) {
SetCurrentWeapon(m_storedWeapon);
m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
@@ -4852,7 +4718,6 @@ CPed::ReplaceWeaponWhenExitingVehicle(void)
}
}
-// --MIAMI: Done
void
CPed::PreRender(void)
{
@@ -4861,11 +4726,7 @@ CPed::PreRender(void)
CTimeCycle::m_fShadowFrontX[CTimeCycle::m_CurrentStoredValue], CTimeCycle::m_fShadowFrontY[CTimeCycle::m_CurrentStoredValue],
CTimeCycle::m_fShadowSideX[CTimeCycle::m_CurrentStoredValue], CTimeCycle::m_fShadowSideY[CTimeCycle::m_CurrentStoredValue]);
-#ifdef PED_SKIN
- if(IsClumpSkinned(GetClump())){
- UpdateRpHAnim();
- }
-#endif
+ UpdateRpHAnim();
bool bIsWindModifierTurnedOn = false;
float fAnyDirectionShift = 1.0f;
@@ -5091,7 +4952,6 @@ CPed::PreRender(void)
CVector vecTestTemp(-1.0f, -1.0f, -1.0f);
-// --MIAMI: Done
void
CPed::Render(void)
{
@@ -5141,7 +5001,6 @@ CPed::Render(void)
}
}
-// --MIAMI: Done
void
CPed::CheckAroundForPossibleCollisions(void)
{
@@ -5174,7 +5033,6 @@ CPed::CheckAroundForPossibleCollisions(void)
}
}
-// --MIAMI: Done
void
CPed::SetIdle(void)
{
@@ -5191,18 +5049,17 @@ CPed::SetIdle(void)
}
}
-// --MIAMI: Done
void
CPed::Idle(void)
{
CVehicle *veh = m_pMyVehicle;
- if (veh && veh->m_nGettingOutFlags && m_vehEnterType) {
+ if (veh && veh->m_nGettingOutFlags && m_vehDoor) {
- if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehEnterType)) {
+ if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehDoor)) {
if (m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
- CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehEnterType);
+ CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehDoor);
CVector doorDist = GetPosition() - doorPos;
if (doorDist.MagnitudeSqr() < sq(0.5f)) {
@@ -5219,14 +5076,12 @@ CPed::Idle(void)
m_moved = CVector2D(0.0f, 0.0f);
}
-// --MIAMI: Done
void
CPed::ClearPause(void)
{
RestorePreviousState();
}
-// --MIAMI: Done
void
CPed::Pause(void)
{
@@ -5235,7 +5090,6 @@ CPed::Pause(void)
ClearPause();
}
-// --MIAMI: Done
void
CPed::SetFall(int extraTime, AnimationId animId, uint8 evenIfNotInControl)
{
@@ -5301,14 +5155,12 @@ CPed::SetFall(int extraTime, AnimationId animId, uint8 evenIfNotInControl)
bFallenDown = true;
}
-// --MIAMI: Done
void
CPed::ClearFall(void)
{
SetGetUp();
}
-// --MIAMI: Done
void
CPed::Fall(void)
{
@@ -5367,7 +5219,6 @@ CPed::Fall(void)
}
}
-// --MIAMI: Done
bool
CPed::CheckIfInTheAir(void)
{
@@ -5389,7 +5240,6 @@ CPed::CheckIfInTheAir(void)
return !foundGround;
}
-// --MIAMI: Done
void
CPed::SetInTheAir(void)
{
@@ -5408,7 +5258,6 @@ CPed::SetInTheAir(void)
}
-// --MIAMI: Done
void
CPed::InTheAir(void)
{
@@ -5432,7 +5281,6 @@ CPed::InTheAir(void)
}
}
-// --MIAMI: Done
void
CPed::SetLanding(void)
{
@@ -5468,7 +5316,6 @@ CPed::SetLanding(void)
bIsLanding = true;
}
-// --MIAMI: Done
void
CPed::SetGetUp(void)
{
@@ -5539,7 +5386,6 @@ CPed::SetGetUp(void)
}
}
-// --MIAMI: Done
void
CPed::Mug(void)
{
@@ -5561,7 +5407,6 @@ CPed::Mug(void)
}
}
-// --MIAMI: Done
// Unused
void
CPed::SetLook(float direction)
@@ -5573,7 +5418,6 @@ CPed::SetLook(float direction)
}
}
-// --MIAMI: Done
void
CPed::SetLook(CEntity* to)
{
@@ -5584,7 +5428,6 @@ CPed::SetLook(CEntity* to)
}
}
-// --MIAMI: Done
void
CPed::SetLookTimer(int time)
{
@@ -5593,7 +5436,6 @@ CPed::SetLookTimer(int time)
}
}
-// --MIAMI: Done
void
CPed::SetAttackTimer(uint32 time)
{
@@ -5601,7 +5443,6 @@ CPed::SetAttackTimer(uint32 time)
m_attackTimer = Max(m_shootTimer, CTimer::GetTimeInMilliseconds()) + time;
}
-// --MIAMI: Done
void
CPed::SetShootTimer(uint32 time)
{
@@ -5610,7 +5451,6 @@ CPed::SetShootTimer(uint32 time)
}
}
-// --MIAMI: Done
void
CPed::ClearLook(void)
{
@@ -5618,14 +5458,12 @@ CPed::ClearLook(void)
ClearLookFlag();
}
-// --MIAMI: Done
void
CPed::Look(void)
{
TurnBody();
}
-// --MIAMI: Done
bool
CPed::TurnBody(void)
{
@@ -5659,7 +5497,6 @@ CPed::TurnBody(void)
return turnDone;
}
-// --MIAMI: Done
void
CPed::SetSeek(CVector pos, float distanceToCountDone)
{
@@ -5667,7 +5504,7 @@ CPed::SetSeek(CVector pos, float distanceToCountDone)
|| (m_nPedState == PED_SEEK_POS && m_vecSeekPos.x == pos.x && m_vecSeekPos.y == pos.y) || m_nPedState == PED_FOLLOW_PATH)
return;
- if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAimWithArm) {
+ if (!CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) {
ClearPointGunAt();
}
@@ -5678,7 +5515,6 @@ CPed::SetSeek(CVector pos, float distanceToCountDone)
m_distanceToCountSeekDone = distanceToCountDone;
m_vecSeekPos = pos;
}
-// --MIAMI: Done
void
CPed::SetSeek(CEntity *seeking, float distanceToCountDone)
{
@@ -5701,7 +5537,6 @@ CPed::SetSeek(CEntity *seeking, float distanceToCountDone)
SetMoveState(PEDMOVE_STILL);
}
-// --MIAMI: Done
void
CPed::ClearSeek(void)
{
@@ -5709,7 +5544,6 @@ CPed::ClearSeek(void)
bRunningToPhone = false;
}
-// --MIAMI: Done
bool
CPed::Seek(void)
{
@@ -5882,7 +5716,6 @@ CPed::Seek(void)
return true;
}
-// --MIAMI: Done
void
CPed::SetFlee(CVector2D const &from, int time)
{
@@ -5912,7 +5745,6 @@ CPed::SetFlee(CVector2D const &from, int time)
}
}
-// --MIAMI: Done
void
CPed::SetFlee(CEntity *fleeFrom, int time)
{
@@ -5943,17 +5775,15 @@ CPed::SetFlee(CEntity *fleeFrom, int time)
}
}
-// --MIAMI: Done
void
CPed::ClearFlee(void)
{
RestorePreviousState();
bUsePedNodeSeek = false;
- m_standardTimer = 0;
+ m_chatTimer = 0;
m_fleeTimer = 0;
}
-// --MIAMI: Done
void
CPed::Flee(void)
{
@@ -5995,7 +5825,7 @@ CPed::Flee(void)
if (m_nPedStateTimer < CTimer::GetTimeInMilliseconds()
&& m_collidingThingTimer < CTimer::GetTimeInMilliseconds()) {
- if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_standardTimer) {
+ if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_chatTimer) {
curDirectionShouldBe = CGeneral::GetNodeHeadingFromVector(GetPosition().x - ms_vec2DFleePosition.x, GetPosition().y - ms_vec2DFleePosition.y);
if (m_nPathDir < curDirectionShouldBe)
@@ -6038,7 +5868,7 @@ CPed::Flee(void)
if (m_pNextPathNode && m_pNextPathNode != realLastNode && m_pNextPathNode != m_pLastPathNode && curDirectionShouldBe - nextDirection != 4) {
m_nPathDir = nextDirection;
- m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000;
+ m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000;
} else {
bUsePedNodeSeek = false;
SetMoveState(PEDMOVE_RUN);
@@ -6141,7 +5971,6 @@ CPed::WanderRange(void)
}
}
-// --MIAMI: Done
bool
CPed::SetWanderPath(int8 pathStateDest)
{
@@ -6190,7 +6019,6 @@ CPed::SetWanderPath(int8 pathStateDest)
}
}
-// --MIAMI: Done
void
CPed::WanderPath(void)
{
@@ -6298,7 +6126,6 @@ CPed::WanderPath(void)
Say(SOUND_PED_WAIT_DOUBLEBACK);
}
}
-// --MIAMI: Done
void
CPed::Avoid(void)
{
@@ -6347,7 +6174,6 @@ CPed::Avoid(void)
}
}
-// --MIAMI: Done
CVector*
CPed::SeekFollowingPath(void)
{
@@ -6369,7 +6195,6 @@ CPed::SeekFollowingPath(void)
return &vecNextPathNode;
}
-// --MIAMI: Done
bool
CPed::SetFollowPath(CVector dest, float radius, eMoveState state, CEntity* walkAroundEnt, CEntity* targetEnt, int time)
{
@@ -6422,7 +6247,6 @@ CPed::SetFollowPath(CVector dest, float radius, eMoveState state, CEntity* walkA
return SetFollowPathStatic();
}
-// --MIAMI: Done
bool
CPed::SetFollowPathStatic(void)
{
@@ -6475,8 +6299,8 @@ CPed::SetFollowPathStatic(void)
if (m_nLastPedState == PED_NONE)
m_nLastPedState = oldLastState;
- m_nPedState = PED_FOLLOW_PATH;
- m_nMoveState = m_followPathMoveState;
+ SetPedState(PED_FOLLOW_PATH);
+ SetMoveState(m_followPathMoveState);
} else {
RestorePreviousState();
if (m_objective == OBJECTIVE_NONE) {
@@ -6491,7 +6315,6 @@ CPed::SetFollowPathStatic(void)
return true;
}
-// --MIAMI: Done
bool
CPed::SetFollowPathDynamic(void)
{
@@ -6855,8 +6678,8 @@ CPed::SetFollowPathDynamic(void)
if (m_nLastPedState == PED_NONE)
m_nLastPedState = oldLastState;
- m_nPedState = PED_FOLLOW_PATH;
- m_nMoveState = m_followPathMoveState;
+ SetPedState(PED_FOLLOW_PATH);
+ SetMoveState(m_followPathMoveState);
return true;
} else {
@@ -6875,7 +6698,6 @@ CPed::SetFollowPathDynamic(void)
}
}
-// --MIAMI: Done
void
CPed::ClearFollowPath()
{
@@ -6886,7 +6708,6 @@ CPed::ClearFollowPath()
m_nCurPathNodeId = 0;
}
-// --MIAMI: Done
void
CPed::FollowPath(void)
{
@@ -6917,7 +6738,6 @@ CPed::FollowPath(void)
}
}
-// --MIAMI: Done
void
CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
{
@@ -6993,7 +6813,6 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
}
}
-// --MIAMI: Done
void
CPed::SetEvasiveDive(CPhysical *reason, uint8 onlyRandomJump)
{
@@ -7099,7 +6918,7 @@ CPed::SetEvasiveDive(CPhysical *reason, uint8 onlyRandomJump)
ClearLookFlag();
ClearAimFlag();
SetStoredState();
- m_nPedState = PED_DIVE_AWAY;
+ SetPedState(PED_DIVE_AWAY);
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_EV_DIVE, 8.0f);
animAssoc->SetFinishCallback(PedEvadeCB, this);
}
@@ -7113,7 +6932,6 @@ CPed::SetEvasiveDive(CPhysical *reason, uint8 onlyRandomJump)
}
}
-// --MIAMI: Done
void
CPed::PedEvadeCB(CAnimBlendAssociation* animAssoc, void* arg)
{
@@ -7151,7 +6969,6 @@ CPed::PedEvadeCB(CAnimBlendAssociation* animAssoc, void* arg)
}
}
-// --MIAMI: Done
void
CPed::SetDie(AnimationId animId, float delta, float speed)
{
@@ -7215,7 +7032,6 @@ CPed::SetDie(AnimationId animId, float delta, float speed)
}
}
-// --MIAMI: Done
void
CPed::FinishDieAnimCB(CAnimBlendAssociation *animAssoc, void *arg)
{
@@ -7225,7 +7041,6 @@ CPed::FinishDieAnimCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->bIsPedDieAnimPlaying = false;
}
-// --MIAMI: Done
void
CPed::SetDead(void)
{
@@ -7258,14 +7073,12 @@ CPed::SetDead(void)
CEventList::RegisterEvent(EVENT_DEAD_PED, EVENT_ENTITY_PED, this, nil, 1000);
}
-// --MIAMI: Done
void
CPed::Die(void)
{
// UNUSED: This is a perfectly empty function.
}
-// --MIAMI: Done
void
CPed::SetChat(CEntity *chatWith, uint32 time)
{
@@ -7278,11 +7091,10 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
SetMoveState(PEDMOVE_STILL);
m_lookTimer = 0;
SetLookFlag(chatWith, true);
- m_standardTimer = CTimer::GetTimeInMilliseconds() + time;
+ m_chatTimer = CTimer::GetTimeInMilliseconds() + time;
m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000;
}
-// --MIAMI: Done
void
CPed::Chat(void)
{
@@ -7299,7 +7111,7 @@ CPed::Chat(void)
if (partner->m_nPedState != PED_CHAT) {
ClearChat();
- m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000;
+ m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000;
if (partner->m_pedInObjective) {
if (partner->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT ||
partner->m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE)
@@ -7332,13 +7144,12 @@ CPed::Chat(void)
Say(SOUND_PED_CHAT);
}
}
- if (m_standardTimer && CTimer::GetTimeInMilliseconds() > m_standardTimer) {
+ if (m_chatTimer && CTimer::GetTimeInMilliseconds() > m_chatTimer) {
ClearChat();
- m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000;
+ m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000;
}
}
-// --MIAMI: Done
void
CPed::ClearChat(void)
{
@@ -7357,7 +7168,6 @@ CPed::ClearChat(void)
}
}
-// --MIAMI: Done
bool
CPed::FacePhone(void)
{
@@ -7406,7 +7216,6 @@ CPed::FacePhone(void)
#endif
}
-// --MIAMI: Done
bool
CPed::MakePhonecall(void)
{
@@ -7419,7 +7228,6 @@ CPed::MakePhonecall(void)
return true;
}
-// --MIAMI: Done
void
StartTalkingOnMobileCB(CAnimBlendAssociation* assoc, void* arg)
{
@@ -7428,7 +7236,6 @@ StartTalkingOnMobileCB(CAnimBlendAssociation* assoc, void* arg)
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_PHONE_TALK, 4.0f);
}
-// --MIAMI: Done
void
FinishTalkingOnMobileCB(CAnimBlendAssociation *assoc, void *arg)
{
@@ -7441,7 +7248,6 @@ FinishTalkingOnMobileCB(CAnimBlendAssociation *assoc, void *arg)
ped->m_lookTimer = 0;
}
-// --MIAMI: Done
void
CPed::SetAnswerMobile(void)
{
@@ -7458,7 +7264,6 @@ CPed::SetAnswerMobile(void)
}
}
-// --MIAMI: Done
void
CPed::ClearAnswerMobile(void)
{
@@ -7478,7 +7283,6 @@ CPed::ClearAnswerMobile(void)
}
}
-// --MIAMI: Done
void
CPed::AnswerMobile(void)
{
@@ -7511,7 +7315,6 @@ CPed::AnswerMobile(void)
}
}
-// --MIAMI: Done
void
CPed::Teleport(CVector pos)
{
@@ -7525,7 +7328,6 @@ CPed::Teleport(CVector pos)
CWorld::Add(this);
}
-// --MIAMI: Done
void
CPed::SetSeekCar(CVehicle *car, uint32 doorNode)
{
@@ -7543,13 +7345,12 @@ CPed::SetSeekCar(CVehicle *car, uint32 doorNode)
m_pMyVehicle = car;
m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle);
// m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget);
- m_vehEnterType = doorNode;
+ m_vehDoor = doorNode;
m_distanceToCountSeekDone = 0.5f;
SetPedState(PED_SEEK_CAR);
}
-// --MIAMI: Done
void
CPed::SeekCar(void)
{
@@ -7561,9 +7362,9 @@ CPed::SeekCar(void)
}
if (m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
- if (!vehToSeek->IsBike() && m_vehEnterType && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) {
+ if (!vehToSeek->IsBike() && m_vehDoor && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) {
if (IsRoomToBeCarJacked()) {
- dest = GetPositionToOpenCarDoor(vehToSeek, m_vehEnterType);
+ dest = GetPositionToOpenCarDoor(vehToSeek, m_vehDoor);
} else if (m_nPedType == PEDTYPE_COP) {
dest = GetPositionToOpenCarDoor(vehToSeek, CAR_DOOR_RF);
} else {
@@ -7572,7 +7373,7 @@ CPed::SeekCar(void)
} else
GetNearestDoor(vehToSeek, dest);
} else {
- if (m_hitRecoverTimer > CTimer::GetTimeInMilliseconds()) {
+ if (m_carJackTimer > CTimer::GetTimeInMilliseconds()) {
SetMoveState(PEDMOVE_STILL);
return;
}
@@ -7616,7 +7417,7 @@ CPed::SeekCar(void)
if (IsPlayer()) {
ClearObjective();
} else if (CharCreatedBy == RANDOM_CHAR) {
- m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000;
+ m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000;
}
SetMoveState(PEDMOVE_STILL);
TheCamera.ClearPlayerWeaponMode();
@@ -7644,7 +7445,7 @@ CPed::SeekCar(void)
else if (2.0f * vehToSeek->GetColModel()->boundingBox.max.x > distToDestSqr)
bCanPedEnterSeekedCar = true;
- if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehEnterType))
+ if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehDoor))
bVehEnterDoorIsBlocked = true;
else
bVehEnterDoorIsBlocked = false;
@@ -7655,7 +7456,7 @@ CPed::SeekCar(void)
if (1.6f + GetPosition().z > dest.z && GetPosition().z - 0.5f < dest.z) {
#ifdef GTA_TRAIN
if (vehToSeek->IsTrain()) {
- SetEnterTrain(vehToSeek, m_vehEnterType);
+ SetEnterTrain(vehToSeek, m_vehDoor);
} else
#endif
{
@@ -7676,42 +7477,42 @@ CPed::SeekCar(void)
case STATUS_PLAYER_DISABLED:
if (vehToSeek->IsBike()) {
if ((!m_leader || m_leader != vehToSeek->pDriver) &&
- ((m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_WINDSCREEN) && vehToSeek->pDriver ||
- (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) && vehToSeek->pPassengers[0])) {
+ ((m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_WINDSCREEN) && vehToSeek->pDriver ||
+ (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) && vehToSeek->pPassengers[0])) {
SetCarJack(vehToSeek);
} else {
- SetEnterCar(vehToSeek, m_vehEnterType);
+ SetEnterCar(vehToSeek, m_vehDoor);
}
} else if (!vehToSeek->bIsBus && (!m_leader || m_leader != vehToSeek->pDriver) &&
- (m_vehEnterType == CAR_DOOR_LF && vehToSeek->pDriver || m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehEnterType == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehEnterType == CAR_DOOR_RR && vehToSeek->pPassengers[2])) {
+ (m_vehDoor == CAR_DOOR_LF && vehToSeek->pDriver || m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehDoor == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehDoor == CAR_DOOR_RR && vehToSeek->pPassengers[2])) {
SetCarJack(vehToSeek);
- if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehEnterType != CAR_DOOR_LF)
+ if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehDoor != CAR_DOOR_LF)
vehToSeek->pDriver->bFleeAfterExitingCar = true;
} else {
- SetEnterCar(vehToSeek, m_vehEnterType);
+ SetEnterCar(vehToSeek, m_vehDoor);
}
break;
case STATUS_ABANDONED:
if (vehToSeek->IsBike()) {
- if ((m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) && vehToSeek->pPassengers[0]) {
+ if ((m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) && vehToSeek->pPassengers[0]) {
if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) {
if (IsPlayer())
- SetEnterCar(vehToSeek, m_vehEnterType);
+ SetEnterCar(vehToSeek, m_vehDoor);
} else {
SetCarJack(vehToSeek);
}
} else {
- SetEnterCar(vehToSeek, m_vehEnterType);
+ SetEnterCar(vehToSeek, m_vehDoor);
}
- } else if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) {
+ } else if (m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0]) {
if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) {
if (IsPlayer())
- SetEnterCar(vehToSeek, m_vehEnterType);
+ SetEnterCar(vehToSeek, m_vehDoor);
} else {
SetCarJack(vehToSeek);
}
} else {
- SetEnterCar(vehToSeek, m_vehEnterType);
+ SetEnterCar(vehToSeek, m_vehDoor);
}
break;
case STATUS_WRECKED:
@@ -7732,7 +7533,6 @@ CPed::SeekCar(void)
}
}
-// --MIAMI: Done
bool
CPed::CheckForExplosions(CVector2D &area)
{
@@ -7777,7 +7577,6 @@ CPed::CheckForExplosions(CVector2D &area)
return false;
}
-// --MIAMI: Done
CPed *
CPed::CheckForGunShots(void)
{
@@ -7793,7 +7592,6 @@ CPed::CheckForGunShots(void)
return nil;
}
-// --MIAMI: Done
CPed *
CPed::CheckForDeadPeds(void)
{
@@ -7809,7 +7607,6 @@ CPed::CheckForDeadPeds(void)
return nil;
}
-// --MIAMI: Done
bool
CPed::IsPlayer(void) const
{
@@ -7822,14 +7619,12 @@ CPed::IsPlayer(void) const
#endif
}
-// --MIAMI: Done
bool
CPed::IsGangMember(void) const
{
return m_nPedType >= PEDTYPE_GANG1 && m_nPedType <= PEDTYPE_GANG9;
}
-// --MIAMI: Done
bool
IsPedPointerValid(CPed* pPed)
{
@@ -7840,13 +7635,12 @@ IsPedPointerValid(CPed* pPed)
return pPed->m_entryInfoList.first || pPed == FindPlayerPed();
}
-// --MIAMI: Done
bool
IsPedPointerValid_NotInWorld(CPed* pPed)
{
if (!pPed)
return false;
- int index = CPools::GetPedPool()->GetJustIndex(pPed);
+ int index = CPools::GetPedPool()->GetJustIndex_NoFreeAssert(pPed);
#ifdef FIX_BUGS
if (index < 0 || index >= NUMPEDS)
#else
@@ -7856,7 +7650,6 @@ IsPedPointerValid_NotInWorld(CPed* pPed)
return true;
}
-// --MIAMI: Done
bool
CPed::IsPointerValid(void)
{
@@ -7870,7 +7663,6 @@ CPed::IsPointerValid(void)
return false;
}
-// --MIAMI: Done
void
CPed::SetPedPositionInCar(void)
{
@@ -7963,7 +7755,6 @@ CPed::SetPedPositionInCar(void)
GetMatrix() = newMat;
}
-// --MIAMI: Done
void
CPed::LookForSexyPeds(void)
{
@@ -7989,7 +7780,6 @@ CPed::LookForSexyPeds(void)
m_lookTimer = CTimer::GetTimeInMilliseconds() + 10000;
}
-// --MIAMI: Done
void
CPed::LookForSexyCars(void)
{
@@ -8019,7 +7809,6 @@ CPed::LookForSexyCars(void)
}
}
-// --MIAMI: Done
bool
CPed::LookForInterestingNodes(void)
{
@@ -8029,7 +7818,7 @@ CPed::LookForInterestingNodes(void)
C2dEffect *effect;
CMatrix *objMat;
- if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_standardTimer) {
+ if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_chatTimer) {
return false;
}
bool found = false;
@@ -8139,7 +7928,7 @@ CPed::LookForInterestingNodes(void)
float angleToFace = CGeneral::GetRadianAngleBetweenPoints(effectFrontLocal.x, effectFrontLocal.y, 0.0f, 0.0f);
randVal = CGeneral::GetRandomNumber() % 256;
if (randVal <= m_randomSeed % 256) {
- m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000;
+ m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000;
SetLookFlag(angleToFace, true);
SetLookTimer(1000);
return false;
@@ -8161,7 +7950,6 @@ CPed::LookForInterestingNodes(void)
return true;
}
-// --MIAMI: Done
void
PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 first, uint32 amount)
{
@@ -8198,7 +7986,6 @@ PlayRandomAnimationsFromAnimBlock(CPed* ped, AssocGroupId animGroup, uint32 firs
}
}
-// --MIAMI: Done
void
CPed::ClearWaitState(void)
{
@@ -8302,7 +8089,6 @@ CPed::ClearWaitState(void)
m_nWaitState = WAITSTATE_FALSE;
}
-// --MIAMI: Done
void
CPed::SetWaitState(eWaitState state, void *time)
{
@@ -8362,7 +8148,7 @@ CPed::SetWaitState(eWaitState state, void *time)
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) {
ClearObjective();
RestorePreviousState();
- m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000;
+ m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000;
}
break;
case WAITSTATE_TURN180:
@@ -8391,7 +8177,7 @@ CPed::SetWaitState(eWaitState state, void *time)
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) {
ClearObjective();
RestorePreviousState();
- m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000;
+ m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000;
}
break;
case WAITSTATE_LOOK_ABOUT:
@@ -8522,7 +8308,6 @@ CPed::SetWaitState(eWaitState state, void *time)
m_nWaitState = state;
}
-// --MIAMI: Done
void
CPed::Wait(void)
{
@@ -8966,7 +8751,6 @@ CPed::Wait(void)
RestoreHeadingRate();
}
-// --MIAMI: Done
void
CPed::DeleteSunbatheIdleAnimCB(CAnimBlendAssociation *assoc, void *arg)
{
@@ -8985,7 +8769,6 @@ CPed::DeleteSunbatheIdleAnimCB(CAnimBlendAssociation *assoc, void *arg)
ped->Wait();
}
-// --MIAMI: Done
void
CPed::FinishedWaitCB(CAnimBlendAssociation *animAssoc, void *arg)
{
@@ -8996,21 +8779,18 @@ CPed::FinishedWaitCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->Wait();
}
-// --MIAMI: Done
void
CPed::RestoreHeadingRate(void)
{
m_headingRate = m_pedStats->m_headingChangeRate;
}
-// --MIAMI: Done
void
CPed::RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg)
{
((CPed*)arg)->RestoreHeadingRate();
}
-// --MIAMI: Done
void
CPed::FlagToDestroyWhenNextProcessed(void)
{
@@ -9034,7 +8814,6 @@ CPed::FlagToDestroyWhenNextProcessed(void)
m_pVehicleAnim = nil;
}
-// --MIAMI: Done
void
CPed::SetSolicit(uint32 time)
{
@@ -9043,14 +8822,14 @@ CPed::SetSolicit(uint32 time)
if (CharCreatedBy != MISSION_CHAR && m_carInObjective->m_nNumGettingIn == 0
&& CTimer::GetTimeInMilliseconds() < m_objectiveTimer) {
- if (m_vehEnterType == CAR_DOOR_LF) {
+ if (m_vehDoor == CAR_DOOR_LF) {
m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI;
} else {
m_fRotationDest = m_carInObjective->GetForward().Heading() + HALFPI;
}
if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) {
- m_standardTimer = CTimer::GetTimeInMilliseconds() + time;
+ m_chatTimer = CTimer::GetTimeInMilliseconds() + time;
if(!m_carInObjective->bIsVan && !m_carInObjective->bIsBus)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_HOOKERTALK, 4.0f);
@@ -9060,12 +8839,11 @@ CPed::SetSolicit(uint32 time)
}
}
-// --MIAMI: Done
void
CPed::Solicit(void)
{
- if (m_standardTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) {
- CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType, 0.0f);
+ if (m_chatTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) {
+ CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor, 0.0f);
Say(SOUND_PED_SOLICIT);
if (FindPlayerVehicle() == m_carInObjective) {
FindPlayerPed()->Say(SOUND_PED_SOLICIT);
@@ -9106,7 +8884,6 @@ CPed::Solicit(void)
}
}
-// --MIAMI: Done
void
CPed::SetBuyIceCream(void)
{
@@ -9119,13 +8896,12 @@ CPed::SetBuyIceCream(void)
SetPedState(PED_BUY_ICECREAM);
}
-// --MIAMI: Done
void
CPed::BuyIceCream(void)
{
if (m_carInObjective) {
CPed *driver = m_carInObjective->pDriver;
- if (driver && CTimer::GetTimeInMilliseconds() > m_standardTimer) {
+ if (driver && CTimer::GetTimeInMilliseconds() > m_chatTimer) {
SetChat(driver, 8000);
driver->SetChat(this, 8000);
return;
@@ -9138,7 +8914,6 @@ CPed::BuyIceCream(void)
}
}
-// --MIAMI: Done
bool
CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
{
@@ -9201,7 +8976,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
bool canHeadToRf = NTVF_RF <= 0.0f || NTVF_RF >= HALFPI;
// Only order of conditions are different among enterTypes.
- if (m_vehEnterType == CAR_DOOR_RR) {
+ if (m_vehDoor == CAR_DOOR_RR) {
if (canHeadToRr) {
foundPos = rightRearPos;
foundIt = true;
@@ -9215,7 +8990,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
foundPos = leftFrontPos;
foundIt = true;
}
- } else if(m_vehEnterType == CAR_DOOR_RF) {
+ } else if(m_vehDoor == CAR_DOOR_RF) {
if (canHeadToRf) {
foundPos = rightFrontPos;
foundIt = true;
@@ -9229,7 +9004,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
foundPos = leftRearPos;
foundIt = true;
}
- } else if (m_vehEnterType == CAR_DOOR_LF) {
+ } else if (m_vehDoor == CAR_DOOR_LF) {
if (canHeadToLf) {
foundPos = leftFrontPos;
foundIt = true;
@@ -9243,7 +9018,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
foundPos = rightRearPos;
foundIt = true;
}
- } else if (m_vehEnterType == CAR_DOOR_LR) {
+ } else if (m_vehDoor == CAR_DOOR_LR) {
if (canHeadToLr) {
foundPos = leftRearPos;
foundIt = true;
@@ -9272,7 +9047,6 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
return true;
}
-// --MIAMI: Done
void
CPed::SetLeader(CEntity *leader)
{
@@ -9284,7 +9058,6 @@ CPed::SetLeader(CEntity *leader)
}
}
-// --MIAMI: Done
bool
CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal)
{
@@ -9317,7 +9090,6 @@ CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal)
return CWorld::GetIsLineOfSightClear(pos, forwardPos, true, false, false, true, false, false, false);
}
-// --MIAMI: Done
void
CPed::SetJump(void)
{
@@ -9332,7 +9104,6 @@ CPed::SetJump(void)
}
}
-// --MIAMI: Done
void
CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg)
{
@@ -9442,7 +9213,6 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg)
}
}
-// --MIAMI: Done
void
CPed::FinishJumpCB(CAnimBlendAssociation *animAssoc, void *arg)
{
@@ -9454,7 +9224,6 @@ CPed::FinishJumpCB(CAnimBlendAssociation *animAssoc, void *arg)
animAssoc->blendDelta = -1000.0f;
}
-// --MIAMI: Done
void
CPed::FinishHitHeadCB(CAnimBlendAssociation *animAssoc, void *arg)
{
@@ -9471,7 +9240,6 @@ CPed::FinishHitHeadCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->bIsLanding = false;
}
-// --MIAMI: Done
bool
CPed::CanPedDriveOff(void)
{
@@ -9487,7 +9255,6 @@ CPed::CanPedDriveOff(void)
}
return true;
}
-// --MIAMI: Done
void
CPed::SetRadioStation(void)
{
@@ -9508,7 +9275,6 @@ CPed::SetRadioStation(void)
}
}
-// --MIAMI: Done
void
CPed::WarpPedIntoCar(CVehicle *car)
{
@@ -9576,14 +9342,12 @@ CPed::WarpPedIntoCar(CVehicle *car)
bChangedSeat = true;
}
-// --MIAMI: Done
bool
CPed::HasAttractor(void)
{
return m_attractor != nil;
}
-// --MIAMI: Done
void
CPed::SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float heading, float time, int32 qid)
{
@@ -9604,7 +9368,6 @@ CPed::SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float head
m_positionInQueue = qid;
}
-// --MIAMI: Done
void
CPed::AttachPedToEntity(CEntity *ent, CVector offset, uint16 type, float rot, eWeaponType weapon)
{
@@ -9652,7 +9415,6 @@ CPed::AttachPedToEntity(CEntity *ent, CVector offset, uint16 type, float rot, eW
PositionAttachedPed();
}
-// --MIAMI: Done
void
CPed::DettachPedFromEntity(void)
{
@@ -9676,7 +9438,6 @@ CPed::DettachPedFromEntity(void)
}
}
-// --MIAMI: Done
void
CPed::PositionAttachedPed()
{
@@ -9728,7 +9489,6 @@ CPed::PositionAttachedPed()
}
}
-// --MIAMI: Done
void
CPed::Undress(const char* name)
{
@@ -9744,7 +9504,6 @@ CPed::Undress(const char* name)
CWorld::Remove(this);
}
-// --MIAMI: Done
void
CPed::Dress(void)
{
@@ -9769,17 +9528,6 @@ CPed::Say(uint16 audio, int32 time)
}
}
-void
-CPed::SetWeaponLockOnTarget(CEntity *target)
-{
- if (m_pPointGunAt)
- m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
-
- m_pPointGunAt = (CPed*)target;
- if (target)
- ((CEntity*)target)->RegisterReference(&m_pPointGunAt);
-}
-
#ifdef COMPATIBLE_SAVES
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data));