Repository navigation
Partial reloads 03: Resume a ZR68C reload after the magazine is unloaded - #2285
Closed
sunzenshen wants to merge 2 commits into
Closed
sunzenshen wants to merge 2 commits into
sunzenshen wants to merge 2 commits into
Conversation
This was referenced Nov 8, 2026
Merged
sunzenshen
added a commit
to sunzenshen/neo
that referenced
this pull request
Nov 9, 2026
Bring in the NeotokyoRebuild#2285 commits that cut its gesture change, add the one-line reload-phase hooks and rename the sound pieces. Each conflict resolves to the slice: it keeps its gesture fit, which short resumes and reload_skipcycle need. The hook layout and the sound names follow in their own commits.
sunzenshen
added a commit
to sunzenshen/neo
that referenced
this pull request
Nov 9, 2026
Master's Reload, FinishReload, Deploy, Holster and ItemBusyFrame gain one hook call each, as in NeotokyoRebuild#2285, and each hook checks the reload-phase gate itself. The slice's chamber, dry-chamber and reload_skipcycle starts move into ReloadPhasesOnRequest, and the chambered round kept through a magazine change comes back from ReloadPhasesOnFinish, so master's clip arithmetic keeps GetMaxClip1. The header additions move into one commented block. Behavior is unchanged with the flag on and off.
sunzenshen
added a commit
to sunzenshen/neo
that referenced
this pull request
Nov 9, 2026
Name each piece reload_<step>, and a step's later pieces _part2, as in NeotokyoRebuild#2285: reload_unload, reload_load, reload_load_part2, reload_cycle. The wav files and the phases-file keys are renamed to match in neoAssets. The ) prefix stays.
Behind sv_neo_reload_experimental, a weapon whose script has a ReloadPhases block (only the ZR68C here) keeps its reload step across a weapon switch: switched after the unload, the next draw plays the resume sequence named in the phases file, loads the magazine and plays the remaining sound pieces. A switch before the unload still cancels the reload, and a dropped weapon cancels it. The parser reads the ReloadPhases block and stores tables only for weapons that have one. Master's Reload, FinishReload, Deploy, Holster and ItemBusyFrame each gain one call into a hook that checks the flag. The flag is read once per map into the game rules. The third-person reload gesture adopts the new weapon on a resumed reload, so NEO's weapon-switch reset does not clear it. The viewmodel reads the weapon data by reference instead of copying it every frame.
Reviewers can test the resume without setting the cvar. The last PR of the partial-reload stack sets the default back to 0.
sunzenshen
force-pushed
the
reload-zr68c-resume
branch
from
November 9, 2026 06:07
ee640a5 to
86d98ed
Compare
This was referenced Nov 9, 2026
Contributor
Author
|
Closing in favor of #2293 because this PR cannot be inserted into the PR stack. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Depends on NeotokyoRebuild/neoAssets#172 (the ZR68C resume animation, its phases file and three reload sounds).
Partial reloads 03: this PR pairs with neoAssets layer 03 (NeotokyoRebuild/neoAssets#172). The neoAssets stack under it, 01 (NeotokyoRebuild/neoAssets#176, the
Blender layout and tools) and 02 (NeotokyoRebuild/neoAssets#177, the ZR68C sources), carries no game change and has no neo PR. Next: 04
(resume after the load) and 05 (the bolt cycle, a chambered round).
Today a weapon switch during a reload cancels it, even after the old magazine has visibly dropped
out. With
sv_neo_reload_experimental 1, a ZR68C reload that is interrupted after the unload stepcontinues when the ZR68C is drawn again: the draw brings up the fresh magazine, seats it, pulls the
bolt, and ends with a full magazine. The resume cannot be skipped; the gun can fire when it ends.
The last PR of the stack sets the default back to 0. The flag is read once when the map starts (into the game
rules), so a change applies from the next map.
view. The one shared-file change is in
hl2mp_playeranimstate(+8 lines). The resume starts inDeploy, after theweapon switch, so NEO's weapon-switch reset in
multiplayer_animstate.cppcleared the gesture after one frame. Theresume's reload event carries a
RELOAD_EVENT_RESUMEDmarker, and only that event adopts the new weapon after thegesture starts. A plain reload event runs master's code.
ReloadPhasesblock uses the new code, and only the ZR68C has one.seat (1.333 s) instead of at 2.217 s, so a switch after the seat keeps the full magazine and plays
a normal draw. A switch before the unload cancels the reload as it does today.
How it works
ReloadPhaseslists, per viewmodel sequence, when each reload step (1_unload,2_load,3_cycle) counts its ammo and when each of its sounds plays. A resume after step N listsonly the later steps, so it never replays an earlier step's sound. A row's
resumekey names thesequence that resumes a reload interrupted after that step. The table is the one of the sequence the
reload plays, so
reloadandreloademptycan time and resume differently. The ZR68C rows come from neoAssets(
#base "weapon_zr68c_reload_phases.txt"), whose export sets every time from markers in the.blend, so the timing follows the animation. If that file is missing, the parser warns and theweapon plays the normal reload.
ends with both hands at rest. The resume uses no
ReloadReadyBeforeEnd-style time; an uninterruptedreload keeps today's code,
ReloadReadyBeforeEndincluded.table (both networked). Nothing else outlasts the switch.
(
drawunloaded_reload, 2.767 s) instead ofdraw. A second switch during the resume, before itsload, plays the resume again. The load step loads the magazine through the normal
reload finish. The load, its tap and the cycle sounds play as separate pieces, because the single reload sound
cannot start part way. A switch or a drop stops them.
not resume it.
Reload,FinishReload,Deploy,HolsterandItemBusyFrameeach gain oneReloadPhasesOn*call. Every hook holds the flag gate, so master's functions only gain one-line calls.weapon_zr68.reload_load,reload_load_part2andreload_cycle, asreload_<step>[_part<N>]. Indrawunloaded_reloadthey start at 1.367 s, 1.800 s and 2.100 s; the load countsat 1.400 s and the cycle at 2.333 s (times from the neoAssets phases file). The waves keep the
)prefix ofweapon_zr68.npc_reload, the entry NEO plays for areload (
RELOAD_NPC).predicts the resume with the server's values.
Why one glued resume sequence, not a runtime join
A runtime join (a transition clip, then
reloadstarted at the resume frame) hitched for about 85 ms at the join,because of how the engine updates a predicted viewmodel's sequence, and saved only about 3.9 KB per model. The model
duplicates the reload frames in the glued clip instead.
Cost with the flag off
props, 1 rules bit). Prediction fields are constant.
script has them (the ZR68C). The sound pieces are precached with the weapons soundscript at either flag value.
cheap.
neo_predicted_viewmodel.cppnow reads the weapon data by reference instead of copying it every frame.How to review
ReloadPhasesOn*calls inReload,FinishReload,Deploy,Holster,ItemBusyFrame. Each hook returns first on the flag.hl2mp_playeranimstate.cpp, guarded byRELOAD_EVENT_RESUMED.ReloadPhasesinneo_weapon_parse.cpp.drawunloaded_reload, the three sound pieces).How to test
sv_neo_reload_experimentalis 1 by default in this PR).(about 0.7 s in). Switch back: the draw should bring up a fresh magazine, seat it, pull the bolt,
and end with 30 rounds. Holding fire during this draw should not fire.
sv_neo_reload_experimental 0, and with another rifle at both values: the reloadshould behave as it does today.
Results
Tested with this PR's head and the neoAssets layer 03 assets (NeotokyoRebuild/neoAssets#172), Linux Debug client and dedicated server, no
warnings. The layer 03 resume clip is 2 frames longer than the one first tested here (a slower magazine clasp flip
in
drawunloaded): the resume runs 2.767 s instead of 2.70 s, and its load and every sound piece come 0.067 s later(load 1.400 s instead of 1.333 s). The third-person, remote-view and flag-off rows were measured with the earlier clip; the code
they exercise did not change, and the clip length does not enter the flag-off path.
drawunloaded_reload, clip 0 to 30 at 1.41 s after the draw (table 1.400 s), fire allowed at the clip end (2.767 s); fire held through the draw fires no shotReload_ZR68Cplays whole (2.51 s) inside the 2.767 s resume; nostudio.cppassertsReloadPhasesdraw, then the normal reload; no resumematch_end=True, 0 assertsFlag-off against master. One script (ZR68C then Tachi: taps, tactical and dry reloads, switches at 0.3 s and 1.0 s)
logged per tick the weapon, clip, in-reload state, viewmodel sequence and next-attack time, on this PR and on master.
The difference between the PR and master is smaller than master's own run-to-run noise: 194 aligned states, one
differing block (a wall-clock race in the script on master), next-attack times equal within one tick at every state
entry. A second pair confirms it; the two PR runs are identical.
Remote view. A bot replayed the owner's inputs (
bot_mimic) and the owner's client rendered it as a remote player.After a switch and the resume draw, the bot's
Reload_ZR68Crestarts on the draw and plays whole. Its sound piecesstart +0.452 s and +0.753 s after the load piece (table: +0.433 s, +0.733 s; the same spacing in layer 03).
cl_showerrorshows no prediction error at the switch, theresume draw, the fill or the end. This used a bot observed by one client, not two human clients.
The only asserts are engine baseline asserts (
m_simThinkListat join, one client shadow-leaf assert); none firesduring a reload.
Known limits
with an enemy within 250 units switches to its secondary then (
EquipBestWeaponForThreat), as intoday's empty reload; its next draw resumes again.
same after 2.217 s.
Later PRs
Resuming after the load and after the cycle, keeping a chambered round (31/30), and partial reloads.
The script block and the phase list are shaped so those add rows and cases, not new syntax.
Toolchain
Linked Issues