summaryrefslogtreecommitdiff
path: root/src/peds/PedPlacement.cpp
diff options
context:
space:
mode:
authorclaude-bot <[email protected]>2026-07-13 12:27:07 +0000
committerclaude-bot <[email protected]>2026-07-13 12:27:07 +0000
commit9f61c9e6ac6b1ac5692cf6352d2ebbd47a31a686 (patch)
treea84756b82513739a2672db3a1f0ec579db6d18ff /src/peds/PedPlacement.cpp
downloadre3-miami.tar.gz
re3-miami.zip
Import Cai1Hsu/re3 @ miami (reVC / GTA:VC decompilation)HEADmiami
Snapshot import (no upstream history) into git.ancap.in.ua/claude, per @lzcnt. Source: https://github.com/Cai1Hsu/re3 branch miami.
Diffstat (limited to 'src/peds/PedPlacement.cpp')
-rw-r--r--src/peds/PedPlacement.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/peds/PedPlacement.cpp b/src/peds/PedPlacement.cpp
new file mode 100644
index 0000000..840d33f
--- /dev/null
+++ b/src/peds/PedPlacement.cpp
@@ -0,0 +1,58 @@
+#include "common.h"
+
+#include "Ped.h"
+#include "PedPlacement.h"
+#include "World.h"
+
+bool
+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, nil))
+ 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, nil))
+ foundColZ2 = foundCol.point.z;
+
+ zForPed = Max(foundColZ, foundColZ2);
+
+ if (zForPed > -99.0f) {
+ pos->z = FEET_OFFSET + zForPed;
+ return true;
+ }
+ return false;
+}
+
+CEntity*
+CPedPlacement::IsPositionClearOfCars(Const CVector *pos)
+{
+ return CWorld::TestSphereAgainstWorld(*pos, 0.25f, nil, true, true, false, false, false, false);
+}
+
+bool
+CPedPlacement::IsPositionClearForPed(const CVector& pos, float radius, int total, CEntity** entities)
+{
+ int16 count;
+ if (radius == -1.0f)
+ radius = 0.75f;
+ if (total == -1)
+ total = 2;
+ CWorld::FindObjectsKindaColliding(pos, radius, true, &count, total, entities, false, true, true, false, false);
+ return count == 0;
+}