From 88034f0cdf168a6bb589964e6c1a852e86e0b3f1 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sun, 15 Jan 2017 11:37:59 +0300 Subject: [PATCH] NoZoom, FOV tweaks --- cathook/.cproject | 1 + cathook/src/drm.h | 2 ++ cathook/src/globals.cpp | 4 +++- cathook/src/globals.h | 4 +++- cathook/src/hooks/others.cpp | 20 ++++++++++++++------ 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/cathook/.cproject b/cathook/.cproject index 07aa71b4..11db6200 100644 --- a/cathook/.cproject +++ b/cathook/.cproject @@ -49,6 +49,7 @@ diff --git a/cathook/src/drm.h b/cathook/src/drm.h index e02cf532..d0dd6524 100644 --- a/cathook/src/drm.h +++ b/cathook/src/drm.h @@ -12,7 +12,9 @@ #include +#ifndef __DRM_ENABLED #define __DRM_ENABLED true +#endif #define __DRM_NOTES "Unstable build, for testing only!" #define __QUIT_SEGV (*((int*)0) = 0) diff --git a/cathook/src/globals.cpp b/cathook/src/globals.cpp index f11ae0ea..2fc98149 100644 --- a/cathook/src/globals.cpp +++ b/cathook/src/globals.cpp @@ -23,7 +23,9 @@ void GlobalSettings::Init() { this->bIgnoreTaunting = CREATE_CV(CV_SWITCH, "ignore_taunting", "1", "Ignore taunting players"); this->flForceFOV = CREATE_CV(CV_FLOAT, "fov", "0", "FOV"); // this->bProfiler = CREATE_CV(CV_SWITCH, "profiler", "0", "Profiler"); -// this->bNoZoom = CREATE_CV(CV_SWITCH, "nozoom", "0", "No Zoom"); + this->bNoZoom = CREATE_CV(CV_SWITCH, "nozoom", "0", "No Zoom"); + this->flForceFOVZoomed = CREATE_CV(CV_FLOAT, "fov_zoomed", "0", "FOV when zoomed"); + this->bZoomedFOV = CREATE_CV(CV_SWITCH, "zoom_keep_fov", "1", "When zoomed, use " CON_PREFIX "fov_zoomed"); // this->bNoFlinch = CREATE_CV(CV_SWITCH, "noflinch", "0", "No Flinch (broken)"); this->bSendPackets = CREATE_CV(CV_SWITCH, "sendpackets", "1", "Send packets"); this->bShowLogo = CREATE_CV(CV_SWITCH, "logo", "1", "Show logo"); diff --git a/cathook/src/globals.h b/cathook/src/globals.h index 392b6ee4..908b01a7 100644 --- a/cathook/src/globals.h +++ b/cathook/src/globals.h @@ -19,10 +19,12 @@ public: // TODO // CatVar* bMaxPerformance; CatVar* flForceFOV; + CatVar* flForceFOVZoomed; + CatVar* bZoomedFOV; CatVar* bHackEnabled; CatVar* bIgnoreTaunting; // CatVar* bProfiler; -// CatVar* bNoZoom; + CatVar* bNoZoom; // CatVar* bNoFlinch; CatVar* bSendPackets; CatVar* bShowLogo; diff --git a/cathook/src/hooks/others.cpp b/cathook/src/hooks/others.cpp index 88dd4b22..84661d67 100644 --- a/cathook/src/hooks/others.cpp +++ b/cathook/src/hooks/others.cpp @@ -85,8 +85,8 @@ void FrameStageNotify_hook(void* thisptr, int stage) { } } ((FrameStageNotify_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify))(thisptr, stage); - /*if (g_Settings.bHackEnabled->GetBool() && !g_Settings.bInvalid) { - if (stage == 5 && g_Settings.bNoFlinch->GetBool()) { + if (g_Settings.bHackEnabled->GetBool() && !g_Settings.bInvalid) { + /*if (stage == 5 && g_Settings.bNoFlinch->GetBool()) { static Vector oldPunchAngles = Vector(); Vector punchAngles = CE_VECTOR(g_pLocalPlayer->entity, netvar.vecPunchAngle); QAngle viewAngles; @@ -94,15 +94,14 @@ void FrameStageNotify_hook(void* thisptr, int stage) { viewAngles -= VectorToQAngle(punchAngles - oldPunchAngles); oldPunchAngles = punchAngles; interfaces::engineClient->SetViewAngles(viewAngles); - } + }*/ if (g_Settings.bNoZoom->GetBool()) { if (CE_GOOD(g_pLocalPlayer->entity)) { - //g_pLocalPlayer->bWasZoomed = NET_INT(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed; CE_INT(g_pLocalPlayer->entity, netvar.iCond) = CE_INT(g_pLocalPlayer->entity, netvar.iCond) &~ cond::zoomed; } } - }*/ + } //logging::Info("fsi end");// TODO dbg SEGV_END; } @@ -111,8 +110,17 @@ void OverrideView_hook(void* thisptr, CViewSetup* setup) { SEGV_BEGIN; ((OverrideView_t*)hooks::hkClientMode->GetMethod(hooks::offOverrideView))(thisptr, setup); if (!g_Settings.bHackEnabled->GetBool()) return; - if (g_Settings.flForceFOV && g_Settings.flForceFOV->GetBool()) { + if (g_Settings.flForceFOV && g_Settings.flForceFOVZoomed && g_Settings.bZoomedFOV) { + bool zoomed = g_pLocalPlayer->bZoomed; + if (g_Settings.bZoomedFOV->GetBool() && zoomed) { + if (g_Settings.flForceFOVZoomed->GetBool()) { + setup->fov = g_Settings.flForceFOVZoomed->GetFloat(); + } + } else { + if (g_Settings.flForceFOV->GetBool()) { setup->fov = g_Settings.flForceFOV->GetFloat(); + } + } } SEGV_END; }