2021-10-25 10:03:27 -04:00
|
|
|
#include "pch.h"
|
2021-09-20 08:41:40 -04:00
|
|
|
#include "teleport.h"
|
|
|
|
#include "menu.h"
|
2022-06-29 19:56:53 -04:00
|
|
|
#include "widget.h"
|
2021-09-20 08:41:40 -04:00
|
|
|
#include "util.h"
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2021-08-01 21:41:48 -04:00
|
|
|
#ifdef GTASA
|
2021-01-09 15:06:53 -05:00
|
|
|
// FlA
|
2021-10-25 10:03:27 -04:00
|
|
|
tRadarTrace* CRadar::ms_RadarTrace = reinterpret_cast<tRadarTrace*>(patch::GetPointer(0x5838B0 + 2));
|
2021-01-09 15:06:53 -05:00
|
|
|
|
2020-12-09 08:15:50 -05:00
|
|
|
void Teleport::FetchRadarSpriteData()
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-23 07:30:28 -05:00
|
|
|
static int maxSprites = *(uint*)0x5D5870;
|
2022-06-16 06:51:22 -04:00
|
|
|
uint timer = CTimer::m_snTimeInMilliseconds;
|
|
|
|
static uint lastUpdated = timer;
|
2022-01-07 03:18:00 -05:00
|
|
|
|
|
|
|
// Update the radar list each 5 seconds
|
2022-06-16 06:51:22 -04:00
|
|
|
if (timer - lastUpdated < 5000)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-17 18:07:30 -04:00
|
|
|
m_locData.m_pData->RemoveTable("Radar");
|
2022-01-23 07:30:28 -05:00
|
|
|
for (int i = 0; i != maxSprites; ++i)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-05-08 01:36:36 -04:00
|
|
|
CVector pos = CRadar::ms_RadarTrace[i].m_vecPos;
|
2022-06-15 06:45:43 -04:00
|
|
|
std::string sprite = std::to_string(CRadar::ms_RadarTrace[i].m_nRadarSprite);
|
|
|
|
std::string keyName = m_SpriteData.Get<std::string>(sprite.c_str(), "Unknown");
|
|
|
|
keyName += ", " + Util::GetLocationName(&pos);
|
|
|
|
std::string key = "Radar." + keyName;
|
2022-07-17 18:07:30 -04:00
|
|
|
m_locData.m_pData->Set(key.c_str(), std::format("0, {}, {}, {}", pos.x, pos.y, pos.z));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2022-06-16 06:51:22 -04:00
|
|
|
lastUpdated = timer;
|
2020-12-09 08:15:50 -05:00
|
|
|
}
|
2021-08-01 21:41:48 -04:00
|
|
|
#endif
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2022-02-21 03:33:57 -05:00
|
|
|
void Teleport::Init()
|
2020-12-09 08:15:50 -05:00
|
|
|
{
|
2022-07-06 15:11:53 -04:00
|
|
|
m_bTeleportMarker = gConfig.Get("Features.TeleportMarker", false);
|
2022-06-16 06:51:22 -04:00
|
|
|
m_bQuickTeleport = gConfig.Get("Features.QuickTeleport", false);
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
Events::processScriptsEvent += []
|
|
|
|
{
|
2022-07-06 16:23:32 -04:00
|
|
|
if ((TPMarker::m_bEnabled == true) && ((CTimer::m_snTimeInMilliseconds - TPMarker::m_nTimer) > 50))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
CPlayerPed* player = FindPlayerPed();
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-01-07 03:18:00 -05:00
|
|
|
CEntity* player_entity = FindPlayerEntity(-1);
|
2022-07-06 15:11:53 -04:00
|
|
|
TPMarker::m_fPos.z = CWorld::FindGroundZFor3DCoord(TPMarker::m_fPos.x, TPMarker::m_fPos.y,
|
|
|
|
TPMarker::m_fPos.z + 100.0f, nullptr, &player_entity) + 1.0f;
|
2022-01-07 03:18:00 -05:00
|
|
|
#else
|
2022-07-06 15:11:53 -04:00
|
|
|
TPMarker::m_fPos.z = CWorld::FindGroundZFor3DCoord(TPMarker::m_fPos.x, TPMarker::m_fPos.y,
|
|
|
|
TPMarker::m_fPos.z + 100.0f, nullptr) + 1.0f;
|
2022-01-07 03:18:00 -05:00
|
|
|
#endif
|
|
|
|
CVehicle* pVeh = player->m_pVehicle;
|
|
|
|
|
|
|
|
if (pVeh && BY_GAME(player->m_nPedFlags.bInVehicle, player->m_pVehicle, player->m_pVehicle))
|
|
|
|
{
|
2022-07-06 15:11:53 -04:00
|
|
|
BY_GAME(pVeh->Teleport(TPMarker::m_fPos, false), pVeh->Teleport(TPMarker::m_fPos), player->Teleport(TPMarker::m_fPos));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-07-06 15:11:53 -04:00
|
|
|
BY_GAME(player->Teleport(TPMarker::m_fPos, false), player->Teleport(TPMarker::m_fPos), player->Teleport(TPMarker::m_fPos));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2022-07-06 16:23:32 -04:00
|
|
|
#ifdef GTASA
|
|
|
|
if (TPMarker::m_bJetpack)
|
|
|
|
{
|
|
|
|
Command<Commands::TASK_JETPACK>(CPools::GetPedRef(player));
|
|
|
|
}
|
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
|
2022-07-06 15:11:53 -04:00
|
|
|
TPMarker::m_bEnabled = false;
|
2022-01-07 03:18:00 -05:00
|
|
|
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(player), false);
|
|
|
|
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
|
|
|
|
TheCamera.Fade(0, 1);
|
|
|
|
}
|
|
|
|
|
2022-07-06 15:11:53 -04:00
|
|
|
if (m_bTeleportMarker && teleportMarker.Pressed())
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-07-29 16:12:34 -04:00
|
|
|
WarpPlayer<eTeleportType::Marker>();
|
2022-07-06 15:11:53 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef GTASA
|
|
|
|
Events::drawingEvent += []
|
|
|
|
{
|
|
|
|
if (m_bQuickTeleport && quickTeleport.PressedRealtime())
|
|
|
|
{
|
|
|
|
static CSprite2d map;
|
|
|
|
if (!map.m_pTexture)
|
|
|
|
{
|
|
|
|
map.m_pTexture = gTextureList.FindTextureByName("map");
|
|
|
|
}
|
|
|
|
float height = screen::GetScreenHeight();
|
|
|
|
float width = screen::GetScreenWidth();
|
|
|
|
float size = width * height / width; // keep aspect ratio
|
|
|
|
float left = (width-size) / 2;
|
|
|
|
float right = left+size;
|
|
|
|
map.Draw(CRect(left, 0.0f, right, height), CRGBA(255, 255, 255, 200));
|
|
|
|
|
|
|
|
if (ImGui::IsMouseClicked(0))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-07-06 15:11:53 -04:00
|
|
|
// Convert screen space to image space
|
|
|
|
ImVec2 pos = ImGui::GetMousePos();
|
2022-07-06 22:28:09 -04:00
|
|
|
if (pos.x > left && pos.x < right)
|
|
|
|
{
|
|
|
|
pos.x -= left;
|
|
|
|
pos.x -= size/2;
|
|
|
|
pos.y -= size/2;
|
|
|
|
|
|
|
|
// Convert image space to map space
|
|
|
|
pos.x = pos.x / size * 6000;
|
|
|
|
pos.y = pos.y / size * 6000;
|
|
|
|
pos.y *= -1;
|
|
|
|
|
2022-07-29 16:12:34 -04:00
|
|
|
WarpPlayer<eTeleportType::MapPosition>(CVector(pos.x, pos.y, 0.0f));
|
2022-07-06 22:28:09 -04:00
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2022-07-06 15:11:53 -04:00
|
|
|
#endif
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|
|
|
|
|
2022-07-29 16:12:34 -04:00
|
|
|
template<eTeleportType Type>
|
|
|
|
void Teleport::WarpPlayer(CVector pos, int interiorID)
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
CPlayerPed* pPlayer = FindPlayerPed();
|
|
|
|
CVehicle* pVeh = pPlayer->m_pVehicle;
|
2022-07-06 16:23:32 -04:00
|
|
|
int hplayer = CPools::GetPedRef(pPlayer);
|
2022-01-07 03:18:00 -05:00
|
|
|
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-07-06 16:23:32 -04:00
|
|
|
TPMarker::m_bJetpack = Command<Commands::IS_PLAYER_USING_JETPACK>(0);
|
2022-07-29 16:12:34 -04:00
|
|
|
if (Type == eTeleportType::Marker || Type == eTeleportType::MapPosition)
|
|
|
|
{
|
|
|
|
if (Type == eTeleportType::Marker)
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-07-29 16:12:34 -04:00
|
|
|
tRadarTrace targetBlip = CRadar::ms_RadarTrace[LOWORD(FrontEndMenuManager.m_nTargetBlipIndex)];
|
|
|
|
if (targetBlip.m_nRadarSprite != RADAR_SPRITE_WAYPOINT)
|
|
|
|
{
|
2022-07-30 17:57:09 -04:00
|
|
|
Util::SetMessage(TEXT("Teleport.TargetBlipText"));
|
2022-07-29 16:12:34 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
pos = targetBlip.m_vecPos;
|
|
|
|
}
|
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
CEntity* pPlayerEntity = FindPlayerEntity(-1);
|
2022-02-20 04:47:53 -05:00
|
|
|
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, 1000, nullptr, &pPlayerEntity) + 500.f;
|
2022-01-07 03:18:00 -05:00
|
|
|
|
2022-07-06 15:11:53 -04:00
|
|
|
TPMarker::m_fPos = pos;
|
|
|
|
TPMarker::m_nTimer = CTimer::m_snTimeInMilliseconds;
|
|
|
|
TPMarker::m_bEnabled = true;
|
2022-01-07 03:18:00 -05:00
|
|
|
TheCamera.Fade(0, 0);
|
|
|
|
Command<Commands::FREEZE_CHAR_POSITION_AND_DONT_LOAD_COLLISION>(CPools::GetPedRef(pPlayer), true);
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2021-10-21 19:07:30 -04:00
|
|
|
#ifdef GTA3
|
2022-01-07 03:18:00 -05:00
|
|
|
CStreaming::LoadScene(pos);
|
2021-10-21 19:07:30 -04:00
|
|
|
#else
|
2022-01-07 03:18:00 -05:00
|
|
|
CStreaming::LoadScene(&pos);
|
|
|
|
CStreaming::LoadSceneCollision(&pos);
|
2021-10-21 19:07:30 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
CStreaming::LoadAllRequestedModels(false);
|
2021-06-18 12:49:11 -04:00
|
|
|
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-02-13 00:29:58 -05:00
|
|
|
|
2022-01-07 03:18:00 -05:00
|
|
|
if (pVeh && pPlayer->m_nPedFlags.bInVehicle)
|
|
|
|
{
|
|
|
|
|
2022-02-13 00:29:58 -05:00
|
|
|
if (CModelInfo::IsTrainModel(pVeh->m_nModelIndex))
|
|
|
|
{
|
|
|
|
CVector vehPos = pVeh->GetPosition();
|
|
|
|
Command<Commands::WARP_CHAR_FROM_CAR_TO_COORD>(CPools::GetPedRef(pPlayer), vehPos.x, vehPos.y, vehPos.z + 2.0f);
|
|
|
|
|
|
|
|
if (DistanceBetweenPoints(pos, vehPos) > 100.0f)
|
|
|
|
{
|
|
|
|
Command<Commands::DELETE_ALL_TRAINS>();
|
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
|
2022-02-13 00:29:58 -05:00
|
|
|
pPlayer->Teleport(pos, false);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pVeh->Teleport(pos, false);
|
|
|
|
|
|
|
|
if (pVeh->m_nVehicleClass == VEHICLE_BIKE)
|
|
|
|
{
|
|
|
|
reinterpret_cast<CBike*>(pVeh)->PlaceOnRoadProperly();
|
|
|
|
}
|
|
|
|
else if (pVeh->m_nVehicleClass != VEHICLE_BOAT)
|
|
|
|
{
|
|
|
|
reinterpret_cast<CAutomobile*>(pVeh)->PlaceOnRoadProperly();
|
|
|
|
}
|
|
|
|
|
2022-07-29 16:12:34 -04:00
|
|
|
pVeh->m_nAreaCode = interiorID;
|
2022-02-13 00:29:58 -05:00
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pPlayer->Teleport(pos, false);
|
|
|
|
}
|
2022-07-06 16:23:32 -04:00
|
|
|
|
|
|
|
if (TPMarker::m_bJetpack)
|
|
|
|
{
|
|
|
|
Command<Commands::TASK_JETPACK>(hplayer);
|
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
#else
|
|
|
|
if (pVeh && pPlayer->m_pVehicle)
|
|
|
|
{
|
2022-02-13 00:29:58 -05:00
|
|
|
#ifdef GTAVC
|
2022-07-30 17:57:09 -04:00
|
|
|
pPlayer->m_nAreaCode = interiorID;
|
2021-10-21 19:07:30 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
pVeh->Teleport(pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pPlayer->Teleport(pos);
|
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2020-12-25 12:44:41 -05:00
|
|
|
|
2022-02-13 00:29:58 -05:00
|
|
|
#if defined GTASA || defined GTAVC
|
2022-07-29 16:12:34 -04:00
|
|
|
pPlayer->m_nAreaCode = interiorID;
|
|
|
|
Command<Commands::SET_AREA_VISIBLE>(interiorID);
|
2021-11-24 08:28:55 -05:00
|
|
|
#endif
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|
|
|
|
|
2021-10-25 10:03:27 -04:00
|
|
|
void Teleport::TeleportToLocation(std::string& rootkey, std::string& bLocName, std::string& loc)
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
try
|
|
|
|
{
|
|
|
|
int dimension = 0;
|
|
|
|
CVector pos;
|
|
|
|
sscanf(loc.c_str(), "%d,%f,%f,%f", &dimension, &pos.x, &pos.y, &pos.z);
|
2022-07-29 16:12:34 -04:00
|
|
|
WarpPlayer<eTeleportType::Coordinate>(pos, dimension);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
2022-07-30 17:57:09 -04:00
|
|
|
Util::SetMessage(TEXT("Teleport.InvalidLocation"));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|
|
|
|
|
2021-10-25 10:03:27 -04:00
|
|
|
void Teleport::RemoveTeleportEntry(std::string& category, std::string& key, std::string& val)
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
if (category == "Custom")
|
|
|
|
{
|
2022-07-17 18:07:30 -04:00
|
|
|
m_locData.m_pData->RemoveKey("Custom", key.c_str());
|
2022-07-30 17:57:09 -04:00
|
|
|
Util::SetMessage(TEXT("Teleport.LocationRemoved"));
|
2022-07-17 18:07:30 -04:00
|
|
|
m_locData.m_pData->Save();
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-07-30 17:57:09 -04:00
|
|
|
Util::SetMessage(TEXT("Teleport.CustomLocationRemoveOnly"));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2020-12-02 16:19:16 -05:00
|
|
|
}
|
|
|
|
|
2022-01-20 02:04:45 -05:00
|
|
|
void Teleport::ShowPage()
|
2020-12-02 16:19:16 -05:00
|
|
|
{
|
2022-01-07 03:18:00 -05:00
|
|
|
if (ImGui::BeginTabBar("Teleport", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
|
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
2022-02-13 00:29:58 -05:00
|
|
|
if (ImGui::BeginTabItem(TEXT("Window.TeleportPage")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
ImGui::Spacing();
|
|
|
|
if (ImGui::BeginChild("Teleport Child"))
|
|
|
|
{
|
|
|
|
ImGui::Columns(2, nullptr, false);
|
2022-02-13 00:29:58 -05:00
|
|
|
ImGui::Checkbox(TEXT("Teleport.InsertCoord"), &m_bInsertCoord);
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-07-01 04:06:34 -04:00
|
|
|
if (Widget::Checkbox(TEXT("Teleport.QuickTeleport"), &m_bQuickTeleport,
|
2022-02-13 00:29:58 -05:00
|
|
|
std::string(TEXT_S("Teleport.QuickTeleportHint")
|
|
|
|
+ quickTeleport.GetNameString()).c_str()))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-06-16 06:51:22 -04:00
|
|
|
gConfig.Set("Features.QuickTeleport", m_bQuickTeleport);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2022-07-06 15:11:53 -04:00
|
|
|
#endif
|
|
|
|
ImGui::NextColumn();
|
|
|
|
#ifdef GTASA
|
|
|
|
if (Widget::Checkbox(TEXT("Teleport.TeleportMarker"), &m_bTeleportMarker,
|
|
|
|
std::string(TEXT_S("Teleport.TeleportMarkerHint")
|
|
|
|
+ teleportMarker.GetNameString()).c_str()))
|
|
|
|
{
|
|
|
|
gConfig.Set("Features.TeleportMarker", m_bTeleportMarker);
|
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
#endif
|
|
|
|
ImGui::Columns(1);
|
|
|
|
ImGui::Spacing();
|
|
|
|
|
|
|
|
if (m_bInsertCoord)
|
|
|
|
{
|
|
|
|
CVector pos = FindPlayerPed()->GetPosition();
|
|
|
|
|
|
|
|
strcpy(m_nInputBuffer,
|
|
|
|
(std::to_string(static_cast<int>(pos.x)) + ", " + std::to_string(static_cast<int>(pos.y)) +
|
|
|
|
", " + std::to_string(static_cast<int>(pos.z))).c_str());
|
|
|
|
}
|
|
|
|
|
2022-02-13 00:29:58 -05:00
|
|
|
ImGui::InputTextWithHint(TEXT("Teleport.Coordinates"), "x, y, z", m_nInputBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
2022-01-07 03:18:00 -05:00
|
|
|
|
|
|
|
ImGui::Spacing();
|
|
|
|
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Teleport.TeleportToCoord"), Widget::CalcSize(2)))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
|
|
|
CVector pos{0, 0, 10};
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sscanf(m_nInputBuffer,"%f,%f,%f", &pos.x, &pos.y, &pos.z);
|
|
|
|
pos.z += 1.0f;
|
2022-07-29 16:12:34 -04:00
|
|
|
WarpPlayer(pos);
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
2022-07-30 17:57:09 -04:00
|
|
|
Util::SetMessage(TEXT("Teleport.InvalidCoord"));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::SameLine();
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-07-07 03:32:37 -04:00
|
|
|
if (ImGui::Button((TEXT_S("Teleport.TeleportMarker") + "##Btn").c_str(), Widget::CalcSize(2)))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-07-29 16:12:34 -04:00
|
|
|
WarpPlayer<eTeleportType::Marker>();
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#else
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Teleport.TeleportCenter"), Widget::CalcSize(2)))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-07-30 17:57:09 -04:00
|
|
|
WarpPlayer<eTeleportType::Coordinate>(CVector(0, 0, 23));
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2021-08-14 20:36:11 -04:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::EndChild();
|
|
|
|
}
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
2020-12-02 16:19:16 -05:00
|
|
|
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::BeginTabItem(TEXT("Window.LocationsTab")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2021-08-14 20:36:11 -04:00
|
|
|
#ifdef GTASA
|
2022-01-07 03:18:00 -05:00
|
|
|
FetchRadarSpriteData();
|
2022-02-07 03:46:55 -05:00
|
|
|
#endif
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::Spacing();
|
2022-02-13 00:29:58 -05:00
|
|
|
if (ImGui::CollapsingHeader(TEXT("Window.AddNew")))
|
2022-01-07 03:18:00 -05:00
|
|
|
{
|
2022-02-07 03:46:55 -05:00
|
|
|
ImGui::Spacing();
|
2022-02-13 00:29:58 -05:00
|
|
|
ImGui::InputTextWithHint(TEXT("Teleport.Location"), TEXT("Teleport.LocationHint"), m_nLocationBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
|
|
|
ImGui::InputTextWithHint(TEXT("Teleport.Coordinates"), "x, y, z", m_nInputBuffer, IM_ARRAYSIZE(m_nInputBuffer));
|
2022-02-07 03:46:55 -05:00
|
|
|
ImGui::Spacing();
|
2022-06-29 19:56:53 -04:00
|
|
|
if (ImGui::Button(TEXT("Teleport.AddLocation"), Widget::CalcSize()))
|
2022-02-07 03:46:55 -05:00
|
|
|
{
|
2022-06-15 06:45:43 -04:00
|
|
|
std::string key = std::string("Custom.") + m_nLocationBuffer;
|
2022-07-17 18:07:30 -04:00
|
|
|
m_locData.m_pData->Set(key.c_str(), ("0, " + std::string(m_nInputBuffer)));
|
2020-12-21 15:24:07 -05:00
|
|
|
|
2022-02-07 03:46:55 -05:00
|
|
|
#ifdef GTASA
|
|
|
|
// Clear the Radar coordinates
|
2022-07-17 18:07:30 -04:00
|
|
|
m_locData.m_pData->RemoveTable("Radar");
|
2022-02-07 03:46:55 -05:00
|
|
|
#endif
|
2020-12-21 15:24:07 -05:00
|
|
|
|
2022-07-17 18:07:30 -04:00
|
|
|
m_locData.m_pData->Save();
|
2022-02-07 03:46:55 -05:00
|
|
|
}
|
2022-01-07 03:18:00 -05:00
|
|
|
}
|
2022-02-07 03:46:55 -05:00
|
|
|
|
|
|
|
ImGui::Spacing();
|
2022-07-17 18:07:30 -04:00
|
|
|
Widget::DataList(m_locData, TeleportToLocation, RemoveTeleportEntry);
|
2022-01-07 03:18:00 -05:00
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
|
|
|
ImGui::EndTabBar();
|
|
|
|
}
|
2021-06-18 12:49:11 -04:00
|
|
|
}
|