A bug fix and VC ports for veh. enter/exit
This commit is contained in:
parent
0e2f7ff689
commit
ce0687db27
@ -718,7 +718,7 @@ CheckForPedsOnGroundToAttack(CPed *attacker, CPed **pedOnGround)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pedOnGround)
|
if (pedOnGround)
|
||||||
* pedOnGround = currentPed;
|
*pedOnGround = currentPed;
|
||||||
|
|
||||||
return stateToReturn;
|
return stateToReturn;
|
||||||
}
|
}
|
||||||
@ -11060,6 +11060,7 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
|
|||||||
int padNo;
|
int padNo;
|
||||||
if (ped->IsPlayer()) {
|
if (ped->IsPlayer()) {
|
||||||
|
|
||||||
|
// BUG? This will cause crash if m_nPedType is bigger then 1, there are only 2 pads
|
||||||
switch (ped->m_nPedType) {
|
switch (ped->m_nPedType) {
|
||||||
case PEDTYPE_PLAYER1:
|
case PEDTYPE_PLAYER1:
|
||||||
padNo = 0;
|
padNo = 0;
|
||||||
@ -11073,9 +11074,6 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
|
|||||||
case PEDTYPE_PLAYER4:
|
case PEDTYPE_PLAYER4:
|
||||||
padNo = 3;
|
padNo = 3;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
// FIX: that was "break"
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
CPad *pad = CPad::GetPad(padNo);
|
CPad *pad = CPad::GetPad(padNo);
|
||||||
|
|
||||||
@ -11175,6 +11173,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
|
|||||||
int padNo;
|
int padNo;
|
||||||
if (ped->IsPlayer()) {
|
if (ped->IsPlayer()) {
|
||||||
|
|
||||||
|
// BUG? This will cause crash if m_nPedType is bigger then 1, there are only 2 pads
|
||||||
switch (ped->m_nPedType) {
|
switch (ped->m_nPedType) {
|
||||||
case PEDTYPE_PLAYER1:
|
case PEDTYPE_PLAYER1:
|
||||||
padNo = 0;
|
padNo = 0;
|
||||||
@ -11188,9 +11187,6 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
|
|||||||
case PEDTYPE_PLAYER4:
|
case PEDTYPE_PLAYER4:
|
||||||
padNo = 3;
|
padNo = 3;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
// FIX: that was "break"
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
CPad* pad = CPad::GetPad(padNo);
|
CPad* pad = CPad::GetPad(padNo);
|
||||||
bool engineIsIntact = false;
|
bool engineIsIntact = false;
|
||||||
@ -11417,6 +11413,34 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
|
|||||||
if (!veh)
|
if (!veh)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef VC_PED_PORTS
|
||||||
|
// Situation of entering car as a driver while there is already a driver exiting atm.
|
||||||
|
CPed *driver = veh->pDriver;
|
||||||
|
if (driver && driver->m_nPedState == PED_DRIVING && !veh->bIsBus && driver->m_objective == OBJECTIVE_LEAVE_VEHICLE
|
||||||
|
&& (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || ped->m_nPedState == PED_CARJACK)) {
|
||||||
|
|
||||||
|
if (!ped->IsPlayer() && (ped->CharCreatedBy != MISSION_CHAR || driver->IsPlayer())) {
|
||||||
|
ped->QuitEnteringCar();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (driver->CharCreatedBy == MISSION_CHAR) {
|
||||||
|
PedSetOutCarCB(nil, veh->pDriver);
|
||||||
|
if (driver->m_pMyVehicle) {
|
||||||
|
driver->PositionPedOutOfCollision();
|
||||||
|
} else {
|
||||||
|
driver->m_pMyVehicle = veh;
|
||||||
|
driver->PositionPedOutOfCollision();
|
||||||
|
driver->m_pMyVehicle = nil;
|
||||||
|
}
|
||||||
|
veh->pDriver = nil;
|
||||||
|
} else {
|
||||||
|
driver->SetDead();
|
||||||
|
driver->FlagToDestroyWhenNextProcessed();
|
||||||
|
veh->pDriver = nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!ped->IsNotInWreckedVehicle() || ped->DyingOrDead())
|
if (!ped->IsNotInWreckedVehicle() || ped->DyingOrDead())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -11446,7 +11470,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
|
|||||||
|
|
||||||
if (veh->IsBoat()) {
|
if (veh->IsBoat()) {
|
||||||
if (ped->IsPlayer()) {
|
if (ped->IsPlayer()) {
|
||||||
#ifdef VC_PED_PORTS
|
#if defined(FIX_BUGS) || defined(VC_PED_PORTS)
|
||||||
CCarCtrl::RegisterVehicleOfInterest(veh);
|
CCarCtrl::RegisterVehicleOfInterest(veh);
|
||||||
#endif
|
#endif
|
||||||
if (veh->m_status == STATUS_SIMPLE) {
|
if (veh->m_status == STATUS_SIMPLE) {
|
||||||
@ -11499,7 +11523,10 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
|
}
|
||||||
|
// This shouldn't happen at all. Passengers can't enter with PED_CARJACK. Even though they did, we shouldn't call AddPassenger in here and SetDriver in below.
|
||||||
|
#ifndef VC_PED_PORTS
|
||||||
|
else if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
|
||||||
if (ped->m_nPedState == PED_CARJACK) {
|
if (ped->m_nPedState == PED_CARJACK) {
|
||||||
veh->AddPassenger(ped, 0);
|
veh->AddPassenger(ped, 0);
|
||||||
ped->m_nPedState = PED_DRIVING;
|
ped->m_nPedState = PED_DRIVING;
|
||||||
@ -11509,6 +11536,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
|
|||||||
veh->AutoPilot.m_nCruiseSpeed = 17;
|
veh->AutoPilot.m_nCruiseSpeed = 17;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || ped->m_nPedState == PED_CARJACK) {
|
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER || ped->m_nPedState == PED_CARJACK) {
|
||||||
veh->SetDriver(ped);
|
veh->SetDriver(ped);
|
||||||
@ -11572,6 +11600,10 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
|
|||||||
ped->m_prevObjective = OBJECTIVE_NONE;
|
ped->m_prevObjective = OBJECTIVE_NONE;
|
||||||
|
|
||||||
ped->RestorePreviousObjective();
|
ped->RestorePreviousObjective();
|
||||||
|
#ifdef VC_PED_PORTS
|
||||||
|
if(veh->pDriver && ped->CharCreatedBy == RANDOM_CHAR)
|
||||||
|
veh->AutoPilot.m_nCruiseSpeed = 17;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
veh->m_nGettingInFlags &= ~GetCarDoorFlag(ped->m_vehEnterType);
|
veh->m_nGettingInFlags &= ~GetCarDoorFlag(ped->m_vehEnterType);
|
||||||
@ -13098,13 +13130,22 @@ CPed::ProcessObjective(void)
|
|||||||
m_objectiveTimer = 0;
|
m_objectiveTimer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// fall through
|
||||||
}
|
}
|
||||||
case OBJECTIVE_ENTER_CAR_AS_DRIVER:
|
case OBJECTIVE_ENTER_CAR_AS_DRIVER:
|
||||||
{
|
{
|
||||||
if (!m_carInObjective || bInVehicle) {
|
if (!m_carInObjective || bInVehicle) {
|
||||||
bObjectiveCompleted = true;
|
#ifdef VC_PED_PORTS
|
||||||
bScriptObjectiveCompleted = true;
|
if (bInVehicle && m_pMyVehicle != m_carInObjective)
|
||||||
RestorePreviousState();
|
{
|
||||||
|
SetExitCar(m_pMyVehicle, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
bObjectiveCompleted = true;
|
||||||
|
bScriptObjectiveCompleted = true;
|
||||||
|
RestorePreviousState();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_leaveCarTimer > CTimer::GetTimeInMilliseconds()) {
|
if (m_leaveCarTimer > CTimer::GetTimeInMilliseconds()) {
|
||||||
SetMoveState(PEDMOVE_STILL);
|
SetMoveState(PEDMOVE_STILL);
|
||||||
|
@ -3885,6 +3885,9 @@ CAutomobile::IsRoomForPedToLeaveCar(uint32 component, CVector *doorOffset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CVector dist = doorPos - seatPos;
|
CVector dist = doorPos - seatPos;
|
||||||
|
|
||||||
|
// Removing that makes this func. return false for van doors.
|
||||||
|
doorPos.z += 0.5f;
|
||||||
float length = dist.Magnitude();
|
float length = dist.Magnitude();
|
||||||
CVector pedPos = seatPos + dist*((length+0.6f)/length);
|
CVector pedPos = seatPos + dist*((length+0.6f)/length);
|
||||||
|
|
||||||
@ -4193,6 +4196,7 @@ GetCurrentAtomicObjectCB(RwObject *object, void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CColPoint aTempPedColPts[32]; // this name doesn't make any sense
|
CColPoint aTempPedColPts[32]; // this name doesn't make any sense
|
||||||
|
// they probably copied it from Ped (both serves same purpose) and didn't change the name
|
||||||
|
|
||||||
CObject*
|
CObject*
|
||||||
CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
|
CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
|
||||||
|
Loading…
Reference in New Issue
Block a user