fix(ui): restore radar, retail wield switching, and protection meshes

Late-bind radar snapshots to the canonical LiveEntityRuntime maps so the retained radar survives bootstrap and session replacement instead of capturing empty sentinels.

Route paperdoll drops through the retail AutoWield blocker transaction. Move conflicting held weapons, shields, explicit jewelry destinations, and mismatched ammo to the backpack one authoritative confirmation at a time; preserve compatible arrows when switching to melee.

Render mode-1 and no-degrade particle GfxObjs as their authored modern-pipeline meshes, retain Always2D billboards, interleave both paths back-to-front, balance emitter mesh ownership, and fail safely on corrupt DAT material metadata. This restores the closed apex on Armor Self/protection effects.

Retain Studio fixture controller lifetimes, add installed-DAT and adversarial regression coverage, synchronize retail research/divergence bookkeeping, and pass all three review tracks plus the full Release suite.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-14 20:52:45 +02:00
parent 8d63e5c28a
commit b26f84cc69
26 changed files with 1361 additions and 141 deletions

View file

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
namespace AcDream.App.Rendering;
internal enum ParticleSubmissionKind
{
Billboard,
Mesh,
}
internal readonly record struct ParticleSubmission(
ParticleSubmissionKind Kind,
int DrawIndex,
float DistanceSq,
int Sequence);
/// <summary>
/// Shared ordering for the two retail particle geometry paths. Transparent
/// particles are submitted back-to-front; creation/enumeration order is the
/// deterministic tiebreak so a PES chain does not shuffle at equal distance.
/// </summary>
internal static class ParticleSubmissionOrdering
{
public static void Sort(List<ParticleSubmission> submissions)
{
ArgumentNullException.ThrowIfNull(submissions);
submissions.Sort(static (left, right) =>
{
int distance = right.DistanceSq.CompareTo(left.DistanceSq);
return distance != 0
? distance
: left.Sequence.CompareTo(right.Sequence);
});
}
}
/// <summary>
/// Balances the modern mesh pipeline's reference count against one stable
/// particle-emitter handle. Registration and teardown are idempotent because
/// the renderer sees every live particle, not merely every live emitter.
/// </summary>
internal sealed class ParticleMeshReferenceTracker : IDisposable
{
private readonly Action<uint> _increment;
private readonly Action<uint> _decrement;
private readonly Dictionary<int, uint> _gfxByEmitter = new();
private bool _disposed;
public ParticleMeshReferenceTracker(Action<uint> increment, Action<uint> decrement)
{
_increment = increment ?? throw new ArgumentNullException(nameof(increment));
_decrement = decrement ?? throw new ArgumentNullException(nameof(decrement));
}
public void Register(int emitterHandle, uint gfxObjId)
{
ObjectDisposedException.ThrowIf(_disposed, this);
if (_gfxByEmitter.ContainsKey(emitterHandle))
return;
_gfxByEmitter.Add(emitterHandle, gfxObjId);
_increment(gfxObjId);
}
public void Release(int emitterHandle)
{
if (_disposed || !_gfxByEmitter.Remove(emitterHandle, out uint gfxObjId))
return;
_decrement(gfxObjId);
}
public void Dispose()
{
if (_disposed)
return;
_disposed = true;
foreach (uint gfxObjId in _gfxByEmitter.Values)
_decrement(gfxObjId);
_gfxByEmitter.Clear();
}
}