Both OP4 reviews converged on one headline bug (Character-tab rows never re-read live server truth after their pre-login constructor-word seed) plus overlapping MUST-FIXes. All ten converged/consolidated findings land here: MUST-FIX: - BoolOptionRow.SaveCurrentValue now re-reads its live binding (retail's GetValue()-into-SaveCurrentValue) on every OnShown — panel open, tab switch in, initial activation — instead of trusting the pre-login constructor word it was built with. Reset/tab-switch can now only restore values that were actually live at the last show. LockUI's host.Root.UiLocked one-shot mount seed now also converges on every PlayerDescription via the existing OnCharacterOptionsChanged hook. - Apply/Reset are wired to OptionPage.OnOptionChanged in production (Ghosted when nothing changed, Normal when dirty, run once at bind so both start disabled per retail's PostInit); Defaults stays ungated. - The Combat panel's three LEDs (Repeat Attacks/Auto Target/Keep in View) now read/write the same RuntimeCharacterOptionsState seam the Character tab uses instead of a disconnected client-local GameplaySettings copy — closes the "two writable copies" divergence. The three now-orphaned GameplaySettings fields and RuntimeSettingsController's mirror properties/SetCombatGameplay are deleted outright; the headless host's hardcoded AutoRepeatAttack/AutoTarget now read the live option bit. - RuntimeSettingsController.SetUiLocked's convergence guard now compares against the last value actually applied to the runtime target instead of the persisted GameplaySettings.LockUI snapshot, which could already match a server-derived request without ever having been pushed. SHOULD-FIX: - DisplayTimeStamps now prefixes every chat producer (ChatLog.Append is the one seam all of them funnel through), not just AddText's own callers — heard speech, emotes, Turbine channels, and combat text were previously missed. The prefix format escapes its colons and forces InvariantCulture instead of the culture-dependent TimeSeparator placeholder. - sky.frag now honors uFogParams.w (fog mode) like the mesh/terrain shaders, so Disable Distance Fog stops the sky dome's horizon band from blending toward fog color too. - Corrected the "byte-verified" overclaim on the timestamp format string doc comment (BN-sourced, wire doc U6) and the AP-194 anchor-column class-name typo; the RunAsDefaultMovement doc comments now cite retail's actual acclient.h enumerator name. - Added: DispatcherMovementInputSource's option x modifier truth table (incl. || AutoRunActive with the option off), the per-page Apply/Reset enable-gate tests, a real checkbox.OnClick/ToggleBehavior-driven click test, and hash-pins for the six header string keys. - Gate script step 8 corrected for the logout-flush false-failure (closing the panel before relogging is load-bearing); a new step documents the enable-gate sequence and the Combat-panel/Character-tab cross-check. Register: AP-196 (the Group-C default-source change + GameplaySettings retirement) and AP-197 (the ignored per-character timestamp format override) filed in this commit. Full Release suite: 13,044 passed / 4 skipped / 0 failed (was 13,008/4/0; net +36 tests from new coverage and legitimate assertion updates from the GameplaySettings retirement). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
119 lines
4.9 KiB
C#
119 lines
4.9 KiB
C#
using AcDream.UI.Abstractions.Input;
|
|
|
|
namespace AcDream.App.Input;
|
|
|
|
internal interface IMovementInputSource
|
|
: IRuntimeMovementInputSource
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Samples held graphical input and maps press edges onto the Runtime-owned
|
|
/// retail autorun latch. The dispatcher remains the only physical
|
|
/// keyboard/mouse-button state source.
|
|
/// </summary>
|
|
internal sealed class DispatcherMovementInputSource : IMovementInputSource
|
|
{
|
|
private readonly RuntimeLocalPlayerMovementState _movement;
|
|
private readonly IInputCaptureSource? _capture;
|
|
private InputDispatcher? _dispatcher;
|
|
|
|
public DispatcherMovementInputSource(
|
|
RuntimeLocalPlayerMovementState movement,
|
|
IInputCaptureSource? capture = null)
|
|
{
|
|
_movement = movement ?? throw new ArgumentNullException(nameof(movement));
|
|
_capture = capture;
|
|
}
|
|
|
|
public bool AutoRunActive => _movement.AutoRunActive;
|
|
public bool IsAvailable => _dispatcher is not null;
|
|
|
|
public void Bind(InputDispatcher dispatcher)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(dispatcher);
|
|
if (_dispatcher is not null && !ReferenceEquals(_dispatcher, dispatcher))
|
|
throw new InvalidOperationException(
|
|
"The movement input source is already bound to another dispatcher.");
|
|
_dispatcher = dispatcher;
|
|
}
|
|
|
|
public void Unbind(InputDispatcher dispatcher)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(dispatcher);
|
|
if (ReferenceEquals(_dispatcher, dispatcher))
|
|
_dispatcher = null;
|
|
}
|
|
|
|
public MovementInput Capture()
|
|
{
|
|
// Devtools owns the whole gameplay keyboard while active, including
|
|
// a latched autorun. Retained chat owns physical key state only;
|
|
// retail's autorun latch continues until an explicit cancel action.
|
|
if (_capture?.DevToolsWantCaptureKeyboard == true)
|
|
return default;
|
|
|
|
if (_movement.HasCommandInput)
|
|
return _movement.CommandInput;
|
|
|
|
if (_dispatcher is not { } dispatcher)
|
|
return default;
|
|
|
|
bool walking = dispatcher.IsActionHeld(InputAction.MovementWalkMode);
|
|
bool forward = dispatcher.IsActionHeld(InputAction.MovementForward);
|
|
return new MovementInput(
|
|
Forward: forward || AutoRunActive,
|
|
Backward: dispatcher.IsActionHeld(InputAction.MovementBackup),
|
|
StrafeLeft: dispatcher.IsActionHeld(InputAction.MovementStrafeLeft),
|
|
StrafeRight: dispatcher.IsActionHeld(InputAction.MovementStrafeRight),
|
|
TurnLeft: dispatcher.IsActionHeld(InputAction.MovementTurnLeft),
|
|
TurnRight: dispatcher.IsActionHeld(InputAction.MovementTurnRight),
|
|
// Movement parity audit (2026-07-30): retail's autorun hard-forces
|
|
// Run for its whole duration (ACCmdInterp autorun dispatch always
|
|
// sends RunForward-class state); the live walk/run toggle only
|
|
// applies to ordinary held-key movement. Recomputing `!walking`
|
|
// unconditionally let a walk-mode toggle demote an active autorun
|
|
// to walking — impossible in retail.
|
|
//
|
|
// Campaign OP slice OP4 (2026-08-11): `!walking` was a hardcoded
|
|
// "run by default" assumption. Retail PlayerOption id 0xA
|
|
// (acclient.h's ToggleRun_PlayerOption — ACE calls the same bit
|
|
// RunAsDefaultMovement; N7, OP4 review-fix round 2026-08-11)
|
|
// (retail default ON, matching the prior hardcoded behavior
|
|
// exactly) now supplies the default; the walk-mode modifier
|
|
// still temporarily INVERTS whichever default is active, same
|
|
// as before.
|
|
Run: (_movement.RunAsDefaultMovement != walking) || AutoRunActive,
|
|
Jump: dispatcher.IsActionHeld(InputAction.MovementJump));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Applies the press-only autorun policy at the same point in the semantic
|
|
/// action pipeline as the former GameWindow body.
|
|
/// </summary>
|
|
/// <returns>True when the action is fully consumed.</returns>
|
|
public bool HandlePressedAction(InputAction action)
|
|
{
|
|
if (action == InputAction.MovementRunLock)
|
|
return _movement.Execute(
|
|
AcDream.Runtime.RuntimeMovementCommand.ToggleRunLock);
|
|
|
|
if (AutoRunActive && action is (
|
|
// Movement parity audit (2026-07-30): retail's
|
|
// ACCmdInterp::HandleNewForwardMovement drops autorun on EVERY
|
|
// fresh forward press edge, not only on backward/stop/strafe —
|
|
// a new W press while autorunning hands control back to the key.
|
|
InputAction.MovementForward
|
|
or InputAction.MovementBackup
|
|
or InputAction.MovementStop
|
|
or InputAction.MovementStrafeLeft
|
|
or InputAction.MovementStrafeRight))
|
|
{
|
|
_movement.CancelAutoRun();
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public void ResetSession() => _movement.ResetInputIntent();
|
|
}
|