2019-06-30 10:59:55 +00:00
|
|
|
#include "common.h"
|
2020-04-17 13:31:11 +00:00
|
|
|
|
2019-06-30 10:59:55 +00:00
|
|
|
#include "EmergencyPed.h"
|
2020-03-28 14:47:52 +00:00
|
|
|
#include "DMAudio.h"
|
2019-07-14 09:49:03 +00:00
|
|
|
#include "ModelIndices.h"
|
2019-12-22 15:28:16 +00:00
|
|
|
#include "Vehicle.h"
|
|
|
|
#include "Fire.h"
|
|
|
|
#include "General.h"
|
|
|
|
#include "CarCtrl.h"
|
2020-01-11 12:50:11 +00:00
|
|
|
#include "Accident.h"
|
2019-07-14 12:00:36 +00:00
|
|
|
|
2019-07-14 09:49:03 +00:00
|
|
|
CEmergencyPed::CEmergencyPed(uint32 type) : CPed(type)
|
|
|
|
{
|
|
|
|
switch (type){
|
2019-12-22 15:28:16 +00:00
|
|
|
case PEDTYPE_EMERGENCY:
|
|
|
|
SetModelIndex(MI_MEDIC);
|
|
|
|
m_pRevivedPed = nil;
|
|
|
|
field_1360 = 0;
|
|
|
|
break;
|
|
|
|
case PEDTYPE_FIREMAN:
|
|
|
|
SetModelIndex(MI_FIREMAN);
|
|
|
|
m_pRevivedPed = nil;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2019-07-14 09:49:03 +00:00
|
|
|
}
|
2019-12-22 15:28:16 +00:00
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_READY;
|
2019-07-14 09:49:03 +00:00
|
|
|
m_pAttendedAccident = nil;
|
2019-12-22 15:28:16 +00:00
|
|
|
m_bStartedToCPR = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
CEmergencyPed::InRange(CPed *victim)
|
|
|
|
{
|
|
|
|
if (!m_pMyVehicle)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if ((m_pMyVehicle->GetPosition() - victim->GetPosition()).Magnitude() > 30.0f)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
2019-07-14 09:49:03 +00:00
|
|
|
}
|
|
|
|
|
2019-12-22 15:28:16 +00:00
|
|
|
void
|
|
|
|
CEmergencyPed::ProcessControl(void)
|
|
|
|
{
|
|
|
|
CPed::ProcessControl();
|
|
|
|
if (bWasPostponed)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(!DyingOrDead()) {
|
2020-05-17 17:36:48 +00:00
|
|
|
GetWeapon()->Update(m_audioEntityId, nil);
|
2019-12-22 15:28:16 +00:00
|
|
|
|
|
|
|
if (IsPedInControl() && m_moved.Magnitude() > 0.0f)
|
|
|
|
Avoid();
|
|
|
|
|
|
|
|
switch (m_nPedState) {
|
|
|
|
case PED_SEEK_POS:
|
|
|
|
Seek();
|
|
|
|
break;
|
|
|
|
case PED_SEEK_ENTITY:
|
|
|
|
if (m_pSeekTarget) {
|
|
|
|
m_vecSeekPos = m_pSeekTarget->GetPosition();
|
|
|
|
Seek();
|
|
|
|
} else {
|
|
|
|
ClearSeek();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (m_nPedType) {
|
|
|
|
case PEDTYPE_EMERGENCY:
|
|
|
|
if (IsPedInControl() || m_nPedState == PED_DRIVING)
|
|
|
|
MedicAI();
|
|
|
|
break;
|
|
|
|
case PEDTYPE_FIREMAN:
|
|
|
|
if (IsPedInControl())
|
|
|
|
FiremanAI();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// This function was buggy and incomplete in both III and VC, firemen had to be in 5.0m range of fire etc. etc.
|
|
|
|
// Copied some code from MedicAI to make it work.
|
|
|
|
void
|
|
|
|
CEmergencyPed::FiremanAI(void)
|
|
|
|
{
|
|
|
|
float fireDist;
|
|
|
|
CFire *nearestFire;
|
|
|
|
|
|
|
|
switch (m_nEmergencyPedState) {
|
|
|
|
case EMERGENCY_PED_READY:
|
|
|
|
nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist);
|
|
|
|
if (nearestFire) {
|
2020-10-21 18:27:13 +00:00
|
|
|
SetPedState(PED_NONE);
|
2019-12-22 15:28:16 +00:00
|
|
|
SetSeek(nearestFire->m_vecPos, 1.0f);
|
|
|
|
SetMoveState(PEDMOVE_RUN);
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
m_pAttendedFire = nearestFire;
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
bIsRunning = true;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_DETERMINE_NEXT_STATE:
|
|
|
|
nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist);
|
|
|
|
if (nearestFire && nearestFire != m_pAttendedFire) {
|
2020-10-21 18:27:13 +00:00
|
|
|
SetPedState(PED_NONE);
|
2019-12-22 15:28:16 +00:00
|
|
|
SetSeek(nearestFire->m_vecPos, 1.0f);
|
|
|
|
SetMoveState(PEDMOVE_RUN);
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
bIsRunning = true;
|
|
|
|
m_pAttendedFire = nearestFire;
|
|
|
|
} else if (!nearestFire) {
|
|
|
|
#else
|
|
|
|
m_pAttendedFire = nearestFire;
|
|
|
|
} else {
|
|
|
|
#endif
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_STOP;
|
|
|
|
}
|
|
|
|
|
|
|
|
// "Extinguish" the fire (Will overwrite the stop decision above if the attended and nearest fires are same)
|
|
|
|
if (fireDist < 5.0f) {
|
|
|
|
SetIdle();
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_STAND_STILL;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_STAND_STILL:
|
|
|
|
if (!m_pAttendedFire->m_bIsOngoing)
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_STOP;
|
|
|
|
|
|
|
|
// Leftover
|
|
|
|
// fireDist = 30.0f;
|
|
|
|
nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist);
|
|
|
|
if (nearestFire) {
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
if(nearestFire != m_pAttendedFire && (nearestFire->m_vecPos - GetPosition()).Magnitude() < 30.0f)
|
|
|
|
#endif
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
}
|
|
|
|
Say(SOUND_PED_EXTINGUISHING_FIRE);
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_STOP:
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
bIsRunning = false;
|
|
|
|
#endif
|
2020-10-21 18:27:13 +00:00
|
|
|
SetPedState(PED_NONE);
|
2019-12-22 15:28:16 +00:00
|
|
|
SetWanderPath(CGeneral::GetRandomNumber() & 7);
|
|
|
|
m_pAttendedFire = nil;
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_READY;
|
|
|
|
SetMoveState(PEDMOVE_WALK);
|
|
|
|
break;
|
2020-05-11 23:24:57 +00:00
|
|
|
default: break;
|
2019-12-22 15:28:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CEmergencyPed::MedicAI(void)
|
|
|
|
{
|
|
|
|
float distToEmergency;
|
|
|
|
if (!bInVehicle && IsPedInControl()) {
|
2020-10-21 18:27:13 +00:00
|
|
|
ScanForDelayedResponseThreats();
|
|
|
|
if (m_threatFlags && CTimer::GetTimeInMilliseconds() > m_threatCheckTimer) {
|
|
|
|
CheckThreatValidity();
|
|
|
|
m_threatFlags = 0;
|
|
|
|
m_threatCheckTimer = 0;
|
|
|
|
if (m_threatEntity && m_threatEntity->IsPed() && ((CPed*)m_threatEntity)->IsPlayer()) {
|
|
|
|
if (((CPed*)m_threatEntity)->GetWeapon()->IsTypeMelee()) {
|
|
|
|
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, m_threatEntity);
|
|
|
|
} else {
|
|
|
|
SetFlee(m_threatEntity, 6000);
|
|
|
|
Say(SOUND_PED_FLEE_SPRINT);
|
|
|
|
}
|
|
|
|
return;
|
2019-12-22 15:28:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (InVehicle()) {
|
2020-06-22 01:02:44 +00:00
|
|
|
if (m_pMyVehicle->IsCar() && m_objective != OBJECTIVE_LEAVE_CAR) {
|
2019-12-22 15:28:16 +00:00
|
|
|
if (gAccidentManager.FindNearestAccident(m_pMyVehicle->GetPosition(), &distToEmergency)
|
|
|
|
&& distToEmergency < 25.0f && m_pMyVehicle->m_vecMoveSpeed.Magnitude() < 0.01f) {
|
|
|
|
|
|
|
|
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
2020-06-22 01:02:44 +00:00
|
|
|
SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
|
2019-12-22 15:28:16 +00:00
|
|
|
Say(SOUND_PED_LEAVE_VEHICLE);
|
|
|
|
} else if (m_pMyVehicle->pDriver == this && m_nPedState == PED_DRIVING
|
|
|
|
&& m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_NONE && !(CGeneral::GetRandomNumber() & 31)) {
|
|
|
|
|
|
|
|
bool waitUntilMedicEntersCar = false;
|
|
|
|
for (int i = 0; i < m_numNearPeds; ++i) {
|
|
|
|
CPed *nearPed = m_nearPeds[i];
|
|
|
|
if (nearPed->m_nPedType == PEDTYPE_EMERGENCY) {
|
|
|
|
if ((nearPed->m_nPedState == PED_SEEK_CAR || nearPed->m_nPedState == PED_ENTER_CAR)
|
|
|
|
&& nearPed->m_pMyVehicle == m_pMyVehicle) {
|
|
|
|
waitUntilMedicEntersCar = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!waitUntilMedicEntersCar) {
|
|
|
|
CCarCtrl::JoinCarWithRoadSystem(m_pMyVehicle);
|
|
|
|
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
|
|
|
m_pMyVehicle->m_bSirenOrAlarm = 0;
|
|
|
|
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 12;
|
|
|
|
m_pMyVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_SLOW_DOWN_FOR_CARS;
|
|
|
|
if (m_pMyVehicle->bIsAmbulanceOnDuty) {
|
|
|
|
m_pMyVehicle->bIsAmbulanceOnDuty = false;
|
|
|
|
--CCarCtrl::NumAmbulancesOnDuty;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CVector headPos, midPos;
|
|
|
|
CAccident *nearestAccident;
|
|
|
|
if (IsPedInControl()) {
|
|
|
|
switch (m_nEmergencyPedState) {
|
|
|
|
case EMERGENCY_PED_READY:
|
|
|
|
nearestAccident = gAccidentManager.FindNearestAccident(GetPosition(), &distToEmergency);
|
|
|
|
field_1360 = 0;
|
|
|
|
if (nearestAccident) {
|
|
|
|
m_pRevivedPed = nearestAccident->m_pVictim;
|
|
|
|
m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed);
|
2020-12-18 00:58:09 +00:00
|
|
|
m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
|
|
|
|
m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
|
2020-10-21 18:27:13 +00:00
|
|
|
SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
|
2019-12-22 15:28:16 +00:00
|
|
|
bIsRunning = true;
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
m_pAttendedAccident = nearestAccident;
|
|
|
|
++m_pAttendedAccident->m_nMedicsAttending;
|
|
|
|
} else {
|
|
|
|
if (m_pMyVehicle) {
|
|
|
|
if (!bInVehicle) {
|
|
|
|
if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || m_pMyVehicle->pDriver || m_pMyVehicle->m_nGettingInFlags) {
|
|
|
|
|
|
|
|
CPed* driver = m_pMyVehicle->pDriver;
|
|
|
|
if (driver && driver->m_nPedType != PEDTYPE_EMERGENCY && m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
|
|
|
|
SetObjective(OBJECTIVE_KILL_CHAR_ON_FOOT, driver);
|
2020-10-21 18:27:13 +00:00
|
|
|
|
2019-12-22 15:28:16 +00:00
|
|
|
} else if (m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER
|
|
|
|
&& m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER
|
|
|
|
&& m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
|
|
|
|
SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, m_pMyVehicle);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, m_pMyVehicle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (m_nPedState != PED_WANDER_PATH) {
|
|
|
|
SetWanderPath(CGeneral::GetRandomNumber() & 7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_DETERMINE_NEXT_STATE:
|
|
|
|
nearestAccident = gAccidentManager.FindNearestAccident(GetPosition(), &distToEmergency);
|
|
|
|
if (nearestAccident) {
|
|
|
|
if (nearestAccident != m_pAttendedAccident || m_nPedState != PED_SEEK_POS) {
|
|
|
|
m_pRevivedPed = nearestAccident->m_pVictim;
|
|
|
|
m_pRevivedPed->RegisterReference((CEntity**)&m_pRevivedPed);
|
|
|
|
if (!InRange(m_pRevivedPed)) {
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_STOP;
|
|
|
|
break;
|
|
|
|
}
|
2020-12-18 00:58:09 +00:00
|
|
|
m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
|
|
|
|
m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
|
2020-10-21 18:27:13 +00:00
|
|
|
SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector((headPos + midPos) * 0.5f));
|
2019-12-22 15:28:16 +00:00
|
|
|
bIsRunning = true;
|
|
|
|
--m_pAttendedAccident->m_nMedicsAttending;
|
|
|
|
++nearestAccident->m_nMedicsAttending;
|
|
|
|
m_pAttendedAccident = nearestAccident;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_STOP;
|
|
|
|
bIsRunning = false;
|
|
|
|
}
|
|
|
|
if (distToEmergency < 5.0f) {
|
|
|
|
if (m_pRevivedPed->m_pFire) {
|
|
|
|
bIsRunning = false;
|
|
|
|
SetMoveState(PEDMOVE_STILL);
|
|
|
|
} else if (distToEmergency < 4.5f) {
|
|
|
|
bIsRunning = false;
|
|
|
|
SetMoveState(PEDMOVE_WALK);
|
|
|
|
if (distToEmergency < 1.0f
|
|
|
|
|| distToEmergency < 4.5f && m_pAttendedAccident->m_nMedicsPerformingCPR) {
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_START_CPR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_START_CPR:
|
|
|
|
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f || m_pRevivedPed->bFadeOut) {
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
} else {
|
2020-03-07 19:22:43 +00:00
|
|
|
m_pRevivedPed->m_bloodyFootprintCountOrDeathTime = CTimer::GetTimeInMilliseconds();
|
2019-12-22 15:28:16 +00:00
|
|
|
SetMoveState(PEDMOVE_STILL);
|
2020-10-21 18:27:13 +00:00
|
|
|
SetPedState(PED_CPR);
|
2019-12-22 15:28:16 +00:00
|
|
|
m_nLastPedState = PED_CPR;
|
|
|
|
SetLookFlag(m_pRevivedPed, 0);
|
|
|
|
SetLookTimer(500);
|
2020-10-21 18:27:13 +00:00
|
|
|
Say(SOUND_PED_HEALING);
|
2019-12-22 15:28:16 +00:00
|
|
|
if (m_pAttendedAccident->m_nMedicsPerformingCPR) {
|
|
|
|
SetIdle();
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_STAND_STILL;
|
|
|
|
} else {
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_FACE_TO_PATIENT;
|
2021-01-27 16:50:24 +00:00
|
|
|
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_MEDIC, ANIM_MEDIC_CPR, 4.0f);
|
2019-12-22 15:28:16 +00:00
|
|
|
bIsDucking = true;
|
|
|
|
}
|
|
|
|
SetLookTimer(2000);
|
|
|
|
++m_pAttendedAccident->m_nMedicsPerformingCPR;
|
|
|
|
m_bStartedToCPR = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_FACE_TO_PATIENT:
|
|
|
|
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f)
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
else {
|
2020-12-18 00:58:09 +00:00
|
|
|
m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
|
|
|
|
m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
|
2019-12-22 15:28:16 +00:00
|
|
|
midPos = (headPos + midPos) * 0.5f;
|
|
|
|
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
|
|
|
|
midPos.x, midPos.y,
|
|
|
|
GetPosition().x, GetPosition().y);
|
|
|
|
m_fRotationDest = CGeneral::LimitAngle(m_fRotationDest);
|
|
|
|
m_pLookTarget = m_pRevivedPed;
|
|
|
|
m_pLookTarget->RegisterReference((CEntity**)&m_pLookTarget);
|
|
|
|
TurnBody();
|
|
|
|
|
|
|
|
if (Abs(m_fRotationCur - m_fRotationDest) < DEGTORAD(45.0f))
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_PERFORM_CPR;
|
|
|
|
else
|
|
|
|
m_fRotationCur = (m_fRotationCur + m_fRotationDest) * 0.5f;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_PERFORM_CPR:
|
|
|
|
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f) {
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
break;
|
|
|
|
}
|
2020-12-18 00:58:09 +00:00
|
|
|
m_pRevivedPed->m_pedIK.GetComponentPosition(midPos, PED_MID);
|
|
|
|
m_pRevivedPed->m_pedIK.GetComponentPosition(headPos, PED_HEAD);
|
2019-12-22 15:28:16 +00:00
|
|
|
midPos = (headPos + midPos) * 0.5f;
|
|
|
|
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(
|
|
|
|
midPos.x, midPos.y,
|
|
|
|
GetPosition().x, GetPosition().y);
|
|
|
|
m_fRotationDest = CGeneral::LimitAngle(m_fRotationDest);
|
|
|
|
m_pLookTarget = m_pRevivedPed;
|
|
|
|
m_pLookTarget->RegisterReference((CEntity**)&m_pLookTarget);
|
|
|
|
TurnBody();
|
|
|
|
if (CTimer::GetTimeInMilliseconds() <= m_lookTimer) {
|
|
|
|
SetMoveState(PEDMOVE_STILL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_STOP_CPR;
|
2020-10-21 18:27:13 +00:00
|
|
|
SetPedState(PED_NONE);
|
2019-12-22 15:28:16 +00:00
|
|
|
SetMoveState(PEDMOVE_WALK);
|
|
|
|
m_pVehicleAnim = nil;
|
|
|
|
if (!m_pRevivedPed->bBodyPartJustCameOff) {
|
|
|
|
m_pRevivedPed->m_fHealth = 100.0f;
|
2020-10-21 18:27:13 +00:00
|
|
|
m_pRevivedPed->SetPedState(PED_NONE);
|
2019-12-22 15:28:16 +00:00
|
|
|
m_pRevivedPed->m_nLastPedState = PED_WANDER_PATH;
|
|
|
|
m_pRevivedPed->SetGetUp();
|
|
|
|
m_pRevivedPed->bUsesCollision = true;
|
|
|
|
m_pRevivedPed->SetMoveState(PEDMOVE_WALK);
|
|
|
|
m_pRevivedPed->RestartNonPartialAnims();
|
|
|
|
m_pRevivedPed->bIsPedDieAnimPlaying = false;
|
2020-03-02 00:03:39 +00:00
|
|
|
m_pRevivedPed->bKnockedUpIntoAir = false;
|
2019-12-22 15:28:16 +00:00
|
|
|
m_pRevivedPed->m_pCollidingEntity = nil;
|
2020-10-21 18:27:13 +00:00
|
|
|
m_pRevivedPed->bKnockedOffBike = false;
|
|
|
|
m_pRevivedPed->Say(SOUND_PED_ACCIDENTREACTION1);
|
2019-12-22 15:28:16 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_STOP_CPR:
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_STOP;
|
|
|
|
bIsDucking = true;
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_STAND_STILL:
|
|
|
|
if (!m_pRevivedPed || m_pRevivedPed->m_fHealth > 0.0f)
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
else {
|
|
|
|
if (!m_pAttendedAccident->m_pVictim)
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
if (!m_pAttendedAccident->m_nMedicsPerformingCPR)
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
if (gAccidentManager.UnattendedAccidents())
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EMERGENCY_PED_STOP:
|
|
|
|
m_bStartedToCPR = false;
|
2020-10-21 18:27:13 +00:00
|
|
|
SetPedState(PED_NONE);
|
2019-12-22 15:28:16 +00:00
|
|
|
if (m_pAttendedAccident) {
|
|
|
|
m_pAttendedAccident->m_pVictim = nil;
|
|
|
|
--m_pAttendedAccident->m_nMedicsAttending;
|
|
|
|
m_pAttendedAccident = nil;
|
|
|
|
}
|
|
|
|
SetWanderPath(CGeneral::GetRandomNumber() & 7);
|
|
|
|
m_pRevivedPed = nil;
|
|
|
|
m_nEmergencyPedState = EMERGENCY_PED_READY;
|
|
|
|
SetMoveState(PEDMOVE_WALK);
|
|
|
|
break;
|
2020-05-11 23:24:57 +00:00
|
|
|
default: break;
|
2019-12-22 15:28:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|