summaryrefslogtreecommitdiffstats
path: root/src/vehicles
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-25 20:36:18 +0200
committeraap <aap@papnet.eu>2020-05-25 20:36:23 +0200
commit3c3b1aadc0bfd3b8d58cc9dcc269d83f6a003235 (patch)
treed1e86b5e9fe98616c3bb83554381e681330b6b6e /src/vehicles
parentEven more audio cleanups (diff)
downloadre3-3c3b1aadc0bfd3b8d58cc9dcc269d83f6a003235.tar
re3-3c3b1aadc0bfd3b8d58cc9dcc269d83f6a003235.tar.gz
re3-3c3b1aadc0bfd3b8d58cc9dcc269d83f6a003235.tar.bz2
re3-3c3b1aadc0bfd3b8d58cc9dcc269d83f6a003235.tar.lz
re3-3c3b1aadc0bfd3b8d58cc9dcc269d83f6a003235.tar.xz
re3-3c3b1aadc0bfd3b8d58cc9dcc269d83f6a003235.tar.zst
re3-3c3b1aadc0bfd3b8d58cc9dcc269d83f6a003235.zip
Diffstat (limited to 'src/vehicles')
-rw-r--r--src/vehicles/Automobile.cpp4
-rw-r--r--src/vehicles/Heli.cpp2
-rw-r--r--src/vehicles/Vehicle.cpp9
3 files changed, 10 insertions, 5 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 9617c9be..c968a147 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -4314,7 +4314,7 @@ GetCurrentAtomicObjectCB(RwObject *object, void *data)
return object;
}
-CColPoint spherepoints[MAX_COLLISION_POINTS];
+static CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
CObject*
CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
@@ -4434,7 +4434,7 @@ CAutomobile::SpawnFlyingComponent(int32 component, uint32 type)
if(CCollision::ProcessColModels(obj->GetMatrix(), *obj->GetColModel(),
this->GetMatrix(), *this->GetColModel(),
- spherepoints, nil, nil) > 0)
+ aTempPedColPts, nil, nil) > 0)
obj->m_pCollidingEntity = this;
if(bRenderScorched)
diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp
index 7b62b461..bb266a80 100644
--- a/src/vehicles/Heli.cpp
+++ b/src/vehicles/Heli.cpp
@@ -570,7 +570,7 @@ CHeli::PreRender(void)
i = 0;
for(angle = 0.0f; angle < TWOPI; angle += TWOPI/32){
CVector pos(radius*Cos(angle), radius*Sin(angle), 0.0f);
- CVector dir = pos*0.01f;
+ CVector dir = CVector(pos.x, pos.y, 1.0f)*0.01f;
pos += GetPosition();
if(CWorld::ProcessVerticalLine(pos, testLowZ, point, entity, true, false, false, false, true, false, nil))
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index d8c7c4c8..e264d7ed 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -466,6 +466,10 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
static bool bBraking;
static bool bDriving;
+#ifdef FIX_BUGS
+ bAlreadySkidding = false;
+#endif
+
// how much force we want to apply in these axes
float fwd = 0.0f;
float right = 0.0f;
@@ -547,7 +551,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
}
}
- if(sq(adhesion) < sq(right) + sq(fwd)){
+ float speedSq = sq(right) + sq(fwd);
+ if(sq(adhesion) < speedSq){
if(*wheelState != WHEEL_STATE_FIXED){
if(bDriving && contactSpeedFwd < 0.2f)
*wheelState = WHEEL_STATE_SPINNING;
@@ -555,7 +560,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
*wheelState = WHEEL_STATE_SKIDDING;
}
- float l = Sqrt(sq(right) + sq(fwd));
+ float l = Sqrt(speedSq);
float tractionLoss = bAlreadySkidding ? 1.0f : pHandling->fTractionLoss;
right *= adhesion * tractionLoss / l;
fwd *= adhesion * tractionLoss / l;