diff options
author | eray orçunus <erayorcunus@gmail.com> | 2019-10-13 23:33:18 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2019-10-13 23:33:18 +0200 |
commit | 37f0bbc05e87a2a7c0858c6da4a6d51c485fdf64 (patch) | |
tree | d3bb47c4231f7232d911b9dc58a73177d11d1c19 /src/peds/Ped.cpp | |
parent | Fixed unsigned time check in CDarkel (diff) | |
download | re3-37f0bbc05e87a2a7c0858c6da4a6d51c485fdf64.tar re3-37f0bbc05e87a2a7c0858c6da4a6d51c485fdf64.tar.gz re3-37f0bbc05e87a2a7c0858c6da4a6d51c485fdf64.tar.bz2 re3-37f0bbc05e87a2a7c0858c6da4a6d51c485fdf64.tar.lz re3-37f0bbc05e87a2a7c0858c6da4a6d51c485fdf64.tar.xz re3-37f0bbc05e87a2a7c0858c6da4a6d51c485fdf64.tar.zst re3-37f0bbc05e87a2a7c0858c6da4a6d51c485fdf64.zip |
Diffstat (limited to '')
-rw-r--r-- | src/peds/Ped.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index d9ddffc8..5a2472e0 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -53,7 +53,6 @@ WRAPPER void CPed::SpawnFlyingComponent(int, int8) { EAXJMP(0x4EB060); } WRAPPER void CPed::SetPedPositionInCar(void) { EAXJMP(0x4D4970); } WRAPPER void CPed::SetMoveAnim(void) { EAXJMP(0x4C5A40); } -WRAPPER void CPed::SetFollowPath(CVector) { EAXJMP(0x4D2EA0); } WRAPPER void CPed::StartFightDefend(uint8, uint8, uint8) { EAXJMP(0x4E7780); } WRAPPER void CPed::ServiceTalking(void) { EAXJMP(0x4E5870); } WRAPPER void CPed::UpdatePosition(void) { EAXJMP(0x4C7A00); } @@ -14879,6 +14878,37 @@ CPed::SetSolicit(uint32 time) } } +bool +CPed::SetFollowPath(CVector dest) +{ + if (m_nPedState == PED_FOLLOW_PATH) + return false; + + if (FindPlayerPed() != this) + return false; + + if ((dest - GetPosition()).Magnitude() <= 2.0f) + return false; + + CVector pointPoses[7]; + int16 pointsFound; + CPedPath::CalcPedRoute(0, GetPosition(), dest, pointPoses, &pointsFound, 7); + for(int i = 0; i < pointsFound; i++) { + m_stPathNodeStates[i].x = pointPoses[i].x; + m_stPathNodeStates[i].y = pointPoses[i].y; + } + + m_nCurPathNode = 0; + m_nPathNodes = pointsFound; + if (m_nPathNodes < 1) + return false; + + SetStoredState(); + m_nPedState = PED_FOLLOW_PATH; + SetMoveState(PEDMOVE_WALK); + return true; +} + class CPed_ : public CPed { public: @@ -15092,4 +15122,5 @@ STARTPATCHES InjectHook(0x4D7BC0, &CPed::SetRadioStation, PATCH_JUMP); InjectHook(0x4C7FF0, &CPed::ProcessBuoyancy, PATCH_JUMP); InjectHook(0x4D6620, &CPed::SetSolicit, PATCH_JUMP); + InjectHook(0x4D2EA0, &CPed::SetFollowPath, PATCH_JUMP); ENDPATCHES
\ No newline at end of file |