2023-04-29 13:29:28 +02:00
|
|
|
#include "core/data/ipls.hpp"
|
2022-02-28 23:04:56 +01:00
|
|
|
#include "fiber_pool.hpp"
|
|
|
|
#include "util/globals.hpp"
|
2022-07-27 14:39:22 +02:00
|
|
|
#include "util/mobile.hpp"
|
2022-02-28 23:04:56 +01:00
|
|
|
#include "util/teleport.hpp"
|
|
|
|
#include "util/vehicle.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
#include "views/view.hpp"
|
2022-02-28 23:04:56 +01:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
2022-06-27 15:45:26 +02:00
|
|
|
void view::teleport()
|
|
|
|
{
|
2023-06-27 14:05:44 +02:00
|
|
|
ImGui::SeparatorText("BLIPS"_T.data());
|
2023-06-10 14:47:19 +02:00
|
|
|
ImGui::Spacing();
|
2022-02-28 23:04:56 +01:00
|
|
|
|
2023-10-20 12:24:44 -04:00
|
|
|
components::command_button<"waypointtp">({}, "VIEW_PLAYER_TELEPORT_WAYPOINT"_T);
|
2022-12-22 21:23:32 +00:00
|
|
|
ImGui::SameLine();
|
2023-10-20 12:24:44 -04:00
|
|
|
components::command_button<"objectivetp">({}, "VIEW_TELEPORT_OBJECTIVE"_T);
|
2023-07-19 18:08:29 -04:00
|
|
|
ImGui::SameLine();
|
2023-10-20 12:24:44 -04:00
|
|
|
components::command_button<"highlighttp">({}, "VIEW_TELEPORT_SELECTED"_T);
|
2023-01-31 00:19:05 +01:00
|
|
|
components::command_checkbox<"autotptowp">();
|
2022-12-06 16:12:02 +00:00
|
|
|
|
2023-10-20 12:24:44 -04:00
|
|
|
ImGui::SeparatorText("VIEW_TELEPORT_MOVEMENT"_T.data());
|
2023-06-10 14:47:19 +02:00
|
|
|
|
|
|
|
ImGui::Spacing();
|
|
|
|
|
2023-10-20 12:24:44 -04:00
|
|
|
components::small_text("VIEW_TELEPORT_CURRENT_COORDINATES"_T);
|
2023-06-21 10:00:38 +02:00
|
|
|
float coords[3] = {self::pos.x, self::pos.y, self::pos.z};
|
2023-06-10 14:47:19 +02:00
|
|
|
static float new_location[3];
|
|
|
|
static float increment = 1;
|
|
|
|
|
2023-06-21 10:00:38 +02:00
|
|
|
ImGui::SetNextItemWidth(400);
|
|
|
|
ImGui::InputFloat3("##currentcoordinates", coords, "%f", ImGuiInputTextFlags_ReadOnly);
|
|
|
|
ImGui::SameLine();
|
2023-10-20 12:24:44 -04:00
|
|
|
components::button("VIEW_TELEPORT_COPY_TO_CUSTOM"_T, [coords] {
|
2023-06-21 10:00:38 +02:00
|
|
|
std::copy(std::begin(coords), std::end(coords), std::begin(new_location));
|
|
|
|
});
|
|
|
|
|
2023-10-20 12:24:44 -04:00
|
|
|
components::small_text("GUI_TAB_CUSTOM_TELEPORT"_T);
|
2023-06-21 10:00:38 +02:00
|
|
|
ImGui::SetNextItemWidth(400);
|
2023-06-10 14:47:19 +02:00
|
|
|
ImGui::InputFloat3("##Customlocation", new_location);
|
|
|
|
ImGui::SameLine();
|
2023-10-20 12:24:44 -04:00
|
|
|
components::button("GUI_TAB_TELEPORT"_T, [] {
|
2023-10-13 00:10:18 +02:00
|
|
|
teleport::to_coords({new_location[0], new_location[1], new_location[2]});
|
2023-06-10 14:47:19 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
ImGui::Spacing();
|
2023-10-20 12:24:44 -04:00
|
|
|
components::small_text("VIEW_TELEPORT_SPECIFIC_MOVEMENT"_T);
|
2023-06-21 10:00:38 +02:00
|
|
|
ImGui::Spacing();
|
|
|
|
|
2023-06-10 14:47:19 +02:00
|
|
|
ImGui::SetNextItemWidth(200);
|
2023-10-20 12:24:44 -04:00
|
|
|
ImGui::InputFloat("VIEW_SELF_CUSTOM_TELEPORT_DISTANCE"_T.data(), &increment);
|
2023-06-10 14:47:19 +02:00
|
|
|
|
|
|
|
ImGui::BeginGroup();
|
2023-10-20 12:24:44 -04:00
|
|
|
components::button("VIEW_TELEPORT_FORWARD"_T, [] {
|
2023-10-13 00:10:18 +02:00
|
|
|
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, increment, 0));
|
2023-06-10 14:47:19 +02:00
|
|
|
});
|
2023-10-20 12:24:44 -04:00
|
|
|
components::button("VIEW_TELEPORT_BACKWARD"_T, [] {
|
2023-10-13 00:10:18 +02:00
|
|
|
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, -increment, 0));
|
2023-06-10 14:47:19 +02:00
|
|
|
});
|
|
|
|
ImGui::EndGroup();
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
ImGui::BeginGroup();
|
2023-10-20 12:24:44 -04:00
|
|
|
components::button("LEFT"_T, [] {
|
2023-10-13 00:10:18 +02:00
|
|
|
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, -increment, 0, 0));
|
2023-06-10 14:47:19 +02:00
|
|
|
});
|
2023-10-20 12:24:44 -04:00
|
|
|
components::button("RIGHT"_T, [] {
|
2023-10-13 00:10:18 +02:00
|
|
|
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, increment, 0, 0));
|
2023-06-10 14:47:19 +02:00
|
|
|
});
|
|
|
|
ImGui::EndGroup();
|
|
|
|
|
|
|
|
ImGui::SameLine();
|
|
|
|
|
|
|
|
ImGui::BeginGroup();
|
2023-10-20 12:24:44 -04:00
|
|
|
components::button("VIEW_TELEPORT_UP"_T, [] {
|
2023-10-13 00:10:18 +02:00
|
|
|
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, 0, increment));
|
2023-06-10 14:47:19 +02:00
|
|
|
});
|
2023-10-20 12:24:44 -04:00
|
|
|
components::button("VIEW_TELEPORT_DOWN"_T, [] {
|
2023-10-13 00:10:18 +02:00
|
|
|
teleport::to_coords(ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, 0, -increment));
|
2023-06-10 14:47:19 +02:00
|
|
|
});
|
|
|
|
ImGui::EndGroup();
|
|
|
|
|
2023-06-27 14:05:44 +02:00
|
|
|
ImGui::SeparatorText("VEHICLES"_T.data());
|
2023-06-10 14:47:19 +02:00
|
|
|
ImGui::Spacing();
|
|
|
|
|
2022-12-22 21:23:32 +00:00
|
|
|
components::command_button<"lastvehtp">();
|
|
|
|
ImGui::SameLine();
|
|
|
|
components::command_button<"bringpv">();
|
|
|
|
ImGui::SameLine();
|
|
|
|
components::command_button<"pvtp">();
|
2023-04-29 13:29:28 +02:00
|
|
|
|
2023-06-27 14:05:44 +02:00
|
|
|
ImGui::SeparatorText("GUI_TAB_IPL"_T.data());
|
2023-04-29 13:29:28 +02:00
|
|
|
|
2023-10-23 15:33:01 -06:00
|
|
|
static int current_select = -1;
|
|
|
|
static int last_select = current_select;
|
|
|
|
|
|
|
|
ImGui::SetNextItemWidth(400);
|
|
|
|
if (ImGui::BeginCombo("##Ipllocation", ipls[current_select].friendly_name))
|
2023-04-29 13:29:28 +02:00
|
|
|
{
|
|
|
|
for (int i = 0; i < IM_ARRAYSIZE(ipls); i++)
|
|
|
|
{
|
2023-10-23 15:33:01 -06:00
|
|
|
bool is_selected = (i == current_select);
|
|
|
|
if (ImGui::Selectable(ipls[i].friendly_name, is_selected))
|
|
|
|
{
|
|
|
|
current_select = i;
|
|
|
|
}
|
|
|
|
if (is_selected)
|
|
|
|
{
|
2023-04-29 13:29:28 +02:00
|
|
|
ImGui::SetItemDefaultFocus();
|
2023-10-23 15:33:01 -06:00
|
|
|
}
|
2023-04-29 13:29:28 +02:00
|
|
|
}
|
|
|
|
ImGui::EndCombo();
|
|
|
|
}
|
2023-10-23 15:33:01 -06:00
|
|
|
ImGui::SameLine();
|
|
|
|
components::button("LOAD_IPL"_T, []
|
2023-04-29 13:29:28 +02:00
|
|
|
{
|
2023-10-23 15:33:01 -06:00
|
|
|
// If we've changed selections, first unload previously loaded IPL, then load previously deleted IPLs
|
|
|
|
if (current_select != last_select)
|
|
|
|
{
|
|
|
|
// Unload previously loaded IPL of the last selection
|
|
|
|
for (auto& ipl_name_unload : ipls[last_select].ipl_names)
|
2023-04-29 13:29:28 +02:00
|
|
|
{
|
2023-10-23 15:33:01 -06:00
|
|
|
if (STREAMING::IS_IPL_ACTIVE(ipl_name_unload))
|
2023-04-29 13:29:28 +02:00
|
|
|
{
|
2023-10-23 15:33:01 -06:00
|
|
|
STREAMING::REMOVE_IPL(ipl_name_unload);
|
2023-04-29 13:29:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-23 15:33:01 -06:00
|
|
|
// Load previously deleted IPLs of the last selection
|
|
|
|
for (auto& ipl_name_load : ipls[last_select].ipl_names_remove)
|
|
|
|
{
|
|
|
|
STREAMING::REQUEST_IPL(ipl_name_load);
|
|
|
|
}
|
2023-04-29 13:29:28 +02:00
|
|
|
|
2023-10-23 15:33:01 -06:00
|
|
|
// Load new IPLs of the current selection
|
|
|
|
for (auto& ipl_name : ipls[current_select].ipl_names)
|
|
|
|
{
|
|
|
|
STREAMING::REQUEST_IPL(ipl_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove old IPLs of the current selection to avoid conflicts
|
|
|
|
for (auto& ipl_name_remove : ipls[current_select].ipl_names_remove_when_load)
|
|
|
|
{
|
|
|
|
STREAMING::REMOVE_IPL(ipl_name_remove);
|
|
|
|
}
|
2023-04-29 13:29:28 +02:00
|
|
|
|
2023-10-23 15:33:01 -06:00
|
|
|
last_select = current_select;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
ImGui::SameLine();
|
|
|
|
components::button("TP_TO_IPL"_T, []
|
2023-04-29 13:29:28 +02:00
|
|
|
{
|
2023-10-23 15:33:01 -06:00
|
|
|
teleport::to_coords(ipls[current_select].location);
|
|
|
|
});
|
2023-04-29 13:29:28 +02:00
|
|
|
|
2023-06-10 14:47:19 +02:00
|
|
|
ImGui::Spacing();
|
2023-10-20 12:24:44 -04:00
|
|
|
components::small_text("IPL_INFOS"_T);
|
2023-06-10 14:47:19 +02:00
|
|
|
|
2023-10-23 15:33:01 -06:00
|
|
|
ImGui::Text(std::vformat("IPL_CNT"_T, std::make_format_args(ipls[current_select].ipl_names.size())).data());
|
|
|
|
ImGui::Text(std::vformat("IPL_POSITION"_T, std::make_format_args(ipls[current_select].location.x, ipls[current_select].location.y, ipls[current_select].location.z)).data());
|
2022-02-28 23:04:56 +01:00
|
|
|
}
|
2022-06-27 15:45:26 +02:00
|
|
|
}
|