diff --git a/gui/esp.cpp b/gui/esp.cpp index 97b931db..f8714cf5 100644 --- a/gui/esp.cpp +++ b/gui/esp.cpp @@ -11,7 +11,7 @@ ImGuiWindow* CurrentWindow = nullptr; static void RenderText(const char* text, const ImVec2& pos, const ImVec4& color, const bool outlined = true, const bool centered = true) { if (!text) return; - ImVec2& ImScreen = *(ImVec2*)&pos; // Type punning is safe here + ImVec2 ImScreen = pos; if (centered) { auto size = ImGui::CalcTextSize(text); diff --git a/gui/esp.hpp b/gui/esp.hpp index 6b6db6bb..569755a9 100644 --- a/gui/esp.hpp +++ b/gui/esp.hpp @@ -67,8 +67,7 @@ typedef struct Drawing { std::mutex m_DrawingMutex; - static const int MaxPlayersInLevel = 15; - std::array m_Players; + std::array m_Players; ImVec2 LocalPosition{ 0.0f, 0.0f }; } drawing_t; diff --git a/gui/tabs/esp_tab.cpp b/gui/tabs/esp_tab.cpp index b64e13b4..e474629b 100644 --- a/gui/tabs/esp_tab.cpp +++ b/gui/tabs/esp_tab.cpp @@ -7,21 +7,27 @@ namespace EspTab { void Render() { - if (IsInGame()) - { - if (ImGui::BeginTabItem("Esp")) - { - ImGui::Checkbox("Enable", &State.ShowEsp); + if (not IsInGame()) + return; - ImGui::Checkbox("Show Ghosts", &State.ShowEsp_Ghosts); - ImGui::Checkbox("Hide During Meetings", &State.HideEsp_During_Meetings); + bool changed = false; + if (ImGui::BeginTabItem("Esp")) { - ImGui::Checkbox("Show Box", &State.ShowEsp_Box); - ImGui::Checkbox("Show Tracers", &State.ShowEsp_Tracers); - ImGui::Checkbox("Show Distance", &State.ShowEsp_Distance); + changed |= ImGui::Checkbox("Enable", &State.ShowEsp); - ImGui::EndTabItem(); - } + changed |= ImGui::Checkbox("Show Ghosts", &State.ShowEsp_Ghosts); + changed |= ImGui::Checkbox("Hide During Meetings", &State.HideEsp_During_Meetings); + + changed |= ImGui::Checkbox("Show Box", &State.ShowEsp_Box); + changed |= ImGui::Checkbox("Show Tracers", &State.ShowEsp_Tracers); + changed |= ImGui::Checkbox("Show Distance", &State.ShowEsp_Distance); + + changed |= ImGui::Checkbox("Role-based", &State.ShowEsp_RoleBased); + + ImGui::EndTabItem(); + } + if (changed) { + State.Save(); } } } \ No newline at end of file diff --git a/gui/tabs/self_tab.cpp b/gui/tabs/self_tab.cpp index 7649fd0a..e7a2db51 100644 --- a/gui/tabs/self_tab.cpp +++ b/gui/tabs/self_tab.cpp @@ -67,10 +67,12 @@ namespace SelfTab { if (ImGui::Checkbox("Reveal Votes", &State.RevealVotes)) { State.Save(); } - ImGui::SameLine(); - if (ImGui::Checkbox("Reveal Anonymous Votes", &State.RevealAnonymousVotes)) { - State.Save(); - RevealAnonymousVotes(); + if (!IsInGame() && !IsInLobby() || (*Game::pGameOptionsData)->fields.AnonymousVotes) { + ImGui::SameLine(); + if (ImGui::Checkbox("Reveal Anonymous Votes", &State.RevealAnonymousVotes)) { + State.Save(); + RevealAnonymousVotes(); + } } if (ImGui::Checkbox("See Ghosts", &State.ShowGhosts)) { diff --git a/hooks/PlayerControl.cpp b/hooks/PlayerControl.cpp index a1b0f96c..91df7519 100644 --- a/hooks/PlayerControl.cpp +++ b/hooks/PlayerControl.cpp @@ -208,12 +208,14 @@ void dPlayerControl_FixedUpdate(PlayerControl* __this, MethodInfo* method) { espPlayerData.Position = WorldToScreen(playerPos); if (outfit != NULL) { - espPlayerData.Color = AmongUsColorToImVec4(GetPlayerColor(outfit->fields.ColorId)); + espPlayerData.Color = State.ShowEsp_RoleBased == false ? AmongUsColorToImVec4(GetPlayerColor(outfit->fields.ColorId)) + : AmongUsColorToImVec4(GetRoleColor(playerData->fields.Role)); espPlayerData.Name = convert_from_string(outfit->fields._playerName); } else { - espPlayerData.Color = ImVec4(0.f, 0.f, 0.f, 1.f); + espPlayerData.Color = State.ShowEsp_RoleBased == false ? ImVec4(0.f, 0.f, 0.f, 1.f) + : AmongUsColorToImVec4(GetRoleColor(playerData->fields.Role)); espPlayerData.Name = ""; } espPlayerData.OnScreen = IsWithinScreenBounds(playerPos); diff --git a/user/state.cpp b/user/state.cpp index 6c9db485..99edec3f 100644 --- a/user/state.cpp +++ b/user/state.cpp @@ -60,6 +60,7 @@ void Settings::Load() { JSON_TRYGET("ShowEsp_Tracers", this->ShowEsp_Tracers); JSON_TRYGET("ShowEsp_Distance", this->ShowEsp_Distance); JSON_TRYGET("HideEsp_During_Meetings", this->HideEsp_During_Meetings); + JSON_TRYGET("ShowEsp_RoleBased", this->ShowEsp_RoleBased); JSON_TRYGET("MaxVision", this->MaxVision); JSON_TRYGET("Wallhack", this->Wallhack); @@ -127,6 +128,7 @@ void Settings::Save() { {"ShowEsp_Tracers", this->ShowEsp_Tracers}, {"ShowEsp_Distance", this->ShowEsp_Distance}, {"HideEsp_During_Meetings", this->HideEsp_During_Meetings}, + {"ShowEsp_RoleBased", this->ShowEsp_RoleBased}, {"MaxVision", this->MaxVision}, {"Wallhack", this->Wallhack}, diff --git a/user/state.hpp b/user/state.hpp index 6ae17a26..6456e095 100644 --- a/user/state.hpp +++ b/user/state.hpp @@ -82,6 +82,7 @@ class Settings { bool ShowEsp_Tracers = true; bool ShowEsp_Distance = true; bool HideEsp_During_Meetings = false; + bool ShowEsp_RoleBased = false; bool InMeeting = false; bool PlayMedbayScan = false;