backtrack for legit play

This commit is contained in:
BenCat07 2018-05-15 17:51:21 +02:00
parent c466194920
commit aa98f1c7ee
23 changed files with 118 additions and 75 deletions

View File

@ -172,4 +172,8 @@ struct offsets
{ {
return PlatformOffset(14, undefined, undefined); return PlatformOffset(14, undefined, undefined);
} }
static constexpr uint32_t IsPlayingTimeDemo()
{
return PlatformOffset(77, undefined, 77);
}
}; };

View File

@ -15,6 +15,7 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/AutoSticky.hpp" "${CMAKE_CURRENT_LIST_DIR}/AutoSticky.hpp"
"${CMAKE_CURRENT_LIST_DIR}/AutoTaunt.hpp" "${CMAKE_CURRENT_LIST_DIR}/AutoTaunt.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Bunnyhop.hpp" "${CMAKE_CURRENT_LIST_DIR}/Bunnyhop.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Backtrack.hpp"
"${CMAKE_CURRENT_LIST_DIR}/CatBot.hpp" "${CMAKE_CURRENT_LIST_DIR}/CatBot.hpp"
"${CMAKE_CURRENT_LIST_DIR}/FollowBot.hpp" "${CMAKE_CURRENT_LIST_DIR}/FollowBot.hpp"
"${CMAKE_CURRENT_LIST_DIR}/hacklist.hpp" "${CMAKE_CURRENT_LIST_DIR}/hacklist.hpp"
@ -27,7 +28,8 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Spam.hpp" "${CMAKE_CURRENT_LIST_DIR}/Spam.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Trigger.hpp" "${CMAKE_CURRENT_LIST_DIR}/Trigger.hpp"
"${CMAKE_CURRENT_LIST_DIR}/UberSpam.hpp" "${CMAKE_CURRENT_LIST_DIR}/UberSpam.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Walkbot.hpp") "${CMAKE_CURRENT_LIST_DIR}/Walkbot.hpp"
"${CMAKE_CURRENT_LIST_DIR}/Radar.hpp")
if(EnableVisuals) if(EnableVisuals)
target_sources(cathook PRIVATE target_sources(cathook PRIVATE

View File

@ -16,8 +16,6 @@ namespace tf
{ {
namespace radar namespace radar
{ {
void Init();
std::pair<int, int> WorldToRadar(int x, int y); std::pair<int, int> WorldToRadar(int x, int y);
void Draw(); void Draw();
} }

View File

@ -29,6 +29,7 @@
#include "AutoDeadringer.hpp" #include "AutoDeadringer.hpp"
#include "Bunnyhop.hpp" #include "Bunnyhop.hpp"
#include "LagExploit.hpp" #include "LagExploit.hpp"
#include "Radar.hpp"
#include "Walkbot.hpp" #include "Walkbot.hpp"
#include "AutoJoin.hpp" #include "AutoJoin.hpp"
#include "AntiBackstab.hpp" #include "AntiBackstab.hpp"
@ -46,3 +47,4 @@
#include "Announcer.hpp" #include "Announcer.hpp"
#include "Killstreak.hpp" #include "Killstreak.hpp"
#include "CatBot.hpp" #include "CatBot.hpp"
#include "Backtrack.hpp"

View File

@ -58,6 +58,7 @@ extern VMTHook localbaseent;
extern VMTHook clientmode; extern VMTHook clientmode;
extern VMTHook clientmode4; extern VMTHook clientmode4;
extern VMTHook client; extern VMTHook client;
extern VMTHook engine;
extern VMTHook netchannel; extern VMTHook netchannel;
extern VMTHook clientdll; extern VMTHook clientdll;
extern VMTHook matsurface; extern VMTHook matsurface;

View File

@ -68,6 +68,8 @@ DECLARE_HOOKED_METHOD(FireEventClientSide, bool, IGameEventManager2 *,
#if ENABLE_VISUALS #if ENABLE_VISUALS
// ClientMode // ClientMode
DECLARE_HOOKED_METHOD(OverrideView, void, void *, CViewSetup *); DECLARE_HOOKED_METHOD(OverrideView, void, void *, CViewSetup *);
// g_IEngine
DECLARE_HOOKED_METHOD(IsPlayingTimeDemo, bool);
// IVModelRender // IVModelRender
DECLARE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *, DECLARE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *,
const DrawModelState_t &, const ModelRenderInfo_t &, const DrawModelState_t &, const ModelRenderInfo_t &,

View File

@ -22,9 +22,9 @@ public:
self, offsets::PlatformOffset(522, offsets::undefined, 522), self, offsets::PlatformOffset(522, offsets::undefined, 522),
0)(self, trace); 0)(self, trace);
} }
inline static int GetSwingRange(IClientEntity *self) inline static float GetSwingRange(IClientEntity *self)
{ {
typedef int (*fn_t)(IClientEntity *); typedef float (*fn_t)(IClientEntity *);
return vfunc<fn_t>( return vfunc<fn_t>(
self, offsets::PlatformOffset(520, offsets::undefined, 520), self, offsets::PlatformOffset(520, offsets::undefined, 520),
0)(self); 0)(self);

View File

@ -19,19 +19,20 @@ class sprite;
class sprite class sprite
{ {
public: public:
sprite(float x, float y, float w, float h, const texture_atlas &atlas); sprite(float x, float y, float w, float h, texture_atlas &atlas);
public: public:
void setsprite(float x, float y, float w, float h);
void draw(float scrx, float scry, float scrw, float scrh, void draw(float scrx, float scry, float scrw, float scrh,
const rgba_t &rgba) const; const rgba_t &rgba);
public: public:
const float nx; float nx;
const float ny; float ny;
const float nw; float nw;
const float nh; float nh;
const texture_atlas &atlas; texture_atlas &atlas;
}; };
class texture_atlas class texture_atlas
@ -40,7 +41,7 @@ public:
texture_atlas(std::string filename, float width, float height); texture_atlas(std::string filename, float width, float height);
public: public:
sprite create_sprite(float x, float y, float sx, float sy) const; sprite create_sprite(float x, float y, float sx, float sy);
public: public:
const float width; const float width;

View File

@ -12,7 +12,7 @@ CatVar jointeam(CV_SWITCH, "fb_autoteam", "1",
CatVar joinclass(CV_STRING, "fb_autoclass", "spy", CatVar joinclass(CV_STRING, "fb_autoclass", "spy",
"Class that will be picked after joining a team (NYI)"); "Class that will be picked after joining a team (NYI)");
CatVar nolerp(CV_SWITCH, "nolerp", "0", "NoLerp mode (experimental)"); CatVar nolerp(CV_SWITCH, "nolerp", "1", "NoLerp mode (experimental)");
CatVar engine_pred(CV_SWITCH, "engine_prediction", "0", "Engine Prediction"); CatVar engine_pred(CV_SWITCH, "engine_prediction", "0", "Engine Prediction");
CatVar debug_projectiles(CV_SWITCH, "debug_projectiles", "0", CatVar debug_projectiles(CV_SWITCH, "debug_projectiles", "0",

View File

@ -346,6 +346,10 @@ free(logname);*/
hooks::enginevgui.HookMethod(HOOK_ARGS(Paint)); hooks::enginevgui.HookMethod(HOOK_ARGS(Paint));
hooks::enginevgui.Apply(); hooks::enginevgui.Apply();
hooks::engine.Set(g_IEngine);
hooks::engine.HookMethod(HOOK_ARGS(IsPlayingTimeDemo));
hooks::engine.Apply();
hooks::eventmanager2.Set(g_IEventManager2); hooks::eventmanager2.Set(g_IEventManager2);
hooks::eventmanager2.HookMethod(HOOK_ARGS(FireEvent)); hooks::eventmanager2.HookMethod(HOOK_ARGS(FireEvent));
hooks::eventmanager2.HookMethod(HOOK_ARGS(FireEventClientSide)); hooks::eventmanager2.HookMethod(HOOK_ARGS(FireEventClientSide));

View File

@ -15,7 +15,7 @@ namespace shared
namespace antiaim namespace antiaim
{ {
CatVar communicate(CV_SWITCH, "identify", "1", "identify", CatVar communicate(CV_SWITCH, "identify", "0", "identify",
"Auto identify for other cathook users"); "Auto identify for other cathook users");
CatVar enabled(CV_SWITCH, "aa_enabled", "0", "Anti-Aim", CatVar enabled(CV_SWITCH, "aa_enabled", "0", "Anti-Aim",
"Master AntiAim switch"); "Master AntiAim switch");

View File

@ -16,6 +16,7 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/AutoSticky.cpp" "${CMAKE_CURRENT_LIST_DIR}/AutoSticky.cpp"
"${CMAKE_CURRENT_LIST_DIR}/AutoTaunt.cpp" "${CMAKE_CURRENT_LIST_DIR}/AutoTaunt.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Bunnyhop.cpp" "${CMAKE_CURRENT_LIST_DIR}/Bunnyhop.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Backtrack.cpp"
"${CMAKE_CURRENT_LIST_DIR}/CatBot.cpp" "${CMAKE_CURRENT_LIST_DIR}/CatBot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/FollowBot.cpp" "${CMAKE_CURRENT_LIST_DIR}/FollowBot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/HealArrows.cpp" "${CMAKE_CURRENT_LIST_DIR}/HealArrows.cpp"
@ -27,7 +28,8 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/Spam.cpp" "${CMAKE_CURRENT_LIST_DIR}/Spam.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Trigger.cpp" "${CMAKE_CURRENT_LIST_DIR}/Trigger.cpp"
"${CMAKE_CURRENT_LIST_DIR}/UberSpam.cpp" "${CMAKE_CURRENT_LIST_DIR}/UberSpam.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Walkbot.cpp") "${CMAKE_CURRENT_LIST_DIR}/Walkbot.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Radar.cpp")
if(EnableVisuals) if(EnableVisuals)
target_sources(cathook PRIVATE target_sources(cathook PRIVATE

View File

@ -81,7 +81,7 @@ void WorldTick()
if (follow_steam) if (follow_steam)
{ {
// Find a target with the steam id, as it is prioritized // Find a target with the steam id, as it is prioritized
auto ent_count = g_IEngine->GetMaxClients(); auto ent_count = HIGHEST_ENTITY;
for (int i = 0; i < ent_count; i++) for (int i = 0; i < ent_count; i++)
{ {
auto entity = ENTITY(i); auto entity = ENTITY(i);
@ -89,12 +89,10 @@ void WorldTick()
continue; continue;
if (entity->m_Type != ENTITY_PLAYER) if (entity->m_Type != ENTITY_PLAYER)
continue; continue;
player_info_s info; if ((int)follow_steam + 18 != entity->player_info.friendsID) // steamid check
g_IEngine->GetPlayerInfo(entity->m_IDX, &info);
unsigned int xd = info.friendsID;
int xdd = xd;
if ((int) follow_steam != xdd) // steamid check
continue; continue;
logging::Info("Success");
if (!entity->m_bAlivePlayer) // Dont follow dead players if (!entity->m_bAlivePlayer) // Dont follow dead players
continue; continue;
if (!VisCheckEntFromEnt(LOCAL_E, entity)) if (!VisCheckEntFromEnt(LOCAL_E, entity))
@ -149,7 +147,7 @@ void WorldTick()
} }
} }
// last check for entity before we continue // last check for entity before we continue
if (!follow_target) if (!follow_target)
return; return;
} }

View File

@ -291,9 +291,8 @@ void CreateMove()
} }
} }
} }
if (cloak && shoot) if (cloak && shoot && CE_INT(LOCAL_E, netvar.iClass) != tf_class::tf_spy)
{ {
if ((g_pUserCmd->buttons & IN_ATTACK) && !bWasHolding && if ((g_pUserCmd->buttons & IN_ATTACK) && !bWasHolding &&
HasCondition<TFCond_Cloaked>(LOCAL_E)) HasCondition<TFCond_Cloaked>(LOCAL_E))
{ {
@ -345,7 +344,7 @@ void CreateMove()
} }
else if (!shoot) else if (!shoot)
{ {
if (cloak) if (cloak && CE_INT(LOCAL_E, netvar.iClass) != tf_class::tf_spy)
{ {
if ((g_pUserCmd->buttons & IN_ATTACK2) && !bWasHolding && if ((g_pUserCmd->buttons & IN_ATTACK2) && !bWasHolding &&
!HasCondition<TFCond_Cloaked>(LOCAL_E)) !HasCondition<TFCond_Cloaked>(LOCAL_E))

View File

@ -6,6 +6,7 @@
*/ */
#include "common.hpp" #include "common.hpp"
#include "Radar.hpp"
#ifndef FEATURE_RADAR_DISABLED #ifndef FEATURE_RADAR_DISABLED
@ -16,10 +17,6 @@ namespace tf
namespace radar namespace radar
{ {
std::array<std::array<textures::sprite, 9>, 3> tx_class;
std::array<textures::sprite, 2> tx_teams;
std::array<textures::sprite, 2> tx_items;
static CatVar size(CV_INT, "radar_size", "300", "Radar size", static CatVar size(CV_INT, "radar_size", "300", "Radar size",
"Defines radar size in pixels"); "Defines radar size in pixels");
static CatVar zoom(CV_FLOAT, "radar_zoom", "20", "Radar zoom", static CatVar zoom(CV_FLOAT, "radar_zoom", "20", "Radar zoom",
@ -45,27 +42,7 @@ static CatVar show_healthpacks(CV_SWITCH, "radar_healthpacks", "1",
"Show Healthpacks"); "Show Healthpacks");
static CatVar show_ammopacks(CV_SWITCH, "radar_ammopacks", "1", static CatVar show_ammopacks(CV_SWITCH, "radar_ammopacks", "1",
"Show Ammopacks"); "Show Ammopacks");
Timer invalid{};
void Init()
{
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 9; j++)
{
tx_classes[i][j].reset(new textures::AtlasTexture(
64 * j, textures::atlas_height - 64 * (i + 1), 64, 64));
}
}
tx_teams[0].reset(new textures::AtlasTexture(
11 * 64, textures::atlas_height - 128, 64, 64));
tx_teams[1].reset(new textures::AtlasTexture(
11 * 64, textures::atlas_height - 64, 64, 64));
tx_items[0].reset(new textures::AtlasTexture(
10 * 64, textures::atlas_height - 64, 64, 64));
tx_items[1].reset(new textures::AtlasTexture(
10 * 64, textures::atlas_height - 128, 64, 64));
}
std::pair<int, int> WorldToRadar(int x, int y) std::pair<int, int> WorldToRadar(int x, int y)
{ {
@ -103,9 +80,44 @@ std::pair<int, int> WorldToRadar(int x, int y)
return { nx + halfsize - (int) icon_size / 2, return { nx + halfsize - (int) icon_size / 2,
ny + halfsize - (int) icon_size / 2 }; ny + halfsize - (int) icon_size / 2 };
} }
bool loaded = false;
textures::texture_atlas texture(DATA_PATH "/res/atlas.png", 1024, 512);
void DrawEntity(int x, int y, CachedEntity *ent) void DrawEntity(int x, int y, CachedEntity *ent)
{ {
if (!loaded)
{
if (texture.texture.handle == GLEZ_TEXTURE_INVALID &&
invalid.test_and_set(10000))
{
logging::Info("Invalid atlas, retrying....");
texture.texture.handle =
glez_texture_load_png_rgba(DATA_PATH "/res/atlas.png");
return;
}
else if (texture.texture.handle != GLEZ_TEXTURE_INVALID)
loaded = true;
else
return;
}
struct basesprite
{
textures::sprite sprite = texture.create_sprite(0, 0, 0, 0);
};
static std::array<std::array<basesprite, 9>, 3> tx_class;
static std::array<basesprite, 2> tx_teams;
static std::array<basesprite, 2> tx_items;
for (int i = 0; i < 3; i++)
for (int j = 0; j < 9; j++)
tx_class[i][j].sprite.setsprite(64 * j, texture.height -64 * (i + 1), 64, 64);
tx_teams[0].sprite.setsprite(11 * 64, texture.height - 128, 64, 64);
tx_teams[1].sprite.setsprite(11 * 64, texture.height -64, 64, 64);
tx_items[0].sprite.setsprite(10 * 64, texture.height - 64, 64, 64);
tx_items[1].sprite.setsprite(10 * 64, texture.height - 128, 64, 64);
int idx; int idx;
rgba_t clr; rgba_t clr;
float healthp; float healthp;
@ -128,18 +140,18 @@ void DrawEntity(int x, int y, CachedEntity *ent)
if (use_icons) if (use_icons)
{ {
tx_teams[idx].get()->Draw(x + wtr.first, y + wtr.second, tx_teams[idx].sprite.draw(x + wtr.first, y + wtr.second,
colors::white, (int) icon_size, (int) icon_size, (int) icon_size,
(int) icon_size); colors::white);
tx_classes[2][clazz - 1].get()->Draw( tx_class[2][clazz - 1].sprite.draw(
x + wtr.first, y + wtr.second, colors::white, x + wtr.first, y + wtr.second, (int) icon_size,
(int) icon_size, (int) icon_size); (int) icon_size, colors::white);
} }
else else
{ {
tx_classes[idx][clazz - 1].get()->Draw( tx_class[idx][clazz - 1].sprite.draw(
x + wtr.first, y + wtr.second, colors::white, x + wtr.first, y + wtr.second, (int) icon_size,
(int) icon_size, (int) icon_size); (int) icon_size, colors::white);
draw_api::draw_rect_outlined( draw_api::draw_rect_outlined(
x + wtr.first, y + wtr.second, (int) icon_size, x + wtr.first, y + wtr.second, (int) icon_size,
(int) icon_size, idx ? colors::blu_v : colors::red_v, 0.5f); (int) icon_size, idx ? colors::blu_v : colors::red_v, 0.5f);
@ -190,8 +202,8 @@ void DrawEntity(int x, int y, CachedEntity *ent)
WorldToRadar(ent->m_vecOrigin.x, ent->m_vecOrigin.y); WorldToRadar(ent->m_vecOrigin.x, ent->m_vecOrigin.y);
float sz = float(icon_size) * 0.15f * 0.5f; float sz = float(icon_size) * 0.15f * 0.5f;
float sz2 = float(icon_size) * 0.85; float sz2 = float(icon_size) * 0.85;
tx_items[1].get()->Draw(x + wtr.first + sz, y + wtr.second + sz, tx_items[1].sprite.draw(x + wtr.first + sz, y + wtr.second + sz,
colors::white, sz2, sz2); sz2, sz2, colors::white);
} }
else if (show_ammopacks && (ent->m_ItemType == ITEM_AMMO_LARGE || else if (show_ammopacks && (ent->m_ItemType == ITEM_AMMO_LARGE ||
ent->m_ItemType == ITEM_AMMO_MEDIUM || ent->m_ItemType == ITEM_AMMO_MEDIUM ||
@ -201,8 +213,8 @@ void DrawEntity(int x, int y, CachedEntity *ent)
WorldToRadar(ent->m_vecOrigin.x, ent->m_vecOrigin.y); WorldToRadar(ent->m_vecOrigin.x, ent->m_vecOrigin.y);
float sz = float(icon_size) * 0.15f * 0.5f; float sz = float(icon_size) * 0.15f * 0.5f;
float sz2 = float(icon_size) * 0.85; float sz2 = float(icon_size) * 0.85;
tx_items[0].get()->Draw(x + wtr.first + sz, y + wtr.second + sz, tx_items[0].sprite.draw(x + wtr.first + sz, y + wtr.second + sz,
colors::white, sz2, sz2); sz2, sz2, colors::white);
} }
} }
} }
@ -212,6 +224,8 @@ void Draw()
{ {
if (!g_IEngine->IsInGame()) if (!g_IEngine->IsInGame())
return; return;
if (CE_BAD(LOCAL_E))
return;
int x, y; int x, y;
rgba_t outlineclr; rgba_t outlineclr;
std::vector<CachedEntity *> enemies{}; std::vector<CachedEntity *> enemies{};
@ -224,8 +238,7 @@ void Draw()
int radar_size = size; int radar_size = size;
int half_size = radar_size / 2; int half_size = radar_size / 2;
outlineclr = outlineclr = GUIColor();
(hacks::shared::aimbot::foundTarget ? colors::pink : GUIColor());
draw_api::draw_rect(x, y, radar_size, radar_size, draw_api::draw_rect(x, y, radar_size, radar_size,
colors::Transparent(colors::black, 0.4f)); colors::Transparent(colors::black, 0.4f));

View File

@ -100,6 +100,7 @@ VMTHook baseclientstate8{};
VMTHook clientmode{}; VMTHook clientmode{};
VMTHook panel{}; VMTHook panel{};
VMTHook client{}; VMTHook client{};
VMTHook engine{};
VMTHook ctfpartyclient; VMTHook ctfpartyclient;
VMTHook netchannel{}; VMTHook netchannel{};
VMTHook clientdll{}; VMTHook clientdll{};

View File

@ -13,7 +13,8 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/SendNetMsg.cpp" "${CMAKE_CURRENT_LIST_DIR}/SendNetMsg.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Shutdown.cpp" "${CMAKE_CURRENT_LIST_DIR}/Shutdown.cpp"
"${CMAKE_CURRENT_LIST_DIR}/FireEvent.cpp" "${CMAKE_CURRENT_LIST_DIR}/FireEvent.cpp"
"${CMAKE_CURRENT_LIST_DIR}/FireEventClientSide.cpp") "${CMAKE_CURRENT_LIST_DIR}/FireEventClientSide.cpp"
"${CMAKE_CURRENT_LIST_DIR}/IsPlayingTimeDemo.cpp")
if(EnableVisuals) if(EnableVisuals)
add_subdirectory(visual) add_subdirectory(visual)

View File

@ -312,6 +312,10 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
if (engine_pred) if (engine_pred)
engine_prediction::RunEnginePrediction(RAW_ENT(LOCAL_E), engine_prediction::RunEnginePrediction(RAW_ENT(LOCAL_E),
g_pUserCmd); g_pUserCmd);
{
PROF_SECTION(CM_backtracc);
hacks::shared::backtrack::Run();
}
{ {
PROF_SECTION(CM_aimbot); PROF_SECTION(CM_aimbot);
hacks::shared::aimbot::CreateMove(); hacks::shared::aimbot::CreateMove();

View File

@ -111,6 +111,7 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec"); g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec");
hacks::shared::aimbot::Reset(); hacks::shared::aimbot::Reset();
hacks::shared::backtrack::Init();
chat_stack::Reset(); chat_stack::Reset();
hacks::shared::anticheat::ResetEverything(); hacks::shared::anticheat::ResetEverything();
original::LevelInit(this_, name); original::LevelInit(this_, name);

View File

@ -4,6 +4,7 @@
*/ */
#include "HookedMethods.hpp" #include "HookedMethods.hpp"
#include "Radar.hpp"
CatVar clean_screenshots(CV_SWITCH, "clean_screenshots", "1", CatVar clean_screenshots(CV_SWITCH, "clean_screenshots", "1",
"Clean screenshots", "Clean screenshots",
@ -44,9 +45,6 @@ DEFINE_HOOKED_METHOD(PaintTraverse, void, vgui::IPanel *this_,
if (!textures_loaded) if (!textures_loaded)
{ {
textures_loaded = true; textures_loaded = true;
#ifndef FEATURE_RADAR_DISABLED
hacks::tf::radar::Init();
#endif
} }
#endif #endif
if (pure_bypass) if (pure_bypass)

View File

@ -6,6 +6,7 @@
*/ */
#include "common.hpp" #include "common.hpp"
#include "Backtrack.hpp"
/* /*
* Targeting priorities: * Targeting priorities:

16
src/visual/atlas.cpp Executable file → Normal file
View File

@ -10,14 +10,20 @@
namespace textures namespace textures
{ {
sprite::sprite(float x, float y, float w, float h, const texture_atlas &atlas) sprite::sprite(float x, float y, float w, float h, texture_atlas &atlas)
: nx(x / atlas.width), ny(y / atlas.height), nw(w / atlas.width), : nx(x / atlas.width), ny(y / atlas.height), nw(w / atlas.width),
nh(h / atlas.height), atlas(atlas) nh(h / atlas.height), atlas(atlas)
{ {
} }
void sprite::setsprite(float x, float y, float w, float h)
{
nx = x;
ny = y;
nw = w;
nh = h;
}
void sprite::draw(float scrx, float scry, float scrw, float scrh, void sprite::draw(float scrx, float scry, float scrw, float scrh,
const rgba_t &rgba) const const rgba_t &rgba)
{ {
draw_api::draw_rect_textured(scrx, scry, scrw, scrh, rgba, atlas.texture, draw_api::draw_rect_textured(scrx, scry, scrw, scrh, rgba, atlas.texture,
nx, ny, nw, nh, 0); nx, ny, nw, nh, 0);
@ -29,14 +35,14 @@ texture_atlas::texture_atlas(std::string filename, float width, float height)
texture = draw_api::create_texture(filename.c_str()); texture = draw_api::create_texture(filename.c_str());
} }
sprite texture_atlas::create_sprite(float x, float y, float sx, float sy) const sprite texture_atlas::create_sprite(float x, float y, float sx, float sy)
{ {
return sprite(x, y, sx, sy, *this); return sprite(x, y, sx, sy, *this);
} }
texture_atlas &atlas() texture_atlas &atlas()
{ {
static texture_atlas object{ DATA_PATH "/atlas.png", 1024, 512 }; static texture_atlas object{ DATA_PATH "/res/atlas.png", 1024, 512 };
return object; return object;
} }
} }

View File

@ -139,6 +139,11 @@ void DrawCheatVisuals()
hacks::tf::autoreflect::Draw(); hacks::tf::autoreflect::Draw();
} }
IF_GAME(IsTF2()) IF_GAME(IsTF2())
{
PROF_SECTION(DRAW_backtracc);
hacks::shared::backtrack::Draw();
}
IF_GAME(IsTF2())
{ {
PROF_SECTION(DRAW_healarrows); PROF_SECTION(DRAW_healarrows);
hacks::tf2::healarrow::Draw(); hacks::tf2::healarrow::Draw();