Fixed teleport::to_coords not respecting the rotation and view angles from persist teleport. (#2396)

* Fixed teleport::to_coords not respecting the rotation and view angles from persist teleport.

* Fixed World -> Vehicles -> Max Vehicle Mods button being cut off.
This commit is contained in:
gir489 2023-11-08 18:12:31 -05:00 committed by GitHub
parent dc321104c4
commit 93dea3bebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 18 deletions

View File

@ -8,9 +8,21 @@
namespace big::teleport
{
inline void to_coords(const Vector3& location)
inline void to_coords(const Vector3& location, const Vector3& euler = {0, 0, 0})
{
PED::SET_PED_COORDS_KEEP_VEHICLE(self::ped, location.x, location.y, location.z + 1.f);
if (euler.x != 0.f)
{
if (PED::IS_PED_IN_ANY_VEHICLE(self::ped, true))
{
ENTITY::SET_ENTITY_HEADING(self::veh, euler.x);
}
}
if (euler.y != 0.f && euler.z != 0.f)
{
CAM::SET_GAMEPLAY_CAM_RELATIVE_PITCH(euler.y, 1.f);
CAM::SET_GAMEPLAY_CAM_RELATIVE_HEADING(euler.z);
}
}
inline bool teleport_player_to_coords(player_ptr player, Vector3 coords, Vector3 euler = {0, 0, 0})
@ -22,11 +34,11 @@ namespace big::teleport
else
ent = PLAYER::PLAYER_PED_ID();
bool is_local_player = (ent == self::ped || ent == self::veh);
bool is_local_player = ent == self::ped;
if (is_local_player)
{
to_coords(coords);
to_coords(coords, euler);
return true;
}
@ -43,14 +55,9 @@ namespace big::teleport
if (entity::take_control_of(ent))
{
ENTITY::SET_ENTITY_COORDS_NO_OFFSET(ent, coords.x, coords.y, coords.z, TRUE, TRUE, TRUE);
if (euler.x + euler.y + euler.z != 0.0f)
if (euler.x != 0.0f)
{
ENTITY::SET_ENTITY_HEADING(ent, euler.x);
if (is_local_player)
{
CAM::SET_GAMEPLAY_CAM_RELATIVE_PITCH(euler.y, 1.f);
CAM::SET_GAMEPLAY_CAM_RELATIVE_HEADING(euler.z);
}
}
}
else
@ -80,13 +87,6 @@ namespace big::teleport
g.m_remote_player_teleports.emplace(veh_id, remote_tp);
if (is_local_player)
{
ENTITY::SET_ENTITY_HEADING(ent, euler.x);
CAM::SET_GAMEPLAY_CAM_RELATIVE_PITCH(euler.y, 1.f);
CAM::SET_GAMEPLAY_CAM_RELATIVE_HEADING(euler.z);
}
if ((player->is_valid() && PED::IS_PED_IN_ANY_VEHICLE(PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(player->id()), false))
|| PLAYER::IS_REMOTE_PLAYER_IN_NON_CLONED_VEHICLE(player->id()))
g_pointers->m_gta.m_clear_ped_tasks_network(player->get_ped(), true);

View File

@ -69,7 +69,7 @@ namespace big
ImGui::SeparatorText("VEHICLES"_T.data());
components::button<ImVec2(110, 0), ImVec4(0.02745f, 0.4745f, 0.10196f, 1.f)>("MAX_VEHICLE"_T, [] {
components::button<ImVec2(0, 0), ImVec4(0.02745f, 0.4745f, 0.10196f, 1.f)>("MAX_VEHICLE"_T, [] {
for (auto vehs : entity::get_entities(true, false))
{
if (entity::take_control_of(vehs))
@ -81,7 +81,7 @@ namespace big
});
ImGui::SameLine();
components::button<ImVec2(110, 0), ImVec4(0.4549f, 0.03529f, 0.03529f, 1.f)>("VIEW_WORLD_DOWNGRADE"_T, [] {
components::button<ImVec2(0, 0), ImVec4(0.4549f, 0.03529f, 0.03529f, 1.f)>("VIEW_WORLD_DOWNGRADE"_T, [] {
for (auto vehs : entity::get_entities(true, false))
{
if (entity::take_control_of(vehs))