summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/CivilianPed.cpp2
-rw-r--r--src/peds/CopPed.cpp58
-rw-r--r--src/peds/CopPed.h1
-rw-r--r--src/peds/EmergencyPed.cpp23
-rw-r--r--src/peds/EmergencyPed.h10
-rw-r--r--src/peds/Ped.cpp5
-rw-r--r--src/peds/Ped.h5
7 files changed, 100 insertions, 4 deletions
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp
index cf8a0580..717eaa3f 100644
--- a/src/peds/CivilianPed.cpp
+++ b/src/peds/CivilianPed.cpp
@@ -6,7 +6,7 @@ WRAPPER void CCivilianPed::ProcessControl(void) { EAXJMP(0x4BFFE0); }
CCivilianPed::CCivilianPed(int pedtype, int mi) : CPed(pedtype)
{
- CPed::SetModelIndex(mi);
+ SetModelIndex(mi);
for (int i = 0; i < 10; i++)
{
m_nearPeds[i] = nil;
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp
index 0ac0473f..badcc4de 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -1,6 +1,62 @@
#include "common.h"
#include "patcher.h"
#include "CopPed.h"
+#include "ModelIndices.h"
+
+CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
+{
+ m_nCopType = copType;
+ switch (copType) {
+ case COP_STREET:
+ SetModelIndex(MI_COP);
+ GiveWeapon(WEAPONTYPE_COLT45, 1000);
+ m_currentWeapon = WEAPONTYPE_UNARMED;
+ m_fArmour = 0.0f;
+ m_wepSkills = 208; /* TODO: what is this? seems unused */
+ m_wepAccuracy = 60;
+ break;
+ case COP_FBI:
+ SetModelIndex(MI_FBI);
+ GiveWeapon(WEAPONTYPE_COLT45, 1000);
+ GiveWeapon(WEAPONTYPE_AK47, 1000);
+ SetCurrentWeapon(WEAPONTYPE_AK47);
+ m_fArmour = 100.0f;
+ m_wepSkills = 176; /* TODO: what is this? seems unused */
+ m_wepAccuracy = 76;
+ break;
+ case COP_SWAT:
+ SetModelIndex(MI_SWAT);
+ GiveWeapon(WEAPONTYPE_COLT45, 1000);
+ GiveWeapon(WEAPONTYPE_UZI, 1000);
+ SetCurrentWeapon(WEAPONTYPE_UZI);
+ m_fArmour = 50.0f;
+ m_wepSkills = 32; /* TODO: what is this? seems unused */
+ m_wepAccuracy = 64;
+ break;
+ case COP_ARMY:
+ SetModelIndex(MI_ARMY);
+ GiveWeapon(WEAPONTYPE_COLT45, 1000);
+ GiveWeapon(WEAPONTYPE_M16, 1000);
+ GiveWeapon(WEAPONTYPE_GRENADE, 10);
+ SetCurrentWeapon(WEAPONTYPE_M16);
+ m_fArmour = 100.0f;
+ m_wepSkills = 32; /* TODO: what is this? seems unused */
+ m_wepAccuracy = 84;
+ break;
+ default:
+ break;
+ }
+ m_bIsInPursuit = false;
+ field_1350 = 1;
+ m_bIsDisabledCop = false;
+ field_1356 = 0;
+ m_attackTimer = 0;
+ field_1351 = 0;
+ m_bZoneDisabledButClose = false;
+ m_bZoneDisabled = false;
+ field_1364 = -1;
+ m_pPointGunAt = nil;
+}
CCopPed::~CCopPed()
{
@@ -12,9 +68,11 @@ WRAPPER void CCopPed::ClearPursuit(void) { EAXJMP(0x4C28C0); }
class CCopPed_ : public CCopPed
{
public:
+ CCopPed *ctor(eCopType type) { return ::new (this) CCopPed(type); };
void dtor(void) { CCopPed::~CCopPed(); }
};
STARTPATCHES
+ InjectHook(0x4C11B0, &CCopPed_::ctor, PATCH_JUMP);
InjectHook(0x4C13E0, &CCopPed_::dtor, PATCH_JUMP);
ENDPATCHES
diff --git a/src/peds/CopPed.h b/src/peds/CopPed.h
index f8139046..17ca111f 100644
--- a/src/peds/CopPed.h
+++ b/src/peds/CopPed.h
@@ -31,6 +31,7 @@ public:
int8 field_1366;
int8 field_1367;
+ CCopPed(eCopType);
~CCopPed();
void ClearPursuit(void);
diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp
index 664bd6f6..d4f46b0e 100644
--- a/src/peds/EmergencyPed.cpp
+++ b/src/peds/EmergencyPed.cpp
@@ -1,13 +1,36 @@
#include "common.h"
#include "patcher.h"
#include "EmergencyPed.h"
+#include "ModelIndices.h"
class CEmergencyPed_ : public CEmergencyPed
{
public:
+ CEmergencyPed *ctor(int pedtype) { return ::new (this) CEmergencyPed(pedtype); };
void dtor(void) { CEmergencyPed::~CEmergencyPed(); }
};
+CEmergencyPed::CEmergencyPed(uint32 type) : CPed(type)
+{
+ switch (type){
+ case PEDTYPE_EMERGENCY:
+ SetModelIndex(MI_MEDIC);
+ m_pRevivedPed = nil;
+ field_1360 = 0;
+ break;
+ case PEDTYPE_FIREMAN:
+ SetModelIndex(MI_FIREMAN);
+ m_pRevivedPed = nil;
+ break;
+ default:
+ break;
+ }
+ m_nEmergencyPedState = 0;
+ m_pAttendedAccident = nil;
+ field_1356 = 0;
+}
+
STARTPATCHES
+ InjectHook(0x4C2E40, &CEmergencyPed_::ctor, PATCH_JUMP);
InjectHook(0x4C2EF0, &CEmergencyPed_::dtor, PATCH_JUMP);
ENDPATCHES
diff --git a/src/peds/EmergencyPed.h b/src/peds/EmergencyPed.h
index f21996e8..b9d979e3 100644
--- a/src/peds/EmergencyPed.h
+++ b/src/peds/EmergencyPed.h
@@ -1,11 +1,19 @@
#pragma once
+#include "Fire.h"
#include "Ped.h"
class CEmergencyPed : public CPed
{
public:
// 0x53C
- uint8 stuff[24];
+ CPed* m_pRevivedPed;
+ int32 m_nEmergencyPedState; // looks like flags
+ void* m_pAttendedAccident; //TODO: CAccident*
+ CFire* m_pAttendedFire;
+ int8 field_1356;
+ int32 field_1360;
+
+ CEmergencyPed(uint32);
};
static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error");
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 4ad4ac1b..859ddda4 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -46,6 +46,9 @@ WRAPPER void CPed::SetDuck(uint32) { EAXJMP(0x4E4920); }
WRAPPER void CPed::RegisterThreatWithGangPeds(CEntity*) { EAXJMP(0x4E3870); }
WRAPPER void CPed::MakeChangesForNewWeapon(int8) { EAXJMP(0x4F2560); }
WRAPPER bool CPed::Seek(void) { EAXJMP(0x4D1640); }
+WRAPPER void CPed::ClearAll(void) { EAXJMP(0x4C7F20); }
+WRAPPER void CPed::SetWanderPath(int8) { EAXJMP(0x4D2750); }
+WRAPPER void CPed::SetFollowPath(CVector) { EAXJMP(0x4D2EA0); }
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
@@ -1404,7 +1407,7 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
if (vehicle->pDriver == ped) {
vehicle->RemoveDriver();
- if (vehicle->m_nDoorLock == CARLOCK_COP_CAR)
+ if (vehicle->m_nDoorLock == CARLOCK_LOCKED_INITIALLY)
vehicle->m_nDoorLock = CARLOCK_UNLOCKED;
if (ped->m_nPedType == PEDTYPE_COP && vehicle->IsLawEnforcementVehicle())
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index cd7d88af..d13371ab 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -210,7 +210,7 @@ public:
uint8 m_ped_flagD10 : 1;
uint8 m_ped_flagD20 : 1;
uint8 m_ped_flagD40 : 1; // reset when objective changes
- uint8 m_ped_flagD80 : 1;
+ uint8 m_bScriptObjectiveCompleted : 1;
uint8 m_ped_flagE1 : 1;
uint8 m_ped_flagE2 : 1;
@@ -460,6 +460,9 @@ public:
void MakeChangesForNewWeapon(int8);
void CheckAroundForPossibleCollisions(void);
bool Seek(void);
+ void ClearAll(void);
+ void SetWanderPath(int8);
+ void SetFollowPath(CVector);
// Static methods
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);