diff options
author | eray orçunus <erayorcunus@gmail.com> | 2019-06-24 16:57:54 +0200 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2019-06-24 23:01:40 +0200 |
commit | 1e09bf9c30094b4387431be4842876181a1425fe (patch) | |
tree | 22ee6dfa941b6cc85619973311c357f11acc1ef1 /src/control/PedPlacement.cpp | |
parent | more Radar code (diff) | |
download | re3-1e09bf9c30094b4387431be4842876181a1425fe.tar re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.gz re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.bz2 re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.lz re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.xz re3-1e09bf9c30094b4387431be4842876181a1425fe.tar.zst re3-1e09bf9c30094b4387431be4842876181a1425fe.zip |
Diffstat (limited to '')
-rw-r--r-- | src/control/PedPlacement.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/control/PedPlacement.cpp b/src/control/PedPlacement.cpp new file mode 100644 index 00000000..de4cdae1 --- /dev/null +++ b/src/control/PedPlacement.cpp @@ -0,0 +1,40 @@ +#include "common.h" +#include "patcher.h" +#include "PedPlacement.h" +#include "World.h" + +void +CPedPlacement::FindZCoorForPed(CVector* pos) +{ + float zForPed; + float startZ = pos->z - 100.0f; + float foundColZ = -100.0f; + float foundColZ2 = -100.0f; + CColPoint foundCol; + CEntity* foundEnt; + + CVector vec( + pos->x, + pos->y, + pos->z + 1.0f + ); + + if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, false)) + foundColZ = foundCol.point.z; + + // Adjust coords and do a second test + vec.x += 0.1f; + vec.y += 0.1f; + + if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, false)) + foundColZ2 = foundCol.point.z; + + zForPed = max(foundColZ, foundColZ2); + + if (zForPed > -99.0f) + pos->z = 1.04f + zForPed; +} + +STARTPATCHES + InjectHook(0x4EE340, &CPedPlacement::FindZCoorForPed, PATCH_JUMP); +ENDPATCHES |