summaryrefslogtreecommitdiffstats
path: root/src/vehicles
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicles')
-rw-r--r--src/vehicles/Automobile.cpp26
-rw-r--r--src/vehicles/Automobile.h2
-rw-r--r--src/vehicles/Boat.cpp7
-rw-r--r--src/vehicles/Boat.h2
-rw-r--r--src/vehicles/Cranes.cpp3
-rw-r--r--src/vehicles/HandlingMgr.cpp86
-rw-r--r--src/vehicles/HandlingMgr.h1
-rw-r--r--src/vehicles/Heli.cpp18
-rw-r--r--src/vehicles/Heli.h1
-rw-r--r--src/vehicles/Plane.h1
-rw-r--r--src/vehicles/Train.cpp26
-rw-r--r--src/vehicles/Train.h1
-rw-r--r--src/vehicles/Vehicle.cpp45
-rw-r--r--src/vehicles/Vehicle.h20
14 files changed, 150 insertions, 89 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 60f17204..8ecea0ff 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_MIAMI_SPARROW || GetModelIndex() == MI_MIAMI_RCRAIDER){
+ }else if(GetModelIndex() == MI_SPARROW || GetModelIndex() == MI_RCRAIDER){
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);
@@ -229,10 +229,6 @@ CAutomobile::ProcessControl(void)
colModel = GetColModel();
bWarnedPeds = false;
- // skip if the collision isn't for the current level
- if(colModel->level > LEVEL_NONE && colModel->level != CCollision::ms_collisionInMemory)
- return;
-
// Improve grip of vehicles in certain cases
bool strongGrip1 = false;
bool strongGrip2 = false;
@@ -494,8 +490,7 @@ CAutomobile::ProcessControl(void)
TankControl();
BlowUpCarsInPath();
break;
- case MI_YARDIE:
- // beta also had esperanto here it seems
+ case MI_VOODOO:
HydraulicControl();
break;
default:
@@ -677,9 +672,9 @@ CAutomobile::ProcessControl(void)
acceleration /= m_fForceMultiplier;
// unused
- if(GetModelIndex() == MI_MIAMI_RCBARON ||
- GetModelIndex() == MI_MIAMI_RCRAIDER ||
- GetModelIndex() == MI_MIAMI_SPARROW)
+ if(GetModelIndex() == MI_RCBARON ||
+ GetModelIndex() == MI_RCRAIDER ||
+ GetModelIndex() == MI_SPARROW)
acceleration = 0.0f;
brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep();
@@ -1005,7 +1000,7 @@ CAutomobile::ProcessControl(void)
m_bSirenOrAlarm = !m_bSirenOrAlarm;
}else
m_nCarHornTimer = 0;
- }else if(GetModelIndex() != MI_YARDIE && !CVehicle::bCheat3){
+ }else if(GetModelIndex() != MI_VOODOO && !CVehicle::bCheat3){
if(Pads[0].GetHorn())
m_nCarHornTimer = 1;
else
@@ -1016,7 +1011,7 @@ CAutomobile::ProcessControl(void)
// Flying
if(GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && GetStatus() != STATUS_PHYSICS){
- if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW)
+ if(GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_SPARROW)
m_aWheelSpeed[0] = Max(m_aWheelSpeed[0]-0.0005f, 0.0f);
}else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) &&
m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
@@ -1026,9 +1021,9 @@ CAutomobile::ProcessControl(void)
else
#endif
FlyingControl(FLIGHT_MODEL_DODO);
- }else if(GetModelIndex() == MI_MIAMI_RCBARON){
+ }else if(GetModelIndex() == MI_RCBARON){
FlyingControl(FLIGHT_MODEL_RCPLANE);
- }else if(GetModelIndex() == MI_MIAMI_RCRAIDER || GetModelIndex() == MI_MIAMI_SPARROW || bAllCarCheat){
+ }else if(GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_SPARROW || bAllCarCheat){
#ifdef ALLCARSHELI_CHEAT
if (bAllCarCheat)
FlyingControl(FLIGHT_MODEL_HELI);
@@ -1595,7 +1590,8 @@ CAutomobile::PreRender(void)
case MI_TAXI:
case MI_CABBIE:
- case MI_BORGNINE:
+ case MI_ZEBRA:
+ case MI_KAUFMAN:
if(bTaxiLight){
CVector pos = GetPosition() + GetUp()*0.95f;
CCoronas::RegisterCorona((uintptr)this + 21,
diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h
index 041302bf..0356a9f2 100644
--- a/src/vehicles/Automobile.h
+++ b/src/vehicles/Automobile.h
@@ -197,8 +197,6 @@ public:
static void SetAllTaxiLights(bool set);
};
-static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error");
-
inline uint8 GetCarDoorFlag(int32 carnode) {
switch (carnode) {
case CAR_DOOR_LF:
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 348f2732..87b8a212 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -109,9 +109,6 @@ CBoat::GetComponentWorldPosition(int32 component, CVector &pos)
void
CBoat::ProcessControl(void)
{
- if(m_nZoneLevel > LEVEL_NONE && m_nZoneLevel != CCollision::ms_collisionInMemory)
- return;
-
bool onLand = m_fDamageImpulse > 0.0f && m_vecDamageNormal.z > 0.1f;
PruneWakeTrail();
@@ -290,8 +287,8 @@ CBoat::ProcessControl(void)
AddWakePoint(GetPosition());
float steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward());
- if (GetModelIndex() == MI_GHOST)
- steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward())*0.3f;
+// if (GetModelIndex() == MI_GHOST)
+// steerFactor = 1.0f - DotProduct(m_vecMoveSpeed, GetForward())*0.3f;
if(steerFactor < 0.0f) steerFactor = 0.0f;
CVector propeller(0.0f, -pHandling->Dimension.y*m_fPropellerY, -pHandling->Dimension.z*m_fPropellerZ);
diff --git a/src/vehicles/Boat.h b/src/vehicles/Boat.h
index 70407ab9..cde5de84 100644
--- a/src/vehicles/Boat.h
+++ b/src/vehicles/Boat.h
@@ -72,8 +72,6 @@ public:
};
-static_assert(sizeof(CBoat) == 0x484, "CBoat: error");
-
extern float MAX_WAKE_LENGTH;
extern float MIN_WAKE_INTERVAL;
extern float WAKE_LIFETIME; \ No newline at end of file
diff --git a/src/vehicles/Cranes.cpp b/src/vehicles/Cranes.cpp
index 3ef11302..e1f46f7d 100644
--- a/src/vehicles/Cranes.cpp
+++ b/src/vehicles/Cranes.cpp
@@ -57,7 +57,8 @@ void CCranes::InitCranes(void)
}
}
}
- for (CPtrNode* pNode = CWorld::GetBigBuildingList(LEVEL_INDUSTRIAL).first; pNode; pNode = pNode->next) {
+ // TODO(MIAMI): LEVEL_MAINLAND just so it compiles
+ for (CPtrNode* pNode = CWorld::GetBigBuildingList(LEVEL_MAINLAND).first; pNode; pNode = pNode->next) {
CEntity* pEntity = (CEntity*)pNode->item;
if (MODELID_CRANE_1 == pEntity->GetModelIndex() ||
MODELID_CRANE_2 == pEntity->GetModelIndex() ||
diff --git a/src/vehicles/HandlingMgr.cpp b/src/vehicles/HandlingMgr.cpp
index 3ac0da38..cc6428e1 100644
--- a/src/vehicles/HandlingMgr.cpp
+++ b/src/vehicles/HandlingMgr.cpp
@@ -21,7 +21,6 @@ const char VehicleNames[NUMHANDLINGS][14] = {
"STRETCH",
"MANANA",
"INFERNUS",
- "BLISTA",
"PONY",
"MULE",
"CHEETAH",
@@ -38,7 +37,6 @@ const char VehicleNames[NUMHANDLINGS][14] = {
"ENFORCER",
"SECURICA",
"BANSHEE",
- "PREDATOR",
"BUS",
"RHINO",
"BARRACKS",
@@ -50,22 +48,73 @@ const char VehicleNames[NUMHANDLINGS][14] = {
"STALLION",
"RUMPO",
"RCBANDIT",
- "BELLYUP",
- "MRWONGS",
"MAFIA",
- "YARDIE",
- "YAKUZA",
- "DIABLOS",
- "COLUMB",
- "HOODS",
"AIRTRAIN",
"DEADDODO",
- "SPEEDER",
- "REEFER",
- "PANLANT",
"FLATBED",
"YANKEE",
- "BORGNINE"
+ "GOLFCART",
+ "VOODOO",
+ "WASHING",
+ "CUBAN",
+ "ROMERO",
+ "PACKER",
+ "ADMIRAL",
+ "GANGBUR",
+ "ZEBRA",
+ "TOPFUN",
+ "GLENDALE",
+ "OCEANIC",
+ "HERMES",
+ "SABRE1",
+ "SABRETUR",
+ "PHEONIX",
+ "WALTON",
+ "REGINA",
+ "COMET",
+ "DELUXO",
+ "BURRITO",
+ "SPAND",
+ "BAGGAGE",
+ "KAUFMAN",
+ "RANCHER",
+ "FBIRANCH",
+ "VIRGO",
+ "GREENWOO",
+ "HOTRING",
+ "SANDKING",
+ "BLISTAC",
+ "BOXVILLE",
+ "BENSON",
+ "DESPERAD",
+ "LOVEFIST",
+ "BLOODRA",
+ "BLOODRB",
+ "BIKE",
+ "MOPED",
+ "DIRTBIKE",
+ "ANGEL",
+ "FREEWAY",
+ "PREDATOR",
+ "SPEEDER",
+ "REEFER",
+ "RIO",
+ "SQUALO",
+ "TROPIC",
+ "COASTGRD",
+ "DINGHY",
+ "MARQUIS",
+ "CUPBOAT",
+ "SEAPLANE",
+ "SPARROW",
+ "SEASPAR",
+ "MAVERICK",
+ "COASTMAV",
+ "POLMAV",
+ "HUNTER",
+ "RCBARON",
+ "RCGOBLIN",
+ "RCCOPTER"
};
cHandlingDataMgr::cHandlingDataMgr(void)
@@ -117,7 +166,9 @@ cHandlingDataMgr::LoadHandlingData(void)
// yeah, this is kinda crappy
if(strncmp(line, ";the end", 9) == 0)
keepGoing = 0;
- else if(line[0] != ';'){
+// else if(line[0] != ';'){
+// TODO(MIAMI): read boat, bike, flying values
+ else if(line[0] != ';' && line[0] != '%' && line[0] != '!' && line[0] != '$'){
field = 0;
strcpy(delim, " \t");
// FIX: game seems to use a do-while loop here
@@ -158,11 +209,14 @@ cHandlingDataMgr::LoadHandlingData(void)
case 27: handling->fSuspensionLowerLimit = strtod(word, nil); break;
case 28: handling->fSuspensionBias = strtod(word, nil); break;
case 29:
+ // TODO(MIAMI): suspension anti-dive multiplier
+ break;
+ case 30:
sscanf(word, "%x", &handling->Flags);
handling->Transmission.Flags = handling->Flags;
break;
- case 30: handling->FrontLights = atoi(word); break;
- case 31: handling->RearLights = atoi(word); break;
+ case 31: handling->FrontLights = atoi(word); break;
+ case 32: handling->RearLights = atoi(word); break;
}
field++;
}
diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h
index 398a415f..905ed7b8 100644
--- a/src/vehicles/HandlingMgr.h
+++ b/src/vehicles/HandlingMgr.h
@@ -139,5 +139,4 @@ public:
bool HasRearWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'R'; }
bool HasFrontWheelDrive(eHandlingId id) { return HandlingData[id].Transmission.nDriveType == 'F'; }
};
-VALIDATE_SIZE(cHandlingDataMgr, 0x3030);
extern cHandlingDataMgr mod_HandlingManager;
diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp
index e4cd5883..d9c364d2 100644
--- a/src/vehicles/Heli.cpp
+++ b/src/vehicles/Heli.cpp
@@ -776,7 +776,6 @@ CHeli::InitHelis(void)
for(i = 0; i < NUM_HELIS; i++)
pHelis[i] = nil;
- ((CVehicleModelInfo*)CModelInfo::GetModelInfo(MI_ESCAPE))->SetColModel(&CTempColModels::ms_colModelPed1);
((CVehicleModelInfo*)CModelInfo::GetModelInfo(MI_CHOPPER))->SetColModel(&CTempColModels::ms_colModelPed1);
}
@@ -787,10 +786,7 @@ GenerateHeli(bool catalina)
CVector heliPos;
int i;
- if(catalina)
- heli = new CHeli(MI_ESCAPE, PERMANENT_VEHICLE);
- else
- heli = new CHeli(MI_CHOPPER, PERMANENT_VEHICLE);
+ heli = new CHeli(MI_CHOPPER, PERMANENT_VEHICLE);
if(catalina)
heliPos = CVector(-224.0f, 201.0f, 83.0f);
@@ -867,18 +863,6 @@ CHeli::UpdateHelis(void)
pHelis[HELI_SCRIPT]->m_heliStatus = HELI_STATUS_FLY_AWAY;
}
- // Handle Catalina's heli
- if(CatalinaHeliOn){
- if(CStreaming::HasModelLoaded(MI_ESCAPE) && pHelis[HELI_CATALINA] == nil){
- pHelis[HELI_CATALINA] = GenerateHeli(true);
- pHelis[HELI_CATALINA]->m_heliType = HELI_TYPE_CATALINA;
- }else
- CStreaming::RequestModel(MI_ESCAPE, STREAMFLAGS_DONT_REMOVE);
- }else{
- if(pHelis[HELI_CATALINA])
- pHelis[HELI_CATALINA]->m_heliStatus = HELI_STATUS_FLY_AWAY;
- }
-
// Delete helis that we no longer need
for(i = 0; i < NUM_HELIS; i++)
if(pHelis[i] && pHelis[i]->m_heliStatus == HELI_STATUS_FLY_AWAY && pHelis[i]->GetPosition().z > 150.0f){
diff --git a/src/vehicles/Heli.h b/src/vehicles/Heli.h
index 39e4cbcf..a8f604aa 100644
--- a/src/vehicles/Heli.h
+++ b/src/vehicles/Heli.h
@@ -95,4 +95,3 @@ public:
static void ActivateHeli(bool activate);
};
-static_assert(sizeof(CHeli) == 0x33C, "CHeli: error");
diff --git a/src/vehicles/Plane.h b/src/vehicles/Plane.h
index 79738858..6fa6776b 100644
--- a/src/vehicles/Plane.h
+++ b/src/vehicles/Plane.h
@@ -63,7 +63,6 @@ public:
static bool HasCesnaBeenDestroyed(void);
static bool HasDropOffCesnaBeenShotDown(void);
};
-static_assert(sizeof(CPlane) == 0x29C, "CPlane: error");
extern float LandingPoint;
extern float TakeOffPoint;
diff --git a/src/vehicles/Train.cpp b/src/vehicles/Train.cpp
index 7831a0c8..fef712e6 100644
--- a/src/vehicles/Train.cpp
+++ b/src/vehicles/Train.cpp
@@ -38,6 +38,7 @@ CVector CTrain::aStationCoors_S[4];
CTrain::CTrain(int32 id, uint8 CreatedBy)
: CVehicle(CreatedBy)
{
+#ifdef GTA_TRAIN
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(id);
m_vehType = VEHICLE_TYPE_TRAIN;
pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId);
@@ -60,22 +61,28 @@ CTrain::CTrain(int32 id, uint8 CreatedBy)
bUsesCollision = true;
SetStatus(STATUS_TRAIN_MOVING);
+#else
+ assert(0 && "No trains in this game");
+#endif
}
void
CTrain::SetModelIndex(uint32 id)
{
+#ifdef GTA_TRAIN
int i;
CVehicle::SetModelIndex(id);
for(i = 0; i < NUM_TRAIN_NODES; i++)
m_aTrainNodes[i] = nil;
CClumpModelInfo::FillFrameArray(GetClump(), m_aTrainNodes);
+#endif
}
void
CTrain::ProcessControl(void)
{
+#ifdef GTA_TRAIN
if(gbModelViewer || m_isFarAway && (CTimer::GetFrameCounter() + m_nWagonId) & 0xF)
return;
@@ -278,11 +285,13 @@ CTrain::ProcessControl(void)
TrainHitStuff(s->m_lists[ENTITYLIST_PEDS_OVERLAP]);
}
}
+#endif GTA_TRAIN
}
void
CTrain::PreRender(void)
{
+#ifdef GTA_TRAIN
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex());
if(m_bIsFirstWagon){
@@ -342,17 +351,21 @@ CTrain::PreRender(void)
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_ON,
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f);
}
+#endif
}
void
CTrain::Render(void)
{
+#ifdef GTA_TRAIN
CEntity::Render();
+#endif
}
void
CTrain::TrainHitStuff(CPtrList &list)
{
+#ifdef GTA_TRAIN
CPtrNode *node;
CPhysical *phys;
@@ -361,11 +374,13 @@ CTrain::TrainHitStuff(CPtrList &list)
if(phys != this && Abs(this->GetPosition().z - phys->GetPosition().z) < 1.5f)
phys->bHitByTrain = true;
}
+#endif
}
void
CTrain::AddPassenger(CPed *ped)
{
+#ifdef GTA_TRAIN
int i = ped->m_vehEnterType;
if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){
pPassengers[i] = ped;
@@ -378,11 +393,13 @@ CTrain::AddPassenger(CPed *ped)
return;
}
}
+#endif
}
void
CTrain::OpenTrainDoor(float ratio)
{
+#ifdef GTA_TRAIN
if(m_rwObject == nil)
return;
@@ -407,6 +424,7 @@ CTrain::OpenTrainDoor(float ratio)
doorL.UpdateRW();
doorR.UpdateRW();
+#endif
}
@@ -414,6 +432,7 @@ CTrain::OpenTrainDoor(float ratio)
void
CTrain::InitTrains(void)
{
+#ifdef GTA_TRAIN
int i, j;
CTrain *train;
@@ -480,21 +499,25 @@ CTrain::InitTrains(void)
for(j = 0; pTrackNodes_S[j].t < StationDist_S[i]; j++);
aStationCoors_S[i] = pTrackNodes_S[j].p;
}
+#endif
}
void
CTrain::Shutdown(void)
{
+#ifdef GTA_TRAIN
delete[] pTrackNodes;
delete[] pTrackNodes_S;
pTrackNodes = nil;
pTrackNodes_S = nil;
+#endif
}
void
CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *numNodes, int32 numStations, float *stationDists,
float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail)
{
+#ifdef GTA_TRAIN
bool readingFile = false;
int bp, lp;
int i, tmp;
@@ -616,6 +639,7 @@ CTrain::ReadAndInterpretTrackFile(char *filename, CTrainNode **nodes, int16 *num
// end
interpLines[j].time = *totalDuration;
+#endif
}
void
@@ -627,6 +651,7 @@ ProcessTrainAnnouncements(void)
void
CTrain::UpdateTrains(void)
{
+#ifdef GTA_TRAIN
int i, j;
uint32 time;
float t, deltaT;
@@ -690,4 +715,5 @@ CTrain::UpdateTrains(void)
// time offset for each train
time += 0x40000/4;
}
+#endif
}
diff --git a/src/vehicles/Train.h b/src/vehicles/Train.h
index bf541250..e20a08fd 100644
--- a/src/vehicles/Train.h
+++ b/src/vehicles/Train.h
@@ -91,4 +91,3 @@ public:
float *totalLength, float *totalDuration, CTrainInterpolationLine *interpLines, bool rightRail);
static void UpdateTrains(void);
};
-static_assert(sizeof(CTrain) == 0x2E4, "CTrain: error");
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 5dc7bc72..5fdbde06 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -99,6 +99,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
m_bSirenOrAlarm = 0;
m_nCarHornTimer = 0;
m_nCarHornPattern = 0;
+ bParking = false;
m_nAlarmState = 0;
m_nDoorLock = CARLOCK_UNLOCKED;
m_nLastWeaponDamage = -1;
@@ -118,6 +119,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
AutoPilot.m_bStayInCurrentLevel = false;
AutoPilot.m_bIgnorePathfinding = false;
+ AutoPilot.m_nSwitchDistance = 20;
}
CVehicle::~CVehicle()
@@ -383,7 +385,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
case FLIGHT_MODEL_HELI:
{
CVector vecMoveResistance;
- if (GetModelIndex() == MI_MIAMI_SPARROW)
+ if (GetModelIndex() == MI_SPARROW)
vecMoveResistance = vecHeliMoveRes;
else
vecMoveResistance = vecRCHeliMoveRes;
@@ -434,7 +436,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
CVector vecResistance;
- if (GetModelIndex() == MI_MIAMI_SPARROW)
+ if (GetModelIndex() == MI_SPARROW)
vecResistance = vecHeliResistance;
else
vecResistance = vecRCHeliResistance;
@@ -873,24 +875,7 @@ CVehicle::IsVehicleNormal(void)
{
if (!pDriver || m_nNumPassengers != 0 || GetStatus() == STATUS_WRECKED)
return false;
- switch (GetModelIndex()){
- case MI_FIRETRUCK:
- case MI_AMBULAN:
- case MI_TAXI:
- case MI_POLICE:
- case MI_ENFORCER:
- case MI_BUS:
- case MI_RHINO:
- case MI_BARRACKS:
- case MI_DODO:
- case MI_COACH:
- case MI_CABBIE:
- case MI_RCBANDIT:
- case MI_BORGNINE:
- return false;
- default:
- return true;
- }
+ return GetModelInfo()->m_vehicleClass != -1;
}
bool
@@ -1089,7 +1074,7 @@ CVehicle::SetDriver(CPed *driver)
driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5);
else if(GetModelIndex() == MI_ENFORCER)
driver->m_fArmour = Max(driver->m_fArmour, 100.0f);
- else if(GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE)
+ else if(GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA) // TODO(MIAMI): check zebra
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
bFreebies = false;
}
@@ -1347,3 +1332,21 @@ CVehicle::Load(uint8*& buf)
SkipSaveBuf(buf, 99);
}
#endif
+
+eVehicleAppearance
+//--MIAMI: TODO, implement VC version, appearance != type
+// This would work for cars, boats and bikes but not for planes and helis
+CVehicle::GetVehicleAppearance(void)
+{
+ if (IsCar())
+ return VEHICLE_CAR;
+ if (IsBoat())
+ return VEHICLE_BOAT;
+ if (IsBike())
+ return VEHICLE_BIKE;
+ if (IsPlane())
+ return VEHICLE_PLANE;
+ if (IsHeli())
+ return VEHICLE_HELI;
+ return VEHICLE_NONE;
+}
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index 110ff97c..66dfebb1 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -109,6 +109,16 @@ enum eFlightModel
FLIGHT_MODEL_SEAPLANE
};
+enum eVehicleAppearance
+{
+ VEHICLE_NONE,
+ VEHICLE_CAR,
+ VEHICLE_BIKE,
+ VEHICLE_HELI,
+ VEHICLE_BOAT,
+ VEHICLE_PLANE,
+};
+
// Or Weapon.h?
void FireOneInstantHitRound(CVector *shotSource, CVector *shotTarget, int32 damage);
@@ -172,6 +182,8 @@ public:
uint8 bIsCarParkVehicle : 1; // Car has been created using the special CAR_PARK script command
uint8 bHasAlreadyBeenRecorded : 1; // Used for replays
+ uint8 bParking : 1;
+
int8 m_numPedsUseItAsCover;
uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default)
int8 m_nPacManPickupsCarried;
@@ -236,6 +248,7 @@ public:
virtual void Load(uint8*& buf);
#endif
+ eVehicleAppearance GetVehicleAppearance(void);
bool IsCar(void) { return m_vehType == VEHICLE_TYPE_CAR; }
bool IsBoat(void) { return m_vehType == VEHICLE_TYPE_BOAT; }
bool IsTrain(void) { return m_vehType == VEHICLE_TYPE_TRAIN; }
@@ -277,7 +290,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_BORGNINE; }
+ bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA || GetModelIndex() == MI_KAUFMAN; }
AnimationId GetDriverAnim(void) { return IsCar() && bLowVehicle ? ANIM_CAR_LSIT : (IsBoat() && GetModelIndex() != MI_SPEEDER ? ANIM_DRIVE_BOAT : ANIM_CAR_SIT); }
static bool bWheelsOnlyCheat;
@@ -291,9 +304,4 @@ public:
static bool m_bDisableMouseSteering;
};
-static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");
-static_assert(offsetof(CVehicle, m_pCurGroundEntity) == 0x1E0, "CVehicle: error");
-static_assert(offsetof(CVehicle, m_nAlarmState) == 0x1A0, "CVehicle: error");
-static_assert(offsetof(CVehicle, m_nLastWeaponDamage) == 0x228, "CVehicle: error");
-
void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle);