minor optimization stuff
This commit is contained in:
parent
5c016174ae
commit
005415d2c1
@ -53,7 +53,7 @@
|
||||
#ifndef CATHOOK_BUILD_NUMBER
|
||||
#define CATHOOK_BUILD_NUMBER "LATEST"
|
||||
#endif
|
||||
#define CATHOOK_BUILD_NAME "Butterscotch Pie"
|
||||
#define CATHOOK_BUILD_NAME "Cat's Eye"
|
||||
|
||||
#define CON_NAME "cat"
|
||||
#define CON_PREFIX CON_NAME "_"
|
||||
|
@ -9,9 +9,13 @@
|
||||
#define CRITS_H_
|
||||
|
||||
class CUserCmd;
|
||||
class IClientEntity;
|
||||
|
||||
bool RandomCrits();
|
||||
bool WeaponCanCrit();
|
||||
bool IsAttackACrit(CUserCmd* cmd);
|
||||
|
||||
//bool CalcIsAttackCritical(IClientEntity* weapon);
|
||||
|
||||
|
||||
#endif /* CRITS_H_ */
|
||||
|
@ -45,7 +45,6 @@ void CachedEntity::Update(int idx) {
|
||||
|
||||
m_ESPOrigin.Zero();
|
||||
|
||||
m_nESPStrings = 0;
|
||||
m_IDX = idx;
|
||||
m_pEntity = interfaces::entityList->GetClientEntity(idx);
|
||||
if (!m_pEntity) {
|
||||
@ -228,6 +227,14 @@ EntityCache::~EntityCache() {
|
||||
delete [] m_pArray;
|
||||
}
|
||||
|
||||
void CachedEntity::PruneStrings() {
|
||||
m_nESPStrings = 0;
|
||||
}
|
||||
|
||||
void EntityCache::PruneStrings() {
|
||||
for (int i = 0; i < m_nMax && i < MAX_ENTITIES; i++) m_pArray[i].PruneStrings();
|
||||
}
|
||||
|
||||
void EntityCache::Update() {
|
||||
m_nMax = interfaces::entityList->GetHighestEntityIndex();
|
||||
for (int i = 0; i < m_nMax && i < MAX_ENTITIES; i++) {
|
||||
|
@ -34,7 +34,7 @@ struct mstudiobbox_t;
|
||||
#define CE_VECTOR(entity, offset) CE_VAR(entity, offset, Vector)
|
||||
|
||||
#define CE_GOOD_NO_DORMANT_CHECK(entity) (!g_Settings.bInvalid && dynamic_cast<CachedEntity*>(entity) && dynamic_cast<IClientEntity*>(entity->m_pEntity))
|
||||
#define CE_GOOD(entity) (!g_Settings.bInvalid && dynamic_cast<CachedEntity*>(entity) && dynamic_cast<IClientEntity*>(entity->m_pEntity) && !entity->m_pEntity->IsDormant())
|
||||
#define CE_GOOD(entity) (!g_Settings.bInvalid && dynamic_cast<CachedEntity*>(entity) && dynamic_cast<IClientEntity*>(entity->m_pEntity) && entity->m_pEntity->GetIClientEntity() && !entity->m_pEntity->GetIClientEntity()->IsDormant())
|
||||
#define CE_BAD(entity) (!CE_GOOD(entity))
|
||||
|
||||
#define IDX_GOOD(idx) (idx >= 0 && idx < HIGHEST_ENTITY && idx < MAX_ENTITIES)
|
||||
@ -107,6 +107,7 @@ public:
|
||||
~CachedEntity();
|
||||
|
||||
void Update(int idx);
|
||||
void PruneStrings();
|
||||
void AddESPString(const char* string, ...);
|
||||
ESPStringCompound& GetESPString(int idx);
|
||||
|
||||
@ -166,6 +167,7 @@ public:
|
||||
~EntityCache();
|
||||
|
||||
void Update();
|
||||
void PruneStrings();
|
||||
void Invalidate();
|
||||
CachedEntity* GetEntity(int idx);
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
g_ph##x = new x()
|
||||
|
||||
#define HACK_PROCESS_USERCMD(x, y) \
|
||||
g_ph##x->ProcessUserCmd(y)
|
||||
{ PROF_SECTION(x); g_ph##x->ProcessUserCmd(y); }
|
||||
|
||||
#define HACK_DRAW(x) \
|
||||
g_ph##x->Draw()
|
||||
|
@ -42,7 +42,7 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
}
|
||||
bool ret = ((CreateMove_t*)hooks::hkClientMode->GetMethod(hooks::offCreateMove))(thisptr, inputSample, cmd);
|
||||
|
||||
//PROF_SECTION(CreateMove);
|
||||
PROF_SECTION(CreateMove);
|
||||
|
||||
if (!cmd) {
|
||||
return ret;
|
||||
@ -82,11 +82,13 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
|
||||
gEntityCache.Invalidate();
|
||||
}
|
||||
// PROF_BEGIN();
|
||||
SAFE_CALL(gEntityCache.Update());
|
||||
{ PROF_SECTION(EntityCache); SAFE_CALL(gEntityCache.Update()); }
|
||||
// PROF_END("Entity Cache updating");
|
||||
SAFE_CALL(g_pPlayerResource->Update());
|
||||
SAFE_CALL(g_pLocalPlayer->Update());
|
||||
g_Settings.bInvalid = false;
|
||||
if (!cmd->command_number) return ret;
|
||||
gEntityCache.PruneStrings();
|
||||
if (CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
|
||||
// PROF_BEGIN();
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "hookedmethods.h"
|
||||
#include "../gui/GUI.h"
|
||||
#include "../segvcatch/segvcatch.h"
|
||||
#include "../profiler.h"
|
||||
|
||||
void PaintTraverse_hook(void* p, unsigned int vp, bool fr, bool ar) {
|
||||
#if DEBUG_SEGV == true
|
||||
@ -33,6 +34,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));
|
||||
PROF_SECTION(PaintTraverse);
|
||||
if (vp == panel_top) draw_flag = true;
|
||||
if (!g_Settings.bHackEnabled->GetBool()) return;
|
||||
// Because of single-multi thread shit I'm gonna put this thing riiiight here.
|
||||
|
@ -28,6 +28,8 @@ typedef void(LevelInit_t)(void*, const char*);
|
||||
typedef void(LevelShutdown_t)(void*);
|
||||
typedef void(BeginFrame_t)(IStudioRender*);
|
||||
typedef bool(*CanInspect_t)(IClientEntity*);
|
||||
//typedef void(*CInput__CreateMove_t)(void*, int, float, bool);
|
||||
//void CInput__CreateMove_hook(void*, int sequence_number, float input_sample_frametime, bool active);
|
||||
bool CanInspect_hook(IClientEntity*);
|
||||
const unsigned int offCanInspect = 512;
|
||||
void BeginFrame_hook(IStudioRender*);
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
ProfilerSection& m_section;
|
||||
};
|
||||
|
||||
#define ENABLE_PROFILER true
|
||||
#define ENABLE_PROFILER false
|
||||
#if ENABLE_PROFILER
|
||||
#define PROF_SECTION(id) \
|
||||
static ProfilerSection __PROFILER__##id(#id); \
|
||||
|
Reference in New Issue
Block a user