Added cvar 'dz_silent_aim'

This commit is contained in:
Wizzard 2023-09-20 09:59:07 -04:00
parent e43cea56f8
commit f38678d727
3 changed files with 9 additions and 6 deletions

View File

@ -15,6 +15,7 @@ DECL_CVAR(tracers);
DECL_CVAR(clmove); DECL_CVAR(clmove);
DECL_CVAR(watermark); DECL_CVAR(watermark);
DECL_CVAR(watermark_rainbow); DECL_CVAR(watermark_rainbow);
DECL_CVAR(silent_aim);
bool cvars_init(void) { bool cvars_init(void) {
REGISTER_CVAR(bhop, 1); REGISTER_CVAR(bhop, 1);
@ -27,6 +28,7 @@ bool cvars_init(void) {
REGISTER_CVAR(clmove, 0); REGISTER_CVAR(clmove, 0);
REGISTER_CVAR(watermark, 1); REGISTER_CVAR(watermark, 1);
REGISTER_CVAR(watermark_rainbow, 1); REGISTER_CVAR(watermark_rainbow, 1);
REGISTER_CVAR(silent_aim, 1);
if (IsCS16()) { if (IsCS16()) {
REGISTER_CVAR(tracers, 0); REGISTER_CVAR(tracers, 0);
} else { } else {

View File

@ -90,8 +90,6 @@ void aimbot(usercmd_t* cmd) {
/* TODO: Add setting for lowest health */ /* TODO: Add setting for lowest health */
vec3_t best_delta = get_closest_delta(engine_viewangles); vec3_t best_delta = get_closest_delta(engine_viewangles);
if (!vec_is_zero(best_delta)) { if (!vec_is_zero(best_delta)) {
/* NOTE: We can divide the best delta here to add smoothing */
engine_viewangles.x += best_delta.x; engine_viewangles.x += best_delta.x;
engine_viewangles.y += best_delta.y; engine_viewangles.y += best_delta.y;
engine_viewangles.z += best_delta.z; engine_viewangles.z += best_delta.z;
@ -100,8 +98,10 @@ void aimbot(usercmd_t* cmd) {
cmd->buttons &= ~IN_ATTACK; cmd->buttons &= ~IN_ATTACK;
} }
if (CVAR_ON(silent_aim)) {
vec_copy(cmd->viewangles, engine_viewangles); vec_copy(cmd->viewangles, engine_viewangles);
} else {
/* NOTE: Uncomment to disable silent aim */ i_engine->SetViewAngles(engine_viewangles);
/* i_engine->SetViewAngles(engine_viewangles); */
} }
}

View File

@ -41,6 +41,7 @@ DECL_CVAR_EXTERN(tracers);
DECL_CVAR_EXTERN(clmove); DECL_CVAR_EXTERN(clmove);
DECL_CVAR_EXTERN(watermark); DECL_CVAR_EXTERN(watermark);
DECL_CVAR_EXTERN(watermark_rainbow); DECL_CVAR_EXTERN(watermark_rainbow);
DECL_CVAR_EXTERN(silent_aim);
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/