add esp font change
This commit is contained in:
parent
b8336e0e7b
commit
7e3f9b8d8d
@ -62,6 +62,11 @@
|
|||||||
|
|
||||||
#include "sdk.h"
|
#include "sdk.h"
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
constexpr T _clamp(T _min, T _max, T _val) {
|
||||||
|
return ((_val > _max) ? _max : ((_val < _min) ? _min : _val));
|
||||||
|
}
|
||||||
|
|
||||||
#define TF2C (g_AppID == 243750)
|
#define TF2C (g_AppID == 243750)
|
||||||
#define TF2 (g_AppID == 440)
|
#define TF2 (g_AppID == 440)
|
||||||
#define TF (TF2C || TF2)
|
#define TF (TF2C || TF2)
|
||||||
|
@ -51,9 +51,6 @@ void AddCenterString(const std::string& string, int color) {
|
|||||||
|
|
||||||
|
|
||||||
// TODO globals
|
// TODO globals
|
||||||
unsigned long fonts::ESP = 0;
|
|
||||||
unsigned long fonts::MENU = 0;
|
|
||||||
unsigned long fonts::MENU_BIG = 0;
|
|
||||||
int draw::width = 0;
|
int draw::width = 0;
|
||||||
int draw::height = 0;
|
int draw::height = 0;
|
||||||
|
|
||||||
@ -204,18 +201,46 @@ void draw::DrawRect(int x, int y, int w, int h, int color) {
|
|||||||
g_ISurface->DrawFilledRect(x, y, x + w, y + h);
|
g_ISurface->DrawFilledRect(x, y, x + w, y + h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace fonts {
|
||||||
|
|
||||||
|
unsigned long ESP = 0;
|
||||||
|
unsigned long MENU = 0;
|
||||||
|
unsigned long MENU_BIG = 0;
|
||||||
|
|
||||||
|
static const std::vector<std::string> fonts = {"Tahoma Bold", "Tahoma", "TF2 Build", "Verdana", "Verdana Bold", "Arial", "Courier New", "Ubuntu Mono Bold"};
|
||||||
|
static CatEnum family_enum(fonts);
|
||||||
|
CatVar esp_family(family_enum, "font_esp_family", "2", "ESP font", "ESP font family");
|
||||||
|
CatVar esp_height(CV_INT, "font_esp_height", "14", "ESP height", "ESP font height");
|
||||||
|
|
||||||
|
void Update() {
|
||||||
|
fonts::ESP = g_ISurface->CreateFont();
|
||||||
|
g_ISurface->SetFontGlyphSet(fonts::ESP, fonts::fonts[_clamp(0, 7, (int)fonts::esp_family)].c_str(), (int)fonts::esp_height, 0, 0, 0, 0); // or Ubuntu Mono Bold
|
||||||
|
//g_ISurface->ResetFontCaches();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void draw::Initialize() {
|
void draw::Initialize() {
|
||||||
fonts::ESP = g_ISurface->CreateFont();
|
fonts::ESP = g_ISurface->CreateFont();
|
||||||
fonts::MENU = g_ISurface->CreateFont();
|
fonts::MENU = g_ISurface->CreateFont();
|
||||||
fonts::MENU_BIG = g_ISurface->CreateFont();
|
fonts::MENU_BIG = g_ISurface->CreateFont();
|
||||||
|
|
||||||
if (!draw::width || !draw::height) {
|
if (!draw::width || !draw::height) {
|
||||||
g_IEngine->GetScreenSize(draw::width, draw::height);
|
g_IEngine->GetScreenSize(draw::width, draw::height);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_ISurface->SetFontGlyphSet(fonts::ESP, "TF2 Build", fonts::ESP_HEIGHT, 0, 0, 0, 0); // or Ubuntu Mono Bold
|
const auto install_callback_fn = [](CatVar* var) {
|
||||||
g_ISurface->SetFontGlyphSet(fonts::MENU, "Verdana", fonts::MENU_HEIGHT, 0, 0, 0, 0);
|
var->convar_parent->InstallChangeCallback([](IConVar* var, const char* pOldValue, float flOldValue) {
|
||||||
g_ISurface->SetFontGlyphSet(fonts::MENU_BIG, "Verdana Bold", fonts::MENU_BIG_HEIGHT, 0, 0, 0, 0x0);
|
fonts::Update();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
fonts::esp_family.OnRegister(install_callback_fn);
|
||||||
|
fonts::esp_height.OnRegister(install_callback_fn);
|
||||||
|
|
||||||
|
fonts::Update();
|
||||||
|
g_ISurface->SetFontGlyphSet(fonts::MENU, fonts::fonts[_clamp(0, 5, (int)fonts::esp_family)].c_str(), (int)fonts::esp_height, 0, 0, 0, 0);
|
||||||
|
g_ISurface->SetFontGlyphSet(fonts::MENU, "Verdana", 12, 0, 0, 0, 0);
|
||||||
|
g_ISurface->SetFontGlyphSet(fonts::MENU_BIG, "Verdana Bold", 30, 0, 0, 0, 0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw::DrawLine(int x, int y, int dx, int dy, int color) {
|
void draw::DrawLine(int x, int y, int dx, int dy, int color) {
|
||||||
|
@ -15,17 +15,20 @@
|
|||||||
|
|
||||||
class CachedEntity;
|
class CachedEntity;
|
||||||
class Vector;
|
class Vector;
|
||||||
|
class CatVar;
|
||||||
class IClientEntity;
|
class IClientEntity;
|
||||||
|
|
||||||
namespace fonts {
|
namespace fonts {
|
||||||
|
|
||||||
|
// FIXME add menu fonts
|
||||||
extern unsigned long ESP;
|
extern unsigned long ESP;
|
||||||
extern unsigned long MENU;
|
extern unsigned long MENU;
|
||||||
extern unsigned long MENU_BIG;
|
extern unsigned long MENU_BIG;
|
||||||
|
|
||||||
const int ESP_HEIGHT = 14;
|
void Update();
|
||||||
const int MENU_HEIGHT = 12;
|
|
||||||
const int MENU_BIG_HEIGHT = 30;
|
extern CatVar esp_family;
|
||||||
|
extern CatVar esp_height;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,6 +202,8 @@ List& MainList() {
|
|||||||
"ESP" [
|
"ESP" [
|
||||||
"ESP Menu"
|
"ESP Menu"
|
||||||
"esp_enabled"
|
"esp_enabled"
|
||||||
|
"font_esp_family"
|
||||||
|
"font_esp_height"
|
||||||
"esp_conds"
|
"esp_conds"
|
||||||
"esp_class"
|
"esp_class"
|
||||||
"esp_name"
|
"esp_name"
|
||||||
|
@ -64,9 +64,6 @@ void hack::ExecuteCommand(const std::string command) {
|
|||||||
hack::command_stack().push(command);
|
hack::command_stack().push(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hack::InitHacks() {
|
|
||||||
}
|
|
||||||
|
|
||||||
ConCommand* hack::c_Cat = 0;
|
ConCommand* hack::c_Cat = 0;
|
||||||
|
|
||||||
void hack::CC_Cat(const CCommand& args) {
|
void hack::CC_Cat(const CCommand& args) {
|
||||||
@ -110,7 +107,6 @@ void hack::Initialize() {
|
|||||||
else if (TF2C) g_pClassID = new ClassIDTF2C();
|
else if (TF2C) g_pClassID = new ClassIDTF2C();
|
||||||
else if (HL2DM) g_pClassID = new ClassIDHL2DM();
|
else if (HL2DM) g_pClassID = new ClassIDHL2DM();
|
||||||
g_pClassID->Init();
|
g_pClassID->Init();
|
||||||
draw::Initialize();
|
|
||||||
colors::Init();
|
colors::Init();
|
||||||
if (TF2) {
|
if (TF2) {
|
||||||
uintptr_t mmmf = (gSignatures.GetClientSignature("C7 44 24 04 09 00 00 00 BB ? ? ? ? C7 04 24 00 00 00 00 E8 ? ? ? ? BA ? ? ? ? 85 C0 B8 ? ? ? ? 0F 44 DA") + 37);
|
uintptr_t mmmf = (gSignatures.GetClientSignature("C7 44 24 04 09 00 00 00 BB ? ? ? ? C7 04 24 00 00 00 00 E8 ? ? ? ? BA ? ? ? ? 85 C0 B8 ? ? ? ? 0F 44 DA") + 37);
|
||||||
@ -128,9 +124,9 @@ void hack::Initialize() {
|
|||||||
}
|
}
|
||||||
BeginConVars();
|
BeginConVars();
|
||||||
hack::c_Cat = CreateConCommand(CON_NAME, &hack::CC_Cat, "Info");
|
hack::c_Cat = CreateConCommand(CON_NAME, &hack::CC_Cat, "Info");
|
||||||
hack::InitHacks();
|
|
||||||
g_Settings.Init();
|
g_Settings.Init();
|
||||||
EndConVars();
|
EndConVars();
|
||||||
|
draw::Initialize();
|
||||||
g_pGUI = new CatGUI();
|
g_pGUI = new CatGUI();
|
||||||
g_pGUI->Setup();
|
g_pGUI->Setup();
|
||||||
gNetvars.init();
|
gNetvars.init();
|
||||||
|
@ -33,8 +33,6 @@ void Initialize();
|
|||||||
void Think();
|
void Think();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
void InitHacks();
|
|
||||||
|
|
||||||
void CC_Cat(const CCommand& args);
|
void CC_Cat(const CCommand& args);
|
||||||
extern ConCommand* c_Cat;
|
extern ConCommand* c_Cat;
|
||||||
|
|
||||||
|
@ -178,12 +178,12 @@ void Draw3DBox(CachedEntity* ent, int clr, bool healthbar, int health, int healt
|
|||||||
data.at(ent->m_IDX).esp_origin = Vector(max_x + 1, min_y, 0);
|
data.at(ent->m_IDX).esp_origin = Vector(max_x + 1, min_y, 0);
|
||||||
} break;
|
} break;
|
||||||
case 1: { // BOTTOM RIGHT
|
case 1: { // BOTTOM RIGHT
|
||||||
data.at(ent->m_IDX).esp_origin = Vector(max_x + 1, max_y - data.at(ent->m_IDX).string_count * 13, 0);
|
data.at(ent->m_IDX).esp_origin = Vector(max_x + 1, max_y - data.at(ent->m_IDX).string_count * ((int)fonts::esp_height - 1), 0);
|
||||||
} break;
|
} break;
|
||||||
case 2: { // CENTER
|
case 2: { // CENTER
|
||||||
} break;
|
} break;
|
||||||
case 3: { // ABOVE
|
case 3: { // ABOVE
|
||||||
data.at(ent->m_IDX).esp_origin = Vector(min_x, min_y - data.at(ent->m_IDX).string_count * 13, 0);
|
data.at(ent->m_IDX).esp_origin = Vector(min_x, min_y - data.at(ent->m_IDX).string_count * ((int)fonts::esp_height - 1), 0);
|
||||||
} break;
|
} break;
|
||||||
case 4: { // BELOW
|
case 4: { // BELOW
|
||||||
data.at(ent->m_IDX).esp_origin = Vector(min_x, max_y, 0);
|
data.at(ent->m_IDX).esp_origin = Vector(min_x, max_y, 0);
|
||||||
@ -256,12 +256,12 @@ void DrawBox(CachedEntity* ent, int clr, float widthFactor, float addHeight, boo
|
|||||||
data.at(ent->m_IDX).esp_origin = Vector(max_x, min_y, 0);
|
data.at(ent->m_IDX).esp_origin = Vector(max_x, min_y, 0);
|
||||||
} break;
|
} break;
|
||||||
case 1: { // BOTTOM RIGHT
|
case 1: { // BOTTOM RIGHT
|
||||||
data.at(ent->m_IDX).esp_origin = Vector(max_x, max_y - data.at(ent->m_IDX).string_count * 13, 0);
|
data.at(ent->m_IDX).esp_origin = Vector(max_x, max_y - data.at(ent->m_IDX).string_count * ((int)fonts::esp_height - 1), 0);
|
||||||
} break;
|
} break;
|
||||||
case 2: { // CENTER
|
case 2: { // CENTER
|
||||||
} break;
|
} break;
|
||||||
case 3: { // ABOVE
|
case 3: { // ABOVE
|
||||||
data.at(ent->m_IDX).esp_origin = Vector(min_x, min_y - data.at(ent->m_IDX).string_count * 13, 0);
|
data.at(ent->m_IDX).esp_origin = Vector(min_x, min_y - data.at(ent->m_IDX).string_count * ((int)fonts::esp_height - 1), 0);
|
||||||
} break;
|
} break;
|
||||||
case 4: { // BELOW
|
case 4: { // BELOW
|
||||||
data.at(ent->m_IDX).esp_origin = Vector(min_x, max_y, 0);
|
data.at(ent->m_IDX).esp_origin = Vector(min_x, max_y, 0);
|
||||||
@ -527,11 +527,11 @@ void ProcessEntityPT(CachedEntity* ent) {
|
|||||||
if (transparent) color = colors::Transparent(color);
|
if (transparent) color = colors::Transparent(color);
|
||||||
if (!origin_is_zero) {
|
if (!origin_is_zero) {
|
||||||
draw::String(fonts::ESP, draw_point.x, draw_point.y, color, 2, string.data);
|
draw::String(fonts::ESP, draw_point.x, draw_point.y, color, 2, string.data);
|
||||||
draw_point.y += 11;
|
draw_point.y += (int)fonts::esp_height - 3;
|
||||||
} else {
|
} else {
|
||||||
auto l = draw::GetStringLength(fonts::ESP, string.data);
|
auto l = draw::GetStringLength(fonts::ESP, string.data);
|
||||||
draw::String(fonts::ESP, draw_point.x - l.first / 2, draw_point.y, color, 2, string.data);
|
draw::String(fonts::ESP, draw_point.x - l.first / 2, draw_point.y, color, 2, string.data);
|
||||||
draw_point.y += 11;
|
draw_point.y += (int)fonts::esp_height - 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user