diff options
author | _AG <gennariarmando@outlook.com> | 2019-07-04 22:31:21 +0200 |
---|---|---|
committer | _AG <gennariarmando@outlook.com> | 2019-07-04 22:33:19 +0200 |
commit | 9fed0c040c482bac8cba688e7564c8e8dfe23b30 (patch) | |
tree | 6098d16b702a3a057cd0bbd39bf3ece217c832c8 /src/entities | |
parent | Merge pull request #110 from erorcun/erorcun (diff) | |
download | re3-9fed0c040c482bac8cba688e7564c8e8dfe23b30.tar re3-9fed0c040c482bac8cba688e7564c8e8dfe23b30.tar.gz re3-9fed0c040c482bac8cba688e7564c8e8dfe23b30.tar.bz2 re3-9fed0c040c482bac8cba688e7564c8e8dfe23b30.tar.lz re3-9fed0c040c482bac8cba688e7564c8e8dfe23b30.tar.xz re3-9fed0c040c482bac8cba688e7564c8e8dfe23b30.tar.zst re3-9fed0c040c482bac8cba688e7564c8e8dfe23b30.zip |
Diffstat (limited to '')
-rw-r--r-- | src/entities/Ped.cpp | 9 | ||||
-rw-r--r-- | src/entities/Ped.h | 3 | ||||
-rw-r--r-- | src/entities/PlayerPed.cpp | 16 | ||||
-rw-r--r-- | src/entities/PlayerPed.h | 1 |
4 files changed, 23 insertions, 6 deletions
diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp index 9e1836c2..2e51a5c1 100644 --- a/src/entities/Ped.cpp +++ b/src/entities/Ped.cpp @@ -39,6 +39,7 @@ WRAPPER void CPed::PreRender(void) { EAXJMP(0x4CFDD0); } WRAPPER void CPed::Render(void) { EAXJMP(0x4D03F0); } WRAPPER int32 CPed::ProcessEntityCollision(CEntity*, CColPoint*) { EAXJMP(0x4CBB30); } WRAPPER void CPed::SetMoveAnim(void) { EAXJMP(0x4C5A40); } +WRAPPER void CPed::MakeChangesForNewWeapon(int8) { EAXJMP(0x4F2560); } bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44; bool &CPed::bPedCheat2 = *(bool*)0x95CD5A; @@ -461,9 +462,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; @@ -1445,9 +1446,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); diff --git a/src/entities/Ped.h b/src/entities/Ped.h index 558ec9c1..4367dc61 100644 --- a/src/entities/Ped.h +++ b/src/entities/Ped.h @@ -324,7 +324,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 @@ -427,6 +427,7 @@ public: bool CanSeeEntity(CEntity*, float); void RestorePreviousObjective(void); void SetObjective(eObjective, void*); + void MakeChangesForNewWeapon(int8); // Static methods static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset); diff --git a/src/entities/PlayerPed.cpp b/src/entities/PlayerPed.cpp index 2d67d5b2..7eb01db0 100644 --- a/src/entities/PlayerPed.cpp +++ b/src/entities/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/entities/PlayerPed.h b/src/entities/PlayerPed.h index 15ad74a6..4f325da3 100644 --- a/src/entities/PlayerPed.h +++ b/src/entities/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"); |