1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-22 19:30:01 +00:00
This commit is contained in:
erorcun 2021-01-13 16:54:45 +03:00
commit 011a9cc775
13 changed files with 213 additions and 213 deletions

View file

@ -171,11 +171,10 @@ workspace "re3"
filter {} filter {}
function setpaths (gamepath, exepath, scriptspath) function setpaths (gamepath, exepath)
scriptspath = scriptspath or ""
if (gamepath) then if (gamepath) then
postbuildcommands { postbuildcommands {
'{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"' '{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. '%{cfg.buildtarget.name}"'
} }
debugdir (gamepath) debugdir (gamepath)
if (exepath) then if (exepath) then
@ -185,7 +184,6 @@ workspace "re3"
debugdir (gamepath .. (dir or "")) debugdir (gamepath .. (dir or ""))
end end
end end
--targetdir ("bin/%{prj.name}/" .. scriptspath)
end end
if(_OPTIONS["with-librw"]) then if(_OPTIONS["with-librw"]) then
@ -307,7 +305,7 @@ project "re3"
filter {} filter {}
if(os.getenv("GTA_III_RE_DIR")) then if(os.getenv("GTA_III_RE_DIR")) then
setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "") setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)")
end end
filter "platforms:win*" filter "platforms:win*"

View file

@ -7,7 +7,7 @@
CAnimBlendClumpData::CAnimBlendClumpData(void) CAnimBlendClumpData::CAnimBlendClumpData(void)
{ {
numFrames = 0; numFrames = 0;
velocity = nil; velocity2d = nil;
frames = nil; frames = nil;
link.Init(); link.Init();
} }

View file

@ -3,7 +3,6 @@
#include "AnimBlendList.h" #include "AnimBlendList.h"
// TODO: put somewhere else
struct AnimBlendFrameData struct AnimBlendFrameData
{ {
enum { enum {
@ -38,7 +37,10 @@ public:
#ifdef PED_SKIN #ifdef PED_SKIN
int32 modelNumber; // doesn't seem to be used int32 modelNumber; // doesn't seem to be used
#endif #endif
CVector *velocity; union {
CVector2D *velocity2d;
CVector *velocity3d;
};
// order of frames is determined by RW hierarchy // order of frames is determined by RW hierarchy
AnimBlendFrameData *frames; AnimBlendFrameData *frames;

View file

@ -29,7 +29,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg); FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
else else
@ -138,11 +138,11 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
gpAnimBlendClump->velocity->x = transx - curx; gpAnimBlendClump->velocity2d->x = transx - curx;
gpAnimBlendClump->velocity->y = transy - cury; gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){ if(looped){
gpAnimBlendClump->velocity->x += endx; gpAnimBlendClump->velocity2d->x += endx;
gpAnimBlendClump->velocity->y += endy; gpAnimBlendClump->velocity2d->y += endy;
} }
mat->pos.x = pos.x - transx; mat->pos.x = pos.x - transx;
mat->pos.y = pos.y - transy; mat->pos.y = pos.y - transy;
@ -218,9 +218,9 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame,
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
mat->pos.x = (pos - trans).x + frame->resetPos.x; mat->pos.x = (pos - trans).x + frame->resetPos.x;
mat->pos.y = (pos - trans).y + frame->resetPos.y; mat->pos.y = (pos - trans).y + frame->resetPos.y;
mat->pos.z = (pos - trans).z + frame->resetPos.z; mat->pos.z = (pos - trans).z + frame->resetPos.z;
@ -241,7 +241,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg); FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
else else
@ -353,11 +353,11 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
gpAnimBlendClump->velocity->x = transx - curx; gpAnimBlendClump->velocity2d->x = transx - curx;
gpAnimBlendClump->velocity->y = transy - cury; gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){ if(looped){
gpAnimBlendClump->velocity->x += endx; gpAnimBlendClump->velocity2d->x += endx;
gpAnimBlendClump->velocity->y += endy; gpAnimBlendClump->velocity2d->y += endy;
} }
xform->t.x = pos.x - transx; xform->t.x = pos.x - transx;
xform->t.y = pos.y - transy; xform->t.y = pos.y - transy;
@ -433,9 +433,9 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
xform->t.x = (pos - trans).x + frame->resetPos.x; xform->t.x = (pos - trans).x + frame->resetPos.x;
xform->t.y = (pos - trans).y + frame->resetPos.y; xform->t.y = (pos - trans).y + frame->resetPos.y;
xform->t.z = (pos - trans).z + frame->resetPos.z; xform->t.z = (pos - trans).z + frame->resetPos.z;

View file

@ -2212,7 +2212,7 @@ CCamera::StartTransition(int16 newMode)
while(deltaBeta < -PI) deltaBeta += 2*PI; while(deltaBeta < -PI) deltaBeta += 2*PI;
deltaBeta = Abs(deltaBeta); deltaBeta = Abs(deltaBeta);
door = FindPlayerPed()->m_vehEnterType; door = FindPlayerPed()->m_vehDoor;
if(deltaBeta > HALFPI){ if(deltaBeta > HALFPI){
if(((CPed*)pTargetEntity)->m_carInObjective){ if(((CPed*)pTargetEntity)->m_carInObjective){
if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){ if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){
@ -2293,7 +2293,7 @@ CCamera::StartTransition(int16 newMode)
} }
#endif #endif
door = FindPlayerPed()->m_vehEnterType; door = FindPlayerPed()->m_vehDoor;
if(deltaBeta > HALFPI){ if(deltaBeta > HALFPI){
if(((CVehicle*)pTargetEntity)->IsUpsideDown()){ if(((CVehicle*)pTargetEntity)->IsUpsideDown()){
if(door == CAR_DOOR_LF || door == CAR_DOOR_LR) // BUG: game checks LF twice if(door == CAR_DOOR_LF || door == CAR_DOOR_LR) // BUG: game checks LF twice

View file

@ -222,8 +222,8 @@ CPlayerInfo::Process(void)
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow); m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow);
} else if (carBelow->IsBoat()) { } else if (carBelow->IsBoat()) {
if (!carBelow->pDriver) { if (!carBelow->pDriver) {
m_pPed->m_vehEnterType = 0; m_pPed->m_vehDoor = 0;
m_pPed->SetEnterCar(carBelow, m_pPed->m_vehEnterType); m_pPed->SetEnterCar(carBelow, m_pPed->m_vehDoor);
} }
} else { } else {
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow); m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow);

View file

@ -35,7 +35,7 @@ CCutsceneObject::SetModelIndex(uint32 id)
CEntity::SetModelIndex(id); CEntity::SetModelIndex(id);
assert(RwObjectGetType(m_rwObject) == rpCLUMP); assert(RwObjectGetType(m_rwObject) == rpCLUMP);
RpAnimBlendClumpInit((RpClump*)m_rwObject); RpAnimBlendClumpInit((RpClump*)m_rwObject);
(*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = &m_vecMoveSpeed; (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity3d = &m_vecMoveSpeed;
(*RPANIMBLENDCLUMPDATA(m_rwObject))->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION_3D; (*RPANIMBLENDCLUMPDATA(m_rwObject))->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION_3D;
} }

View file

@ -97,15 +97,15 @@ 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;
m_headingRate = 15.0f; m_headingRate = 15.0f;
m_fRotationDest = 0.0f; m_fRotationDest = 0.0f;
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
m_walkAroundType = 0; m_walkAroundType = 0;
m_pCurrentPhysSurface = nil; m_pCurrentPhysSurface = nil;
m_vecOffsetFromPhysSurface = CVector(0.0f, 0.0f, 0.0f); m_vecOffsetFromPhysSurface = CVector(0.0f, 0.0f, 0.0f);
@ -288,7 +288,7 @@ CPed::~CPed(void)
CWorld::Remove(this); CWorld::Remove(this);
CRadar::ClearBlipForEntity(BLIP_CHAR, CPools::GetPedPool()->GetIndex(this)); CRadar::ClearBlipForEntity(BLIP_CHAR, CPools::GetPedPool()->GetIndex(this));
if (InVehicle()){ if (InVehicle()){
uint8 door_flag = GetCarDoorFlag(m_vehEnterType); uint8 door_flag = GetCarDoorFlag(m_vehDoor);
if (m_pMyVehicle->pDriver == this) if (m_pMyVehicle->pDriver == this)
m_pMyVehicle->pDriver = nil; m_pMyVehicle->pDriver = nil;
else { else {
@ -330,8 +330,7 @@ CPed::SetModelIndex(uint32 mi)
m_animGroup = (AssocGroupId) modelInfo->m_animGroup; m_animGroup = (AssocGroupId) modelInfo->m_animGroup;
CAnimManager::AddAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE); CAnimManager::AddAnimation(GetClump(), m_animGroup, ANIM_IDLE_STANCE);
// This is a mistake by R*, velocity is CVector, whereas m_vecAnimMoveDelta is CVector2D. (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity2d = &m_vecAnimMoveDelta;
(*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = (CVector*) &m_vecAnimMoveDelta;
#ifdef PED_SKIN #ifdef PED_SKIN
if(modelInfo->GetHitColModel() == nil) if(modelInfo->GetHitColModel() == nil)
@ -1142,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;
@ -1165,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) {
@ -1190,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);
@ -1218,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
@ -1235,7 +1235,7 @@ CPed::ScanForInterestingStuff(void)
} }
} }
} else { } else {
m_standardTimer = CTimer::GetTimeInMilliseconds() + 200; m_chatTimer = CTimer::GetTimeInMilliseconds() + 200;
} }
#endif #endif
} }
@ -3642,11 +3642,11 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
#ifdef NEW_WALK_AROUND_ALGORITHM #ifdef NEW_WALK_AROUND_ALGORITHM
else { else {
CVector tl = obj->GetMatrix() * CVector(adjustedColMin.x, adjustedColMax.y, 0.0f) - GetPosition(); CVector tl = obj->GetMatrix() * CVector(adjustedColMin.x, adjustedColMax.y, 0.0f) - GetPosition();
if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) { if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)) {
cornerToGo = tl; cornerToGo = tl;
m_walkAroundType = 1; m_walkAroundType = 1;
if (m_vehEnterType == CAR_DOOR_LR) if (m_vehDoor == CAR_DOOR_LR)
iWouldPreferGoingBack = 1; iWouldPreferGoingBack = 1;
} else if(CanWeSeeTheCorner(tl, GetForward())){ } else if(CanWeSeeTheCorner(tl, GetForward())){
cornerToGo = tl; cornerToGo = tl;
@ -3680,11 +3680,11 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
else { else {
CVector tr = obj->GetMatrix() * CVector(adjustedColMax.x, adjustedColMax.y, 0.0f) - GetPosition(); CVector tr = obj->GetMatrix() * CVector(adjustedColMax.x, adjustedColMax.y, 0.0f) - GetPosition();
if (tr.Magnitude2D() < cornerToGo.Magnitude2D()) { if (tr.Magnitude2D() < cornerToGo.Magnitude2D()) {
if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) { if (goingToEnterCar && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)) {
cornerToGo = tr; cornerToGo = tr;
m_walkAroundType = 2; m_walkAroundType = 2;
if (m_vehEnterType == CAR_DOOR_RR) if (m_vehDoor == CAR_DOOR_RR)
iWouldPreferGoingBack = 2; iWouldPreferGoingBack = 2;
} else if (CanWeSeeTheCorner(tr, GetForward())) { } else if (CanWeSeeTheCorner(tr, GetForward())) {
cornerToGo = tr; cornerToGo = tr;
@ -3721,7 +3721,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
if (iWouldPreferGoingBack == 2) if (iWouldPreferGoingBack == 2)
m_walkAroundType = 4; m_walkAroundType = 4;
else if (br.Magnitude2D() < cornerToGo.Magnitude2D()) { else if (br.Magnitude2D() < cornerToGo.Magnitude2D()) {
if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) { if (goingToEnterCar && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)) {
cornerToGo = br; cornerToGo = br;
m_walkAroundType = 5; m_walkAroundType = 5;
} else if (CanWeSeeTheCorner(br, GetForward())) { } else if (CanWeSeeTheCorner(br, GetForward())) {
@ -3759,7 +3759,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
if (iWouldPreferGoingBack == 1) if (iWouldPreferGoingBack == 1)
m_walkAroundType = 7; m_walkAroundType = 7;
else if (bl.Magnitude2D() < cornerToGo.Magnitude2D()) { else if (bl.Magnitude2D() < cornerToGo.Magnitude2D()) {
if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) { if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)) {
cornerToGo = bl; cornerToGo = bl;
m_walkAroundType = 6; m_walkAroundType = 6;
} else if (CanWeSeeTheCorner(bl, GetForward())) { } else if (CanWeSeeTheCorner(bl, GetForward())) {
@ -3789,7 +3789,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
if (Abs(angleDiffBtwObjCenterAndForward) >= objTopRightHeading) { if (Abs(angleDiffBtwObjCenterAndForward) >= objTopRightHeading) {
if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) { if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) {
if ((angleDiffBtwObjCenterAndForward <= 0.0f || objUpsideDown) && (angleDiffBtwObjCenterAndForward < 0.0f || !objUpsideDown)) { if ((angleDiffBtwObjCenterAndForward <= 0.0f || objUpsideDown) && (angleDiffBtwObjCenterAndForward < 0.0f || !objUpsideDown)) {
if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) { if (goingToEnterCar && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)) {
m_walkAroundType = 0; m_walkAroundType = 0;
} else { } else {
if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) >= 0.0f) { if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) >= 0.0f) {
@ -3807,7 +3807,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} }
} }
} else { } else {
if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) { if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)) {
m_walkAroundType = 0; m_walkAroundType = 0;
} else { } else {
if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) <= 0.0f) { if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) <= 0.0f) {
@ -3825,7 +3825,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} }
} }
} }
} else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)
|| CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) < 0.0f) { || CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) < 0.0f) {
if (entityOnTopLeftOfObj == 1 || entityOnTopLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) { if (entityOnTopLeftOfObj == 1 || entityOnTopLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) {
m_walkAroundType = 3; m_walkAroundType = 3;
@ -3833,7 +3833,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} else if (entityOnTopRightOfObj == 1 || entityOnTopRightOfObj && !entityOnTopLeftOfObj && !entityOnBottomLeftOfObj) { } else if (entityOnTopRightOfObj == 1 || entityOnTopRightOfObj && !entityOnTopLeftOfObj && !entityOnBottomLeftOfObj) {
m_walkAroundType = 4; m_walkAroundType = 4;
} }
} else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)
|| CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) > 0.0f) { || CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) > 0.0f) {
if (entityOnBottomLeftOfObj == 1 || entityOnBottomLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) { if (entityOnBottomLeftOfObj == 1 || entityOnBottomLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) {
m_walkAroundType = 2; m_walkAroundType = 2;
@ -3866,13 +3866,13 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
nextWalkAround = 7; nextWalkAround = 7;
} }
CVector nextPosToHead = objMat * LocalPosForWalkAround(adjustedColMin, adjustedColMax, nextWalkAround, goingToEnterCar ? m_vehEnterType : 0, goingToEnterCarAndItsVan); CVector nextPosToHead = objMat * LocalPosForWalkAround(adjustedColMin, adjustedColMax, nextWalkAround, goingToEnterCar ? m_vehDoor : 0, goingToEnterCarAndItsVan);
bool nextRouteIsClear = CWorld::GetIsLineOfSightClear(GetPosition(), nextPosToHead, true, true, true, true, true, true, false); bool nextRouteIsClear = CWorld::GetIsLineOfSightClear(GetPosition(), nextPosToHead, true, true, true, true, true, true, false);
if(nextRouteIsClear) if(nextRouteIsClear)
m_walkAroundType = nextWalkAround; m_walkAroundType = nextWalkAround;
else { else {
CVector posToHead = objMat * LocalPosForWalkAround(adjustedColMin, adjustedColMax, m_walkAroundType, goingToEnterCar ? m_vehEnterType : 0, goingToEnterCarAndItsVan); CVector posToHead = objMat * LocalPosForWalkAround(adjustedColMin, adjustedColMax, m_walkAroundType, goingToEnterCar ? m_vehDoor : 0, goingToEnterCarAndItsVan);
bool currentRouteIsClear = CWorld::GetIsLineOfSightClear(GetPosition(), posToHead, bool currentRouteIsClear = CWorld::GetIsLineOfSightClear(GetPosition(), posToHead,
true, true, true, true, true, true, false); true, true, true, true, true, true, false);
@ -3902,15 +3902,15 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} }
} }
localPosToHead = LocalPosForWalkAround(adjustedColMin, adjustedColMax, m_walkAroundType, goingToEnterCar ? m_vehEnterType : 0, goingToEnterCarAndItsVan); localPosToHead = LocalPosForWalkAround(adjustedColMin, adjustedColMax, m_walkAroundType, goingToEnterCar ? m_vehDoor : 0, goingToEnterCarAndItsVan);
#else #else
if (Abs(angleDiffBtwObjCenterAndForward) < objTopRightHeading) { if (Abs(angleDiffBtwObjCenterAndForward) < objTopRightHeading) {
if (goingToEnterCar) { if (goingToEnterCar) {
if (goingToEnterCarAndItsVan) { if (goingToEnterCarAndItsVan) {
if (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) if (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR)
return; return;
} }
if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) { if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) {
m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI); m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI);
localPosToHead.x = adjustedColMax.x; localPosToHead.x = adjustedColMax.x;
localPosToHead.z = 0.0f; localPosToHead.z = 0.0f;
@ -3939,9 +3939,9 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} else { } else {
if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) { if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) {
if (angleDiffBtwObjCenterAndForward <= 0.0f) { if (angleDiffBtwObjCenterAndForward <= 0.0f) {
if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR) { if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR) {
if (goingToEnterCar) { if (goingToEnterCar) {
if (m_vehEnterType == CAR_DOOR_RF || (m_vehEnterType == CAR_DOOR_RR && !goingToEnterCarAndItsVan)) if (m_vehDoor == CAR_DOOR_RF || (m_vehDoor == CAR_DOOR_RR && !goingToEnterCarAndItsVan))
return; return;
} }
if (m_walkAroundType == 4 || m_walkAroundType == 3 if (m_walkAroundType == 4 || m_walkAroundType == 3
@ -3963,14 +3963,14 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
localPosToHead.z = 0.0f; localPosToHead.z = 0.0f;
localPosToHead.y = adjustedColMin.y; localPosToHead.y = adjustedColMin.y;
} }
} else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR)) { } else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR)) {
m_fRotationDest = CGeneral::LimitRadianAngle(PI + dirToSet); m_fRotationDest = CGeneral::LimitRadianAngle(PI + dirToSet);
localPosToHead.x = adjustedColMin.x; localPosToHead.x = adjustedColMin.x;
localPosToHead.z = 0.0f; localPosToHead.z = 0.0f;
localPosToHead.y = adjustedColMin.y; localPosToHead.y = adjustedColMin.y;
} else { } else {
if (goingToEnterCar) { if (goingToEnterCar) {
if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR && !goingToEnterCarAndItsVan) if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR && !goingToEnterCarAndItsVan)
return; return;
} }
if (m_walkAroundType == 1 || m_walkAroundType == 2 if (m_walkAroundType == 1 || m_walkAroundType == 2
@ -3988,8 +3988,8 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} }
} }
} else { } else {
if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR)) { if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR)) {
if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) { if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) {
m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI); m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI);
localPosToHead.x = adjustedColMax.x; localPosToHead.x = adjustedColMax.x;
@ -4162,7 +4162,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
#endif #endif
ped->bInVehicle = false; ped->bInVehicle = false;
if (veh && veh->IsCar() && !veh->IsRoomForPedToLeaveCar(ped->m_vehEnterType, nil)) { if (veh && veh->IsCar() && !veh->IsRoomForPedToLeaveCar(ped->m_vehDoor, nil)) {
ped->PositionPedOutOfCollision(); ped->PositionPedOutOfCollision();
} }
@ -4247,7 +4247,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
} }
} }
veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehDoor);
if (veh->pDriver == ped) { if (veh->pDriver == ped) {
veh->RemoveDriver(); veh->RemoveDriver();
#ifndef FIX_BUGS // RemoveDriver does it anyway #ifndef FIX_BUGS // RemoveDriver does it anyway
@ -4263,7 +4263,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->bIsBus && !veh->IsUpsideDown() && !veh->IsOnItsSide()) { if (veh->bIsBus && !veh->IsUpsideDown() && !veh->IsOnItsSide()) {
float angleAfterExit; float angleAfterExit;
if (ped->m_vehEnterType == CAR_DOOR_LF) { if (ped->m_vehDoor == CAR_DOOR_LF) {
angleAfterExit = HALFPI + veh->GetForward().Heading(); angleAfterExit = HALFPI + veh->GetForward().Heading();
} else { } else {
angleAfterExit = veh->GetForward().Heading() - HALFPI; angleAfterExit = veh->GetForward().Heading() - HALFPI;
@ -4321,7 +4321,7 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
vehicle = ped->m_pMyVehicle; vehicle = ped->m_pMyVehicle;
if (vehicle) { if (vehicle) {
vehicle->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); vehicle->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehDoor);
if (vehicle->pDriver == ped) { if (vehicle->pDriver == ped) {
vehicle->RemoveDriver(); vehicle->RemoveDriver();
@ -4541,7 +4541,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->bIsBus) { if (veh->bIsBus) {
veh->AddPassenger(ped); veh->AddPassenger(ped);
} else { } else {
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
veh->AddPassenger(ped, 0); veh->AddPassenger(ped, 0);
break; break;
@ -4567,7 +4567,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
#endif #endif
} }
veh->m_nGettingInFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); veh->m_nGettingInFlags &= ~GetCarDoorFlag(ped->m_vehDoor);
if (veh->bIsBus && !veh->m_nGettingInFlags) if (veh->bIsBus && !veh->m_nGettingInFlags)
((CAutomobile*)veh)->SetBusDoorTimer(1000, 1); ((CAutomobile*)veh)->SetBusDoorTimer(1000, 1);
@ -4955,13 +4955,13 @@ void
CPed::Idle(void) CPed::Idle(void)
{ {
CVehicle *veh = m_pMyVehicle; CVehicle *veh = m_pMyVehicle;
if (veh && veh->m_nGettingOutFlags && m_vehEnterType) { if (veh && veh->m_nGettingOutFlags && m_vehDoor) {
if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehEnterType)) { if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehDoor)) {
if (m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) { if (m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehEnterType); CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehDoor);
CVector doorDist = GetPosition() - doorPos; CVector doorDist = GetPosition() - doorPos;
if (doorDist.MagnitudeSqr() < sq(0.5f)) { if (doorDist.MagnitudeSqr() < sq(0.5f)) {
@ -5605,7 +5605,7 @@ CPed::ClearFlee(void)
{ {
RestorePreviousState(); RestorePreviousState();
bUsePedNodeSeek = false; bUsePedNodeSeek = false;
m_standardTimer = 0; m_chatTimer = 0;
m_fleeTimer = 0; m_fleeTimer = 0;
} }
@ -5642,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)
@ -5685,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);
@ -6399,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;
} }
@ -6451,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;
} }
} }
@ -6632,7 +6632,7 @@ CPed::SetSeekCar(CVehicle *car, uint32 doorNode)
m_pMyVehicle = car; m_pMyVehicle = car;
m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle); m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle);
// m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); // m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget);
m_vehEnterType = doorNode; m_vehDoor = doorNode;
m_distanceToCountSeekDone = 0.5f; m_distanceToCountSeekDone = 0.5f;
SetPedState(PED_SEEK_CAR); SetPedState(PED_SEEK_CAR);
@ -6649,9 +6649,9 @@ CPed::SeekCar(void)
} }
if (m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER) { if (m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
if (m_vehEnterType && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) { if (m_vehDoor && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) {
if (IsRoomToBeCarJacked()) { if (IsRoomToBeCarJacked()) {
dest = GetPositionToOpenCarDoor(vehToSeek, m_vehEnterType); dest = GetPositionToOpenCarDoor(vehToSeek, m_vehDoor);
} else if (m_nPedType == PEDTYPE_COP) { } else if (m_nPedType == PEDTYPE_COP) {
dest = GetPositionToOpenCarDoor(vehToSeek, CAR_DOOR_RF); dest = GetPositionToOpenCarDoor(vehToSeek, CAR_DOOR_RF);
} else { } else {
@ -6660,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;
} }
@ -6704,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();
@ -6736,7 +6736,7 @@ CPed::SeekCar(void)
else if (2.0f * vehToSeek->GetColModel()->boundingBox.max.x > distToDestSqr) else if (2.0f * vehToSeek->GetColModel()->boundingBox.max.x > distToDestSqr)
bCanPedEnterSeekedCar = true; bCanPedEnterSeekedCar = true;
if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehEnterType)) if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehDoor))
bVehEnterDoorIsBlocked = true; bVehEnterDoorIsBlocked = true;
else else
bVehEnterDoorIsBlocked = false; bVehEnterDoorIsBlocked = false;
@ -6746,7 +6746,7 @@ CPed::SeekCar(void)
if (!foundBetterPosToSeek) { if (!foundBetterPosToSeek) {
if (1.5f + GetPosition().z > dest.z && GetPosition().z - 0.5f < dest.z) { if (1.5f + GetPosition().z > dest.z && GetPosition().z - 0.5f < dest.z) {
if (vehToSeek->IsTrain()) { if (vehToSeek->IsTrain()) {
SetEnterTrain(vehToSeek, m_vehEnterType); SetEnterTrain(vehToSeek, m_vehDoor);
} else { } else {
m_fRotationCur = m_fRotationDest; m_fRotationCur = m_fRotationDest;
if (!bVehEnterDoorIsBlocked) { if (!bVehEnterDoorIsBlocked) {
@ -6764,24 +6764,24 @@ CPed::SeekCar(void)
case STATUS_PHYSICS: case STATUS_PHYSICS:
case STATUS_PLAYER_DISABLED: case STATUS_PLAYER_DISABLED:
if (!vehToSeek->bIsBus && (!m_leader || m_leader != vehToSeek->pDriver) && if (!vehToSeek->bIsBus && (!m_leader || m_leader != vehToSeek->pDriver) &&
(m_vehEnterType == CAR_DOOR_LF && vehToSeek->pDriver || m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehEnterType == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehEnterType == CAR_DOOR_RR && vehToSeek->pPassengers[2])) { (m_vehDoor == CAR_DOOR_LF && vehToSeek->pDriver || m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehDoor == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehDoor == CAR_DOOR_RR && vehToSeek->pPassengers[2])) {
SetCarJack(vehToSeek); SetCarJack(vehToSeek);
if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehEnterType != CAR_DOOR_LF) if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehDoor != CAR_DOOR_LF)
vehToSeek->pDriver->bFleeAfterExitingCar = true; vehToSeek->pDriver->bFleeAfterExitingCar = true;
} else { } else {
SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehDoor);
} }
break; break;
case STATUS_ABANDONED: case STATUS_ABANDONED:
if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) { if (m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0]) {
if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) { if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) {
if (IsPlayer()) if (IsPlayer())
SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehDoor);
} else { } else {
SetCarJack(vehToSeek); SetCarJack(vehToSeek);
} }
} else { } else {
SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehDoor);
} }
break; break;
case STATUS_WRECKED: case STATUS_WRECKED:
@ -7039,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;
@ -7149,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;
@ -7225,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:
@ -7254,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:
@ -7675,14 +7675,14 @@ CPed::SetSolicit(uint32 time)
if (CharCreatedBy != MISSION_CHAR && m_carInObjective->m_nNumGettingIn == 0 if (CharCreatedBy != MISSION_CHAR && m_carInObjective->m_nNumGettingIn == 0
&& CTimer::GetTimeInMilliseconds() < m_objectiveTimer) { && CTimer::GetTimeInMilliseconds() < m_objectiveTimer) {
if (m_vehEnterType == CAR_DOOR_LF) { if (m_vehDoor == CAR_DOOR_LF) {
m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI; m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI;
} else { } else {
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() + 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);
@ -7695,8 +7695,8 @@ 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_vehEnterType, 0.0f); CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor, 0.0f);
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
// Game uses GetAngleBetweenPoints and converts it to radian // Game uses GetAngleBetweenPoints and converts it to radian
@ -7759,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);
} }
} }
@ -7826,7 +7826,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
bool canHeadToRf = NTVF_RF <= 0.0f || NTVF_RF >= HALFPI; bool canHeadToRf = NTVF_RF <= 0.0f || NTVF_RF >= HALFPI;
// Only order of conditions are different among enterTypes. // Only order of conditions are different among enterTypes.
if (m_vehEnterType == CAR_DOOR_RR) { if (m_vehDoor == CAR_DOOR_RR) {
if (canHeadToRr) { if (canHeadToRr) {
foundPos = rightRearPos; foundPos = rightRearPos;
foundIt = true; foundIt = true;
@ -7840,7 +7840,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
foundPos = leftFrontPos; foundPos = leftFrontPos;
foundIt = true; foundIt = true;
} }
} else if(m_vehEnterType == CAR_DOOR_RF) { } else if(m_vehDoor == CAR_DOOR_RF) {
if (canHeadToRf) { if (canHeadToRf) {
foundPos = rightFrontPos; foundPos = rightFrontPos;
foundIt = true; foundIt = true;
@ -7854,7 +7854,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
foundPos = leftRearPos; foundPos = leftRearPos;
foundIt = true; foundIt = true;
} }
} else if (m_vehEnterType == CAR_DOOR_LF) { } else if (m_vehDoor == CAR_DOOR_LF) {
if (canHeadToLf) { if (canHeadToLf) {
foundPos = leftFrontPos; foundPos = leftFrontPos;
foundIt = true; foundIt = true;
@ -7868,7 +7868,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
foundPos = rightRearPos; foundPos = rightRearPos;
foundIt = true; foundIt = true;
} }
} else if (m_vehEnterType == CAR_DOOR_LR) { } else if (m_vehDoor == CAR_DOOR_LR) {
if (canHeadToLr) { if (canHeadToLr) {
foundPos = leftRearPos; foundPos = leftRearPos;
foundIt = true; foundIt = true;

View file

@ -443,7 +443,7 @@ public:
float m_fRotationCur; float m_fRotationCur;
float m_fRotationDest; float m_fRotationDest;
float m_headingRate; float m_headingRate;
uint16 m_vehEnterType; uint16 m_vehDoor;
int16 m_walkAroundType; int16 m_walkAroundType;
CPhysical *m_pCurrentPhysSurface; CPhysical *m_pCurrentPhysSurface;
CVector m_vecOffsetFromPhysSurface; CVector m_vecOffsetFromPhysSurface;
@ -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

@ -1038,19 +1038,19 @@ CPed::ProcessObjective(void)
if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) { if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) {
GoToNearestDoor(vehOfTarget); GoToNearestDoor(vehOfTarget);
} else { } else {
m_vehEnterType = 0; m_vehDoor = 0;
if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) { if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) {
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
} else if (m_pedInObjective == vehOfTarget->pPassengers[0]) { } else if (m_pedInObjective == vehOfTarget->pPassengers[0]) {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
} else if (m_pedInObjective == vehOfTarget->pPassengers[1]) { } else if (m_pedInObjective == vehOfTarget->pPassengers[1]) {
m_vehEnterType = CAR_DOOR_LR; m_vehDoor = CAR_DOOR_LR;
} else if (m_pedInObjective == vehOfTarget->pPassengers[2]) { } else if (m_pedInObjective == vehOfTarget->pPassengers[2]) {
m_vehEnterType = CAR_DOOR_RR; m_vehDoor = CAR_DOOR_RR;
} }
// Unused // Unused
// GetPositionToOpenCarDoor(vehOfTarget, m_vehEnterType); // GetPositionToOpenCarDoor(vehOfTarget, m_vehDoor);
SetSeekCar(vehOfTarget, m_vehEnterType); SetSeekCar(vehOfTarget, m_vehDoor);
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
} }
} }
@ -1381,26 +1381,26 @@ CPed::ProcessObjective(void)
if (m_carInObjective->pPassengers[2] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RR) { if (m_carInObjective->pPassengers[2] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RR) {
foundSeat = false; foundSeat = false;
} else { } else {
m_vehEnterType = CAR_DOOR_RR; m_vehDoor = CAR_DOOR_RR;
foundSeat = true; foundSeat = true;
} }
} else { } else {
m_vehEnterType = CAR_DOOR_LR; m_vehDoor = CAR_DOOR_LR;
foundSeat = true; foundSeat = true;
} }
} else { } else {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
foundSeat = true; foundSeat = true;
} }
for (int i = 2; i < m_carInObjective->m_nNumMaxPassengers; ++i) { for (int i = 2; i < m_carInObjective->m_nNumMaxPassengers; ++i) {
if (!m_carInObjective->pPassengers[i] && !(m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { if (!m_carInObjective->pPassengers[i] && !(m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RF)) {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
foundSeat = true; foundSeat = true;
} }
} }
if (foundSeat) { if (foundSeat) {
SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType)); SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor));
SetEnterCar(m_carInObjective, m_vehEnterType); SetEnterCar(m_carInObjective, m_vehDoor);
} }
} }
m_objectiveTimer = 0; m_objectiveTimer = 0;
@ -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();
@ -2228,7 +2228,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
eDoors enterDoor; eDoors enterDoor;
AnimationId enterAnim; AnimationId enterAnim;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
itsVan = false; itsVan = false;
enterDoor = DOOR_FRONT_RIGHT; enterDoor = DOOR_FRONT_RIGHT;
@ -2305,7 +2305,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_QJACK); ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_QJACK);
ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped);
veh->pDriver->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, true); veh->pDriver->SetBeingDraggedFromCar(veh, ped->m_vehDoor, true);
if (veh->pDriver->IsGangMember()) if (veh->pDriver->IsGangMember())
veh->pDriver->RegisterThreatWithGangPeds(ped); veh->pDriver->RegisterThreatWithGangPeds(ped);
@ -2351,7 +2351,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
eDoors door; eDoors door;
CPed *pedInSeat = nil; CPed *pedInSeat = nil;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; pedInSeat = veh->pPassengers[0]; break; case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; pedInSeat = veh->pPassengers[0]; break;
case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; pedInSeat = veh->pPassengers[2]; break; case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; pedInSeat = veh->pPassengers[2]; break;
case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; pedInSeat = veh->pDriver; break; case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; pedInSeat = veh->pDriver; break;
@ -2392,21 +2392,21 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) { if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) {
ped->QuitEnteringCar(); ped->QuitEnteringCar();
if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR)
ped->SetFall(1000, ANIM_KO_SPIN_R, false); ped->SetFall(1000, ANIM_KO_SPIN_R, false);
else else
ped->SetFall(1000, ANIM_KO_SPIN_L, false); ped->SetFall(1000, ANIM_KO_SPIN_L, false);
return; return;
} }
veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_OPEN_LHS, 1.0f); veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_OPEN_LHS, 1.0f);
if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_RF) if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_RF)
isVan = false; isVan = false;
if (ped->m_nPedState != PED_CARJACK || isBus) { if (ped->m_nPedState != PED_CARJACK || isBus) {
AnimationId animToPlay; AnimationId animToPlay;
if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) { if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR) {
if (isVan) { if (isVan) {
animToPlay = ANIM_VAN_GETIN; animToPlay = ANIM_VAN_GETIN;
@ -2430,7 +2430,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped);
} else { } else {
CPed *pedToDragOut = nil; CPed *pedToDragOut = nil;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: pedToDragOut = veh->pPassengers[0]; break; case CAR_DOOR_RF: pedToDragOut = veh->pPassengers[0]; break;
case CAR_DOOR_RR: pedToDragOut = veh->pPassengers[2]; break; case CAR_DOOR_RR: pedToDragOut = veh->pPassengers[2]; break;
case CAR_DOOR_LF: pedToDragOut = veh->pDriver; break; case CAR_DOOR_LF: pedToDragOut = veh->pDriver; break;
@ -2444,7 +2444,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
((CCopPed*)ped)->SetArrestPlayer(ped->m_pedInObjective); ((CCopPed*)ped)->SetArrestPlayer(ped->m_pedInObjective);
} }
if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) { if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR) {
if (pedToDragOut && !pedToDragOut->bDontDragMeOutCar) { if (pedToDragOut && !pedToDragOut->bDontDragMeOutCar) {
if (pedToDragOut->m_nPedState != PED_DRIVING) { if (pedToDragOut->m_nPedState != PED_DRIVING) {
ped->QuitEnteringCar(); ped->QuitEnteringCar();
@ -2500,7 +2500,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
} }
if (pedToDragOut) { if (pedToDragOut) {
pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, false); pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehDoor, false);
if (pedToDragOut->IsGangMember()) if (pedToDragOut->IsGangMember())
pedToDragOut->RegisterThreatWithGangPeds(ped); pedToDragOut->RegisterThreatWithGangPeds(ped);
} }
@ -2575,7 +2575,7 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
AnimationId animToPlay; AnimationId animToPlay;
if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) { if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR) {
if (isLow) if (isLow)
animToPlay = ANIM_CAR_GETIN_LOW_RHS; animToPlay = ANIM_CAR_GETIN_LOW_RHS;
else else
@ -2628,7 +2628,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
return; return;
} }
if (ped->IsPlayer() && ped->m_vehEnterType == CAR_DOOR_LF if (ped->IsPlayer() && ped->m_vehDoor == CAR_DOOR_LF
&& (Pads[0].GetAccelerate() >= 255.0f || Pads[0].GetBrake() >= 255.0f) && (Pads[0].GetAccelerate() >= 255.0f || Pads[0].GetBrake() >= 255.0f)
&& veh->IsCar()) { && veh->IsCar()) {
if (((CAutomobile*)veh)->Damage.GetDoorStatus(DOOR_FRONT_LEFT) != DOOR_STATUS_MISSING) if (((CAutomobile*)veh)->Damage.GetDoorStatus(DOOR_FRONT_LEFT) != DOOR_STATUS_MISSING)
@ -2641,7 +2641,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
bool isBus = !!veh->bIsBus; bool isBus = !!veh->bIsBus;
bool isLow = !!veh->bLowVehicle; bool isLow = !!veh->bLowVehicle;
eDoors enterDoor; eDoors enterDoor;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
isVan = false; isVan = false;
enterDoor = DOOR_FRONT_RIGHT; enterDoor = DOOR_FRONT_RIGHT;
@ -2682,7 +2682,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 400; ped->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 400;
return; return;
} }
if (driver != ped && ped->m_vehEnterType != CAR_DOOR_LF) { if (driver != ped && ped->m_vehDoor != CAR_DOOR_LF) {
if (!driver->IsPlayer()) { if (!driver->IsPlayer()) {
driver->bUsePedNodeSeek = true; driver->bUsePedNodeSeek = true;
driver->m_pLastPathNode = nil; driver->m_pLastPathNode = nil;
@ -2749,10 +2749,10 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
bool isLow = !!veh->bLowVehicle; bool isLow = !!veh->bLowVehicle;
if (!veh->bIsBus) if (!veh->bIsBus)
veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_CLOSEDOOR_LHS, 1.0f); veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_CLOSEDOOR_LHS, 1.0f);
eDoors door; eDoors door;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break; case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break;
case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break; case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break;
case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break; case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break;
@ -2765,7 +2765,7 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
if (door == DOOR_FRONT_LEFT || ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || veh->bIsBus) { if (door == DOOR_FRONT_LEFT || ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || veh->bIsBus) {
PedSetInCarCB(nil, ped); PedSetInCarCB(nil, ped);
} else if (ped->m_vehEnterType == CAR_DOOR_RF } else if (ped->m_vehDoor == 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_CAR (veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR
@ -2902,7 +2902,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
veh->m_vecMoveSpeed += CVector(0.001f, 0.001f, 0.001f); veh->m_vecMoveSpeed += CVector(0.001f, 0.001f, 0.001f);
veh->m_vecTurnSpeed += CVector(0.001f, 0.001f, 0.001f); veh->m_vecTurnSpeed += CVector(0.001f, 0.001f, 0.001f);
if (!veh->bIsBus) if (!veh->bIsBus)
veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_GETOUT_LHS, 1.0f); veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_GETOUT_LHS, 1.0f);
/* /*
// Duplicate and only in PC for some reason // Duplicate and only in PC for some reason
@ -2912,7 +2912,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
} }
*/ */
eDoors door; eDoors door;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
door = DOOR_FRONT_RIGHT; door = DOOR_FRONT_RIGHT;
break; break;
@ -3052,7 +3052,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
if (veh->GetUp().z <= -0.8f) if (veh->GetUp().z <= -0.8f)
vehIsUpsideDown = true; vehIsUpsideDown = true;
if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) {
if (vehIsUpsideDown) { if (vehIsUpsideDown) {
m_fRotationDest = -PI + veh->GetForward().Heading(); m_fRotationDest = -PI + veh->GetForward().Heading();
} else if (veh->bIsBus) { } else if (veh->bIsBus) {
@ -3060,7 +3060,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
} else { } else {
m_fRotationDest = veh->GetForward().Heading(); m_fRotationDest = veh->GetForward().Heading();
} }
} else if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { } else if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) {
if (vehIsUpsideDown) { if (vehIsUpsideDown) {
m_fRotationDest = veh->GetForward().Heading(); m_fRotationDest = veh->GetForward().Heading();
} else if (veh->bIsBus) { } else if (veh->bIsBus) {
@ -3163,7 +3163,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
if (phase == LINE_UP_TO_CAR_2) { if (phase == LINE_UP_TO_CAR_2) {
neededPos = GetPosition(); neededPos = GetPosition();
} else { } else {
neededPos = GetPositionToOpenCarDoor(veh, m_vehEnterType, seatPosMult); neededPos = GetPositionToOpenCarDoor(veh, m_vehDoor, seatPosMult);
} }
CVector autoZPos = neededPos; CVector autoZPos = neededPos;
@ -3273,7 +3273,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
SetHeading(m_fRotationCur); SetHeading(m_fRotationCur);
} else { } else {
CMatrix vehDoorMat(veh->GetMatrix()); CMatrix vehDoorMat(veh->GetMatrix());
vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, GetLocalPositionToOpenCarDoor(veh, m_vehEnterType, 0.0f)); vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, GetLocalPositionToOpenCarDoor(veh, m_vehDoor, 0.0f));
// VC couch anims are inverted, so they're fixing it here. // VC couch anims are inverted, so they're fixing it here.
GetMatrix() = vehDoorMat; GetMatrix() = vehDoorMat;
} }
@ -3290,7 +3290,7 @@ CPed::SetCarJack(CVehicle* car)
if (car->IsBoat()) if (car->IsBoat())
return; return;
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
doorFlag = CAR_DOOR_FLAG_RF; doorFlag = CAR_DOOR_FLAG_RF;
door = DOOR_FRONT_RIGHT; door = DOOR_FRONT_RIGHT;
@ -3329,7 +3329,7 @@ CPed::SetCarJack(CVehicle* car)
if (m_nPedState != PED_CARJACK && !m_pVehicleAnim) if (m_nPedState != PED_CARJACK && !m_pVehicleAnim)
if ((car->IsDoorReady(door) || car->IsDoorFullyOpen(door))) if ((car->IsDoorReady(door) || car->IsDoorFullyOpen(door)))
if (!car->bIsBeingCarJacked && !(doorFlag & car->m_nGettingInFlags) && !(doorFlag & car->m_nGettingOutFlags)) if (!car->bIsBeingCarJacked && !(doorFlag & car->m_nGettingInFlags) && !(doorFlag & car->m_nGettingOutFlags))
SetCarJack_AllClear(car, m_vehEnterType, doorFlag); SetCarJack_AllClear(car, m_vehDoor, doorFlag);
} }
void void
@ -3349,7 +3349,7 @@ CPed::SetCarJack_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
Say(m_nPedType == PEDTYPE_COP ? SOUND_PED_ARREST_COP : SOUND_PED_CAR_JACKING); Say(m_nPedType == PEDTYPE_COP ? SOUND_PED_ARREST_COP : SOUND_PED_CAR_JACKING);
CVector carEnterPos; CVector carEnterPos;
carEnterPos = GetPositionToOpenCarDoor(car, m_vehEnterType); carEnterPos = GetPositionToOpenCarDoor(car, m_vehDoor);
car->m_nGettingInFlags |= doorFlag; car->m_nGettingInFlags |= doorFlag;
m_vecOffsetSeek = carEnterPos - GetPosition(); m_vecOffsetSeek = carEnterPos - GetPosition();
@ -3357,7 +3357,7 @@ CPed::SetCarJack_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
float zDiff = Max(0.0f, carEnterPos.z - GetPosition().z); float zDiff = Max(0.0f, carEnterPos.z - GetPosition().z);
bUsesCollision = false; bUsesCollision = false;
if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f);
else else
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f);
@ -3377,8 +3377,8 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack)
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
m_pSeekTarget = veh; m_pSeekTarget = veh;
m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget); m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget);
m_vehEnterType = vehEnterType; m_vehDoor = vehEnterType;
if (m_vehEnterType == CAR_DOOR_LF) { if (m_vehDoor == CAR_DOOR_LF) {
if (veh->pDriver && veh->pDriver->IsPlayer()) if (veh->pDriver && veh->pDriver->IsPlayer())
veh->SetStatus(STATUS_PLAYER_DISABLED); veh->SetStatus(STATUS_PLAYER_DISABLED);
else else
@ -3396,7 +3396,7 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack)
Say(SOUND_PED_CAR_JACKED); Say(SOUND_PED_CAR_JACKED);
SetRadioStation(); SetRadioStation();
veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehEnterType); veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehDoor);
} }
void void
@ -3421,7 +3421,7 @@ CPed::BeingDraggedFromCar(void)
if (animAssoc) if (animAssoc)
animAssoc->blendDelta = -1000.0f; animAssoc->blendDelta = -1000.0f;
if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) {
if (bWillBeQuickJacked) { if (bWillBeQuickJacked) {
enterAnim = ANIM_CAR_QJACKED; enterAnim = ANIM_CAR_QJACKED;
} else if (m_pMyVehicle->bLowVehicle) { } else if (m_pMyVehicle->bLowVehicle) {
@ -3429,7 +3429,7 @@ CPed::BeingDraggedFromCar(void)
} else { } else {
enterAnim = ANIM_CAR_JACKED_LHS; enterAnim = ANIM_CAR_JACKED_LHS;
} }
} else if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { } else if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) {
if (m_pMyVehicle->bLowVehicle) if (m_pMyVehicle->bLowVehicle)
enterAnim = ANIM_CAR_LJACKED_RHS; enterAnim = ANIM_CAR_LJACKED_RHS;
else else
@ -3454,7 +3454,7 @@ CPed::BeingDraggedFromCar(void)
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
if (m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) { if (m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) {
if (m_pMyVehicle) { if (m_pMyVehicle) {
m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, NUM_ANIMS, m_pVehicleAnim->currentTime * 5.0f); m_pMyVehicle->ProcessOpenDoor(m_vehDoor, NUM_ANIMS, m_pVehicleAnim->currentTime * 5.0f);
} }
} }
#endif #endif
@ -3469,7 +3469,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused)
} else { } else {
uint8 doorFlag; uint8 doorFlag;
eDoors door; eDoors door;
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
doorFlag = CAR_DOOR_FLAG_RF; doorFlag = CAR_DOOR_FLAG_RF;
door = DOOR_FRONT_RIGHT; door = DOOR_FRONT_RIGHT;
@ -3496,7 +3496,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused)
|| doorFlag && !car->IsDoorReady(door) && !car->IsDoorFullyOpen(door)) || doorFlag && !car->IsDoorReady(door) && !car->IsDoorFullyOpen(door))
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
else else
SetEnterCar_AllClear(car, m_vehEnterType, doorFlag); SetEnterCar_AllClear(car, m_vehDoor, doorFlag);
} }
} }
@ -3512,9 +3512,9 @@ 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_vehDoor = doorNode;
SetPedState(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_vehDoor == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && car->m_vehType != VEHICLE_TYPE_BIKE) {
car->bIsBeingCarJacked = true; car->bIsBeingCarJacked = true;
} }
@ -3522,7 +3522,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle); m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle);
((CVehicle*)m_pSeekTarget)->m_nNumGettingIn++; ((CVehicle*)m_pSeekTarget)->m_nNumGettingIn++;
bUsesCollision = false; bUsesCollision = false;
CVector doorOpenPos = GetPositionToOpenCarDoor(car, m_vehEnterType); CVector doorOpenPos = GetPositionToOpenCarDoor(car, m_vehDoor);
// Because buses have stairs // Because buses have stairs
if (!m_pMyVehicle->bIsBus) if (!m_pMyVehicle->bIsBus)
@ -3554,13 +3554,13 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
CWaterLevel::AllocateBoatWakeArray(); CWaterLevel::AllocateBoatWakeArray();
} else { } else {
if (zDiff > 4.4f) { if (zDiff > 4.4f) {
if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGNHI_RHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGNHI_RHS, 4.0f);
else else
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGNHI_LHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGNHI_LHS, 4.0f);
} else { } else {
if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGN_RHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGN_RHS, 4.0f);
else else
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGN_LHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ALIGN_LHS, 4.0f);
@ -3577,11 +3577,11 @@ CPed::EnterCar(void)
CVehicle *veh = (CVehicle*)m_pSeekTarget; CVehicle *veh = (CVehicle*)m_pSeekTarget;
// Not used. // Not used.
// CVector posForDoor = GetPositionToOpenCarDoor(veh, m_vehEnterType); // CVector posForDoor = GetPositionToOpenCarDoor(veh, m_vehDoor);
if (veh->CanPedOpenLocks(this)) { if (veh->CanPedOpenLocks(this)) {
if (m_vehEnterType && m_pVehicleAnim) { if (m_vehDoor && m_pVehicleAnim) {
veh->ProcessOpenDoor(m_vehEnterType, m_pVehicleAnim->animId, m_pVehicleAnim->currentTime); veh->ProcessOpenDoor(m_vehDoor, m_pVehicleAnim->animId, m_pVehicleAnim->currentTime);
} }
} }
bIsInTheAir = false; bIsInTheAir = false;
@ -3616,7 +3616,7 @@ CPed::QuitEnteringCar(void)
RestorePreviousObjective(); RestorePreviousObjective();
#endif #endif
veh->m_nGettingInFlags &= ~GetCarDoorFlag(m_vehEnterType); veh->m_nGettingInFlags &= ~GetCarDoorFlag(m_vehDoor);
} }
bUsesCollision = true; bUsesCollision = true;
@ -3681,10 +3681,10 @@ CPed::SetExitBoat(CVehicle *boat)
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_vehDoor = CAR_DOOR_RF;
SetPedState(PED_EXIT_CAR); SetPedState(PED_EXIT_CAR);
} else { } else {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
bIsStanding = true; bIsStanding = true;
m_pCurSurface = boat; m_pCurSurface = boat;
@ -3703,7 +3703,7 @@ CPed::SetExitBoat(CVehicle *boat)
newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z }; newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z };
newPos = boat->GetMatrix() * newPos; newPos = boat->GetMatrix() * newPos;
newPos.z += 1.0f; newPos.z += 1.0f;
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
bIsStanding = true; bIsStanding = true;
m_pCurSurface = boat; m_pCurSurface = boat;
@ -3714,7 +3714,7 @@ CPed::SetExitBoat(CVehicle *boat)
if (boat->m_modelIndex == MI_SKIMMER) if (boat->m_modelIndex == MI_SKIMMER)
newPos.z += 2.0f newPos.z += 2.0f
*/ */
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
bIsStanding = true; bIsStanding = true;
m_pCurSurface = boat; m_pCurSurface = boat;
@ -3726,7 +3726,7 @@ CPed::SetExitBoat(CVehicle *boat)
newPos.z = FEET_OFFSET + foundCol.point.z; newPos.z = FEET_OFFSET + foundCol.point.z;
/* // VC specific /* // VC specific
} else { } else {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
bIsStanding = true; bIsStanding = true;
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
@ -3921,7 +3921,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
bUsesCollision = false; bUsesCollision = false;
m_pSeekTarget = veh; m_pSeekTarget = veh;
m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget);
m_vehEnterType = optedDoorNode; m_vehDoor = optedDoorNode;
SetPedState(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;
@ -3963,7 +3963,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
if (veh->GetModelIndex() == MI_YARDIE) if (veh->GetModelIndex() == MI_YARDIE)
addDoorSmoke = true; addDoorSmoke = true;
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
if (veh->bIsBus) { if (veh->bIsBus) {
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_COACH_OUT_L); m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_COACH_OUT_L);
@ -4012,7 +4012,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
break; break;
} }
if (!bBusJacked) { if (!bBusJacked) {
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
veh->m_nGettingOutFlags |= CAR_DOOR_FLAG_RF; veh->m_nGettingOutFlags |= CAR_DOOR_FLAG_RF;
break; break;
@ -4031,9 +4031,9 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
} }
m_pVehicleAnim->SetFinishCallback(PedAnimStepOutCarCB, this); m_pVehicleAnim->SetFinishCallback(PedAnimStepOutCarCB, this);
} else { } else {
if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) {
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS2); m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS2);
} else if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { } else if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) {
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS); m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS);
} }
m_pVehicleAnim->SetFinishCallback(PedSetOutCarCB, this); m_pVehicleAnim->SetFinishCallback(PedSetOutCarCB, this);
@ -4062,7 +4062,7 @@ CPed::ExitCar(void)
AnimationId exitAnim = (AnimationId) m_pVehicleAnim->animId; AnimationId exitAnim = (AnimationId) m_pVehicleAnim->animId;
float animTime = m_pVehicleAnim->currentTime; float animTime = m_pVehicleAnim->currentTime;
m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, exitAnim, animTime); m_pMyVehicle->ProcessOpenDoor(m_vehDoor, exitAnim, animTime);
if (m_pSeekTarget) { if (m_pSeekTarget) {
// Car is upside down // Car is upside down
@ -4123,10 +4123,10 @@ void
CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen) CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen)
{ {
CVector *enterOffset = nil; CVector *enterOffset = nil;
if (m_vehEnterType == CAR_DOOR_LF && veh->pDriver if (m_vehDoor == CAR_DOOR_LF && veh->pDriver
|| m_vehEnterType == CAR_DOOR_RF && veh->pPassengers[0] || m_vehDoor == CAR_DOOR_RF && veh->pPassengers[0]
|| m_vehEnterType == CAR_DOOR_LR && veh->pPassengers[1] || m_vehDoor == CAR_DOOR_LR && veh->pPassengers[1]
|| m_vehEnterType == CAR_DOOR_RR && veh->pPassengers[2]) || m_vehDoor == CAR_DOOR_RR && veh->pPassengers[2])
{ {
enterOffset = &vecPedQuickDraggedOutCarAnimOffset; enterOffset = &vecPedQuickDraggedOutCarAnimOffset;
} }
@ -4138,10 +4138,10 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen)
if ((lfPos - GetPosition()).MagnitudeSqr2D() < (rfPos - GetPosition()).MagnitudeSqr2D()) { if ((lfPos - GetPosition()).MagnitudeSqr2D() < (rfPos - GetPosition()).MagnitudeSqr2D()) {
if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) {
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
posToOpen = lfPos; posToOpen = lfPos;
} else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_RF, enterOffset)) { } else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_RF, enterOffset)) {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
posToOpen = rfPos; posToOpen = rfPos;
} }
} else { } else {
@ -4154,14 +4154,14 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen)
&& veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)
|| (veh->m_nGettingInFlags & CAR_DOOR_FLAG_RF) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { || (veh->m_nGettingInFlags & CAR_DOOR_FLAG_RF) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) {
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
posToOpen = lfPos; posToOpen = lfPos;
} else { } else {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
posToOpen = rfPos; posToOpen = rfPos;
} }
} else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { } else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) {
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
posToOpen = lfPos; posToOpen = lfPos;
} }
} }
@ -4177,7 +4177,7 @@ CPed::GetNearestPassengerDoor(CVehicle *veh, CVector &posToOpen)
switch (veh->GetModelIndex()) { switch (veh->GetModelIndex()) {
case MI_BUS: case MI_BUS:
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
posToOpen = GetPositionToOpenCarDoor(veh, CAR_DOOR_RF); posToOpen = GetPositionToOpenCarDoor(veh, CAR_DOOR_RF);
return true; return true;
case MI_RHINO: case MI_RHINO:
@ -4220,15 +4220,15 @@ CPed::GetNearestPassengerDoor(CVehicle *veh, CVector &posToOpen)
CVector2D nextToCompare = rfPosDist; CVector2D nextToCompare = rfPosDist;
posToOpen = rfPos; posToOpen = rfPos;
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
if (lrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) { if (lrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) {
m_vehEnterType = CAR_DOOR_LR; m_vehDoor = CAR_DOOR_LR;
posToOpen = lrPos; posToOpen = lrPos;
nextToCompare = lrPosDist; nextToCompare = lrPosDist;
} }
if (rrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) { if (rrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) {
m_vehEnterType = CAR_DOOR_RR; m_vehDoor = CAR_DOOR_RR;
posToOpen = rrPos; posToOpen = rrPos;
} }
return canEnter; return canEnter;
@ -4335,7 +4335,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void
ped->bUsesCollision = true; ped->bUsesCollision = true;
ped->RestartNonPartialAnims(); ped->RestartNonPartialAnims();
draggedOutOffset = vecPedQuickDraggedOutCarAnimOffset; draggedOutOffset = vecPedQuickDraggedOutCarAnimOffset;
if (ped->m_vehEnterType == CAR_DOOR_RF || ped->m_vehEnterType == CAR_DOOR_RR) if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR)
draggedOutOffset.x = -draggedOutOffset.x; draggedOutOffset.x = -draggedOutOffset.x;
finalPos = Multiply3x3(pedMat, draggedOutOffset) + ped->GetPosition(); finalPos = Multiply3x3(pedMat, draggedOutOffset) + ped->GetPosition();
@ -4348,7 +4348,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void
ped->m_fRotationCur = ped->m_fRotationDest; ped->m_fRotationCur = ped->m_fRotationDest;
ped->CalculateNewOrientation(); ped->CalculateNewOrientation();
if (!veh->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedQuickDraggedOutCarAnimOffset)) if (!veh->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedQuickDraggedOutCarAnimOffset))
ped->PositionPedOutOfCollision(); ped->PositionPedOutOfCollision();
} }
@ -4425,7 +4425,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
ped->RestartNonPartialAnims(); ped->RestartNonPartialAnims();
bool itsRearDoor = false; bool itsRearDoor = false;
if (ped->m_vehEnterType == CAR_DOOR_RF || ped->m_vehEnterType == CAR_DOOR_RR) if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR)
itsRearDoor = true; itsRearDoor = true;
CMatrix pedMat(ped->GetMatrix()); CMatrix pedMat(ped->GetMatrix());
@ -4438,7 +4438,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
ped->SetPosition(posAfterBeingDragged); ped->SetPosition(posAfterBeingDragged);
if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedDraggedOutCarAnimOffset)) { if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedDraggedOutCarAnimOffset)) {
ped->PositionPedOutOfCollision(); ped->PositionPedOutOfCollision();
} }
@ -4516,7 +4516,7 @@ CPed::GetNearestTrainDoor(CVehicle *train, CVector &doorPos)
CVehicleModelInfo* trainModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(train->m_modelIndex); CVehicleModelInfo* trainModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(train->m_modelIndex);
CMatrix trainMat = CMatrix(train->GetMatrix()); CMatrix trainMat = CMatrix(train->GetMatrix());
doorPos = trainModel->m_positions[m_vehEnterType]; doorPos = trainModel->m_positions[m_vehDoor];
doorPos.x -= 1.5f; doorPos.x -= 1.5f;
doorPos = Multiply3x3(trainMat, doorPos); doorPos = Multiply3x3(trainMat, doorPos);
doorPos += train->GetPosition(); doorPos += train->GetPosition();
@ -4566,17 +4566,17 @@ CPed::GetNearestTrainPedPosition(CVehicle *train, CVector &enterPos)
if (distMidEntry < distLeftEntry) { if (distMidEntry < distLeftEntry) {
if (distMidEntry < distRightEntry) { if (distMidEntry < distRightEntry) {
enterPos = midEntryPos; enterPos = midEntryPos;
m_vehEnterType = TRAIN_POS_MID_ENTRY; m_vehDoor = TRAIN_POS_MID_ENTRY;
} else { } else {
enterPos = rightEntryPos; enterPos = rightEntryPos;
m_vehEnterType = TRAIN_POS_RIGHT_ENTRY; m_vehDoor = TRAIN_POS_RIGHT_ENTRY;
} }
} else if (distRightEntry < distLeftEntry) { } else if (distRightEntry < distLeftEntry) {
enterPos = rightEntryPos; enterPos = rightEntryPos;
m_vehEnterType = TRAIN_POS_RIGHT_ENTRY; m_vehDoor = TRAIN_POS_RIGHT_ENTRY;
} else { } else {
enterPos = leftEntryPos; enterPos = leftEntryPos;
m_vehEnterType = TRAIN_POS_LEFT_ENTRY; m_vehDoor = TRAIN_POS_LEFT_ENTRY;
} }
return 1; return 1;
@ -5198,7 +5198,7 @@ CPed::SeekBoatPosition(void)
m_vecSeekPos = boatMat * enterOffset; m_vecSeekPos = boatMat * enterOffset;
if (Seek()) { if (Seek()) {
// We arrived to the boat // We arrived to the boat
m_vehEnterType = 0; m_vehDoor = 0;
SetEnterCar(m_carInObjective, 0); SetEnterCar(m_carInObjective, 0);
} }
} else } else

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;

View file

@ -373,7 +373,7 @@ CTrain::TrainHitStuff(CPtrList &list)
void void
CTrain::AddPassenger(CPed *ped) CTrain::AddPassenger(CPed *ped)
{ {
int i = ped->m_vehEnterType; int i = ped->m_vehDoor;
if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){ if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){
pPassengers[i] = ped; pPassengers[i] = ped;
m_nNumPassengers++; m_nNumPassengers++;

View file

@ -794,13 +794,13 @@ CVehicle::ShufflePassengersToMakeSpace(void)
if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) {
pPassengers[2] = pPassengers[1]; pPassengers[2] = pPassengers[1];
pPassengers[1] = nil; pPassengers[1] = nil;
pPassengers[2]->m_vehEnterType = CAR_DOOR_RR; pPassengers[2]->m_vehDoor = CAR_DOOR_RR;
return true; return true;
} }
if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) {
pPassengers[0] = pPassengers[1]; pPassengers[0] = pPassengers[1];
pPassengers[1] = nil; pPassengers[1] = nil;
pPassengers[0]->m_vehEnterType = CAR_DOOR_RF; pPassengers[0]->m_vehDoor = CAR_DOOR_RF;
return true; return true;
} }
return false; return false;
@ -811,13 +811,13 @@ CVehicle::ShufflePassengersToMakeSpace(void)
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[2]; pPassengers[1] = pPassengers[2];
pPassengers[2] = nil; pPassengers[2] = nil;
pPassengers[1]->m_vehEnterType = CAR_DOOR_LR; pPassengers[1]->m_vehDoor = CAR_DOOR_LR;
return true; return true;
} }
if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) {
pPassengers[0] = pPassengers[2]; pPassengers[0] = pPassengers[2];
pPassengers[2] = nil; pPassengers[2] = nil;
pPassengers[0]->m_vehEnterType = CAR_DOOR_RF; pPassengers[0]->m_vehDoor = CAR_DOOR_RF;
return true; return true;
} }
return false; return false;
@ -828,13 +828,13 @@ CVehicle::ShufflePassengersToMakeSpace(void)
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[0]; pPassengers[1] = pPassengers[0];
pPassengers[0] = nil; pPassengers[0] = nil;
pPassengers[1]->m_vehEnterType = CAR_DOOR_LR; pPassengers[1]->m_vehDoor = CAR_DOOR_LR;
return true; return true;
} }
if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) {
pPassengers[2] = pPassengers[0]; pPassengers[2] = pPassengers[0];
pPassengers[0] = nil; pPassengers[0] = nil;
pPassengers[2]->m_vehEnterType = CAR_DOOR_RR; pPassengers[2]->m_vehDoor = CAR_DOOR_RR;
return true; return true;
} }
return false; return false;