mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-29 12:04:30 +00:00
some fixes for CPed
This commit is contained in:
parent
1fa0116f5f
commit
f34365dfc0
1 changed files with 97 additions and 8 deletions
|
@ -4645,13 +4645,97 @@ CPed::ExitCar(void)
|
|||
CVector
|
||||
CPed::GetPositionToOpenCarDoor(CVehicle *veh, uint32 component)
|
||||
{
|
||||
CVector vehDoorPos = GetPositionToOpenCarDoor(veh, component, 1.0f);
|
||||
CVector doorPos;
|
||||
CVector vehDoorOffset;
|
||||
CVehicleModelInfo* vehModel = veh->GetModelInfo();
|
||||
|
||||
/*
|
||||
// Unused
|
||||
vehDoorPosWithoutOffset = veh->GetMatrix() * localVehDoorPos;
|
||||
*/
|
||||
return vehDoorPos;
|
||||
if (veh->IsBike()) {
|
||||
CBike* bike = (CBike*)veh;
|
||||
|
||||
if (component == CAR_WINDSCREEN) {
|
||||
doorPos = vehModel->GetFrontSeatPosn();
|
||||
return bike->GetMatrix() * (doorPos +
|
||||
CVector(-vecPedBikeKickAnimOffset.x, vecPedBikeKickAnimOffset.y, -vecPedBikeKickAnimOffset.z));
|
||||
} else {
|
||||
switch (bike->m_bikeAnimType) {
|
||||
case ASSOCGRP_BIKE_VESPA:
|
||||
vehDoorOffset = vecPedVespaBikeJumpRhsAnimOffset;
|
||||
break;
|
||||
case ASSOCGRP_BIKE_HARLEY:
|
||||
vehDoorOffset = vecPedHarleyBikeJumpRhsAnimOffset;
|
||||
break;
|
||||
case ASSOCGRP_BIKE_DIRT:
|
||||
vehDoorOffset = vecPedDirtBikeJumpRhsAnimOffset;
|
||||
break;
|
||||
default:
|
||||
vehDoorOffset = vecPedStdBikeJumpRhsAnimOffset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
doorPos = vehModel->GetFrontSeatPosn();
|
||||
if (component == CAR_DOOR_LR || component == CAR_DOOR_RR) {
|
||||
doorPos = vehModel->m_positions[CAR_POS_BACKSEAT];
|
||||
}
|
||||
|
||||
if (component == CAR_DOOR_LR || component == CAR_DOOR_LF) {
|
||||
vehDoorOffset.x *= -1.f;
|
||||
}
|
||||
|
||||
CVector correctedPos;
|
||||
bike->GetCorrectedWorldDoorPosition(correctedPos, vehDoorOffset, doorPos);
|
||||
return correctedPos;
|
||||
} else {
|
||||
float seatOffset;
|
||||
if (veh->bIsVan && (component == CAR_DOOR_LR || component == CAR_DOOR_RR)) {
|
||||
seatOffset = 0.0f;
|
||||
vehDoorOffset = vecPedVanRearDoorAnimOffset;
|
||||
} else {
|
||||
seatOffset = veh->pHandling->fSeatOffsetDistance;
|
||||
if (veh->bLowVehicle) {
|
||||
vehDoorOffset = vecPedCarDoorLoAnimOffset;
|
||||
} else {
|
||||
vehDoorOffset = vecPedCarDoorAnimOffset;
|
||||
}
|
||||
}
|
||||
|
||||
switch (component) {
|
||||
case CAR_DOOR_RF:
|
||||
doorPos = vehModel->GetFrontSeatPosn();
|
||||
doorPos.x += seatOffset;
|
||||
vehDoorOffset.x = -vehDoorOffset.x;
|
||||
break;
|
||||
|
||||
case CAR_DOOR_RR:
|
||||
doorPos = vehModel->m_positions[CAR_POS_BACKSEAT];
|
||||
doorPos.x += seatOffset;
|
||||
vehDoorOffset.x = -vehDoorOffset.x;
|
||||
break;
|
||||
|
||||
case CAR_DOOR_LF:
|
||||
doorPos = vehModel->GetFrontSeatPosn();
|
||||
doorPos.x += seatOffset;
|
||||
doorPos.x = -doorPos.x;
|
||||
break;
|
||||
|
||||
case CAR_DOOR_LR:
|
||||
doorPos = vehModel->m_positions[CAR_POS_BACKSEAT];
|
||||
doorPos.x += seatOffset;
|
||||
doorPos.x = -doorPos.x;
|
||||
break;
|
||||
|
||||
default:
|
||||
doorPos = vehModel->GetFrontSeatPosn();
|
||||
vehDoorOffset = CVector(0.0f, 0.0f, 0.0f);
|
||||
break;
|
||||
}
|
||||
|
||||
CVector diffVec = doorPos - vehDoorOffset;
|
||||
return Multiply3x3(veh->GetMatrix(), diffVec) + veh->GetPosition();
|
||||
|
||||
//unused
|
||||
//doorPos = Multiply3x3(veh->GetMatrix(), doorPos) + veh->GetMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -5103,7 +5187,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
|
|||
break;
|
||||
}
|
||||
} else {
|
||||
draggedOutOffset = vecPedDraggedOutCarAnimOffset;
|
||||
draggedOutOffset = CVector(vecPedDraggedOutCarAnimOffset.x, vecPedDraggedOutCarAnimOffset.y, 0.0f);
|
||||
}
|
||||
if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR)
|
||||
draggedOutOffset.x = -draggedOutOffset.x;
|
||||
|
@ -5114,7 +5198,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
|
|||
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||
ped->SetPosition(posAfterBeingDragged);
|
||||
|
||||
if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedDraggedOutCarAnimOffset)) {
|
||||
if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehDoor, &draggedOutOffset)) {
|
||||
ped->PositionPedOutOfCollision();
|
||||
}
|
||||
|
||||
|
@ -5729,7 +5813,12 @@ CPed::GetPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset)
|
|||
doorPos = vehModel->GetFrontSeatPosn();
|
||||
|
||||
if (component == CAR_WINDSCREEN) {
|
||||
#ifdef FIX_BUGS
|
||||
return bike->GetMatrix() * (doorPos +
|
||||
CVector(-vecPedBikeKickAnimOffset.x, vecPedBikeKickAnimOffset.y, -vecPedBikeKickAnimOffset.z));
|
||||
#else
|
||||
return bike->GetMatrix() * (doorPos + vecPedBikeKickAnimOffset);
|
||||
#endif
|
||||
} else {
|
||||
switch (bike->m_bikeAnimType) {
|
||||
case ASSOCGRP_BIKE_VESPA:
|
||||
|
|
Loading…
Reference in a new issue