From 27c9ad766e1b1333922b4c14cbde9d9b77c8dab0 Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 15:22:19 +0100 Subject: Spread control: client-seed no-spread HL2's CBaseEntity::FireBullets seeds its RNG from the usercmd random_seed (m_bUseServerRandomSeed is false for HL2 weapons), so the client can select the 8-bit seed that puts CShotManipulator::ApplySpread closest to the center. - New feature Spread control -> Active / No spread (both default on). - Precompute the best seed for a single shot and for the shotgun's 8-shot primary (first pellet accurate) and 12-shot secondary windows using the engine's own RandomSeed/RandomFloat from libvstdlib. - Set cmd->random_seed on attack commands; note_modified repairs the CRC. - The random cone offset is neutralized, but the cone size, the pistol accuracy penalty, server view punch and any damage falloff remain server-side; stock HL2 has no distance damage falloff. --- src/hl2h.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/hl2h.h') diff --git a/src/hl2h.h b/src/hl2h.h index 2680591..ef8e8d6 100644 --- a/src/hl2h.h +++ b/src/hl2h.h @@ -129,7 +129,7 @@ struct CUserCmd { // engine constants // --------------------------------------------------------------------------- -enum { IN_ATTACK = 1 << 0, IN_JUMP = 1 << 1, IN_DUCK = 1 << 2, IN_USE = 1 << 5 }; +enum { IN_ATTACK = 1 << 0, IN_JUMP = 1 << 1, IN_DUCK = 1 << 2, IN_USE = 1 << 5, IN_ATTACK2 = 1 << 11 }; enum { FL_ONGROUND = 1 << 0, FL_DUCKING = 1 << 1, FL_INWATER = 1 << 9 }; enum { MOVETYPE_WALK = 2, MOVETYPE_NOCLIP = 8, MOVETYPE_LADDER = 9 }; @@ -150,6 +150,7 @@ bool triggerbot_apply(CUserCmd *cmd); bool silent_aim_apply(CUserCmd *cmd); bool melee_weapon_active(void *local_ent); bool melee_aimbot_apply(CUserCmd *cmd); +bool spread_control_apply(CUserCmd *cmd, void *local_ent); enum FeatureId { FEAT_BHOP = 0, FEAT_ABH = 1, @@ -158,7 +159,8 @@ enum FeatureId { FEAT_TRIGGERBOT = 4, FEAT_SILENTAIM = 5, FEAT_JUMPBUG = 6, - FEAT_MELEE = 7 + FEAT_MELEE = 7, + FEAT_SPREAD = 8 }; enum EspOption { ESP_OPT_SHOW_NEUTRAL = 0, @@ -193,6 +195,7 @@ bool feature_bind_held(int feature); bool esp_option(int opt); bool bhop_autostrafe_enabled(); bool jumpbug_assist_enabled(); +bool spread_no_spread_enabled(); unsigned aimbot_bone_mask(); int aimbot_smooth_step(); bool aimbot_vischeck_enabled(); -- cgit v1.2.3