Update to 1.67 (#1407)

This commit is contained in:
maybegreat48
2023-06-14 21:29:25 +00:00
committed by GitHub
parent f1895be28a
commit 0af712537f
42 changed files with 259 additions and 485 deletions

View File

@ -1,5 +1,6 @@
#include "core/scr_globals.hpp"
#include "script_local.hpp"
#include "services/tunables/tunables_service.hpp"
#include "util/math.hpp"
#include "util/scripts.hpp"
#include "util/teleport.hpp"
@ -7,7 +8,7 @@
namespace big
{
int get_land_mark_beast_is_closest_to(player_ptr player, script_local land_mark_list)
int get_land_mark_beast_is_closest_to(player_ptr player, script_local land_mark_list, int num_landmarks)
{
if (!player->get_ped() || !player->get_ped()->m_navigation)
return -1;
@ -18,7 +19,7 @@ namespace big
player->get_ped()->m_navigation->get_position()->z);
float distance = math::distance_between_vectors(transformed_vector, *land_mark_list.at(0, 3).as<Vector3*>());
for (int i = 1; i < *script_global(262145).at(11711).as<int*>(); i++)
for (int i = 1; i < num_landmarks; i++)
{
float new_distance = math::distance_between_vectors(transformed_vector, *land_mark_list.at(i, 3).as<Vector3*>());
if (new_distance < distance)
@ -46,22 +47,26 @@ namespace big
});
ImGui::Spacing();
auto beast_land_mark_list = script_local(hunt_the_beast_script_thread, 599).at(1).at(19);
auto beast_land_marks = *script_global(262145).at(11711).as<int*>();
auto beast_land_mark_list =
script_local(hunt_the_beast_script_thread, scr_locals::am_hunt_the_beast::broadcast_idx).at(1).at(19);
static int* num_landmarks = nullptr;
if (!num_landmarks)
num_landmarks = g_tunables_service->get_tunable<int*>(RAGE_JOAAT("HUNT_THE_BEAST_NUMBER_OF_ACTIVE_LANDMARKS"));
if (ImGui::ListBoxHeader("##beastlandmarks", ImVec2(400, 300)))
{
for (int i = 0; i < beast_land_marks; i++)
for (int i = 0; i < (num_landmarks ? *num_landmarks : 10); i++)
{
auto script_local_land_mark = *beast_land_mark_list.at(i, 3).as<Vector3*>();
std::string label = std::format("Tp to landmark {} at {} {} {}",
std::string label = std::format("TP To Landmark {} at {} {} {}",
i,
script_local_land_mark.x,
script_local_land_mark.y,
script_local_land_mark.z);
if (ImGui::Selectable(label.data(), i == get_land_mark_beast_is_closest_to(g_player_service->get_by_id(beast_player_index), beast_land_mark_list)))
if (ImGui::Selectable(label.data(), i == get_land_mark_beast_is_closest_to(g_player_service->get_by_id(beast_player_index), beast_land_mark_list, num_landmarks ? *num_landmarks : 10)))
g_fiber_pool->queue_job([script_local_land_mark, beast] {
teleport::teleport_player_to_coords(g.player.spectating ? beast : g_player_service->get_self(), script_local_land_mark);
});