From 9e842f1628c273d20fb8221e8b42198880b127fe Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 10 May 2020 20:51:29 +0200 Subject: vehicle model descriptions; a bit of heli code --- src/vehicles/Automobile.cpp | 18 ++++++++---------- src/vehicles/Automobile.h | 2 +- src/vehicles/Bike.h | 13 ++++++++++--- src/vehicles/Boat.h | 6 +++++- src/vehicles/Plane.h | 7 +++++++ src/vehicles/Vehicle.cpp | 9 ++++----- src/vehicles/Vehicle.h | 2 ++ 7 files changed, 37 insertions(+), 20 deletions(-) (limited to 'src/vehicles') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 8ecea0ff..50eec49f 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -195,7 +195,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) CMatrix mat2(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LF])); mat1.GetPosition() += CVector(mat2.GetPosition().x + 0.1f, 0.0f, mat2.GetPosition().z); mat1.UpdateRW(); - }else if(GetModelIndex() == MI_SPARROW || GetModelIndex() == MI_RCRAIDER){ + }else if(IsRealHeli()){ RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LF]), 0); RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_RF]), 0); RpAtomicSetFlags((RpAtomic*)GetFirstObject(m_aCarNodes[CAR_WHEEL_LB]), 0); @@ -672,9 +672,7 @@ CAutomobile::ProcessControl(void) acceleration /= m_fForceMultiplier; // unused - if(GetModelIndex() == MI_RCBARON || - GetModelIndex() == MI_RCRAIDER || - GetModelIndex() == MI_SPARROW) + if(GetModelIndex() == MI_RCBARON || IsRealHeli()) acceleration = 0.0f; brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep(); @@ -1023,18 +1021,18 @@ CAutomobile::ProcessControl(void) FlyingControl(FLIGHT_MODEL_DODO); }else if(GetModelIndex() == MI_RCBARON){ FlyingControl(FLIGHT_MODEL_RCPLANE); - }else if(GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_SPARROW || bAllCarCheat){ + }else if(IsRealHeli() || bAllCarCheat){ #ifdef ALLCARSHELI_CHEAT if (bAllCarCheat) FlyingControl(FLIGHT_MODEL_HELI); else #endif { - if (CPad::GetPad(0)->GetCircleJustDown()) - m_aWheelSpeed[0] = Max(m_aWheelSpeed[0] - 0.03f, 0.0f); - if (m_aWheelSpeed[0] < 0.22f) - m_aWheelSpeed[0] += 0.0001f; - if (m_aWheelSpeed[0] > 0.15f) + // if (CPad::GetPad(0)->GetCircleJustDown()) + // m_aWheelSpeed[0] = Max(m_aWheelSpeed[0] - 0.03f, 0.0f); + // if (m_aWheelSpeed[0] < 0.22f) + // m_aWheelSpeed[0] += 0.0001f; + // if (m_aWheelSpeed[0] > 0.15f) FlyingControl(FLIGHT_MODEL_HELI); } } diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index 0356a9f2..b9f130f8 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -36,7 +36,7 @@ enum eCarPositions CAR_POS_TAILLIGHTS, CAR_POS_FRONTSEAT, CAR_POS_BACKSEAT, - CAR_POS_EXHAUST = 9, + CAR_POS_EXHAUST }; // These are used for all the wheel arrays diff --git a/src/vehicles/Bike.h b/src/vehicles/Bike.h index 4e7e5a0e..85cd3213 100644 --- a/src/vehicles/Bike.h +++ b/src/vehicles/Bike.h @@ -1,7 +1,5 @@ #pragma once -// some miami bike leftovers - enum eBikeNodes { BIKE_NODE_NONE, BIKE_CHASSIS, @@ -12,4 +10,13 @@ enum eBikeNodes { BIKE_MUDGUARD, BIKE_HANDLEBARS, BIKE_NUM_NODES -}; \ No newline at end of file +}; + +enum eBikePositions +{ + BIKE_POS_HEADLIGHTS, + BIKE_POS_TAILLIGHTS, + BIKE_POS_FRONTSEAT, + BIKE_POS_BACKSEAT, + BIKE_POS_EXHAUST +}; diff --git a/src/vehicles/Boat.h b/src/vehicles/Boat.h index cde5de84..7a0a9be4 100644 --- a/src/vehicles/Boat.h +++ b/src/vehicles/Boat.h @@ -5,8 +5,12 @@ enum eBoatNodes { BOAT_MOVING = 1, + BOAT_WINDSCREEN, BOAT_RUDDER, - BOAT_WINDSCREEN + BOAT_FLAP_LEFT, + BOAT_FLAP_RIGHT, + BOAT_REARFLAP_LEFT, + BOAT_REARFLAP_RIGHT }; class CBoat : public CVehicle diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h index 6fa6776b..a9afa4bc 100644 --- a/src/vehicles/Plane.h +++ b/src/vehicles/Plane.h @@ -2,6 +2,13 @@ #include "Vehicle.h" +enum ePlaneNodes +{ + PLANE_WHEEL_FRONT = 2, + PLANE_WHEEL_READ, + NUM_PLANE_NODES +}; + enum ePlanePositions { PLANE_POS_LIGHT_LEFT, diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index d0341058..b6045062 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -423,17 +423,16 @@ CVehicle::FlyingControl(eFlightModel flightModel) } else { fPitch = CPad::GetPad(0)->GetSteeringUpDown() / 128.0f; - fRoll = CPad::GetPad(0)->GetLookLeft(); - if (CPad::GetPad(0)->GetLookRight()) - fRoll = -1.0f; - fYaw = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f; + fYaw = CPad::GetPad(0)->GetLookRight(); + if (CPad::GetPad(0)->GetLookLeft()) + fYaw = -1.0f; + fRoll = -CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f; } if (CPad::GetPad(0)->GetHorn()) { fYaw = 0.0f; fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetUp()), -200.0f, 1.3f); fRoll = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f); } - debug("fPitch: %f\n", fPitch); ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward()); ApplyTurnForce(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 3b6d778e..0ef454fd 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -5,6 +5,7 @@ #include "ModelIndices.h" #include "AnimManager.h" #include "Weapon.h" +#include "HandlingMgr.h" class CPed; class CFire; @@ -294,6 +295,7 @@ public: bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; } CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); } bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA || GetModelIndex() == MI_KAUFMAN; } + bool IsRealHeli(void) { return !!(pHandling->Flags & HANDLING_IS_HELI); } AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); } static bool bWheelsOnlyCheat; -- cgit v1.2.3