Lightesp converted (test)

This commit is contained in:
TotallyNotElite 2018-09-08 20:14:49 +02:00
parent 10b735c88c
commit 4ff18a0d5d
6 changed files with 16 additions and 21 deletions

View File

@ -97,7 +97,7 @@
#include "init.hpp" #include "init.hpp"
#include "reclasses/reclasses.hpp" #include "reclasses/reclasses.hpp"
#include <CNavFile.h> #include <CNavFile.h>
#include <astar.h> #include "HookTools.hpp"
#include "copypasted/Netvar.h" #include "copypasted/Netvar.h"
#include "copypasted/CSignature.h" #include "copypasted/CSignature.h"

View File

@ -3,7 +3,6 @@
namespace hacks::shared::lightesp namespace hacks::shared::lightesp
{ {
#if ENABLE_VISUALS #if ENABLE_VISUALS
void run();
void draw(); void draw();
rgba_t LightESPColor(CachedEntity *ent); rgba_t LightESPColor(CachedEntity *ent);
#endif #endif

View File

@ -4,11 +4,12 @@
#include <init.hpp> #include <init.hpp>
#include "core/logging.hpp" #include "core/logging.hpp"
namespace HookTools { namespace HookTools
void CreateMove(); {
void CreateMove();
} }
struct CreateMove struct CreateMove
{ {
CreateMove(int priority = 5, std::function<void()> func = [](){}); CreateMove(int priority = 5, std::function<void()> func = []() {});
}; };

View File

@ -14,9 +14,9 @@ Vector minp[32];
Vector maxp[32]; Vector maxp[32];
bool drawEsp[32]; bool drawEsp[32];
void run()
{
#if ENABLE_VISUALS #if ENABLE_VISUALS
static CreateMove run(5, []() {
PROF_SECTION(CM_lightesp);
if (!enable) if (!enable)
return; return;
for (int i = 1; i < g_IEngine->GetMaxClients(); i++) for (int i = 1; i < g_IEngine->GetMaxClients(); i++)
@ -42,8 +42,9 @@ void run()
maxp[i] = pEntity->hitboxes.GetHitbox(0)->max; maxp[i] = pEntity->hitboxes.GetHitbox(0)->max;
drawEsp[i] = true; drawEsp[i] = true;
} }
});
#endif #endif
}
void draw() void draw()
{ {
#if ENABLE_VISUALS #if ENABLE_VISUALS

View File

@ -286,10 +286,6 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time,
PROF_SECTION(CM_esp); PROF_SECTION(CM_esp);
hacks::shared::esp::CreateMove(); hacks::shared::esp::CreateMove();
} }
{
PROF_SECTION(CM_lightesp);
hacks::shared::lightesp::run();
}
#endif #endif
#endif #endif
if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon())) if (!g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->weapon()))

View File

@ -23,13 +23,11 @@ void HookTools::CreateMove()
} }
static InitRoutine init([]() { static InitRoutine init([]() {
auto &CreateMoves = GetCreateMoves(); auto &CreateMoves = GetCreateMoves();
std::sort(CreateMoves.begin(), std::sort(CreateMoves.begin(), CreateMoves.end(),
CreateMoves.end(), [](std::pair<int, std::function<void()>> a,
[](std::pair<int, std::function<void()>> a, std::pair<int, std::function<void()>> b) {
std::pair<int, std::function<void()>> b) { return a.first > b.first;
return a.first > b.first; });
}); logging::Info("Sorted CreateMove functions: %i", CreateMoves.size());
logging::Info("Sorted CreateMove functions: %i",
CreateMoves.size());
}); });