Skip to content

Partial reloads 15: Add partial reloads to the SRS - #2301

Closed
sunzenshen wants to merge 1 commit into
stack/reload-zr68c/95-aa13from
stack/reload-zr68c/100-srs
Closed

sunzenshen wants to merge 1 commit into
stack/reload-zr68c/95-aa13from
stack/reload-zr68c/100-srs

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

Depends on NeotokyoRebuild/neoAssets#187 (layer 15: the SRS sources, clips, phases file and sound pieces).

Partial reloads 15: add partial reloads to the SRS. This PR builds on layer 14 (#2300, the AA13) and pairs with
neoAssets layer 15. Next: #2302 (16, PZ252).

The phase code of 03-05 is generic: a weapon gets partial reloads from its weapon script and a phases file. The SRS
also needs code, because it is a bolt action: after a shot the chamber holds the spent case until the bolt is home.

  • SRS script: #base "weapon_srs_reload_phases.txt", "ReloadPhases" {}, "ChamberedRound" "1", as the ZR68C
    has them. Its reload has three steps (magazine out, magazine seat, bolt) and three new sound entries,
    weapon_srs.reload_unload, _load, _cycle.
  • Bolt after a shot (weapon_srs.cpp): the charge row of the phases file gives the time the bolt is home.
    Until then IsRoundChambered() is false, a shot is ignored, and a reload with rounds left waits. Without the wait a
    reload during the bolt would count the spent case as a chambered round: one round from nothing. A switch during the
    bolt keeps it pending; the next draw finishes it before the gun fires. Every hook does nothing with the flag at 0.
  • Base weapon: the four chamber queries (HasChamberSlot, IsRoundChambered, RoundsInMagazine,
    MagazineCapacity) become virtual; the SRS overrides IsRoundChambered.
  • The flag sv_neo_reload_experimental defaults to 1 while the partial-reload stack is reviewed (Partial reloads 06: Resume a ZR68C reload after the magazine is unloaded #2293); the
    last PR of the stack sets it back to 0. With the flag at 0 the SRS behaves as on master.

How to review

  1. weapon_srs.h / weapon_srs.cpp: the BoltPhases* hooks and the IsRoundChambered override.
  2. weapon_neobasecombatweapon.h: the four virtual keywords.
  3. weapon_srs.txt: the three lines, as weapon_zr68c.txt has them (Partial reloads 06: Resume a ZR68C reload after the magazine is unloaded #2293, Partial reloads 08: Keep a chambered round through a partial reload #2294).
  4. game_sounds_weapons.txt: the three SRS entries, in the weapon_zr68.reload_* pattern.
  5. The neoAssets layer 15 phases file (the charge row).
  6. Test in game: "How to test".

How to test

  1. Load a map (the flag is 1 by default during review). Take the SRS (Assault, Lieutenant): the HUD shows 5+1.
  2. Fire two rounds and reload: no bolt pull, 5+1. Fire it empty and reload: 5 with a dim round icon, then 4+1 at
    the bolt.
  3. Fire one round and hold R during the bolt: the reload starts when the bolt is home and ends at 5+1, not 6+1.
  4. Reload and switch to the secondary after the old magazine is out (about 1.0-1.8 s in), then back, once dry and once
    with a round chambered. Then once dry after the new magazine is seated (about 1.9-3.2 s in).
  5. Repeat with sv_neo_reload_experimental 0 (set before the map loads): master behavior, 5 rounds, no +1.

Results

Layer 15 build (this PR + neoAssets layer 15), Linux Debug, ntre_engage_ctg, owner SRS plus a bot_mimic bot:

case result
tactical from 3 (2+1) reload_skipcycle: 1 at the unload (+1.01 s) -> 6 (5+1) at the load (+1.88 s), ends +2.40 s; unload and load sounds once each; no bolt pull
dry from 0 reload: 0 -> 5 with the round icon dim (+1.88 s) -> 4+1 at the bolt (+3.24 s)
dry, switch after the unload, back drawunloaded_reload: 0 -> 5 (+2.15 s) -> 4+1 (+3.51 s); load and cycle sounds
tactical, switch after the unload, back drawunloaded_reload_skipcycle: 1 -> 6 (+2.15 s)
dry, switch after the load, back drawtocycle_reload: 5 dim -> 4+1 (+1.64 s); cycle sound
2+1, a shot, R held during the bolt charge plays; the reload starts at the bolt home (0.99 s after the shot) from 1+1: 1 at the unload -> 6 (5+1)
a shot after any reload charge; chambered again 0.99-1.11 s after the shot (the charge row is 0.833 s from the start of charge)
flag 0: tactical, dry, R during the bolt master: reload 3 -> 5 and 0 -> 5 at +3.12 s, whole sound; R during the bolt starts a master reload at once, 2 -> 5
HUD (frame crops) tactical: round icon lit throughout; dry: icon dim with 0 and with 5 after the load, lit at 4+1; after a shot: icon dim until the bolt is home
headless TDM, 12 Assault bots on the SRS, flag 1, 1 round PASS, match_end=True, 0 asserts; bots reloaded to 6 (5+1)

Toolchain

  • Linux GCC Distro Native (Linux Mint 22.3, GCC 13.3.0)

Linked Issues

The SRS script gets the reload phases from neoAssets and a chamber
slot: #base "weapon_srs_reload_phases.txt", "ReloadPhases" {} and
"ChamberedRound" "1", and game_sounds_weapons.txt the three reload
sound pieces the phases play (weapon_srs.reload_unload, reload_load,
reload_cycle). The generic phase code then resumes a reload
interrupted after the unload or the load, and a reload with a round
chambered skips the bolt pull.

The bolt cycle after a shot needs its own hooks, all inert with
sv_neo_reload_experimental at 0. Until the bolt is home (the charge
row of the phase table) the chamber holds the spent case, so
IsRoundChambered() is false, a shot is ignored, and a reload with
rounds left waits: it would otherwise count the case as a chambered
round and add one round from nothing. A switch during the bolt cycle
keeps it pending, and the next draw finishes it before the gun fires.
The chamber queries of the base weapon become virtual for this
override.
@sunzenshen

Copy link
Copy Markdown
Contributor Author

Closing to clear the board in favor of the PR stack of sunzenshen#34

@sunzenshen sunzenshen closed this Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Animations Animation stuff. Including the syncronizing of animations between client and server based on state.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants