CPhysical fixes and cleanup

This commit is contained in:
aap 2021-08-02 20:02:57 +02:00
parent ae1deb2209
commit 4a047f56bc
2 changed files with 42 additions and 63 deletions

View file

@ -226,14 +226,13 @@ CPhysical::RemoveAndAdd(void)
CRect CRect
CPhysical::GetBoundRect(void) CPhysical::GetBoundRect(void)
{ {
CVUVECTOR center; CVector center;
float radius; float radius;
GetBoundCentre(center); center = GetBoundCentre();
radius = GetBoundRadius(); radius = GetBoundRadius();
return CRect(center.x-radius, center.y-radius, center.x+radius, center.y+radius); return CRect(center.x-radius, center.y-radius, center.x+radius, center.y+radius);
} }
// --MIAMI: Proof-read once
void void
CPhysical::AddToMovingList(void) CPhysical::AddToMovingList(void)
{ {
@ -241,7 +240,6 @@ CPhysical::AddToMovingList(void)
m_movingListNode = CWorld::GetMovingEntityList().InsertItem(this); m_movingListNode = CWorld::GetMovingEntityList().InsertItem(this);
} }
// --MIAMI: Proof-read once
void void
CPhysical::RemoveFromMovingList(void) CPhysical::RemoveFromMovingList(void)
{ {
@ -261,7 +259,6 @@ CPhysical::SetDamagedPieceRecord(uint16 piece, float impulse, CEntity *entity, C
m_vecDamageNormal = dir; m_vecDamageNormal = dir;
} }
// --MIAMI: Proof-read once
void void
CPhysical::AddCollisionRecord(CEntity *ent) CPhysical::AddCollisionRecord(CEntity *ent)
{ {
@ -285,7 +282,6 @@ CPhysical::AddCollisionRecord(CEntity *ent)
} }
} }
// --MIAMI: Proof-read once
void void
CPhysical::AddCollisionRecord_Treadable(CEntity *ent) CPhysical::AddCollisionRecord_Treadable(CEntity *ent)
{ {
@ -293,7 +289,6 @@ CPhysical::AddCollisionRecord_Treadable(CEntity *ent)
} }
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::GetHasCollidedWith(CEntity *ent) CPhysical::GetHasCollidedWith(CEntity *ent)
{ {
@ -305,7 +300,6 @@ CPhysical::GetHasCollidedWith(CEntity *ent)
return false; return false;
} }
// --MIAMI: Proof-read once
void void
CPhysical::RemoveRefsToEntity(CEntity *ent) CPhysical::RemoveRefsToEntity(CEntity *ent)
{ {
@ -321,7 +315,6 @@ CPhysical::RemoveRefsToEntity(CEntity *ent)
} }
} }
// --MIAMI: Proof-read once
void void
CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos) CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos)
{ {
@ -338,7 +331,6 @@ CPhysical::PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phy
CWorld::Add(phys); CWorld::Add(phys);
} }
// --MIAMI: Proof-read once
int32 int32
CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints) CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
{ {
@ -357,7 +349,6 @@ CPhysical::ProcessEntityCollision(CEntity *ent, CColPoint *colpoints)
return numSpheres; return numSpheres;
} }
// --MIAMI: Proof-read once
void void
CPhysical::ProcessControl(void) CPhysical::ProcessControl(void)
{ {
@ -425,7 +416,6 @@ CPhysical::GetSpeed(const CVector &r)
return m_vecMoveSpeed + m_vecMoveFriction + CrossProduct(m_vecTurnFriction + m_vecTurnSpeed, r); return m_vecMoveSpeed + m_vecMoveFriction + CrossProduct(m_vecTurnFriction + m_vecTurnSpeed, r);
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyMoveSpeed(void) CPhysical::ApplyMoveSpeed(void)
{ {
@ -435,7 +425,6 @@ CPhysical::ApplyMoveSpeed(void)
GetMatrix().Translate(m_vecMoveSpeed * CTimer::GetTimeStep()); GetMatrix().Translate(m_vecMoveSpeed * CTimer::GetTimeStep());
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyTurnSpeed(void) CPhysical::ApplyTurnSpeed(void)
{ {
@ -451,14 +440,12 @@ CPhysical::ApplyTurnSpeed(void)
} }
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyMoveForce(float jx, float jy, float jz) CPhysical::ApplyMoveForce(float jx, float jy, float jz)
{ {
m_vecMoveSpeed += CVector(jx, jy, jz)*(1.0f/m_fMass); m_vecMoveSpeed += CVector(jx, jy, jz)*(1.0f/m_fMass);
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyTurnForce(float jx, float jy, float jz, float px, float py, float pz) CPhysical::ApplyTurnForce(float jx, float jy, float jz, float px, float py, float pz)
{ {
@ -473,7 +460,6 @@ CPhysical::ApplyFrictionMoveForce(float jx, float jy, float jz)
m_vecMoveFriction += CVector(jx, jy, jz)*(1.0f/m_fMass); m_vecMoveFriction += CVector(jx, jy, jz)*(1.0f/m_fMass);
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float py, float pz) CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float py, float pz)
{ {
@ -482,7 +468,6 @@ CPhysical::ApplyFrictionTurnForce(float jx, float jy, float jz, float px, float
m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass); m_vecTurnFriction += turnimpulse*(1.0f/m_fTurnMass);
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias) CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias)
{ {
@ -496,7 +481,6 @@ CPhysical::ApplySpringCollision(float springConst, CVector &springDir, CVector &
return true; return true;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ApplySpringCollisionAlt(float springConst, CVector &springDir, CVector &point, float springRatio, float bias, CVector &forceDir) CPhysical::ApplySpringCollisionAlt(float springConst, CVector &springDir, CVector &point, float springRatio, float bias, CVector &forceDir)
{ {
@ -514,7 +498,6 @@ CPhysical::ApplySpringCollisionAlt(float springConst, CVector &springDir, CVecto
return true; return true;
} }
// --MIAMI: Proof-read once
// What exactly is speed? // What exactly is speed?
bool bool
CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &point, CVector &speed) CPhysical::ApplySpringDampening(float damping, CVector &springDir, CVector &point, CVector &speed)
@ -579,7 +562,6 @@ CPhysical::ApplyFriction(void)
m_vecTurnFriction = CVector(0.0f, 0.0f, 0.0f); m_vecTurnFriction = CVector(0.0f, 0.0f, 0.0f);
} }
// --MIAMI: Proof-read once
void void
CPhysical::ApplyAirResistance(void) CPhysical::ApplyAirResistance(void)
{ {
@ -698,7 +680,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
if(model == MI_FIRE_HYDRANT && !Bobj->bHasBeenDamaged){ if(model == MI_FIRE_HYDRANT && !Bobj->bHasBeenDamaged){
CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, B->GetPosition() - CVector(0.0f, 0.0f, 0.5f), true); CParticleObject::AddObject(POBJECT_FIRE_HYDRANT, B->GetPosition() - CVector(0.0f, 0.0f, 0.5f), true);
Bobj->bHasBeenDamaged = true; Bobj->bHasBeenDamaged = true;
}else if(model == MI_PARKINGMETER || model == MI_PARKINGMETER2){ }else if((model == MI_PARKINGMETER || model == MI_PARKINGMETER2) && !Bobj->bHasBeenDamaged){
CPickups::CreateSomeMoney(GetPosition(), CGeneral::GetRandomNumber()%100); CPickups::CreateSomeMoney(GetPosition(), CGeneral::GetRandomNumber()%100);
Bobj->bHasBeenDamaged = true; Bobj->bHasBeenDamaged = true;
}else if(B->IsObject() && !IsExplosiveThingModel(model)) }else if(B->IsObject() && !IsExplosiveThingModel(model))
@ -716,14 +698,17 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
} }
return true; return true;
} }
}else if(!B->bInfiniteMass) }else if(!B->bInfiniteMass){
B->SetIsStatic(false); B->SetIsStatic(false);
CWorld::Players[CWorld::PlayerInFocus].m_nHavocLevel += 2;
CStats::PropertyDestroyed += CGeneral::GetRandomNumberInRange(30, 60);
}
} }
} }
if(B->GetIsStatic()) if(B->GetIsStatic())
return false; return false;
if(!B->bInfiniteMass && !B->m_phy_flagA08) if(!B->bInfiniteMass && !B->bIsStaticWaitingForCollision)
B->AddToMovingList(); B->AddToMovingList();
} }
@ -733,11 +718,11 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
// negative if A is moving towards B // negative if A is moving towards B
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal); speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
// positive if B is moving towards A // positive if B is moving towards A
float speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal); speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal);
bool affectB = false; bool affectB = false;
float mA = A->m_fMass;; float mA = A->m_fMass;
float mB = B->m_fMass;; float mB = B->m_fMass;
float speedSum; float speedSum;
if(((CPed*)A)->GetPedState() == PED_FOLLOW_PATH){ if(((CPed*)A)->GetPedState() == PED_FOLLOW_PATH){
affectB = true; affectB = true;
@ -1009,7 +994,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV
Abs(m_vecMoveSpeed.z) < minspeed*2.0f) Abs(m_vecMoveSpeed.z) < minspeed*2.0f)
impulse = -0.8f * normalSpeed * mass; impulse = -0.8f * normalSpeed * mass;
else if(IsVehicle() && ((CVehicle*)this)->IsBoat() && else if(IsVehicle() && ((CVehicle*)this)->IsBoat() &&
colpoint.surfaceB == SURFACE_WOOD_SOLID && colpoint.normal.z < 0.5f) (colpoint.surfaceB == SURFACE_WOOD_SOLID || colpoint.normal.z < 0.5f))
impulse = -(2.0f * m_fElasticity + 1.0f) * normalSpeed * mass; impulse = -(2.0f * m_fElasticity + 1.0f) * normalSpeed * mass;
else else
impulse = -(m_fElasticity + 1.0f) * normalSpeed * mass; impulse = -(m_fElasticity + 1.0f) * normalSpeed * mass;
@ -1037,7 +1022,6 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV
return false; return false;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint) CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
{ {
@ -1187,7 +1171,6 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
return false; return false;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint) CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
{ {
@ -1253,7 +1236,6 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
return false; return false;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ProcessShiftSectorList(CPtrList *lists) CPhysical::ProcessShiftSectorList(CPtrList *lists)
{ {
@ -1287,11 +1269,12 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
skipShift = false; skipShift = false;
if(B->IsBuilding() || if(B->IsBuilding() ||
B->IsObject() && B->bInfiniteMass) B->IsObject() && B->bInfiniteMass ||
A->IsPed() && B->IsObject() && B->GetIsStatic() && !Bobj->bHasBeenDamaged)
canshift = true; canshift = true;
else else
canshift = A->IsPed() && canshift = false;
B->IsObject() && B->GetIsStatic() && !Bobj->bHasBeenDamaged;
if(B == A || if(B == A ||
B->m_scanCode == CWorld::GetCurrentScanCode() || B->m_scanCode == CWorld::GetCurrentScanCode() ||
!B->bUsesCollision || !B->bUsesCollision ||
@ -1320,7 +1303,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
Aobj->m_pCollidingEntity = nil; Aobj->m_pCollidingEntity = nil;
}else if(Aobj->m_pCollidingEntity != B){ }else if(Aobj->m_pCollidingEntity != B){
CMatrix inv; CMatrix inv;
CVector size = CModelInfo::GetModelInfo(A->GetModelIndex())->GetColModel()->boundingBox.GetSize(); CVector size = CModelInfo::GetColModel(A->GetModelIndex())->boundingBox.GetSize();
size = A->GetMatrix() * size; size = A->GetMatrix() * size;
if(size.z < B->GetPosition().z || if(size.z < B->GetPosition().z ||
(Invert(B->GetMatrix(), inv) * size).z < 0.0f){ (Invert(B->GetMatrix(), inv) * size).z < 0.0f){
@ -1338,7 +1321,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
Bobj->m_pCollidingEntity = nil; Bobj->m_pCollidingEntity = nil;
}else if(Bobj->m_pCollidingEntity != A){ }else if(Bobj->m_pCollidingEntity != A){
CMatrix inv; CMatrix inv;
CVector size = CModelInfo::GetModelInfo(B->GetModelIndex())->GetColModel()->boundingBox.GetSize(); CVector size = CModelInfo::GetColModel(B->GetModelIndex())->boundingBox.GetSize();
size = B->GetMatrix() * size; size = B->GetMatrix() * size;
if(size.z < A->GetPosition().z || if(size.z < A->GetPosition().z ||
(Invert(A->GetMatrix(), inv) * size).z < 0.0f) (Invert(A->GetMatrix(), inv) * size).z < 0.0f)
@ -1350,9 +1333,10 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
else if(A->IsPed() && IsBodyPart(B->GetModelIndex())) else if(A->IsPed() && IsBodyPart(B->GetModelIndex()))
skipShift = true; skipShift = true;
else if(A->IsPed() && ((CPed*)A)->m_pCollidingEntity == B || else if(A->IsPed() && ((CPed*)A)->m_pCollidingEntity == B ||
B->IsPed() && ((CPed*)B)->m_pCollidingEntity == A || B->IsPed() && ((CPed*)B)->m_pCollidingEntity == A)
A->GetModelIndex() == MI_RCBANDIT && B->IsVehicle() || skipShift = true;
B->GetModelIndex() == MI_RCBANDIT && (A->IsPed() || A->IsVehicle())) else if(A->GetModelIndex() == MI_RCBANDIT && B->IsVehicle() ||
B->GetModelIndex() == MI_RCBANDIT && (A->IsPed() || A->IsVehicle()))
skipShift = true; skipShift = true;
if(skipShift) if(skipShift)
@ -1416,7 +1400,6 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
return true; return true;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ProcessCollisionSectorList_SimpleCar(CPtrList *lists) CPhysical::ProcessCollisionSectorList_SimpleCar(CPtrList *lists)
{ {
@ -1583,7 +1566,6 @@ collision:
return true; return true;
} }
// --MIAMI: Proof-read once
bool bool
CPhysical::ProcessCollisionSectorList(CPtrList *lists) CPhysical::ProcessCollisionSectorList(CPtrList *lists)
{ {
@ -1621,18 +1603,17 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
bool isTouching = true; bool isTouching = true;
if(!B->bUsesCollision || if(!B->bUsesCollision ||
B->m_scanCode == CWorld::GetCurrentScanCode() || B->m_scanCode == CWorld::GetCurrentScanCode() ||
B == A || B == A)
!(isTouching = B->GetIsTouching(center, radius))){ continue;
if(!isTouching){ if(!B->GetIsTouching(center, radius)){
if(A->IsObject() && Aobj->m_pCollidingEntity == B) if(A->IsObject() && Aobj->m_pCollidingEntity == B)
Aobj->m_pCollidingEntity = nil; Aobj->m_pCollidingEntity = nil;
else if(B->IsObject() && Bobj->m_pCollidingEntity == A) else if(B->IsObject() && Bobj->m_pCollidingEntity == A)
Bobj->m_pCollidingEntity = nil; Bobj->m_pCollidingEntity = nil;
else if(A->IsPed() && Aped->m_pCollidingEntity == B) else if(A->IsPed() && Aped->m_pCollidingEntity == B)
Aped->m_pCollidingEntity = nil; Aped->m_pCollidingEntity = nil;
else if(B->IsPed() && Bped->m_pCollidingEntity == A) else if(B->IsPed() && Bped->m_pCollidingEntity == A)
Bped->m_pCollidingEntity = nil; Bped->m_pCollidingEntity = nil;
}
continue; continue;
} }
@ -1664,7 +1645,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
skipCollision = true; skipCollision = true;
else if(Aobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){ else if(Aobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){
CMatrix inv; CMatrix inv;
CVector size = CModelInfo::GetModelInfo(A->GetModelIndex())->GetColModel()->boundingBox.GetSize(); CVector size = CModelInfo::GetColModel(A->GetModelIndex())->boundingBox.GetSize();
size = A->GetMatrix() * size; size = A->GetMatrix() * size;
if(size.z < B->GetPosition().z || if(size.z < B->GetPosition().z ||
(Invert(B->GetMatrix(), inv) * size).z < 0.0f){ (Invert(B->GetMatrix(), inv) * size).z < 0.0f){
@ -1683,7 +1664,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
skipCollision = true; skipCollision = true;
else if(Bobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){ else if(Bobj->m_nCollisionDamageEffect < DAMAGE_EFFECT_SMASH_COMPLETELY){
CMatrix inv; CMatrix inv;
CVector size = CModelInfo::GetModelInfo(B->GetModelIndex())->GetColModel()->boundingBox.GetSize(); CVector size = CModelInfo::GetColModel(B->GetModelIndex())->boundingBox.GetSize();
size = B->GetMatrix() * size; size = B->GetMatrix() * size;
if(size.z < A->GetPosition().z || if(size.z < A->GetPosition().z ||
(Invert(A->GetMatrix(), inv) * size).z < 0.0f){ (Invert(A->GetMatrix(), inv) * size).z < 0.0f){
@ -1833,7 +1814,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
if(!CWorld::bNoMoreCollisionTorque && if(!CWorld::bNoMoreCollisionTorque &&
A->GetStatus() == STATUS_PLAYER && A->IsVehicle() && A->GetStatus() == STATUS_PLAYER && A->IsVehicle() &&
Abs(A->m_vecMoveSpeed.x) > 0.2f && Abs(A->m_vecMoveSpeed.x) > 0.2f &&
Abs(A->m_vecMoveSpeed.y) > 0.2f){ Abs(A->m_vecMoveSpeed.y) > 0.2f && !A->bIsInWater){
A->m_vecMoveFriction.x += moveSpeed.x * -0.3f / numCollisions; A->m_vecMoveFriction.x += moveSpeed.x * -0.3f / numCollisions;
A->m_vecMoveFriction.y += moveSpeed.y * -0.3f / numCollisions; A->m_vecMoveFriction.y += moveSpeed.y * -0.3f / numCollisions;
A->m_vecTurnFriction += turnSpeed * -0.3f / numCollisions; A->m_vecTurnFriction += turnSpeed * -0.3f / numCollisions;
@ -1986,7 +1967,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
Bobj->ObjectDamage(maxImpulseB); Bobj->ObjectDamage(maxImpulseB);
else if(Bobj->m_nCollisionDamageEffect >= DAMAGE_EFFECT_SMASH_COMPLETELY){ else if(Bobj->m_nCollisionDamageEffect >= DAMAGE_EFFECT_SMASH_COMPLETELY){
CMatrix inv; CMatrix inv;
CVector size = CModelInfo::GetModelInfo(B->GetModelIndex())->GetColModel()->boundingBox.GetSize(); CVector size = CModelInfo::GetColModel(B->GetModelIndex())->boundingBox.GetSize();
size = B->GetMatrix() * size; size = B->GetMatrix() * size;
if(size.z < A->GetPosition().z || if(size.z < A->GetPosition().z ||
(Invert(A->GetMatrix(), inv) * size).z < 0.0f) (Invert(A->GetMatrix(), inv) * size).z < 0.0f)
@ -2001,7 +1982,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
else if(Bobj->m_nCollisionDamageEffect >= DAMAGE_EFFECT_SMASH_COMPLETELY){ else if(Bobj->m_nCollisionDamageEffect >= DAMAGE_EFFECT_SMASH_COMPLETELY){
#endif #endif
CMatrix inv; CMatrix inv;
CVector size = CModelInfo::GetModelInfo(A->GetModelIndex())->GetColModel()->boundingBox.GetSize(); CVector size = CModelInfo::GetColModel(A->GetModelIndex())->boundingBox.GetSize();
size = A->GetMatrix() * size; size = A->GetMatrix() * size;
if(size.z < B->GetPosition().z || if(size.z < B->GetPosition().z ||
(Invert(B->GetMatrix(), inv) * size).z < 0.0f) (Invert(B->GetMatrix(), inv) * size).z < 0.0f)
@ -2054,7 +2035,6 @@ CPhysical::CheckCollision_SimpleCar(void)
float PHYSICAL_SHIFT_SPEED_DAMP = 0.707f; float PHYSICAL_SHIFT_SPEED_DAMP = 0.707f;
// --MIAMI: Proof-read once
void void
CPhysical::ProcessShift(void) CPhysical::ProcessShift(void)
{ {
@ -2110,7 +2090,7 @@ CPhysical::ProcessShift(void)
} }
// x is the number of units (m) we would like to step // x is the number of units (m) we would like to step
#define NUMSTEPS(x) ceil(Sqrt(distSq) * (1.0f/(x))) #define NUMSTEPS(x) Ceil(Sqrt(distSq) * (1.0f/(x)))
float HIGHSPEED_ELASTICITY_MULT_PED = 2.0f; float HIGHSPEED_ELASTICITY_MULT_PED = 2.0f;
float HIGHSPEED_ELASTICITY_MULT_COPCAR = 2.0f; float HIGHSPEED_ELASTICITY_MULT_COPCAR = 2.0f;
@ -2186,10 +2166,11 @@ CPhysical::ProcessCollision(void)
m_bIsVehicleBeingShifted = false; m_bIsVehicleBeingShifted = false;
bJustCheckCollision = true; bJustCheckCollision = true;
bool savedUsesCollision = bUsesCollision;
bUsesCollision = false; bUsesCollision = false;
if(!CheckCollision()){ if(!CheckCollision()){
bJustCheckCollision = false; bJustCheckCollision = false;
bUsesCollision = true; bUsesCollision = savedUsesCollision;
if(IsVehicle()) if(IsVehicle())
((CVehicle*)this)->bVehicleColProcessed = true; ((CVehicle*)this)->bVehicleColProcessed = true;
@ -2204,7 +2185,7 @@ CPhysical::ProcessCollision(void)
return; return;
} }
bJustCheckCollision = false; bJustCheckCollision = false;
bUsesCollision = true; bUsesCollision = savedUsesCollision;
GetMatrix() = savedMatrix; GetMatrix() = savedMatrix;
m_vecMoveSpeed = savedMoveSpeed; m_vecMoveSpeed = savedMoveSpeed;
if(IsVehicle() && ((CVehicle*)this)->bIsLawEnforcer) if(IsVehicle() && ((CVehicle*)this)->bIsLawEnforcer)

View file

@ -15,8 +15,6 @@ class CTreadable;
class CPhysical : public CEntity class CPhysical : public CEntity
{ {
public: public:
// The not properly indented fields haven't been checked properly yet
int32 m_audioEntityId; int32 m_audioEntityId;
float m_phys_unused1; float m_phys_unused1;
uint32 m_nLastTimeCollided; uint32 m_nLastTimeCollided;