fix debug teleport

This commit is contained in:
Nikolay Korolev 2021-08-26 21:50:19 +03:00
parent b2daa0e502
commit 7a80acf6a1

View file

@ -47,6 +47,7 @@
#include "CarCtrl.h" #include "CarCtrl.h"
#include "Population.h" #include "Population.h"
#include "IniFile.h" #include "IniFile.h"
#include "Zones.h"
#include "crossplatform.h" #include "crossplatform.h"
@ -775,14 +776,14 @@ FixCar(void)
static void static void
TeleportToWaypoint(void) TeleportToWaypoint(void)
{ {
CStreaming::LoadScene(CRadar::TargetMarkerPos); if (CRadar::TargetMarkerId == -1)
CStreaming::LoadSceneCollision(CRadar::TargetMarkerPos); return;
if (FindPlayerVehicle()) { CEntity* pEntityToTeleport = FindPlayerEntity();
if (CRadar::TargetMarkerId != -1) CVector vNewPos = CRadar::TargetMarkerPos;
FindPlayerVehicle()->Teleport(CRadar::TargetMarkerPos + CVector(0.0f, 0.0f, CWorld::FindGroundZForCoord(CRadar::TargetMarkerPos.x, CRadar::TargetMarkerPos.y) + FindPlayerVehicle()->GetColModel()->boundingSphere.radius)); CStreaming::LoadScene(vNewPos);
} else CStreaming::LoadSceneCollision(vNewPos);
if(CRadar::TargetMarkerId != -1) vNewPos.z = CWorld::FindGroundZForCoord(vNewPos.x, vNewPos.y) + pEntityToTeleport->GetDistanceFromCentreOfMassToBaseOfModel();
FindPlayerPed()->Teleport(CRadar::TargetMarkerPos + CVector(0.0f, 0.0f, CWorld::FindGroundZForCoord(CRadar::TargetMarkerPos.x, CRadar::TargetMarkerPos.y) + FEET_OFFSET)); pEntityToTeleport->Teleport(vNewPos);
} }
#endif #endif