crit indicator

This commit is contained in:
nullifiedcat 2017-05-13 21:36:31 +03:00
parent 74b9f4c571
commit a11ca74ba8
12 changed files with 144 additions and 17 deletions

View File

@ -32,7 +32,7 @@
<folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1168214098." name="/" resourcePath=""> <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1168214098." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.965909756" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.exe.debug" superClass="cdt.managedbuild.toolchain.gnu.exe.debug"> <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.965909756" name="Linux GCC" nonInternalBuilderId="cdt.managedbuild.target.gnu.builder.exe.debug" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
<targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1799148153" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/> <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1799148153" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
<builder arguments="-e NOGUI=1 GAME=tf2" buildPath="${workspace_loc:/cathook}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.1548213350" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/> <builder arguments="-e GAME=tf2" buildPath="${workspace_loc:/cathook}" command="make" id="cdt.managedbuild.target.gnu.builder.exe.debug.1548213350" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
<tool id="cdt.managedbuild.tool.gnu.archiver.base.782611349" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/> <tool id="cdt.managedbuild.tool.gnu.archiver.base.782611349" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
<tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.883030293" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug"> <tool command="g++" id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.883030293" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
<option id="gnu.cpp.compiler.exe.debug.option.optimization.level.908662295" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/> <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.908662295" name="Optimization Level" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>

BIN
res/crit_1 Normal file

Binary file not shown.

BIN
res/crit_2 Normal file

Binary file not shown.

BIN
res/crit_3 Normal file

Binary file not shown.

BIN
res/crit_4 Normal file

Binary file not shown.

View File

@ -0,0 +1,75 @@
/*
* CritIndicator.cpp
*
* Created on: May 13, 2017
* Author: nullifiedcat
*/
#include "CritIndicator.hpp"
#include "../../common.h"
namespace menu { namespace ncc {
CatVar ci_enabled(CV_SWITCH, "gui_ncc_crit_indicator", "1", "Crit Indicator");
CatVar ci_x(CV_INT, "gui_ncc_crit_indicator_x", "400", "Crit Indicator X");
CatVar ci_y(CV_INT, "gui_ncc_crit_indicator_x", "150", "Crit Indicator Y");
CritIndicator::CritIndicator() : CBaseWidget("ncc_crit_indicator"),
crit_normal(&_binary_crit_1_start, 64, 64),
crit_none(&_binary_crit_2_start, 64, 64),
crit_ready(&_binary_crit_3_start, 64, 64),
crit_disabled(&_binary_crit_4_start, 64, 64) {
SetOffset((int)ci_x, (int)ci_y);
SetSize(64, 72);
}
bool CritIndicator::IsVisible() {
return !g_Settings.bInvalid && ci_enabled && hacks::shared::misc::crit_hack_next;
}
void CritIndicator::Draw(int x, int y) {
if (!crit_none.id) crit_none.Load();
if (!crit_disabled.id) crit_disabled.Load();
if (!crit_normal.id) crit_normal.Load();
if (!crit_ready.id) crit_ready.Load();
Texture* tx = &crit_none;
bool critkey { false };
if (RandomCrits() && WeaponCanCrit()) {
// It's safe to be 1 tick behind real values to prevent flickering.
if (hacks::shared::misc::found_crit_number >= hacks::shared::misc::last_number - 1 && hacks::shared::misc::found_crit_weapon == RAW_ENT(LOCAL_W)) {
tx = &crit_normal;
if (CritKeyDown() || experimental_crit_hack.KeyDown()) {
tx = &crit_ready;
critkey = true;
}
}
} else {
tx = &crit_disabled;
}
draw::DrawRect(x, y, 64, 72, colors::Transparent(colors::black));
tx->Draw(x, y, 64, 64);
draw::OutlineRect(x, y, 64, 72, critkey ? colors::pink : GUIColor());
draw::DrawLine(x, y + 64, 64, 0, critkey ? colors::pink : GUIColor());
if (CE_GOOD(LOCAL_W)) {
float bucket = *(float*)((uintptr_t)RAW_ENT(LOCAL_W) + 2612u);
draw::DrawRect(x + 1, y + 65, 62.0f * (bucket / 1000.0f), 6, colors::Create(20, 235, 20, 255));
}
}
bool CritIndicator::AlwaysVisible() {
return IsVisible();
}
void CritIndicator::Update() {
if (IsPressed()) {
auto offset = GetOffset();
offset.first += g_pGUI->mouse_dx;
offset.second += g_pGUI->mouse_dy;
SetOffset(offset.first, offset.second);
ci_x = (int)offset.first;
ci_y = (int)offset.second;
}
}
}}

View File

@ -0,0 +1,42 @@
/*
* CritIndicator.hpp
*
* Created on: May 13, 2017
* Author: nullifiedcat
*/
#ifndef CRITINDICATOR_HPP_
#define CRITINDICATOR_HPP_
#include "Menu.hpp"
extern unsigned char _binary_crit_1_start;
extern unsigned char _binary_crit_2_start;
extern unsigned char _binary_crit_3_start;
extern unsigned char _binary_crit_4_start;
namespace menu { namespace ncc {
// FIXME temporary.. I need to make a way to save this instead of using convars.
extern CatVar ci_enabled;
extern CatVar ci_x;
extern CatVar ci_y;
class CritIndicator : public CBaseWidget {
public:
CritIndicator();
virtual bool IsVisible() override;
virtual void Draw(int x, int y) override;
virtual bool AlwaysVisible() override;
virtual void Update() override;
public:
Texture crit_normal;
Texture crit_none;
Texture crit_ready;
Texture crit_disabled;
};
}}
#endif /* CRITINDICATOR_HPP_ */

View File

@ -24,6 +24,7 @@
#include "Root.hpp" #include "Root.hpp"
#include "Tooltip.hpp" #include "Tooltip.hpp"
#include "Background.hpp" #include "Background.hpp"
#include "CritIndicator.hpp"
#include "Logo.hpp" #include "Logo.hpp"
namespace menu { namespace ncc { namespace menu { namespace ncc {

View File

@ -46,6 +46,7 @@ void Root::Setup() {
PlayerList* pl = new PlayerList(); PlayerList* pl = new PlayerList();
pl->SetOffset(200, 200); pl->SetOffset(200, 200);
AddChild(pl); AddChild(pl);
AddChild(new CritIndicator());
} }
void Root::OnKeyPress(ButtonCode_t key, bool repeat) { void Root::OnKeyPress(ButtonCode_t key, bool repeat) {

View File

@ -633,16 +633,18 @@ EAimbotLocalState ShouldAim() {
} }
} }
} }
switch (GetWeaponMode()) { IF_GAME (IsTF2()) {
case weapon_hitscan: switch (GetWeaponMode()) {
case weapon_melee: case weapon_hitscan:
break; case weapon_melee:
case weapon_projectile: break;
if (!projectile_aimbot) return EAimbotLocalState::DISABLED_FOR_THIS_WEAPON; case weapon_projectile:
break; if (!projectile_aimbot) return EAimbotLocalState::DISABLED_FOR_THIS_WEAPON;
default: break;
return EAimbotLocalState::DISABLED_FOR_THIS_WEAPON; default:
}; return EAimbotLocalState::DISABLED_FOR_THIS_WEAPON;
};
}
IF_GAME (IsTF()) { IF_GAME (IsTF()) {
if (g_pLocalPlayer->bZoomed) { if (g_pLocalPlayer->bZoomed) {
if (!(g_pUserCmd->buttons & (IN_ATTACK | IN_ATTACK2))) { if (!(g_pUserCmd->buttons & (IN_ATTACK | IN_ATTACK2))) {

View File

@ -48,7 +48,7 @@ bool C_TFPlayer__ShouldDraw_hook(IClientEntity* thisptr) {
} }
} }
static CatVar crit_hack_next(CV_SWITCH, "crit_hack_next", "0", "Next crit info"); CatVar crit_hack_next(CV_SWITCH, "crit_hack_next", "0", "Next crit info");
void DumpRecvTable(CachedEntity* ent, RecvTable* table, int depth, const char* ft, unsigned acc_offset) { void DumpRecvTable(CachedEntity* ent, RecvTable* table, int depth, const char* ft, unsigned acc_offset) {
bool forcetable = ft && strlen(ft); bool forcetable = ft && strlen(ft);
@ -98,9 +98,9 @@ static CatCommand dump_vars("debug_dump_netvars", "Dump netvars of entity", [](c
CatVar nopush_enabled(CV_SWITCH, "nopush_enabled", "0", "No Push", "Prevents other players from pushing you around."); CatVar nopush_enabled(CV_SWITCH, "nopush_enabled", "0", "No Push", "Prevents other players from pushing you around.");
static IClientEntity* found_crit_weapon = nullptr; IClientEntity* found_crit_weapon = nullptr;
static int found_crit_number = 0; int found_crit_number = 0;
static int last_number = 0; int last_number = 0;
// SUPER SECRET CODE DONOT STEEL // SUPER SECRET CODE DONOT STEEL
@ -189,7 +189,7 @@ void CreateMove() {
if (crit_hack_next && CE_GOOD(LOCAL_W) && WeaponCanCrit() && RandomCrits()) { if (crit_hack_next && CE_GOOD(LOCAL_W) && WeaponCanCrit() && RandomCrits()) {
PROF_SECTION(CM_misc_crit_hack_prediction); PROF_SECTION(CM_misc_crit_hack_prediction);
weapon = RAW_ENT(LOCAL_W); weapon = RAW_ENT(LOCAL_W);
if (vfunc<bool(*)(IClientEntity*)>(weapon, 1944 / 4, 0)(weapon)) { if (weapon && vfunc<bool(*)(IClientEntity*)>(weapon, 1944 / 4, 0)(weapon)) {
if (experimental_crit_hack.KeyDown()) { if (experimental_crit_hack.KeyDown()) {
if (!g_pUserCmd->command_number || critWarmup < 8) { if (!g_pUserCmd->command_number || critWarmup < 8) {
if (g_pUserCmd->buttons & IN_ATTACK) { if (g_pUserCmd->buttons & IN_ATTACK) {
@ -285,7 +285,7 @@ void CreateMove() {
void Draw() { void Draw() {
if (crit_info && CE_GOOD(LOCAL_W)) { if (crit_info && CE_GOOD(LOCAL_W)) {
if (CritKeyDown()) { if (CritKeyDown() || experimental_crit_hack.KeyDown()) {
AddCenterString("FORCED CRITS!", colors::red); AddCenterString("FORCED CRITS!", colors::red);
} }
IF_GAME (IsTF2()) { IF_GAME (IsTF2()) {

View File

@ -12,12 +12,18 @@
class ConVar; class ConVar;
class CatCommand; class CatCommand;
class IClientEntity;
namespace hacks { namespace shared { namespace misc { namespace hacks { namespace shared { namespace misc {
void CreateMove(); void CreateMove();
void Draw(); void Draw();
extern IClientEntity* found_crit_weapon;
extern int found_crit_number;
extern int last_number;
extern CatVar crit_hack_next;
extern CatVar debug_info; extern CatVar debug_info;
extern CatVar flashlight_spam; extern CatVar flashlight_spam;
extern CatVar crit_info; // TODO separate extern CatVar crit_info; // TODO separate