summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-07-16 18:25:46 +0200
committerGitHub <noreply@github.com>2019-07-16 18:25:46 +0200
commit568b3de9cc682b4963d4fc6129692d11cfffe64a (patch)
treee119d9af8c6dc6fe93387c1cb264ea12304fbc0a /src/peds
parentstarted making frontend accurate to game (diff)
parentfix (diff)
downloadre3-568b3de9cc682b4963d4fc6129692d11cfffe64a.tar
re3-568b3de9cc682b4963d4fc6129692d11cfffe64a.tar.gz
re3-568b3de9cc682b4963d4fc6129692d11cfffe64a.tar.bz2
re3-568b3de9cc682b4963d4fc6129692d11cfffe64a.tar.lz
re3-568b3de9cc682b4963d4fc6129692d11cfffe64a.tar.xz
re3-568b3de9cc682b4963d4fc6129692d11cfffe64a.tar.zst
re3-568b3de9cc682b4963d4fc6129692d11cfffe64a.zip
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/CivilianPed.cpp2
-rw-r--r--src/peds/CopPed.cpp60
-rw-r--r--src/peds/CopPed.h2
-rw-r--r--src/peds/EmergencyPed.cpp25
-rw-r--r--src/peds/EmergencyPed.h11
-rw-r--r--src/peds/Ped.cpp7
-rw-r--r--src/peds/Ped.h5
7 files changed, 107 insertions, 5 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..5bc67e15 100644
--- a/src/peds/CopPed.cpp
+++ b/src/peds/CopPed.cpp
@@ -1,6 +1,64 @@
#include "common.h"
#include "patcher.h"
#include "CopPed.h"
+#include "ModelIndices.h"
+
+WRAPPER void CCopPed::ProcessControl() { EAXJMP(0x4C1400); }
+
+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 +70,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..162f14a6 100644
--- a/src/peds/CopPed.h
+++ b/src/peds/CopPed.h
@@ -31,9 +31,11 @@ public:
int8 field_1366;
int8 field_1367;
+ CCopPed(eCopType);
~CCopPed();
void ClearPursuit(void);
+ void ProcessControl(void);
};
static_assert(sizeof(CCopPed) == 0x558, "CCopPed: error");
diff --git a/src/peds/EmergencyPed.cpp b/src/peds/EmergencyPed.cpp
index 664bd6f6..cbcfb403 100644
--- a/src/peds/EmergencyPed.cpp
+++ b/src/peds/EmergencyPed.cpp
@@ -1,13 +1,38 @@
#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(); }
};
+WRAPPER void CEmergencyPed::ProcessControl(void) { EAXJMP(0x4C2F10); }
+
+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..f55fa4e2 100644
--- a/src/peds/EmergencyPed.h
+++ b/src/peds/EmergencyPed.h
@@ -1,11 +1,20 @@
#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);
+ void ProcessControl(void);
};
static_assert(sizeof(CEmergencyPed) == 0x554, "CEmergencyPed: error");
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 4ad4ac1b..851c56d5 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;
@@ -393,7 +396,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_ped_flagD10 = false;
m_ped_flagD20 = false;
m_ped_flagD40 = false;
- m_ped_flagD80 = false;
+ m_bScriptObjectiveCompleted = false;
m_ped_flagE1 = false;
m_ped_flagE2 = false;
@@ -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);