CWanted, anim fix, ped objs renaming, remove III beta features

This commit is contained in:
eray orçunus 2020-06-22 04:02:44 +03:00
parent d6a853bd60
commit f3ed6659c3
29 changed files with 358 additions and 394 deletions

View File

@ -44,7 +44,7 @@ CAnimBlendHierarchy::CalcTotalTime(void)
#endif #endif
totalLength = Max(totalLength, sequences[i].GetKeyFrame(sequences[i].numFrames-1)->deltaTime); totalLength = Max(totalLength, sequences[i].GetKeyFrame(sequences[i].numFrames-1)->deltaTime);
for(j = sequences[i].numFrames-1; j > 0; j--){ for(j = sequences[i].numFrames-1; j >= 1; j--){
KeyFrame *kf1 = sequences[i].GetKeyFrame(j); KeyFrame *kf1 = sequences[i].GetKeyFrame(j);
KeyFrame *kf2 = sequences[i].GetKeyFrame(j-1); KeyFrame *kf2 = sequences[i].GetKeyFrame(j-1);
kf1->deltaTime -= kf2->deltaTime; kf1->deltaTime -= kf2->deltaTime;
@ -66,7 +66,7 @@ CAnimBlendHierarchy::CalcTotalTimeCompressed(void)
#endif #endif
totalLength = Max(totalLength, sequences[i].GetKeyFrameCompressed(sequences[i].numFrames-1)->deltaTime/60.0f); totalLength = Max(totalLength, sequences[i].GetKeyFrameCompressed(sequences[i].numFrames-1)->deltaTime/60.0f);
for(j = sequences[i].numFrames-1; j > 0; j--){ for(j = sequences[i].numFrames-1; j >= 1; j--){
KeyFrame *kf1 = sequences[i].GetKeyFrameCompressed(j); KeyFrame *kf1 = sequences[i].GetKeyFrameCompressed(j);
KeyFrame *kf2 = sequences[i].GetKeyFrameCompressed(j-1); KeyFrame *kf2 = sequences[i].GetKeyFrameCompressed(j-1);
kf1->deltaTime -= kf2->deltaTime; kf1->deltaTime -= kf2->deltaTime;

View File

@ -97,12 +97,9 @@ CAnimBlendNode::FindKeyFrame(float t)
if(sequence->numFrames == 1){ if(sequence->numFrames == 1){
remainingTime = 0.0f; remainingTime = 0.0f;
}else{ }else{
frameA++;
// advance until t is between frameB and frameA // advance until t is between frameB and frameA
while(t > sequence->GetKeyFrame(frameA)->deltaTime){ while(t > sequence->GetKeyFrame(++frameA)->deltaTime){
t -= sequence->GetKeyFrame(frameA)->deltaTime; t -= sequence->GetKeyFrame(frameA)->deltaTime;
frameA++;
if(frameA + 1 >= sequence->numFrames){ if(frameA + 1 >= sequence->numFrames){
// reached end of animation // reached end of animation
if(!association->IsRepeating()){ if(!association->IsRepeating()){

View File

@ -1004,9 +1004,10 @@ CAnimManager::UncompressAnimation(CAnimBlendHierarchy *hier)
}else{ }else{
CLink<CAnimBlendHierarchy*> *link = ms_animCache.Insert(hier); CLink<CAnimBlendHierarchy*> *link = ms_animCache.Insert(hier);
if(link == nil){ if(link == nil){
ms_animCache.tail.prev->item->RemoveUncompressedData(); CAnimBlendHierarchy *lastHier = ms_animCache.tail.prev->item;
lastHier->RemoveUncompressedData();
ms_animCache.Remove(ms_animCache.tail.prev); ms_animCache.Remove(ms_animCache.tail.prev);
ms_animCache.tail.prev->item->linkPtr = nil; lastHier->linkPtr = nil;
link = ms_animCache.Insert(hier); link = ms_animCache.Insert(hier);
} }
hier->linkPtr = link; hier->linkPtr = link;

View File

@ -585,7 +585,7 @@ 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);
} }
@ -593,7 +593,7 @@ void CCarAI::TellOccupantsToLeaveCar(CVehicle* pVehicle)
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]->m_leaveCarTimer = timer; pVehicle->pPassengers[i]->m_leaveCarTimer = timer;
pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle); pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
timer += CGeneral::GetRandomNumberInRange(200, 400); timer += CGeneral::GetRandomNumberInRange(200, 400);
} }
} }
@ -602,7 +602,7 @@ void CCarAI::TellOccupantsToLeaveCar(CVehicle* pVehicle)
void CCarAI::TellOccupantsToFleeCar(CVehicle* pVehicle) void CCarAI::TellOccupantsToFleeCar(CVehicle* pVehicle)
{ {
if (pVehicle->pDriver && !pVehicle->pDriver->IsPlayer()) { if (pVehicle->pDriver && !pVehicle->pDriver->IsPlayer()) {
pVehicle->pDriver->SetObjective(OBJECTIVE_FLEE_TILL_SAFE); pVehicle->pDriver->SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
if (pVehicle->GetModelIndex() != MI_FIRETRUCK && pVehicle->GetModelIndex() == MI_AMBULAN) if (pVehicle->GetModelIndex() != MI_FIRETRUCK && pVehicle->GetModelIndex() == MI_AMBULAN)
pVehicle->pDriver->Say(SOUND_PED_LEAVE_VEHICLE); pVehicle->pDriver->Say(SOUND_PED_LEAVE_VEHICLE);
} }
@ -610,7 +610,7 @@ void CCarAI::TellOccupantsToFleeCar(CVehicle* pVehicle)
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]->m_leaveCarTimer = timer; pVehicle->pPassengers[i]->m_leaveCarTimer = timer;
pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_FLEE_TILL_SAFE); pVehicle->pPassengers[i]->SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
timer += CGeneral::GetRandomNumberInRange(200, 400); timer += CGeneral::GetRandomNumberInRange(200, 400);
} }
} }

View File

@ -701,7 +701,7 @@ CCarCtrl::GenerateOneRandomCar()
pVehicle->SetMoveSpeed(0.0f, 0.0f, 0.0f); pVehicle->SetMoveSpeed(0.0f, 0.0f, 0.0f);
for (int i = 0; i < pVehicle->m_nNumPassengers; i++) { for (int i = 0; i < pVehicle->m_nNumPassengers; 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);
pVehicle->pPassengers[i]->m_nLastPedState = PED_WANDER_PATH; pVehicle->pPassengers[i]->m_nLastPedState = PED_WANDER_PATH;
pVehicle->pPassengers[i]->m_vehicleInAccident = pVehicle; pVehicle->pPassengers[i]->m_vehicleInAccident = pVehicle;
pVehicle->pPassengers[i]->bDeadPedInFrontOfCar = true; pVehicle->pPassengers[i]->bDeadPedInFrontOfCar = true;
@ -709,7 +709,7 @@ CCarCtrl::GenerateOneRandomCar()
} }
} }
if (pVehicle->pDriver) { if (pVehicle->pDriver) {
pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pVehicle); pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
pVehicle->pDriver->m_nLastPedState = PED_WANDER_PATH; pVehicle->pDriver->m_nLastPedState = PED_WANDER_PATH;
pVehicle->pDriver->m_vehicleInAccident = pVehicle; pVehicle->pDriver->m_vehicleInAccident = pVehicle;
pVehicle->pDriver->bDeadPedInFrontOfCar = true; pVehicle->pDriver->bDeadPedInFrontOfCar = true;

View File

@ -503,7 +503,7 @@ CGameLogic::UpdateShortCut()
case SHORTCUT_ARRIVING: case SHORTCUT_ARRIVING:
if (CTimer::GetTimeInMilliseconds() > ShortCutTimer) { if (CTimer::GetTimeInMilliseconds() > ShortCutTimer) {
CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - SHORTCUT_TAXI_COST); CWorld::Players[CWorld::PlayerInFocus].m_nMoney = Max(0, CWorld::Players[CWorld::PlayerInFocus].m_nMoney - SHORTCUT_TAXI_COST);
FindPlayerPed()->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pShortCutTaxi); FindPlayerPed()->SetObjective(OBJECTIVE_LEAVE_CAR, pShortCutTaxi);
FindPlayerPed()->m_carInObjective = pShortCutTaxi; FindPlayerPed()->m_carInObjective = pShortCutTaxi;
ShortCutState = SHORTCUT_GETTING_OUT; ShortCutState = SHORTCUT_GETTING_OUT;
} }

View File

@ -1100,7 +1100,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_fInfX || pVehicle->GetPosition().x > m_fSupX || if (pVehicle->GetPosition().x < m_fInfX || pVehicle->GetPosition().x > m_fSupX ||

View File

@ -34,18 +34,6 @@ CPed *CPhoneInfo::pCallBackPed; // ped who picking up the phone (reset after pic
after 60 seconds of last phone pick-up. after 60 seconds of last phone pick-up.
*/ */
#ifdef TOGGLEABLE_BETA_FEATURES
CPed* crimeReporters[NUMPHONES] = {};
bool
isPhoneAvailable(int m_phoneId)
{
return gPhoneInfo.m_aPhones[m_phoneId].m_nState == PHONE_STATE_FREE &&
(crimeReporters[m_phoneId] == nil || !crimeReporters[m_phoneId]->IsPointerValid() || !crimeReporters[m_phoneId]->bRunningToPhone || crimeReporters[m_phoneId]->m_objective > OBJECTIVE_IDLE ||
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));
}
#endif
void void
CPhoneInfo::Update(void) CPhoneInfo::Update(void)
{ {
@ -164,11 +152,7 @@ CPhoneInfo::FindNearestFreePhone(CVector *pos)
for (int phoneId = 0; phoneId < m_nMax; phoneId++) { for (int phoneId = 0; phoneId < m_nMax; phoneId++) {
if (gPhoneInfo.m_aPhones[phoneId].m_nState == PHONE_STATE_FREE if (gPhoneInfo.m_aPhones[phoneId].m_nState == PHONE_STATE_FREE) {
#ifdef TOGGLEABLE_BETA_FEATURES
&& isPhoneAvailable(phoneId)
#endif
) {
float phoneDist = (m_aPhones[phoneId].m_vecPos - *pos).Magnitude2D(); float phoneDist = (m_aPhones[phoneId].m_vecPos - *pos).Magnitude2D();
if (phoneDist < nearestPhoneDist) { if (phoneDist < nearestPhoneDist) {

View File

@ -66,9 +66,4 @@ public:
extern CPhoneInfo gPhoneInfo; extern CPhoneInfo gPhoneInfo;
void PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg); void PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg);
void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg); void PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg);
#ifdef TOGGLEABLE_BETA_FEATURES
extern CPed *crimeReporters[NUMPHONES];
bool isPhoneAvailable(int);
#endif

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

@ -1530,7 +1530,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
CPed* pTestedPed = ped->m_nearPeds[i]; CPed* pTestedPed = ped->m_nearPeds[i];
if (!pTestedPed || !IsPedPointerValid(pTestedPed)) if (!pTestedPed || !IsPedPointerValid(pTestedPed))
continue; continue;
if (pTestedPed->m_pedInObjective == ped && pTestedPed->m_objective == OBJECTIVE_FOLLOW_PED_IN_FORMATION) { if (pTestedPed->m_pedInObjective == ped && pTestedPed->m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION) {
CVector vFollowerPos = pTestedPed->GetFormationPosition(); CVector vFollowerPos = pTestedPed->GetFormationPosition();
CTheScripts::ClearSpaceForMissionEntity(vFollowerPos, ped); CTheScripts::ClearSpaceForMissionEntity(vFollowerPos, ped);
bool bFound = false; bool bFound = false;
@ -2070,7 +2070,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* ped = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(ped); 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:
@ -3840,7 +3840,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); 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:
@ -4321,7 +4321,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
assert(pPed); 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:
@ -4353,7 +4353,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
assert(pPed); 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_DESTROY_OBJ, pVehicle); pPed->SetObjective(OBJECTIVE_DESTROY_OBJECT, pVehicle);
return 0; return 0;
} }
case COMMAND_SET_CHAR_OBJ_DESTROY_CAR: case COMMAND_SET_CHAR_OBJ_DESTROY_CAR:
@ -6568,7 +6568,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
assert(pPed); 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;
} }
@ -8804,7 +8804,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); assert(pPed);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_LEAVE_VEHICLE, pPed->m_pMyVehicle); pPed->SetObjective(OBJECTIVE_LEAVE_CAR, pPed->m_pMyVehicle);
return 0; return 0;
} }
case COMMAND_SET_SPRITES_DRAW_BEFORE_FADE: case COMMAND_SET_SPRITES_DRAW_BEFORE_FADE:
@ -9537,7 +9537,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_VEHICLE && pPed->m_pMyVehicle == pVehicle); UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_CAR && pPed->m_pMyVehicle == pVehicle);
return 0; return 0;
} }
case COMMAND_IS_PLAYER_SITTING_IN_ANY_CAR: case COMMAND_IS_PLAYER_SITTING_IN_ANY_CAR:
@ -9545,7 +9545,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed; CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
assert(pPed); assert(pPed);
UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_VEHICLE); UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_CAR);
return 0; return 0;
} }
/* /*
@ -9582,7 +9582,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
assert(pPed); assert(pPed);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]); CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
assert(pVehicle); assert(pVehicle);
UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_VEHICLE && pPed->m_pMyVehicle == pVehicle); UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_CAR && pPed->m_pMyVehicle == pVehicle);
return 0; return 0;
} }
case COMMAND_IS_CHAR_SITTING_IN_ANY_CAR: case COMMAND_IS_CHAR_SITTING_IN_ANY_CAR:
@ -9590,7 +9590,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]); CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
assert(pPed); assert(pPed);
UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_VEHICLE); UpdateCompareFlag(pPed->GetPedState() == PED_DRIVING && pPed->m_objective != OBJECTIVE_LEAVE_CAR);
return 0; return 0;
} }
case COMMAND_IS_PLAYER_ON_FOOT: case COMMAND_IS_PLAYER_ON_FOOT:
@ -10718,7 +10718,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]); CPed* pTargetPed = CPools::GetPedPool()->GetAt(ScriptParams[1]);
assert(pTargetPed); assert(pTargetPed);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_AIM_GUN_AT_PED, pTargetPed); pPed->SetObjective(OBJECTIVE_AIM_GUN_AT, pTargetPed);
return 0; return 0;
} }
case COMMAND_SWITCH_SECURITY_CAMERA: case COMMAND_SWITCH_SECURITY_CAMERA:
@ -11134,7 +11134,7 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
pos.y = *(float*)&ScriptParams[2]; pos.y = *(float*)&ScriptParams[2];
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
pPed->bScriptObjectiveCompleted = false; pPed->bScriptObjectiveCompleted = false;
pPed->SetObjective(OBJECTIVE_SPRINT_TO_COORD, pos); pPed->SetObjective(OBJECTIVE_SPRINT_TO_AREA, pos);
return 0; return 0;
} }
case COMMAND_CREATE_SWAT_ROPE: case COMMAND_CREATE_SWAT_ROPE:
@ -14239,7 +14239,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

@ -5071,7 +5071,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

@ -18,6 +18,9 @@ enum eCrimeType {
CRIME_COP_BURNED, CRIME_COP_BURNED,
CRIME_VEHICLE_BURNED, CRIME_VEHICLE_BURNED,
CRIME_DESTROYED_CESSNA, CRIME_DESTROYED_CESSNA,
CRIME_EXPLOSION,
CRIME_HIT_PED_NASTYWEAPON,
CRIME_HIT_COP_NASTYWEAPON,
NUM_CRIME_TYPES NUM_CRIME_TYPES
}; };

View File

@ -187,6 +187,7 @@ CEventList::FindClosestEvent(eEventType type, CVector posn, int32 *event)
return found; return found;
} }
// --MIAMI: Done
void void
CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCare) CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCare)
{ {
@ -201,19 +202,31 @@ CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCar
case EVENT_HIT_AND_RUN_COP: crime = CRIME_RUNOVER_COP; break; case EVENT_HIT_AND_RUN_COP: crime = CRIME_RUNOVER_COP; break;
case EVENT_SHOOT_PED: crime = CRIME_SHOOT_PED; break; case EVENT_SHOOT_PED: crime = CRIME_SHOOT_PED; break;
case EVENT_SHOOT_COP: crime = CRIME_SHOOT_COP; break; case EVENT_SHOOT_COP: crime = CRIME_SHOOT_COP; break;
case EVENT_EXPLOSION: crime = CRIME_EXPLOSION; break;
case EVENT_PED_SET_ON_FIRE: crime = CRIME_PED_BURNED; break; case EVENT_PED_SET_ON_FIRE: crime = CRIME_PED_BURNED; break;
case EVENT_COP_SET_ON_FIRE: crime = CRIME_COP_BURNED; break; case EVENT_COP_SET_ON_FIRE: crime = CRIME_COP_BURNED; break;
case EVENT_CAR_SET_ON_FIRE: crime = CRIME_VEHICLE_BURNED; break; case EVENT_CAR_SET_ON_FIRE: crime = CRIME_VEHICLE_BURNED; break;
case EVENT_ASSAULT_NASTYWEAPON: crime = CRIME_HIT_PED_NASTYWEAPON; break;
case EVENT_ASSAULT_NASTYWEAPON_POLICE: crime = CRIME_HIT_COP_NASTYWEAPON; break;
default: crime = CRIME_NONE; break; default: crime = CRIME_NONE; break;
} }
if (crime == CRIME_HIT_PED && IsPedPointerValid((CPed*)crimeId) && FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 && ((CPed*)crimeId)->bBeingChasedByPolice) {
if (!((CPed*)crimeId)->DyingOrDead()) {
CMessages::AddBigMessage(TheText.Get("GOODBOY"), 5000, 0);
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 50;
}
return;
}
if(crime == CRIME_NONE) if(crime == CRIME_NONE)
return; return;
CVector playerPedCoors = FindPlayerPed()->GetPosition(); CVector playerPedCoors = FindPlayerPed()->GetPosition();
CVector playerCoors = FindPlayerCoors(); CVector playerCoors = FindPlayerCoors();
if(CWanted::WorkOutPolicePresence(playerCoors, 14.0f) != 0){ if(CWanted::WorkOutPolicePresence(playerCoors, 14.0f) != 0 ||
CGame::germanGame && (crime == CRIME_SHOOT_PED || crime == CRIME_SHOOT_COP || crime == CRIME_COP_BURNED || crime == CRIME_VEHICLE_BURNED)){
FindPlayerPed()->m_pWanted->RegisterCrime_Immediately(crime, playerPedCoors, crimeId, copsDontCare); FindPlayerPed()->m_pWanted->RegisterCrime_Immediately(crime, playerPedCoors, crimeId, copsDontCare);
FindPlayerPed()->m_pWanted->SetWantedLevelNoDrop(1); FindPlayerPed()->m_pWanted->SetWantedLevelNoDrop(1);
}else }else
@ -221,7 +234,7 @@ CEventList::ReportCrimeForEvent(eEventType type, int32 crimeId, bool copsDontCar
if(type == EVENT_ASSAULT_POLICE) if(type == EVENT_ASSAULT_POLICE)
FindPlayerPed()->SetWantedLevelNoDrop(1); FindPlayerPed()->SetWantedLevelNoDrop(1);
if(type == EVENT_SHOOT_COP) if(type == EVENT_SHOOT_COP || type == EVENT_ASSAULT_NASTYWEAPON_POLICE)
FindPlayerPed()->SetWantedLevelNoDrop(2); FindPlayerPed()->SetWantedLevelNoDrop(2);
} }

View File

@ -315,13 +315,13 @@ void ArmourCheat()
void WantedLevelUpCheat() void WantedLevelUpCheat()
{ {
CHud::SetHelpMessage(TheText.Get("CHEAT5"), true); CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
FindPlayerPed()->SetWantedLevel(Min(FindPlayerPed()->m_pWanted->m_nWantedLevel + 2, 6)); FindPlayerPed()->m_pWanted->CheatWantedLevel(Min(FindPlayerPed()->m_pWanted->m_nWantedLevel + 2, 6));
} }
void WantedLevelDownCheat() void WantedLevelDownCheat()
{ {
CHud::SetHelpMessage(TheText.Get("CHEAT5"), true); CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
FindPlayerPed()->SetWantedLevel(0); FindPlayerPed()->m_pWanted->CheatWantedLevel(0);
} }
void SunnyWeatherCheat() void SunnyWeatherCheat()

View File

@ -416,7 +416,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

@ -12,14 +12,18 @@
#include "General.h" #include "General.h"
int32 CWanted::MaximumWantedLevel = 6; int32 CWanted::MaximumWantedLevel = 6;
int32 CWanted::nMaximumWantedLevel = 6400; int32 CWanted::nMaximumWantedLevel = 9600;
// --MIAMI: File done except stats
void void
CWanted::Initialise() CWanted::Initialise()
{ {
m_nChaos = 0; m_nChaos = 0;
m_nMinChaos = 0;
m_nLastUpdateTime = 0; m_nLastUpdateTime = 0;
m_nLastWantedLevelChange = 0; m_nLastWantedLevelChange = 0;
m_nLastTimeSuspended = 0;
m_CurrentCops = 0; m_CurrentCops = 0;
m_MaxCops = 0; m_MaxCops = 0;
m_MaximumLawEnforcerVehicles = 0; m_MaximumLawEnforcerVehicles = 0;
@ -31,6 +35,7 @@ CWanted::Initialise()
m_bArmyRequired = false; m_bArmyRequired = false;
m_fCrimeSensitivity = 1.0f; m_fCrimeSensitivity = 1.0f;
m_nWantedLevel = 0; m_nWantedLevel = 0;
m_nMinWantedLevel = 0;
m_CopsBeatingSuspect = 0; m_CopsBeatingSuspect = 0;
for (int i = 0; i < ARRAY_SIZE(m_pCops); i++) for (int i = 0; i < ARRAY_SIZE(m_pCops); i++)
@ -75,7 +80,7 @@ CWanted::NumOfHelisRequired()
return 1; return 1;
case 5: case 5:
case 6: case 6:
return 2; return 1;
default: default:
return 0; return 0;
} }
@ -93,22 +98,22 @@ CWanted::SetWantedLevel(int32 level)
m_nChaos = 0; m_nChaos = 0;
break; break;
case 1: case 1:
m_nChaos = 60; m_nChaos = 70;
break; break;
case 2: case 2:
m_nChaos = 220; m_nChaos = 200;
break; break;
case 3: case 3:
m_nChaos = 420; m_nChaos = 570;
break; break;
case 4: case 4:
m_nChaos = 820; m_nChaos = 1220;
break; break;
case 5: case 5:
m_nChaos = 1620; m_nChaos = 2420;
break; break;
case 6: case 6:
m_nChaos = 3220; m_nChaos = 4820;
break; break;
default: default:
break; break;
@ -119,10 +124,20 @@ CWanted::SetWantedLevel(int32 level)
void void
CWanted::SetWantedLevelNoDrop(int32 level) CWanted::SetWantedLevelNoDrop(int32 level)
{ {
if (m_nWantedLevel < m_nMinWantedLevel)
SetWantedLevel(m_nMinWantedLevel);
if (level > m_nWantedLevel) if (level > m_nWantedLevel)
SetWantedLevel(level); SetWantedLevel(level);
} }
void
CWanted::CheatWantedLevel(int32 level)
{
SetWantedLevel(level);
UpdateWantedLevel();
}
void void
CWanted::SetMaximumWantedLevel(int32 level) CWanted::SetMaximumWantedLevel(int32 level)
{ {
@ -132,27 +147,27 @@ CWanted::SetMaximumWantedLevel(int32 level)
MaximumWantedLevel = 0; MaximumWantedLevel = 0;
break; break;
case 1: case 1:
nMaximumWantedLevel = 120; nMaximumWantedLevel = 115;
MaximumWantedLevel = 1; MaximumWantedLevel = 1;
break; break;
case 2: case 2:
nMaximumWantedLevel = 300; nMaximumWantedLevel = 365;
MaximumWantedLevel = 2; MaximumWantedLevel = 2;
break; break;
case 3: case 3:
nMaximumWantedLevel = 600; nMaximumWantedLevel = 875;
MaximumWantedLevel = 3; MaximumWantedLevel = 3;
break; break;
case 4: case 4:
nMaximumWantedLevel = 1200; nMaximumWantedLevel = 1800;
MaximumWantedLevel = 4; MaximumWantedLevel = 4;
break; break;
case 5: case 5:
nMaximumWantedLevel = 2400; nMaximumWantedLevel = 3600;
MaximumWantedLevel = 5; MaximumWantedLevel = 5;
break; break;
case 6: case 6:
nMaximumWantedLevel = 4800; nMaximumWantedLevel = 7200;
MaximumWantedLevel = 6; MaximumWantedLevel = 6;
break; break;
} }
@ -167,7 +182,11 @@ CWanted::RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool po
void void
CWanted::RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare) CWanted::RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare)
{ {
#ifdef FIX_BUGS
if(!AddCrimeToQ(type, id, coors, true, policeDoesntCare))
#else
if(!AddCrimeToQ(type, id, coors, false, policeDoesntCare)) if(!AddCrimeToQ(type, id, coors, false, policeDoesntCare))
#endif
ReportCrimeNow(type, coors, policeDoesntCare); ReportCrimeNow(type, coors, policeDoesntCare);
} }
@ -271,14 +290,25 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt
case CRIME_DESTROYED_CESSNA: case CRIME_DESTROYED_CESSNA:
m_nChaos += 500.0f*chaos; m_nChaos += 500.0f*chaos;
break; break;
case CRIME_EXPLOSION:
m_nChaos += 25.0f * chaos;
break;
case CRIME_HIT_PED_NASTYWEAPON:
m_nChaos += 35.0f * chaos;
break;
case CRIME_HIT_COP_NASTYWEAPON:
m_nChaos += 100.0f * chaos;
break;
default: default:
// Error("Undefined crime type, RegisterCrime, Crime.cpp"); // different file for some reason // Error("Undefined crime type, RegisterCrime, Crime.cpp"); // different file for some reason
Error("Undefined crime type, RegisterCrime, Wanted.cpp"); Error("Undefined crime type, RegisterCrime, Wanted.cpp");
} }
m_nChaos = Max(m_nChaos, m_nMinChaos);
DMAudio.ReportCrime(type, coors); DMAudio.ReportCrime(type, coors);
UpdateWantedLevel(); UpdateWantedLevel();
} }
// TODO(Miami): Stats
void void
CWanted::UpdateWantedLevel() CWanted::UpdateWantedLevel()
{ {
@ -287,47 +317,41 @@ CWanted::UpdateWantedLevel()
if (m_nChaos > nMaximumWantedLevel) if (m_nChaos > nMaximumWantedLevel)
m_nChaos = nMaximumWantedLevel; m_nChaos = nMaximumWantedLevel;
if (m_nChaos >= 0 && m_nChaos < 40) { if (m_nChaos >= 0 && m_nChaos < 50) {
m_nWantedLevel = 0; m_nWantedLevel = 0;
m_MaximumLawEnforcerVehicles = 0; m_MaximumLawEnforcerVehicles = 0;
m_MaxCops = 0; m_MaxCops = 0;
m_RoadblockDensity = 0; m_RoadblockDensity = 0;
} } else if (m_nChaos >= 50 && m_nChaos < 180) {
else if (m_nChaos >= 40 && m_nChaos < 200) {
m_nWantedLevel = 1; m_nWantedLevel = 1;
m_MaximumLawEnforcerVehicles = 1; m_MaximumLawEnforcerVehicles = 1;
m_MaxCops = 1; m_MaxCops = 1;
m_RoadblockDensity = 0; m_RoadblockDensity = 0;
} } else if (m_nChaos >= 180 && m_nChaos < 550) {
else if (m_nChaos >= 200 && m_nChaos < 400) {
m_nWantedLevel = 2; m_nWantedLevel = 2;
m_MaximumLawEnforcerVehicles = 2; m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 3; m_MaxCops = 3;
m_RoadblockDensity = 0; m_RoadblockDensity = 0;
} } else if (m_nChaos >= 550 && m_nChaos < 1200) {
else if (m_nChaos >= 400 && m_nChaos < 800) {
m_nWantedLevel = 3; m_nWantedLevel = 3;
m_MaximumLawEnforcerVehicles = 2; m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 4; m_MaxCops = 4;
m_RoadblockDensity = 4; m_RoadblockDensity = 12;
} } else if (m_nChaos >= 1200 && m_nChaos < 2400) {
else if (m_nChaos >= 800 && m_nChaos < 1600) {
m_nWantedLevel = 4; m_nWantedLevel = 4;
m_MaximumLawEnforcerVehicles = 2; m_MaximumLawEnforcerVehicles = 2;
m_MaxCops = 6; m_MaxCops = 6;
m_RoadblockDensity = 8; m_RoadblockDensity = 18;
} } else if (m_nChaos >= 2400 && m_nChaos < 4800) {
else if (m_nChaos >= 1600 && m_nChaos < 3200) {
m_nWantedLevel = 5; m_nWantedLevel = 5;
m_MaximumLawEnforcerVehicles = 3; m_MaximumLawEnforcerVehicles = 3;
m_MaxCops = 8; m_MaxCops = 8;
m_RoadblockDensity = 10; m_RoadblockDensity = 24;
} } else if (m_nChaos >= 4800) {
else if (m_nChaos >= 3200) {
m_nWantedLevel = 6; m_nWantedLevel = 6;
m_MaximumLawEnforcerVehicles = 3; m_MaximumLawEnforcerVehicles = 3;
m_MaxCops = 10; m_MaxCops = 10;
m_RoadblockDensity = 12; m_RoadblockDensity = 30;
} }
if (CurrWantedLevel != m_nWantedLevel) if (CurrWantedLevel != m_nWantedLevel)
@ -369,6 +393,10 @@ CWanted::WorkOutPolicePresence(CVector posn, float radius)
void void
CWanted::Update(void) CWanted::Update(void)
{ {
if (CTimer::GetTimeInMilliseconds() > m_nLastTimeSuspended + 20000) {
m_nMinChaos = 0;
m_nMinWantedLevel = 0;
}
if (CTimer::GetTimeInMilliseconds() - m_nLastUpdateTime > 1000) { if (CTimer::GetTimeInMilliseconds() - m_nLastUpdateTime > 1000) {
if (m_nWantedLevel > 1) { if (m_nWantedLevel > 1) {
m_nLastUpdateTime = CTimer::GetTimeInMilliseconds(); m_nLastUpdateTime = CTimer::GetTimeInMilliseconds();
@ -466,6 +494,12 @@ CWanted::UpdateCrimesQ(void)
void void
CWanted::Suspend(void) CWanted::Suspend(void)
{ {
// TODO(MIAMI)! // TODO(Miami): Stats
Reset(); // <- temporary // dwStarsEvaded += m_nWantedLevel;
m_nMinChaos = m_nChaos;
m_nMinWantedLevel = m_nWantedLevel;
m_nLastTimeSuspended = CTimer::GetTimeInMilliseconds();
m_nChaos = 0;
m_nWantedLevel = 0;
ResetPolicePursuit();
} }

View File

@ -9,8 +9,10 @@ class CWanted
{ {
public: public:
int32 m_nChaos; int32 m_nChaos;
int32 m_nMinChaos;
int32 m_nLastUpdateTime; int32 m_nLastUpdateTime;
uint32 m_nLastWantedLevelChange; uint32 m_nLastWantedLevelChange;
uint32 m_nLastTimeSuspended;
float m_fCrimeSensitivity; float m_fCrimeSensitivity;
uint8 m_CurrentCops; uint8 m_CurrentCops;
uint8 m_MaxCops; uint8 m_MaxCops;
@ -23,6 +25,7 @@ public:
uint8 m_bFbiRequired : 1; uint8 m_bFbiRequired : 1;
uint8 m_bArmyRequired : 1; uint8 m_bArmyRequired : 1;
int32 m_nWantedLevel; int32 m_nWantedLevel;
int32 m_nMinWantedLevel;
CCrimeBeingQd m_aCrimes[16]; CCrimeBeingQd m_aCrimes[16];
CCopPed *m_pCops[10]; CCopPed *m_pCops[10];
@ -38,6 +41,7 @@ public:
int32 NumOfHelisRequired(); int32 NumOfHelisRequired();
void SetWantedLevel(int32); void SetWantedLevel(int32);
void SetWantedLevelNoDrop(int32 level); void SetWantedLevelNoDrop(int32 level);
void CheatWantedLevel(int32 level);
void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare); void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare); void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
void ClearQdCrimes(); void ClearQdCrimes();

View File

@ -204,7 +204,6 @@ enum Config {
// Just debug menu entries // Just debug menu entries
#ifdef DEBUGMENU #ifdef DEBUGMENU
#define TOGGLEABLE_BETA_FEATURES // not too many things
#define RELOADABLES // some debug menu options to reload TXD files #define RELOADABLES // some debug menu options to reload TXD files
#define MISSION_SWITCHER // from debug menu #define MISSION_SWITCHER // from debug menu
#endif #endif

View File

@ -118,31 +118,12 @@ CCivilianPed::CivilianAI(void)
investigateDeadPed = false; investigateDeadPed = false;
} }
#ifdef TOGGLEABLE_BETA_FEATURES
eCrimeType crime = (((CPed*)m_pEventEntity)->m_ped_flagI40 ?
(((CPed*)m_pEventEntity)->m_nPedType == PEDTYPE_COP ? CRIME_RUNOVER_COP : CRIME_RUNOVER_PED) :
(((CPed*)m_pEventEntity)->m_nPedType == PEDTYPE_COP ? CRIME_SHOOT_COP : CRIME_SHOOT_PED));
bool eligibleToReport = bMakePedsRunToPhonesToReportCrimes && killerOfDeadPed && killerOfDeadPed->IsPed() && ((CPed*)killerOfDeadPed)->IsPlayer() &&
m_pedStats->m_fear <= m_pedStats->m_lawfulness && m_pedStats->m_temper <= m_pedStats->m_fear;
if (IsGangMember() || !eligibleToReport || !RunToReportCrime(crime))
#endif
if (investigateDeadPed) if (investigateDeadPed)
SetInvestigateEvent(EVENT_DEAD_PED, CVector2D(m_pEventEntity->GetPosition()), 1.0f, 20000, 0.0f); SetInvestigateEvent(EVENT_DEAD_PED, CVector2D(m_pEventEntity->GetPosition()), 1.0f, 20000, 0.0f);
} else { } else {
#ifdef TOGGLEABLE_BETA_FEATURES SetFindPathAndFlee(m_pEventEntity, 5000);
CEntity* killerOfDeadPed = ((CPed*)m_pEventEntity)->m_threatEntity; SetMoveState(PEDMOVE_RUN);
eCrimeType crime = (((CPed*)m_pEventEntity)->m_ped_flagI40 ?
(((CPed*)m_pEventEntity)->m_nPedType == PEDTYPE_COP ? CRIME_RUNOVER_COP : CRIME_RUNOVER_PED) :
(((CPed*)m_pEventEntity)->m_nPedType == PEDTYPE_COP ? CRIME_SHOOT_COP : CRIME_SHOOT_PED));
bool eligibleToReport = bMakePedsRunToPhonesToReportCrimes && killerOfDeadPed && killerOfDeadPed->IsPed() && ((CPed*)killerOfDeadPed)->IsPlayer() &&
m_pedStats->m_fear <= m_pedStats->m_lawfulness && m_pedStats->m_temper <= m_pedStats->m_fear;
if(!eligibleToReport || !RunToReportCrime(crime))
#endif
{
SetFindPathAndFlee(m_pEventEntity, 5000);
SetMoveState(PEDMOVE_RUN);
}
} }
} else if (closestThreatFlag == PED_FLAG_EXPLOSION) { } else if (closestThreatFlag == PED_FLAG_EXPLOSION) {
CVector2D eventDistVec = m_eventOrThreat - GetPosition(); CVector2D eventDistVec = m_eventOrThreat - GetPosition();
@ -219,18 +200,7 @@ CCivilianPed::ProcessControl(void)
if (Seek()) { if (Seek()) {
if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA || IsUseAttractorObjective(m_objective)) && m_pNextPathNode) { if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA || IsUseAttractorObjective(m_objective)) && m_pNextPathNode) {
m_pNextPathNode = nil; m_pNextPathNode = nil;
#ifdef TOGGLEABLE_BETA_FEATURES
} else if (bRunningToPhone && m_objective < OBJECTIVE_FLEE_TILL_SAFE) {
if (!isPhoneAvailable(m_phoneId)) {
RestorePreviousState();
crimeReporters[m_phoneId] = nil;
m_phoneId = -1;
bRunningToPhone = false;
} else {
crimeReporters[m_phoneId] = this;
m_nPedState = PED_FACE_PHONE;
}
#else
} else if (bRunningToPhone) { } else if (bRunningToPhone) {
if (gPhoneInfo.m_aPhones[m_phoneId].m_nState != PHONE_STATE_FREE) { if (gPhoneInfo.m_aPhones[m_phoneId].m_nState != PHONE_STATE_FREE) {
RestorePreviousState(); RestorePreviousState();
@ -239,9 +209,8 @@ CCivilianPed::ProcessControl(void)
gPhoneInfo.m_aPhones[m_phoneId].m_nState = PHONE_STATE_REPORTING_CRIME; gPhoneInfo.m_aPhones[m_phoneId].m_nState = PHONE_STATE_REPORTING_CRIME;
m_nPedState = PED_FACE_PHONE; m_nPedState = PED_FACE_PHONE;
} }
#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;
@ -331,13 +300,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 = CWorld::Players[0].m_nMaxHealth + 25.0f; m_pMyVehicle->pDriver->m_fHealth = CWorld::Players[0].m_nMaxHealth + 25.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;
@ -350,7 +319,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

@ -185,12 +185,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

@ -143,11 +143,6 @@ void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->N
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); } void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); }
#ifdef TOGGLEABLE_BETA_FEATURES
bool CPed::bPopHeadsOnHeadshot = false;
bool CPed::bMakePedsRunToPhonesToReportCrimes = false;
#endif
// --MIAMI: Done // --MIAMI: Done
CPed::~CPed(void) CPed::~CPed(void)
{ {
@ -812,11 +807,7 @@ CPed::RemoveBodyPart(PedNode nodeId, int8 direction)
if(!IsClumpSkinned(GetClump())) if(!IsClumpSkinned(GetClump()))
#endif #endif
{ {
#ifdef TOGGLEABLE_BETA_FEATURES
if (bPopHeadsOnHeadshot || nodeId != PED_HEAD)
#else
if (nodeId != PED_HEAD) if (nodeId != PED_HEAD)
#endif
SpawnFlyingComponent(nodeId, direction); SpawnFlyingComponent(nodeId, direction);
RecurseFrameChildrenVisibilityCB(frame, nil); RecurseFrameChildrenVisibilityCB(frame, nil);
@ -2964,7 +2955,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 ||
objective == OBJECTIVE_LEAVE_CAR_AND_DIE || objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || objective == OBJECTIVE_LEAVE_CAR_AND_DIE || objective == OBJECTIVE_ENTER_CAR_AS_DRIVER ||
objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER; objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER;
} }
@ -2996,7 +2987,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:
@ -3007,13 +2998,13 @@ CPed::ForceStoredObjective(eObjective objective)
case OBJECTIVE_ENTER_CAR_AS_DRIVER: case OBJECTIVE_ENTER_CAR_AS_DRIVER:
case OBJECTIVE_GOTO_AREA_ON_FOOT: case OBJECTIVE_GOTO_AREA_ON_FOOT:
case OBJECTIVE_RUN_TO_AREA: case OBJECTIVE_RUN_TO_AREA:
case OBJECTIVE_USE_SEAT_ATTRACTOR: case OBJECTIVE_GOTO_SEAT_ON_FOOT:
case OBJECTIVE_USE_ATM_ATTRACTOR: case OBJECTIVE_GOTO_ATM_ON_FOOT:
case OBJECTIVE_USE_STOP_ATTRACTOR: case OBJECTIVE_GOTO_BUS_STOP_ON_FOOT:
case OBJECTIVE_USE_PIZZA_ATTRACTOR: case OBJECTIVE_GOTO_PIZZA_ON_FOOT:
case OBJECTIVE_USE_SHELTER_ATTRACTOR: case OBJECTIVE_GOTO_SHELTER_ON_FOOT:
case OBJECTIVE_SPRINT_TO_COORD: case OBJECTIVE_SPRINT_TO_AREA:
case OBJECTIVE_USE_ICECREAM_ATTRACTOR: case OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT:
return; return;
default: default:
m_prevObjective = m_objective; m_prevObjective = m_objective;
@ -3028,7 +3019,7 @@ CPed::SetStoredObjective(void)
return; return;
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:
@ -3040,13 +3031,13 @@ CPed::SetStoredObjective(void)
case OBJECTIVE_ENTER_CAR_AS_DRIVER: case OBJECTIVE_ENTER_CAR_AS_DRIVER:
case OBJECTIVE_GOTO_AREA_ON_FOOT: case OBJECTIVE_GOTO_AREA_ON_FOOT:
case OBJECTIVE_RUN_TO_AREA: case OBJECTIVE_RUN_TO_AREA:
case OBJECTIVE_USE_SEAT_ATTRACTOR: case OBJECTIVE_GOTO_SEAT_ON_FOOT:
case OBJECTIVE_USE_ATM_ATTRACTOR: case OBJECTIVE_GOTO_ATM_ON_FOOT:
case OBJECTIVE_USE_STOP_ATTRACTOR: case OBJECTIVE_GOTO_BUS_STOP_ON_FOOT:
case OBJECTIVE_USE_PIZZA_ATTRACTOR: case OBJECTIVE_GOTO_PIZZA_ON_FOOT:
case OBJECTIVE_USE_SHELTER_ATTRACTOR: case OBJECTIVE_GOTO_SHELTER_ON_FOOT:
case OBJECTIVE_SPRINT_TO_COORD: case OBJECTIVE_SPRINT_TO_AREA:
case OBJECTIVE_USE_ICECREAM_ATTRACTOR: case OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT:
return; return;
default: default:
m_prevObjective = m_objective; m_prevObjective = m_objective;
@ -3060,14 +3051,14 @@ 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
&& m_nPedState != PED_CARJACK) && m_nPedState != PED_CARJACK)
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;
@ -3106,13 +3097,13 @@ 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:
@ -3121,7 +3112,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;
@ -3130,7 +3121,7 @@ CPed::SetObjective(eObjective newObj, void *entity)
if (m_leader == entity) if (m_leader == entity)
return; return;
break; break;
case OBJECTIVE_AIM_GUN_AT_PED: case OBJECTIVE_AIM_GUN_AT:
if (m_pedInObjective == entity) if (m_pedInObjective == entity)
return; return;
break; break;
@ -3138,7 +3129,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
@ -3162,7 +3153,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);
@ -3183,17 +3174,17 @@ CPed::SetObjective(eObjective newObj, void *entity)
case OBJECTIVE_GOTO_CHAR_ON_FOOT: case OBJECTIVE_GOTO_CHAR_ON_FOOT:
case OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING: case OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING:
case OBJECTIVE_HASSLE_CHAR: case OBJECTIVE_HASSLE_CHAR:
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
@ -3222,14 +3213,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())) {
@ -3242,7 +3233,7 @@ CPed::SetObjective(eObjective newObj, void *entity)
SetLeader((CEntity*)entity); SetLeader((CEntity*)entity);
RestorePreviousObjective(); RestorePreviousObjective();
break; break;
case OBJECTIVE_AIM_GUN_AT_PED: case OBJECTIVE_AIM_GUN_AT:
m_pedInObjective = (CPed*)entity; m_pedInObjective = (CPed*)entity;
m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective); m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
break; break;
@ -3276,7 +3267,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
|| m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) && !IsPlayer() && !IsPedInControl()) { || m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) && !IsPlayer() && !IsPedInControl()) {
bStartWanderPathOnFoot = true; bStartWanderPathOnFoot = true;
@ -3373,6 +3364,7 @@ CPed::ClearChat(void)
} }
} }
// --MIAMI: Done
bool bool
CPed::IsGangMember(void) CPed::IsGangMember(void)
{ {
@ -3660,27 +3652,16 @@ CPed::CheckAroundForPossibleCollisions(void)
bool bool
CPed::MakePhonecall(void) CPed::MakePhonecall(void)
{ {
#ifdef TOGGLEABLE_BETA_FEATURES
if (bMakePedsRunToPhonesToReportCrimes)
if (!IsPlayer() && CTimer::GetTimeInMilliseconds() > m_phoneTalkTimer - 7000 && bRunningToPhone) {
FindPlayerPed()->m_pWanted->RegisterCrime_Immediately(m_crimeToReportOnPhone, GetPosition(),
(m_crimeToReportOnPhone == CRIME_POSSESSION_GUN ? (uintptr)m_threatEntity : (uintptr)((CPed*)m_pEventEntity)->m_threatEntity), false);
bRunningToPhone = false;
}
#endif
if (CTimer::GetTimeInMilliseconds() <= m_phoneTalkTimer) if (CTimer::GetTimeInMilliseconds() <= m_phoneTalkTimer)
return false; return false;
SetIdle(); SetIdle();
gPhoneInfo.m_aPhones[m_phoneId].m_nState = PHONE_STATE_FREE; gPhoneInfo.m_aPhones[m_phoneId].m_nState = PHONE_STATE_FREE;
#ifdef TOGGLEABLE_BETA_FEATURES
crimeReporters[m_phoneId] = nil;
#endif
m_phoneId = -1; m_phoneId = -1;
return true; return true;
} }
// --MIAMI: Done
bool bool
CPed::FacePhone(void) CPed::FacePhone(void)
{ {
@ -4737,7 +4718,7 @@ CPed::ClearObjective(void)
if(!IsPlayer()) if(!IsPlayer())
bWanderPathAfterExitingCar = true; bWanderPathAfterExitingCar = true;
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle); SetObjective(OBJECTIVE_LEAVE_CAR, m_pMyVehicle);
} }
m_nLastPedState = PED_NONE; m_nLastPedState = PED_NONE;
} else { } else {
@ -6219,11 +6200,11 @@ 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
|| 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
)) { )) {
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) {
@ -8307,7 +8288,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)) {
@ -8332,7 +8313,7 @@ CPed::Seek(void)
if (!m_pSeekTarget && m_nPedState == PED_SEEK_ENTITY) if (!m_pSeekTarget && m_nPedState == PED_SEEK_ENTITY)
ClearSeek(); ClearSeek();
if (m_objective == OBJECTIVE_FOLLOW_PED_IN_FORMATION && !m_pedInObjective) { if (m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION && !m_pedInObjective) {
m_objective = OBJECTIVE_NONE; m_objective = OBJECTIVE_NONE;
ClearObjective(); ClearObjective();
SetWanderPath(0); SetWanderPath(0);
@ -8342,16 +8323,16 @@ 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_SPRINT_TO_COORD) if (m_objective == OBJECTIVE_SPRINT_TO_AREA)
nextMove = PEDMOVE_SPRINT; nextMove = PEDMOVE_SPRINT;
else if (m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ANY_MEANS || m_objective == OBJECTIVE_RUN_TO_AREA || bIsRunning) else 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;
@ -8450,13 +8431,13 @@ 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;
} }
if (m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA || m_objective == OBJECTIVE_SPRINT_TO_COORD || if (m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA || m_objective == OBJECTIVE_SPRINT_TO_AREA ||
m_objective == OBJECTIVE_GOTO_AREA_ANY_MEANS || IsUseAttractorObjective(m_objective)) { m_objective == OBJECTIVE_GOTO_AREA_ANY_MEANS || IsUseAttractorObjective(m_objective)) {
if (m_pNextPathNode) if (m_pNextPathNode)
@ -9653,10 +9634,6 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
if (car->pDriver) { if (car->pDriver) {
CEventList::RegisterEvent((m_nPedType == PEDTYPE_COP ? EVENT_HIT_AND_RUN_COP : EVENT_HIT_AND_RUN), EVENT_ENTITY_PED, this, car->pDriver, 1000); CEventList::RegisterEvent((m_nPedType == PEDTYPE_COP ? EVENT_HIT_AND_RUN_COP : EVENT_HIT_AND_RUN), EVENT_ENTITY_PED, this, car->pDriver, 1000);
#ifdef TOGGLEABLE_BETA_FEATURES
if (bMakePedsRunToPhonesToReportCrimes)
m_ped_flagI40 = true;
#endif
} }
ePedPieceTypes pieceToDamage; ePedPieceTypes pieceToDamage;
@ -10765,7 +10742,7 @@ CPed::ProcessControl(void)
&& (!IsPlayer() && (!IsPlayer()
|| m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT
|| m_objective == OBJECTIVE_RUN_TO_AREA || m_objective == OBJECTIVE_RUN_TO_AREA
|| m_objective == OBJECTIVE_SPRINT_TO_COORD || m_objective == OBJECTIVE_SPRINT_TO_AREA
|| m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)) { || m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)) {
if (collidingVeh != m_pCurrentPhysSurface || IsPlayer()) { if (collidingVeh != m_pCurrentPhysSurface || IsPlayer()) {
@ -11306,7 +11283,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);
} }
} }
@ -11765,7 +11742,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
&& veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR_AND_DIE && veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR_AND_DIE
|| !veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, nil))))) { || !veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, nil))))) {
@ -11775,7 +11752,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;
@ -11942,7 +11919,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
} }
if (ped->m_vehEnterType == CAR_DOOR_RF && pedInSeat && veh->IsCar()) if (ped->m_vehEnterType == CAR_DOOR_RF && pedInSeat && veh->IsCar())
pedInSeat->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); pedInSeat->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
} }
ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped);
@ -12150,7 +12127,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);
@ -12161,7 +12138,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;
@ -12185,7 +12162,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);
veh->pDriver->SetRadioStation(); veh->pDriver->SetRadioStation();
if (veh->m_nDoorLock == CARLOCK_UNLOCKED) if (veh->m_nDoorLock == CARLOCK_UNLOCKED)
@ -12612,7 +12589,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
// 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())) {
@ -12717,7 +12694,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->bStayInCarOnJack && !passenger->b156_8 && (passenger->m_leader != ped || !ped->bIsLeader)) { if (passenger && !passenger->bStayInCarOnJack && !passenger->b156_8 && (passenger->m_leader != ped || !ped->bIsLeader)) {
passenger->SetObjective(OBJECTIVE_LEAVE_VEHICLE, veh); passenger->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
passenger->m_leaveCarTimer = CTimer::GetTimeInMilliseconds(); passenger->m_leaveCarTimer = CTimer::GetTimeInMilliseconds();
} }
} }
@ -12758,7 +12735,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
if (ped->m_prevObjective == OBJECTIVE_RUN_TO_AREA || ped->m_prevObjective == OBJECTIVE_GOTO_CHAR_ON_FOOT if (ped->m_prevObjective == OBJECTIVE_RUN_TO_AREA || ped->m_prevObjective == OBJECTIVE_GOTO_CHAR_ON_FOOT
|| ped->m_prevObjective == OBJECTIVE_SPRINT_TO_COORD || ped->m_prevObjective == OBJECTIVE_KILL_CHAR_ON_FOOT) || ped->m_prevObjective == OBJECTIVE_SPRINT_TO_AREA || ped->m_prevObjective == OBJECTIVE_KILL_CHAR_ON_FOOT)
ped->m_prevObjective = OBJECTIVE_NONE; ped->m_prevObjective = OBJECTIVE_NONE;
ped->RestorePreviousObjective(); ped->RestorePreviousObjective();
@ -12794,12 +12771,12 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
ped->SetPedState(PED_DRIVING); ped->SetPedState(PED_DRIVING);
if (ped->m_prevObjective == OBJECTIVE_RUN_TO_AREA || ped->m_prevObjective == OBJECTIVE_GOTO_CHAR_ON_FOOT if (ped->m_prevObjective == OBJECTIVE_RUN_TO_AREA || ped->m_prevObjective == OBJECTIVE_GOTO_CHAR_ON_FOOT
|| ped->m_prevObjective == OBJECTIVE_SPRINT_TO_COORD || ped->m_prevObjective == OBJECTIVE_KILL_CHAR_ON_FOOT) || ped->m_prevObjective == OBJECTIVE_SPRINT_TO_AREA || ped->m_prevObjective == OBJECTIVE_KILL_CHAR_ON_FOOT)
ped->m_prevObjective = OBJECTIVE_NONE; ped->m_prevObjective = OBJECTIVE_NONE;
ped->RestorePreviousObjective(); ped->RestorePreviousObjective();
// VC has conditional OBJECTIVE_LEAVE_VEHICLE here, which runs if it entered the first dead condition. // VC has conditional OBJECTIVE_LEAVE_CAR here, which runs if it entered the first dead condition.
if(slowDown) if(slowDown)
veh->AutoPilot.m_nCruiseSpeed = 17; veh->AutoPilot.m_nCruiseSpeed = 17;
@ -12820,18 +12797,18 @@ 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:
case OBJECTIVE_RUN_TO_AREA: case OBJECTIVE_RUN_TO_AREA:
case OBJECTIVE_USE_SEAT_ATTRACTOR: case OBJECTIVE_GOTO_SEAT_ON_FOOT:
case OBJECTIVE_USE_ATM_ATTRACTOR: case OBJECTIVE_GOTO_ATM_ON_FOOT:
case OBJECTIVE_USE_STOP_ATTRACTOR: case OBJECTIVE_GOTO_BUS_STOP_ON_FOOT:
case OBJECTIVE_USE_PIZZA_ATTRACTOR: case OBJECTIVE_GOTO_PIZZA_ON_FOOT:
case OBJECTIVE_USE_SHELTER_ATTRACTOR: case OBJECTIVE_GOTO_SHELTER_ON_FOOT:
case OBJECTIVE_SPRINT_TO_COORD: case OBJECTIVE_SPRINT_TO_AREA:
case OBJECTIVE_USE_ICECREAM_ATTRACTOR: case OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT:
break; break;
default: default:
ped->SetObjective(OBJECTIVE_NONE); ped->SetObjective(OBJECTIVE_NONE);
@ -12885,21 +12862,13 @@ CPed::PedStaggerCB(CAnimBlendAssociation* animAssoc, void* arg)
*/ */
} }
// It's "CPhoneInfo::ProcessNearestFreePhone" in PC IDB, but it's not true, someone made it up. // --MIAMI: Done
bool bool
CPed::RunToReportCrime(eCrimeType crimeToReport) CPed::RunToReportCrime(eCrimeType crimeToReport)
{ {
#ifdef TOGGLEABLE_BETA_FEATURES
if (!bMakePedsRunToPhonesToReportCrimes)
return false;
if (bRunningToPhone)
return true;
#else
// They changed true into false to make this function unusable. So running to phone actually starts but first frame after that cancels it. // They changed true into false to make this function unusable. So running to phone actually starts but first frame after that cancels it.
if (m_nPedState == PED_SEEK_POS) if (m_nPedState == PED_SEEK_POS)
return false; return false;
#endif
CVector pos = GetPosition(); CVector pos = GetPosition();
int phoneId = gPhoneInfo.FindNearestFreePhone(&pos); int phoneId = gPhoneInfo.FindNearestFreePhone(&pos);
@ -12912,9 +12881,8 @@ CPed::RunToReportCrime(eCrimeType crimeToReport)
return false; return false;
bRunningToPhone = true; bRunningToPhone = true;
SetSeek(phone->m_pEntity->GetPosition() - phone->m_pEntity->GetForward(), 1.3f); // original: phone.m_vecPos, 0.3f SetSeek(phone->m_vecPos, 0.3f);
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
bIsRunning = true; // not there in original
m_phoneId = phoneId; m_phoneId = phoneId;
m_crimeToReportOnPhone = crimeToReport; m_crimeToReportOnPhone = crimeToReport;
return true; return true;
@ -13078,7 +13046,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();
else if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) { else if (ped->m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) {
ped->m_fHealth = 0.0f; ped->m_fHealth = 0.0f;
@ -13727,13 +13695,13 @@ 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_GOTO_AREA_IN_CAR: case OBJECTIVE_GOTO_AREA_IN_CAR:
case OBJECTIVE_FOLLOW_CAR_ON_FOOT_WITH_OFFSET: 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:
if (GetPedState() == PED_DRIVING) if (GetPedState() == PED_DRIVING)
m_objective = OBJECTIVE_NONE; m_objective = OBJECTIVE_NONE;
else { else {
@ -13750,9 +13718,9 @@ CPed::ProcessObjective(void)
} }
} }
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);
@ -13794,7 +13762,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:
@ -13804,7 +13772,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()) {
@ -13830,7 +13798,7 @@ CPed::ProcessObjective(void)
|| targetHasVeh && m_pedInObjective->m_pMyVehicle->CanPedExitCar(false)) { || targetHasVeh && m_pedInObjective->m_pMyVehicle->CanPedExitCar(false)) {
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;
@ -13907,7 +13875,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;
} }
@ -13972,7 +13940,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) {
@ -14263,7 +14231,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)
@ -14331,7 +14299,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();
@ -14576,7 +14544,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;
} }
@ -14617,11 +14585,11 @@ CPed::ProcessObjective(void)
} }
case OBJECTIVE_GOTO_AREA_ON_FOOT: case OBJECTIVE_GOTO_AREA_ON_FOOT:
case OBJECTIVE_RUN_TO_AREA: case OBJECTIVE_RUN_TO_AREA:
case OBJECTIVE_SPRINT_TO_COORD: case OBJECTIVE_SPRINT_TO_AREA:
{ {
if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA || m_objective == OBJECTIVE_SPRINT_TO_COORD) if ((m_objective == OBJECTIVE_GOTO_AREA_ON_FOOT || m_objective == OBJECTIVE_RUN_TO_AREA || m_objective == OBJECTIVE_SPRINT_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;
@ -14657,7 +14625,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);
@ -14690,7 +14658,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) {
@ -14895,7 +14863,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()
&& (FindPlayerPed() != this || !CPad::GetPad(0)->GetAccelerate() && (FindPlayerPed() != this || !CPad::GetPad(0)->GetAccelerate()
@ -14921,7 +14889,7 @@ CPed::ProcessObjective(void)
} }
} }
break; break;
case OBJECTIVE_AIM_GUN_AT_PED: case OBJECTIVE_AIM_GUN_AT:
if (m_pedInObjective) { if (m_pedInObjective) {
if (!bObstacleShowedUpDuringKillObjective) if (!bObstacleShowedUpDuringKillObjective)
SetPointGunAt(m_pedInObjective); SetPointGunAt(m_pedInObjective);
@ -14962,12 +14930,12 @@ CPed::ProcessObjective(void)
} }
break; break;
} }
case OBJECTIVE_USE_SEAT_ATTRACTOR: case OBJECTIVE_GOTO_SEAT_ON_FOOT:
case OBJECTIVE_USE_ATM_ATTRACTOR: case OBJECTIVE_GOTO_ATM_ON_FOOT:
case OBJECTIVE_USE_STOP_ATTRACTOR: case OBJECTIVE_GOTO_BUS_STOP_ON_FOOT:
case OBJECTIVE_USE_PIZZA_ATTRACTOR: case OBJECTIVE_GOTO_PIZZA_ON_FOOT:
case OBJECTIVE_USE_SHELTER_ATTRACTOR: case OBJECTIVE_GOTO_SHELTER_ON_FOOT:
case OBJECTIVE_USE_ICECREAM_ATTRACTOR: case OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT:
if (CTimer::GetTimeInMilliseconds() > m_objectiveTimer) { if (CTimer::GetTimeInMilliseconds() > m_objectiveTimer) {
m_objectiveTimer = 0; m_objectiveTimer = 0;
if (m_attractor) if (m_attractor)
@ -14976,7 +14944,7 @@ CPed::ProcessObjective(void)
else { else {
CVector distance = m_nextRoutePointPos - GetPosition(); CVector distance = m_nextRoutePointPos - GetPosition();
distance.z = 0.0f; distance.z = 0.0f;
if (m_objective == OBJECTIVE_USE_SHELTER_ATTRACTOR) { if (m_objective == OBJECTIVE_GOTO_SHELTER_ON_FOOT) {
if (m_nMoveState == PEDMOVE_SPRINT && distance.Magnitude() < SQR(2.0f)) { if (m_nMoveState == PEDMOVE_SPRINT && distance.Magnitude() < SQR(2.0f)) {
SetMoveState(PEDMOVE_WALK); SetMoveState(PEDMOVE_WALK);
bIsRunning = false; bIsRunning = false;
@ -14986,7 +14954,7 @@ CPed::ProcessObjective(void)
return; return;
} }
} }
else if (m_objective == OBJECTIVE_USE_ICECREAM_ATTRACTOR) { else if (m_objective == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT) {
if (m_nMoveState == PEDMOVE_SPRINT && distance.Magnitude() < SQR(4.0f)) { if (m_nMoveState == PEDMOVE_SPRINT && distance.Magnitude() < SQR(4.0f)) {
SetMoveState(PEDMOVE_WALK); SetMoveState(PEDMOVE_WALK);
bIsRunning = false; bIsRunning = false;
@ -15051,7 +15019,7 @@ CPed::ProcessObjective(void)
GetPedAttractorManager()->BroadcastArrival(this, m_attractor); GetPedAttractorManager()->BroadcastArrival(this, m_attractor);
if (GetPedAttractorManager()->IsAtHeadOfQueue(this, m_attractor)) { if (GetPedAttractorManager()->IsAtHeadOfQueue(this, m_attractor)) {
switch (m_objective) { switch (m_objective) {
case OBJECTIVE_USE_SEAT_ATTRACTOR: case OBJECTIVE_GOTO_SEAT_ON_FOOT:
if (!bTurnedAroundOnAttractor) { if (!bTurnedAroundOnAttractor) {
ClearObjective(); ClearObjective();
SetWaitState(WAITSTATE_SIT_DOWN, 0); SetWaitState(WAITSTATE_SIT_DOWN, 0);
@ -15061,27 +15029,27 @@ CPed::ProcessObjective(void)
SetWaitState(WAITSTATE_SIT_DOWN_RVRS, 0); SetWaitState(WAITSTATE_SIT_DOWN_RVRS, 0);
} }
break; break;
case OBJECTIVE_USE_ATM_ATTRACTOR: case OBJECTIVE_GOTO_ATM_ON_FOOT:
ClearObjective(); ClearObjective();
SetWaitState(WAITSTATE_USE_ATM, 0); SetWaitState(WAITSTATE_USE_ATM, 0);
break; break;
case OBJECTIVE_USE_STOP_ATTRACTOR: case OBJECTIVE_GOTO_BUS_STOP_ON_FOOT:
ClearObjective(); ClearObjective();
SetObjective(OBJECTIVE_WAIT_FOR_BUS); SetObjective(OBJECTIVE_WAIT_ON_FOOT_AT_BUS_STOP);
break; break;
case OBJECTIVE_USE_PIZZA_ATTRACTOR: case OBJECTIVE_GOTO_PIZZA_ON_FOOT:
ClearObjective(); ClearObjective();
m_prevObjective = OBJECTIVE_NONE; m_prevObjective = OBJECTIVE_NONE;
SetObjective(OBJECTIVE_IDLE); SetObjective(OBJECTIVE_WAIT_ON_FOOT);
m_objectiveTimer = CTimer::GetTimeInMilliseconds() + m_attractor->GetHeadOfQueueWaitTime(); m_objectiveTimer = CTimer::GetTimeInMilliseconds() + m_attractor->GetHeadOfQueueWaitTime();
break; break;
case OBJECTIVE_USE_SHELTER_ATTRACTOR: case OBJECTIVE_GOTO_SHELTER_ON_FOOT:
m_prevObjective = OBJECTIVE_NONE; m_prevObjective = OBJECTIVE_NONE;
SetObjective(OBJECTIVE_WAIT_FOR_RAIN_TO_END); SetObjective(OBJECTIVE_WAIT_ON_FOOT_AT_SHELTER);
break; break;
case OBJECTIVE_USE_ICECREAM_ATTRACTOR: case OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT:
m_prevObjective = OBJECTIVE_NONE; m_prevObjective = OBJECTIVE_NONE;
SetObjective(OBJECTIVE_PURCHASE_ICECREAM); SetObjective(OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN);
break; break;
} }
} }
@ -15089,12 +15057,12 @@ CPed::ProcessObjective(void)
} }
} }
return; return;
case OBJECTIVE_WAIT_FOR_RAIN_TO_END: case OBJECTIVE_WAIT_ON_FOOT_AT_SHELTER:
SetIdle(); SetIdle();
if (m_attractor && CWeather::Rain < 0.2f) if (m_attractor && CWeather::Rain < 0.2f)
GetPedAttractorManager()->DeRegisterPed(this, m_attractor); GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
break; break;
case OBJECTIVE_WAIT_FOR_BUS: case OBJECTIVE_WAIT_ON_FOOT_AT_BUS_STOP:
SetIdle(); SetIdle();
if (m_attractor) { if (m_attractor) {
float left = GetPosition().x - 10.0f; float left = GetPosition().x - 10.0f;
@ -15134,7 +15102,7 @@ CPed::ProcessObjective(void)
if (pBus) { if (pBus) {
if (pBus->m_nNumPassengers >= pBus->m_nNumMaxPassengers - 1) if (pBus->m_nNumPassengers >= pBus->m_nNumMaxPassengers - 1)
SetObjective(OBJECTIVE_IDLE); SetObjective(OBJECTIVE_WAIT_ON_FOOT);
else { else {
GetPedAttractorManager()->DeRegisterPed(this, m_attractor); GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, pBus); SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, pBus);
@ -15303,14 +15271,11 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
if (m_nMoveState == PEDMOVE_NONE || m_nMoveState == PEDMOVE_STILL) if (m_nMoveState == PEDMOVE_NONE || m_nMoveState == PEDMOVE_STILL)
return; return;
#ifdef TOGGLEABLE_BETA_FEATURES if (CharCreatedBy != MISSION_CHAR && obj->GetModelIndex() == MI_PHONEBOOTH1) {
if (!bMakePedsRunToPhonesToReportCrimes) bool isRunning = m_nMoveState == PEDMOVE_RUN || m_nMoveState == PEDMOVE_SPRINT;
#endif SetFindPathAndFlee(obj, 5000, !isRunning);
if (CharCreatedBy != MISSION_CHAR && obj->GetModelIndex() == MI_PHONEBOOTH1) { return;
bool isRunning = m_nMoveState == PEDMOVE_RUN || m_nMoveState == PEDMOVE_SPRINT; }
SetFindPathAndFlee(obj, 5000, !isRunning);
return;
}
CVector2D adjustedColMin(objColMin.x - 0.35f, objColMin.y - 0.35f); CVector2D adjustedColMin(objColMin.x - 0.35f, objColMin.y - 0.35f);
CVector2D adjustedColMax(objColMax.x + 0.35f, objColMax.y + 0.35f); CVector2D adjustedColMax(objColMax.x + 0.35f, objColMax.y + 0.35f);
@ -15375,7 +15340,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;
@ -17231,7 +17196,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;
} }
@ -17578,7 +17543,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;
} }
@ -17883,7 +17848,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();
@ -18228,14 +18193,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;
} }
@ -18250,12 +18215,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);
@ -18280,7 +18245,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;
@ -18340,7 +18305,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:
@ -18350,11 +18315,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;
@ -18702,12 +18667,12 @@ void
CPed::SetObjective(eObjective newObj, float heading, const CVector& pos) CPed::SetObjective(eObjective newObj, float heading, const CVector& pos)
{ {
switch (newObj) { switch (newObj) {
case OBJECTIVE_USE_SEAT_ATTRACTOR: case OBJECTIVE_GOTO_SEAT_ON_FOOT:
case OBJECTIVE_USE_ATM_ATTRACTOR: case OBJECTIVE_GOTO_ATM_ON_FOOT:
case OBJECTIVE_USE_STOP_ATTRACTOR: case OBJECTIVE_GOTO_BUS_STOP_ON_FOOT:
case OBJECTIVE_USE_PIZZA_ATTRACTOR: case OBJECTIVE_GOTO_PIZZA_ON_FOOT:
case OBJECTIVE_USE_SHELTER_ATTRACTOR: case OBJECTIVE_GOTO_SHELTER_ON_FOOT:
case OBJECTIVE_USE_ICECREAM_ATTRACTOR: case OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT:
ClearPointGunAt(); ClearPointGunAt();
SetObjective(newObj, pos); SetObjective(newObj, pos);
m_attractorHeading = heading; m_attractorHeading = heading;
@ -18725,7 +18690,7 @@ CPed::SetObjective(eObjective newObj, CVector dest)
return; return;
if (m_objective == newObj) { if (m_objective == newObj) {
if (newObj == OBJECTIVE_GOTO_AREA_ANY_MEANS || newObj == OBJECTIVE_GOTO_AREA_ON_FOOT || newObj == OBJECTIVE_RUN_TO_AREA || newObj == OBJECTIVE_SPRINT_TO_COORD) { if (newObj == OBJECTIVE_GOTO_AREA_ANY_MEANS || newObj == OBJECTIVE_GOTO_AREA_ON_FOOT || newObj == OBJECTIVE_RUN_TO_AREA || newObj == OBJECTIVE_SPRINT_TO_AREA) {
if (m_nextRoutePointPos == dest) if (m_nextRoutePointPos == dest)
return; return;
} else if (newObj == OBJECTIVE_GUARD_SPOT) { } else if (newObj == OBJECTIVE_GUARD_SPOT) {
@ -18745,7 +18710,7 @@ 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:
@ -18753,20 +18718,20 @@ CPed::SetObjective(eObjective newObj, CVector dest)
case OBJECTIVE_GOTO_CHAR_ON_FOOT: case OBJECTIVE_GOTO_CHAR_ON_FOOT:
case OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING: case OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING:
case OBJECTIVE_HASSLE_CHAR: case OBJECTIVE_HASSLE_CHAR:
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:
case OBJECTIVE_GOTO_AREA_IN_CAR: case OBJECTIVE_GOTO_AREA_IN_CAR:
case OBJECTIVE_FOLLOW_CAR_ON_FOOT_WITH_OFFSET: case OBJECTIVE_FOLLOW_CAR_ON_FOOT_WITH_OFFSET:
case OBJECTIVE_FIGHT_CHAR: case OBJECTIVE_GUARD_ATTACK:
case OBJECTIVE_SET_LEADER: case OBJECTIVE_SET_LEADER:
case OBJECTIVE_FOLLOW_ROUTE: case OBJECTIVE_FOLLOW_ROUTE:
case OBJECTIVE_SOLICIT: case OBJECTIVE_SOLICIT_VEHICLE:
case OBJECTIVE_HAIL_TAXI: case OBJECTIVE_HAIL_TAXI:
case OBJECTIVE_CATCH_TRAIN: case OBJECTIVE_CATCH_TRAIN:
case OBJECTIVE_BUY_ICE_CREAM: case OBJECTIVE_BUY_ICE_CREAM:
@ -18776,48 +18741,48 @@ CPed::SetObjective(eObjective newObj, CVector dest)
case OBJECTIVE_LEAVE_CAR_AND_DIE: case OBJECTIVE_LEAVE_CAR_AND_DIE:
case OBJECTIVE_FLEE_CAR: case OBJECTIVE_FLEE_CAR:
case OBJECTIVE_SUN_BATHE: case OBJECTIVE_SUN_BATHE:
case OBJECTIVE_AIM_GUN_AT_PED: case OBJECTIVE_AIM_GUN_AT:
case OBJECTIVE_WANDER: case OBJECTIVE_WANDER:
case OBJECTIVE_WAIT_FOR_RAIN_TO_END: case OBJECTIVE_WAIT_ON_FOOT_AT_SHELTER:
case OBJECTIVE_KILL_CHAR_ON_BOAT: case OBJECTIVE_KILL_CHAR_ON_BOAT:
case OBJECTIVE_SOLICIT_FOOT: case OBJECTIVE_SOLICIT_FOOT:
case OBJECTIVE_WAIT_FOR_BUS: case OBJECTIVE_WAIT_ON_FOOT_AT_BUS_STOP:
break; break;
case OBJECTIVE_GOTO_AREA_ANY_MEANS: case OBJECTIVE_GOTO_AREA_ANY_MEANS:
case OBJECTIVE_GOTO_AREA_ON_FOOT: case OBJECTIVE_GOTO_AREA_ON_FOOT:
case OBJECTIVE_USE_SEAT_ATTRACTOR: case OBJECTIVE_GOTO_SEAT_ON_FOOT:
case OBJECTIVE_USE_ATM_ATTRACTOR: case OBJECTIVE_GOTO_ATM_ON_FOOT:
case OBJECTIVE_USE_STOP_ATTRACTOR: case OBJECTIVE_GOTO_BUS_STOP_ON_FOOT:
case OBJECTIVE_USE_PIZZA_ATTRACTOR: case OBJECTIVE_GOTO_PIZZA_ON_FOOT:
case OBJECTIVE_USE_SHELTER_ATTRACTOR: case OBJECTIVE_GOTO_SHELTER_ON_FOOT:
case OBJECTIVE_USE_ICECREAM_ATTRACTOR: case OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT:
bIsRunning = false; bIsRunning = false;
m_pNextPathNode = nil; m_pNextPathNode = nil;
m_nextRoutePointPos = dest; m_nextRoutePointPos = dest;
m_vecSeekPos = m_nextRoutePointPos; m_vecSeekPos = m_nextRoutePointPos;
m_distanceToCountSeekDone = 0.5f; m_distanceToCountSeekDone = 0.5f;
if (m_objective == OBJECTIVE_USE_ATM_ATTRACTOR) { if (m_objective == OBJECTIVE_GOTO_ATM_ON_FOOT) {
m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone();
m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading();
} }
if (m_objective == OBJECTIVE_USE_SEAT_ATTRACTOR) { if (m_objective == OBJECTIVE_GOTO_SEAT_ON_FOOT) {
m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone();
m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading();
} }
if (m_objective == OBJECTIVE_USE_STOP_ATTRACTOR) { if (m_objective == OBJECTIVE_GOTO_BUS_STOP_ON_FOOT) {
m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone();
m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading();
} }
if (m_objective == OBJECTIVE_USE_PIZZA_ATTRACTOR) { if (m_objective == OBJECTIVE_GOTO_PIZZA_ON_FOOT) {
m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone();
m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading();
} }
if (m_objective == OBJECTIVE_USE_SHELTER_ATTRACTOR) { if (m_objective == OBJECTIVE_GOTO_SHELTER_ON_FOOT) {
bIsRunning = true; bIsRunning = true;
m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone();
m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading();
} }
if (m_objective == OBJECTIVE_USE_ICECREAM_ATTRACTOR) { if (m_objective == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT) {
bIsRunning = true; bIsRunning = true;
m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone(); m_distanceToCountSeekDone = m_attractor->GetDistanceToCountSeekDone();
m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading(); m_acceptableHeadingOffset = m_attractor->GetAcceptableHeading();
@ -18831,7 +18796,7 @@ CPed::SetObjective(eObjective newObj, CVector dest)
} }
break; break;
case OBJECTIVE_RUN_TO_AREA: case OBJECTIVE_RUN_TO_AREA:
case OBJECTIVE_SPRINT_TO_COORD: case OBJECTIVE_SPRINT_TO_AREA:
bIsRunning = true; bIsRunning = true;
m_pNextPathNode = nil; m_pNextPathNode = nil;
m_nextRoutePointPos = dest; m_nextRoutePointPos = dest;
@ -19452,12 +19417,12 @@ CPed::SetNewAttraction(CPedAttractor* pAttractor, const CVector& pos, float head
if (m_attractor != pAttractor) if (m_attractor != pAttractor)
return; return;
switch (pAttractor->GetEffect()->pedattr.type) { switch (pAttractor->GetEffect()->pedattr.type) {
case ATTRACTOR_ATM: SetObjective(OBJECTIVE_USE_ATM_ATTRACTOR, heading, pos); break; case ATTRACTOR_ATM: SetObjective(OBJECTIVE_GOTO_ATM_ON_FOOT, heading, pos); break;
case ATTRACTOR_SEAT: SetObjective(OBJECTIVE_USE_SEAT_ATTRACTOR, heading, pos); break; case ATTRACTOR_SEAT: SetObjective(OBJECTIVE_GOTO_SEAT_ON_FOOT, heading, pos); break;
case ATTRACTOR_STOP: SetObjective(OBJECTIVE_USE_STOP_ATTRACTOR, heading, pos); break; case ATTRACTOR_STOP: SetObjective(OBJECTIVE_GOTO_BUS_STOP_ON_FOOT, heading, pos); break;
case ATTRACTOR_PIZZA: SetObjective(OBJECTIVE_USE_PIZZA_ATTRACTOR, heading, pos); break; case ATTRACTOR_PIZZA: SetObjective(OBJECTIVE_GOTO_PIZZA_ON_FOOT, heading, pos); break;
case ATTRACTOR_SHELTER: SetObjective(OBJECTIVE_USE_SHELTER_ATTRACTOR, heading, pos); break; case ATTRACTOR_SHELTER: SetObjective(OBJECTIVE_GOTO_SHELTER_ON_FOOT, heading, pos); break;
case ATTRACTOR_ICECREAM: SetObjective(OBJECTIVE_USE_ICECREAM_ATTRACTOR, heading, pos); break; case ATTRACTOR_ICECREAM: SetObjective(OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT, heading, pos); break;
default: return; default: return;
} }
SetObjectiveTimer(time); SetObjectiveTimer(time);
@ -19929,7 +19894,7 @@ CPed::PedShuffle(void)
{ {
if (m_pMyVehicle->pPassengers[0] == this) { if (m_pMyVehicle->pPassengers[0] == this) {
CPed *driver = m_pMyVehicle->pDriver; CPed *driver = m_pMyVehicle->pDriver;
if (!driver || driver->m_objective == OBJECTIVE_LEAVE_VEHICLE) { if (!driver || driver->m_objective == OBJECTIVE_LEAVE_CAR) {
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, m_pMyVehicle->bLowVehicle ? ANIM_CAR_LSHUFFLE_RHS : ANIM_CAR_SHUFFLE_RHS); m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, m_pMyVehicle->bLowVehicle ? ANIM_CAR_LSHUFFLE_RHS : ANIM_CAR_SHUFFLE_RHS);
m_objective = OBJECTIVE_ENTER_CAR_AS_DRIVER; m_objective = OBJECTIVE_ENTER_CAR_AS_DRIVER;
m_pMyVehicle->RemovePassenger(this); m_pMyVehicle->RemovePassenger(this);

View File

@ -181,13 +181,13 @@ enum eWaitState {
enum eObjective : uint32 { enum eObjective : uint32 {
OBJECTIVE_NONE, OBJECTIVE_NONE,
OBJECTIVE_IDLE, OBJECTIVE_WAIT_ON_FOOT,
OBJECTIVE_IDLE_COP, OBJECTIVE_WAIT_ON_FOOT_FOR_COP,
OBJECTIVE_FLEE_TILL_SAFE, OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE,
OBJECTIVE_GUARD_SPOT, OBJECTIVE_GUARD_SPOT,
OBJECTIVE_GUARD_AREA, // not implemented OBJECTIVE_GUARD_AREA,
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,
@ -195,23 +195,23 @@ enum eObjective : uint32 {
OBJECTIVE_GOTO_CHAR_ON_FOOT, OBJECTIVE_GOTO_CHAR_ON_FOOT,
OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING, OBJECTIVE_GOTO_CHAR_ON_FOOT_WALKING,
OBJECTIVE_HASSLE_CHAR, OBJECTIVE_HASSLE_CHAR,
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,
OBJECTIVE_FIRE_AT_OBJ_FROM_VEHICLE, // not implemented OBJECTIVE_FIRE_AT_OBJECT_FROM_VEHICLE,
OBJECTIVE_DESTROY_OBJ, // not implemented OBJECTIVE_DESTROY_OBJECT,
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_GOTO_AREA_IN_CAR, // not implemented OBJECTIVE_GOTO_AREA_IN_CAR,
OBJECTIVE_FOLLOW_CAR_ON_FOOT_WITH_OFFSET, // not implemented OBJECTIVE_FOLLOW_CAR_ON_FOOT_WITH_OFFSET,
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,
@ -219,22 +219,22 @@ enum eObjective : uint32 {
OBJECTIVE_STEAL_ANY_MISSION_CAR, OBJECTIVE_STEAL_ANY_MISSION_CAR,
OBJECTIVE_MUG_CHAR, OBJECTIVE_MUG_CHAR,
OBJECTIVE_LEAVE_CAR_AND_DIE, OBJECTIVE_LEAVE_CAR_AND_DIE,
OBJECTIVE_USE_SEAT_ATTRACTOR, OBJECTIVE_GOTO_SEAT_ON_FOOT,
OBJECTIVE_USE_ATM_ATTRACTOR, OBJECTIVE_GOTO_ATM_ON_FOOT,
OBJECTIVE_FLEE_CAR, OBJECTIVE_FLEE_CAR,
OBJECTIVE_SUN_BATHE, OBJECTIVE_SUN_BATHE,
OBJECTIVE_USE_STOP_ATTRACTOR, OBJECTIVE_GOTO_BUS_STOP_ON_FOOT,
OBJECTIVE_USE_PIZZA_ATTRACTOR, OBJECTIVE_GOTO_PIZZA_ON_FOOT,
OBJECTIVE_USE_SHELTER_ATTRACTOR, OBJECTIVE_GOTO_SHELTER_ON_FOOT,
OBJECTIVE_AIM_GUN_AT_PED, OBJECTIVE_AIM_GUN_AT,
OBJECTIVE_WANDER, OBJECTIVE_WANDER,
OBJECTIVE_WAIT_FOR_RAIN_TO_END, OBJECTIVE_WAIT_ON_FOOT_AT_SHELTER,
OBJECTIVE_SPRINT_TO_COORD, OBJECTIVE_SPRINT_TO_AREA,
OBJECTIVE_KILL_CHAR_ON_BOAT, OBJECTIVE_KILL_CHAR_ON_BOAT,
OBJECTIVE_SOLICIT_FOOT, OBJECTIVE_SOLICIT_FOOT,
OBJECTIVE_WAIT_FOR_BUS, OBJECTIVE_WAIT_ON_FOOT_AT_BUS_STOP,
OBJECTIVE_USE_ICECREAM_ATTRACTOR, OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT,
OBJECTIVE_PURCHASE_ICECREAM, OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN,
OBJ_55, OBJ_55,
OBJ_56, OBJ_56,
OBJ_57, OBJ_57,
@ -349,6 +349,7 @@ enum eMoveState {
PEDMOVE_JOG, PEDMOVE_JOG,
PEDMOVE_RUN, PEDMOVE_RUN,
PEDMOVE_SPRINT, PEDMOVE_SPRINT,
PEDMOVE_THROWN
}; };
class CVehicle; class CVehicle;
@ -966,9 +967,9 @@ public:
bool EnteringCar(void) { return m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK; } bool EnteringCar(void) { return m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK; }
bool HasAttractor(void) { return m_attractor != nil; } bool HasAttractor(void) { return m_attractor != nil; }
bool IsUseAttractorObjective(eObjective obj) { bool IsUseAttractorObjective(eObjective obj) {
return obj == OBJECTIVE_USE_ATM_ATTRACTOR || obj == OBJECTIVE_USE_ICECREAM_ATTRACTOR || return obj == OBJECTIVE_GOTO_ATM_ON_FOOT || obj == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT ||
obj == OBJECTIVE_USE_PIZZA_ATTRACTOR || obj == OBJECTIVE_USE_SEAT_ATTRACTOR || obj == OBJECTIVE_GOTO_PIZZA_ON_FOOT || obj == OBJECTIVE_GOTO_SEAT_ON_FOOT ||
obj == OBJECTIVE_USE_SHELTER_ATTRACTOR || obj == OBJECTIVE_USE_STOP_ATTRACTOR; obj == OBJECTIVE_GOTO_SHELTER_ON_FOOT || obj == OBJECTIVE_GOTO_BUS_STOP_ON_FOOT;
} }
void ReplaceWeaponWhenExitingVehicle(void); void ReplaceWeaponWhenExitingVehicle(void);
@ -1080,11 +1081,6 @@ public:
static bool bPedCheat3; static bool bPedCheat3;
static CVector2D ms_vec2DFleePosition; static CVector2D ms_vec2DFleePosition;
#ifdef TOGGLEABLE_BETA_FEATURES
static bool bPopHeadsOnHeadshot;
static bool bMakePedsRunToPhonesToReportCrimes;
#endif
#ifndef MASTER #ifndef MASTER
// Mobile things // Mobile things
void DebugDrawPedDestination(CPed *, int, int); void DebugDrawPedDestination(CPed *, int, int);

View File

@ -276,27 +276,27 @@ static bool IsPedUsingAttractorOfThisType(int8 type, CPed* pPed)
{ {
switch (type) { switch (type) {
case ATTRACTOR_ATM: case ATTRACTOR_ATM:
if (pPed->m_objective == OBJECTIVE_USE_ATM_ATTRACTOR) if (pPed->m_objective == OBJECTIVE_GOTO_ATM_ON_FOOT)
return true; return true;
break; break;
case ATTRACTOR_SEAT: case ATTRACTOR_SEAT:
if (pPed->m_objective == OBJECTIVE_USE_SEAT_ATTRACTOR) if (pPed->m_objective == OBJECTIVE_GOTO_SEAT_ON_FOOT)
return true; return true;
break; break;
case ATTRACTOR_STOP: case ATTRACTOR_STOP:
if (pPed->m_objective == OBJECTIVE_USE_STOP_ATTRACTOR || pPed->m_objective == OBJECTIVE_WAIT_FOR_BUS || pPed->m_objective == OBJECTIVE_IDLE) if (pPed->m_objective == OBJECTIVE_GOTO_BUS_STOP_ON_FOOT || pPed->m_objective == OBJECTIVE_WAIT_ON_FOOT_AT_BUS_STOP || pPed->m_objective == OBJECTIVE_WAIT_ON_FOOT)
return true; return true;
break; break;
case ATTRACTOR_PIZZA: case ATTRACTOR_PIZZA:
if (pPed->m_objective == OBJECTIVE_USE_PIZZA_ATTRACTOR || pPed->m_objective == OBJECTIVE_IDLE) if (pPed->m_objective == OBJECTIVE_GOTO_PIZZA_ON_FOOT || pPed->m_objective == OBJECTIVE_WAIT_ON_FOOT)
return true; return true;
break; break;
case ATTRACTOR_SHELTER: case ATTRACTOR_SHELTER:
if (pPed->m_objective == OBJECTIVE_USE_SHELTER_ATTRACTOR || pPed->m_objective == OBJECTIVE_WAIT_FOR_RAIN_TO_END) if (pPed->m_objective == OBJECTIVE_GOTO_SHELTER_ON_FOOT || pPed->m_objective == OBJECTIVE_WAIT_ON_FOOT_AT_SHELTER)
return true; return true;
break; break;
case ATTRACTOR_ICECREAM: case ATTRACTOR_ICECREAM:
if (pPed->m_objective == OBJECTIVE_USE_ICECREAM_ATTRACTOR || pPed->m_objective == OBJECTIVE_PURCHASE_ICECREAM) if (pPed->m_objective == OBJECTIVE_GOTO_ICE_CREAM_VAN_ON_FOOT || pPed->m_objective == OBJECTIVE_WAIT_ON_FOOT_AT_ICE_CREAM_VAN)
return true; return true;
break; break;
} }

View File

@ -1485,7 +1485,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

@ -500,7 +500,11 @@ void CHud::Draw()
CFont::SetColor(WANTED_COLOR); CFont::SetColor(WANTED_COLOR);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon); CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
// TODO(Miami): There is one more condition in here } else if (playerPed->m_pWanted->m_nMinWantedLevel > i && CTimer::GetFrameCounter() & 4) {
WANTED_COLOR_FLASH.a = alpha;
CFont::SetColor(WANTED_COLOR_FLASH);
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(110.0f + 23.0f * i), SCREEN_SCALE_Y(87.0f), sPrintIcon);
} else if (playerPed->m_pWanted->m_nWantedLevel <= i) { } else if (playerPed->m_pWanted->m_nWantedLevel <= i) {
NOTWANTED_COLOR.a = alpha; NOTWANTED_COLOR.a = alpha;
CFont::SetColor(NOTWANTED_COLOR); CFont::SetColor(NOTWANTED_COLOR);

View File

@ -322,7 +322,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);
} }
ActivateBombWhenEntered(); ActivateBombWhenEntered();
@ -334,7 +334,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);
@ -442,7 +442,7 @@ CAutomobile::ProcessControl(void)
}else if(pDriver && pDriver->IsPlayer() && }else if(pDriver && pDriver->IsPlayer() &&
(pDriver->GetPedState() == PED_ARRESTED || (pDriver->GetPedState() == PED_ARRESTED ||
pDriver->GetPedState() == PED_DRAG_FROM_CAR || pDriver->GetPedState() == PED_DRAG_FROM_CAR ||
(pDriver->GetPedState() == PED_EXIT_CAR || pDriver->m_objective == OBJECTIVE_LEAVE_VEHICLE) && !CanPedJumpOutCar())){ (pDriver->GetPedState() == PED_EXIT_CAR || pDriver->m_objective == OBJECTIVE_LEAVE_CAR) && !CanPedJumpOutCar())){
bIsHandbrakeOn = true; bIsHandbrakeOn = true;
m_fBrakePedal = 1.0f; m_fBrakePedal = 1.0f;
m_fGasPedal = 0.0f; m_fGasPedal = 0.0f;
@ -532,7 +532,7 @@ CAutomobile::ProcessControl(void)
(pDriver && pDriver->IsPlayer() && (pDriver && pDriver->IsPlayer() &&
(pDriver->GetPedState() == PED_ARRESTED || (pDriver->GetPedState() == PED_ARRESTED ||
pDriver->GetPedState() == PED_DRAG_FROM_CAR || pDriver->GetPedState() == PED_DRAG_FROM_CAR ||
(pDriver->GetPedState() == PED_EXIT_CAR || pDriver->m_objective == OBJECTIVE_LEAVE_VEHICLE) && !CanPedJumpOutCar()))){ (pDriver->GetPedState() == PED_EXIT_CAR || pDriver->m_objective == OBJECTIVE_LEAVE_CAR) && !CanPedJumpOutCar()))){
bIsHandbrakeOn = true; bIsHandbrakeOn = true;
m_fBrakePedal = 1.0f; m_fBrakePedal = 1.0f;
m_fGasPedal = 0.0f; m_fGasPedal = 0.0f;

View File

@ -1228,7 +1228,7 @@ CVehicle::InflictDamage(CEntity *damagedBy, eWeaponType weaponType, float damage
if(AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_PLOUGH_THROUGH || if(AutoPilot.m_nDrivingStyle == DRIVINGSTYLE_PLOUGH_THROUGH ||
CGeneral::GetRandomNumberInRange(0.0f, 1.0f) > 0.5f && AutoPilot.m_nCarMission == MISSION_CRUISE){ CGeneral::GetRandomNumberInRange(0.0f, 1.0f) > 0.5f && AutoPilot.m_nCarMission == MISSION_CRUISE){
// Drive away like a maniac // Drive away like a maniac
if(pDriver && pDriver->m_objective != OBJECTIVE_LEAVE_VEHICLE){ if(pDriver && pDriver->m_objective != OBJECTIVE_LEAVE_CAR){
if(AutoPilot.m_nDrivingStyle != DRIVINGSTYLE_PLOUGH_THROUGH) if(AutoPilot.m_nDrivingStyle != DRIVINGSTYLE_PLOUGH_THROUGH)
AutoPilot.m_nCruiseSpeed *= 1.5f; AutoPilot.m_nCruiseSpeed *= 1.5f;
AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_PLOUGH_THROUGH; AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_PLOUGH_THROUGH;
@ -1238,16 +1238,16 @@ CVehicle::InflictDamage(CEntity *damagedBy, eWeaponType weaponType, float damage
if (pDriver && pDriver->CharCreatedBy != MISSION_CHAR) { if (pDriver && pDriver->CharCreatedBy != MISSION_CHAR) {
SetStatus(STATUS_ABANDONED); SetStatus(STATUS_ABANDONED);
pDriver->bFleeAfterExitingCar = true; pDriver->bFleeAfterExitingCar = true;
pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, this);
pDriver->Say(SOUND_PED_FLEE_SPRINT); pDriver->Say(SOUND_PED_FLEE_SPRINT);
} }
int time = 200; int time = 200;
for (int i = 0; i < m_nNumMaxPassengers; i++) { for (int i = 0; i < m_nNumMaxPassengers; i++) {
if (pPassengers[i] && if (pPassengers[i] &&
pPassengers[i]->m_objective != OBJECTIVE_LEAVE_VEHICLE && pPassengers[i]->m_objective != OBJECTIVE_LEAVE_CAR &&
pPassengers[i]->CharCreatedBy != MISSION_CHAR) { pPassengers[i]->CharCreatedBy != MISSION_CHAR) {
pPassengers[i]->bFleeAfterExitingCar = true; pPassengers[i]->bFleeAfterExitingCar = true;
pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); pPassengers[i]->SetObjective(OBJECTIVE_LEAVE_CAR, this);
pPassengers[i]->m_objectiveTimer = CTimer::GetTimeInMilliseconds() + time; pPassengers[i]->m_objectiveTimer = CTimer::GetTimeInMilliseconds() + time;
pPassengers[i]->Say(SOUND_PED_FLEE_SPRINT); pPassengers[i]->Say(SOUND_PED_FLEE_SPRINT);
time += 200; time += 200;
@ -1504,7 +1504,7 @@ CVehicle::MakeNonDraggedPedsLeaveVehicle(CPed *ped1, CPed *ped2, CPlayerPed *&pl
int time = 1800; int time = 1800;
for(i = 0; i < numPeds3; i++){ for(i = 0; i < numPeds3; i++){
peds3[i]->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + time; peds3[i]->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + time;
peds3[i]->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this); peds3[i]->SetObjective(OBJECTIVE_LEAVE_CAR, this);
time += CGeneral::GetRandomNumberInRange(300.0f, 600.0f); time += CGeneral::GetRandomNumberInRange(300.0f, 600.0f);
} }

View File

@ -740,7 +740,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
{ {
if (driver->m_pedStats->m_temper <= driver->m_pedStats->m_fear) if (driver->m_pedStats->m_temper <= driver->m_pedStats->m_fear)
{ {
driver->SetObjective(OBJECTIVE_FLEE_TILL_SAFE); driver->SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
} }
else else
{ {
@ -756,7 +756,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
CPed *passenger = nearCar->pPassengers[j]; CPed *passenger = nearCar->pPassengers[j];
if (passenger && passenger->CharCreatedBy != MISSION_CHAR) if (passenger && passenger->CharCreatedBy != MISSION_CHAR)
{ {
nearCar->pPassengers[j]->SetObjective(OBJECTIVE_FLEE_TILL_SAFE); nearCar->pPassengers[j]->SetObjective(OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE);
passenger->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + leaveCarDelay; passenger->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + leaveCarDelay;
leaveCarDelay += 200; leaveCarDelay += 200;
} }
@ -767,8 +767,8 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
CPed *driver = nearCar->pDriver; CPed *driver = nearCar->pDriver;
if (driver) if (driver)
{ {
if (driver->m_objective != OBJECTIVE_LEAVE_VEHICLE && driver->m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT && if (driver->m_objective != OBJECTIVE_LEAVE_CAR && driver->m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT &&
driver->m_objective != OBJECTIVE_FLEE_TILL_SAFE) driver->m_objective != OBJECTIVE_FLEE_ON_FOOT_TILL_SAFE)
{ {
if (nearCar->AutoPilot.m_nDrivingStyle != DRIVINGSTYLE_PLOUGH_THROUGH) if (nearCar->AutoPilot.m_nDrivingStyle != DRIVINGSTYLE_PLOUGH_THROUGH)
nearCar->AutoPilot.m_nCruiseSpeed = nearCar->AutoPilot.m_nCruiseSpeed * 1.5f; nearCar->AutoPilot.m_nCruiseSpeed = nearCar->AutoPilot.m_nCruiseSpeed * 1.5f;