acdream/tests/AcDream.Core.Tests
Erik 13fcf38138 fix(physics): port retail's find_bbox_cell_list outdoor extent walk (#334)
acdream had never implemented retail's SECOND cell-membership algorithm.
CPhysicsObj::calc_cross_cells @0x00515230 tests HAS_PHYSICS_BSP_PS at
0x00515285 and jumps (0x0051528f jne 0x515305) to find_bbox_cell_list
@0x00510fc0 for a BSP-bearing object; everything below that jump is the
OTHER algorithm, CObjCell::find_cell_list, and that is all we had. Every
object, BSP-bearing or not, was routed through it.

That path's outdoor expansion is a HARD CAP of one cell in each direction.
CellTransit.AddAllOutsideCells computes minRad = radius, maxRad = 24 - radius
and adds at most the eight neighbours of the sphere's own cell, so for any
radius >= 12 m both boundary tests are unconditionally true and the result is
exactly 3x3. Widening the radius or adding a second sphere is mechanically
incapable of adding a tenth cell. The user's live probe measured the
consequence directly: standing inside a Neftet formation, inCell=2 exempt=2
reached=0 -- the geometry was not a candidate at all.

The port. AddAllOutsideCellsFromParts is CLandCell::add_all_outside_cells
@0x00533360 plus add_cell_block @0x005331d0: base landcell from the FIRST
part's own adjust_to_outside, baseX/baseY within-block, each part's authored
CGfxObj::gfx_bound_box re-fit through all eight corners
(BBox::LocalToGlobal @0x005b2120), floor(v / square_length) where
square_length = 0x7c920c = 24.0f, four accumulators seeded to zero, ONE
rectangle unioned across all parts, FILLED, in GLOBAL lcoords so it crosses
landblocks freely, clamped only to [0, 0x7f8).
BuildShadowCellSetFromParts is find_bbox_cell_list's worklist.
RegisterMultiPart dispatches on the same flag retail does, and
BuildFloodSpheres' BSP arm is deleted rather than left unreachable.

Disassembled from the PDB-paired 2013-09-06 binary, not read from Binary
Ninja: BN mis-renders four separate constructs inside add_all_outside_cells
alone -- a dropped `and eax,0xffff` on baseX, a neg/sbb/and select shown as
identically zero, a wrong get_landcell argument, and both x87 flag tests as
`unimplemented {test ah}`.

ShadowPartGeometry pairs the BSP root sphere with the authored box so no
resolver can answer one and leave the other call site to synthesize a
substitute -- the AP-156 invariant applied a second time, since that split is
what produced AP-156 and then this. The box comes from
FlatGfxObjVisualBounds, already computed by exactly CGfxObj::init_end's
algorithm and already in the prepared package: no bake change, no DAT re-read.

Cost, measured over the installed DATs before any code was written: 1,258
physics-BSP GfxObjs, cells/object p50 4, p90 4, p99 12, max 49. The port is
CHEAPER than the old 3x3 = 9 for 98.97% of them. Row totals (shapes x cells)
over all 1,031 landblocks with BSP owners fall 97,173 -> 15,607 (0.161x);
dense Arwic 0xC6A9 falls 342 -> 43. One landblock more than doubles.

Precondition confirmed before pinning any expected cell set: 0x010046D8's box
is 96 m x 96 m about cell (2,2) = 0x87640013, which independently corroborates
the 3x3-centred-there diagnosis, and its rectangle does contain 0x87640011 and
0x87640019 -- the two cells the probe measured empty.

Register: AP-156's outdoor half CLOSED and its risk column CORRECTED (it read
"extra broadphase candidates, never a missed one", which generalised the indoor
direction to the whole row and is why #334 sat inside it unnoticed). AP-159 +
issue #335 file the unported indoor arm; AD-49 records the seed-time rectangle.
Issue #336 files a fourth load-sensitive test flake seen once during the gate.

Ten tests, every one sabotage-verified in both directions across eight
mutations (dispatch, 8-corner refit, floor-vs-truncation, union-vs-per-part,
map clamp, adjust guard, landblock clamp, box-path-for-everything). The
strongest is an installed-DAT replay of the user's own probe evidence.
Suite 11,208 -> 11,218 passed / 4 skipped / 0 failed; the +10 is exactly the
new tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-06 19:07:06 +02:00
..
Allegiance feat(allegiance): Phase H.2 AllegianceRequests + AllegianceTree model 2026-04-18 17:17:45 +02:00
Audio feat(core): adopt retail's SoundType catalog; retire AC2D 2026-07-29 07:38:56 +02:00
Chat fix(chat): display retail's text for WeenieError 0x0504 and three PK siblings 2026-08-03 22:20:31 +02:00
Combat fix(combat): #298 — admit player targets to melee/missile attack and the camera 2026-08-03 21:29:15 +02:00
Conformance refactor(pipeline): MP1a cleanup - narrow public surface, csproj parity, move residue 2026-07-05 20:52:01 +02:00
Fixtures fix(physics): enforce retail step-down support radius (#273) 2026-07-31 12:10:03 +02:00
Input refactor(physics): delete legacy PhysicsEngine.Resolve/ResolvePlacement/HasCellSurface (C5a, AP-1/AD-1) 2026-08-05 14:11:31 +02:00
Items fix(physics): #297 — keep the PWD bitfield live so PK status reaches the client 2026-08-03 20:59:01 +02:00
Lighting perf(lighting): bound global light selection 2026-07-25 05:40:32 +02:00
Meshing feat(vfx): bind effects to live animated poses 2026-07-14 10:56:01 +02:00
Physics fix(physics): port retail's find_bbox_cell_list outdoor extent walk (#334) 2026-08-06 19:07:06 +02:00
Player feat(player): port retail augmentation stat chain 2026-07-31 08:08:23 +02:00
Plugins fix(rendering): bound portal resource lifetime 2026-07-18 21:35:16 +02:00
Properties feat(core): adopt retail's full WeenieError code table 2026-07-29 07:33:27 +02:00
Rendering fix(physics): validate retail cell containment roots 2026-07-31 14:48:26 +02:00
Selection refactor(net): converge live session state reset 2026-07-21 12:00:48 +02:00
Social refactor(net): converge live session state reset 2026-07-21 12:00:48 +02:00
Spells merge: #267 vitae character-panel display (attributes vitae-immune per retail; skill dual parentheticals) 2026-07-30 18:14:48 +02:00
Streaming fix(test): stop the streaming priority-apply tests reading a warm JIT 2026-07-28 18:09:08 +02:00
Terrain fix #108-residual (root cause): terrain drew DOUBLE-SIDED - port retail landPolysDraw eye-side gate as terrain backface cull 2026-06-12 22:05:31 +02:00
Textures fix(render): keep authored surface translucency on composite textures 2026-07-29 21:40:26 +02:00
Ui feat(chat): port retail client command families 2026-07-13 14:50:15 +02:00
Vfx fix(vfx): classify hardwareless particle emitters once 2026-07-27 00:03:44 +02:00
World fix(physics): validate retail cell containment roots 2026-07-31 14:48:26 +02:00
AcDream.Core.Tests.csproj test: fix PhysicsResolveCapture/PhysicsDiagnostics static-leak isolation 2026-06-02 15:20:24 +02:00
GlobalUsings.cs refactor(runtime): own local movement and outbound cadence 2026-07-26 12:33:53 +02:00
SmokeTest.cs chore: phase 1 — add Core, Abstractions, App, Tests projects 2026-04-10 09:22:33 +02:00
xunit.runner.json test: fix PhysicsResolveCapture/PhysicsDiagnostics static-leak isolation 2026-06-02 15:20:24 +02:00