summaryrefslogtreecommitdiffstats
path: root/src/entities/Ped.cpp
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2019-06-14 14:33:08 +0200
committereray orçunus <erayorcunus@gmail.com>2019-06-14 16:04:29 +0200
commited69be36cc30609100f0c75ac18aa5b4c15b22b4 (patch)
treebbf363a93f1450a46f7cab6a9d5cd9aeb28fb4f9 /src/entities/Ped.cpp
parentMerge pull request #14 from ShFil119/patch-1 (diff)
downloadre3-ed69be36cc30609100f0c75ac18aa5b4c15b22b4.tar
re3-ed69be36cc30609100f0c75ac18aa5b4c15b22b4.tar.gz
re3-ed69be36cc30609100f0c75ac18aa5b4c15b22b4.tar.bz2
re3-ed69be36cc30609100f0c75ac18aa5b4c15b22b4.tar.lz
re3-ed69be36cc30609100f0c75ac18aa5b4c15b22b4.tar.xz
re3-ed69be36cc30609100f0c75ac18aa5b4c15b22b4.tar.zst
re3-ed69be36cc30609100f0c75ac18aa5b4c15b22b4.zip
Diffstat (limited to '')
-rw-r--r--src/entities/Ped.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/entities/Ped.cpp b/src/entities/Ped.cpp
index 55e33a2d..b4b980e5 100644
--- a/src/entities/Ped.cpp
+++ b/src/entities/Ped.cpp
@@ -11,6 +11,8 @@ void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
WRAPPER void CPed::KillPedWithCar(CVehicle *veh, float impulse) { EAXJMP(0x4EC430); }
+WRAPPER void CPed::Say(uint16 audio) { EAXJMP(0x4E5A10); }
+WRAPPER void CPed::SetLookFlag(CEntity* to, bool set) { EAXJMP(0x4C6460); }
static char ObjectiveText[34][28] = {
"No Obj",
@@ -175,3 +177,56 @@ CPed::UseGroundColModel(void)
m_nPedState == PED_DIE ||
m_nPedState == PED_DEAD;
}
+
+void
+CPed::AddWeaponModel(int id)
+{
+ RpAtomic* atm;
+
+ if (id != -1) {
+ atm = (RpAtomic*)CModelInfo::GetModelInfo(id)->CreateInstance();
+ RwFrameDestroy(RpAtomicGetFrame(atm));
+ RpAtomicSetFrame(atm, m_pFrames[PED_HANDR]->frame);
+ RpClumpAddAtomic((RpClump*)m_rwObject, atm);
+ m_wepModelID = id;
+ }
+}
+
+void
+CPed::AimGun()
+{
+ RwV3d pos;
+ CVector vector;
+ uint8 newFlag;
+
+ if (m_pSeekTarget) {
+ if (m_pSeekTarget->m_status == STATUS_PHYSICS) {
+ m_pSeekTarget->m_pedIK.GetComponentPosition(&pos, 1);
+ vector.x = pos.x;
+ vector.y = pos.y;
+ vector.z = pos.z;
+ } else {
+ vector = *(m_pSeekTarget->GetMatrix().GetPosition());
+ }
+ CPed::Say(0x74);
+
+ m_ped_flagB40 = m_pedIK.PointGunAtPosition(&vector);
+ if (m_pPedFight != m_pSeekTarget) {
+ CPed::SetLookFlag(m_pSeekTarget, 1);
+ }
+
+ } else {
+ if (CPed::IsPlayer()) {
+ newFlag = m_pedIK.PointGunInDirection(m_fLookDirection, m_vecMoveSpeedAvg.y);
+ } else {
+ newFlag = m_pedIK.PointGunInDirection(m_fLookDirection, 0.0);
+ }
+
+ m_ped_flagB40 = newFlag;
+ }
+}
+
+STARTPATCHES
+ InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP);
+ InjectHook(0x4C6AA0, &CPed::AimGun, PATCH_JUMP);
+ENDPATCHES \ No newline at end of file