Skip to content

Partial reloads 05: Keep a chambered round through a partial reload - #2286

Closed
sunzenshen wants to merge 1 commit into
NeotokyoRebuild:stack/reload-zr68c/40-attachfrom
sunzenshen:sketch-zr68c-full
Closed

sunzenshen wants to merge 1 commit into
NeotokyoRebuild:stack/reload-zr68c/40-attachfrom
sunzenshen:sketch-zr68c-full

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by #2294 (same commits, opened from the upstream stack branch so GitHub links the stack). Review there; this draft stays open until the author closes it.

Description

Depends on NeotokyoRebuild/neoAssets#173 (layer 05: the skipcycle clips, their phases rows and the unload sound).

Partial reloads 05: keep a chambered round through a partial reload. This PR builds on #2292 (04: the resume after
the load) and pairs with neoAssets layer 05. Next: 06 (the M41 family).

The ZR68C is a closed-bolt rifle: a reload with a round in the chamber keeps that round and needs no bolt pull.
With this PR the ZR68C tracks its chamber:

path sequence
dry reload: unload, load, cycle reload
tactical reload: unload, load, back to idle reload_skipcycle (new)
resume after the unload, chamber empty drawunloaded_reload (03)
resume after the unload, round chambered drawunloaded_reload_skipcycle (new)
resume after the load, chamber empty drawtocycle_reload (04)
resume after the load, round chambered nothing remains: plain draw

How it works

  • Chamber: "ChamberedRound" in weapon_zr68c.txt. The clip counts the chambered round: a fresh gun holds
    29+1 (30, as on master), a tactical reload fills it to 30+1. m_bChamberEmpty (one networked, predicted bool) is set by the last shot and cleared only by a reload's
    3_cycle; while it is set a loaded magazine cannot fire.
  • Reload request: ReloadPhasesOnRequest answers a reload press before the default reload: refuse during a
    reload or with a full magazine, chamber a loaded magazine (the dry reload without taking reserve ammo, when a resume
    was lost), or start reload_skipcycle when a round is chambered. Otherwise the default reload runs.
  • Clip at the unload: when the old magazine comes out (1_unload), the clip drops to the chambered round, 1 or 0,
    until the new magazine loads. Master's reload already discards the old magazine's rounds at the load; they now go at
    the unload, so the reserve changes as on master: a tactical reload from 20 takes 30 from the reserve and ends at
    30+1, with or without a switch after the unload. A switch before the unload keeps the old magazine.
  • Bots: a bot keeps its gun while the reload is past the unload (IsReloadPastUnload). Before, the empty clip
    made EquipBestWeaponForThreat switch to the secondary with an enemy within 250 units, which interrupted the
    reload.
  • HUD: a gun with a chamber shows the magazine count plus +1 while a round is chambered (29+1/30), and lights
    the round icon of the fire-mode glyph only then.
  • Third person: reload_skipcycle is shorter than the reload gesture. It plays the gesture from the start and cuts
    it at the clip end (RELOAD_GESTURE_KEEP_START, added in 04).
  • Drop: a gun dropped after the load keeps its pending bolt pull for the next owner's draw.
  • Sound: weapon_zr68.reload_unload, the unload piece reload_skipcycle plays (the reload_<step> pattern
    of Partial reloads 03: Resume a ZR68C reload after the magazine is unloaded #2285).

How to review

  1. weapon_neobasecombatweapon.cpp: ReloadPhasesOnRequest, StartPartialReload, PlayReloadSequence (split out
    of 04's ResumeReload), FinishReloadPhase, the chamber helpers, and the two PrimaryAttack lines.
  2. neo_bot.cpp: the early return in EquipBestWeaponForThreat.
  3. neo_hud_ammo.cpp: the +1 row and DrawFireModeWithChamber.
  4. The neoAssets layer 05 phases file (two new sequences).
  5. Test in game: "How to test".

How to test

  1. Load a map (the flag is 1 by default during review). Take the ZR68C: the HUD shows 29+1.
  2. Fire a few rounds and reload: the reload ends without a bolt pull at 30+1.
  3. Fire the magazine empty and reload: the bolt is pulled; the HUD shows 30 with a dim round icon until the pull,
    then 29+1.
  4. Reload and switch to the secondary after the old magazine is out (about 0.7-1.3 s in), then back, once dry and once
    with a round chambered; then dry, switch after the new magazine is seated (about 1.4-2.2 s in), and back.
  5. Repeat with sv_neo_reload_experimental 0 (set before the map loads): master behavior, 30 rounds, no +1.

Results

Linux Debug client and dedicated server, 0 compiler warnings, neoAssets layer 05 assets. Client runs used a listen
server with one bot replaying the owner's inputs (bot_mimic), seen as a remote player. HUD values were read from
movie frames.

check result
tactical reload from 20 reload_skipcycle, no bolt pull; clip 1 (the chambered round) at the unload +0.705 s, 31 (30+1) at the load +1.335 s, fire at +2.175 s; reserve 90 to 60; unload, load and tap sounds once; HUD: magazine bullets all dim at the unload with the round icon lit
dry reload from 0 reload; 30 at the load with the round icon dim, 29+1 at the bolt pull (+2.28 s), fire at +2.715 s
dry, switch after the unload drawunloaded_reload; 0, then 30 dim, then 29+1
tactical, switch after the unload clip 1 kept through the switch; drawunloaded_reload_skipcycle; 31 at the end; no cycle sound
dry, switch after the load drawtocycle_reload; 30 dim, then 29+1; cycle sound once
tactical, switch after the load plain draw, keeps 30+1
third person reload_skipcycle plays the gesture from its start and cuts it at cycle 0.80 after 2.17 s
flag 0, tactical and dry with a switch master: clip 20 until +2.22 s, then 30, no +1; a switch cancels the dry reload
headless TDM, 12 bots on ZR68C, 1 round, flag 1 PASS, 0 asserts; bots kept the gun past the unload in 133 episodes (all 12 bots) and switched away there 0 times
same, flag 0 PASS, 0 asserts; 2 switches during a reload at clip 0 (grenades), as on master

The only client assert is the engine baseline shadow-leaf assert, outside the reloads.

Known limits

  • A drop after the unload still cancels the pending resume.
  • Bots count 30 of 31 as a full clip: a bot at 29+1 does not reload by its own logic.
  • The dry-reload fallback (a loaded magazine with an empty chamber while idle) is not reached by any in-game path
    tested.

Toolchain

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

Linked Issues

@sunzenshen

Copy link
Copy Markdown
Contributor Author

This PR is not ready for review, it was mostly intended to sketch out what the full code of a vertical slice would look like for one weapon for partial reloads, so that the code in #2285 ideally mostly survives with the end goal in mind.

I do plan to keep tinkering with this branch while the smaller single transition MVP is under review.

@sunzenshen sunzenshen changed the title Sketch: full ZR68C partial-reload slice Complete the ZR68C partial-reload vertical slice Nov 8, 2026
With sv_neo_reload_experimental, a weapon script can declare
"ChamberedRound": the ZR68C now holds 30+1. A reload with a round
chambered plays reload_skipcycle, which leaves out the bolt cycle and
keeps that round; a dry reload still cycles the bolt. The last shot
empties the chamber, and only a reload's 3_cycle phase fills it again.

The old magazine's rounds now leave at the unload, as the magazine
does, so the clip shows only the chambered round from there. Bots do
not switch away from a reload that is past the unload, since the
switch would only delay the refill. The ammo HUD shows the chamber as
"+1" and lights the fire-mode glyph's round icon while it is loaded.

Flag off: every new path checks IsReloadPhaseSystemEnabled() first,
so the weapon behaves as on master.
@sunzenshen sunzenshen changed the title Complete the ZR68C partial-reload vertical slice Partial reloads 05: Keep a chambered round through a partial reload Nov 9, 2026
@sunzenshen
sunzenshen changed the base branch from master to stack/reload-zr68c/40-attach November 9, 2026 07:12
@sunzenshen

Copy link
Copy Markdown
Contributor Author

Closing in favor of #2294 because this PR cannot be added to the PR stack.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant