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

View File

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

View File

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

View File

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

View File

@ -274,7 +274,7 @@ CCivilianPed::ProcessControl(void)
} else {
crimeReporters[m_phoneId] = this;
m_facePhoneStart = true;
m_nPedState = PED_FACE_PHONE;
SetPedState(PED_FACE_PHONE);
}
#else
} else if (bRunningToPhone) {
@ -283,7 +283,7 @@ CCivilianPed::ProcessControl(void)
m_phoneId = -1;
} else {
gPhoneInfo.m_aPhones[m_phoneId].m_nState = PHONE_STATE_REPORTING_CRIME;
m_nPedState = PED_FACE_PHONE;
SetPedState(PED_FACE_PHONE);
}
#endif
} else if (m_objective != OBJECTIVE_KILL_CHAR_ANY_MEANS && m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
@ -305,7 +305,7 @@ CCivilianPed::ProcessControl(void)
break;
case PED_FACE_PHONE:
if (FacePhone())
m_nPedState = PED_MAKE_CALL;
SetPedState(PED_MAKE_CALL);
break;
case PED_MAKE_CALL:
if (MakePhonecall())
@ -331,7 +331,7 @@ CCivilianPed::ProcessControl(void)
for (int j = 0; j < m_numNearPeds; ++j) {
CPed *nearPed = m_nearPeds[j];
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) {
player->m_nLastPedState = player->m_nPedState;
player->m_nPedState = PED_ARRESTED;
player->SetPedState(PED_ARRESTED);
FindPlayerPed()->m_bCanBeDamaged = false;
((CPlayerPed*)player)->m_pArrestingCop = this;
this->RegisterReference((CEntity**) &((CPlayerPed*)player)->m_pArrestingCop);
}
m_nPedState = PED_ARREST_PLAYER;
SetPedState(PED_ARREST_PLAYER);
SetObjective(OBJECTIVE_NONE);
m_prevObjective = OBJECTIVE_NONE;
bIsPointingGunAt = false;
@ -229,7 +229,7 @@ CCopPed::ArrestPlayer(void)
CPed *suspect = (CPed*)m_pSeekTarget;
if (suspect) {
if (suspect->CanSetPedState())
suspect->m_nPedState = PED_ARRESTED;
suspect->SetPedState(PED_ARRESTED);
if (suspect->bInVehicle && m_pMyVehicle && suspect->m_pMyVehicle == m_pMyVehicle) {

View File

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

View File

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

View File

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

View File

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

View File

@ -244,7 +244,7 @@ CPlayerPed::SetInitialState(void)
if (m_pFire)
m_pFire->Extinguish();
RpAnimBlendClumpRemoveAllAssociations(GetClump());
m_nPedState = PED_IDLE;
SetPedState(PED_IDLE);
SetMoveState(PEDMOVE_STILL);
m_nLastPedState = PED_NONE;
m_animGroup = ASSOCGRP_PLAYER;
@ -989,7 +989,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
GetWeapon()->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE || GetWeapon()->m_eWeaponType == WEAPONTYPE_M16) {
if (padUsed->TargetJustDown()) {
SetStoredState();
m_nPedState = PED_SNIPER_MODE;
SetPedState(PED_SNIPER_MODE);
#ifdef FREE_CAM
if (CCamera::bFreeCam && TheCamera.Cams[0].Using3rdPersonMouseCam()) {
m_fRotationCur = CGeneral::LimitRadianAngle(-TheCamera.Orientation);
@ -1343,41 +1343,6 @@ CPlayerPed::ProcessControl(void)
if (IsPedInControl() && padUsed)
ProcessPlayerWeapon(padUsed);
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:
m_vecSeekPos = m_pSeekTarget->GetPosition();
@ -1457,6 +1422,8 @@ CPlayerPed::ProcessControl(void)
if (m_nLastPedState == PED_DRAG_FROM_CAR && m_pVehicleAnim)
BeingDraggedFromCar();
break;
default:
break;
}
if (padUsed && IsPedShootable()) {
ProcessWeaponSwitch(padUsed);

View File

@ -718,10 +718,10 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
if (i != 0) {
// Gang member
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
newPed->m_nPedState = PED_UNKNOWN;
gangLeader->m_nPedState = PED_UNKNOWN;
newPed->SetPedState(PED_UNKNOWN);
gangLeader->SetPedState(PED_UNKNOWN);
newPed->m_fRotationCur = CGeneral::GetRadianAngleBetweenPoints(
gangLeader->GetPosition().x, gangLeader->GetPosition().y,
newPed->GetPosition().x, newPed->GetPosition().y);