Use SetPedState

This commit is contained in:
Sergeanur 2020-12-15 05:11:02 +02:00
parent 3c8c20ea0b
commit f76dfaee82
12 changed files with 87 additions and 149 deletions

View File

@ -67,7 +67,7 @@ CPhoneInfo::Update(void)
} else { } else {
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE); CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE);
if (player->m_nPedState == PED_MAKE_CALL) if (player->m_nPedState == PED_MAKE_CALL)
player->m_nPedState = PED_IDLE; player->SetPedState(PED_IDLE);
} }
} }
bool notInCar; bool notInCar;
@ -114,7 +114,7 @@ CPhoneInfo::Update(void)
player->m_fRotationCur = angleToFace; player->m_fRotationCur = angleToFace;
player->m_fRotationDest = angleToFace; player->m_fRotationDest = angleToFace;
player->SetHeading(angleToFace); player->SetHeading(angleToFace);
player->m_nPedState = PED_MAKE_CALL; player->SetPedState(PED_MAKE_CALL);
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE); CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
TheCamera.SetWideScreenOn(); TheCamera.SetWideScreenOn();
playerInfo->MakePlayerSafe(true); playerInfo->MakePlayerSafe(true);
@ -412,7 +412,7 @@ PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg)
ped->bUpdateAnimHeading = true; ped->bUpdateAnimHeading = true;
if (ped->m_nPedState == PED_MAKE_CALL) if (ped->m_nPedState == PED_MAKE_CALL)
ped->m_nPedState = PED_IDLE; ped->SetPedState(PED_IDLE);
} }
void void

View File

@ -1921,7 +1921,7 @@ void CTheScripts::CleanUpThisPed(CPed* pPed)
if (pPed->IsPedInControl()) if (pPed->IsPedInControl())
pPed->SetWanderPath(CGeneral::GetRandomNumber() & 7); pPed->SetWanderPath(CGeneral::GetRandomNumber() & 7);
if (flees) { if (flees) {
pPed->m_nPedState = state; pPed->SetPedState(state);
pPed->SetMoveState(ms); pPed->SetMoveState(ms);
} }
--CPopulation::ms_nTotalMissionPeds; --CPopulation::ms_nTotalMissionPeds;

View File

@ -228,7 +228,7 @@ CFireManager::StartFire(CEntity *entityOnFire, CEntity *fleeFrom, float strength
ped->bDrawLast = false; ped->bDrawLast = false;
ped->SetMoveState(PEDMOVE_SPRINT); ped->SetMoveState(PEDMOVE_SPRINT);
ped->SetMoveAnim(); ped->SetMoveAnim();
ped->m_nPedState = PED_ON_FIRE; ped->SetPedState(PED_ON_FIRE);
} }
if (fleeFrom) { if (fleeFrom) {
if (ped->m_nPedType == PEDTYPE_COP) { if (ped->m_nPedType == PEDTYPE_COP) {
@ -401,7 +401,7 @@ CFireManager::StartScriptFire(const CVector &pos, CEntity *target, float strengt
CVector2D pos = target->GetPosition(); CVector2D pos = target->GetPosition();
ped->SetFlee(pos, 10000); ped->SetFlee(pos, 10000);
ped->SetMoveAnim(); ped->SetMoveAnim();
ped->m_nPedState = PED_ON_FIRE; ped->SetPedState(PED_ON_FIRE);
} }
} else if (target->IsVehicle()) { } else if (target->IsVehicle()) {
veh->m_pCarFire = fire; veh->m_pCarFire = fire;

View File

@ -419,7 +419,7 @@ CPlayerInfo::Process(void)
if (found) if (found)
sth.z = 1.0f + groundZ; sth.z = 1.0f + groundZ;
m_pPed->m_nPedState = PED_IDLE; m_pPed->SetPedState(PED_IDLE);
m_pPed->SetMoveState(PEDMOVE_STILL); m_pPed->SetMoveState(PEDMOVE_STILL);
CPed::PedSetOutCarCB(0, m_pPed); CPed::PedSetOutCarCB(0, m_pPed);
CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f); CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);

View File

@ -274,7 +274,7 @@ CCivilianPed::ProcessControl(void)
} else { } else {
crimeReporters[m_phoneId] = this; crimeReporters[m_phoneId] = this;
m_facePhoneStart = true; m_facePhoneStart = true;
m_nPedState = PED_FACE_PHONE; SetPedState(PED_FACE_PHONE);
} }
#else #else
} else if (bRunningToPhone) { } else if (bRunningToPhone) {
@ -283,7 +283,7 @@ CCivilianPed::ProcessControl(void)
m_phoneId = -1; m_phoneId = -1;
} else { } else {
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; SetPedState(PED_FACE_PHONE);
} }
#endif #endif
} else if (m_objective != OBJECTIVE_KILL_CHAR_ANY_MEANS && m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) { } else if (m_objective != OBJECTIVE_KILL_CHAR_ANY_MEANS && m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
@ -305,7 +305,7 @@ CCivilianPed::ProcessControl(void)
break; break;
case PED_FACE_PHONE: case PED_FACE_PHONE:
if (FacePhone()) if (FacePhone())
m_nPedState = PED_MAKE_CALL; SetPedState(PED_MAKE_CALL);
break; break;
case PED_MAKE_CALL: case PED_MAKE_CALL:
if (MakePhonecall()) if (MakePhonecall())
@ -331,7 +331,7 @@ CCivilianPed::ProcessControl(void)
for (int j = 0; j < m_numNearPeds; ++j) { for (int j = 0; j < m_numNearPeds; ++j) {
CPed *nearPed = m_nearPeds[j]; CPed *nearPed = m_nearPeds[j];
if (nearPed->m_nPedType == m_nPedType && nearPed->m_nPedState == PED_WANDER_PATH) { if (nearPed->m_nPedType == m_nPedType && nearPed->m_nPedState == PED_WANDER_PATH) {
nearPed->m_nPedState = PED_UNKNOWN; nearPed->SetPedState(PED_UNKNOWN);
} }
} }
} }

View File

@ -114,14 +114,14 @@ CCopPed::SetArrestPlayer(CPed *player)
} else if (player->m_nPedState != PED_DIE && player->m_nPedState != PED_DEAD && player->m_nPedState != PED_ARRESTED) { } else if (player->m_nPedState != PED_DIE && player->m_nPedState != PED_DEAD && player->m_nPedState != PED_ARRESTED) {
player->m_nLastPedState = player->m_nPedState; player->m_nLastPedState = player->m_nPedState;
player->m_nPedState = PED_ARRESTED; player->SetPedState(PED_ARRESTED);
FindPlayerPed()->m_bCanBeDamaged = false; FindPlayerPed()->m_bCanBeDamaged = false;
((CPlayerPed*)player)->m_pArrestingCop = this; ((CPlayerPed*)player)->m_pArrestingCop = this;
this->RegisterReference((CEntity**) &((CPlayerPed*)player)->m_pArrestingCop); this->RegisterReference((CEntity**) &((CPlayerPed*)player)->m_pArrestingCop);
} }
m_nPedState = PED_ARREST_PLAYER; SetPedState(PED_ARREST_PLAYER);
SetObjective(OBJECTIVE_NONE); SetObjective(OBJECTIVE_NONE);
m_prevObjective = OBJECTIVE_NONE; m_prevObjective = OBJECTIVE_NONE;
bIsPointingGunAt = false; bIsPointingGunAt = false;
@ -229,7 +229,7 @@ CCopPed::ArrestPlayer(void)
CPed *suspect = (CPed*)m_pSeekTarget; CPed *suspect = (CPed*)m_pSeekTarget;
if (suspect) { if (suspect) {
if (suspect->CanSetPedState()) if (suspect->CanSetPedState())
suspect->m_nPedState = PED_ARRESTED; suspect->SetPedState(PED_ARRESTED);
if (suspect->bInVehicle && m_pMyVehicle && suspect->m_pMyVehicle == m_pMyVehicle) { if (suspect->bInVehicle && m_pMyVehicle && suspect->m_pMyVehicle == m_pMyVehicle) {

View File

@ -100,7 +100,7 @@ CEmergencyPed::FiremanAI(void)
case EMERGENCY_PED_READY: case EMERGENCY_PED_READY:
nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist); nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist);
if (nearestFire) { if (nearestFire) {
m_nPedState = PED_NONE; SetPedState(PED_NONE);
SetSeek(nearestFire->m_vecPos, 1.0f); SetSeek(nearestFire->m_vecPos, 1.0f);
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE; m_nEmergencyPedState = EMERGENCY_PED_DETERMINE_NEXT_STATE;
@ -114,7 +114,7 @@ CEmergencyPed::FiremanAI(void)
case EMERGENCY_PED_DETERMINE_NEXT_STATE: case EMERGENCY_PED_DETERMINE_NEXT_STATE:
nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist); nearestFire = gFireManager.FindNearestFire(GetPosition(), &fireDist);
if (nearestFire && nearestFire != m_pAttendedFire) { if (nearestFire && nearestFire != m_pAttendedFire) {
m_nPedState = PED_NONE; SetPedState(PED_NONE);
SetSeek(nearestFire->m_vecPos, 1.0f); SetSeek(nearestFire->m_vecPos, 1.0f);
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
#ifdef FIX_BUGS #ifdef FIX_BUGS
@ -160,7 +160,7 @@ CEmergencyPed::FiremanAI(void)
#endif #endif
--m_pAttendedFire->m_nFiremenPuttingOut; --m_pAttendedFire->m_nFiremenPuttingOut;
m_nPedState = PED_NONE; SetPedState(PED_NONE);
SetWanderPath(CGeneral::GetRandomNumber() & 7); SetWanderPath(CGeneral::GetRandomNumber() & 7);
m_pAttendedFire = nil; m_pAttendedFire = nil;
m_nEmergencyPedState = EMERGENCY_PED_READY; m_nEmergencyPedState = EMERGENCY_PED_READY;
@ -307,7 +307,7 @@ CEmergencyPed::MedicAI(void)
} else { } else {
m_pRevivedPed->m_bloodyFootprintCountOrDeathTime = CTimer::GetTimeInMilliseconds(); m_pRevivedPed->m_bloodyFootprintCountOrDeathTime = CTimer::GetTimeInMilliseconds();
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
m_nPedState = PED_CPR; SetPedState(PED_CPR);
m_nLastPedState = PED_CPR; m_nLastPedState = PED_CPR;
SetLookFlag(m_pRevivedPed, 0); SetLookFlag(m_pRevivedPed, 0);
SetLookTimer(500); SetLookTimer(500);
@ -366,12 +366,12 @@ CEmergencyPed::MedicAI(void)
break; break;
} }
m_nEmergencyPedState = EMERGENCY_PED_STOP_CPR; m_nEmergencyPedState = EMERGENCY_PED_STOP_CPR;
m_nPedState = PED_NONE; SetPedState(PED_NONE);
SetMoveState(PEDMOVE_WALK); SetMoveState(PEDMOVE_WALK);
m_pVehicleAnim = nil; m_pVehicleAnim = nil;
if (!m_pRevivedPed->bBodyPartJustCameOff) { if (!m_pRevivedPed->bBodyPartJustCameOff) {
m_pRevivedPed->m_fHealth = 100.0f; m_pRevivedPed->m_fHealth = 100.0f;
m_pRevivedPed->m_nPedState = PED_NONE; m_pRevivedPed->SetPedState(PED_NONE);
m_pRevivedPed->m_nLastPedState = PED_WANDER_PATH; m_pRevivedPed->m_nLastPedState = PED_WANDER_PATH;
m_pRevivedPed->SetGetUp(); m_pRevivedPed->SetGetUp();
m_pRevivedPed->bUsesCollision = true; m_pRevivedPed->bUsesCollision = true;
@ -400,7 +400,7 @@ CEmergencyPed::MedicAI(void)
break; break;
case EMERGENCY_PED_STOP: case EMERGENCY_PED_STOP:
m_bStartedToCPR = false; m_bStartedToCPR = false;
m_nPedState = PED_NONE; SetPedState(PED_NONE);
if (m_pAttendedAccident) { if (m_pAttendedAccident) {
m_pAttendedAccident->m_pVictim = nil; m_pAttendedAccident->m_pVictim = nil;
--m_pAttendedAccident->m_nMedicsAttending; --m_pAttendedAccident->m_nMedicsAttending;

View File

@ -641,7 +641,7 @@ CPed::RestorePreviousState(void)
return; return;
if (InVehicle()) { if (InVehicle()) {
m_nPedState = PED_DRIVING; SetPedState(PED_DRIVING);
m_nLastPedState = PED_NONE; m_nLastPedState = PED_NONE;
} else { } else {
if (m_nLastPedState == PED_NONE) { if (m_nLastPedState == PED_NONE) {
@ -658,7 +658,7 @@ CPed::RestorePreviousState(void)
SetIdle(); SetIdle();
break; break;
case PED_WANDER_PATH: case PED_WANDER_PATH:
m_nPedState = PED_WANDER_PATH; SetPedState(PED_WANDER_PATH);
bIsRunning = false; bIsRunning = false;
if (bFindNewNodeAfterStateRestore) { if (bFindNewNodeAfterStateRestore) {
if (m_pNextPathNode) { if (m_pNextPathNode) {
@ -672,7 +672,7 @@ CPed::RestorePreviousState(void)
SetWanderPath(CGeneral::GetRandomNumber() & 7); SetWanderPath(CGeneral::GetRandomNumber() & 7);
break; break;
default: default:
m_nPedState = m_nLastPedState; SetPedState(m_nLastPedState);
SetMoveState((eMoveState) m_nPrevMoveState); SetMoveState((eMoveState) m_nPrevMoveState);
break; break;
} }
@ -1511,8 +1511,8 @@ CPed::ClearAll(void)
if (!IsPedInControl() && m_nPedState != PED_DEAD) if (!IsPedInControl() && m_nPedState != PED_DEAD)
return; return;
m_nPedState = PED_NONE; SetPedState(PED_NONE);
m_nMoveState = PEDMOVE_NONE; SetMoveState(PEDMOVE_NONE);
m_pSeekTarget = nil; m_pSeekTarget = nil;
m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f); m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f);
m_fleeFromPosX = 0.0f; m_fleeFromPosX = 0.0f;
@ -1585,7 +1585,7 @@ CPed::ProcessBuoyancy(void)
CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, pos, CVector(0.0f, 0.0f, 0.0f), 0.0f, 50, CRGBA(0, 0, 0, 0), true); CParticleObject::AddObject(POBJECT_PED_WATER_SPLASH, pos, CVector(0.0f, 0.0f, 0.0f), 0.0f, 50, CRGBA(0, 0, 0, 0), true);
#endif #endif
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
m_nPedState = PED_IDLE; SetPedState(PED_IDLE);
return; return;
} }
} }
@ -2692,36 +2692,6 @@ CPed::ProcessControl(void)
case PED_WANDER_PATH: case PED_WANDER_PATH:
WanderPath(); WanderPath();
break; break;
case PED_SEEK_POS:
case PED_SEEK_ENTITY:
case PED_PURSUE:
case PED_SNIPER_MODE:
case PED_ROCKET_MODE:
case PED_DUMMY:
case PED_FACE_PHONE:
case PED_MAKE_CALL:
case PED_MUG:
case PED_AI_CONTROL:
case PED_FOLLOW_ROUTE:
case PED_CPR:
case PED_SOLICIT:
case PED_BUY_ICECREAM:
case PED_STEP_AWAY:
case PED_UNKNOWN:
case PED_STATES_NO_AI:
case PED_JUMP:
case PED_STAGGER:
case PED_DIVE_AWAY:
case PED_STATES_NO_ST:
case PED_ARREST_PLAYER:
case PED_PASSENGER:
case PED_TAXI_PASSENGER:
case PED_OPEN_DOOR:
case PED_DEAD:
case PED_DRAG_FROM_CAR:
case PED_EXIT_CAR:
case PED_STEAL_CAR:
break;
case PED_ENTER_CAR: case PED_ENTER_CAR:
case PED_CARJACK: case PED_CARJACK:
{ {
@ -4467,7 +4437,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (!veh->bEngineOn) if (!veh->bEngineOn)
veh->bEngineOn = true; veh->bEngineOn = true;
ped->m_nPedState = PED_DRIVING; ped->SetPedState(PED_DRIVING);
ped->StopNonPartialAnims(); ped->StopNonPartialAnims();
return; return;
} }
@ -4512,7 +4482,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) { else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
if (ped->m_nPedState == PED_CARJACK) { if (ped->m_nPedState == PED_CARJACK) {
veh->AddPassenger(ped, 0); veh->AddPassenger(ped, 0);
ped->m_nPedState = PED_DRIVING; ped->SetPedState(PED_DRIVING);
ped->RestorePreviousObjective(); ped->RestorePreviousObjective();
ped->SetObjective(OBJECTIVE_LEAVE_CAR, veh); ped->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
} else if (veh->pDriver && ped->CharCreatedBy == RANDOM_CHAR) { } else if (veh->pDriver && ped->CharCreatedBy == RANDOM_CHAR) {
@ -4552,7 +4522,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS; veh->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
veh->AutoPilot.m_nCruiseSpeed = 25; veh->AutoPilot.m_nCruiseSpeed = 25;
} }
ped->m_nPedState = PED_DRIVING; ped->SetPedState(PED_DRIVING);
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 || ped->m_prevObjective == OBJECTIVE_KILL_CHAR_ON_FOOT) if (ped->m_prevObjective == OBJECTIVE_RUN_TO_AREA || ped->m_prevObjective == OBJECTIVE_GOTO_CHAR_ON_FOOT || ped->m_prevObjective == OBJECTIVE_KILL_CHAR_ON_FOOT)
@ -4580,7 +4550,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
break; break;
} }
} }
ped->m_nPedState = PED_DRIVING; ped->SetPedState(PED_DRIVING);
if (ped->m_prevObjective == OBJECTIVE_RUN_TO_AREA || ped->m_prevObjective == OBJECTIVE_GOTO_CHAR_ON_FOOT || ped->m_prevObjective == OBJECTIVE_KILL_CHAR_ON_FOOT) if (ped->m_prevObjective == OBJECTIVE_RUN_TO_AREA || ped->m_prevObjective == OBJECTIVE_GOTO_CHAR_ON_FOOT || ped->m_prevObjective == OBJECTIVE_KILL_CHAR_ON_FOOT)
ped->m_prevObjective = OBJECTIVE_NONE; ped->m_prevObjective = OBJECTIVE_NONE;
@ -4967,7 +4937,7 @@ CPed::SetIdle(void)
m_nLastPedState = PED_NONE; m_nLastPedState = PED_NONE;
#endif #endif
m_nPedState = PED_IDLE; SetPedState(PED_IDLE);
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
} }
if (m_nWaitState == WAITSTATE_FALSE) { if (m_nWaitState == WAITSTATE_FALSE) {
@ -5055,7 +5025,7 @@ CPed::SetFall(int extraTime, AnimationId animId, uint8 evenIfNotInControl)
ClearLookFlag(); ClearLookFlag();
ClearAimFlag(); ClearAimFlag();
SetStoredState(); SetStoredState();
m_nPedState = PED_FALL; SetPedState(PED_FALL);
CAnimBlendAssociation *fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), animId); CAnimBlendAssociation *fallAssoc = RpAnimBlendClumpGetAssociation(GetClump(), animId);
if (fallAssoc) { if (fallAssoc) {
@ -5220,7 +5190,7 @@ CPed::SetGetUp(void)
} }
if (m_nPedState != PED_GETUP) { if (m_nPedState != PED_GETUP) {
SetStoredState(); SetStoredState();
m_nPedState = PED_GETUP; SetPedState(PED_GETUP);
} }
CVehicle *collidingVeh = (CVehicle*)m_pCollidingEntity; CVehicle *collidingVeh = (CVehicle*)m_pCollidingEntity;
@ -5375,7 +5345,7 @@ CPed::SetSeek(CVector pos, float distanceToCountDone)
if (m_nPedState != PED_SEEK_POS) if (m_nPedState != PED_SEEK_POS)
SetStoredState(); SetStoredState();
m_nPedState = PED_SEEK_POS; SetPedState(PED_SEEK_POS);
m_distanceToCountSeekDone = distanceToCountDone; m_distanceToCountSeekDone = distanceToCountDone;
m_vecSeekPos = pos; m_vecSeekPos = pos;
} }
@ -5395,7 +5365,7 @@ CPed::SetSeek(CEntity *seeking, float distanceToCountDone)
if (m_nPedState != PED_SEEK_ENTITY) if (m_nPedState != PED_SEEK_ENTITY)
SetStoredState(); SetStoredState();
m_nPedState = PED_SEEK_ENTITY; SetPedState(PED_SEEK_ENTITY);
m_distanceToCountSeekDone = distanceToCountDone; m_distanceToCountSeekDone = distanceToCountDone;
m_pSeekTarget = seeking; m_pSeekTarget = seeking;
m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget); m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget);
@ -5572,7 +5542,7 @@ CPed::SetFlee(CVector2D const &from, int time)
if (m_nPedState != PED_FLEE_ENTITY) { if (m_nPedState != PED_FLEE_ENTITY) {
SetStoredState(); SetStoredState();
m_nPedState = PED_FLEE_POS; SetPedState(PED_FLEE_POS);
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
m_fleeFromPosX = from.x; m_fleeFromPosX = from.x;
m_fleeFromPosY = from.y; m_fleeFromPosY = from.y;
@ -5601,7 +5571,7 @@ CPed::SetFlee(CEntity *fleeFrom, int time)
return; return;
SetStoredState(); SetStoredState();
m_nPedState = PED_FLEE_ENTITY; SetPedState(PED_FLEE_ENTITY);
bUsePedNodeSeek = true; bUsePedNodeSeek = true;
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
m_fleeFrom = fleeFrom; m_fleeFrom = fleeFrom;
@ -5862,7 +5832,7 @@ CPed::SetWanderPath(int8 pathStateDest)
// We did it, save next path state and return true // We did it, save next path state and return true
m_nPathDir = nextPathState; m_nPathDir = nextPathState;
m_nPedState = PED_WANDER_PATH; SetPedState(PED_WANDER_PATH);
SetMoveState(PEDMOVE_WALK); SetMoveState(PEDMOVE_WALK);
bIsRunning = false; bIsRunning = false;
return true; return true;
@ -6047,7 +6017,7 @@ CPed::SetFollowPath(CVector dest)
return false; return false;
SetStoredState(); SetStoredState();
m_nPedState = PED_FOLLOW_PATH; SetPedState(PED_FOLLOW_PATH);
SetMoveState(PEDMOVE_WALK); SetMoveState(PEDMOVE_WALK);
return true; return true;
} }
@ -6150,7 +6120,7 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
m_fRotationCur = CGeneral::LimitRadianAngle(angleToFace); m_fRotationCur = CGeneral::LimitRadianAngle(angleToFace);
ClearAimFlag(); ClearAimFlag();
SetStoredState(); SetStoredState();
m_nPedState = PED_STEP_AWAY; SetPedState(PED_STEP_AWAY);
} }
} }
} }
@ -6247,13 +6217,13 @@ CPed::SetEvasiveDive(CPhysical *reason, uint8 onlyRandomJump)
animAssoc->flags &= ~ASSOC_DELETEFADEDOUT; animAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
animAssoc->SetFinishCallback(PedEvadeCB, this); animAssoc->SetFinishCallback(PedEvadeCB, this);
SetStoredState(); SetStoredState();
m_nPedState = PED_STEP_AWAY; SetPedState(PED_STEP_AWAY);
} else { } else {
m_fRotationCur = angleToFace; m_fRotationCur = angleToFace;
ClearLookFlag(); ClearLookFlag();
ClearAimFlag(); ClearAimFlag();
SetStoredState(); SetStoredState();
m_nPedState = PED_DIVE_AWAY; SetPedState(PED_DIVE_AWAY);
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_EV_DIVE, 8.0f); animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_EV_DIVE, 8.0f);
animAssoc->SetFinishCallback(PedEvadeCB, this); animAssoc->SetFinishCallback(PedEvadeCB, this);
} }
@ -6291,7 +6261,7 @@ CPed::PedEvadeCB(CAnimBlendAssociation* animAssoc, void* arg)
if (ped->m_nPedState == PED_DIVE_AWAY) if (ped->m_nPedState == PED_DIVE_AWAY)
{ {
ped->m_getUpTimer = CTimer::GetTimeInMilliseconds() + 1; ped->m_getUpTimer = CTimer::GetTimeInMilliseconds() + 1;
ped->m_nPedState = PED_FALL; ped->SetPedState(PED_FALL);
} }
animAssoc->flags &= ~ASSOC_FADEOUTWHENDONE; animAssoc->flags &= ~ASSOC_FADEOUTWHENDONE;
animAssoc->flags |= ASSOC_DELETEFADEDOUT; animAssoc->flags |= ASSOC_DELETEFADEDOUT;
@ -6342,7 +6312,7 @@ CPed::SetDie(AnimationId animId, float delta, float speed)
QuitEnteringCar(); QuitEnteringCar();
} }
m_nPedState = PED_DIE; SetPedState(PED_DIE);
if (animId == NUM_ANIMS) { if (animId == NUM_ANIMS) {
bIsPedDieAnimPlaying = false; bIsPedDieAnimPlaying = false;
} else { } else {
@ -6384,7 +6354,7 @@ CPed::SetDead(void)
if (m_nPedState == PED_DRIVING) if (m_nPedState == PED_DRIVING)
bIsVisible = false; bIsVisible = false;
m_nPedState = PED_DEAD; SetPedState(PED_DEAD);
m_pVehicleAnim = nil; m_pVehicleAnim = nil;
m_pCollidingEntity = nil; m_pCollidingEntity = nil;
@ -6417,7 +6387,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
if(m_nPedState != PED_CHAT) if(m_nPedState != PED_CHAT)
SetStoredState(); SetStoredState();
m_nPedState = PED_CHAT; SetPedState(PED_CHAT);
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
#if defined VC_PED_PORTS || defined FIX_BUGS #if defined VC_PED_PORTS || defined FIX_BUGS
m_lookTimer = 0; m_lookTimer = 0;
@ -6658,7 +6628,7 @@ CPed::SetSeekCar(CVehicle *car, uint32 doorNode)
// m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); // m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget);
m_vehEnterType = doorNode; m_vehEnterType = doorNode;
m_distanceToCountSeekDone = 0.5f; m_distanceToCountSeekDone = 0.5f;
m_nPedState = PED_SEEK_CAR; SetPedState(PED_SEEK_CAR);
} }
@ -7683,10 +7653,11 @@ CPed::FlagToDestroyWhenNextProcessed(void)
} }
bInVehicle = false; bInVehicle = false;
m_pMyVehicle = nil; m_pMyVehicle = nil;
if (CharCreatedBy == MISSION_CHAR) if (CharCreatedBy == MISSION_CHAR)
m_nPedState = PED_DEAD; SetPedState(PED_DEAD);
else else
m_nPedState = PED_NONE; SetPedState(PED_NONE);
m_pVehicleAnim = nil; m_pVehicleAnim = nil;
} }
@ -7710,7 +7681,7 @@ CPed::SetSolicit(uint32 time)
if(!m_carInObjective->bIsVan && !m_carInObjective->bIsBus) if(!m_carInObjective->bIsVan && !m_carInObjective->bIsBus)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_HOOKERTALK, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_HOOKERTALK, 4.0f);
m_nPedState = PED_SOLICIT; SetPedState(PED_SOLICIT);
} }
} }
} }
@ -7769,7 +7740,7 @@ CPed::SetBuyIceCream(void)
// Simulating BuyIceCream // Simulating BuyIceCream
CPed* driver = m_carInObjective->pDriver; CPed* driver = m_carInObjective->pDriver;
if (driver) { if (driver) {
m_nPedState = PED_BUY_ICECREAM; SetPedState(PED_BUY_ICECREAM);
bFindNewNodeAfterStateRestore = true; bFindNewNodeAfterStateRestore = true;
SetObjectiveTimer(8000); SetObjectiveTimer(8000);
SetChat(driver, 8000); SetChat(driver, 8000);
@ -7783,7 +7754,7 @@ CPed::SetBuyIceCream(void)
if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) { if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) {
m_standardTimer = CTimer::GetTimeInMilliseconds() + 3000; m_standardTimer = CTimer::GetTimeInMilliseconds() + 3000;
m_nPedState = PED_BUY_ICECREAM; SetPedState(PED_BUY_ICECREAM);
} }
} }
@ -7985,7 +7956,7 @@ CPed::SetJump(void)
#endif #endif
(m_nSurfaceTouched != SURFACE_STEEP_CLIFF || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) { (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) {
SetStoredState(); SetStoredState();
m_nPedState = PED_JUMP; SetPedState(PED_JUMP);
CAnimBlendAssociation *jumpAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_JUMP_LAUNCH, 8.0f); CAnimBlendAssociation *jumpAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_JUMP_LAUNCH, 8.0f);
jumpAssoc->SetFinishCallback(FinishLaunchCB, this); jumpAssoc->SetFinishCallback(FinishLaunchCB, this);
m_fRotationDest = m_fRotationCur; m_fRotationDest = m_fRotationCur;
@ -8287,7 +8258,7 @@ CPed::WarpPedIntoCar(CVehicle *car)
m_pMyVehicle->RegisterReference((CEntity **) &m_pMyVehicle); m_pMyVehicle->RegisterReference((CEntity **) &m_pMyVehicle);
m_carInObjective = car; m_carInObjective = car;
m_carInObjective->RegisterReference((CEntity **) &m_carInObjective); m_carInObjective->RegisterReference((CEntity **) &m_carInObjective);
m_nPedState = PED_DRIVING; SetPedState(PED_DRIVING);
bUsesCollision = false; bUsesCollision = false;
bIsInTheAir = false; bIsInTheAir = false;
bVehExitWillBeInstant = true; bVehExitWillBeInstant = true;

View File

@ -809,10 +809,10 @@ CPed::ProcessObjective(void)
break; break;
} }
case OBJECTIVE_WAIT_IN_CAR: case OBJECTIVE_WAIT_IN_CAR:
m_nPedState = PED_DRIVING; SetPedState(PED_DRIVING);
break; break;
case OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT: case OBJECTIVE_WAIT_IN_CAR_THEN_GET_OUT:
m_nPedState = PED_DRIVING; SetPedState(PED_DRIVING);
break; break;
case OBJECTIVE_KILL_CHAR_ANY_MEANS: case OBJECTIVE_KILL_CHAR_ANY_MEANS:
{ {
@ -2617,7 +2617,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
if (ped->IsPlayer() && ped->bGonnaKillTheCarJacker && ((CPlayerPed*)ped)->m_pArrestingCop) { if (ped->IsPlayer() && ped->bGonnaKillTheCarJacker && ((CPlayerPed*)ped)->m_pArrestingCop) {
PedSetInCarCB(nil, ped); PedSetInCarCB(nil, ped);
ped->m_nLastPedState = ped->m_nPedState; ped->m_nLastPedState = ped->m_nPedState;
ped->m_nPedState = PED_ARRESTED; ped->SetPedState(PED_ARRESTED);
ped->bGonnaKillTheCarJacker = false; ped->bGonnaKillTheCarJacker = false;
if (veh) { if (veh) {
veh->m_nNumGettingIn = 0; veh->m_nNumGettingIn = 0;
@ -3340,7 +3340,7 @@ CPed::SetCarJack_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
m_pSeekTarget = car; m_pSeekTarget = car;
m_pSeekTarget->RegisterReference((CEntity**)&m_pSeekTarget); m_pSeekTarget->RegisterReference((CEntity**)&m_pSeekTarget);
m_nPedState = PED_CARJACK; SetPedState(PED_CARJACK);
car->bIsBeingCarJacked = true; car->bIsBeingCarJacked = true;
m_pMyVehicle = (CVehicle*)m_pSeekTarget; m_pMyVehicle = (CVehicle*)m_pSeekTarget;
m_pMyVehicle->RegisterReference((CEntity**)&m_pMyVehicle); m_pMyVehicle->RegisterReference((CEntity**)&m_pMyVehicle);
@ -3387,7 +3387,7 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack)
SetMoveState(PEDMOVE_NONE); SetMoveState(PEDMOVE_NONE);
LineUpPedWithCar(LINE_UP_TO_CAR_START); LineUpPedWithCar(LINE_UP_TO_CAR_START);
m_pVehicleAnim = nil; m_pVehicleAnim = nil;
m_nPedState = PED_DRAG_FROM_CAR; SetPedState(PED_DRAG_FROM_CAR);
bChangedSeat = false; bChangedSeat = false;
bWillBeQuickJacked = quickJack; bWillBeQuickJacked = quickJack;
@ -3512,7 +3512,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
m_pSeekTarget = car; m_pSeekTarget = car;
m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget); m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget);
m_vehEnterType = doorNode; m_vehEnterType = doorNode;
m_nPedState = PED_ENTER_CAR; SetPedState(PED_ENTER_CAR);
if (m_vehEnterType == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && car->m_vehType != VEHICLE_TYPE_BIKE) { if (m_vehEnterType == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && car->m_vehType != VEHICLE_TYPE_BIKE) {
car->bIsBeingCarJacked = true; car->bIsBeingCarJacked = true;
} }
@ -3674,14 +3674,14 @@ void
CPed::SetExitBoat(CVehicle *boat) CPed::SetExitBoat(CVehicle *boat)
{ {
#ifndef VC_PED_PORTS #ifndef VC_PED_PORTS
m_nPedState = PED_IDLE; SetPedState(PED_IDLE);
CVector firstPos = GetPosition(); CVector firstPos = GetPosition();
CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f); CAnimManager::BlendAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE, 100.0f);
if (boat->GetModelIndex() == MI_SPEEDER && boat->IsUpsideDown()) { if (boat->GetModelIndex() == MI_SPEEDER && boat->IsUpsideDown()) {
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS, 8.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS, 8.0f);
m_pVehicleAnim->SetFinishCallback(PedSetOutCarCB, this); m_pVehicleAnim->SetFinishCallback(PedSetOutCarCB, this);
m_vehEnterType = CAR_DOOR_RF; m_vehEnterType = CAR_DOOR_RF;
m_nPedState = PED_EXIT_CAR; SetPedState(PED_EXIT_CAR);
} else { } else {
m_vehEnterType = CAR_DOOR_RF; m_vehEnterType = CAR_DOOR_RF;
PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
@ -3694,7 +3694,7 @@ CPed::SetExitBoat(CVehicle *boat)
m_vecMoveSpeed = boat->m_vecMoveSpeed; m_vecMoveSpeed = boat->m_vecMoveSpeed;
bTryingToReachDryLand = true; bTryingToReachDryLand = true;
#else #else
m_nPedState = PED_IDLE; SetPedState(PED_IDLE);
CVector newPos = GetPosition(); CVector newPos = GetPosition();
RemoveInCarAnims(); RemoveInCarAnims();
CColModel* boatCol = boat->GetColModel(); CColModel* boatCol = boat->GetColModel();
@ -3921,7 +3921,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
m_pSeekTarget = veh; m_pSeekTarget = veh;
m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget);
m_vehEnterType = optedDoorNode; m_vehEnterType = optedDoorNode;
m_nPedState = PED_EXIT_CAR; SetPedState(PED_EXIT_CAR);
if (m_pVehicleAnim && m_pVehicleAnim->flags & ASSOC_PARTIAL) if (m_pVehicleAnim && m_pVehicleAnim->flags & ASSOC_PARTIAL)
m_pVehicleAnim->blendDelta = -1000.0f; m_pVehicleAnim->blendDelta = -1000.0f;
SetMoveState(PEDMOVE_NONE); SetMoveState(PEDMOVE_NONE);
@ -4469,7 +4469,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
ped->bGonnaKillTheCarJacker = false; ped->bGonnaKillTheCarJacker = false;
if (!ped->m_pedInObjective || !(CGeneral::GetRandomNumber() & 1)) { if (!ped->m_pedInObjective || !(CGeneral::GetRandomNumber() & 1)) {
if (!driver || driver == ped || driver->IsPlayer() && CTheScripts::IsPlayerOnAMission()) { if (!driver || driver == ped || driver->IsPlayer() && CTheScripts::IsPlayerOnAMission()) {
ped->m_nPedState = PED_NONE; ped->SetPedState(PED_NONE);
ped->m_nLastPedState = PED_NONE; ped->m_nLastPedState = PED_NONE;
ped->SetFlee(ped->m_pMyVehicle->GetPosition(), 4000); ped->SetFlee(ped->m_pMyVehicle->GetPosition(), 4000);
} else { } else {
@ -4498,7 +4498,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
else else
#endif #endif
{ {
ped->m_nPedState = PED_NONE; ped->SetPedState(PED_NONE);
ped->m_nLastPedState = PED_NONE; ped->m_nLastPedState = PED_NONE;
ped->SetFindPathAndFlee(ped->m_pMyVehicle->GetPosition(), 10000); ped->SetFindPathAndFlee(ped->m_pMyVehicle->GetPosition(), 10000);
} }
@ -4591,7 +4591,7 @@ CPed::PedSetInTrainCB(CAnimBlendAssociation* animAssoc, void* arg)
return; return;
ped->bInVehicle = true; ped->bInVehicle = true;
ped->m_nPedState = PED_DRIVING; ped->SetPedState(PED_DRIVING);
ped->RestorePreviousObjective(); ped->RestorePreviousObjective();
ped->SetMoveState(PEDMOVE_STILL); ped->SetMoveState(PEDMOVE_STILL);
veh->AddPassenger(ped); veh->AddPassenger(ped);
@ -4612,7 +4612,7 @@ CPed::SetEnterTrain(CVehicle *train, uint32 unused)
m_pMyVehicle = train; m_pMyVehicle = train;
m_pMyVehicle->RegisterReference((CEntity **) &m_pMyVehicle); m_pMyVehicle->RegisterReference((CEntity **) &m_pMyVehicle);
m_nPedState = PED_ENTER_TRAIN; SetPedState(PED_ENTER_TRAIN);
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_TRAIN_GETIN, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_TRAIN_GETIN, 4.0f);
m_pVehicleAnim->SetFinishCallback(PedSetInTrainCB, this); m_pVehicleAnim->SetFinishCallback(PedSetInTrainCB, this);
bUsesCollision = false; bUsesCollision = false;
@ -4686,7 +4686,7 @@ CPed::SetExitTrain(CVehicle* train)
CVector exitPos; CVector exitPos;
GetNearestTrainPedPosition(train, exitPos); GetNearestTrainPedPosition(train, exitPos);
*/ */
m_nPedState = PED_EXIT_TRAIN; SetPedState(PED_EXIT_TRAIN);
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_TRAIN_GETOUT, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_TRAIN_GETOUT, 4.0f);
m_pVehicleAnim->SetFinishCallback(PedSetOutTrainCB, this); m_pVehicleAnim->SetFinishCallback(PedSetOutTrainCB, this);
bUsesCollision = false; bUsesCollision = false;
@ -4712,7 +4712,7 @@ CPed::PedSetOutTrainCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->bUsesCollision = true; ped->bUsesCollision = true;
ped->m_pVehicleAnim = nil; ped->m_pVehicleAnim = nil;
ped->bInVehicle = false; ped->bInVehicle = false;
ped->m_nPedState = PED_IDLE; ped->SetPedState(PED_IDLE);
ped->RestorePreviousObjective(); ped->RestorePreviousObjective();
ped->SetMoveState(PEDMOVE_STILL); ped->SetMoveState(PEDMOVE_STILL);
@ -5180,7 +5180,7 @@ CPed::SetSeekBoatPosition(CVehicle *boat)
m_pMyVehicle = boat; m_pMyVehicle = boat;
m_pMyVehicle->RegisterReference((CEntity **) &m_pMyVehicle); m_pMyVehicle->RegisterReference((CEntity **) &m_pMyVehicle);
m_distanceToCountSeekDone = 0.5f; m_distanceToCountSeekDone = 0.5f;
m_nPedState = PED_SEEK_IN_BOAT; SetPedState(PED_SEEK_IN_BOAT);
} }
void void

View File

@ -164,7 +164,7 @@ CPed::SetPointGunAt(CEntity *to)
if (m_nPedState != PED_ATTACK) if (m_nPedState != PED_ATTACK)
SetStoredState(); SetStoredState();
m_nPedState = PED_AIM_GUN; SetPedState(PED_AIM_GUN);
bIsPointingGunAt = true; bIsPointingGunAt = true;
CWeaponInfo *curWeapon = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType); CWeaponInfo *curWeapon = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
SetMoveState(PEDMOVE_NONE); SetMoveState(PEDMOVE_NONE);
@ -222,7 +222,7 @@ CPed::ClearPointGunAt(void)
RestorePreviousState(); RestorePreviousState();
#else #else
if (m_nPedState == PED_AIM_GUN || m_nPedState == PED_ATTACK) { if (m_nPedState == PED_AIM_GUN || m_nPedState == PED_ATTACK) {
m_nPedState = PED_IDLE; SetPedState(PED_IDLE);
RestorePreviousState(); RestorePreviousState();
} }
#endif #endif
@ -281,7 +281,7 @@ CPed::SetAttack(CEntity *victim)
(m_nPedState != PED_FIGHT && m_nMoveState != PEDMOVE_NONE && m_nMoveState != PEDMOVE_STILL && !(m_pedStats->m_flags & STAT_SHOPPING_BAGS))) { (m_nPedState != PED_FIGHT && m_nMoveState != PEDMOVE_NONE && m_nMoveState != PEDMOVE_STILL && !(m_pedStats->m_flags & STAT_SHOPPING_BAGS))) {
if (m_nPedState != PED_ATTACK) { if (m_nPedState != PED_ATTACK) {
m_nPedState = PED_ATTACK; SetPedState(PED_ATTACK);
bIsAttacking = false; bIsAttacking = false;
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, curWeapon->m_AnimToPlay, 8.0f); animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, curWeapon->m_AnimToPlay, 8.0f);
animAssoc->SetRun(); animAssoc->SetRun();
@ -348,7 +348,7 @@ CPed::SetAttack(CEntity *victim)
if (m_nPedState != PED_AIM_GUN) if (m_nPedState != PED_AIM_GUN)
SetStoredState(); SetStoredState();
m_nPedState = PED_ATTACK; SetPedState(PED_ATTACK);
SetMoveState(PEDMOVE_NONE); SetMoveState(PEDMOVE_NONE);
if (bCrouchWhenShooting) { if (bCrouchWhenShooting) {
animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_RBLOCK_CSHOOT, 4.0f); animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_RBLOCK_CSHOOT, 4.0f);
@ -786,7 +786,7 @@ CPed::StartFightAttack(uint8 buttonPressure)
RestoreHeadingRate(); RestoreHeadingRate();
} }
m_nPedState = PED_FIGHT; SetPedState(PED_FIGHT);
m_fightButtonPressure = 0; m_fightButtonPressure = 0;
RpAnimBlendClumpRemoveAssociations(GetClump(), ASSOC_REPEAT); RpAnimBlendClumpRemoveAssociations(GetClump(), ASSOC_REPEAT);
CAnimBlendAssociation *animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WALK_START); CAnimBlendAssociation *animAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WALK_START);
@ -1062,7 +1062,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
m_nWaitState = WAITSTATE_FALSE; m_nWaitState = WAITSTATE_FALSE;
RestoreHeadingRate(); RestoreHeadingRate();
} }
m_nPedState = PED_FIGHT; SetPedState(PED_FIGHT);
m_fightButtonPressure = 0; m_fightButtonPressure = 0;
RpAnimBlendClumpRemoveAssociations(GetClump(), ASSOC_REPEAT); RpAnimBlendClumpRemoveAssociations(GetClump(), ASSOC_REPEAT);
CAnimBlendAssociation *walkStartAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WALK_START); CAnimBlendAssociation *walkStartAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_WALK_START);
@ -1796,7 +1796,7 @@ CPed::SetInvestigateEvent(eEventType event, CVector2D pos, float distanceToCount
SetStoredState(); SetStoredState();
bFindNewNodeAfterStateRestore = false; bFindNewNodeAfterStateRestore = false;
m_nPedState = PED_INVESTIGATE; SetPedState(PED_INVESTIGATE);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_standardTimer = CTimer::GetTimeInMilliseconds() + time;
m_eventType = event; m_eventType = event;
m_eventOrThreat = pos; m_eventOrThreat = pos;

View File

@ -244,7 +244,7 @@ CPlayerPed::SetInitialState(void)
if (m_pFire) if (m_pFire)
m_pFire->Extinguish(); m_pFire->Extinguish();
RpAnimBlendClumpRemoveAllAssociations(GetClump()); RpAnimBlendClumpRemoveAllAssociations(GetClump());
m_nPedState = PED_IDLE; SetPedState(PED_IDLE);
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
m_nLastPedState = PED_NONE; m_nLastPedState = PED_NONE;
m_animGroup = ASSOCGRP_PLAYER; m_animGroup = ASSOCGRP_PLAYER;
@ -989,7 +989,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || GetWeapon()->m_eWeaponType == WEAPONTYPE_M16) { GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || GetWeapon()->m_eWeaponType == WEAPONTYPE_M16) {
if (padUsed->TargetJustDown()) { if (padUsed->TargetJustDown()) {
SetStoredState(); SetStoredState();
m_nPedState = PED_SNIPER_MODE; SetPedState(PED_SNIPER_MODE);
#ifdef FREE_CAM #ifdef FREE_CAM
if (CCamera::bFreeCam && TheCamera.Cams[0].Using3rdPersonMouseCam()) { if (CCamera::bFreeCam && TheCamera.Cams[0].Using3rdPersonMouseCam()) {
m_fRotationCur = CGeneral::LimitRadianAngle(-TheCamera.Orientation); m_fRotationCur = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
@ -1343,41 +1343,6 @@ CPlayerPed::ProcessControl(void)
if (IsPedInControl() && padUsed) if (IsPedInControl() && padUsed)
ProcessPlayerWeapon(padUsed); ProcessPlayerWeapon(padUsed);
break; break;
case PED_LOOK_ENTITY:
case PED_LOOK_HEADING:
case PED_WANDER_RANGE:
case PED_WANDER_PATH:
case PED_PURSUE:
case PED_FOLLOW_PATH:
case PED_ROCKET_MODE:
case PED_DUMMY:
case PED_PAUSE:
case PED_FACE_PHONE:
case PED_MAKE_CALL:
case PED_CHAT:
case PED_MUG:
case PED_AI_CONTROL:
case PED_FOLLOW_ROUTE:
case PED_CPR:
case PED_SOLICIT:
case PED_BUY_ICECREAM:
case PED_INVESTIGATE:
case PED_STEP_AWAY:
case PED_ON_FIRE:
case PED_UNKNOWN:
case PED_STATES_NO_AI:
case PED_STAGGER:
case PED_DIVE_AWAY:
case PED_STATES_NO_ST:
case PED_ARREST_PLAYER:
case PED_DRIVING:
case PED_PASSENGER:
case PED_TAXI_PASSENGER:
case PED_OPEN_DOOR:
case PED_DIE:
case PED_DEAD:
case PED_HANDS_UP:
break;
case PED_SEEK_ENTITY: case PED_SEEK_ENTITY:
m_vecSeekPos = m_pSeekTarget->GetPosition(); m_vecSeekPos = m_pSeekTarget->GetPosition();
@ -1457,6 +1422,8 @@ CPlayerPed::ProcessControl(void)
if (m_nLastPedState == PED_DRAG_FROM_CAR && m_pVehicleAnim) if (m_nLastPedState == PED_DRAG_FROM_CAR && m_pVehicleAnim)
BeingDraggedFromCar(); BeingDraggedFromCar();
break; break;
default:
break;
} }
if (padUsed && IsPedShootable()) { if (padUsed && IsPedShootable()) {
ProcessWeaponSwitch(padUsed); ProcessWeaponSwitch(padUsed);

View File

@ -718,10 +718,10 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
if (i != 0) { if (i != 0) {
// Gang member // Gang member
newPed->SetLeader(gangLeader); newPed->SetLeader(gangLeader);
#ifndef FIX_BUGS #if !defined(FIX_BUGS) && GTA_VERSION >= GTA3_PC_10
// seems to be a miami leftover (this code is not on PS2) but gang peds end up just being frozen // seems to be a miami leftover (this code is not on PS2) but gang peds end up just being frozen
newPed->m_nPedState = PED_UNKNOWN; newPed->SetPedState(PED_UNKNOWN);
gangLeader->m_nPedState = PED_UNKNOWN; gangLeader->SetPedState(PED_UNKNOWN);
newPed->m_fRotationCur = CGeneral::GetRadianAngleBetweenPoints( newPed->m_fRotationCur = CGeneral::GetRadianAngleBetweenPoints(
gangLeader->GetPosition().x, gangLeader->GetPosition().y, gangLeader->GetPosition().x, gangLeader->GetPosition().y,
newPed->GetPosition().x, newPed->GetPosition().y); newPed->GetPosition().x, newPed->GetPosition().y);