summaryrefslogtreecommitdiffstats
path: root/src/vehicles
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2021-01-12 22:11:15 +0100
committerFire-Head <Fire-Head@users.noreply.github.com>2021-01-12 22:11:15 +0100
commit3e6016dc6ee40372a06b74d24cae2f97428358f2 (patch)
treeff2420d56a8cc4ab1b9c0f43f720e6f6fbb8bc11 /src/vehicles
parentrem gMakeResources (diff)
parentMerge remote-tracking branch 'origin/miami' into lcs (diff)
downloadre3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar
re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.gz
re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.bz2
re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.lz
re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.xz
re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.tar.zst
re3-3e6016dc6ee40372a06b74d24cae2f97428358f2.zip
Diffstat (limited to 'src/vehicles')
-rw-r--r--src/vehicles/Automobile.cpp20
-rw-r--r--src/vehicles/Bike.cpp2
-rw-r--r--src/vehicles/Boat.cpp10
-rw-r--r--src/vehicles/Cranes.cpp4
-rw-r--r--src/vehicles/Door.cpp55
-rw-r--r--src/vehicles/Door.h19
6 files changed, 92 insertions, 18 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 64309c39..6f00a2ea 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -288,17 +288,17 @@ CAutomobile::ProcessControl(void)
// Improve grip of vehicles in certain cases
bool strongGrip1 = false;
bool strongGrip2 = false;
- if(FindPlayerVehicle() && this != FindPlayerVehicle() &&
+ if(FindPlayerVehicle() && this != FindPlayerVehicle() && FindPlayerPed()->m_pWanted->GetWantedLevel() > 3 &&
(AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE ||
- AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE)){
- if(FindPlayerSpeed().Magnitude() > 0.3f){
- strongGrip1 = true;
- if(FindPlayerSpeed().Magnitude() > 0.4f &&
- m_vecMoveSpeed.Magnitude() < 0.3f)
- strongGrip2 = true;
- else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f)
- strongGrip2 = true;
- }
+ AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE) &&
+ FindPlayerSpeed().Magnitude() > 0.3f){
+
+ strongGrip1 = true;
+ if(FindPlayerSpeed().Magnitude() > 0.4f &&
+ m_vecMoveSpeed.Magnitude() < 0.3f)
+ strongGrip2 = true;
+ else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f)
+ strongGrip2 = true;
}else if(GetModelIndex() == MI_RCBANDIT && GetStatus() != STATUS_PLAYER_REMOTE)
strongGrip1 = true;
diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp
index ab5ab622..bb613617 100644
--- a/src/vehicles/Bike.cpp
+++ b/src/vehicles/Bike.cpp
@@ -83,7 +83,7 @@ CBike::CBike(int32 id, uint8 CreatedBy)
case MI_SANCHEZ:
m_bikeAnimType = ASSOCGRP_BIKE_DIRT;
break;
- default: assert(0 && "invalid bike model ID");
+ default: m_bikeAnimType = ASSOCGRP_BIKE_STANDARD; //assert(0 && "invalid bike model ID"); // TODO
}
m_vehType = VEHICLE_TYPE_BIKE;
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 6ad23f8e..e3bcf096 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -32,15 +32,15 @@
#define INVALID_ORIENTATION (-9999.99f)
-float fShapeLength = 0.4f;
-float fShapeTime = 0.05f;
-float fRangeMult = 0.6f;
-float fTimeMult;
-
float CBoat::MAX_WAKE_LENGTH = 50.0f;
float CBoat::MIN_WAKE_INTERVAL = 2.0f;
float CBoat::WAKE_LIFETIME = 150.0f;
+float fShapeLength = 0.4f;
+float fShapeTime = 0.05f;
+float fRangeMult = 0.6f;
+float fTimeMult = 1.2f/CBoat::WAKE_LIFETIME;
+
CBoat *CBoat::apFrameWakeGeneratingBoats[4];
const uint32 CBoat::nSaveStructSize =
diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp
index ffcb80d0..ce254100 100644
--- a/src/vehicles/Cranes.cpp
+++ b/src/vehicles/Cranes.cpp
@@ -466,7 +466,7 @@ bool CCranes::DoesMilitaryCraneHaveThisOneAlready(uint32 mi)
case MI_FIRETRUCK: return (CarsCollectedMilitaryCrane & 1);
case MI_AMBULAN: return (CarsCollectedMilitaryCrane & 2);
case MI_ENFORCER: return (CarsCollectedMilitaryCrane & 4);
- case MI_FBIRANCH: return (CarsCollectedMilitaryCrane & 8);
+ case (uint32)MI_FBIRANCH: return (CarsCollectedMilitaryCrane & 8);
case MI_RHINO: return (CarsCollectedMilitaryCrane & 0x10);
case MI_BARRACKS: return (CarsCollectedMilitaryCrane & 0x20);
case MI_POLICE: return (CarsCollectedMilitaryCrane & 0x40);
@@ -481,7 +481,7 @@ void CCranes::RegisterCarForMilitaryCrane(uint32 mi)
case MI_FIRETRUCK: CarsCollectedMilitaryCrane |= 1; break;
case MI_AMBULAN: CarsCollectedMilitaryCrane |= 2; break;
case MI_ENFORCER: CarsCollectedMilitaryCrane |= 4; break;
- case MI_FBIRANCH: CarsCollectedMilitaryCrane |= 8; break;
+ case (uint32)MI_FBIRANCH: CarsCollectedMilitaryCrane |= 8; break;
case MI_RHINO: CarsCollectedMilitaryCrane |= 0x10; break;
case MI_BARRACKS: CarsCollectedMilitaryCrane |= 0x20; break;
case MI_POLICE: CarsCollectedMilitaryCrane |= 0x40; break;
diff --git a/src/vehicles/Door.cpp b/src/vehicles/Door.cpp
index c80965aa..72a30339 100644
--- a/src/vehicles/Door.cpp
+++ b/src/vehicles/Door.cpp
@@ -168,3 +168,58 @@ CTrainDoor::IsClosed(void)
{
return m_fPosn == RetTranslationWhenClosed();
}
+
+bool
+CFerryDoor::IsInUse(void)
+{
+ float translationDifference = m_fPrevPosn - m_fPosn;
+ m_fPrevPosn = m_fPosn;
+ return Abs(translationDifference) > 0.002f;
+}
+
+float
+CFerryDoor::RetTranslationWhenClosed(void)
+{
+ if(Abs(m_fClosedPosn) < Abs(m_fOpenPosn))
+ return m_fClosedPosn;
+ else
+ return m_fOpenPosn;
+}
+
+bool
+CFerryDoor::IsClosed(void)
+{
+ return m_fPosn == RetTranslationWhenClosed();
+}
+
+float
+CFerryDoor::RetTranslationWhenOpen(void)
+{
+ if(Abs(m_fClosedPosn) < Abs(m_fOpenPosn))
+ return m_fOpenPosn;
+ else
+ return m_fClosedPosn;
+}
+
+bool
+CFerryDoor::IsFullyOpen(void)
+{
+ if(Abs(m_fPosn) < Abs(RetTranslationWhenOpen()) - 0.5f)
+ return false;
+ return true;
+}
+
+void
+CFerryDoor::Open(float ratio)
+{
+ float open;
+
+ m_fPrevPosn = m_fPosn;
+ open = RetTranslationWhenOpen();
+ if(ratio < 1.0f){
+ m_fPosn = open*ratio;
+ }else{
+ m_nDoorState = DOORST_OPEN;
+ m_fPosn = open;
+ }
+} \ No newline at end of file
diff --git a/src/vehicles/Door.h b/src/vehicles/Door.h
index 567d3263..da5a3de0 100644
--- a/src/vehicles/Door.h
+++ b/src/vehicles/Door.h
@@ -67,3 +67,22 @@ public:
float RetTranslationWhenOpen(void);
void Open(float ratio);
};
+
+
+class CFerryDoor {
+private:
+ float m_fClosedPosn;
+ float m_fOpenPosn;
+ int8 m_nDirn;
+ int8 m_nAxis;
+ int8 m_nDoorState;
+ float m_fPosn;
+ float m_fPrevPosn;
+public:
+ bool IsInUse(void);
+ float RetTranslationWhenClosed(void);
+ float RetTranslationWhenOpen(void);
+ bool IsClosed(void);
+ bool IsFullyOpen(void);
+ void Open(float ratio);
+}; \ No newline at end of file