diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 13:26:33 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 13:26:33 +0100 |
| commit | d22bd8d184091e6a4600beb78eb279c2f5fab51b (patch) | |
| tree | d2599374c611b56a5568f949b93e7fab2a93f6c8 /CONTEXT.md | |
| parent | Fix No spread on the hl2_complete server build (diff) | |
| download | hl2h-d22bd8d184091e6a4600beb78eb279c2f5fab51b.tar.gz hl2h-d22bd8d184091e6a4600beb78eb279c2f5fab51b.zip | |
No spread: zero pellet offsets inside FireBullets
Picking the best of 256 pending seeds still leaves the shotgun's 8/12 pellets
a few degrees apart. CShotManipulator::ApplySpread is inlined into
CBaseEntity::FireBullets and draws x/y through the global
CUniformRandomStream; hook its RandomFloat slot and return 0 when the calling
frame's shooter is the local server player. This collapses every pellet onto
the shot direction while NPC fire and client prediction keep their randomness.
Diffstat (limited to 'CONTEXT.md')
| -rw-r--r-- | CONTEXT.md | 8 |
1 files changed, 8 insertions, 0 deletions
| @@ -298,6 +298,14 @@ vocabulary / decisions. | |||
| 298 | `CBaseEntity::FireBullets`; the `CUniformRandomStream` wrappers and | 298 | `CBaseEntity::FireBullets`; the `CUniformRandomStream` wrappers and |
| 299 | constructor-time `RandomSeed(0)` resets pass other objects and are left | 299 | constructor-time `RandomSeed(0)` resets pass other objects and are left |
| 300 | alone. | 300 | alone. |
| 301 | - Seed choice alone cannot remove all of a shotgun's pellet spread: the best | ||
| 302 | of 256 sequences still leaves its 8/12 draws apart. `CShotManipulator:: | ||
| 303 | ApplySpread` is inlined into `CBaseEntity::FireBullets` and draws x/y via | ||
| 304 | the global `CUniformRandomStream` (`_ZTV20CUniformRandomStream` + 8, slot 1 | ||
| 305 | = `RandomFloat(float,float)`; confirmed against `libvstdlib.so`). The hook | ||
| 306 | returns 0 for those draws only when the calling frame's `this` (at | ||
| 307 | `ebp+8`) is the local server player, so every pellet follows the exact shot | ||
| 308 | direction. NPC fire and the client's prediction stream keep normal values. | ||
| 301 | - This attacks the random cone offset only. The cone size, the pistol's | 309 | - This attacks the random cone offset only. The cone size, the pistol's |
| 302 | `m_flAccuracyPenalty` growth, the server view punch added to | 310 | `m_flAccuracyPenalty` growth, the server view punch added to |
| 303 | `GetAutoaimVector`, and any damage falloff are server-side state. In | 311 | `GetAutoaimVector`, and any damage falloff are server-side state. In |
