summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-08-26 20:50:19 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2021-08-26 20:56:31 +0200
commit7a80acf6a16cae5aa3303090097a43406746e04d (patch)
treecc381a9a9fae7b8cc67bf55a6053deb20592de0d
parentMerge remote-tracking branch 'upstream/miami' into miami (diff)
downloadre3-7a80acf6a16cae5aa3303090097a43406746e04d.tar
re3-7a80acf6a16cae5aa3303090097a43406746e04d.tar.gz
re3-7a80acf6a16cae5aa3303090097a43406746e04d.tar.bz2
re3-7a80acf6a16cae5aa3303090097a43406746e04d.tar.lz
re3-7a80acf6a16cae5aa3303090097a43406746e04d.tar.xz
re3-7a80acf6a16cae5aa3303090097a43406746e04d.tar.zst
re3-7a80acf6a16cae5aa3303090097a43406746e04d.zip
-rw-r--r--src/core/re3.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 672cca98..b9cfc34d 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -47,6 +47,7 @@
#include "CarCtrl.h"
#include "Population.h"
#include "IniFile.h"
+#include "Zones.h"
#include "crossplatform.h"
@@ -775,14 +776,14 @@ FixCar(void)
static void
TeleportToWaypoint(void)
{
- CStreaming::LoadScene(CRadar::TargetMarkerPos);
- CStreaming::LoadSceneCollision(CRadar::TargetMarkerPos);
- if (FindPlayerVehicle()) {
- if (CRadar::TargetMarkerId != -1)
- FindPlayerVehicle()->Teleport(CRadar::TargetMarkerPos + CVector(0.0f, 0.0f, CWorld::FindGroundZForCoord(CRadar::TargetMarkerPos.x, CRadar::TargetMarkerPos.y) + FindPlayerVehicle()->GetColModel()->boundingSphere.radius));
- } else
- if(CRadar::TargetMarkerId != -1)
- FindPlayerPed()->Teleport(CRadar::TargetMarkerPos + CVector(0.0f, 0.0f, CWorld::FindGroundZForCoord(CRadar::TargetMarkerPos.x, CRadar::TargetMarkerPos.y) + FEET_OFFSET));
+ if (CRadar::TargetMarkerId == -1)
+ return;
+ CEntity* pEntityToTeleport = FindPlayerEntity();
+ CVector vNewPos = CRadar::TargetMarkerPos;
+ CStreaming::LoadScene(vNewPos);
+ CStreaming::LoadSceneCollision(vNewPos);
+ vNewPos.z = CWorld::FindGroundZForCoord(vNewPos.x, vNewPos.y) + pEntityToTeleport->GetDistanceFromCentreOfMassToBaseOfModel();
+ pEntityToTeleport->Teleport(vNewPos);
}
#endif