From dba2b052a64bc4f468e94fbf078eff7a0cb27ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Tue, 9 Jun 2020 00:56:01 +0300 Subject: Peds, bike center of mass and reversing fixes --- src/vehicles/Automobile.h | 48 +------------------------------ src/vehicles/Bike.cpp | 2 +- src/vehicles/Bike.h | 14 +++++++++ src/vehicles/Vehicle.h | 72 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 48 deletions(-) (limited to 'src/vehicles') diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index 186ed646..6c13c117 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -7,30 +7,6 @@ class CObject; -enum eCarNodes -{ - CAR_WHEEL_RF = 1, - CAR_WHEEL_RM, - CAR_WHEEL_RB, - CAR_WHEEL_LF, - CAR_WHEEL_LM, - CAR_WHEEL_LB, - CAR_BUMP_FRONT, - CAR_BUMP_REAR, - CAR_WING_RF, - CAR_WING_RR, - CAR_DOOR_RF, - CAR_DOOR_RR, - CAR_WING_LF, - CAR_WING_LR, - CAR_DOOR_LF, - CAR_DOOR_LR, - CAR_BONNET, - CAR_BOOT, - CAR_WINDSCREEN, - NUM_CAR_NODES, -}; - // These are used for all the wheel arrays // DON'T confuse with VEHWHEEL, which are vehicle components enum { @@ -40,13 +16,6 @@ enum { CARWHEEL_REAR_RIGHT }; -enum { - CAR_DOOR_FLAG_UNKNOWN = 0x0, - CAR_DOOR_FLAG_LF = 0x1, - CAR_DOOR_FLAG_LR = 0x2, - CAR_DOOR_FLAG_RF = 0x4, - CAR_DOOR_FLAG_RR = 0x8 -}; class CAutomobile : public CVehicle { @@ -196,19 +165,4 @@ public: static const uint32 nSaveStructSize; static void SetAllTaxiLights(bool set); -}; - -inline uint8 GetCarDoorFlag(int32 carnode) { - switch (carnode) { - case CAR_DOOR_LF: - return CAR_DOOR_FLAG_LF; - case CAR_DOOR_LR: - return CAR_DOOR_FLAG_LR; - case CAR_DOOR_RF: - return CAR_DOOR_FLAG_RF; - case CAR_DOOR_RR: - return CAR_DOOR_FLAG_RR; - default: - return CAR_DOOR_FLAG_UNKNOWN; - } -} +}; \ No newline at end of file diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp index 555967fa..0dee85ce 100644 --- a/src/vehicles/Bike.cpp +++ b/src/vehicles/Bike.cpp @@ -127,7 +127,7 @@ CBike::CBike(int32 id, uint8 CreatedBy) bIsOnFire = false; m_bike_flag80 = false; - m_fTireTemperature = 0.0f; + m_fTireTemperature = 1.0f; m_fBrakeDestabilization = 0.0f; field_490 = 0; diff --git a/src/vehicles/Bike.h b/src/vehicles/Bike.h index 34d2074a..a13e4c56 100644 --- a/src/vehicles/Bike.h +++ b/src/vehicles/Bike.h @@ -133,3 +133,17 @@ public: void SetupModelNodes(void); void ReduceHornCounter(void); }; + +inline int8 GetBikeDoorFlag(int32 carnode) { + switch (carnode) { + case CAR_DOOR_RR: + case CAR_DOOR_LR: + return CAR_DOOR_FLAG_RR | CAR_DOOR_FLAG_LR; + case CAR_DOOR_RF: + case CAR_DOOR_LF: + case CAR_WINDSCREEN: + return CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF; + default: + return CAR_DOOR_FLAG_UNKNOWN; + } +} \ No newline at end of file diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index bc14bc77..6be16c83 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -20,6 +20,38 @@ enum { PERMANENT_VEHICLE = 4, }; +enum eCarNodes +{ + CAR_WHEEL_RF = 1, + CAR_WHEEL_RM, + CAR_WHEEL_RB, + CAR_WHEEL_LF, + CAR_WHEEL_LM, + CAR_WHEEL_LB, + CAR_BUMP_FRONT, + CAR_BUMP_REAR, + CAR_WING_RF, + CAR_WING_RR, + CAR_DOOR_RF, + CAR_DOOR_RR, + CAR_WING_LF, + CAR_WING_LR, + CAR_DOOR_LF, + CAR_DOOR_LR, + CAR_BONNET, + CAR_BOOT, + CAR_WINDSCREEN, + NUM_CAR_NODES, +}; + +enum { + CAR_DOOR_FLAG_UNKNOWN = 0x0, + CAR_DOOR_FLAG_LF = 0x1, + CAR_DOOR_FLAG_LR = 0x2, + CAR_DOOR_FLAG_RF = 0x4, + CAR_DOOR_FLAG_RR = 0x8 +}; + enum eCarLock { CARLOCK_NOT_USED, CARLOCK_UNLOCKED, @@ -379,3 +411,43 @@ public: void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle); bool IsVehiclePointerValid(CVehicle* pVehicle); + +// Names of functions below are made up by us. + +// Used in III and VC. +inline int8 GetCarDoorFlag(int32 carnode) { + switch (carnode) { + case CAR_DOOR_LF: + return CAR_DOOR_FLAG_LF; + case CAR_DOOR_LR: + return CAR_DOOR_FLAG_LR; + case CAR_DOOR_RF: + return CAR_DOOR_FLAG_RF; + case CAR_DOOR_RR: + return CAR_DOOR_FLAG_RR; + default: + return CAR_DOOR_FLAG_UNKNOWN; + } +} + +// VC. Accounts the case numMaxPassengers == 0, only for m_nGettingInFlags. +inline int8 GetEnterCarDoorFlag(int32 carnode, uint8 numMaxPassengers) { + switch (carnode) { + case CAR_DOOR_RF: + return CAR_DOOR_FLAG_RF; + case CAR_DOOR_RR: + return CAR_DOOR_FLAG_RR; + case CAR_DOOR_LF: + if (numMaxPassengers != 0) + return CAR_DOOR_FLAG_LF; + else + return CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR; + case CAR_DOOR_LR: + if (numMaxPassengers != 0) + return CAR_DOOR_FLAG_LR; + else + return CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR; + default: + return CAR_DOOR_FLAG_UNKNOWN; + } +} -- cgit v1.2.3