diff options
author | eray orçunus <erayorcunus@gmail.com> | 2019-07-17 15:13:00 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2019-07-17 15:13:00 +0200 |
commit | 06ed308bb1a2383125cf04fd712b1753c4ba1d55 (patch) | |
tree | 713a8e10b3657d4c3a0d9c20c3704e0da8f9357e /src/peds | |
parent | Merge branch 'master' of git://github.com/GTAmodding/re3 into erorcun (diff) | |
parent | renamed some variables and added files; more CAutomobile::ProcessControl (diff) | |
download | re3-06ed308bb1a2383125cf04fd712b1753c4ba1d55.tar re3-06ed308bb1a2383125cf04fd712b1753c4ba1d55.tar.gz re3-06ed308bb1a2383125cf04fd712b1753c4ba1d55.tar.bz2 re3-06ed308bb1a2383125cf04fd712b1753c4ba1d55.tar.lz re3-06ed308bb1a2383125cf04fd712b1753c4ba1d55.tar.xz re3-06ed308bb1a2383125cf04fd712b1753c4ba1d55.tar.zst re3-06ed308bb1a2383125cf04fd712b1753c4ba1d55.zip |
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/CivilianPed.cpp | 2 | ||||
-rw-r--r-- | src/peds/CopPed.cpp | 60 | ||||
-rw-r--r-- | src/peds/CopPed.h | 2 | ||||
-rw-r--r-- | src/peds/EmergencyPed.cpp | 25 | ||||
-rw-r--r-- | src/peds/EmergencyPed.h | 11 | ||||
-rw-r--r-- | src/peds/Ped.cpp | 15 | ||||
-rw-r--r-- | src/peds/Ped.h | 5 |
7 files changed, 111 insertions, 9 deletions
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp index 383a3e56..3b1f9e1c 100644 --- a/src/peds/CivilianPed.cpp +++ b/src/peds/CivilianPed.cpp @@ -7,7 +7,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 45074d2b..b1738465 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -47,6 +47,9 @@ WRAPPER void CPed::SetDuck(uint32) { EAXJMP(0x4E4920); } WRAPPER void CPed::RegisterThreatWithGangPeds(CEntity*) { EAXJMP(0x4E3870); } WRAPPER void CPed::MakeChangesForNewWeapon(int8) { EAXJMP(0x4F2560); } WRAPPER void CPed::SetSeek(CVector, float) { EAXJMP(0x4D14B0); } +WRAPPER bool CPed::Seek(void) { EAXJMP(0x4D1640); } +WRAPPER void CPed::SetWanderPath(int8) { EAXJMP(0x4D2750); } +WRAPPER void CPed::SetFollowPath(CVector) { EAXJMP(0x4D2EA0); } bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44; bool &CPed::bPedCheat2 = *(bool*)0x95CD5A; @@ -394,7 +397,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; @@ -1405,7 +1408,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()) @@ -1457,7 +1460,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enter seatOffset = 0.0f; vehDoorOffset = offsetToOpenVanDoor; } else { - seatOffset = veh->m_handling->fSeatOffsetDistance * seatPosMult; + seatOffset = veh->pHandling->fSeatOffsetDistance * seatPosMult; if (veh->bLowVehicle) { vehDoorOffset = offsetToOpenLowCarDoor; } else { @@ -2730,8 +2733,8 @@ CPed::QuitEnteringCar(void) m_pVehicleAnim = nil; if (veh) { - if (veh->m_autoPilot.m_nCruiseSpeed == 0) - veh->m_autoPilot.m_nCruiseSpeed = 17; + if (veh->AutoPilot.m_nCruiseSpeed == 0) + veh->AutoPilot.m_nCruiseSpeed = 17; } } @@ -3049,7 +3052,7 @@ CPed::CheckForPointBlankPeds(CPed *pedToVerify) neededAngle = CGeneral::LimitRadianAngle(neededAngle); m_fRotationCur = CGeneral::LimitRadianAngle(m_fRotationCur); - float neededTurn = Abs(neededTurn - m_fRotationCur); + float neededTurn = Abs(neededAngle - m_fRotationCur); if (neededTurn > PI) neededTurn = 2*PI - neededTurn; diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 8439e0f8..2cc064a5 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; @@ -469,6 +469,9 @@ public: bool CheckIfInTheAir(void); void ClearAll(void); void SetPointGunAt(CEntity*); + bool Seek(void); + void SetWanderPath(int8); + void SetFollowPath(CVector); // Static methods static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset); |