summaryrefslogtreecommitdiffstats
path: root/src/entities
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/entities/Automobile.h63
-rw-r--r--src/entities/Ped.cpp34
-rw-r--r--src/entities/Physical.cpp8
-rw-r--r--src/entities/Vehicle.h120
4 files changed, 109 insertions, 116 deletions
diff --git a/src/entities/Automobile.h b/src/entities/Automobile.h
index 64e411ce..b6617f4b 100644
--- a/src/entities/Automobile.h
+++ b/src/entities/Automobile.h
@@ -1,26 +1,61 @@
#pragma once
#include "DamageManager.h"
-#include "Door.h"
-#include "RwHelper.h"
#include "Vehicle.h"
+struct CDoor
+{
+ float m_fAngleWhenOpened;
+ float m_fAngleWhenClosed;
+ char field_8;
+ char field_9;
+ char field_10;
+ char field_11;
+ float m_fAngle;
+ float m_fPreviousAngle;
+ float m_fAngularVelocity;
+ CVector m_vecVelocity;
+};
+
class CAutomobile : public CVehicle
{
public:
// 0x288
- CDamageManager m_DamageManager;
- CDoor m_aDoors[6];
- RwFrame *m_apModelNodes[20];
- uint8 stuff1[160];
- float m_afWheelSuspDist[4];
- uint8 stuff2[44];
- float m_afWheelRotation[4];
- uint8 stuff3[200];
+ CDamageManager Damage;
+ CDoor Doors[6];
+ RwFrame *m_aCarNodes[NUM_CAR_NODES];
+ CColPoint m_aWheelColPoints[4];
+ float m_aWheelDist[4];
+ float m_aWheelDist_2[4];
+ float m_aWheelSkidThing[4];
+ int field_49C;
+ bool m_aWheelSkidmarkMuddy[4];
+ bool m_aWheelSkidmarkBloody[4];
+ float m_aWheelRotation[4];
+ float m_aWheelPosition[4];
+ float m_aWheelSpeed[4];
+ uint8 stuff3[12];
+ uint32 m_nBusDoorTimerEnd;
+ uint32 m_nBusDoorTimerStart;
+ float m_aSuspensionRange[4];
+ float m_aSuspensionLineLength[4];
+ float m_fHeightAboveRoad;
+ float m_fImprovedHandling;
+ uint8 stuff6[32];
+ CPhysical *m_aGroundPhysical[4]; // physicals touching wheels
+ CVector m_aGroundOffset[4]; // from ground object to colpoint
+ CEntity *m_pBlowUpEntity;
+ float m_weaponThingA; // TODO
+ float m_weaponThingB; // TODO
float m_fCarGunLR;
- uint8 stuff4[13];
- uint8 m_nDriveWheelsOnGround;
- uint8 stuff5[22];
+ float m_fCarGunUD;
+ float m_fWindScreenRotation;
+ uint8 stuff4[4];
+ uint8 m_nWheelsOnGround_2;
+ uint8 m_nWheelsOnGround;
+ uint8 m_nWheelsOnGroundPrev;
+ uint8 stuff5[5];
+ int32 m_aWheelState[4];
CAutomobile(int, uint8);
CAutomobile* ctor(int, uint8);
@@ -30,4 +65,4 @@ public:
void dtor() { this->CAutomobile::~CAutomobile(); }
};
static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error");
-static_assert(offsetof(CAutomobile, m_afWheelSuspDist) == 0x46C, "CAutomobile: error");
+static_assert(offsetof(CAutomobile, m_aWheelDist) == 0x46C, "CAutomobile: error");
diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp
index ba0e3088..055ea3fb 100644
--- a/src/entities/Ped.cpp
+++ b/src/entities/Ped.cpp
@@ -558,11 +558,11 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround)
if (currentPedState == PED_DEAD) {
foundDead = 1;
if (!deadPed)
- deadPed = (CPed*)currentPed;
+ deadPed = currentPed;
} else if (!currentPed->IsPedHeadAbovePos(-0.6f)) {
foundOnTheFloor = 1;
if (!pedOnTheFloor)
- pedOnTheFloor = (CPed*)currentPed;
+ pedOnTheFloor = currentPed;
}
}
} else if ((distance >= 0.8f || angleDiff >= DEGTORAD(75.0f))
@@ -573,11 +573,11 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround)
if (angleDiff < DEGTORAD(75.0f)) {
foundBelow = 1;
if (!pedBelow)
- pedBelow = (CPed*)currentPed;
+ pedBelow = currentPed;
}
} else {
foundBelow = 1;
- pedBelow = (CPed*)currentPed;
+ pedBelow = currentPed;
break;
}
}
@@ -598,7 +598,7 @@ CheckForPedsOnGroundToAttack(CPlayerPed *player, CPed **pedOnGround)
}
if (pedOnGround)
- * pedOnGround = (CPed*)currentPed;
+ * pedOnGround = currentPed;
return stateToReturn;
}
@@ -1370,7 +1370,7 @@ CPed::RestartNonPartialAnims(void)
{
CAnimBlendAssociation *assoc;
- for (assoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)m_rwObject); !assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) {
+ for (assoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)m_rwObject); assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) {
if (!assoc->IsPartial())
assoc->flags |= ASSOC_RUNNING;
}
@@ -1680,7 +1680,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
float pedZSpeedOnExit = m_vecMoveSpeed.z - 0.008f * CTimer::GetTimeStep();
// If we're not in ground at next step, apply animation
- if (neededPos.z + pedZSpeedOnExit > autoZPos.z) {
+ if (neededPos.z + pedZSpeedOnExit >= autoZPos.z) {
m_vecMoveSpeed.z = pedZSpeedOnExit;
ApplyMoveSpeed();
// Removing below line breaks the animation
@@ -1742,9 +1742,9 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
neededPos -= timeUntilStateChange * m_vecOffsetSeek;
}
- if (limitedAngle >= PI + m_fRotationCur) {
+ if (limitedAngle > PI + m_fRotationCur) {
limitedAngle -= 2 * PI;
- } else if (limitedAngle <= m_fRotationCur - PI) {
+ } else if (limitedAngle < m_fRotationCur - PI) {
limitedAngle += 2 * PI;
}
m_fRotationCur -= (m_fRotationCur - limitedAngle) * (1.0f - timeUntilStateChange);
@@ -2376,7 +2376,7 @@ CPed::SetLeader(CEntity *leader)
m_leader = (CPed*)leader;
if(m_leader)
- m_leader->RegisterReference((CEntity **)m_leader);
+ m_leader->RegisterReference((CEntity **)&m_leader);
}
void
@@ -2458,9 +2458,9 @@ CPed::SetObjective(eObjective newObj, void *entity)
m_ped_flagD20 = false;
m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f);
m_pedInObjective = (CPed*)entity;
- m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective);
+ m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
m_pLookTarget = (CEntity*)entity;
- m_pLookTarget->RegisterReference((CEntity**)m_pLookTarget);
+ m_pLookTarget->RegisterReference((CEntity**)&m_pLookTarget);
return;
case OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE:
case OBJECTIVE_FLEE_CHAR_ON_FOOT_ALWAYS:
@@ -2468,17 +2468,17 @@ CPed::SetObjective(eObjective newObj, void *entity)
case OBJECTIVE_FIGHT_CHAR:
m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f);
m_pedInObjective = (CPed*)entity;
- m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective);
+ m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
return;
case OBJECTIVE_FOLLOW_PED_IN_FORMATION:
m_pedInObjective = (CPed*)entity;
- m_pedInObjective->RegisterReference((CEntity**)m_pedInObjective);
+ m_pedInObjective->RegisterReference((CEntity**)&m_pedInObjective);
m_pedFormation = 1;
return;
case OBJECTIVE_LEAVE_VEHICLE:
case OBJECTIVE_FLEE_CAR:
m_carInObjective = (CVehicle*)entity;
- m_carInObjective->RegisterReference((CEntity **)m_carInObjective);
+ m_carInObjective->RegisterReference((CEntity **)&m_carInObjective);
if (!m_carInObjective->bIsBus || m_leaveCarTimer)
return;
break;
@@ -2496,9 +2496,9 @@ CPed::SetObjective(eObjective newObj, void *entity)
case OBJECTIVE_SOLICIT:
case OBJECTIVE_BUY_ICE_CREAM:
m_carInObjective = (CVehicle*)entity;
- m_carInObjective->RegisterReference((CEntity**)m_carInObjective);
+ m_carInObjective->RegisterReference((CEntity**)&m_carInObjective);
m_pSeekTarget = m_carInObjective;
- m_pSeekTarget->RegisterReference((CEntity**)m_pSeekTarget);
+ m_pSeekTarget->RegisterReference((CEntity**)&m_pSeekTarget);
m_vecSeekVehicle = CVector(0.0f, 0.0f, 0.0f);
if (newObj == OBJECTIVE_SOLICIT) {
m_objectiveTimer = CTimer::GetTimeInMilliseconds() + 10000;
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index b570efd9..14891cd9 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -1858,10 +1858,10 @@ CPhysical::ProcessCollision(void)
CVehicle *veh = (CVehicle*)this;
if(veh->m_vehType == VEHICLE_TYPE_CAR){
CAutomobile *car = (CAutomobile*)this;
- car->m_afWheelSuspDist[0] = 1.0f;
- car->m_afWheelSuspDist[1] = 1.0f;
- car->m_afWheelSuspDist[2] = 1.0f;
- car->m_afWheelSuspDist[3] = 1.0f;
+ car->m_aWheelDist[0] = 1.0f;
+ car->m_aWheelDist[1] = 1.0f;
+ car->m_aWheelDist[2] = 1.0f;
+ car->m_aWheelDist[3] = 1.0f;
}else if(veh->m_vehType == VEHICLE_TYPE_BIKE){
assert(0 && "TODO - but unused");
}
diff --git a/src/entities/Vehicle.h b/src/entities/Vehicle.h
index eb5275ad..39a56fe0 100644
--- a/src/entities/Vehicle.h
+++ b/src/entities/Vehicle.h
@@ -14,14 +14,6 @@ enum {
PERMANENT_VEHICLE = 4,
};
-
-enum {
- GETTING_IN_OUT_FL = 1,
- GETTING_IN_OUT_RL = 2,
- GETTING_IN_OUT_FR = 4,
- GETTING_IN_OUT_RR = 8
-};
-
enum eCarLock {
CARLOCK_NOT_USED,
CARLOCK_UNLOCKED,
@@ -33,82 +25,48 @@ enum eCarLock {
CARLOCK_SKIP_SHUT_DOORS
};
-// TODO: where is this used? Is Vehicle.h the right file?
-enum eVehicleModel
+
+enum eCarNodes
{
- LANDSTAL,
- IDAHO,
- STINGER,
- LINERUN,
- PEREN,
- SENTINEL,
- PATRIOT,
- FIRETRUK,
- TRASH,
- STRETCH,
- MANANA,
- INFERNUS,
- BLISTA,
- PONY,
- MULE,
- CHEETAH,
- AMBULAN,
- FBICAR,
- MOONBEAM,
- ESPERANT,
- TAXI,
- KURUMA,
- BOBCAT,
- MRWHOOP,
- BFINJECT,
- CORPSE,
- POLICE,
- ENFORCER,
- SECURICA,
- BANSHEE,
- PREDATOR,
- BUS,
- RHINO,
- BARRACKS,
- TRAIN,
- CHOPPER,
- DODO,
- COACH,
- CABBIE,
- STALLION,
- RUMPO,
- RCBANDIT,
- BELLYUP,
- MRWONGS,
- MAFIA,
- YARDIE,
- YAKUZA,
- DIABLOS,
- COLUMB,
- HOODS,
- AIRTRAIN,
- DEADDODO,
- SPEEDER,
- REEFER,
- PANLANT,
- FLATBED,
- YANKEE,
- ESCAPE,
- BORGNINE,
- TOYZ,
- GHOST,
- CAR151,
- CAR152,
- CAR153,
- CAR154,
- CAR155,
- CAR156,
- CAR157,
- CAR158,
- CAR159,
+ 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 eDoors {
+enum
+{
+ CAR_POS_HEADLIGHTS,
+ CAR_POS_TAILLIGHTS,
+ CAR_POS_FRONTSEAT,
+ CAR_POS_BACKSEAT,
+ CAR_POS_EXHAUST = 9,
+};
+
+enum eDoors
+{
+ DOOR_BONNET = 0,
+ DOOR_BOOT,
+ DOOR_FRONT_LEFT,
+ DOOR_FRONT_RIGHT,
+ DOOR_REAR_LEFT,
+ DOOR_REAR_RIGHT
};
class CVehicle : public CPhysical