summaryrefslogtreecommitdiffstats
path: root/src/peds/CivilianPed.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-07-15 14:11:40 +0200
committereray orçunus <erayorcunus@gmail.com>2019-07-15 14:11:40 +0200
commit2c138b2b77cf661d9f119061963a726fdcde56d0 (patch)
tree1c8316f212304c911252b378b3b56368ba4ceaa9 /src/peds/CivilianPed.cpp
parentlittle change to aspect ratio defines (diff)
downloadre3-2c138b2b77cf661d9f119061963a726fdcde56d0.tar
re3-2c138b2b77cf661d9f119061963a726fdcde56d0.tar.gz
re3-2c138b2b77cf661d9f119061963a726fdcde56d0.tar.bz2
re3-2c138b2b77cf661d9f119061963a726fdcde56d0.tar.lz
re3-2c138b2b77cf661d9f119061963a726fdcde56d0.tar.xz
re3-2c138b2b77cf661d9f119061963a726fdcde56d0.tar.zst
re3-2c138b2b77cf661d9f119061963a726fdcde56d0.zip
Diffstat (limited to '')
-rw-r--r--src/peds/CivilianPed.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp
index cf8a0580..383a3e56 100644
--- a/src/peds/CivilianPed.cpp
+++ b/src/peds/CivilianPed.cpp
@@ -1,6 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "CivilianPed.h"
+#include "Phones.h"
WRAPPER void CCivilianPed::ProcessControl(void) { EAXJMP(0x4BFFE0); }
@@ -13,6 +14,28 @@ CCivilianPed::CCivilianPed(int pedtype, int mi) : CPed(pedtype)
}
}
+bool
+CCivilianPed::ProcessNearestFreePhone(int unused)
+{
+ if (m_nPedState == PED_SEEK_POS)
+ return false;
+
+ int phoneId = gPhoneInfo.FindNearestFreePhone(&GetPosition());
+
+ if (phoneId == -1)
+ return false;
+
+ if (gPhoneInfo.m_aPhones[phoneId].m_nState != PHONE_STATE_FREE)
+ return false;
+
+ field_31C = 1;
+ SetMoveState(PEDMOVE_RUN);
+ SetSeek(gPhoneInfo.m_aPhones[phoneId].m_vecPos, 0.3f);
+ m_phoneId = phoneId;
+ m_lookingForPhone = unused;
+ return true;
+}
+
class CCivilianPed_ : public CCivilianPed
{
public:
@@ -23,4 +46,5 @@ public:
STARTPATCHES
InjectHook(0x4BFF30, &CCivilianPed_::ctor, PATCH_JUMP);
InjectHook(0x4BFFC0, &CCivilianPed_::dtor, PATCH_JUMP);
+ InjectHook(0x4C10C0, &CCivilianPed::ProcessNearestFreePhone, PATCH_JUMP);
ENDPATCHES