Bettah car enter canceling, fix CFO crash, ped objs. renaming

This commit is contained in:
eray orçunus 2020-07-03 16:51:33 +03:00
parent ed036df3ce
commit 15548758ac
17 changed files with 150 additions and 126 deletions

View File

@ -509,14 +509,14 @@ void CCarAI::AddFiretruckOccupants(CVehicle* pVehicle)
void CCarAI::TellOccupantsToLeaveCar(CVehicle* pVehicle) void CCarAI::TellOccupantsToLeaveCar(CVehicle* pVehicle)
{ {
if (pVehicle->pDriver){ if (pVehicle->pDriver){
pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle); pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
if (pVehicle->GetModelIndex() == MI_AMBULAN) if (pVehicle->GetModelIndex() == MI_AMBULAN)
pVehicle->pDriver->Say(SOUND_PED_LEAVE_VEHICLE); pVehicle->pDriver->Say(SOUND_PED_LEAVE_VEHICLE);
} }
int timer = 100; int timer = 100;
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++){ for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++){
if (pVehicle->pPassengers[i]) { if (pVehicle->pPassengers[i]) {
pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle); pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
} }
} }
} }

View File

@ -1175,7 +1175,7 @@ bool CGarage::IsStaticPlayerCarEntirelyInside()
return false; return false;
if (FindPlayerPed()->GetPedState() != PED_DRIVING) if (FindPlayerPed()->GetPedState() != PED_DRIVING)
return false; return false;
if (FindPlayerPed()->m_objective == OBJECTIVE_LEAVE_VEHICLE) if (FindPlayerPed()->m_objective == OBJECTIVE_LEAVE_CAR)
return false; return false;
CVehicle* pVehicle = FindPlayerVehicle(); CVehicle* pVehicle = FindPlayerVehicle();
if (pVehicle->GetPosition().x < m_fX1 || pVehicle->GetPosition().x > m_fX2 || if (pVehicle->GetPosition().x < m_fX1 || pVehicle->GetPosition().x > m_fX2 ||

View File

@ -39,7 +39,7 @@ CPed* crimeReporters[NUMPHONES] = {};
bool bool
isPhoneAvailable(int m_phoneId) isPhoneAvailable(int m_phoneId)
{ {
return crimeReporters[m_phoneId] == nil || !crimeReporters[m_phoneId]->IsPointerValid() || crimeReporters[m_phoneId]->m_objective > OBJECTIVE_IDLE || return crimeReporters[m_phoneId] == nil || !crimeReporters[m_phoneId]->IsPointerValid() || crimeReporters[m_phoneId]->m_objective > OBJECTIVE_WAIT_ON_FOOT ||
crimeReporters[m_phoneId]->m_nLastPedState != PED_SEEK_POS && crimeReporters[m_phoneId]->m_nLastPedState != PED_SEEK_POS &&
(crimeReporters[m_phoneId]->m_nPedState != PED_MAKE_CALL && crimeReporters[m_phoneId]->m_nPedState != PED_FACE_PHONE && crimeReporters[m_phoneId]->m_nPedState != PED_SEEK_POS); (crimeReporters[m_phoneId]->m_nPedState != PED_MAKE_CALL && crimeReporters[m_phoneId]->m_nPedState != PED_FACE_PHONE && crimeReporters[m_phoneId]->m_nPedState != PED_SEEK_POS);
} }

View File

@ -631,7 +631,7 @@ void CSceneEdit::ProcessCommand(void)
SelectActor(); SelectActor();
if (m_bActorSelected) { if (m_bActorSelected) {
if (pActors[m_nActor]->bInVehicle) { if (pActors[m_nActor]->bInVehicle) {
pActors[m_nActor]->SetObjective(OBJECTIVE_LEAVE_VEHICLE); pActors[m_nActor]->SetObjective(OBJECTIVE_LEAVE_CAR);
Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_GET_OUT_CAR; Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_GET_OUT_CAR;
Movie[m_nNumMovieCommands++].m_nActorId = m_nActor; Movie[m_nNumMovieCommands++].m_nActorId = m_nActor;
} }
@ -695,7 +695,7 @@ void CSceneEdit::ProcessCommand(void)
case MOVIE_WAIT: case MOVIE_WAIT:
SelectActor(); SelectActor();
if (m_bActorSelected) { if (m_bActorSelected) {
pActors[m_nActor]->SetObjective(OBJECTIVE_IDLE); pActors[m_nActor]->SetObjective(OBJECTIVE_WAIT_ON_FOOT);
Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_WAIT; Movie[m_nNumMovieCommands].m_nCommandId = MOVIE_WAIT;
Movie[m_nNumMovieCommands++].m_nActorId = m_nActor; Movie[m_nNumMovieCommands++].m_nActorId = m_nActor;
} }
@ -876,7 +876,7 @@ void CSceneEdit::PlayBack(void)
case MOVIE_GET_OUT_CAR: case MOVIE_GET_OUT_CAR:
m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId; m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId;
if (pActors[m_nActor]->bInVehicle) if (pActors[m_nActor]->bInVehicle)
pActors[m_nActor]->SetObjective(OBJECTIVE_LEAVE_VEHICLE); pActors[m_nActor]->SetObjective(OBJECTIVE_LEAVE_CAR);
else else
++m_nCurrentMovieCommand; ++m_nCurrentMovieCommand;
break; break;
@ -895,7 +895,7 @@ void CSceneEdit::PlayBack(void)
break; break;
case MOVIE_WAIT: case MOVIE_WAIT:
m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId; m_nActor = Movie[m_nCurrentMovieCommand].m_nActorId;
pActors[m_nActor]->SetObjective(OBJECTIVE_IDLE); pActors[m_nActor]->SetObjective(OBJECTIVE_WAIT_ON_FOOT);
++m_nCurrentMovieCommand; ++m_nCurrentMovieCommand;
break; break;
case MOVIE_POSITION_CAMERA: case MOVIE_POSITION_CAMERA:

View File

@ -3326,7 +3326,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
script_assert(ped); script_assert(ped);
ped->bScriptObjectiveCompleted = false; ped->bScriptObjectiveCompleted = false;
ped->SetObjective(OBJECTIVE_IDLE); ped->SetObjective(OBJECTIVE_WAIT_ON_FOOT);
return 0; return 0;
} }
case COMMAND_GET_CHAR_COORDINATES: case COMMAND_GET_CHAR_COORDINATES:
@ -5128,7 +5128,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
script_assert(pPed); script_assert(pPed);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_IDLE); pPed->SetObjective(OBJECTIVE_WAIT_ON_FOOT);
return 0; return 0;
} }
case COMMAND_SET_CHAR_OBJ_FLEE_ON_FOOT_TILL_SAFE: case COMMAND_SET_CHAR_OBJ_FLEE_ON_FOOT_TILL_SAFE:
@ -5620,7 +5620,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
script_assert(pPed); script_assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle); pPed->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
return 0; return 0;
} }
case COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_PASSENGER: case COMMAND_SET_CHAR_OBJ_ENTER_CAR_AS_PASSENGER:
@ -7823,7 +7823,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
script_assert(pPed); script_assert(pPed);
CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, pTargetPed); pPed->SetObjective(OBJECTIVE_FOLLOW_CHAR_IN_FORMATION, pTargetPed);
pPed->SetFormation((eFormation)ScriptParams[2]); pPed->SetFormation((eFormation)ScriptParams[2]);
return 0; return 0;
} }
@ -10870,13 +10870,13 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
script_assert(pVehicle); script_assert(pVehicle);
if (pVehicle->pDriver) { if (pVehicle->pDriver) {
pVehicle->pDriver->bScriptObjectiveCompleted = false; pVehicle->pDriver->bScriptObjectiveCompleted = false;
pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle); pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
} }
for (int i = 0; i < ARRAY_SIZE(pVehicle->pPassengers); i++) for (int i = 0; i < ARRAY_SIZE(pVehicle->pPassengers); i++)
{ {
if (pVehicle->pPassengers[i]) { if (pVehicle->pPassengers[i]) {
pVehicle->pPassengers[i]->bScriptObjectiveCompleted = false; pVehicle->pPassengers[i]->bScriptObjectiveCompleted = false;
pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle); pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
} }
} }
return 0; return 0;
@ -13100,7 +13100,7 @@ void CTheScripts::CleanUpThisPed(CPed* pPed)
} }
else { else {
if (pPed->m_pMyVehicle->m_vehType == VEHICLE_TYPE_CAR) { if (pPed->m_pMyVehicle->m_vehType == VEHICLE_TYPE_CAR) {
pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pPed->m_pMyVehicle); pPed->SetObjective(OBJECTIVE_LEAVE_CAR, pPed->m_pMyVehicle);
pPed->bWanderPathAfterExitingCar = true; pPed->bWanderPathAfterExitingCar = true;
} }
} }

View File

@ -5060,7 +5060,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
// This is not working on cars as SA // This is not working on cars as SA
// Because III/VC doesn't have any buttons tied to LeftStick if you're not in Classic Configuration, using Dodo or using GInput/Pad, so :shrug: // Because III/VC doesn't have any buttons tied to LeftStick if you're not in Classic Configuration, using Dodo or using GInput/Pad, so :shrug:
if (Abs(pad->GetSteeringUpDown()) > 120.0f) { if (Abs(pad->GetSteeringUpDown()) > 120.0f) {
if (car->pDriver && car->pDriver->m_objective != OBJECTIVE_LEAVE_VEHICLE) { if (car->pDriver && car->pDriver->m_objective != OBJECTIVE_LEAVE_CAR) {
yMovement += Abs(pad->GetSteeringUpDown()) * (FOV / 80.0f * 3.f / 70.f) * pad->GetSteeringUpDown() * 0.007f * 0.007f * 0.5; yMovement += Abs(pad->GetSteeringUpDown()) * (FOV / 80.0f * 3.f / 70.f) * pad->GetSteeringUpDown() * 0.007f * 0.007f * 0.5;
} }
} }

View File

@ -3068,7 +3068,6 @@ CMenuManager::InitialiseChangedLanguageSettings()
} }
#ifdef CUSTOM_FRONTEND_OPTIONS #ifdef CUSTOM_FRONTEND_OPTIONS
RemoveCustomFrontendOptions();
CustomFrontendOptionsPopulate(); CustomFrontendOptionsPopulate();
#endif #endif
} }

View File

@ -409,7 +409,7 @@ CPlayerInfo::Process(void)
if (veh->m_vehType != VEHICLE_TYPE_BIKE || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) { if (veh->m_vehType != VEHICLE_TYPE_BIKE || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
if (veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) { if (veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) {
if (veh->m_vecMoveSpeed.Magnitude() < 0.17f && CTimer::GetTimeScale() >= 0.5f && !veh->bIsInWater) { if (veh->m_vecMoveSpeed.Magnitude() < 0.17f && CTimer::GetTimeScale() >= 0.5f && !veh->bIsInWater) {
m_pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); m_pPed->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
} }
} }
} else { } else {

View File

@ -75,7 +75,6 @@ mysrand(unsigned int seed)
void ReloadFrontendOptions(void) void ReloadFrontendOptions(void)
{ {
RemoveCustomFrontendOptions();
CustomFrontendOptionsPopulate(); CustomFrontendOptionsPopulate();
} }
@ -137,6 +136,8 @@ void ToggleFreeCam(int8 action)
void void
CustomFrontendOptionsPopulate(void) CustomFrontendOptionsPopulate(void)
{ {
RemoveCustomFrontendOptions(); // if exist
#ifdef MORE_LANGUAGES #ifdef MORE_LANGUAGES
FrontendOptionSetPosition(MENUPAGE_LANGUAGE_SETTINGS); FrontendOptionSetPosition(MENUPAGE_LANGUAGE_SETTINGS);
FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, LangPolSelect, nil); FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, LangPolSelect, nil);

View File

@ -43,10 +43,13 @@ GetNumberOfMenuOptions(int screen)
return Rows; return Rows;
} }
// Used before reloading in InitialiseChangedLanguageSettings and debugmenu // Used before populating options, but effective in InitialiseChangedLanguageSettings and debugmenu
void void
RemoveCustomFrontendOptions() RemoveCustomFrontendOptions()
{ {
if (numCustomFrontendOptions == 0)
return;
for (int i = 0; i < MENUPAGES; i++) { for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) { for (int j = 0; j < NUM_MENUROWS; j++) {
if (aScreens[i].m_aEntries[j].m_Action == MENUACTION_TRIGGERFUNC) { if (aScreens[i].m_aEntries[j].m_Action == MENUACTION_TRIGGERFUNC) {

View File

@ -263,7 +263,7 @@ CCivilianPed::ProcessControl(void)
if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA) && m_pNextPathNode) { if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA) && m_pNextPathNode) {
m_pNextPathNode = nil; m_pNextPathNode = nil;
#ifdef PEDS_REPORT_CRIMES_ON_PHONE #ifdef PEDS_REPORT_CRIMES_ON_PHONE
} else if (bRunningToPhone && m_objective < OBJECTIVE_FLEE_TILL_SAFE) { } else if (bRunningToPhone && m_objective < OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE) {
if (!isPhoneAvailable(m_phoneId)) { if (!isPhoneAvailable(m_phoneId)) {
RestorePreviousState(); RestorePreviousState();
if (crimeReporters[m_phoneId] == this) if (crimeReporters[m_phoneId] == this)
@ -287,7 +287,7 @@ CCivilianPed::ProcessControl(void)
} }
#endif #endif
} else if (m_objective != OBJECTIVE_KILL_CHAR_ANY_MEANS && m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) { } else if (m_objective != OBJECTIVE_KILL_CHAR_ANY_MEANS && m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
if (m_objective == OBJECTIVE_FOLLOW_PED_IN_FORMATION) { if (m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION) {
if (m_moved.Magnitude() == 0.0f) { if (m_moved.Magnitude() == 0.0f) {
if (m_pedInObjective->m_nMoveState == PEDMOVE_STILL) if (m_pedInObjective->m_nMoveState == PEDMOVE_STILL)
m_fRotationDest = m_pedInObjective->m_fRotationCur; m_fRotationDest = m_pedInObjective->m_fRotationCur;
@ -377,13 +377,13 @@ CCivilianPed::ProcessControl(void)
} else { } else {
bWanderPathAfterExitingCar = true; bWanderPathAfterExitingCar = true;
CWorld::Players[CWorld::PlayerInFocus].m_pHooker = nil; CWorld::Players[CWorld::PlayerInFocus].m_pHooker = nil;
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} }
} else { } else {
bWanderPathAfterExitingCar = true; bWanderPathAfterExitingCar = true;
CWorld::Players[CWorld::PlayerInFocus].m_pHooker = nil; CWorld::Players[CWorld::PlayerInFocus].m_pHooker = nil;
m_pMyVehicle->pDriver->m_fHealth = 125.0f; m_pMyVehicle->pDriver->m_fHealth = 125.0f;
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} }
} else { } else {
CWorld::Players[CWorld::PlayerInFocus].m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + 3000; CWorld::Players[CWorld::PlayerInFocus].m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + 3000;
@ -396,7 +396,7 @@ CCivilianPed::ProcessControl(void)
} else { } else {
bWanderPathAfterExitingCar = true; bWanderPathAfterExitingCar = true;
CWorld::Players[CWorld::PlayerInFocus].m_pHooker = nil; CWorld::Players[CWorld::PlayerInFocus].m_pHooker = nil;
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} }
} }

View File

@ -188,12 +188,12 @@ CEmergencyPed::MedicAI(void)
} }
if (InVehicle()) { if (InVehicle()) {
if (m_pMyVehicle->IsCar() && m_objective != OBJECTIVE_LEAVE_VEHICLE) { if (m_pMyVehicle->IsCar() && m_objective != OBJECTIVE_LEAVE_CAR) {
if (gAccidentManager.FindNearestAccident(m_pMyVehicle->GetPosition(), &distToEmergency) if (gAccidentManager.FindNearestAccident(m_pMyVehicle->GetPosition(), &distToEmergency)
&& distToEmergency < 25.0f && m_pMyVehicle->m_vecMoveSpeed.Magnitude() < 0.01f) { && distToEmergency < 25.0f && m_pMyVehicle->m_vecMoveSpeed.Magnitude() < 0.01f) {
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE; m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
Say(SOUND_PED_LEAVE_VEHICLE); Say(SOUND_PED_LEAVE_VEHICLE);
} else if (m_pMyVehicle->pDriver == this && m_nPedState == PED_DRIVING } else if (m_pMyVehicle->pDriver == this && m_nPedState == PED_DRIVING
&& m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_NONE && !(CGeneral::GetRandomNumber() & 31)) { && m_pMyVehicle->AutoPilot.m_nCarMission == MISSION_NONE && !(CGeneral::GetRandomNumber() & 31)) {

View File

@ -2403,7 +2403,7 @@ CPed::CanSeeEntity(CEntity *entity, float threshold = CAN_SEE_ENTITY_ANGLE_THRES
bool bool
CPed::IsTemporaryObjective(eObjective objective) CPed::IsTemporaryObjective(eObjective objective)
{ {
return objective == OBJECTIVE_LEAVE_VEHICLE || objective == OBJECTIVE_SET_LEADER || return objective == OBJECTIVE_LEAVE_CAR || objective == OBJECTIVE_SET_LEADER ||
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
objective == OBJECTIVE_LEAVE_CAR_AND_DIE || objective == OBJECTIVE_LEAVE_CAR_AND_DIE ||
#endif #endif
@ -2436,7 +2436,7 @@ CPed::ForceStoredObjective(eObjective objective)
switch (m_objective) switch (m_objective)
{ {
case OBJECTIVE_FLEE_TILL_SAFE: case OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE:
case OBJECTIVE_KILL_CHAR_ON_FOOT: case OBJECTIVE_KILL_CHAR_ON_FOOT:
case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE: case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE:
case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS: case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS:
@ -2459,14 +2459,14 @@ CPed::SetStoredObjective(void)
switch (m_objective) switch (m_objective)
{ {
case OBJECTIVE_FLEE_TILL_SAFE: case OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE:
case OBJECTIVE_KILL_CHAR_ON_FOOT: case OBJECTIVE_KILL_CHAR_ON_FOOT:
case OBJECTIVE_KILL_CHAR_ANY_MEANS: case OBJECTIVE_KILL_CHAR_ANY_MEANS:
case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE: case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE:
case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS: case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS:
case OBJECTIVE_GOTO_CHAR_ON_FOOT: case OBJECTIVE_GOTO_CHAR_ON_FOOT:
case OBJECTIVE_FOLLOW_PED_IN_FORMATION: case OBJECTIVE_FOLLOW_CHAR_IN_FORMATION:
case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_LEAVE_CAR:
case OBJECTIVE_ENTER_CAR_AS_PASSENGER: case OBJECTIVE_ENTER_CAR_AS_PASSENGER:
case OBJECTIVE_ENTER_CAR_AS_DRIVER: case OBJECTIVE_ENTER_CAR_AS_DRIVER:
case OBJECTIVE_GOTO_AREA_ON_FOOT: case OBJECTIVE_GOTO_AREA_ON_FOOT:
@ -2483,17 +2483,17 @@ CPed::RestorePreviousObjective(void)
if (m_objective == OBJECTIVE_NONE) if (m_objective == OBJECTIVE_NONE)
return; return;
if (m_objective != OBJECTIVE_LEAVE_VEHICLE && m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER if (m_objective != OBJECTIVE_LEAVE_CAR && m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER
#if defined VC_PED_PORTS || defined FIX_BUGS #if defined VC_PED_PORTS || defined FIX_BUGS
&& m_nPedState != PED_CARJACK && m_nPedState != PED_CARJACK
#endif #endif
) )
m_pedInObjective = nil; m_pedInObjective = nil;
if (m_objective == OBJECTIVE_WAIT_IN_CAR_THEN_GETOUT) { if (m_objective == OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT) {
m_objective = OBJECTIVE_NONE; m_objective = OBJECTIVE_NONE;
if (m_pMyVehicle) if (m_pMyVehicle)
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} else { } else {
m_objective = m_prevObjective; m_objective = m_prevObjective;
@ -2532,14 +2532,14 @@ CPed::SetObjective(eObjective newObj, void *entity)
case OBJECTIVE_KILL_CHAR_ON_FOOT: case OBJECTIVE_KILL_CHAR_ON_FOOT:
case OBJECTIVE_KILL_CHAR_ANY_MEANS: case OBJECTIVE_KILL_CHAR_ANY_MEANS:
case OBJECTIVE_GOTO_CHAR_ON_FOOT: case OBJECTIVE_GOTO_CHAR_ON_FOOT:
case OBJECTIVE_FOLLOW_PED_IN_FORMATION: case OBJECTIVE_FOLLOW_CHAR_IN_FORMATION:
case OBJECTIVE_GOTO_AREA_ANY_MEANS: case OBJECTIVE_GOTO_AREA_ANY_MEANS:
case OBJECTIVE_FIGHT_CHAR: case OBJECTIVE_GUARD_ATTACK:
if (m_pedInObjective == entity) if (m_pedInObjective == entity)
return; return;
break; break;
case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_LEAVE_CAR:
case OBJECTIVE_FLEE_CAR: case OBJECTIVE_FLEE_CAR:
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
case OBJECTIVE_LEAVE_CAR_AND_DIE: case OBJECTIVE_LEAVE_CAR_AND_DIE:
@ -2548,7 +2548,7 @@ CPed::SetObjective(eObjective newObj, void *entity)
case OBJECTIVE_ENTER_CAR_AS_PASSENGER: case OBJECTIVE_ENTER_CAR_AS_PASSENGER:
case OBJECTIVE_ENTER_CAR_AS_DRIVER: case OBJECTIVE_ENTER_CAR_AS_DRIVER:
case OBJECTIVE_DESTROY_CAR: case OBJECTIVE_DESTROY_CAR:
case OBJECTIVE_SOLICIT: case OBJECTIVE_SOLICIT_VEHICLE:
case OBJECTIVE_BUY_ICE_CREAM: case OBJECTIVE_BUY_ICE_CREAM:
if (m_carInObjective == entity) if (m_carInObjective == entity)
return; return;
@ -2563,7 +2563,7 @@ CPed::SetObjective(eObjective newObj, void *entity)
break; break;
} }
} else { } else {
if ((newObj == OBJECTIVE_LEAVE_VEHICLE if ((newObj == OBJECTIVE_LEAVE_CAR
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
|| newObj == OBJECTIVE_LEAVE_CAR_AND_DIE || newObj == OBJECTIVE_LEAVE_CAR_AND_DIE
#endif #endif
@ -2588,7 +2588,7 @@ CPed::SetObjective(eObjective newObj, void *entity)
} }
switch (newObj) { switch (newObj) {
case OBJECTIVE_WAIT_IN_CAR_THEN_GETOUT: case OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT:
// In this special case, entity parameter isn't CEntity, but int. // In this special case, entity parameter isn't CEntity, but int.
SetObjectiveTimer((uintptr)entity); SetObjectiveTimer((uintptr)entity);
@ -2607,17 +2607,17 @@ CPed::SetObjective(eObjective newObj, void *entity)
case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE: case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE:
case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS: case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS:
case OBJECTIVE_GOTO_CHAR_ON_FOOT: case OBJECTIVE_GOTO_CHAR_ON_FOOT:
case OBJECTIVE_FIGHT_CHAR: case OBJECTIVE_GUARD_ATTACK:
m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f); m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f);
m_pedInObjective = (CPed*)entity; m_pedInObjective = (CPed*)entity;
m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective); m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
break; break;
case OBJECTIVE_FOLLOW_PED_IN_FORMATION: case OBJECTIVE_FOLLOW_CHAR_IN_FORMATION:
m_pedInObjective = (CPed*)entity; m_pedInObjective = (CPed*)entity;
m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective); m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
m_pedFormation = FORMATION_REAR; m_pedFormation = FORMATION_REAR;
break; break;
case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_LEAVE_CAR:
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
case OBJECTIVE_LEAVE_CAR_AND_DIE: case OBJECTIVE_LEAVE_CAR_AND_DIE:
#endif #endif
@ -2646,14 +2646,14 @@ CPed::SetObjective(eObjective newObj, void *entity)
} }
// fall through // fall through
case OBJECTIVE_DESTROY_CAR: case OBJECTIVE_DESTROY_CAR:
case OBJECTIVE_SOLICIT: case OBJECTIVE_SOLICIT_VEHICLE:
case OBJECTIVE_BUY_ICE_CREAM: case OBJECTIVE_BUY_ICE_CREAM:
m_carInObjective = (CVehicle*)entity; m_carInObjective = (CVehicle*)entity;
m_carInObjective->RegisterReference((CEntity**)&m_carInObjective); m_carInObjective->RegisterReference((CEntity**)&m_carInObjective);
m_pSeekTarget = m_carInObjective; m_pSeekTarget = m_carInObjective;
m_pSeekTarget->RegisterReference((CEntity**)&m_pSeekTarget); m_pSeekTarget->RegisterReference((CEntity**)&m_pSeekTarget);
m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f); m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f);
if (newObj == OBJECTIVE_SOLICIT) { if (newObj == OBJECTIVE_SOLICIT_VEHICLE) {
m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000; m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000;
} else if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == MISSION_CHAR && } else if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == MISSION_CHAR &&
(m_carInObjective->GetStatus() == STATUS_PLAYER_DISABLED || CPad::GetPad(CWorld::PlayerInFocus)->ArePlayerControlsDisabled())) { (m_carInObjective->GetStatus() == STATUS_PLAYER_DISABLED || CPad::GetPad(CWorld::PlayerInFocus)->ArePlayerControlsDisabled())) {
@ -2696,7 +2696,7 @@ CPed::SetObjective(eObjective newObj)
return; return;
if (newObj == OBJECTIVE_NONE) { if (newObj == OBJECTIVE_NONE) {
if ((m_objective == OBJECTIVE_LEAVE_VEHICLE || m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER if ((m_objective == OBJECTIVE_LEAVE_CAR || m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
|| m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) || m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE)
&& !IsPlayer() && !IsPlayer()
@ -4211,7 +4211,7 @@ CPed::ClearObjective(void)
#endif #endif
bWanderPathAfterExitingCar = true; bWanderPathAfterExitingCar = true;
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} }
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
m_nLastPedState = PED_NONE; m_nLastPedState = PED_NONE;
@ -5475,12 +5475,12 @@ CPed::CollideWithPed(CPed *collideWith)
if ((!IsPlayer() || ((CPlayerPed*)this)->m_fMoveSpeed <= 1.8f) if ((!IsPlayer() || ((CPlayerPed*)this)->m_fMoveSpeed <= 1.8f)
&& (IsPlayer() || heIsMissionChar && weAreMissionChar || m_nMoveState != PEDMOVE_RUN && m_nMoveState != PEDMOVE_SPRINT && (IsPlayer() || heIsMissionChar && weAreMissionChar || m_nMoveState != PEDMOVE_RUN && m_nMoveState != PEDMOVE_SPRINT
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
|| m_objective == OBJECTIVE_FOLLOW_PED_IN_FORMATION && m_pedInObjective == collideWith || m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION && m_pedInObjective == collideWith
|| collideWith->m_objective == OBJECTIVE_FOLLOW_PED_IN_FORMATION && collideWith->m_pedInObjective == this || collideWith->m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION && collideWith->m_pedInObjective == this
#endif #endif
)) { )) {
if (m_objective != OBJECTIVE_FOLLOW_PED_IN_FORMATION && m_objective != OBJECTIVE_GOTO_CHAR_ON_FOOT) { if (m_objective != OBJECTIVE_FOLLOW_CHAR_IN_FORMATION && m_objective != OBJECTIVE_GOTO_CHAR_ON_FOOT) {
if (CTimer::GetTimeInMilliseconds() > m_nPedStateTimer) { if (CTimer::GetTimeInMilliseconds() > m_nPedStateTimer) {
@ -7251,7 +7251,7 @@ CPed::Seek(void)
if (m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) { if (m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) {
if (m_nPedState != PED_EXIT_TRAIN && m_nPedState != PED_ENTER_TRAIN && m_nPedState != PED_SEEK_IN_BOAT && if (m_nPedState != PED_EXIT_TRAIN && m_nPedState != PED_ENTER_TRAIN && m_nPedState != PED_SEEK_IN_BOAT &&
m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER && m_objective != OBJECTIVE_SOLICIT && !bDuckAndCover) { m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER && m_objective != OBJECTIVE_SOLICIT_VEHICLE && !bDuckAndCover) {
if ((!m_pedInObjective || !m_pedInObjective->bInVehicle) if ((!m_pedInObjective || !m_pedInObjective->bInVehicle)
&& !((CTimer::GetFrameCounter() + (m_randomSeed % 256) + 17) & 7)) { && !((CTimer::GetFrameCounter() + (m_randomSeed % 256) + 17) & 7)) {
@ -7279,14 +7279,14 @@ CPed::Seek(void)
float seekPosDist = (m_vecSeekPos - GetPosition()).Magnitude2D(); float seekPosDist = (m_vecSeekPos - GetPosition()).Magnitude2D();
if (seekPosDist < 2.0f || m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT) { if (seekPosDist < 2.0f || m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT) {
if (m_objective == OBJECTIVE_FOLLOW_PED_IN_FORMATION) { if (m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION) {
if (m_pedInObjective->m_nMoveState != PEDMOVE_STILL) if (m_pedInObjective->m_nMoveState != PEDMOVE_STILL)
nextMove = m_pedInObjective->m_nMoveState; nextMove = m_pedInObjective->m_nMoveState;
} else } else
nextMove = PEDMOVE_WALK; nextMove = PEDMOVE_WALK;
} else if (m_objective != OBJECTIVE_FOLLOW_PED_IN_FORMATION) { } else if (m_objective != OBJECTIVE_FOLLOW_CHAR_IN_FORMATION) {
if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS || m_objective == OBJECTIVE_RUN_TO_AREA || bIsRunning) if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS || m_objective == OBJECTIVE_RUN_TO_AREA || bIsRunning)
nextMove = PEDMOVE_RUN; nextMove = PEDMOVE_RUN;
@ -7376,7 +7376,7 @@ CPed::Seek(void)
return false; return false;
} }
if ((m_objective != OBJECTIVE_FOLLOW_PED_IN_FORMATION || m_pedInObjective->m_nMoveState == PEDMOVE_STILL) && m_nMoveState != PEDMOVE_STILL) { if ((m_objective != OBJECTIVE_FOLLOW_CHAR_IN_FORMATION || m_pedInObjective->m_nMoveState == PEDMOVE_STILL) && m_nMoveState != PEDMOVE_STILL) {
m_nPedStateTimer = 0; m_nPedStateTimer = 0;
m_actionX = 0; m_actionX = 0;
m_actionY = 0; m_actionY = 0;
@ -10073,7 +10073,7 @@ CPed::ProcessControl(void)
bStartWanderPathOnFoot = false; bStartWanderPathOnFoot = false;
} else if (m_nPedState == PED_DRIVING) { } else if (m_nPedState == PED_DRIVING) {
bWanderPathAfterExitingCar = true; bWanderPathAfterExitingCar = true;
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} }
} }
@ -10223,22 +10223,34 @@ CPed::ProcessControl(void)
int vehAnim = m_pVehicleAnim->animId; int vehAnim = m_pVehicleAnim->animId;
static bool cancelQuickJack = false; static bool cancelJack = false;
int16 padWalkX = pad->GetPedWalkLeftRight(); int16 padWalkX = pad->GetPedWalkLeftRight();
int16 padWalkY = pad->GetPedWalkUpDown(); int16 padWalkY = pad->GetPedWalkUpDown();
if (Abs(padWalkX) > 0.0f || Abs(padWalkY) > 0.0f) { 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 || 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) { vehAnim == ANIM_VAN_OPEN_L || vehAnim == ANIM_VAN_OPEN) {
if (!m_pMyVehicle->pDriver) {
cancelJack = false;
bCancelEnteringCar = true; bCancelEnteringCar = true;
} else
cancelJack = true;
} else if (vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f) { } else if (vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f) {
cancelQuickJack = true; 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 (cancelQuickJack && vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f && m_pVehicleAnim->GetTimeLeft() < 0.78f) { if (cancelJack && vehAnim == ANIM_CAR_QJACK && m_pVehicleAnim->GetTimeLeft() > 0.75f && m_pVehicleAnim->GetTimeLeft() < 0.78f) {
cancelQuickJack = false; cancelJack = false;
QuitEnteringCar(); QuitEnteringCar();
RestorePreviousObjective(); 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 #endif
break; break;
} }
@ -10574,7 +10586,7 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
} else if (ped->m_vehEnterType == CAR_DOOR_RF } else if (ped->m_vehEnterType == CAR_DOOR_RF
&& (veh->m_nGettingInFlags & CAR_DOOR_FLAG_LF || && (veh->m_nGettingInFlags & CAR_DOOR_FLAG_LF ||
(veh->pDriver != nil && (veh->pDriver != nil &&
(veh->pDriver->m_objective != OBJECTIVE_LEAVE_VEHICLE (veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
&& veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR_AND_DIE && veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR_AND_DIE
#endif #endif
@ -10590,7 +10602,7 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->m_objective = OBJECTIVE_ENTER_CAR_AS_PASSENGER; ped->m_objective = OBJECTIVE_ENTER_CAR_AS_PASSENGER;
PedSetInCarCB(nil, ped); PedSetInCarCB(nil, ped);
ped->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); ped->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
if (!ped->IsPlayer()) if (!ped->IsPlayer())
ped->bFleeAfterExitingCar = true; ped->bFleeAfterExitingCar = true;
@ -10958,7 +10970,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
CPed *driver = veh->pDriver; CPed *driver = veh->pDriver;
if (driver && (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || ped->m_nPedState == PED_CARJACK)) { if (driver && (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || ped->m_nPedState == PED_CARJACK)) {
if (veh->bIsBus) { if (veh->bIsBus) {
driver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); driver->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
if (driver->IsPlayer()) { if (driver->IsPlayer()) {
veh->bIsHandbrakeOn = true; veh->bIsHandbrakeOn = true;
veh->SetStatus(STATUS_PLAYER_DISABLED); veh->SetStatus(STATUS_PLAYER_DISABLED);
@ -10969,7 +10981,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
if (ped->m_nPedType == PEDTYPE_COP if (ped->m_nPedType == PEDTYPE_COP
|| ped->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || ped->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT
|| ped->m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) { || ped->m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS) {
ped->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); ped->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
} }
ped->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 400; ped->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 400;
return; return;
@ -10993,7 +11005,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
if ((ped->m_nPedType != PEDTYPE_EMERGENCY || veh->pDriver->m_nPedType != PEDTYPE_EMERGENCY) if ((ped->m_nPedType != PEDTYPE_EMERGENCY || veh->pDriver->m_nPedType != PEDTYPE_EMERGENCY)
&& (ped->m_nPedType != PEDTYPE_COP || veh->pDriver->m_nPedType != PEDTYPE_COP)) { && (ped->m_nPedType != PEDTYPE_COP || veh->pDriver->m_nPedType != PEDTYPE_COP)) {
veh->pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); veh->pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
veh->pDriver->Say(SOUND_PED_CAR_JACKED); veh->pDriver->Say(SOUND_PED_CAR_JACKED);
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
veh->pDriver->SetRadioStation(); veh->pDriver->SetRadioStation();
@ -11046,6 +11058,15 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
if (!ped->IsNotInWreckedVehicle()) if (!ped->IsNotInWreckedVehicle())
return; return;
#ifdef CANCELLABLE_CAR_ENTER
if (ped->bCancelEnteringCar) {
ped->QuitEnteringCar();
ped->RestorePreviousObjective();
ped->bCancelEnteringCar = false;
return;
}
#endif
bool isLow = !!veh->bLowVehicle; bool isLow = !!veh->bLowVehicle;
int padNo; int padNo;
@ -11418,7 +11439,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
// Situation of entering car as a driver while there is already a driver exiting atm. // Situation of entering car as a driver while there is already a driver exiting atm.
CPed *driver = veh->pDriver; CPed *driver = veh->pDriver;
if (driver && driver->m_nPedState == PED_DRIVING && !veh->bIsBus && driver->m_objective == OBJECTIVE_LEAVE_VEHICLE if (driver && driver->m_nPedState == PED_DRIVING && !veh->bIsBus && driver->m_objective == OBJECTIVE_LEAVE_CAR
&& (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || ped->m_nPedState == PED_CARJACK)) { && (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || ped->m_nPedState == PED_CARJACK)) {
if (!ped->IsPlayer() && (ped->CharCreatedBy != MISSION_CHAR || driver->IsPlayer())) { if (!ped->IsPlayer() && (ped->CharCreatedBy != MISSION_CHAR || driver->IsPlayer())) {
@ -11519,7 +11540,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
for (int i = 0; i < veh->m_nNumMaxPassengers; ++i) { for (int i = 0; i < veh->m_nNumMaxPassengers; ++i) {
CPed *passenger = veh->pPassengers[i]; CPed *passenger = veh->pPassengers[i];
if (passenger && passenger->CharCreatedBy == RANDOM_CHAR) { if (passenger && passenger->CharCreatedBy == RANDOM_CHAR) {
passenger->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); passenger->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
passenger->m_leaveCarTimer = CTimer::GetTimeInMilliseconds(); passenger->m_leaveCarTimer = CTimer::GetTimeInMilliseconds();
#endif #endif
@ -11533,7 +11554,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->AddPassenger(ped, 0); veh->AddPassenger(ped, 0);
ped->m_nPedState = PED_DRIVING; ped->m_nPedState = PED_DRIVING;
ped->RestorePreviousObjective(); ped->RestorePreviousObjective();
ped->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); ped->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
} else if (veh->pDriver && ped->CharCreatedBy == RANDOM_CHAR) { } else if (veh->pDriver && ped->CharCreatedBy == RANDOM_CHAR) {
veh->AutoPilot.m_nCruiseSpeed = 17; veh->AutoPilot.m_nCruiseSpeed = 17;
} }
@ -11618,7 +11639,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
switch (ped->m_objective) { switch (ped->m_objective) {
case OBJECTIVE_KILL_CHAR_ON_FOOT: case OBJECTIVE_KILL_CHAR_ON_FOOT:
case OBJECTIVE_KILL_CHAR_ANY_MEANS: case OBJECTIVE_KILL_CHAR_ANY_MEANS:
case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_LEAVE_CAR:
case OBJECTIVE_FOLLOW_CAR_IN_CAR: case OBJECTIVE_FOLLOW_CAR_IN_CAR:
case OBJECTIVE_GOTO_AREA_ANY_MEANS: case OBJECTIVE_GOTO_AREA_ANY_MEANS:
case OBJECTIVE_GOTO_AREA_ON_FOOT: case OBJECTIVE_GOTO_AREA_ON_FOOT:
@ -11887,7 +11908,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh && veh->IsBoat()) if (veh && veh->IsBoat())
ped->ApplyMoveSpeed(); ped->ApplyMoveSpeed();
if (ped->m_objective == OBJECTIVE_LEAVE_VEHICLE) if (ped->m_objective == OBJECTIVE_LEAVE_CAR)
ped->RestorePreviousObjective(); ped->RestorePreviousObjective();
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
else if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) { else if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) {
@ -12553,20 +12574,20 @@ CPed::ProcessObjective(void)
case OBJECTIVE_NONE: case OBJECTIVE_NONE:
case OBJECTIVE_GUARD_AREA: case OBJECTIVE_GUARD_AREA:
case OBJECTIVE_FOLLOW_CAR_IN_CAR: case OBJECTIVE_FOLLOW_CAR_IN_CAR:
case OBJECTIVE_FIRE_AT_OBJ_FROM_VEHICLE: case OBJECTIVE_FIRE_AT_OBJECT_FROM_VEHICLE:
case OBJECTIVE_DESTROY_OBJ: case OBJECTIVE_DESTROY_OBJECT:
case OBJECTIVE_23: case OBJECTIVE_GOTO_AREA_IN_CAR:
case OBJECTIVE_24: case OBJECTIVE_FOLLOW_CAR_ON_FOOT_WITH_OFFSET:
case OBJECTIVE_SET_LEADER: case OBJECTIVE_SET_LEADER:
break; break;
case OBJECTIVE_IDLE: case OBJECTIVE_WAIT_ON_FOOT:
SetIdle(); SetIdle();
m_objective = OBJECTIVE_NONE; m_objective = OBJECTIVE_NONE;
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
break; break;
case OBJECTIVE_FLEE_TILL_SAFE: case OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE:
if (InVehicle()) { if (InVehicle()) {
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
bFleeAfterExitingCar = true; bFleeAfterExitingCar = true;
} else if (m_nPedState != PED_FLEE_POS) { } else if (m_nPedState != PED_FLEE_POS) {
SetFlee(GetPosition(), 10000); SetFlee(GetPosition(), 10000);
@ -12608,7 +12629,7 @@ CPed::ProcessObjective(void)
case OBJECTIVE_WAIT_IN_CAR: case OBJECTIVE_WAIT_IN_CAR:
m_nPedState = PED_DRIVING; m_nPedState = PED_DRIVING;
break; break;
case OBJECTIVE_WAIT_IN_CAR_THEN_GETOUT: case OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT:
m_nPedState = PED_DRIVING; m_nPedState = PED_DRIVING;
break; break;
case OBJECTIVE_KILL_CHAR_ANY_MEANS: case OBJECTIVE_KILL_CHAR_ANY_MEANS:
@ -12618,7 +12639,7 @@ CPed::ProcessObjective(void)
&& m_nPedType != PEDTYPE_COP && FindPlayerPed()->m_pWanted->m_CurrentCops && m_nPedType != PEDTYPE_COP && FindPlayerPed()->m_pWanted->m_CurrentCops
&& !bKindaStayInSamePlace) { && !bKindaStayInSamePlace) {
SetObjective(OBJECTIVE_FLEE_TILL_SAFE); SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
break; break;
} }
if (InVehicle()) { if (InVehicle()) {
@ -12643,7 +12664,7 @@ CPed::ProcessObjective(void)
|| targetHasVeh && m_pedInObjective->m_pMyVehicle->CanPedExitCar()) { || targetHasVeh && m_pedInObjective->m_pMyVehicle->CanPedExitCar()) {
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0; m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE; m_pMyVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} }
} }
break; break;
@ -12720,7 +12741,7 @@ CPed::ProcessObjective(void)
{ {
bool killPlayerInNoPoliceZone = false; bool killPlayerInNoPoliceZone = false;
if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT && InVehicle()) { if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT && InVehicle()) {
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
break; break;
} }
@ -12785,7 +12806,7 @@ CPed::ProcessObjective(void)
} }
if (m_pedInObjective->IsPlayer() && m_nPedType != PEDTYPE_COP if (m_pedInObjective->IsPlayer() && m_nPedType != PEDTYPE_COP
&& CharCreatedBy != MISSION_CHAR && FindPlayerPed()->m_pWanted->m_CurrentCops) { && CharCreatedBy != MISSION_CHAR && FindPlayerPed()->m_pWanted->m_CurrentCops) {
SetObjective(OBJECTIVE_FLEE_TILL_SAFE); SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
break; break;
} }
if (m_pedInObjective->m_fHealth <= 0.0f) { if (m_pedInObjective->m_fHealth <= 0.0f) {
@ -13076,7 +13097,7 @@ CPed::ProcessObjective(void)
{ {
if (InVehicle()) { if (InVehicle()) {
if (m_nPedState == PED_DRIVING) if (m_nPedState == PED_DRIVING)
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} else if (m_nPedState != PED_FLEE_ENTITY) { } else if (m_nPedState != PED_FLEE_ENTITY) {
int time; int time;
if (m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS) if (m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS)
@ -13140,7 +13161,7 @@ CPed::ProcessObjective(void)
} }
break; break;
} }
case OBJECTIVE_FOLLOW_PED_IN_FORMATION: case OBJECTIVE_FOLLOW_CHAR_IN_FORMATION:
{ {
if (m_pedInObjective) { if (m_pedInObjective) {
CVector posToGo = GetFormationPosition(); CVector posToGo = GetFormationPosition();
@ -13385,7 +13406,7 @@ CPed::ProcessObjective(void)
if (distWithTarget.MagnitudeSqr() < sq(20.0f)) { if (distWithTarget.MagnitudeSqr() < sq(20.0f)) {
m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0; m_pMyVehicle->AutoPilot.m_nCruiseSpeed = 0;
ForceStoredObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS); ForceStoredObjective(OBJECTIVE_GOTO_AREA_ANY_MEANS);
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} }
break; break;
} }
@ -13429,7 +13450,7 @@ CPed::ProcessObjective(void)
{ {
if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA) if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA)
&& InVehicle()) { && InVehicle()) {
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} else { } else {
distWithTarget = m_nextRoutePointPos - GetPosition(); distWithTarget = m_nextRoutePointPos - GetPosition();
distWithTarget.z = 0.0f; distWithTarget.z = 0.0f;
@ -13454,7 +13475,7 @@ CPed::ProcessObjective(void)
break; break;
} }
case OBJECTIVE_FIGHT_CHAR: case OBJECTIVE_GUARD_ATTACK:
{ {
if (m_pedInObjective) { if (m_pedInObjective) {
SetLookFlag(m_pedInObjective, true); SetLookFlag(m_pedInObjective, true);
@ -13487,7 +13508,7 @@ CPed::ProcessObjective(void)
SetSeek(m_nextRoutePointPos, 0.8f); SetSeek(m_nextRoutePointPos, 0.8f);
} }
break; break;
case OBJECTIVE_SOLICIT: case OBJECTIVE_SOLICIT_VEHICLE:
if (m_carInObjective) { if (m_carInObjective) {
if (m_objectiveTimer <= CTimer::GetTimeInMilliseconds()) { if (m_objectiveTimer <= CTimer::GetTimeInMilliseconds()) {
if (!bInVehicle) { if (!bInVehicle) {
@ -13687,7 +13708,7 @@ CPed::ProcessObjective(void)
break; break;
} }
// fall through // fall through
case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_LEAVE_CAR:
if (CTimer::GetTimeInMilliseconds() > m_leaveCarTimer) { if (CTimer::GetTimeInMilliseconds() > m_leaveCarTimer) {
if (InVehicle() if (InVehicle()
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
@ -13970,7 +13991,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} }
if (m_pSeekTarget == obj && obj->IsVehicle()) { if (m_pSeekTarget == obj && obj->IsVehicle()) {
if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER
|| m_objective == OBJECTIVE_SOLICIT) { || m_objective == OBJECTIVE_SOLICIT_VEHICLE) {
goingToEnterCar = true; goingToEnterCar = true;
if (IsPlayer()) if (IsPlayer())
checkIntervalInTime = 0.0f; checkIntervalInTime = 0.0f;
@ -15312,7 +15333,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
default: default:
break; break;
} }
if (someoneEntersFromOurExitDoor && m_objective == OBJECTIVE_LEAVE_VEHICLE) { if (someoneEntersFromOurExitDoor && m_objective == OBJECTIVE_LEAVE_CAR) {
RestorePreviousObjective(); RestorePreviousObjective();
return; return;
} }
@ -15669,7 +15690,7 @@ CPed::ScanForInterestingStuff(void)
if (veh->IsVehicleNormal()) { if (veh->IsVehicleNormal()) {
if (veh->IsCar()) { if (veh->IsCar()) {
if ((GetPosition() - veh->GetPosition()).Magnitude() < 5.0f && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, nil)) { if ((GetPosition() - veh->GetPosition()).Magnitude() < 5.0f && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, nil)) {
SetObjective(OBJECTIVE_SOLICIT, veh); SetObjective(OBJECTIVE_SOLICIT_VEHICLE, veh);
Say(SOUND_PED_SOLICIT); Say(SOUND_PED_SOLICIT);
return; return;
} }
@ -15990,7 +16011,7 @@ CPed::SeekCar(void)
m_fRotationCur = m_fRotationDest; m_fRotationCur = m_fRotationDest;
if (!bVehEnterDoorIsBlocked) { if (!bVehEnterDoorIsBlocked) {
vehToSeek->bIsStatic = false; vehToSeek->bIsStatic = false;
if (m_objective == OBJECTIVE_SOLICIT) { if (m_objective == OBJECTIVE_SOLICIT_VEHICLE) {
SetSolicit(1000); SetSolicit(1000);
} else if (m_objective == OBJECTIVE_BUY_ICE_CREAM) { } else if (m_objective == OBJECTIVE_BUY_ICE_CREAM) {
SetBuyIceCream(); SetBuyIceCream();
@ -16322,14 +16343,14 @@ CPed::UpdateFromLeader(void)
if (m_leader->m_nPedState == PED_DEAD) { if (m_leader->m_nPedState == PED_DEAD) {
SetLeader(nil); SetLeader(nil);
SetObjective(OBJECTIVE_FLEE_TILL_SAFE); SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
return; return;
} }
if (!m_leader->bInVehicle) { if (!m_leader->bInVehicle) {
if (m_leader->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) { if (m_leader->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) {
if (bInVehicle) { if (bInVehicle) {
if (m_objective != OBJECTIVE_WAIT_IN_CAR_THEN_GETOUT && m_objective != OBJECTIVE_LEAVE_VEHICLE) if (m_objective != OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT && m_objective != OBJECTIVE_LEAVE_CAR)
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
return; return;
} }
@ -16344,12 +16365,12 @@ CPed::UpdateFromLeader(void)
} }
} }
if (bInVehicle || !m_leader->bInVehicle || m_leader->m_nPedState != PED_DRIVING) { if (bInVehicle || !m_leader->bInVehicle || m_leader->m_nPedState != PED_DRIVING) {
if (m_leader->m_objective != OBJECTIVE_NONE && (!m_leader->IsPlayer() || m_leader->m_objective != OBJECTIVE_IDLE) if (m_leader->m_objective != OBJECTIVE_NONE && (!m_leader->IsPlayer() || m_leader->m_objective != OBJECTIVE_WAIT_ON_FOOT)
&& m_objective != m_leader->m_objective) { && m_objective != m_leader->m_objective) {
switch (m_leader->m_objective) { switch (m_leader->m_objective) {
case OBJECTIVE_IDLE: case OBJECTIVE_WAIT_ON_FOOT:
case OBJECTIVE_FLEE_TILL_SAFE: case OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE:
case OBJECTIVE_WAIT_IN_CAR: case OBJECTIVE_WAIT_IN_CAR:
case OBJECTIVE_FOLLOW_ROUTE: case OBJECTIVE_FOLLOW_ROUTE:
SetObjective(m_leader->m_objective); SetObjective(m_leader->m_objective);
@ -16374,7 +16395,7 @@ CPed::UpdateFromLeader(void)
return; return;
} }
break; break;
case OBJECTIVE_FIGHT_CHAR: case OBJECTIVE_GUARD_ATTACK:
return; return;
case OBJECTIVE_HAIL_TAXI: case OBJECTIVE_HAIL_TAXI:
m_leader = nil; m_leader = nil;
@ -16434,7 +16455,7 @@ CPed::UpdateFromLeader(void)
} }
} }
} else if (bInVehicle) { } else if (bInVehicle) {
if ((!m_leader->bInVehicle || m_leader->m_nPedState == PED_EXIT_CAR) && m_objective != OBJECTIVE_WAIT_IN_CAR_THEN_GETOUT) { if ((!m_leader->bInVehicle || m_leader->m_nPedState == PED_EXIT_CAR) && m_objective != OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT) {
switch (m_leader->m_objective) { switch (m_leader->m_objective) {
case OBJECTIVE_ENTER_CAR_AS_PASSENGER: case OBJECTIVE_ENTER_CAR_AS_PASSENGER:
@ -16444,11 +16465,11 @@ CPed::UpdateFromLeader(void)
// fall through // fall through
default: default:
if (m_pMyVehicle && m_objective != OBJECTIVE_LEAVE_VEHICLE) { if (m_pMyVehicle && m_objective != OBJECTIVE_LEAVE_CAR) {
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 250; m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 250;
#endif #endif
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} }
break; break;
@ -16821,19 +16842,19 @@ CPed::SetObjective(eObjective newObj, CVector dest)
break; break;
case OBJECTIVE_GUARD_AREA: case OBJECTIVE_GUARD_AREA:
case OBJECTIVE_WAIT_IN_CAR: case OBJECTIVE_WAIT_IN_CAR:
case OBJECTIVE_WAIT_IN_CAR_THEN_GETOUT: case OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT:
case OBJECTIVE_KILL_CHAR_ON_FOOT: case OBJECTIVE_KILL_CHAR_ON_FOOT:
case OBJECTIVE_KILL_CHAR_ANY_MEANS: case OBJECTIVE_KILL_CHAR_ANY_MEANS:
case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE: case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE:
case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS: case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS:
case OBJECTIVE_GOTO_CHAR_ON_FOOT: case OBJECTIVE_GOTO_CHAR_ON_FOOT:
case OBJECTIVE_FOLLOW_PED_IN_FORMATION: case OBJECTIVE_FOLLOW_CHAR_IN_FORMATION:
case OBJECTIVE_LEAVE_VEHICLE: case OBJECTIVE_LEAVE_CAR:
case OBJECTIVE_ENTER_CAR_AS_PASSENGER: case OBJECTIVE_ENTER_CAR_AS_PASSENGER:
case OBJECTIVE_ENTER_CAR_AS_DRIVER: case OBJECTIVE_ENTER_CAR_AS_DRIVER:
case OBJECTIVE_FOLLOW_CAR_IN_CAR: case OBJECTIVE_FOLLOW_CAR_IN_CAR:
case OBJECTIVE_FIRE_AT_OBJ_FROM_VEHICLE: case OBJECTIVE_FIRE_AT_OBJECT_FROM_VEHICLE:
case OBJECTIVE_DESTROY_OBJ: case OBJECTIVE_DESTROY_OBJECT:
case OBJECTIVE_DESTROY_CAR: case OBJECTIVE_DESTROY_CAR:
break; break;
case OBJECTIVE_GOTO_AREA_ANY_MEANS: case OBJECTIVE_GOTO_AREA_ANY_MEANS:

View File

@ -153,34 +153,34 @@ enum eWaitState {
enum eObjective : uint32 { enum eObjective : uint32 {
OBJECTIVE_NONE, OBJECTIVE_NONE,
OBJECTIVE_IDLE, OBJECTIVE_WAIT_ON_FOOT,
OBJECTIVE_FLEE_TILL_SAFE, OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE,
OBJECTIVE_GUARD_SPOT, OBJECTIVE_GUARD_SPOT,
OBJECTIVE_GUARD_AREA, // not implemented OBJECTIVE_GUARD_AREA, // not implemented
OBJECTIVE_WAIT_IN_CAR, OBJECTIVE_WAIT_IN_CAR,
OBJECTIVE_WAIT_IN_CAR_THEN_GETOUT, OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT,
OBJECTIVE_KILL_CHAR_ON_FOOT, OBJECTIVE_KILL_CHAR_ON_FOOT,
OBJECTIVE_KILL_CHAR_ANY_MEANS, OBJECTIVE_KILL_CHAR_ANY_MEANS,
OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE, OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE,
OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS, OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS,
OBJECTIVE_GOTO_CHAR_ON_FOOT, OBJECTIVE_GOTO_CHAR_ON_FOOT,
OBJECTIVE_FOLLOW_PED_IN_FORMATION, OBJECTIVE_FOLLOW_CHAR_IN_FORMATION,
OBJECTIVE_LEAVE_VEHICLE, OBJECTIVE_LEAVE_CAR,
OBJECTIVE_ENTER_CAR_AS_PASSENGER, OBJECTIVE_ENTER_CAR_AS_PASSENGER,
OBJECTIVE_ENTER_CAR_AS_DRIVER, OBJECTIVE_ENTER_CAR_AS_DRIVER,
OBJECTIVE_FOLLOW_CAR_IN_CAR, // seems not implemented so far OBJECTIVE_FOLLOW_CAR_IN_CAR, // not implemented
OBJECTIVE_FIRE_AT_OBJ_FROM_VEHICLE, // not implemented OBJECTIVE_FIRE_AT_OBJECT_FROM_VEHICLE, // not implemented
OBJECTIVE_DESTROY_OBJ, // not implemented OBJECTIVE_DESTROY_OBJECT, // not implemented
OBJECTIVE_DESTROY_CAR, OBJECTIVE_DESTROY_CAR,
OBJECTIVE_GOTO_AREA_ANY_MEANS, OBJECTIVE_GOTO_AREA_ANY_MEANS,
OBJECTIVE_GOTO_AREA_ON_FOOT, OBJECTIVE_GOTO_AREA_ON_FOOT,
OBJECTIVE_RUN_TO_AREA, OBJECTIVE_RUN_TO_AREA,
OBJECTIVE_23, // not implemented OBJECTIVE_GOTO_AREA_IN_CAR, // not implemented
OBJECTIVE_24, // not implemented OBJECTIVE_FOLLOW_CAR_ON_FOOT_WITH_OFFSET, // not implemented
OBJECTIVE_FIGHT_CHAR, OBJECTIVE_GUARD_ATTACK,
OBJECTIVE_SET_LEADER, OBJECTIVE_SET_LEADER,
OBJECTIVE_FOLLOW_ROUTE, OBJECTIVE_FOLLOW_ROUTE,
OBJECTIVE_SOLICIT, OBJECTIVE_SOLICIT_VEHICLE,
OBJECTIVE_HAIL_TAXI, OBJECTIVE_HAIL_TAXI,
OBJECTIVE_CATCH_TRAIN, OBJECTIVE_CATCH_TRAIN,
OBJECTIVE_BUY_ICE_CREAM, OBJECTIVE_BUY_ICE_CREAM,

View File

@ -1288,7 +1288,7 @@ CPlayerPed::ProcessControl(void)
SetDead(); SetDead();
return; return;
} }
if (m_nPedState == PED_DRIVING && m_objective != OBJECTIVE_LEAVE_VEHICLE) { if (m_nPedState == PED_DRIVING && m_objective != OBJECTIVE_LEAVE_CAR) {
if (m_pMyVehicle->IsCar() && ((CAutomobile*)m_pMyVehicle)->Damage.GetDoorStatus(DOOR_FRONT_LEFT) == DOOR_STATUS_SWINGING) { if (m_pMyVehicle->IsCar() && ((CAutomobile*)m_pMyVehicle)->Damage.GetDoorStatus(DOOR_FRONT_LEFT) == DOOR_STATUS_SWINGING) {
CAnimBlendAssociation *rollDoorAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLDOOR); CAnimBlendAssociation *rollDoorAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_ROLLDOOR);
if (!rollDoorAssoc) { if (!rollDoorAssoc) {

View File

@ -283,7 +283,7 @@ CAutomobile::ProcessControl(void)
if(!pDriver->IsPlayer() && if(!pDriver->IsPlayer() &&
!(pDriver->m_leader && pDriver->m_leader->bInVehicle) && !(pDriver->m_leader && pDriver->m_leader->bInVehicle) &&
pDriver->CharCreatedBy != MISSION_CHAR) pDriver->CharCreatedBy != MISSION_CHAR)
pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, this);
} }
}else }else
bDriverLastFrame = false; bDriverLastFrame = false;
@ -295,7 +295,7 @@ CAutomobile::ProcessControl(void)
if(!pPassengers[i]->IsPlayer() && if(!pPassengers[i]->IsPlayer() &&
!(pPassengers[i]->m_leader && pPassengers[i]->m_leader->bInVehicle) && !(pPassengers[i]->m_leader && pPassengers[i]->m_leader->bInVehicle) &&
pPassengers[i]->CharCreatedBy != MISSION_CHAR) pPassengers[i]->CharCreatedBy != MISSION_CHAR)
pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_CAR, this);
} }
CRubbish::StirUp(this); CRubbish::StirUp(this);

View File

@ -669,12 +669,12 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage
if (pDriver) { if (pDriver) {
SetStatus(STATUS_ABANDONED); SetStatus(STATUS_ABANDONED);
pDriver->bFleeAfterExitingCar = true; pDriver->bFleeAfterExitingCar = true;
pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, this);
} }
for (int i = 0; i < m_nNumMaxPassengers; i++) { for (int i = 0; i < m_nNumMaxPassengers; i++) {
if (pPassengers[i]) { if (pPassengers[i]) {
pPassengers[i]->bFleeAfterExitingCar = true; pPassengers[i]->bFleeAfterExitingCar = true;
pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_CAR, this);
} }
} }
break; break;