more renames

This commit is contained in:
aap 2021-01-13 13:41:24 +01:00
parent 083aa700e9
commit 6aab948be2
4 changed files with 37 additions and 36 deletions

View File

@ -97,9 +97,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_attackTimer = 0; m_attackTimer = 0;
m_timerUnused = 0; m_timerUnused = 0;
m_lookTimer = 0; m_lookTimer = 0;
m_standardTimer = 0; m_chatTimer = 0;
m_shootTimer = 0; m_shootTimer = 0;
m_hitRecoverTimer = 0; m_carJackTimer = 0;
m_duckAndCoverTimer = 0; m_duckAndCoverTimer = 0;
m_moved = CVector2D(0.0f, 0.0f); m_moved = CVector2D(0.0f, 0.0f);
m_fRotationCur = 0.0f; m_fRotationCur = 0.0f;
@ -1141,7 +1141,8 @@ CPed::ScanForInterestingStuff(void)
if (LookForInterestingNodes()) if (LookForInterestingNodes())
return; return;
if (m_nPedType == PEDTYPE_CRIMINAL && m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) { if (m_nPedType == PEDTYPE_CRIMINAL && m_carJackTimer < CTimer::GetTimeInMilliseconds()) {
// Find a car to steal or a ped to mug if we haven't already decided to steal a car
if (CGeneral::GetRandomNumber() % 100 < 10) { if (CGeneral::GetRandomNumber() % 100 < 10) {
int mostExpensiveVehAround = -1; int mostExpensiveVehAround = -1;
int bestMonetaryValue = 0; int bestMonetaryValue = 0;
@ -1164,10 +1165,10 @@ CPed::ScanForInterestingStuff(void)
} }
if (bestMonetaryValue > 2000 && mostExpensiveVehAround != -1 && vehicles[mostExpensiveVehAround]) { if (bestMonetaryValue > 2000 && mostExpensiveVehAround != -1 && vehicles[mostExpensiveVehAround]) {
SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, vehicles[mostExpensiveVehAround]); SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, vehicles[mostExpensiveVehAround]);
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
return; return;
} }
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
} else if (m_objective != OBJECTIVE_MUG_CHAR && !(CGeneral::GetRandomNumber() & 7)) { } else if (m_objective != OBJECTIVE_MUG_CHAR && !(CGeneral::GetRandomNumber() & 7)) {
CPed *charToMug = nil; CPed *charToMug = nil;
for (int i = 0; i < m_numNearPeds; ++i) { for (int i = 0; i < m_numNearPeds; ++i) {
@ -1189,22 +1190,22 @@ CPed::ScanForInterestingStuff(void)
if (charToMug) if (charToMug)
SetObjective(OBJECTIVE_MUG_CHAR, charToMug); SetObjective(OBJECTIVE_MUG_CHAR, charToMug);
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
} }
} }
if (m_nPedState == PED_WANDER_PATH) { if (m_nPedState == PED_WANDER_PATH) {
#ifndef VC_PED_PORTS #ifndef VC_PED_PORTS
if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (CTimer::GetTimeInMilliseconds() > m_chatTimer) {
// += 2 is weird // += 2 is weird
for (int i = 0; i < m_numNearPeds; i += 2) { for (int i = 0; i < m_numNearPeds; i += 2) {
if (m_nearPeds[i]->m_nPedState == PED_WANDER_PATH && WillChat(m_nearPeds[i])) { if (m_nearPeds[i]->m_nPedState == PED_WANDER_PATH && WillChat(m_nearPeds[i])) {
if (CGeneral::GetRandomNumberInRange(0, 100) >= 100) if (CGeneral::GetRandomNumberInRange(0, 100) >= 100)
m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000;
else { else {
if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() >= 1.8f) { if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() >= 1.8f) {
m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000;
} else if (CanSeeEntity(m_nearPeds[i])) { } else if (CanSeeEntity(m_nearPeds[i])) {
int time = CGeneral::GetRandomNumber() % 4000 + 10000; int time = CGeneral::GetRandomNumber() % 4000 + 10000;
SetChat(m_nearPeds[i], time); SetChat(m_nearPeds[i], time);
@ -1217,7 +1218,7 @@ CPed::ScanForInterestingStuff(void)
} }
#else #else
if (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.5f) { if (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.5f) {
if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (CTimer::GetTimeInMilliseconds() > m_chatTimer) {
for (int i = 0; i < m_numNearPeds; i ++) { for (int i = 0; i < m_numNearPeds; i ++) {
if (m_nearPeds[i] && m_nearPeds[i]->m_nPedState == PED_WANDER_PATH) { if (m_nearPeds[i] && m_nearPeds[i]->m_nPedState == PED_WANDER_PATH) {
if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() < 1.8f if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() < 1.8f
@ -1234,7 +1235,7 @@ CPed::ScanForInterestingStuff(void)
} }
} }
} else { } else {
m_standardTimer = CTimer::GetTimeInMilliseconds() + 200; m_chatTimer = CTimer::GetTimeInMilliseconds() + 200;
} }
#endif #endif
} }
@ -5604,7 +5605,7 @@ CPed::ClearFlee(void)
{ {
RestorePreviousState(); RestorePreviousState();
bUsePedNodeSeek = false; bUsePedNodeSeek = false;
m_standardTimer = 0; m_chatTimer = 0;
m_fleeTimer = 0; m_fleeTimer = 0;
} }
@ -5641,7 +5642,7 @@ CPed::Flee(void)
if (m_nPedStateTimer < CTimer::GetTimeInMilliseconds() if (m_nPedStateTimer < CTimer::GetTimeInMilliseconds()
&& m_collidingThingTimer < CTimer::GetTimeInMilliseconds()) { && m_collidingThingTimer < CTimer::GetTimeInMilliseconds()) {
if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_chatTimer) {
curDirectionShouldBe = CGeneral::GetNodeHeadingFromVector(GetPosition().x - ms_vec2DFleePosition.x, GetPosition().y - ms_vec2DFleePosition.y); curDirectionShouldBe = CGeneral::GetNodeHeadingFromVector(GetPosition().x - ms_vec2DFleePosition.x, GetPosition().y - ms_vec2DFleePosition.y);
if (m_nPathDir < curDirectionShouldBe) if (m_nPathDir < curDirectionShouldBe)
@ -5684,7 +5685,7 @@ CPed::Flee(void)
if (m_pNextPathNode && m_pNextPathNode != realLastNode && m_pNextPathNode != m_pLastPathNode && curDirectionShouldBe - nextDirection != 4) { if (m_pNextPathNode && m_pNextPathNode != realLastNode && m_pNextPathNode != m_pLastPathNode && curDirectionShouldBe - nextDirection != 4) {
m_nPathDir = nextDirection; m_nPathDir = nextDirection;
m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000;
} else { } else {
bUsePedNodeSeek = false; bUsePedNodeSeek = false;
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
@ -6398,7 +6399,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
m_lookTimer = 0; m_lookTimer = 0;
#endif #endif
SetLookFlag(chatWith, true); SetLookFlag(chatWith, true);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_chatTimer = CTimer::GetTimeInMilliseconds() + time;
m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000; m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000;
} }
@ -6450,9 +6451,9 @@ CPed::Chat(void)
Say(SOUND_PED_CHAT); Say(SOUND_PED_CHAT);
} }
} }
if (m_standardTimer && CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (m_chatTimer && CTimer::GetTimeInMilliseconds() > m_chatTimer) {
ClearChat(); ClearChat();
m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000;
} }
} }
@ -6659,7 +6660,7 @@ CPed::SeekCar(void)
} else } else
GetNearestDoor(vehToSeek, dest); GetNearestDoor(vehToSeek, dest);
} else { } else {
if (m_hitRecoverTimer > CTimer::GetTimeInMilliseconds()) { if (m_carJackTimer > CTimer::GetTimeInMilliseconds()) {
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
return; return;
} }
@ -6703,7 +6704,7 @@ CPed::SeekCar(void)
if (IsPlayer()) { if (IsPlayer()) {
ClearObjective(); ClearObjective();
} else if (CharCreatedBy == RANDOM_CHAR) { } else if (CharCreatedBy == RANDOM_CHAR) {
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000;
} }
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
TheCamera.ClearPlayerWeaponMode(); TheCamera.ClearPlayerWeaponMode();
@ -7038,7 +7039,7 @@ CPed::LookForInterestingNodes(void)
C2dEffect *effect; C2dEffect *effect;
CMatrix *objMat; CMatrix *objMat;
if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_standardTimer) { if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_chatTimer) {
return false; return false;
} }
bool found = false; bool found = false;
@ -7148,7 +7149,7 @@ CPed::LookForInterestingNodes(void)
float angleToFace = CGeneral::GetRadianAngleBetweenPoints(effectFrontLocal.x, effectFrontLocal.y, 0.0f, 0.0f); float angleToFace = CGeneral::GetRadianAngleBetweenPoints(effectFrontLocal.x, effectFrontLocal.y, 0.0f, 0.0f);
randVal = CGeneral::GetRandomNumber() % 256; randVal = CGeneral::GetRandomNumber() % 256;
if (randVal <= m_randomSeed % 256) { if (randVal <= m_randomSeed % 256) {
m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000;
SetLookFlag(angleToFace, true); SetLookFlag(angleToFace, true);
SetLookTimer(1000); SetLookTimer(1000);
return false; return false;
@ -7224,7 +7225,7 @@ CPed::SetWaitState(eWaitState state, void *time)
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) { if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) {
ClearObjective(); ClearObjective();
RestorePreviousState(); RestorePreviousState();
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000;
} }
break; break;
case WAITSTATE_TURN180: case WAITSTATE_TURN180:
@ -7253,7 +7254,7 @@ CPed::SetWaitState(eWaitState state, void *time)
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) { if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) {
ClearObjective(); ClearObjective();
RestorePreviousState(); RestorePreviousState();
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000;
} }
break; break;
case WAITSTATE_LOOK_ABOUT: case WAITSTATE_LOOK_ABOUT:
@ -7681,7 +7682,7 @@ CPed::SetSolicit(uint32 time)
} }
if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) { if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) {
m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_chatTimer = CTimer::GetTimeInMilliseconds() + 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);
@ -7694,7 +7695,7 @@ CPed::SetSolicit(uint32 time)
void void
CPed::Solicit(void) CPed::Solicit(void)
{ {
if (m_standardTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) { if (m_chatTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) {
CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor, 0.0f); CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor, 0.0f);
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
@ -7758,7 +7759,7 @@ CPed::SetBuyIceCream(void)
m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI; m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI;
if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) { if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) {
m_standardTimer = CTimer::GetTimeInMilliseconds() + 3000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 3000;
SetPedState(PED_BUY_ICECREAM); SetPedState(PED_BUY_ICECREAM);
} }
} }

View File

@ -493,10 +493,10 @@ public:
uint32 m_leaveCarTimer; uint32 m_leaveCarTimer;
uint32 m_getUpTimer; uint32 m_getUpTimer;
uint32 m_lookTimer; uint32 m_lookTimer;
uint32 m_standardTimer; uint32 m_chatTimer;
uint32 m_attackTimer; uint32 m_attackTimer;
uint32 m_shootTimer; // shooting is a part of attack uint32 m_shootTimer; // shooting is a part of attack
uint32 m_hitRecoverTimer; uint32 m_carJackTimer;
uint32 m_objectiveTimer; uint32 m_objectiveTimer;
uint32 m_duckTimer; uint32 m_duckTimer;
uint32 m_duckAndCoverTimer; uint32 m_duckAndCoverTimer;

View File

@ -1754,7 +1754,7 @@ CPed::ProcessObjective(void)
if (bInVehicle) { if (bInVehicle) {
bScriptObjectiveCompleted = true; bScriptObjectiveCompleted = true;
RestorePreviousObjective(); RestorePreviousObjective();
} else if (m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) { } else if (m_carJackTimer < CTimer::GetTimeInMilliseconds()) {
CVehicle *carToSteal = nil; CVehicle *carToSteal = nil;
float closestCarDist = ENTER_CAR_MAX_DIST; float closestCarDist = ENTER_CAR_MAX_DIST;
CVector pos = GetPosition(); CVector pos = GetPosition();
@ -1780,7 +1780,7 @@ CPed::ProcessObjective(void)
} }
if (carToSteal) { if (carToSteal) {
SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carToSteal); SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carToSteal);
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
} else { } else {
RestorePreviousObjective(); RestorePreviousObjective();
RestorePreviousState(); RestorePreviousState();

View File

@ -1793,7 +1793,7 @@ CPed::SetInvestigateEvent(eEventType event, CVector2D pos, float distanceToCount
SetStoredState(); SetStoredState();
bFindNewNodeAfterStateRestore = false; bFindNewNodeAfterStateRestore = false;
SetPedState(PED_INVESTIGATE); SetPedState(PED_INVESTIGATE);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_chatTimer = CTimer::GetTimeInMilliseconds() + time;
m_eventType = event; m_eventType = event;
m_eventOrThreat = pos; m_eventOrThreat = pos;
m_distanceToCountSeekDone = distanceToCountDone; m_distanceToCountSeekDone = distanceToCountDone;
@ -1816,13 +1816,13 @@ CPed::InvestigateEvent(void)
if (m_nWaitState == WAITSTATE_TURN180) if (m_nWaitState == WAITSTATE_TURN180)
return; return;
if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (CTimer::GetTimeInMilliseconds() > m_chatTimer) {
if (m_standardTimer) { if (m_chatTimer) {
if (m_eventType < EVENT_ASSAULT_NASTYWEAPON) if (m_eventType < EVENT_ASSAULT_NASTYWEAPON)
SetWaitState(WAITSTATE_TURN180, nil); SetWaitState(WAITSTATE_TURN180, nil);
m_standardTimer = 0; m_chatTimer = 0;
} else { } else {
ClearInvestigateEvent(); ClearInvestigateEvent();
} }
@ -1882,7 +1882,7 @@ CPed::InvestigateEvent(void)
Say(SOUND_PED_CHAT_EVENT); Say(SOUND_PED_CHAT_EVENT);
} else { } else {
m_standardTimer = 0; m_chatTimer = 0;
} }
} else if (CTimer::GetTimeInMilliseconds() > m_lookTimer) { } else if (CTimer::GetTimeInMilliseconds() > m_lookTimer) {
@ -2021,7 +2021,7 @@ CPed::ClearInvestigateEvent(void)
animAssoc->flags |= ASSOC_DELETEFADEDOUT; animAssoc->flags |= ASSOC_DELETEFADEDOUT;
} }
if (m_eventType > EVENT_EXPLOSION) if (m_eventType > EVENT_EXPLOSION)
m_standardTimer = CTimer::GetTimeInMilliseconds() + 15000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 15000;
bGonnaInvestigateEvent = false; bGonnaInvestigateEvent = false;
m_pEventEntity = nil; m_pEventEntity = nil;