some vehicle cleanup

This commit is contained in:
aap
2020-06-02 23:34:53 +02:00
parent 575c5466df
commit 04a91761df
10 changed files with 88 additions and 100 deletions

View File

@ -145,8 +145,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;
@ -2314,6 +2313,17 @@ CAutomobile::ProcessControlInputs(uint8 pad)
m_fSteerAngle = DEGTORAD(pHandling->fSteeringLock) * fValue;
if(bComedyControls){
#if 0 // old comedy controls from PS2 - same as bike's
if(((CTimer::GetTimeInMilliseconds() >> 10) & 0xF) < 12)
m_fGasPedal = 1.0f;
if((((CTimer::GetTimeInMilliseconds() >> 10)+6) & 0xF) < 12)
m_fBrakePedal = 0.0f;
bIsHandbrakeOn = false;
if(CTimer::GetTimeInMilliseconds() & 0x800)
m_fSteerAngle += 0.08f;
else
m_fSteerAngle -= 0.03f;
#else
int rnd = CGeneral::GetRandomNumber() % 10;
switch(m_comedyControlState){
case 0:
@ -2333,8 +2343,10 @@ CAutomobile::ProcessControlInputs(uint8 pad)
m_comedyControlState = 0;
break;
}
}else
}else{
m_comedyControlState = 0;
#endif
}
// Brake if player isn't in control
// BUG: game always uses pad 0 here
@ -3948,8 +3960,8 @@ CAutomobile::BurstTyre(uint8 wheel)
CCarCtrl::SwitchVehicleToRealPhysics(this);
}
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());
}
}
@ -3964,10 +3976,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:
@ -4558,7 +4570,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

View File

@ -30,22 +30,6 @@ enum eCarNodes
NUM_CAR_NODES,
};
enum eCarPositions
{
CAR_POS_HEADLIGHTS,
CAR_POS_TAILLIGHTS,
CAR_POS_FRONTSEAT,
CAR_POS_BACKSEAT,
// these are unused so we don't know the actual values
CAR_POS_REVERSELIGHTS,
CAR_POS_BRAKELIGHTS,
CAR_POS_INDICATORS_FRONT,
CAR_POS_INDICATORS_BACK,
CAR_POS_STEERWHEEL,
//
CAR_POS_EXHAUST
};
// These are used for all the wheel arrays
// DON'T confuse with VEHWHEEL, which are vehicle components
enum {

View File

@ -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

View File

@ -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

View File

@ -28,12 +28,6 @@ enum eCarLock {
CARLOCK_SKIP_SHUT_DOORS
};
enum
{
BOAT_POS_FRONTSEAT
};
enum eDoors
{
DOOR_BONNET = 0,