1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-05 04:15:55 +00:00
re3/src/peds/PedPlacement.cpp

48 lines
1.1 KiB
C++
Raw Normal View History

#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
);
2019-06-30 10:53:39 +00:00
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;
2019-06-30 10:53:39 +00:00
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, nil))
foundColZ2 = foundCol.point.z;
2019-08-16 18:17:15 +00:00
zForPed = Max(foundColZ, foundColZ2);
if (zForPed > -99.0f)
pos->z = 1.04f + zForPed;
}
CEntity*
CPedPlacement::IsPositionClearOfCars(CVector* pos)
{
2019-07-31 15:54:18 +00:00
return CWorld::TestSphereAgainstWorld(*pos, 0.25f, nil, true, true, false, false, false, false);
}
STARTPATCHES
InjectHook(0x4EE340, &CPedPlacement::FindZCoorForPed, PATCH_JUMP);
InjectHook(0x4EE310, &CPedPlacement::IsPositionClearOfCars, PATCH_JUMP);
ENDPATCHES