summaryrefslogtreecommitdiffstats
path: root/src/vehicles
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-06-02 23:35:20 +0200
committeraap <aap@papnet.eu>2020-06-02 23:35:20 +0200
commit2ca3c50463eff025b9783930d112dd0c257c040e (patch)
tree1601340bc1b3d51542aad6f448f52c89badfd89d /src/vehicles
parentfixed radar rendering (diff)
downloadre3-2ca3c50463eff025b9783930d112dd0c257c040e.tar
re3-2ca3c50463eff025b9783930d112dd0c257c040e.tar.gz
re3-2ca3c50463eff025b9783930d112dd0c257c040e.tar.bz2
re3-2ca3c50463eff025b9783930d112dd0c257c040e.tar.lz
re3-2ca3c50463eff025b9783930d112dd0c257c040e.tar.xz
re3-2ca3c50463eff025b9783930d112dd0c257c040e.tar.zst
re3-2ca3c50463eff025b9783930d112dd0c257c040e.zip
Diffstat (limited to 'src/vehicles')
-rw-r--r--src/vehicles/Automobile.cpp15
-rw-r--r--src/vehicles/Automobile.h19
-rw-r--r--src/vehicles/Bike.h59
-rw-r--r--src/vehicles/Plane.h7
-rw-r--r--src/vehicles/Train.h9
-rw-r--r--src/vehicles/Vehicle.h10
6 files changed, 65 insertions, 54 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index f4444f58..d146ffca 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -175,8 +175,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
for(i = 0; i < 4; i++){
m_aGroundPhysical[i] = nil;
m_aGroundOffset[i] = CVector(0.0f, 0.0f, 0.0f);
- m_aSuspensionSpringRatio[i] = 1.0f;
- m_aSuspensionSpringRatioPrev[i] = m_aSuspensionSpringRatio[i];
+ m_aSuspensionSpringRatioPrev[i] = m_aSuspensionSpringRatio[i] = 1.0f;
m_aWheelTimer[i] = 0.0f;
m_aWheelRotation[i] = 0.0f;
m_aWheelSpeed[i] = 0.0f;
@@ -4850,8 +4849,8 @@ CAutomobile::BurstTyre(uint8 wheel, bool applyForces)
}
if(applyForces){
- ApplyMoveForce(GetRight() * CGeneral::GetRandomNumberInRange(-0.3f, 0.3f));
- ApplyTurnForce(GetRight() * CGeneral::GetRandomNumberInRange(-0.3f, 0.3f), GetForward());
+ ApplyMoveForce(GetRight() * m_fMass * CGeneral::GetRandomNumberInRange(-0.03f, 0.03f));
+ ApplyTurnForce(GetRight() * m_fTurnMass * CGeneral::GetRandomNumberInRange(-0.03f, 0.03f), GetForward());
}
}
}
@@ -4867,10 +4866,10 @@ CAutomobile::IsRoomForPedToLeaveCar(uint32 component, CVector *doorOffset)
CVector seatPos;
switch(component){
case CAR_DOOR_RF:
- seatPos = mi->m_positions[mi->m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT];
+ seatPos = mi->GetFrontSeatPosn();
break;
case CAR_DOOR_LF:
- seatPos = mi->m_positions[mi->m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT];
+ seatPos = mi->GetFrontSeatPosn();
seatPos.x = -seatPos.x;
break;
case CAR_DOOR_RR:
@@ -4898,7 +4897,7 @@ CAutomobile::IsRoomForPedToLeaveCar(uint32 component, CVector *doorOffset)
CVector dist = doorPos - seatPos;
- // Removing that makes this func. return false for van doors.
+ // Removing that makes thiProcessEntityCollisions func. return false for van doors.
doorPos.z += 0.5f;
float length = dist.Magnitude();
CVector pedPos = seatPos + dist*((length+0.6f)/length);
@@ -5519,7 +5518,7 @@ CAutomobile::SetupModelNodes(void)
int i;
for(i = 0; i < NUM_CAR_NODES; i++)
m_aCarNodes[i] = nil;
- CClumpModelInfo::FillFrameArray((RpClump*)m_rwObject, m_aCarNodes);
+ CClumpModelInfo::FillFrameArray(GetClump(), m_aCarNodes);
}
void
diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h
index 9d24d237..186ed646 100644
--- a/src/vehicles/Automobile.h
+++ b/src/vehicles/Automobile.h
@@ -31,15 +31,6 @@ enum eCarNodes
NUM_CAR_NODES,
};
-enum eCarPositions
-{
- CAR_POS_HEADLIGHTS,
- CAR_POS_TAILLIGHTS,
- CAR_POS_FRONTSEAT,
- CAR_POS_BACKSEAT,
- CAR_POS_EXHAUST
-};
-
// These are used for all the wheel arrays
// DON'T confuse with VEHWHEEL, which are vehicle components
enum {
@@ -49,16 +40,6 @@ enum {
CARWHEEL_REAR_RIGHT
};
-enum eBombType
-{
- CARBOMB_NONE,
- CARBOMB_TIMED,
- CARBOMB_ONIGNITION,
- CARBOMB_REMOTE,
- CARBOMB_TIMEDACTIVE,
- CARBOMB_ONIGNITIONACTIVE,
-};
-
enum {
CAR_DOOR_FLAG_UNKNOWN = 0x0,
CAR_DOOR_FLAG_LF = 0x1,
diff --git a/src/vehicles/Bike.h b/src/vehicles/Bike.h
index f68a9513..ba93fda0 100644
--- a/src/vehicles/Bike.h
+++ b/src/vehicles/Bike.h
@@ -1,5 +1,6 @@
#pragma once
+#include "Vehicle.h"
#include "Skidmarks.h"
enum eBikeNodes {
@@ -14,20 +15,23 @@ enum eBikeNodes {
BIKE_NUM_NODES
};
-enum eBikePositions
-{
- BIKE_POS_HEADLIGHTS,
- BIKE_POS_TAILLIGHTS,
- BIKE_POS_FRONTSEAT,
- BIKE_POS_BACKSEAT,
- BIKE_POS_EXHAUST
+enum {
+ BIKEWHEEL_FRONT,
+ BIKEWHEEL_REAR,
+};
+
+enum {
+ BIKESUSP_FRONT_1,
+ BIKESUSP_FRONT_2,
+ BIKESUSP_REAR_1,
+ BIKESUSP_REAR_2,
};
class CBike : public CVehicle
{
public:
RwFrame *m_aBikeNodes[BIKE_NUM_NODES];
- bool m_bLeanMatrixCalculated;
+ bool bLeanMatrixClean;
CMatrix m_leanMatrix;
CVector wheelieNormal;
CVector wheelieRight;
@@ -83,4 +87,43 @@ public:
uint8 m_nDriveWheelsOnGroundPrev;
float m_fGasPedalAudio;
tWheelState m_aWheelState[2];
+
+ CBike(int32 id, uint8 CreatedBy);
+
+ // from CEntity
+ void SetModelIndex(uint32 id);
+ void ProcessControl(void);
+ void Teleport(CVector v);
+ void PreRender(void);
+ void Render(void);
+
+ // from CPhysical
+ int32 ProcessEntityCollision(CEntity *ent, CColPoint *colpoints);
+
+ // from CVehicle
+ void ProcessControlInputs(uint8);
+ void GetComponentWorldPosition(int32 component, CVector &pos);
+ bool IsComponentPresent(int32 component);
+ void SetComponentRotation(int32 component, CVector rotation);
+ bool IsDoorReady(eDoors door);
+ bool IsDoorFullyOpen(eDoors door);
+ bool IsDoorClosed(eDoors door);
+ bool IsDoorMissing(eDoors door);
+ void RemoveRefsToVehicle(CEntity *ent);
+ void BlowUpCar(CEntity *ent);
+ bool SetUpWheelColModel(CColModel *colModel);
+ void BurstTyre(uint8 tyre, bool applyForces);
+ bool IsRoomForPedToLeaveCar(uint32 component, CVector *doorOffset);
+ float GetHeightAboveRoad(void);
+ void PlayCarHorn(void);
+
+ void PlayHornIfNecessary(void);
+ void ResetSuspension(void);
+ void SetupSuspensionLines(void);
+ void CalculateLeanMatrix(void);
+ void GetCorrectedWorldDoorPosition(CVector &pos, CVector p1, CVector p2);
+
+ void Fix(void);
+ void SetupModelNodes(void);
+ void ReduceHornCounter(void);
};
diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h
index a9afa4bc..e9456bcd 100644
--- a/src/vehicles/Plane.h
+++ b/src/vehicles/Plane.h
@@ -9,13 +9,6 @@ enum ePlaneNodes
NUM_PLANE_NODES
};
-enum ePlanePositions
-{
- PLANE_POS_LIGHT_LEFT,
- PLANE_POS_LIGHT_RIGHT,
- PLANE_POS_LIGHT_TAIL,
-};
-
struct CPlaneNode
{
CVector p; // position
diff --git a/src/vehicles/Train.h b/src/vehicles/Train.h
index d8ee949d..57cd28de 100644
--- a/src/vehicles/Train.h
+++ b/src/vehicles/Train.h
@@ -24,15 +24,6 @@ enum eTrainNodes
NUM_TRAIN_NODES
};
-enum eTrainPositions
-{
- TRAIN_POS_LIGHT_FRONT,
- TRAIN_POS_LIGHT_REAR,
- TRAIN_POS_LEFT_ENTRY,
- TRAIN_POS_MID_ENTRY,
- TRAIN_POS_RIGHT_ENTRY
-};
-
struct CTrainNode
{
CVector p; // position
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index 3fe99144..319f27c8 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -31,10 +31,14 @@ enum eCarLock {
CARLOCK_SKIP_SHUT_DOORS
};
-
-enum
+enum eBombType
{
- BOAT_POS_FRONTSEAT
+ CARBOMB_NONE,
+ CARBOMB_TIMED,
+ CARBOMB_ONIGNITION,
+ CARBOMB_REMOTE,
+ CARBOMB_TIMEDACTIVE,
+ CARBOMB_ONIGNITIONACTIVE,
};
enum eDoors