summaryrefslogtreecommitdiffstats
path: root/src/hl2h.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-27 15:22:19 +0100
committersalmonik <salmonik@tuta.io>2026-10-27 15:22:19 +0100
commit27c9ad766e1b1333922b4c14cbde9d9b77c8dab0 (patch)
tree7c758c0d431a389cc3826495b4c6d20ca28c6530 /src/hl2h.cpp
parentMelee killbot: 360-degree crowbar silent aim (diff)
downloadhl2h-27c9ad766e1b1333922b4c14cbde9d9b77c8dab0.tar.gz
hl2h-27c9ad766e1b1333922b4c14cbde9d9b77c8dab0.zip
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.
Diffstat (limited to '')
-rw-r--r--src/hl2h.cpp3
1 files changed, 3 insertions, 0 deletions
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) {
532 note_modified(cmd, flags, vel); 532 note_modified(cmd, flags, vel);
533 } 533 }
534 } 534 }
535
536 if (spread_control_apply(cmd, ent))
537 note_modified(cmd, flags, vel);
535} 538}
536 539
537// --------------------------------------------------------------------------- 540// ---------------------------------------------------------------------------