Skip to content

Partial reloads 08: Keep a chambered round through a partial reload - #2294

Closed
sunzenshen wants to merge 1 commit into
stack/reload-zr68c/40-attachfrom
stack/reload-zr68c/50-cycle
Closed

sunzenshen wants to merge 1 commit into
stack/reload-zr68c/40-attachfrom
stack/reload-zr68c/50-cycle

Conversation

@sunzenshen

@sunzenshen sunzenshen commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

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

Partial reloads 08: keep a chambered round through a partial reload. This PR builds on #2292 (07: the resume after
the load) and pairs with neoAssets layer 08. Next: 09 (the ZR68-S, #2295).

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 (06)
resume after the unload, round chambered drawunloaded_reload_skipcycle (new)
resume after the load, chamber empty drawtocycle_reload (07)
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 06: Resume a ZR68C reload after the magazine is unloaded #2293).

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 08 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 08 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

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 force-pushed the stack/reload-zr68c/40-attach branch from 5db897e to 7f065b7 Compare November 10, 2026 02:10
@sunzenshen
sunzenshen force-pushed the stack/reload-zr68c/50-cycle branch from 7307cf0 to 338aae6 Compare November 10, 2026 02:10
@sunzenshen sunzenshen changed the title Partial reloads 05: Keep a chambered round through a partial reload Partial reloads 08: Keep a chambered round through a partial reload Nov 10, 2026
@sunzenshen
sunzenshen marked this pull request as ready for review November 10, 2026 04:47

@sunmachine sunmachine left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@sunzenshen

Copy link
Copy Markdown
Contributor Author

Closing to clear the board in favor of sunzenshen#36

@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