feat(selection): port retail offscreen target indicator
This commit is contained in:
parent
ea4f52ec51
commit
ec1bb19609
9 changed files with 404 additions and 97 deletions
|
|
@ -2294,7 +2294,6 @@ public sealed class GameWindow : IDisposable
|
|||
() => _playerServerGuid,
|
||||
() => _persistedGameplay.VividTargetingIndicator,
|
||||
ResolveVividTargetInfo,
|
||||
guid => _retailSelectionScene?.WasVisible(guid) == true,
|
||||
GetSelectionCamera),
|
||||
Indicators: new AcDream.App.UI.IndicatorRuntimeBindings(
|
||||
SpellBook,
|
||||
|
|
@ -13667,7 +13666,7 @@ public sealed class GameWindow : IDisposable
|
|||
|
||||
private AcDream.App.UI.Layout.VividTargetInfo? ResolveVividTargetInfo(uint guid)
|
||||
{
|
||||
if (!_visibleEntitiesByServerGuid.ContainsKey(guid)
|
||||
if (!_entitiesByServerGuid.ContainsKey(guid)
|
||||
|| !TryGetEntitySelectionSphere(guid, out var center, out float radius))
|
||||
return null;
|
||||
|
||||
|
|
@ -13715,17 +13714,25 @@ public sealed class GameWindow : IDisposable
|
|||
worldCenter = default;
|
||||
worldRadius = 0f;
|
||||
|
||||
if (!_visibleEntitiesByServerGuid.TryGetValue(guid, out var entity)) return false;
|
||||
if (!LastSpawns.TryGetValue(guid, out var spawn)) return false;
|
||||
if (spawn.SetupTableId is not uint setupId) return false;
|
||||
if (_dats is null) return false;
|
||||
if (!_dats.TryGet<DatReaderWriter.DBObjs.Setup>(setupId, out var setup)) return false;
|
||||
if (!_entitiesByServerGuid.TryGetValue(guid, out var entity)) return false;
|
||||
|
||||
// SmartBox::GetObjectBoundingBox @ 0x00452E20 installs a 0.1-unit
|
||||
// origin sphere when CPhysicsObj::GetSelectionSphere has no authored
|
||||
// Setup sphere. Preserve that presentation for every materialized
|
||||
// object rather than dropping the marker entirely.
|
||||
worldCenter = entity.Position;
|
||||
worldRadius = 0.1f;
|
||||
if (!LastSpawns.TryGetValue(guid, out var spawn)
|
||||
|| spawn.SetupTableId is not uint setupId
|
||||
|| _dats is null
|
||||
|| !_dats.TryGet<DatReaderWriter.DBObjs.Setup>(setupId, out var setup))
|
||||
return true;
|
||||
|
||||
// DAT Setup carries `SelectionSphere` (Origin + Radius). A zero
|
||||
// radius means the Setup didn't bake one — fall back to the
|
||||
// caller's other path.
|
||||
// radius means the Setup did not author one, so retain the retail
|
||||
// 0.1-unit fallback installed above.
|
||||
var sel = setup.SelectionSphere;
|
||||
if (sel is null || sel.Radius <= 1e-4f) return false;
|
||||
if (sel is null || sel.Radius <= 1e-4f) return true;
|
||||
|
||||
// Retail GetSelectionSphere applies part-array scale to the
|
||||
// sphere center (component-wise) and to the radius (Z-scale
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue