diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2019-07-07 21:28:51 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2019-07-07 21:28:51 +0200 |
commit | 4c86469cc91ce1b1cb767e35a0bf8358d9800ac8 (patch) | |
tree | c0835ff0e74fd35c51f142349bb8580630471b19 /src/peds | |
parent | More scripts (diff) | |
parent | Merge pull request #111 from gennariarmando/master (diff) | |
download | re3-4c86469cc91ce1b1cb767e35a0bf8358d9800ac8.tar re3-4c86469cc91ce1b1cb767e35a0bf8358d9800ac8.tar.gz re3-4c86469cc91ce1b1cb767e35a0bf8358d9800ac8.tar.bz2 re3-4c86469cc91ce1b1cb767e35a0bf8358d9800ac8.tar.lz re3-4c86469cc91ce1b1cb767e35a0bf8358d9800ac8.tar.xz re3-4c86469cc91ce1b1cb767e35a0bf8358d9800ac8.tar.zst re3-4c86469cc91ce1b1cb767e35a0bf8358d9800ac8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/peds/Ped.cpp | 13 | ||||
-rw-r--r-- | src/peds/Ped.h | 4 | ||||
-rw-r--r-- | src/peds/PlayerPed.cpp | 16 | ||||
-rw-r--r-- | src/peds/PlayerPed.h | 1 |
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"); |