summaryrefslogtreecommitdiffstats
path: root/src/peds
diff options
context:
space:
mode:
Diffstat (limited to 'src/peds')
-rw-r--r--src/peds/Ped.cpp13
-rw-r--r--src/peds/Ped.h4
-rw-r--r--src/peds/PlayerPed.cpp16
-rw-r--r--src/peds/PlayerPed.h1
4 files changed, 26 insertions, 8 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 80ef53ee..016fea2f 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -41,6 +41,7 @@ WRAPPER void CPed::SetMoveAnim(void) { EAXJMP(0x4C5A40); }
WRAPPER void CPed::SetFollowRoute(int16, int16) { EAXJMP(0x4DD690); }
WRAPPER void CPed::SetDuck(uint32) { EAXJMP(0x4E4920); }
WRAPPER void CPed::RegisterThreatWithGangPeds(CEntity*) { EAXJMP(0x4E3870); }
+WRAPPER void CPed::MakeChangesForNewWeapon(int8) { EAXJMP(0x4F2560); }
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
@@ -456,9 +457,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
}
m_maxWeaponTypeAllowed = 0;
m_currentWeapon = 0;
- m_storedWeapon = NO_STORED_WEAPON;
+ m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
- for(int i = 0; i < NUM_PED_WEAPONTYPES; i++)
+ for(int i = 0; i < WEAPONTYPE_TOTAL_INVENTORY_WEAPONS; i++)
{
CWeapon &weapon = GetWeapon(i);
weapon.m_eWeaponType = WEAPONTYPE_UNARMED;
@@ -1427,9 +1428,9 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
// Only uzi can be used on cars, so previous weapon was stored
if (ped->IsPlayer() && weaponType == WEAPONTYPE_UZI) {
- if (ped->m_storedWeapon != NO_STORED_WEAPON) {
+ if (ped->m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) {
ped->SetCurrentWeapon(ped->m_storedWeapon);
- ped->m_storedWeapon = NO_STORED_WEAPON;
+ ped->m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
}
} else {
ped->AddWeaponModel(CWeaponInfo::GetWeaponInfo(weaponType)->m_nModelId);
@@ -2701,9 +2702,9 @@ CPed::QuitEnteringCar(void)
bUsesCollision = true;
if (IsPlayer() && GetWeapon()->m_eWeaponType == WEAPONTYPE_UZI) {
- if (IsPlayer() && m_storedWeapon != NO_STORED_WEAPON) {
+ if (IsPlayer() && m_storedWeapon != WEAPONTYPE_UNIDENTIFIED) {
SetCurrentWeapon(m_storedWeapon);
- m_storedWeapon = NO_STORED_WEAPON;
+ m_storedWeapon = WEAPONTYPE_UNIDENTIFIED;
}
} else {
CWeaponInfo *curWeapon = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 95731e15..0493eeee 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -351,7 +351,7 @@ public:
uint8 pad_351[3];
uint32 m_timerUnused;
CEntity *m_targetUnused;
- CWeapon m_weapons[NUM_PED_WEAPONTYPES];
+ CWeapon m_weapons[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS];
eWeaponType m_storedWeapon;
uint8 m_currentWeapon; // eWeaponType
uint8 m_maxWeaponTypeAllowed; // eWeaponType
@@ -465,6 +465,8 @@ public:
void RegisterThreatWithGangPeds(CEntity*);
bool TurnBody(void);
void Chat(void);
+ void MakeChangesForNewWeapon(int8);
+
// Static methods
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp
index 2d67d5b2..7eb01db0 100644
--- a/src/peds/PlayerPed.cpp
+++ b/src/peds/PlayerPed.cpp
@@ -1,6 +1,8 @@
#include "common.h"
#include "patcher.h"
#include "PlayerPed.h"
+#include "Camera.h"
+#include "WeaponEffects.h"
CPlayerPed::~CPlayerPed()
{
@@ -9,6 +11,18 @@ CPlayerPed::~CPlayerPed()
WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
+void CPlayerPed::ClearWeaponTarget()
+{
+ if (!m_nPedType) {
+ m_pPointGunAt = 0;
+ TheCamera.ClearPlayerWeaponMode();
+ CWeaponEffects::ClearCrosshair();
+ }
+ ClearPointGunAt();
+}
+
STARTPATCHES
- InjectHook(0x4EFB30, &CPlayerPed::dtor, PATCH_JUMP);
+InjectHook(0x4EFB30, &CPlayerPed::dtor, PATCH_JUMP);
+InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
+
ENDPATCHES \ No newline at end of file
diff --git a/src/peds/PlayerPed.h b/src/peds/PlayerPed.h
index 15ad74a6..4f325da3 100644
--- a/src/peds/PlayerPed.h
+++ b/src/peds/PlayerPed.h
@@ -43,6 +43,7 @@ public:
void dtor(void) { this->CPlayerPed::~CPlayerPed(); }
void ReApplyMoveAnims(void);
+ void ClearWeaponTarget();
};
static_assert(sizeof(CPlayerPed) == 0x5F0, "CPlayerPed: error");