mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-17 23:07:26 +08:00
feat(ESP): Expand functionality
This commit is contained in:
parent
addad5d44b
commit
302243038f
@ -245,17 +245,26 @@ namespace big
|
||||
struct esp
|
||||
{
|
||||
bool enabled = true;
|
||||
float global_render_distance[2] = {0.f, 600.f};
|
||||
float tracer_render_distance[2] = {200.f, 600.f};
|
||||
float box_render_distance[2] = {0.f, 150.f};
|
||||
bool hide_self = true;
|
||||
float global_render_distance[2] = { 0.f, 600.f };
|
||||
float tracer_render_distance[2] = { 200.f, 600.f };
|
||||
float box_render_distance[2] = { 0.f, 150.f };
|
||||
bool tracer = true;
|
||||
float tracer_draw_position[2] = { 0.5f, 1.f };
|
||||
bool box = true;
|
||||
bool health = true;
|
||||
bool armor = true;
|
||||
bool god = true;
|
||||
bool distance = true;
|
||||
bool name = true;
|
||||
ImU32 color = 3359983061;
|
||||
ImU32 friend_color = 3359983061;
|
||||
bool change_esp_color_from_dist = false;
|
||||
bool scale_health_from_dist = false;
|
||||
bool scale_armor_from_dist = false;
|
||||
float distance_threshold[2] = { 100.f, 200.f };
|
||||
ImU32 enemy_color = 4281479904;
|
||||
ImU32 enemy_near_color = 4283794943;
|
||||
ImU32 default_color = 4285713522;
|
||||
ImU32 friend_color = 4293244509;
|
||||
};
|
||||
|
||||
public:
|
||||
@ -470,13 +479,20 @@ namespace big
|
||||
this->window.users = j["window"]["users"];
|
||||
|
||||
this->esp.enabled = j["esp"]["enabled"];
|
||||
this->esp.color = j["esp"]["color"];
|
||||
this->esp.hide_self = j["esp"]["hide_self"];
|
||||
this->esp.enemy_color = j["esp"]["enemy_color"];
|
||||
this->esp.enemy_near_color = j["esp"]["enemy_near_color"];
|
||||
this->esp.default_color = j["esp"]["default_color"];
|
||||
this->esp.friend_color = j["esp"]["friend_color"];
|
||||
this->esp.box = j["esp"]["box"];
|
||||
this->esp.distance = j["esp"]["distance"];
|
||||
this->esp.god = j["esp"]["god"];
|
||||
this->esp.health = j["esp"]["health"];
|
||||
this->esp.armor = j["esp"]["armor"];
|
||||
this->esp.name = j["esp"]["name"];
|
||||
this->esp.change_esp_color_from_dist = j["esp"]["change_esp_color_from_dist"];
|
||||
this->esp.scale_health_from_dist = j["esp"]["scale_health_from_dist"];
|
||||
this->esp.scale_armor_from_dist = j["esp"]["scale_armor_from_dist"];
|
||||
for (int i = 0; i < 2; i++)
|
||||
this->esp.global_render_distance[i] = j["esp"]["global_render_distance"].at(i);
|
||||
for (int i = 0; i < 2; i++)
|
||||
@ -484,6 +500,10 @@ namespace big
|
||||
for (int i = 0; i < 2; i++)
|
||||
this->esp.box_render_distance[i] = j["esp"]["box_render_distance"].at(i);
|
||||
this->esp.tracer = j["esp"]["tracer"];
|
||||
for (int i = 0; i < 2; i++)
|
||||
this->esp.tracer_draw_position[i] = j["esp"]["tracer_draw_position"].at(i);
|
||||
for (int i = 0; i < 2; i++)
|
||||
this->esp.distance_threshold[i] = j["esp"]["distance_threshold"].at(i);
|
||||
}
|
||||
|
||||
nlohmann::json to_json()
|
||||
@ -694,6 +714,7 @@ namespace big
|
||||
{
|
||||
"esp", {
|
||||
{ "enabled", this->esp.enabled },
|
||||
{ "hide_self", this->esp.hide_self },
|
||||
{ "global_render_distance", nlohmann::json::array({
|
||||
this->esp.global_render_distance[0],
|
||||
this->esp.global_render_distance[1] })
|
||||
@ -706,14 +727,28 @@ namespace big
|
||||
this->esp.box_render_distance[0],
|
||||
this->esp.box_render_distance[1] })
|
||||
},
|
||||
{ "color", this->esp.color },
|
||||
{ "enemy_color", this->esp.enemy_color },
|
||||
{ "enemy_near_color", this->esp.enemy_near_color },
|
||||
{ "default_color", this->esp.default_color },
|
||||
{ "friend_color", this->esp.friend_color },
|
||||
{ "distance", this->esp.distance },
|
||||
{ "box", this->esp.box },
|
||||
{ "god", this->esp.god },
|
||||
{ "health", this->esp.health },
|
||||
{ "armor", this->esp.armor },
|
||||
{ "name", this->esp.name },
|
||||
{ "tracer", this->esp.tracer }
|
||||
{ "tracer", this->esp.tracer },
|
||||
{ "change_esp_color_from_dist", this->esp.change_esp_color_from_dist },
|
||||
{ "scale_health_from_dist", this->esp.scale_health_from_dist },
|
||||
{ "scale_armor_from_dist", this->esp.scale_armor_from_dist },
|
||||
{ "tracer_draw_position", nlohmann::json::array({
|
||||
this->esp.tracer_draw_position[0],
|
||||
this->esp.tracer_draw_position[1] })
|
||||
},
|
||||
{ "distance_threshold", nlohmann::json::array({
|
||||
this->esp.distance_threshold[0],
|
||||
this->esp.distance_threshold[1] })
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -19,11 +19,13 @@ namespace big
|
||||
if (!g->esp.enabled) return;
|
||||
|
||||
static ImColor death_bg = ImColor(0.117f, 0.113f, 0.172f, .75f);
|
||||
static ImColor health_green_bg = ImColor(0.29f, 0.69f, 0.34f, 0.5f);
|
||||
static ImColor armor_blue_bg = ImColor(0.36f, 0.71f, 0.89f, .75f);
|
||||
static ImColor armor_blue = ImColor(0.36f, 0.71f, 0.89f, 1.f);
|
||||
static ImColor health_green_bg = ImColor(0.29f, 0.69f, 0.34f, .75f);
|
||||
static ImColor health_green = ImColor(0.29f, 0.69f, 0.34f, 1.f);
|
||||
static ImColor health_yellow_bg = ImColor(0.69f, 0.49f, 0.29f, 0.5f);
|
||||
static ImColor health_yellow_bg = ImColor(0.69f, 0.49f, 0.29f, .75f);
|
||||
static ImColor health_yellow = ImColor(0.69f, 0.49f, 0.29f, 1.f);
|
||||
static ImColor health_red_bg = ImColor(0.69f, 0.29f, 0.29f, 0.5f);
|
||||
static ImColor health_red_bg = ImColor(0.69f, 0.29f, 0.29f, .75f);
|
||||
static ImColor health_red = ImColor(0.69f, 0.29f, 0.29f, 1.f);
|
||||
|
||||
if (const auto draw_list = ImGui::GetBackgroundDrawList(); draw_list)
|
||||
@ -32,15 +34,14 @@ namespace big
|
||||
{
|
||||
const std::unique_ptr<player>& plyr = item.second;
|
||||
|
||||
if (plyr->id() == gta_util::get_network_player_mgr()->m_local_net_player->m_player_id ||
|
||||
!plyr->is_valid() ||
|
||||
!plyr->get_ped() ||
|
||||
if (g->esp.hide_self && plyr->id() == gta_util::get_network_player_mgr()->m_local_net_player->m_player_id ||
|
||||
!plyr->is_valid() ||
|
||||
!plyr->get_ped() ||
|
||||
!plyr->get_ped()->m_navigation) continue;
|
||||
|
||||
rage::fvector3& player_pos = plyr->get_ped()->m_navigation->m_position;
|
||||
|
||||
float screen_x;
|
||||
float screen_y;
|
||||
float screen_x, screen_y;
|
||||
|
||||
const float distance = calculate_distance(player_pos);
|
||||
const float multplr = distance > g->esp.global_render_distance[1] ? -1.f : 6.17757f / distance;
|
||||
@ -56,37 +57,68 @@ namespace big
|
||||
|
||||
const float esp_side_x = esp_x + (67.5f * multplr);
|
||||
|
||||
ImVec2 name_pos = { esp_side_x, esp_y - (175.f * multplr) };
|
||||
std::string name_str = "";
|
||||
ImVec2 name_pos = { esp_x - (62.5f * multplr), esp_y - (175.f * multplr) - 20.f };
|
||||
ImU32 esp_color = g->esp.default_color;
|
||||
|
||||
ImU32 esp_color = g->esp.color;
|
||||
|
||||
if (plyr->is_friend())
|
||||
if (plyr->is_friend()) {
|
||||
esp_color = g->esp.friend_color;
|
||||
}
|
||||
else if (g->esp.change_esp_color_from_dist) {
|
||||
if (distance >= g->esp.distance_threshold[0] && distance < g->esp.distance_threshold[1])
|
||||
esp_color = g->esp.enemy_near_color;
|
||||
else
|
||||
esp_color = g->esp.enemy_color;
|
||||
}
|
||||
|
||||
if (g->esp.distance)
|
||||
name_pos = { esp_x - (62.5f * multplr), esp_y - (175.f * multplr) - 25.f };
|
||||
float armor_perc = plyr->get_ped()->m_armor / 50;
|
||||
armor_perc = armor_perc < 0.f ? 0.f : armor_perc;
|
||||
|
||||
float health_perc = (plyr->get_ped()->m_health - 100) / (plyr->get_ped()->m_maxhealth - 100);
|
||||
health_perc = health_perc < 0.f ? 0.f : health_perc;
|
||||
|
||||
|
||||
if (distance < g->esp.tracer_render_distance[1] && distance > g->esp.tracer_render_distance[0] && g->esp.tracer)
|
||||
draw_list->AddLine({ (float)*g_pointers->m_resolution_x * 0.5f, (float)*g_pointers->m_resolution_y }, { esp_x, esp_y }, esp_color);
|
||||
draw_list->AddLine({ (float)*g_pointers->m_resolution_x * g->esp.tracer_draw_position[0], (float)*g_pointers->m_resolution_y * g->esp.tracer_draw_position[1] }, { esp_x, esp_y }, esp_color);
|
||||
|
||||
if (distance < g->esp.box_render_distance[1] && distance > g->esp.box_render_distance[0] && g->esp.box)
|
||||
draw_list->AddRect({ esp_x - (62.5f * multplr), esp_y - (175.f * multplr) }, { esp_x - (62.5f * multplr) + (125.f * multplr), esp_y - (175.f * multplr) + (350.f * multplr) }, esp_color);
|
||||
|
||||
if (g->esp.name)
|
||||
draw_list->AddText(name_pos, esp_color, plyr->get_name());
|
||||
name_str = plyr->get_name();
|
||||
|
||||
if (g->esp.distance)
|
||||
draw_list->AddText({ esp_side_x, esp_y - (175.f * multplr) }, esp_color, fmt::format("{}m", (int)distance).c_str());
|
||||
if (g->esp.distance) {
|
||||
if (g->esp.name)
|
||||
name_str += " | ";
|
||||
name_str += std::to_string((int)distance);
|
||||
name_str += "m";
|
||||
}
|
||||
|
||||
if (god && g->esp.god)
|
||||
draw_list->AddText({ esp_side_x, esp_y - (175.f * multplr) + 20.f }, health_red, "GOD");
|
||||
else if (g->esp.health)
|
||||
{
|
||||
draw_list->AddLine({ esp_side_x, esp_y - (175.f * multplr) + 25.f }, { esp_side_x + (100.f), esp_y - (175.f * multplr) + 25.f }, health_perc == 0.f ? death_bg : health_perc < 0.25f ? health_red_bg : health_perc < 0.65f ? health_yellow_bg : health_green_bg, 4);
|
||||
draw_list->AddLine({ esp_side_x, esp_y - (175.f * multplr) + 25.f }, { esp_side_x + (100.f * health_perc), esp_y - (175.f * multplr) + 25.f }, health_perc < 0.25f ? health_red : health_perc < 0.65f ? health_yellow : health_green, 4);
|
||||
draw_list->AddText(name_pos, esp_color, name_str.c_str());
|
||||
|
||||
if (god && g->esp.god) {
|
||||
draw_list->AddText({ esp_x - (62.5f * multplr), esp_y - (175.f * multplr) - 40.f }, ImColor(1.f, 0.f, 0.f, 1.f), "GOD");
|
||||
}
|
||||
else {
|
||||
if (g->esp.health) {
|
||||
if (g->esp.scale_health_from_dist) {
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 5.f }, { esp_x - (62.5f * multplr) + (125.f * multplr), esp_y + (175.f * multplr) + 5.f }, health_perc == 0.f ? death_bg : health_perc < 0.25f ? health_red_bg : health_perc < 0.65f ? health_yellow_bg : health_green_bg, 4);
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 5.f }, { esp_x - (62.5f * multplr) + (125.f * multplr) * health_perc, esp_y + (175.f * multplr) + 5.f }, health_perc < 0.25f ? health_red : health_perc < 0.65f ? health_yellow : health_green, 4);
|
||||
}
|
||||
else {
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 5.f }, { esp_x - (62.5f * multplr) + (100.f), esp_y + (175.f * multplr) + 5.f }, health_perc == 0.f ? death_bg : health_perc < 0.25f ? health_red_bg : health_perc < 0.65f ? health_yellow_bg : health_green_bg, 4);
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 5.f }, { esp_x - (62.5f * multplr) + (100.f * health_perc), esp_y + (175.f * multplr) + 5.f }, health_perc < 0.25f ? health_red : health_perc < 0.65f ? health_yellow : health_green, 4);
|
||||
}
|
||||
}
|
||||
if (g->esp.armor && plyr->get_ped()->m_armor > 0) {
|
||||
if (g->esp.scale_armor_from_dist) {
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 10.f }, { esp_x - (62.5f * multplr) + (125.f * multplr), esp_y + (175.f * multplr) + 10.f }, armor_blue_bg, 4);
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 10.f }, { esp_x - (62.5f * multplr) + (125.f * multplr) * armor_perc, esp_y + (175.f * multplr) + 10.f }, armor_blue, 4);
|
||||
}
|
||||
else {
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 10.f }, { esp_x - (62.5f * multplr) + (100.f), esp_y + (175.f * multplr) + 10.f }, armor_blue_bg, 4);
|
||||
draw_list->AddLine({ esp_x - (62.5f * multplr), esp_y + (175.f * multplr) + 10.f }, { esp_x - (62.5f * multplr) + (100.f * armor_perc), esp_y + (175.f * multplr) + 10.f }, armor_blue, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,30 +8,73 @@ namespace big
|
||||
|
||||
if (g->esp.enabled)
|
||||
{
|
||||
ImGui::SliderFloat2("Global Render Distance", g->esp.global_render_distance, 0.f, 1500.f);
|
||||
ImGui::Checkbox("Hide Self", &g->esp.hide_self);
|
||||
|
||||
ImGui::Text("Global Render Distance (min, max)");
|
||||
ImGui::SliderFloat2("###Global Render Distance", g->esp.global_render_distance, 0.f, 1500.f);
|
||||
|
||||
ImGui::Checkbox("Tracer", &g->esp.tracer);
|
||||
if (g->esp.tracer)
|
||||
ImGui::SliderFloat2("Tracer Render Distance", g->esp.tracer_render_distance, g->esp.global_render_distance[0], g->esp.global_render_distance[1]);
|
||||
if (g->esp.tracer) {
|
||||
ImGui::Text("Tracer Draw Position (x, y)");
|
||||
ImGui::SliderFloat2("###Draw Position", g->esp.tracer_draw_position, 0.f, 1.f);
|
||||
ImGui::Text("Tracer Render Distance (min, max)");
|
||||
ImGui::SliderFloat2("###Tracer Render Distance", g->esp.tracer_render_distance, g->esp.global_render_distance[0], g->esp.global_render_distance[1]);
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Box ESP", &g->esp.box);
|
||||
if (g->esp.box)
|
||||
ImGui::SliderFloat2("Box Render Distance", g->esp.box_render_distance, g->esp.global_render_distance[0], g->esp.global_render_distance[1]);
|
||||
if (g->esp.box) {
|
||||
ImGui::Text("Box Render Distance (min, max)");
|
||||
ImGui::SliderFloat2("###Box Render Distance", g->esp.box_render_distance, g->esp.global_render_distance[0], g->esp.global_render_distance[1]);
|
||||
}
|
||||
|
||||
ImGui::Checkbox("Show Player Name", &g->esp.name);
|
||||
ImGui::Checkbox("Show Player Distance", &g->esp.distance);
|
||||
ImGui::Checkbox("Show Player Godmode", &g->esp.god);
|
||||
ImGui::Checkbox("Show Player Health", &g->esp.health);
|
||||
ImGui::Checkbox("Show Player Name", &g->esp.name);
|
||||
ImGui::Checkbox("Show Player Armor", &g->esp.armor);
|
||||
|
||||
static ImVec4 col_esp = ImGui::ColorConvertU32ToFloat4(g->esp.color);
|
||||
ImGui::Checkbox("Should ESP Color Change with Distance", &g->esp.change_esp_color_from_dist);
|
||||
if (g->esp.health)
|
||||
ImGui::Checkbox("Should Healthbar Scale with Distance", &g->esp.scale_health_from_dist);
|
||||
|
||||
if (g->esp.armor)
|
||||
ImGui::Checkbox("Should Armorbar Scale with Distance", &g->esp.scale_armor_from_dist);
|
||||
|
||||
static ImVec4 col_enemy = ImGui::ColorConvertU32ToFloat4(g->esp.enemy_color);
|
||||
static ImVec4 col_enemy_near = ImGui::ColorConvertU32ToFloat4(g->esp.enemy_near_color);
|
||||
static ImVec4 col_default = ImGui::ColorConvertU32ToFloat4(g->esp.default_color);
|
||||
static ImVec4 col_friend = ImGui::ColorConvertU32ToFloat4(g->esp.friend_color);
|
||||
if (ImGui::ColorEdit4("ESP Color##esp_picker", (float*)&col_esp, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
|
||||
|
||||
ImGui::Text("Distance threshold (min, max)");
|
||||
ImGui::SliderFloat2("###Distance threshold", g->esp.distance_threshold, g->esp.global_render_distance[0], g->esp.global_render_distance[1]);
|
||||
|
||||
if (ImGui::TreeNode("ESP Colors (RGBA)"))
|
||||
{
|
||||
g->esp.color = ImGui::ColorConvertFloat4ToU32(col_esp);
|
||||
}
|
||||
if (ImGui::ColorEdit4("Friend ESP Color##friend_picker", (float*)&col_friend, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
|
||||
{
|
||||
g->esp.friend_color = ImGui::ColorConvertFloat4ToU32(col_friend);
|
||||
if (g->esp.change_esp_color_from_dist) {
|
||||
ImGui::Text("Enemy Close Color:");
|
||||
if (ImGui::ColorEdit4("###Enemy ESP Color##esp_picker", (float*)&col_enemy, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
|
||||
{
|
||||
g->esp.enemy_color = ImGui::ColorConvertFloat4ToU32(col_enemy);
|
||||
}
|
||||
|
||||
ImGui::Text("Enemy Near Color:");
|
||||
if (ImGui::ColorEdit4("###Enemy Near ESP Color##esp_picker", (float*)&col_enemy_near, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
|
||||
{
|
||||
g->esp.enemy_near_color = ImGui::ColorConvertFloat4ToU32(col_enemy_near);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Default Color:");
|
||||
if (ImGui::ColorEdit4("###Default ESP Color##esp_picker", (float*)&col_default, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
|
||||
{
|
||||
g->esp.default_color = ImGui::ColorConvertFloat4ToU32(col_default);
|
||||
}
|
||||
|
||||
ImGui::Text("Friendly Color:");
|
||||
if (ImGui::ColorEdit4("###Friend ESP Color##friend_picker", (float*)&col_friend, ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoSidePreview))
|
||||
{
|
||||
g->esp.friend_color = ImGui::ColorConvertFloat4ToU32(col_friend);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user