summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-07-25 22:34:29 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-07-25 22:34:29 +0200
commit5acce16261606f06e39e09d0bd6ec0d95787ae38 (patch)
treed3b6a483930067302386dc3284dbd68326432bf3 /src/peds
parentfixed dinput (diff)
downloadre3-5acce16261606f06e39e09d0bd6ec0d95787ae38.tar
re3-5acce16261606f06e39e09d0bd6ec0d95787ae38.tar.gz
re3-5acce16261606f06e39e09d0bd6ec0d95787ae38.tar.bz2
re3-5acce16261606f06e39e09d0bd6ec0d95787ae38.tar.lz
re3-5acce16261606f06e39e09d0bd6ec0d95787ae38.tar.xz
re3-5acce16261606f06e39e09d0bd6ec0d95787ae38.tar.zst
re3-5acce16261606f06e39e09d0bd6ec0d95787ae38.zip
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/Ped.cpp16
-rw-r--r--src/peds/Ped.h4
2 files changed, 18 insertions, 2 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 0c4e33d6..c0c49751 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -47,6 +47,7 @@ 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::SetFollowPath(CVector) { EAXJMP(0x4D2EA0); }
+WRAPPER void CPed::RemoveInCarAnims(void) { EAXJMP(0x4E4E20); }
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
@@ -395,7 +396,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bIsPedDieAnimPlaying = false;
m_ped_flagD20 = false;
m_ped_flagD40 = false;
- m_bScriptObjectiveCompleted = false;
+ bScriptObjectiveCompleted = false;
m_ped_flagE1 = false;
m_ped_flagE2 = false;
@@ -4039,6 +4040,18 @@ CPed::SetAmmo(eWeaponType weaponType, uint32 ammo)
}
void
+CPed::GrantAmmo(eWeaponType weaponType, uint32 ammo)
+{
+ if (HasWeapon(weaponType)) {
+ GetWeapon(weaponType).m_nAmmoTotal += ammo;
+ }
+ else {
+ GetWeapon(weaponType).Initialise(weaponType, ammo);
+ m_maxWeaponTypeAllowed++;
+ }
+}
+
+void
CPed::SetEvasiveStep(CEntity *reason, uint8 animType)
{
AnimationId stepAnim;
@@ -4237,5 +4250,6 @@ STARTPATCHES
InjectHook(0x4D6540, &CPed::RestoreHeadingRate, PATCH_JUMP);
InjectHook(0x4C69E0, (void (CPed::*)(CEntity*)) &CPed::SetAimFlag, PATCH_JUMP);
InjectHook(0x4C6960, (void (CPed::*)(float)) &CPed::SetAimFlag, PATCH_JUMP);
+ InjectHook(0x4CFAD0, &CPed::GrantAmmo, PATCH_JUMP);
InjectHook(0x4CFB20, &CPed::SetAmmo, PATCH_JUMP);
ENDPATCHES
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 7b8bc2ce..f0e222a0 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -221,7 +221,7 @@ public:
uint8 bIsPedDieAnimPlaying : 1;
uint8 m_ped_flagD20 : 1;
uint8 m_ped_flagD40 : 1; // reset when objective changes
- uint8 m_bScriptObjectiveCompleted : 1;
+ uint8 bScriptObjectiveCompleted : 1;
uint8 m_ped_flagE1 : 1;
uint8 m_ped_flagE2 : 1;
@@ -503,6 +503,7 @@ public:
void SetAimFlag(float angle);
void SetAmmo(eWeaponType weaponType, uint32 ammo);
void SetEvasiveStep(CEntity*, uint8);
+ void GrantAmmo(eWeaponType, uint32);
// Static methods
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
@@ -559,6 +560,7 @@ public:
void SetLeader(CEntity* leader);
void SetPedStats(ePedStats);
bool IsGangMember(void);
+ void RemoveInCarAnims(void);
bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; }
CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; }