diff options
Diffstat (limited to 'src/vehicles')
-rw-r--r-- | src/vehicles/Automobile.cpp | 7 | ||||
-rw-r--r-- | src/vehicles/Boat.cpp | 9 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 1 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h | 8 |
4 files changed, 23 insertions, 2 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index e0ee0296..524067ca 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -2853,6 +2853,7 @@ CAutomobile::ProcessBuoyancy(void) if(impulseRatio > 0.5f){ bIsInWater = true; + bIsDrowning = true; if(m_vecMoveSpeed.z < -0.1f) m_vecMoveSpeed.z = -0.1f; @@ -2867,8 +2868,11 @@ CAutomobile::ProcessBuoyancy(void) if(pPassengers[i]->IsPlayer() || !bWaterTight) pPassengers[i]->InflictDamage(nil, WEAPONTYPE_DROWNING, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0); } - }else + } + else { bIsInWater = false; + bIsDrowning = false; + } static uint32 nGenerateRaindrops = 0; static uint32 nGenerateWaterCircles = 0; @@ -2950,6 +2954,7 @@ CAutomobile::ProcessBuoyancy(void) } }else{ bIsInWater = false; + bIsDrowning = false; bTouchingWater = false; static RwRGBA splashCol = {155, 155, 185, 196}; diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 1e7f8ecf..c4ac94a2 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -273,9 +273,17 @@ CBoat::ProcessControl(void) if(0.1f * m_fMass * GRAVITY*CTimer::GetTimeStep() < buoyanceImpulse.z){ bBoatInWater = true; bIsInWater = true; + if (GetUp().z < -0.6f && Abs(GetMoveSpeed().x) < 0.05 && Abs(GetMoveSpeed().y) < 0.05) { + bIsDrowning = true; + if (pDriver) + pDriver->InflictDamage(nil, WEAPONTYPE_DROWNING, CTimer::GetTimeStep(), PEDPIECE_TORSO, 0); + } + else + bIsDrowning = false; }else{ bBoatInWater = false; bIsInWater = false; + bIsDrowning = false; } m_fVolumeUnderWater = mod_Buoyancy.m_volumeUnderWater; @@ -519,6 +527,7 @@ CBoat::ProcessControl(void) }else{ bBoatInWater = false; bIsInWater = false; + bIsDrowning = false; } if(m_bIsAnchored){ diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index c5699d5e..90ffed50 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -104,6 +104,7 @@ CVehicle::CVehicle(uint8 CreatedBy) m_nCarHornPattern = 0; m_nCarHornDelay = 0; bPartOfConvoy = false; + bIsDrowning = false; bCreatedAsPoliceVehicle = false; bParking = false; m_nAlarmState = 0; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index c2cfa5e4..cce07410 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -182,10 +182,16 @@ public: uint8 bVehicleColProcessed : 1;// Has ProcessEntityCollision been processed for this car? uint8 bIsCarParkVehicle : 1; // Car has been created using the special CAR_PARK script command uint8 bHasAlreadyBeenRecorded : 1; // Used for replays - uint8 bPartOfConvoy : 1; + //uint8 bHeliMinimumTilt : 1; // This heli should have almost no tilt really + //uint8 bAudioChangingGear : 1; // sounds like vehicle is changing gear + + uint8 bIsDrowning : 1; // is vehicle occupants taking damage in water (i.e. vehicle is dead in water) + //uint8 bTyresDontBurst : 1; // If this is set the tyres are invincible uint8 bCreatedAsPoliceVehicle : 1;// True if this guy was created as a police vehicle (enforcer, policecar, miamivice car etc) + //uint8 bRestingOnPhysical : 1; // Dont go static cause car is sitting on a physical object that might get removed uint8 bParking : 1; + //uint8 bCanPark : 1; uint8 m_bombType : 3; |