mirror of
https://github.com/halpz/re3.git
synced 2025-07-03 19:40:48 +00:00
CGame done, Peds, fixes
This commit is contained in:
@ -23,6 +23,7 @@ CCivilianPed::CCivilianPed(ePedType pedtype, uint32 mi) : CPed(pedtype)
|
||||
m_bAttractorUnk = (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 1.25f);
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CCivilianPed::CivilianAI(void)
|
||||
{
|
||||
@ -39,7 +40,13 @@ CCivilianPed::CivilianAI(void)
|
||||
if (CTimer::GetTimeInMilliseconds() <= m_lookTimer)
|
||||
return;
|
||||
|
||||
uint32 closestThreatFlag = ScanForThreats();
|
||||
ScanForDelayedResponseThreats();
|
||||
if (!m_threatFlags || CTimer::GetTimeInMilliseconds() <= m_threatCheckTimer)
|
||||
return;
|
||||
CheckThreatValidity();
|
||||
uint32 closestThreatFlag = m_threatFlags;
|
||||
m_threatFlags = 0;
|
||||
m_threatCheckTimer = 0;
|
||||
if (closestThreatFlag == PED_FLAG_EXPLOSION) {
|
||||
float angleToFace = CGeneral::GetRadianAngleBetweenPoints(
|
||||
m_eventOrThreat.x, m_eventOrThreat.y,
|
||||
@ -53,18 +60,30 @@ CCivilianPed::CivilianAI(void)
|
||||
}
|
||||
return;
|
||||
}
|
||||
uint32 closestThreatFlag = ScanForThreats();
|
||||
ScanForDelayedResponseThreats();
|
||||
if (!m_threatFlags || CTimer::GetTimeInMilliseconds() <= m_threatCheckTimer)
|
||||
return;
|
||||
CheckThreatValidity();
|
||||
uint32 closestThreatFlag = m_threatFlags;
|
||||
m_threatFlags = 0;
|
||||
m_threatCheckTimer = 0;
|
||||
if (closestThreatFlag == PED_FLAG_GUN) {
|
||||
if (!m_threatEntity || !m_threatEntity->IsPed())
|
||||
return;
|
||||
|
||||
CPed *threatPed = (CPed*)m_threatEntity;
|
||||
float threatDistSqr = (m_threatEntity->GetPosition() - GetPosition()).MagnitudeSqr2D();
|
||||
if (CharCreatedBy == MISSION_CHAR && bCrouchWhenScared) {
|
||||
SetDuck(10000, true);
|
||||
SetLookFlag(m_threatEntity, false);
|
||||
SetLookTimer(500);
|
||||
return;
|
||||
}
|
||||
if (m_pedStats->m_fear <= m_pedStats->m_lawfulness) {
|
||||
if (m_pedStats->m_temper <= m_pedStats->m_fear) {
|
||||
if (!threatPed->IsPlayer() || !RunToReportCrime(CRIME_POSSESSION_GUN)) {
|
||||
if (threatDistSqr < sq(10.0f)) {
|
||||
Say(SOUND_PED_FLEE_SPRINT);
|
||||
if (threatDistSqr < sq(30.0f)) {
|
||||
bMakeFleeScream = true;
|
||||
SetFindPathAndFlee(m_threatEntity, 10000);
|
||||
} else {
|
||||
SetFindPathAndFlee(m_threatEntity->GetPosition(), 5000, true);
|
||||
@ -74,13 +93,16 @@ CCivilianPed::CivilianAI(void)
|
||||
SetFindPathAndFlee(m_threatEntity, 5000);
|
||||
if (threatDistSqr < sq(20.0f)) {
|
||||
SetMoveState(PEDMOVE_RUN);
|
||||
Say(SOUND_PED_FLEE_SPRINT);
|
||||
bMakeFleeScream = true;
|
||||
} else {
|
||||
SetMoveState(PEDMOVE_WALK);
|
||||
}
|
||||
} else if (threatPed->IsPlayer() && IsGangMember() && b158_80) {
|
||||
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity);
|
||||
|
||||
} else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
|
||||
SetFindPathAndFlee(m_threatEntity, 5000);
|
||||
if (threatDistSqr < sq(10.0f)) {
|
||||
if (threatDistSqr < sq(30.0f)) {
|
||||
SetMoveState(PEDMOVE_RUN);
|
||||
} else {
|
||||
SetMoveState(PEDMOVE_WALK);
|
||||
@ -89,12 +111,12 @@ CCivilianPed::CivilianAI(void)
|
||||
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity);
|
||||
}
|
||||
} else {
|
||||
if (threatDistSqr < sq(10.0f)) {
|
||||
Say(SOUND_PED_FLEE_SPRINT);
|
||||
if (threatDistSqr < sq(30.0f)) {
|
||||
bMakeFleeScream = true;
|
||||
SetFindPathAndFlee(m_threatEntity, 10000);
|
||||
SetMoveState(PEDMOVE_SPRINT);
|
||||
} else {
|
||||
Say(SOUND_PED_FLEE_SPRINT);
|
||||
bMakeFleeScream = false;
|
||||
SetFindPathAndFlee(m_threatEntity, 5000);
|
||||
SetMoveState(PEDMOVE_RUN);
|
||||
}
|
||||
@ -103,7 +125,10 @@ CCivilianPed::CivilianAI(void)
|
||||
SetLookTimer(500);
|
||||
} else if (closestThreatFlag == PED_FLAG_DEADPEDS) {
|
||||
float eventDistSqr = (m_pEventEntity->GetPosition() - GetPosition()).MagnitudeSqr2D();
|
||||
if (((CPed*)m_pEventEntity)->bIsDrowning || IsGangMember() && m_nPedType == ((CPed*)m_pEventEntity)->m_nPedType) {
|
||||
if (CharCreatedBy == MISSION_CHAR && bCrouchWhenScared && eventDistSqr < sq(5.0f)) {
|
||||
SetDuck(10000, true);
|
||||
|
||||
} else if (((CPed*)m_pEventEntity)->bIsDrowning || IsGangMember() && m_nPedType == ((CPed*)m_pEventEntity)->m_nPedType) {
|
||||
if (eventDistSqr < sq(5.0f)) {
|
||||
SetFindPathAndFlee(m_pEventEntity, 2000);
|
||||
SetMoveState(PEDMOVE_RUN);
|
||||
@ -128,8 +153,11 @@ CCivilianPed::CivilianAI(void)
|
||||
} else if (closestThreatFlag == PED_FLAG_EXPLOSION) {
|
||||
CVector2D eventDistVec = m_eventOrThreat - GetPosition();
|
||||
float eventDistSqr = eventDistVec.MagnitudeSqr();
|
||||
if (eventDistSqr < sq(20.0f)) {
|
||||
Say(SOUND_PED_FLEE_SPRINT);
|
||||
if (CharCreatedBy == MISSION_CHAR && bCrouchWhenScared && eventDistSqr < sq(20.0f)) {
|
||||
SetDuck(10000, true);
|
||||
|
||||
} else if (eventDistSqr < sq(20.0f)) {
|
||||
bMakeFleeScream = true;
|
||||
SetFlee(m_eventOrThreat, 2000);
|
||||
float angleToFace = CGeneral::GetRadianAngleBetweenPoints(
|
||||
m_eventOrThreat.x, m_eventOrThreat.y,
|
||||
@ -154,8 +182,11 @@ CCivilianPed::CivilianAI(void)
|
||||
if (m_threatEntity && m_threatEntity->IsPed()) {
|
||||
CPed *threatPed = (CPed*)m_threatEntity;
|
||||
if (m_pedStats->m_fear <= 100 - threatPed->m_pedStats->m_temper && threatPed->m_nPedType != PEDTYPE_COP) {
|
||||
if (threatPed->GetWeapon(m_currentWeapon).IsTypeMelee() || !GetWeapon()->IsTypeMelee()) {
|
||||
if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
|
||||
if (threatPed->GetWeapon()->IsTypeMelee() || !GetWeapon()->IsTypeMelee()) {
|
||||
if (threatPed->IsPlayer() && IsGangMember() && b158_80) {
|
||||
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity);
|
||||
|
||||
} else if (threatPed->IsPlayer() && FindPlayerPed()->m_pWanted->m_CurrentCops != 0) {
|
||||
if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) {
|
||||
SetFindPathAndFlee(m_threatEntity, 10000);
|
||||
}
|
||||
|
724
src/peds/Ped.cpp
724
src/peds/Ped.cpp
File diff suppressed because it is too large
Load Diff
@ -455,17 +455,17 @@ public:
|
||||
uint32 bTurnedAroundOnAttractor : 1;
|
||||
|
||||
uint32 bHasAlreadyUsedAttractor : 1;
|
||||
//uint32 b155_2
|
||||
uint32 b155_2 : 1;
|
||||
uint32 bCarPassenger : 1;
|
||||
//uint32 b155_8
|
||||
//uint32 b155_10
|
||||
uint32 b155_8 : 1;
|
||||
uint32 b155_10 : 1;
|
||||
uint32 bMiamiViceCop : 1;
|
||||
uint32 bMoneyHasBeenGivenByScript : 1; //
|
||||
uint32 bHasBeenPhotographed : 1; //
|
||||
|
||||
uint32 bIsDrowning : 1;
|
||||
uint32 bDrownsInWater : 1;
|
||||
//uint32 b156_4
|
||||
uint32 b156_4 : 1;
|
||||
uint32 bHeldHostageInCar : 1;
|
||||
uint32 bIsPlayerFriend : 1;
|
||||
uint32 bHeadStuckInCollision : 1;
|
||||
@ -475,7 +475,7 @@ public:
|
||||
uint32 bDontFight : 1;
|
||||
uint32 bDoomAim : 1;
|
||||
uint32 bCanBeShotInVehicle : 1;
|
||||
//uint32 b157_8
|
||||
uint32 b157_8 : 1;
|
||||
uint32 bMakeFleeScream : 1;
|
||||
uint32 bPushedAlongByCar : 1;
|
||||
uint32 b157_40 : 1;
|
||||
@ -488,7 +488,7 @@ public:
|
||||
uint32 bCollectBusFare : 1;
|
||||
uint32 bBoughtIceCream : 1;
|
||||
uint32 b158_40 : 1;
|
||||
//uint32 b158_80
|
||||
uint32 b158_80 : 1;
|
||||
|
||||
// our own flags
|
||||
uint32 m_ped_flagI80 : 1; // KANGAROO_CHEAT define makes use of this as cheat toggle
|
||||
@ -566,10 +566,9 @@ public:
|
||||
bool bInVehicle;
|
||||
float m_distanceToCountSeekDone;
|
||||
float m_acceptableHeadingOffset;
|
||||
CVehicle* m_vehicleInAccident;
|
||||
CPedAttractor* m_attractor;
|
||||
int32 m_positionInQueue;
|
||||
CVehicle* m_vehicleInAccident;
|
||||
|
||||
bool bRunningToPhone;
|
||||
int16 m_phoneId;
|
||||
eCrimeType m_crimeToReportOnPhone;
|
||||
@ -635,14 +634,16 @@ public:
|
||||
float m_attachRotStep;
|
||||
uint32 m_attachWepAmmo;
|
||||
uint32 m_threatFlags;
|
||||
uint32 m_threatCheck;
|
||||
uint32 m_lastThreatCheck;
|
||||
uint32 m_threatCheckTimer;
|
||||
uint32 m_threatCheckInterval;
|
||||
uint32 m_delayedSoundID;
|
||||
uint32 m_delayedSoundTimer;
|
||||
uint32 m_lastSoundStart;
|
||||
uint32 m_soundStart;
|
||||
uint16 m_lastQueuedSound;
|
||||
uint16 m_queuedSound;
|
||||
bool m_canTalk;
|
||||
int32 m_lastComment;
|
||||
CVector m_vecSeekPosEx; // used for OBJECTIVE_GUARD_SPOT
|
||||
float m_distanceToCountSeekDoneEx; // used for OBJECTIVE_GUARD_SPOT
|
||||
|
||||
@ -864,6 +865,7 @@ public:
|
||||
void DriveVehicle();
|
||||
void PositionAttachedPed();
|
||||
bool CanUseTorsoWhenLooking();
|
||||
void ScanForDelayedResponseThreats();
|
||||
|
||||
// Static methods
|
||||
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
|
||||
|
@ -376,7 +376,7 @@ CPopulation::FindClosestZoneForCoors(CVector *coors, int *safeZoneOut, eLevelNam
|
||||
}
|
||||
|
||||
void
|
||||
CPopulation::Update()
|
||||
CPopulation::Update(bool addPeds)
|
||||
{
|
||||
if (!CReplay::IsPlayingBack()) {
|
||||
ManagePopulation();
|
||||
@ -392,7 +392,7 @@ CPopulation::Update()
|
||||
ms_nTotalPeds = ms_nNumDummy + ms_nNumEmergency + ms_nNumCop
|
||||
+ ms_nTotalGangPeds + ms_nNumCivFemale + ms_nNumCivMale;
|
||||
ms_nTotalPeds -= ms_nTotalCarPassengerPeds;
|
||||
if (!CCutsceneMgr::IsRunning()) {
|
||||
if (!CCutsceneMgr::IsRunning() && addPeds) {
|
||||
float pcdm = PedCreationDistMultiplier();
|
||||
AddToPopulation(pcdm * (MIN_CREATION_DIST * TheCamera.GenerationDistMultiplier),
|
||||
pcdm * ((MIN_CREATION_DIST + CREATION_RANGE) * TheCamera.GenerationDistMultiplier),
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
static uint32 NumMiamiViceCops;
|
||||
|
||||
static void Initialise();
|
||||
static void Update(void);
|
||||
static void Update(bool);
|
||||
static void LoadPedGroups();
|
||||
static void UpdatePedCount(ePedType, bool);
|
||||
static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool);
|
||||
|
Reference in New Issue
Block a user