Merge pull request #39 from nullifiedcat/glow-valve
crash fixing upd, melee crit broken
This commit is contained in:
commit
08bee14a2e
@ -6,5 +6,73 @@
|
||||
*/
|
||||
|
||||
#include "glowobjects.h"
|
||||
#include "common.h"
|
||||
|
||||
static CatEnum glow_color_scheme_enum({"ESP", "HEALTH"});
|
||||
static CatVar glow_color_scheme(glow_color_scheme_enum, "glow_color_scheme", "1", "Colors", "Doesn't need a description");
|
||||
// Doesn't work - has to be registered manually.
|
||||
//static CatVar glow_ammo_boxes(CV_SWITCH, "glow_ammo_boxes", "0", "Ammo");
|
||||
//static CatVar glow_health_packs(CV_SWITCH, "glow_health_packs", "0", "Health");
|
||||
static CatVar glow_teammates(CV_SWITCH, "glow_teammates", "0", "Teammates");
|
||||
static CatVar glow_teammate_buildings(CV_SWITCH, "glow_teammate_buildings", "0", "Teammate buildings");
|
||||
static CatVar glow_buildings(CV_SWITCH, "glow_buildings", "1", "Buildings");
|
||||
static CatVar glow_stickies(CV_SWITCH, "glow_stickies", "0", "Stickies");
|
||||
|
||||
int GetEntityGlowColor(int idx) {
|
||||
if (idx < 0 || idx > g_IEntityList->GetHighestEntityIndex()) return colors::white;
|
||||
CachedEntity* ent = ENTITY(idx);
|
||||
if (CE_BAD(ent)) return colors::white;
|
||||
switch (ent->m_Type) {
|
||||
case ENTITY_BUILDING:
|
||||
case ENTITY_PLAYER:
|
||||
if ((int)glow_color_scheme == 1) {
|
||||
return colors::Health(ent->m_iHealth, ent->m_iMaxHealth);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return colors::EntityF(ent);
|
||||
}
|
||||
|
||||
bool CanEntityEvenGlow(int idx) {
|
||||
IClientEntity* entity = g_IEntityList->GetClientEntity(idx);
|
||||
if (!entity) return false;
|
||||
int classid = entity->GetClientClass()->m_ClassID;
|
||||
return (classid == g_pClassID->CTFAmmoPack || classid == g_pClassID->CTFPlayer || classid == g_pClassID->CTFGrenadePipebombProjectile || classid == g_pClassID->CObjectDispenser || classid == g_pClassID->CObjectSentrygun || classid == g_pClassID->CObjectTeleporter || classid == g_pClassID->CBaseAnimating);
|
||||
}
|
||||
|
||||
bool ShouldEntityGlow(int idx) {
|
||||
CachedEntity* ent = ENTITY(idx);
|
||||
if (CE_BAD(ent)) return false;
|
||||
switch (ent->m_Type) {
|
||||
case ENTITY_BUILDING:
|
||||
if (!glow_buildings) return false;
|
||||
if (!ent->m_bEnemy && !(glow_teammate_buildings || glow_teammates)) return false;
|
||||
return true;
|
||||
case ENTITY_PLAYER:
|
||||
if (!glow_teammates && !ent->m_bEnemy) return false;
|
||||
if (CE_BYTE(ent, netvar.iLifeState) != LIFE_ALIVE) return false;
|
||||
return true;
|
||||
break;
|
||||
case ENTITY_PROJECTILE:
|
||||
if (!ent->m_bEnemy) return false;
|
||||
if (glow_stickies && ent->m_iClassID == g_pClassID->CTFGrenadePipebombProjectile) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
/*case ENTITY_GENERIC:
|
||||
switch (ent->m_ItemType) {
|
||||
case ITEM_HEALTH_LARGE:
|
||||
case ITEM_HEALTH_MEDIUM:
|
||||
case ITEM_HEALTH_SMALL:
|
||||
return glow_health_packs;
|
||||
case ITEM_AMMO_LARGE:
|
||||
case ITEM_AMMO_MEDIUM:
|
||||
case ITEM_AMMO_SMALL:
|
||||
return glow_ammo_boxes;
|
||||
}
|
||||
break;*/
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CGlowObjectManager* g_GlowObjectManager = 0;
|
||||
|
@ -36,4 +36,8 @@ public:
|
||||
|
||||
extern CGlowObjectManager* g_GlowObjectManager;
|
||||
|
||||
bool CanEntityEvenGlow(int idx);
|
||||
int GetEntityGlowColor(int idx);
|
||||
bool ShouldEntityGlow(int idx);
|
||||
|
||||
#endif /* GLOWOBJECTS_H_ */
|
||||
|
@ -18,11 +18,14 @@
|
||||
void GUIVisibleCallback(IConVar* var, const char* pOldValue, float flOldValue) {
|
||||
g_IInputSystem->SetCursorPosition(draw::width / 2, draw::height / 2);
|
||||
g_ISurface->SetCursor(vgui::CursorCode::dc_none);
|
||||
g_IMatSystemSurface->SetCursorAlwaysVisible(false);
|
||||
g_ISurface->SetCursorAlwaysVisible(false);
|
||||
//g_IMatSystemSurface->SetCursorAlwaysVisible(false);
|
||||
if (gui_visible) {
|
||||
g_IMatSystemSurface->UnlockCursor();
|
||||
g_ISurface->UnlockCursor();
|
||||
//g_IMatSystemSurface->UnlockCursor();
|
||||
} else {
|
||||
g_IMatSystemSurface->LockCursor();
|
||||
g_ISurface->LockCursor();
|
||||
//g_IMatSystemSurface->LockCursor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,6 +153,16 @@ List& MainList() {
|
||||
]
|
||||
]
|
||||
|
||||
"Glow" [
|
||||
"Glow Menu"
|
||||
"glow_enabled"
|
||||
"glow_color_scheme"
|
||||
"glow_teammates"
|
||||
"glow_teammate_buildings"
|
||||
"glow_buildings"
|
||||
"glow_stickies"
|
||||
]
|
||||
|
||||
"ESP" [
|
||||
"ESP Menu"
|
||||
"esp_enabled"
|
||||
@ -161,6 +171,7 @@ List& MainList() {
|
||||
"esp_name"
|
||||
"esp_distance"
|
||||
"esp_box"
|
||||
"esp_box_text_position"
|
||||
"3D Box" [
|
||||
"3D Box Settings"
|
||||
"esp_3d_box"
|
||||
@ -262,7 +273,6 @@ List& MainList() {
|
||||
"tauntslide"
|
||||
"anti_afk"
|
||||
"flashlight"
|
||||
"noisemaker"
|
||||
"minigun_jump"
|
||||
"no_zoom"
|
||||
"no_visuals"
|
||||
|
@ -120,11 +120,11 @@ void hack::Initialize() {
|
||||
Patch((void*)mmmf, (void*)patch1, 3);
|
||||
Patch((void*)(mmmf + 8), (void*)patch2, 3);
|
||||
}
|
||||
uintptr_t canInspectSig = (gSignatures.GetClientSignature("55 0F 57 C0 89 E5 83 EC 48 8B 45 08 F3 0F 11 04 24 F3 0F 11 45 E8 C7 44 24 10 01 00 00 00 C7 44 24 0C 00 00 00 00 89 44 24 08 C7 44 24 ? ? ? ? ? E8 ? ? ? ? F3 0F 10 45 E8 D9 5D E4 F3 0F 10 4D E4 C9 0F 2F C8 0F 95 C0 C3") + 72);
|
||||
/*uintptr_t canInspectSig = (gSignatures.GetClientSignature("55 0F 57 C0 89 E5 83 EC 48 8B 45 08 F3 0F 11 04 24 F3 0F 11 45 E8 C7 44 24 10 01 00 00 00 C7 44 24 0C 00 00 00 00 89 44 24 08 C7 44 24 ? ? ? ? ? E8 ? ? ? ? F3 0F 10 45 E8 D9 5D E4 F3 0F 10 4D E4 C9 0F 2F C8 0F 95 C0 C3") + 72);
|
||||
if (canInspectSig) {
|
||||
unsigned char patch[] = { 0xB0, 0x01, 0x90 };
|
||||
Patch((void*)canInspectSig, (void*)patch, 3);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
BeginConVars();
|
||||
hack::c_Cat = CreateConCommand(CON_NAME, &hack::CC_Cat, "Info");
|
||||
|
@ -103,11 +103,13 @@ void Draw() {
|
||||
}
|
||||
}
|
||||
|
||||
static CatEnum esp_box_text_position_enum({"TOP RIGHT", "BOTTOM RIGHT", "CENTER", "ABOVE", "BELOW" });
|
||||
static CatVar esp_box_text_position(esp_box_text_position_enum, "esp_box_text_position", "0", "Text position", "Defines text position");
|
||||
static CatVar esp_3d_box_health(CV_SWITCH, "esp_3d_box_health", "1", "3D box health color");
|
||||
static CatVar esp_3d_box_thick(CV_SWITCH, "esp_3d_box_thick", "1", "Thick 3D box");
|
||||
static CatVar esp_3d_box_expand(CV_SWITCH, "esp_3d_box_expand", "1", "Expand 3D box");
|
||||
static CatEnum esp_3d_box_smoothing_enum({"None", "Origin offset", "Bone update (NOT IMPL)"});
|
||||
static CatVar esp_3d_box_smoothing(esp_3d_box_smoothing_enum, "esp_3d_box_smoothing", "0", "3D box smoothing", "3D box smoothing method");
|
||||
static CatVar esp_3d_box_smoothing(esp_3d_box_smoothing_enum, "esp_3d_box_smoothing", "1", "3D box smoothing", "3D box smoothing method");
|
||||
|
||||
void Draw3DBox(CachedEntity* ent, int clr, bool healthbar, int health, int healthmax) {
|
||||
Vector mins, maxs;
|
||||
@ -154,7 +156,31 @@ void Draw3DBox(CachedEntity* ent, int clr, bool healthbar, int health, int healt
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (!draw::WorldToScreen(points_r[i], points[i])) success = false;
|
||||
}
|
||||
int max_x = -1, max_y = -1, min_x = 65536, min_y = 65536;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (points[i].x > max_x) max_x = points[i].x;
|
||||
if (points[i].y > max_y) max_y = points[i].y;
|
||||
if (points[i].x < min_x) min_x = points[i].x;
|
||||
if (points[i].y < min_y) min_y = points[i].y;
|
||||
}
|
||||
if (!success) return;
|
||||
data.at(ent->m_IDX).esp_origin.Zero();
|
||||
switch ((int)esp_box_text_position) {
|
||||
case 0: { // TOP RIGHT
|
||||
data.at(ent->m_IDX).esp_origin = Vector(max_x + 1, min_y, 0);
|
||||
} break;
|
||||
case 1: { // BOTTOM RIGHT
|
||||
data.at(ent->m_IDX).esp_origin = Vector(max_x + 1, max_y - data.at(ent->m_IDX).string_count * 13, 0);
|
||||
} break;
|
||||
case 2: { // CENTER
|
||||
} break;
|
||||
case 3: { // ABOVE
|
||||
data.at(ent->m_IDX).esp_origin = Vector(min_x, min_y - data.at(ent->m_IDX).string_count * 13, 0);
|
||||
} break;
|
||||
case 4: { // BELOW
|
||||
data.at(ent->m_IDX).esp_origin = Vector(min_x, max_y, 0);
|
||||
}
|
||||
}
|
||||
//draw::String(fonts::ESP, points[0].x, points[0].y, clr, 1, "MIN");
|
||||
//draw::String(fonts::ESP, points[6].x, points[6].y, clr, 1, "MAX");
|
||||
constexpr int indices[][2] = {
|
||||
@ -204,8 +230,28 @@ void DrawBox(CachedEntity* ent, int clr, float widthFactor, float addHeight, boo
|
||||
//draw::DrawString(min(smin.x, smax.x), min(smin.y, smax.y), clr, false, "min");
|
||||
//draw::DrawString(max(smin.x, smax.x), max(smin.y, smax.y), clr, false, "max");
|
||||
//draw::DrawString((int)so.x, (int)so.y, draw::white, false, "origin");
|
||||
data[ent->m_IDX].esp_origin.x = so.x + width / 2 + 1;
|
||||
data[ent->m_IDX].esp_origin.y = so.y - height;
|
||||
int min_x, min_y, max_x, max_y;
|
||||
data.at(ent->m_IDX).esp_origin.Zero();
|
||||
max_x = so.x + width / 2 + 1;
|
||||
min_y = so.y - height;
|
||||
max_y = so.y;
|
||||
min_x = so.x - width / 2;
|
||||
switch ((int)esp_box_text_position) {
|
||||
case 0: { // TOP RIGHT
|
||||
data.at(ent->m_IDX).esp_origin = Vector(max_x, min_y, 0);
|
||||
} break;
|
||||
case 1: { // BOTTOM RIGHT
|
||||
data.at(ent->m_IDX).esp_origin = Vector(max_x, max_y - data.at(ent->m_IDX).string_count * 13, 0);
|
||||
} break;
|
||||
case 2: { // CENTER
|
||||
} break;
|
||||
case 3: { // ABOVE
|
||||
data.at(ent->m_IDX).esp_origin = Vector(min_x, min_y - data.at(ent->m_IDX).string_count * 13, 0);
|
||||
} break;
|
||||
case 4: { // BELOW
|
||||
data.at(ent->m_IDX).esp_origin = Vector(min_x, max_y, 0);
|
||||
}
|
||||
}
|
||||
unsigned char alpha = clr >> 24;
|
||||
float trf = (float)((float)alpha / 255.0f);
|
||||
int border = cloak ? colors::Create(160, 160, 160, alpha) : colors::Transparent(colors::black, trf);
|
||||
|
@ -96,6 +96,8 @@ void Shutdown_hook(void* thisptr, const char* reason) {
|
||||
SEGV_END;
|
||||
}
|
||||
|
||||
static CatVar glow_enabled(CV_SWITCH, "glow_enabled", "0", "Enable", "Make sure to enable glow_outline_effect_enable in tf2 settings");
|
||||
|
||||
void FrameStageNotify_hook(void* thisptr, int stage) {
|
||||
SEGV_BEGIN;
|
||||
//logging::Info("FrameStageNotify %i", stage);
|
||||
@ -105,6 +107,36 @@ void FrameStageNotify_hook(void* thisptr, int stage) {
|
||||
SVDBG("FSN %i", __LINE__);
|
||||
// TODO hack FSN hook
|
||||
if (TF && cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) {
|
||||
if (glow_enabled) {
|
||||
for (int i = 0; i < g_GlowObjectManager->m_GlowObjectDefinitions.m_Size; i++) {
|
||||
GlowObjectDefinition_t& glowobject = g_GlowObjectManager->m_GlowObjectDefinitions[i];
|
||||
if (glowobject.m_nNextFreeSlot != ENTRY_IN_USE)
|
||||
continue;
|
||||
int color = GetEntityGlowColor(glowobject.m_hEntity.m_Index & 0xFFF);
|
||||
unsigned char _b = (color >> 16) & 0xFF;
|
||||
unsigned char _g = (color >> 8) & 0xFF;
|
||||
unsigned char _r = (color) & 0xFF;
|
||||
glowobject.m_vGlowColor = Vector((float)_r / 255.0f, (float)_g / 255.0f, (float)_b / 255.0f);
|
||||
}
|
||||
}
|
||||
for (int i = 1; i < g_IEntityList->GetHighestEntityIndex(); i++) {
|
||||
IClientEntity* entity = g_IEntityList->GetClientEntity(i);
|
||||
if (!entity || i == g_IEngine->GetLocalPlayer() || entity->IsDormant())
|
||||
continue;
|
||||
|
||||
int clazz = entity->GetClientClass()->m_ClassID;
|
||||
bool old_byte = NET_BYTE(entity, 0xDA1);
|
||||
bool new_byte = (glow_enabled && !entity->IsDormant() && ShouldEntityGlow(i));
|
||||
if (CanEntityEvenGlow(i)) NET_BYTE(entity, 0xDA1) = new_byte;
|
||||
if (old_byte != new_byte && clazz == g_pClassID->CTFPlayer) {
|
||||
if (new_byte) {
|
||||
vfunc<void(*)(IClientEntity*)>(entity, 290, 0)(entity);
|
||||
} else {
|
||||
vfunc<void(*)(IClientEntity*)>(entity, 291, 0)(entity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
SVDBG("FSN %i", __LINE__);
|
||||
if (force_thirdperson && !g_pLocalPlayer->life_state && CE_GOOD(g_pLocalPlayer->entity)) {
|
||||
SVDBG("FSN %i", __LINE__);
|
||||
|
@ -90,10 +90,10 @@ void CreateInterfaces() {
|
||||
if (TF2) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 B4 00 00 00 A1 ? ? ? ? 8B 10")));
|
||||
else if (TF2C) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? C6 05 ? ? ? ? 01 8B 10 89 04 24 FF 92 A8 00 00 00 A1 ? ? ? ? 8B 10")));
|
||||
else if (HL2DM) g_IInput = **(reinterpret_cast<IInput***>((uintptr_t)1 + gSignatures.GetClientSignature("A1 ? ? ? ? 8B 10 89 04 24 FF 52 78 A1 ? ? ? ? 8B 10")));
|
||||
if (TF2 || HL2DM)
|
||||
g_IMatSystemSurface = **reinterpret_cast<IMatSystemSurface***>((uintptr_t)19 + gSignatures.GetClientSignature("FF 92 94 02 00 00 8B 8D C4 FE FF FF 89 85 B0 FE FF FF A1 ? ? ? ? 8B 10 89 4C 24 0C"));
|
||||
else if (TF2C)
|
||||
g_IMatSystemSurface = **reinterpret_cast<IMatSystemSurface***>((uintptr_t)53 + gSignatures.GetClientSignature("C7 44 24 1C FF 00 00 00 C7 44 24 18 FF 00 00 00 C7 44 24 14 FF 00 00 00 C7 44 24 10 00 00 00 00 89 74 24 08 8B 83 D0 E1 00 00 89 95 A4 FE FF FF 89 44 24 04 A1 ? ? ? ? 89 04 24 FF 91 88 02 00 00 8B 95 A4 FE FF FF A1 ? ? ? ? 29 FA 8B 08 89 54 24 0C"));
|
||||
//if (TF2 || HL2DM)
|
||||
//g_IMatSystemSurface = **reinterpret_cast<IMatSystemSurface***>((uintptr_t)19 + gSignatures.GetClientSignature("FF 92 94 02 00 00 8B 8D C4 FE FF FF 89 85 B0 FE FF FF A1 ? ? ? ? 8B 10 89 4C 24 0C"));
|
||||
//else if (TF2C)
|
||||
//g_IMatSystemSurface = **reinterpret_cast<IMatSystemSurface***>((uintptr_t)53 + gSignatures.GetClientSignature("C7 44 24 1C FF 00 00 00 C7 44 24 18 FF 00 00 00 C7 44 24 14 FF 00 00 00 C7 44 24 10 00 00 00 00 89 74 24 08 8B 83 D0 E1 00 00 89 95 A4 FE FF FF 89 44 24 04 A1 ? ? ? ? 89 04 24 FF 91 88 02 00 00 8B 95 A4 FE FF FF A1 ? ? ? ? 29 FA 8B 08 89 54 24 0C"));
|
||||
g_ISteamUser = g_ISteamClient->GetISteamUser(su, sp, "SteamUser018");
|
||||
g_IAchievementMgr = g_IEngine->GetAchievementMgr();
|
||||
g_ISteamUserStats = g_ISteamClient->GetISteamUserStats(su, sp, "STEAMUSERSTATS_INTERFACE_VERSION011");
|
||||
|
Reference in New Issue
Block a user