add: player esp and snaplines
for now the esp will show "Player" instead of the real player name //TOFIX
This commit is contained in:
@@ -53,6 +53,7 @@
|
||||
<ClCompile Include="lib\ClientHelper.cpp" />
|
||||
<ClCompile Include="lib\UnityCore.cpp" />
|
||||
<ClCompile Include="lib\Wrapper.cpp" />
|
||||
<ClCompile Include="user\features\esp\esp.cpp" />
|
||||
<ClCompile Include="user\features\menu.cpp" />
|
||||
<ClCompile Include="user\features\misc\misc.cpp" />
|
||||
<ClCompile Include="user\hooks\hooks.cpp" />
|
||||
@@ -93,6 +94,7 @@
|
||||
<ClInclude Include="lib\ClientHelper.h" />
|
||||
<ClInclude Include="lib\UnityCore.h" />
|
||||
<ClInclude Include="lib\Wrapper.h" />
|
||||
<ClInclude Include="user\features\esp\esp.hpp" />
|
||||
<ClInclude Include="user\features\menu.hpp" />
|
||||
<ClInclude Include="user\features\misc\misc.h" />
|
||||
<ClInclude Include="user\hooks\hooks.hpp" />
|
||||
|
||||
@@ -79,6 +79,9 @@
|
||||
<ClCompile Include="user\players\players.cpp">
|
||||
<Filter>user\players</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="user\features\esp\esp.cpp">
|
||||
<Filter>user\features\esp</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="user\main.h">
|
||||
@@ -195,6 +198,9 @@
|
||||
<ClInclude Include="user\players\players.h">
|
||||
<Filter>user\players</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="user\features\esp\esp.hpp">
|
||||
<Filter>user\features\esp</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="appdata">
|
||||
@@ -236,5 +242,8 @@
|
||||
<Filter Include="user\players">
|
||||
<UniqueIdentifier>{54f72ffe-f8ca-4732-bd14-62d1a7a68267}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="user\features\esp">
|
||||
<UniqueIdentifier>{8f74b1c2-1d3c-4a14-8a6f-7bf00e07d57e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
72
user/features/esp/esp.cpp
Normal file
72
user/features/esp/esp.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
#include "pch-il2cpp.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "ClientHelper.h"
|
||||
#include "UnityCore.h"
|
||||
#include "players/players.h"
|
||||
#include "helpers.h"
|
||||
#include "esp.hpp"
|
||||
|
||||
static void DrawBox(float x, float y, float w, float h, ImColor color, float thickness)
|
||||
{
|
||||
auto drawlist = ImGui::GetBackgroundDrawList();
|
||||
|
||||
drawlist->AddLine(ImVec2{ x, y }, ImVec2{ x + w, y }, color, thickness);
|
||||
drawlist->AddLine(ImVec2{ x, y }, ImVec2{ x, y + h }, color, thickness);
|
||||
drawlist->AddLine(ImVec2{ x + w, y }, ImVec2{ x + w, y + h }, color, thickness);
|
||||
drawlist->AddLine(ImVec2{ x, y + h }, ImVec2{ x + w, y + h}, color, thickness);
|
||||
}
|
||||
|
||||
static void DrawString(ImVec2 pos, ImColor color, std::string label)
|
||||
{
|
||||
auto drawlist = ImGui::GetBackgroundDrawList();
|
||||
|
||||
drawlist->AddText(pos, color, label.c_str());
|
||||
}
|
||||
|
||||
static void DrawBoxESP(app::GameObject *it, float footOffset, float headOffset, std::string name, ImColor color, bool snapline = false, bool esp = false, float nameOffset = -0.5f, float widthOffset = 2.0f)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
app::Camera* cam = app::Camera_get_main(nullptr);
|
||||
if (!it || cam == nullptr)
|
||||
return;
|
||||
|
||||
app::Transform* _transform = Unity::Transform::Get(it);
|
||||
if (_transform == nullptr)
|
||||
return;
|
||||
|
||||
app::Vector3 pos = Unity::Transform::Position(_transform);
|
||||
|
||||
app::Vector3 footpos = app::Camera_WorldToScreenPoint_1(cam, app::Vector3{pos.x, pos.y + footOffset, pos.z}, NULL);
|
||||
app::Vector3 headpos = app::Camera_WorldToScreenPoint_1(cam, app::Vector3{pos.x, pos.y + headOffset, pos.z}, NULL);
|
||||
app::Vector3 namepos = app::Camera_WorldToScreenPoint_1(cam, app::Vector3{pos.x, pos.y + nameOffset, pos.z}, NULL);
|
||||
|
||||
if (esp && footpos.z > 0.0f) {
|
||||
float height = (headpos.y - footpos.y);
|
||||
float width = height / widthOffset;
|
||||
|
||||
DrawBox(footpos.x - (width / 2), (float)io.DisplaySize.y - footpos.y - height, width, height, color, 2.0f);
|
||||
DrawString(ImVec2(namepos.x, (float)io.DisplaySize.y - namepos.y), color, name);
|
||||
}
|
||||
|
||||
if (snapline && footpos.z > 0.f) {
|
||||
auto drawlist = ImGui::GetBackgroundDrawList();
|
||||
drawlist->AddLine(ImVec2(io.DisplaySize.x / 2, io.DisplaySize.y / 2), ImVec2(footpos.x, io.DisplaySize.y - footpos.y), color, 2.f);
|
||||
}
|
||||
}
|
||||
|
||||
void ESP::RunPlayersESP() {
|
||||
app::GameObject__Array* players = Players::GetAllPlayers();
|
||||
|
||||
if (players == NULL)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < players->max_length; i++) {
|
||||
app::GameObject* ent = players->vector[i];
|
||||
|
||||
if (ent == nullptr || ent == Player::GetLocalPlayer())
|
||||
continue;
|
||||
|
||||
DrawBoxESP(ent, -0.25, 1.75, "Player", ImColor{settings::player_esp_color[0], settings::player_esp_color[1], settings::player_esp_color[2], settings::player_esp_color[3]}, settings::player_snaplines, settings::player_esp);
|
||||
}
|
||||
}
|
||||
7
user/features/esp/esp.hpp
Normal file
7
user/features/esp/esp.hpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "settings/settings.hpp"
|
||||
|
||||
namespace ESP {
|
||||
void RunPlayersESP();
|
||||
}
|
||||
@@ -52,6 +52,8 @@ void DrawVisualsTab() {
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("Flashlight color");
|
||||
*/
|
||||
|
||||
|
||||
ImGui::Checkbox("Player ESP", &settings::player_esp);
|
||||
ImGui::SameLine();
|
||||
@@ -77,6 +79,7 @@ void DrawVisualsTab() {
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
/*
|
||||
ImGui::Checkbox("Azazel ESP", &settings::azazel_esp);
|
||||
ImGui::SameLine();
|
||||
bool open_azacolor_popup = ImGui::ColorButton("azaespcolor", ImVec4(settings::azazel_esp_color[0], settings::azazel_esp_color[1], settings::azazel_esp_color[2], settings::azazel_esp_color[3]));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "Hooks.hpp"
|
||||
#include "features/menu.hpp"
|
||||
#include "settings/settings.hpp"
|
||||
#include "../features/esp/esp.hpp"
|
||||
#include "main.h"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
@@ -630,6 +631,8 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval
|
||||
DrawMenu(open_menu);
|
||||
}
|
||||
|
||||
if (settings::player_esp)
|
||||
ESP::RunPlayersESP();
|
||||
|
||||
ImGui::GetIO().MouseDrawCursor = open_menu;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user