summaryrefslogtreecommitdiff
path: root/src/peds
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-10 12:25:30 +0300
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-10 12:25:30 +0300
commit2f7d2fa3ad697b6fa1896ac75f97c23f52ed843e (patch)
tree24ca53597b1ebf632b12fb315ef91e899807d47d /src/peds
parente4683a30741f9528aa0f62fc259660b66c53bbec (diff)
more car control
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/CopPed.cpp20
-rw-r--r--src/peds/CopPed.h3
-rw-r--r--src/peds/Population.cpp15
-rw-r--r--src/peds/Population.h4
4 files changed, 32 insertions, 10 deletions
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index 0c78279e..9e77ec72 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -17,7 +17,7 @@
#include "Renderer.h"
#include "Camera.h"
-CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
+CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
{
m_nCopType = copType;
switch (copType) {
@@ -57,7 +57,23 @@ CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
m_wepSkills = 32; /* TODO: what is this? seems unused */
m_wepAccuracy = 84;
break;
- default:
+ case COP_MIAMIVICE:
+ switch (modifier) {
+ case 0: SetModelIndex(MI_VICE1); break;
+ case 1: SetModelIndex(MI_VICE2); break;
+ case 2: SetModelIndex(MI_VICE3); break;
+ case 3: SetModelIndex(MI_VICE4); break;
+ case 4: SetModelIndex(MI_VICE5); break;
+ case 5: SetModelIndex(MI_VICE6); break;
+ case 6: SetModelIndex(MI_VICE7); break;
+ case 7: SetModelIndex(MI_VICE8); break;
+ default: assert(0); break;
+ }
+ GiveWeapon(WEAPONTYPE_UZI, 1000);
+ SetCurrentWeapon(WEAPONTYPE_UZI);
+ m_fArmour = 100.0f;
+ m_wepSkills = 176;
+ m_wepAccuracy = 76;
break;
}
m_bIsInPursuit = false;
diff --git a/src/peds/CopPed.h b/src/peds/CopPed.h
index d63aef06..c88dffcd 100644
--- a/src/peds/CopPed.h
+++ b/src/peds/CopPed.h
@@ -7,6 +7,7 @@ enum eCopType
COP_FBI = 1,
COP_SWAT = 2,
COP_ARMY = 3,
+ COP_MIAMIVICE = 5
};
class CCopPed : public CPed
@@ -24,7 +25,7 @@ public:
eCopType m_nCopType;
int8 field_1364;
- CCopPed(eCopType);
+ CCopPed(eCopType, int32 modifier = 0);
~CCopPed();
void ClearPursuit(void);
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 1d8c7f5d..2dc0bbab 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -460,7 +460,7 @@ CPopulation::PedCreationDistMultiplier()
}
CPed*
-CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
+CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors, int32 modifier)
{
switch (pedType) {
case PEDTYPE_CIVMALE:
@@ -480,7 +480,7 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors)
}
case PEDTYPE_COP:
{
- CCopPed *ped = new CCopPed((eCopType)miOrCopType);
+ CCopPed *ped = new CCopPed((eCopType)miOrCopType, modifier);
ped->SetPosition(coors);
ped->SetOrientation(0.0f, 0.0f, 0.0f);
CWorld::Add(ped);
@@ -713,9 +713,10 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
}
CPed*
-CPopulation::AddPedInCar(CVehicle* car)
+CPopulation::AddPedInCar(CVehicle* car, bool isPassenger)
{
int defaultModel = MI_MALE01;
+ int miamiViceIndex = 0;
bool imSureThatModelIsLoaded = true;
CVector coors = FindPlayerCoors();
CZoneInfo zoneInfo;
@@ -740,7 +741,6 @@ CPopulation::AddPedInCar(CVehicle* car)
break;
case MI_POLICE:
case MI_PREDATOR:
- case MI_VICECHEE: // TODO(MIAMI): proper model
preferredModel = COP_STREET;
pedType = PEDTYPE_COP;
break;
@@ -753,6 +753,11 @@ CPopulation::AddPedInCar(CVehicle* car)
preferredModel = COP_ARMY;
pedType = PEDTYPE_COP;
break;
+ case MI_VICECHEE: // TODO(MIAMI): figure out new structure of the function
+ preferredModel = COP_MIAMIVICE;
+ pedType = PEDTYPE_COP;
+ miamiViceIndex = (isPassenger ? 2 * CCarCtrl::MiamiViceCycle : 2 * CCarCtrl::MiamiViceCycle + 1);
+ break;
case MI_TAXI:
case MI_CABBIE:
case MI_ZEBRA:
@@ -799,7 +804,7 @@ CPopulation::AddPedInCar(CVehicle* car)
pedType = ((CPedModelInfo*)CModelInfo::GetModelInfo(defaultModel))->m_pedType;
}
- CPed *newPed = CPopulation::AddPed((ePedType)pedType, preferredModel, car->GetPosition());
+ CPed *newPed = CPopulation::AddPed((ePedType)pedType, preferredModel, car->GetPosition(), miamiViceIndex);
newPed->bUsesCollision = false;
// what??
diff --git a/src/peds/Population.h b/src/peds/Population.h
index 181c5809..20d6e567 100644
--- a/src/peds/Population.h
+++ b/src/peds/Population.h
@@ -70,7 +70,7 @@ public:
static void LoadPedGroups();
static void UpdatePedCount(ePedType, bool);
static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool);
- static CPed *AddPedInCar(CVehicle *car);
+ static CPed *AddPedInCar(CVehicle *car, bool isPassenger);
static bool IsPointInSafeZone(CVector *coors);
static void RemovePed(CPed *ent);
static int32 ChooseCivilianOccupation(int32);
@@ -80,7 +80,7 @@ public:
static void FindClosestZoneForCoors(CVector*, int*, eLevelName, eLevelName);
static void GeneratePedsAtStartOfGame();
static float PedCreationDistMultiplier();
- static CPed *AddPed(ePedType pedType, uint32 mi, CVector const &coors);
+ static CPed *AddPed(ePedType pedType, uint32 mi, CVector const &coors, int32 modifier = 0);
static void AddToPopulation(float, float, float, float);
static void ManagePopulation(void);
static void MoveCarsAndPedsOutOfAbandonedZones(void);