This commit is contained in:
nullifiedcat 2016-11-11 20:43:23 +03:00
parent 020120822c
commit c317a2ac3e
10 changed files with 38 additions and 15 deletions

View File

@ -29,7 +29,7 @@ Color draw::yellow(255, 255, 0, 255);
Color draw::black(0, 0, 0, 255);
Color colors::white(255, 255, 255, 255);
Color colors::black(0, 0, 0, 0);
Color colors::black(0, 0, 0, 255);
Color colors::tf_red(184, 56, 59, 255);
Color colors::tf_blu(88, 133, 162, 255);
Color colors::yellow(255, 255, 0, 255);
@ -96,11 +96,13 @@ void draw::DrawString(int x, int y, Color color, bool center, const char* text,
vsprintf(buffer, text, list);
va_end(list);
swprintf(string, 1024, L"%s", buffer);
int l, h;
draw::GetStringLength((char*)text, l, h);
if (center) {
int l, h;
draw::GetStringLength(string, l, h);
x -= (l / 2);
}
draw::GetStringLength((char*)text, l, h);
draw::DrawRect(x, y + 1, l, h - 5, colors::black);
draw::DrawString(draw::font_handle, x, y, color, string);
}
@ -135,8 +137,8 @@ void draw::OutlineRect(int x, int y, int w, int h, Color color) {
interfaces::surface->DrawOutlinedRect(x, y, x + w, y + h);
}
void draw::GetStringLength(wchar_t* string, int& length, int& height) {
//wchar_t buf[1024] = {'\0'};
//mbstowcs(buf, string, strlen(string));
interfaces::surface->GetTextSize(draw::font_handle, string, length, height);
void draw::GetStringLength(char* string, int& length, int& height) {
wchar_t buf[1024] = {'\0'};
mbstowcs(buf, string, strlen(string));
interfaces::surface->GetTextSize(draw::font_handle, buf, length, height);
}

View File

@ -54,7 +54,7 @@ void DrawRect(int x, int y, int w, int h, Color color);
bool WorldToScreen(Vector &origin, Vector &screen);
bool EntityCenterToScreen(IClientEntity* entity, Vector& out);
void OutlineRect(int x, int y, int w, int h, Color color);
void GetStringLength(wchar_t* string, int& length, int& height);
void GetStringLength(char* string, int& length, int& height);
}

View File

@ -98,6 +98,7 @@ void hack::Hk_PaintTraverse(void* p, unsigned int vp, bool fr, bool ar) {
ESPStringCompound str = ce->GetESPString(j);
//logging::Info("drawing [idx=%i][ns=%i] %s", i, ce->m_nESPStrings, str.m_String);
if (!ce->m_ESPOrigin.IsZero(1.0)) {
int sw, sh;
draw::DrawString(ce->m_ESPOrigin.x, ce->m_ESPOrigin.y, str.m_Color, false, str.m_String);
ce->m_ESPOrigin.y += 14;
} else {

View File

@ -55,7 +55,7 @@ void HEsp::Create() {
this->v_bShowFriends = CreateConVar("u_esp_friends", "1", "Show friends");
this->v_bVisCheck = CreateConVar("u_esp_vischeck", "1", "Visibility Checking");
this->v_bLegit = CreateConVar("u_esp_legit", "0", "'legit' esp mode");
this->v_bLegitSeenTicks = CreateConVar("u_esp_legit_seenticks", "800", "Ticks the entity is 'predicted'");
this->v_iLegitSeenTicks = CreateConVar("u_esp_legit_seenticks", "150", "Ticks the entity is still shown after being hidden");
}
#define ESP_HEIGHT 14
@ -107,6 +107,12 @@ void HEsp::ProcessEntityPT(CachedEntity* ent) {
Color color;
switch (ent->m_iClassID) {
case ClassID::CTFPlayer: {
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team) {
if (ent->Var<int>(eoffsets.iCond) & cond::cloaked) return;
if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) {
return;
}
}
if (ent->Var<int>(eoffsets.iTeamNum) == g_pLocalPlayer->team && !v_bTeammates->GetBool() && !(v_bShowFriends->GetBool() && IsFriend(ent->m_pEntity))) break;
if (!ent->m_bAlivePlayer) break;
color = colors::GetTeamColor(ent->m_iTeam, !ent->m_bIsVisible);
@ -193,6 +199,12 @@ void HEsp::ProcessEntity(CachedEntity* ent) {
if (v_bShowFriends->GetBool() && IsFriend(ent->m_pEntity)) {
color = colors::yellow;
}
if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team) {
if (pcond & cond::cloaked) return;
if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) {
return;
}
}
if (power >= 0 && (ent->m_bEnemy || this->v_bTeammatePowerup->GetBool() || this->v_bTeammates->GetBool())) {
ent->AddESPString(color, "HAS [%s]", powerups[power]);
}

View File

@ -37,7 +37,7 @@ public:
ConVar* v_bShowFriends;
ConVar* v_bVisCheck;
ConVar* v_bLegit;
ConVar* v_bLegitSeenTicks;
ConVar* v_iLegitSeenTicks;
//ConVar* v_bModelInfo;
};

View File

@ -103,7 +103,7 @@ bool HTrigger::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) {
((GetEntityValue<int>(entity, eoffsets.iCond)) & cond::cloaked)) return true;
int health = GetEntityValue<int>(entity, eoffsets.iHealth);
bool bodyshot = false;
if (g_pLocalPlayer->clazz == 2) {
if (g_pLocalPlayer->clazz == tf_class::tf_sniper) {
// If sniper..
if (health <= 50 && this->v_bFinishingHit->GetBool()) {
bodyshot = true;
@ -119,13 +119,13 @@ bool HTrigger::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) {
}
}
if ((g_pLocalPlayer->clazz == 2) && this->v_bZoomedOnly->GetBool() &&
!(g_pLocalPlayer->cond_0 & cond::zoomed) && !bodyshot) {
if (!bodyshot && (g_pLocalPlayer->clazz == tf_class::tf_sniper) && this->v_bZoomedOnly->GetBool() &&
!(g_pLocalPlayer->cond_0 & cond::zoomed)) {
return true;
}
//IClientEntity* weapon;
if (this->v_iHitbox->GetInt() >= 0) {
if (!bodyshot && (enemy_trace->hitbox != this->v_iHitbox->GetInt())) return true;
if (this->v_iHitbox->GetInt() >= 0 && !bodyshot) {
if (enemy_trace->hitbox != this->v_iHitbox->GetInt()) return true;
}
cmd->buttons |= IN_ATTACK;
return true;

View File

@ -10,6 +10,8 @@
#include "IHack.h"
class ConVar;
class Tracers : public IHack {
public:
DECL_HACK

View File

@ -296,6 +296,10 @@ float deg2rad(float deg) {
return deg * (PI / 180);
}
bool IsPlayerInvisible(IClientEntity* player) {
return false; // TODO stumpy.flv
}
trace::FilterDefault* trace_filter;
bool IsEntityVisible(IClientEntity* entity, int hb) {
if (!trace_filter) {

View File

@ -25,6 +25,7 @@ class Vector;
bool IsPlayerCritBoosted(IClientEntity* player);
bool IsPlayerInvulnerable(IClientEntity* player);
bool IsPlayerInvisible(IClientEntity* player);
//bool SpyIsVisible(IClientEntity* spy);
ConVar* CreateConVar(const char* name, const char* value, const char* help);
ConCommand* CreateConCommand(const char* name, FnCommandCallback_t callback, const char* help);

View File

@ -23,6 +23,7 @@ void LocalPlayer::Update() {
v_ViewOffset = GetEntityValue<Vector>(entity, eoffsets.vViewOffset);
v_Origin = entity->GetAbsOrigin();
v_Eye = v_Origin + v_ViewOffset;
cond_0 = GetEntityValue<int>(entity, eoffsets.iCond);
int hWeapon = GetEntityValue<int>(entity, eoffsets.hActiveWeapon);
if (hWeapon)
weapon = interfaces::entityList->GetClientEntity(hWeapon & 0xFFF);