Zoom sensitivity ratio tweak, header file modifications (#1428)
* Zoom sens ratio tweak, header file modifications Signed-off-by: Ashley <ash@trapacid.dev> * Fix a bunch of reset problems Co-authored-by: BenCat07 <BenCat07@gmail.com>
This commit is contained in:
parent
70d5a7ac40
commit
5a7117624e
@ -33,7 +33,7 @@
|
||||
<AutoVariable width="fill" target="remove.hats" label="Remove hats"/>
|
||||
<AutoVariable width="fill" target="remove.contracker" label="Remove contracker"/>
|
||||
<AutoVariable width="fill" target="remove.scope" label="Remove scope"/>
|
||||
<AutoVariable width="fill" target="remove.zoom" label="Remove zoom/keep rifle" tooltip="Disables scope zoom and keeps the sniper rifle. Use the command 'zoom_sensitivity_ratio' to adjust mouse sensitivity while zoomed."/>
|
||||
<AutoVariable width="fill" target="remove.zoom" label="Remove zoom/keep rifle" tooltip="Disables scope zoom and keeps the sniper rifle. Enabling Remove scope as well will set zoom_sensitivity_ratio to 4 when zooming in."/>
|
||||
</List>
|
||||
</Box>
|
||||
<Box padding="12 6 6 6" width="content" height="content" name="Misc" x="195" y="125">
|
||||
|
@ -20,6 +20,7 @@ extern std::array<Timer, 32> timers;
|
||||
extern Timer DelayTimer;
|
||||
extern bool firstcm;
|
||||
extern bool ignoredc;
|
||||
extern bool user_sensitivity_ratio_set;
|
||||
|
||||
extern bool calculated_can_shoot;
|
||||
extern float prevflow;
|
||||
@ -27,6 +28,7 @@ extern int prevflowticks;
|
||||
#if ENABLE_VISUALS
|
||||
extern int spectator_target;
|
||||
extern CLC_VoiceData *voicecrash;
|
||||
extern bool freecam_is_toggled;
|
||||
#endif
|
||||
extern settings::Boolean clean_chat;
|
||||
|
||||
@ -37,15 +39,13 @@ extern float backup_lerp;
|
||||
extern settings::Int fakelag_amount;
|
||||
extern settings::Boolean fakelag_midair;
|
||||
extern settings::Boolean no_zoom;
|
||||
extern settings::Boolean no_scope;
|
||||
extern settings::Boolean disable_visuals;
|
||||
extern settings::Int print_r;
|
||||
extern settings::Int print_g;
|
||||
extern settings::Int print_b;
|
||||
extern Color menu_color;
|
||||
extern int stored_buttons;
|
||||
#if ENABLE_VISUALS
|
||||
extern bool freecam_is_toggled;
|
||||
#endif
|
||||
typedef void (*CL_SendMove_t)();
|
||||
extern DetourHook cl_warp_sendmovedetour;
|
||||
extern DetourHook cl_nospread_sendmovedetour;
|
||||
|
@ -79,10 +79,6 @@
|
||||
#include "copypasted/Netvar.h"
|
||||
#include "copypasted/CSignature.h"
|
||||
|
||||
#if ENABLE_GUI
|
||||
// FIXME add gui
|
||||
#endif
|
||||
|
||||
#include <core/sdk.hpp>
|
||||
|
||||
template <typename T> constexpr T _clamp(T _min, T _max, T _val)
|
||||
|
@ -14,6 +14,8 @@ static settings::Button zoom_key{ "visual.zoom-key", "<null>" };
|
||||
static settings::Int zoom_fov{ "visual.zoom-key.fov", "20" };
|
||||
bool freecam_is_toggled{ false };
|
||||
bool zoomed_last_tick{ false };
|
||||
bool user_sensitivity_ratio_set{ true };
|
||||
float zoom_sensitivity_ratio_user;
|
||||
|
||||
namespace hooked_methods
|
||||
{
|
||||
@ -119,6 +121,36 @@ DEFINE_HOOKED_METHOD(OverrideView, void, void *this_, CViewSetup *setup)
|
||||
freecam_is_toggled = false;
|
||||
|
||||
draw::fov = setup->fov;
|
||||
|
||||
auto zoom_sensitivity_ratio = g_ICvar->FindVar("zoom_sensitivity_ratio");
|
||||
|
||||
if (g_pLocalPlayer->bZoomed)
|
||||
{
|
||||
static bool last_zoom_state = false;
|
||||
bool current_zoom_state = no_zoom && no_scope;
|
||||
if (current_zoom_state != last_zoom_state)
|
||||
{
|
||||
if (user_sensitivity_ratio_set)
|
||||
zoom_sensitivity_ratio_user = zoom_sensitivity_ratio->GetFloat();
|
||||
|
||||
// No removing zoom, so user zoom_sensitivity_ratio will be reset to what they had it to on zoom
|
||||
if (no_zoom && no_scope)
|
||||
{
|
||||
if (!user_sensitivity_ratio_set)
|
||||
{
|
||||
zoom_sensitivity_ratio->SetValue(zoom_sensitivity_ratio_user);
|
||||
user_sensitivity_ratio_set = true;
|
||||
}
|
||||
}
|
||||
// Both requirements are true, so change the zoom_sensitivity_ratio to 4
|
||||
else
|
||||
{
|
||||
zoom_sensitivity_ratio->SetValue(4);
|
||||
user_sensitivity_ratio_set = false;
|
||||
}
|
||||
}
|
||||
last_zoom_state = current_zoom_state;
|
||||
}
|
||||
}
|
||||
static InitRoutine override_init([]() {
|
||||
EC::Register(
|
||||
|
Reference in New Issue
Block a user