--- doesn't work ---

This commit is contained in:
nullifiedcat 2017-03-20 23:08:20 +03:00
parent 2c135b194c
commit 083acc4383
7 changed files with 43 additions and 19 deletions

View File

@ -235,8 +235,8 @@ void draw::Initialize() {
g_IEngine->GetScreenSize(draw::width, draw::height);
}
g_ISurface->SetFontGlyphSet(fonts::ESP, "TF2 Build", fonts::ESP_HEIGHT, 0, 0, 0, g_ISurface->FONTFLAG_DROPSHADOW); // or Ubuntu Mono Bold
g_ISurface->SetFontGlyphSet(fonts::MENU, "Verdana", fonts::MENU_HEIGHT, 0, 0, 0, g_ISurface->FONTFLAG_DROPSHADOW);
g_ISurface->SetFontGlyphSet(fonts::ESP, "TF2 Build", fonts::ESP_HEIGHT, 0, 0, 0, 0); // or Ubuntu Mono Bold
g_ISurface->SetFontGlyphSet(fonts::MENU, "Verdana", fonts::MENU_HEIGHT, 0, 0, 0, 0);
g_ISurface->SetFontGlyphSet(fonts::MENU_BIG, "Verdana Bold", fonts::MENU_BIG_HEIGHT, 0, 0, 0, 0x0);
}
@ -339,10 +339,10 @@ void draw::WString(unsigned long font, int x, int y, int color, int shadow, cons
if (shadow) {
unsigned char alpha = (color >> 24);
int black_t = ((alpha == 255) ? colors::black : colors::Create(0, 0, 0, alpha / shadow));
/*if (shadow > 0) {
if (shadow > 0) {
draw::WString(font, x + 1, y + 1, black_t, false, text);
}
if (shadow > 1 && !g_Settings.bFastOutline->GetBool()) {
if (shadow > 1) {
draw::WString(font, x - 1, y + 1, black_t, false, text);
draw::WString(font, x - 1, y - 1, black_t, false, text);
draw::WString(font, x + 1, y - 1, black_t, false, text);
@ -350,7 +350,7 @@ void draw::WString(unsigned long font, int x, int y, int color, int shadow, cons
draw::WString(font, x, y + 1, black_t, false, text);
draw::WString(font, x, y - 1, black_t, false, text);
draw::WString(font, x - 1, y, black_t, false, text);
}*/
}
}
g_ISurface->DrawSetTextPos(x, y);
g_ISurface->DrawSetTextColor(*reinterpret_cast<Color*>(&color));

View File

@ -61,7 +61,7 @@ std::stack<std::string>& hack::command_stack() {
void hack::InitHacks() {
}
std::mutex hack::command_stack_mutex;
//std::mutex hack::command_stack_mutex;
ConCommand* hack::c_Cat = 0;
void hack::CC_Cat(const CCommand& args) {

View File

@ -23,7 +23,7 @@ class CCommand;
namespace hack {
extern std::mutex command_stack_mutex;
//extern std::mutex command_stack_mutex;
std::stack<std::string>& command_stack();
extern bool shutdown;

View File

@ -29,24 +29,45 @@ CatVar bot(CV_SWITCH, "fb_bot", "0", "This player is a bot", "Set to 1 in follow
void WalkTo(const Vector& vector) {
if (CE_VECTOR(LOCAL_E, netvar.vVelocity).IsZero(1.0f)) {
if (LOCAL_E->m_vecOrigin.DistTo(vector) > 150.0f) {
if (LOCAL_E->m_vecOrigin.DistTo(vector) > 200.0f) {
if (!g_pLocalPlayer->bZoomed)
g_pUserCmd->buttons |= IN_JUMP;
}
}
const Vector& current = LOCAL_E->m_vecOrigin;
Vector diff = (current - vector);
float dot = current.Dot(vector);
float cos = dot / (current.Length() * vector.Length());
float rad = acos(cos);
if (diff.y < 0) rad = -rad;
float cur_rad = DEG2RAD(g_pUserCmd->viewangles.y);
Vector diff = (last_direction - current);
float v_cos = diff.x / diff.Length();
float rad = acos(v_cos);
float yan = g_Settings.last_angles.y;
float cur_rad = DEG2RAD(yan);
float rad_diff = cur_rad - rad;
g_pUserCmd->forwardmove = std::cos(rad_diff) * 450.0f;
g_pUserCmd->sidemove = sin(rad_diff) * 450.0f;
//g_pUserCmd->forwardmove = std::cos(rad_diff) * 450.0f;
//g_pUserCmd->sidemove = -std::sin(rad_diff) * 450.0f;
//float deg_move = DEG2RAD(g_pUserCmd->viewangles.y);
g_pUserCmd->forwardmove = std::cos(rad_diff) * ((diff.x > 0) - (diff.x < 0)) * 450.0f;
g_pUserCmd->sidemove = std::sin(rad_diff) * ((diff.y > 0) - (diff.y < 0)) * 450.0f;
}
void PrintDebug() {
const Vector& current = LOCAL_E->m_vecOrigin;
Vector diff = (last_direction - current);
float v_cos = diff.x / diff.Length();
AddSideString(format("cos: ", v_cos));
float rad = acos(v_cos);
AddSideString(format("rad: ", rad / PI, " PI"));
float yan = g_Settings.last_angles.y;
AddSideString(format("view y: ", yan));
float cur_rad = DEG2RAD(yan);
AddSideString(format("view y rad: ", cur_rad / PI, " PI"));
float rad_diff = cur_rad + rad;
AddSideString(format("diff: ", rad_diff / PI, " PI"));
//g_pUserCmd->forwardmove = std::cos(rad_diff) * 450.0f;
//g_pUserCmd->sidemove = -std::sin(rad_diff) * 450.0f;
//float deg_move = DEG2RAD(g_pUserCmd->viewangles.y);
}
void DoWalking() {
if (!bot) return;
following_idx = 0;
for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
@ -66,7 +87,8 @@ void DoWalking() {
}
} else {
lost_time = 0;
WalkTo(found_entity->m_vecOrigin);
if (found_entity->m_vecOrigin.DistTo(LOCAL_E->m_vecOrigin) > 200.0f) WalkTo(found_entity->m_vecOrigin);
last_direction = found_entity->m_vecOrigin;
}
}

View File

@ -22,6 +22,7 @@ extern unsigned follow_steamid;
extern int following_idx;
void DoWalking();
void PrintDebug();
}}}

View File

@ -41,7 +41,7 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
if (call_default) SAFE_CALL(((PaintTraverse_t*)hooks::hkPanel->GetMethod(hooks::offPaintTraverse))(p, vp, fr, ar));
// To avoid threading problems.
{
std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
//std::lock_guard<std::mutex> guard(hack::command_stack_mutex);
while (!hack::command_stack().empty()) {
g_IEngine->ExecuteClientCmd(hack::command_stack().top().c_str());
hack::command_stack().pop();
@ -89,6 +89,7 @@ void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
SAFE_CALL(hacks::shared::misc::Draw());
SAFE_CALL(hacks::shared::esp::Draw());
if (TF) SAFE_CALL(hacks::tf::spyalert::Draw());
hacks::shared::followbot::PrintDebug();
}
#if GUI_ENABLED == true

View File

@ -14,7 +14,7 @@ namespace ipc {
void CommandCallback(cat_ipc::command_s& command, void* payload) {
if (!strcmp("exec", (const char*)command.cmd_data) && payload) {
std::lock_guard<std::mutex> lock(hack::command_stack_mutex);
//std::lock_guard<std::mutex> lock(hack::command_stack_mutex);
hack::command_stack().push(std::string((const char*)payload));
}
}