diff --git a/uran/src/drawing.cpp b/uran/src/drawing.cpp index 6bbe4986..43246d94 100644 --- a/uran/src/drawing.cpp +++ b/uran/src/drawing.cpp @@ -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); } diff --git a/uran/src/drawing.h b/uran/src/drawing.h index 66146655..2a40bc3a 100644 --- a/uran/src/drawing.h +++ b/uran/src/drawing.h @@ -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); } diff --git a/uran/src/hack.cpp b/uran/src/hack.cpp index 5309eeaf..8e23a597 100644 --- a/uran/src/hack.cpp +++ b/uran/src/hack.cpp @@ -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 { diff --git a/uran/src/hacks/HEsp.cpp b/uran/src/hacks/HEsp.cpp index dde4716a..21df5a52 100644 --- a/uran/src/hacks/HEsp.cpp +++ b/uran/src/hacks/HEsp.cpp @@ -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(eoffsets.iCond) & cond::cloaked) return; + if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) { + return; + } + } if (ent->Var(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]); } diff --git a/uran/src/hacks/HEsp.h b/uran/src/hacks/HEsp.h index 0c96a0d8..e5e708ef 100644 --- a/uran/src/hacks/HEsp.h +++ b/uran/src/hacks/HEsp.h @@ -37,7 +37,7 @@ public: ConVar* v_bShowFriends; ConVar* v_bVisCheck; ConVar* v_bLegit; - ConVar* v_bLegitSeenTicks; + ConVar* v_iLegitSeenTicks; //ConVar* v_bModelInfo; }; diff --git a/uran/src/hacks/HTrigger.cpp b/uran/src/hacks/HTrigger.cpp index a81f5c22..2707b028 100644 --- a/uran/src/hacks/HTrigger.cpp +++ b/uran/src/hacks/HTrigger.cpp @@ -103,7 +103,7 @@ bool HTrigger::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) { ((GetEntityValue(entity, eoffsets.iCond)) & cond::cloaked)) return true; int health = GetEntityValue(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; diff --git a/uran/src/hacks/Tracers.h b/uran/src/hacks/Tracers.h index 467110d7..b14aaf69 100644 --- a/uran/src/hacks/Tracers.h +++ b/uran/src/hacks/Tracers.h @@ -10,6 +10,8 @@ #include "IHack.h" +class ConVar; + class Tracers : public IHack { public: DECL_HACK diff --git a/uran/src/helpers.cpp b/uran/src/helpers.cpp index 0e811d40..538e69f1 100644 --- a/uran/src/helpers.cpp +++ b/uran/src/helpers.cpp @@ -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) { diff --git a/uran/src/helpers.h b/uran/src/helpers.h index e11e40cf..c9d60134 100644 --- a/uran/src/helpers.h +++ b/uran/src/helpers.h @@ -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); diff --git a/uran/src/localplayer.cpp b/uran/src/localplayer.cpp index 3ae69a6c..4a39fad4 100644 --- a/uran/src/localplayer.cpp +++ b/uran/src/localplayer.cpp @@ -23,6 +23,7 @@ void LocalPlayer::Update() { v_ViewOffset = GetEntityValue(entity, eoffsets.vViewOffset); v_Origin = entity->GetAbsOrigin(); v_Eye = v_Origin + v_ViewOffset; + cond_0 = GetEntityValue(entity, eoffsets.iCond); int hWeapon = GetEntityValue(entity, eoffsets.hActiveWeapon); if (hWeapon) weapon = interfaces::entityList->GetClientEntity(hWeapon & 0xFFF);