working no hats, no arms, chams
This commit is contained in:
parent
84341c6291
commit
afb0e977bd
@ -51,6 +51,7 @@
|
||||
#include "textfile.h"
|
||||
#include "ipc.h"
|
||||
#include "gui/GUI.h"
|
||||
#include "hooks/hookedmethods.h"
|
||||
#include "classid.h"
|
||||
#include "crits.h"
|
||||
|
||||
|
18
src/hack.cpp
18
src/hack.cpp
@ -171,10 +171,10 @@ void hack::Initialize() {
|
||||
hooks::hkInput->Init((void*)g_IInput, 0);
|
||||
hooks::hkInput->HookMethod((void*)GetUserCmd_hook, hooks::offGetUserCmd);
|
||||
hooks::hkInput->Apply();
|
||||
//hooks::hkIVModelRender = new hooks::VMTHook();
|
||||
//hooks::hkIVModelRender->Init(g_IVModelRender, 0);
|
||||
//hooks::hkIVModelRender->HookMethod((void*)DrawModelExecute_hook, hooks::offDrawModelExecute);
|
||||
//hooks::hkIVModelRender->Apply();
|
||||
hooks::hkIVModelRender = new hooks::VMTHook();
|
||||
hooks::hkIVModelRender->Init(g_IVModelRender, 0);
|
||||
hooks::hkIVModelRender->HookMethod((void*)DrawModelExecute_hook, hooks::offDrawModelExecute);
|
||||
hooks::hkIVModelRender->Apply();
|
||||
if (TF2) g_GlowObjectManager = *reinterpret_cast<CGlowObjectManager**>(gSignatures.GetClientSignature("C1 E0 05 03 05") + 5);
|
||||
InitStrings();
|
||||
hacks::shared::killsay::Init();
|
||||
@ -183,11 +183,11 @@ void hack::Initialize() {
|
||||
hack::command_stack().push("cat_spam_reload");
|
||||
logging::Info("Hooked!");
|
||||
playerlist::Load();
|
||||
g_pEffectGlow = new CScreenSpaceEffectRegistration("_cathook_glow", &g_EffectGlow);
|
||||
for (CScreenSpaceEffectRegistration* reg = *g_ppScreenSpaceRegistrationHead; reg; reg = reg->m_pNext) {
|
||||
logging::Info("%s", reg->m_pEffectName);
|
||||
}
|
||||
g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_glow");
|
||||
//g_pEffectGlow = new CScreenSpaceEffectRegistration("_cathook_glow", &g_EffectGlow);
|
||||
//for (CScreenSpaceEffectRegistration* reg = *g_ppScreenSpaceRegistrationHead; reg; reg = reg->m_pNext) {
|
||||
// logging::Info("%s", reg->m_pEffectName);
|
||||
//}
|
||||
//g_pScreenSpaceEffects->EnableScreenSpaceEffect("_cathook_glow");
|
||||
//g_EffectGlow.Init();
|
||||
logging::Info("SSE enabled..");
|
||||
}
|
||||
|
103
src/hacks/Chams.cpp
Normal file
103
src/hacks/Chams.cpp
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Chams.cpp
|
||||
*
|
||||
* Created on: Apr 15, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#include "../common.h"
|
||||
|
||||
namespace hacks { namespace shared { namespace chams {
|
||||
|
||||
static CatVar enable(CV_SWITCH, "chams_enable", "0", "Enable");
|
||||
|
||||
static bool init = false;
|
||||
|
||||
CMaterialReference mat_unlit;
|
||||
CMaterialReference mat_unlit_z;
|
||||
CMaterialReference mat_lit;
|
||||
CMaterialReference mat_lit_z;
|
||||
|
||||
void Init() {
|
||||
if (!materials) materials = g_IMaterialSystem;
|
||||
{
|
||||
KeyValues* kv = new KeyValues("UnlitGeneric");
|
||||
kv->SetString("$basetexture", "vgui/white_additive");
|
||||
kv->SetInt("$ignorez", 0);
|
||||
mat_unlit.Init("__cathook_chams_unlit", kv);
|
||||
}
|
||||
{
|
||||
KeyValues* kv = new KeyValues("UnlitGeneric");
|
||||
kv->SetString("$basetexture", "vgui/white_additive");
|
||||
kv->SetInt("$ignorez", 1);
|
||||
mat_unlit_z.Init("__cathook_chams_unlit_z", kv);
|
||||
}
|
||||
{
|
||||
KeyValues* kv = new KeyValues("VertexLitGeneric");
|
||||
kv->SetString("$basetexture", "vgui/white_additive");
|
||||
kv->SetInt("$ignorez", 0);
|
||||
kv->SetInt("$halflambert", 1);
|
||||
mat_lit.Init("__cathook_chams_lit", kv);
|
||||
}
|
||||
{
|
||||
KeyValues* kv = new KeyValues("VertexLitGeneric");
|
||||
kv->SetString("$basetexture", "vgui/white_additive");
|
||||
kv->SetInt("$ignorez", 1);
|
||||
kv->SetInt("$halflambert", 1);
|
||||
mat_lit_z.Init("__cathook_chams_lit_z", kv);
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
void DrawModelExecute(IVModelRender* _this, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix) {
|
||||
if (!enable) return;
|
||||
if (!init) {
|
||||
Init();
|
||||
}
|
||||
//std::string name(g_IModelInfo->GetModelName(info.pModel));
|
||||
IClientUnknown* unknown = info.pRenderable->GetIClientUnknown();
|
||||
if (unknown) {
|
||||
IClientEntity* entity = unknown->GetIClientEntity();
|
||||
//logging::Info("entity: 0x%08x", entity);
|
||||
if (entity && !entity->IsDormant()) {
|
||||
//logging::Info("lit player");
|
||||
// IsBaseCombatWeapon
|
||||
if (vfunc<bool(*)(IClientEntity*)>(entity, 0xBE, 0)(entity)) {
|
||||
IClientEntity* owner = vfunc<IClientEntity*(*)(IClientEntity*)>(entity, 0x1C3, 0)(entity);
|
||||
if (owner) {
|
||||
int color = colors::EntityF(ENTITY(owner->entindex()));
|
||||
unsigned char _b = (color >> 16) & 0xFF;
|
||||
unsigned char _g = (color >> 8) & 0xFF;
|
||||
unsigned char _r = (color) & 0xFF;
|
||||
float color_1[] = { (float)_r / 255.0f, (float)_g / 255.0f, (float)_b / 255.0f };
|
||||
float color_2[] = { color_1[0] * 0.6f, color_1[1] * 0.6f, color_1[2] * 0.6f };
|
||||
mat_unlit_z->AlphaModulate(1.0f);
|
||||
g_IVRenderView->SetColorModulation(color_1);
|
||||
g_IVModelRender->ForcedMaterialOverride(mat_lit_z);
|
||||
((DrawModelExecute_t)(hooks::hkIVModelRender->GetMethod(hooks::offDrawModelExecute)))(_this, state, info, matrix);
|
||||
mat_unlit->AlphaModulate(1.0f);
|
||||
g_IVRenderView->SetColorModulation(color_2);
|
||||
g_IVModelRender->ForcedMaterialOverride(mat_lit);
|
||||
}
|
||||
} else if (entity->GetClientClass()->m_ClassID == g_pClassID->C_Player) {
|
||||
int color = colors::EntityF(ENTITY(entity->entindex()));
|
||||
unsigned char _b = (color >> 16) & 0xFF;
|
||||
unsigned char _g = (color >> 8) & 0xFF;
|
||||
unsigned char _r = (color) & 0xFF;
|
||||
float color_1[] = { (float)_r / 255.0f, (float)_g / 255.0f, (float)_b / 255.0f };
|
||||
float color_2[] = { color_1[0] * 0.6f, color_1[1] * 0.6f, color_1[2] * 0.6f };
|
||||
mat_unlit_z->AlphaModulate(1.0f);
|
||||
g_IVRenderView->SetColorModulation(color_1);
|
||||
g_IVModelRender->ForcedMaterialOverride(mat_lit_z);
|
||||
((DrawModelExecute_t)(hooks::hkIVModelRender->GetMethod(hooks::offDrawModelExecute)))(_this, state, info, matrix);
|
||||
mat_unlit->AlphaModulate(1.0f);
|
||||
g_IVRenderView->SetColorModulation(color_2);
|
||||
g_IVModelRender->ForcedMaterialOverride(mat_lit);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}}}
|
17
src/hacks/Chams.hpp
Normal file
17
src/hacks/Chams.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Chams.hpp
|
||||
*
|
||||
* Created on: Apr 15, 2017
|
||||
* Author: nullifiedcat
|
||||
*/
|
||||
|
||||
#ifndef HACKS_CHAMS_HPP_
|
||||
#define HACKS_CHAMS_HPP_
|
||||
|
||||
namespace hacks { namespace shared { namespace chams {
|
||||
|
||||
void DrawModelExecute(IVModelRender* _this, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix);
|
||||
|
||||
}}}
|
||||
|
||||
#endif /* HACKS_CHAMS_HPP_ */
|
@ -23,6 +23,7 @@
|
||||
#include "Misc.h"
|
||||
#include "SpyAlert.h"
|
||||
#include "Trigger.h"
|
||||
#include "Chams.hpp"
|
||||
#include "KillSay.h"
|
||||
#include "Achievement.h"
|
||||
#include "Spam.h"
|
||||
|
@ -10,8 +10,24 @@
|
||||
#include "../hack.h"
|
||||
#include "hookedmethods.h"
|
||||
|
||||
static CatVar no_invisibility(CV_SWITCH, "no_invis", "0", "Remove Invisibility", "Useful with chams!");
|
||||
|
||||
int C_TFPlayer__DrawModel_hook(IClientEntity* _this, int flags) {
|
||||
float old_invis = *(float*)((uintptr_t)_this + 79u);
|
||||
if (no_invisibility) {
|
||||
if (old_invis < 1.0f) {
|
||||
*(float*)((uintptr_t)_this + 79u) = 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
*(float*)((uintptr_t)_this + 79u) = old_invis;
|
||||
}
|
||||
|
||||
static CatVar no_arms(CV_SWITCH, "no_arms", "0", "No Arms");
|
||||
static CatVar no_hats(CV_SWITCH, "no_hats", "0", "No Hats");
|
||||
|
||||
void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state, const ModelRenderInfo_t& info, matrix3x4_t* matrix) {
|
||||
IClientUnknown* unknown = info.pRenderable->GetIClientUnknown();
|
||||
/*IClientUnknown* unknown = info.pRenderable->GetIClientUnknown();
|
||||
if (unknown) {
|
||||
IClientEntity* entity = unknown->GetIClientEntity();
|
||||
if (entity && entity->entindex() != -1) {
|
||||
@ -19,8 +35,27 @@ void DrawModelExecute_hook(IVModelRender* _this, const DrawModelState_t& state,
|
||||
//CMatRenderContextPtr ptr();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (no_arms || no_hats) {
|
||||
if (info.pModel) {
|
||||
const char* name = g_IModelInfo->GetModelName(info.pModel);
|
||||
if (name) {
|
||||
std::string sname(name);
|
||||
if (no_arms && sname.find("arms") != std::string::npos) {
|
||||
return;
|
||||
} else if (no_hats && sname.find("player/items") != std::string::npos) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float mod_old[3] { 0.0f };
|
||||
g_IVRenderView->GetColorModulation(mod_old);
|
||||
hacks::shared::chams::DrawModelExecute(_this, state, info, matrix);
|
||||
((DrawModelExecute_t)(hooks::hkIVModelRender->GetMethod(hooks::offDrawModelExecute)))(_this, state, info, matrix);
|
||||
g_IVModelRender->ForcedMaterialOverride(nullptr);
|
||||
g_IVRenderView->SetColorModulation(mod_old);
|
||||
}
|
||||
|
||||
bool CanPacket_hook(void* thisptr) {
|
||||
|
Reference in New Issue
Block a user