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.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/hl2h.cpp') diff --git a/src/hl2h.cpp b/src/hl2h.cpp index ee2e990..dddcbdc 100644 --- a/src/hl2h.cpp +++ b/src/hl2h.cpp @@ -532,6 +532,9 @@ static void do_move(int seq, float frametime) { note_modified(cmd, flags, vel); } } + + if (spread_control_apply(cmd, ent)) + note_modified(cmd, flags, vel); } // --------------------------------------------------------------------------- -- cgit v1.2.3