fix(vfx): resolve an entity's cell through one owner so effects follow it
Fixes #282 (plan S2). Adds register row AP-133. Retail gives a CPhysicsObj exactly ONE cell: ShouldDrawParticles @0x0050fe60 reads this->cell and calls IsInView on it, and set_cell_id @0x0050f4f0 / change_cell @0x00513390 are the only things that move it. acdream splits that into ParentCellId (render parent, deliberately null for outdoor dat stabs) and EffectCellId (the authored landcell those parentless stabs still need) - an adaptation, now recorded as AP-133. WorldEntity.EffectCellId documents itself as the stab field, with live and interior entities using ParentCellId.f24532adbegan writing it for live entities too. Because EntityEffectPoseRegistry resolved EffectCellId FIRST, that write won - and the audit shows only 3 of 14 cell writers maintain it. The other 11 do not, including the hottest paths: RemotePhysicsUpdater:239,294 and LiveEntityOrdinaryPhysicsUpdater:107 write ParentCellId every physics tick from the snapshot, and LocalPlayerProjectionController:79 writes the local player's cell every frame. So a moving entity updated its cell constantly while EffectCellId stayed frozen at whatever cell it materialized in. Its particles and lights kept being tested against that stale cell and failed IsInView the moment it crossed a boundary - effects vanishing on a monster that is plainly visible, or drawing through a wall from a room the viewer cannot see. The consumers had also drifted into disagreeing: EntityEffectPoseRegistry preferred EffectCellId while WbDrawDispatcher.TryGetEntityCell and the remote spawn seed preferred ParentCellId - two answers to "which cell is this in". - WorldEntity.VisibilityCellId (ParentCellId ?? EffectCellId) is the single accessor; all five consumer sites resolve through it, so the precedence cannot drift apart again. - LiveEntityRuntime's three live-entity EffectCellId writes are removed, restoring the field to its documented purpose. Its real writers - LandblockLoader:80,97 and LandblockBuildFactory:408 - are untouched, and the parentless-stab path is pinned by a new test. - f24532ad's actual fix is preserved: RebucketLiveEntity still installs the committed cell, just on the one field live entities use. LiveEntityLightControllerTests.Refresh_FollowsCurrentTopLevelRootAndCell is back to moving the entity by ParentCellId alone - its original pre-f24532ad form - and passes. CanonicalOnlyRebucket_DoesNotOverwriteAuthoritativeFullCell had its two EffectCellId assertions (added byf24532ad, encoding the defect) replaced with the corrected contract: ParentCellId set, EffectCellId null, VisibilityCellId resolving - a stronger assertion, not a relaxed one. Complete Release solution: 10,836 passed / 4 skipped / 0 failed. User visual check still outstanding: a monster with an active spell effect crossing a cell boundary, and a lit static object, indoors and outdoors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
97d11e6c7f
commit
3c36b4cc21
10 changed files with 134 additions and 29 deletions
|
|
@ -101,6 +101,26 @@ public sealed class WorldEntity
|
|||
/// </summary>
|
||||
public uint? EffectCellId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// #282: the ONE cell this entity occupies, as retail models it. A
|
||||
/// <c>CPhysicsObj</c> has a single <c>cell</c>; <c>ShouldDrawParticles</c>
|
||||
/// @0x0050fe60 reads that same field and calls <c>IsInView</c> on it, and
|
||||
/// <c>set_cell_id</c> @0x0050f4f0 / <c>change_cell</c> @0x00513390 are the
|
||||
/// only things that move it. Our split into
|
||||
/// <see cref="ParentCellId"/> + <see cref="EffectCellId"/> is an
|
||||
/// adaptation for outdoor dat stabs, which keep a null render parent yet
|
||||
/// still need a landcell for particle gating.
|
||||
///
|
||||
/// Resolve through here, never by reading one field or re-deriving the
|
||||
/// precedence at a call site. Live entities carry
|
||||
/// <see cref="ParentCellId"/>, kept current by every per-tick physics and
|
||||
/// network writer; stabs and building shells carry only
|
||||
/// <see cref="EffectCellId"/>. Reading <see cref="EffectCellId"/> FIRST is
|
||||
/// what stranded live entities' particles and lights on their
|
||||
/// materialization cell, because only 3 of 14 cell writers maintain it.
|
||||
/// </summary>
|
||||
public uint? VisibilityCellId => ParentCellId ?? EffectCellId;
|
||||
|
||||
/// <summary>
|
||||
/// True when this entity originates from <c>LandBlockInfo.Buildings[]</c>
|
||||
/// (the dat array that carries building shells: cottage walls, smithy walls,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue