From 5d33171a1672d84ecfbcf3f9fe8946d4d770f311 Mon Sep 17 00:00:00 2001 From: Lighty Date: Mon, 21 May 2018 13:32:28 +0200 Subject: [PATCH] adjustable ESP font scale --- include/hacks/AutoJoin.hpp | 1 + include/visual/drawing.hpp | 1 + src/hacks/AutoJoin.cpp | 3 +++ src/hacks/ESP.cpp | 10 +++++++++- src/hooks/LevelInit.cpp | 1 + src/hooks/LevelShutdown.cpp | 1 + src/tfmm.cpp | 2 ++ src/visual/drawing.cpp | 3 +++ src/visual/menu/ncc/Menu.cpp | 1 + 9 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/hacks/AutoJoin.hpp b/include/hacks/AutoJoin.hpp index 419b724c..0d94d738 100755 --- a/include/hacks/AutoJoin.hpp +++ b/include/hacks/AutoJoin.hpp @@ -15,6 +15,7 @@ namespace autojoin { extern CatVar auto_queue; +extern Timer queuetime; void Update(); void UpdateSearch(); diff --git a/include/visual/drawing.hpp b/include/visual/drawing.hpp index 934293c7..54026272 100755 --- a/include/visual/drawing.hpp +++ b/include/visual/drawing.hpp @@ -20,6 +20,7 @@ namespace fonts { extern draw_api::font_handle_t main_font; +extern draw_api::font_handle_t esp_font; } namespace fonts diff --git a/src/hacks/AutoJoin.cpp b/src/hacks/AutoJoin.cpp index f60bbf6a..644dcee4 100644 --- a/src/hacks/AutoJoin.cpp +++ b/src/hacks/AutoJoin.cpp @@ -46,6 +46,7 @@ bool UnassignedClass() } Timer autoqueue_timer{}; +Timer queuetime{}; Timer req_timer{}; /*CatVar party_bypass(CV_SWITCH, "party_bypass", "0", "Party Bypass", "Bypass Party restrictions");*/ @@ -86,6 +87,8 @@ void UpdateSearch() tfmm::queue_leave(); if (autoqueue_timer.test_and_set(60000)) { + if (!gc->BConnectedToMatchServer(false) && queuetime.test_and_set(10 * 1000 * 60)) + tfmm::queue_leave(); if (gc && !gc->BConnectedToMatchServer(false)) { logging::Info("Starting queue"); diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 7574200e..f6db8cb4 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -76,6 +76,7 @@ static CatVar legit(CV_SWITCH, "esp_legit", "0", "Legit Mode", "Don't show invisible enemies\nHides invisable enemies with " "visibility enabled"); +static CatVar esp_font_scale(CV_INT, "esp_font_scale", "14", "ESP font scale"); // Selective esp options static CatVar local_esp(CV_SWITCH, "esp_local", "1", "ESP Local Player", "Shows local player ESP in thirdperson"); @@ -426,6 +427,13 @@ void Init() } } } + esp_font_scale.InstallChangeCallback( + [](IConVar *var, const char *pszOldValue, float flOldValue) { + if (fonts::esp_font.handle != GLEZ_FONT_INVALID) + draw_api::destroy_font(fonts::esp_font); + fonts::esp_font = draw_api::create_font( + DATA_PATH "/fonts/verasans.ttf", esp_font_scale); + }); } void _FASTCALL emoji(CachedEntity *ent) { @@ -856,7 +864,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity *ent) { draw_api::draw_string_with_outline( draw_point.x, draw_point.y, string.data.c_str(), - fonts::main_font, color, colors::black, 1.5f); + fonts::esp_font, color, colors::black, 1.5f); } else { /* diff --git a/src/hooks/LevelInit.cpp b/src/hooks/LevelInit.cpp index 4558c8e6..7de75720 100644 --- a/src/hooks/LevelInit.cpp +++ b/src/hooks/LevelInit.cpp @@ -81,6 +81,7 @@ namespace hooked_methods DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name) { + hacks::shared::autojoin::queuetime.update(); DelayTimer.update(); #if not LAGBOT_MODE playerlist::Save(); diff --git a/src/hooks/LevelShutdown.cpp b/src/hooks/LevelShutdown.cpp index 525e195b..00b1f797 100644 --- a/src/hooks/LevelShutdown.cpp +++ b/src/hooks/LevelShutdown.cpp @@ -12,6 +12,7 @@ namespace hooked_methods DEFINE_HOOKED_METHOD(LevelShutdown, void, void *this_) { + hacks::shared::autojoin::queuetime.update(); need_name_change = true; #if not LAGBOT_MODE playerlist::Save(); diff --git a/src/tfmm.cpp b/src/tfmm.cpp index d7fed6bd..fd87ef42 100644 --- a/src/tfmm.cpp +++ b/src/tfmm.cpp @@ -6,6 +6,7 @@ */ #include "common.hpp" +#include "AutoJoin.hpp" CatCommand cmd_queue_start("mm_queue_casual", "Start casual queue", []() { tfmm::queue_start(); }); @@ -40,6 +41,7 @@ void queue_start() if (queue == 7) client->LoadSavedCasualCriteria(); client->RequestQueueForMatch((int) queue); + hacks::shared::autojoin::queuetime.update(); } else logging::Info("queue_start: CTFPartyClient == null!"); diff --git a/src/visual/drawing.cpp b/src/visual/drawing.cpp index 7918fc7a..7bde7b25 100755 --- a/src/visual/drawing.cpp +++ b/src/visual/drawing.cpp @@ -74,6 +74,7 @@ namespace fonts { draw_api::font_handle_t main_font; +draw_api::font_handle_t esp_font; } void draw::Initialize() @@ -84,6 +85,8 @@ void draw::Initialize() } fonts::main_font = draw_api::create_font(DATA_PATH "/fonts/verasans.ttf", 14); + fonts::esp_font = + draw_api::create_font(DATA_PATH "/fonts/verasans.ttf", 14); } bool draw::EntityCenterToScreen(CachedEntity *entity, Vector &out) diff --git a/src/visual/menu/ncc/Menu.cpp b/src/visual/menu/ncc/Menu.cpp index d091f076..eb31b960 100644 --- a/src/visual/menu/ncc/Menu.cpp +++ b/src/visual/menu/ncc/Menu.cpp @@ -457,6 +457,7 @@ static const std::string list_tf2 = R"( "esp_enabled" "ESP Preferences"[ "ESP Preferences Menu" + "esp_font_scale" "esp_box" "esp_3d_players" "esp_3d_buildings"