mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
ClassicAPI extension (retail has no such global): true if the player has clear LoS to unit, false if world geometry blocks it, nil when the check can't apply (absent/unresolvable token, or non-unit object). Traces a ray between the two units through the client's world-collision core CWorld::Intersect (0x672170, verified in-binary: __fastcall(start, end, unused, hitOut, tOut, flags), tail-calls the real intersect FUN_0069BFF0). Flags 0x100111 = terrain + WMO (0x100171 also tests M2 doodads but crashes in some dungeons; matches vanilla server LoS which ignores doodads). Endpoints are raised by each unit's collision-box height (CMovement+0xB4) so foot-to-foot rays don't false-block on terrain, with a two-pass level/look-up trace for height mismatches and a 150yd guard against a long-segment crash. Mirrors UnitXP_SP3's proven implementation (same VA, flags, guard, and two-pass logic) but native, so it works with or without that addon -- we call the intersect rather than hooking it, and our flag isn't one UnitXP_SP3's detour acts on. Gated on object type (unit/player) so it never reads CMovement off a GameObject. Adds FUN_CWORLD_INTERSECT, OFF_CMOVEMENT_COLLISION_BOX_HEIGHT, OFF_CGOBJECT_TYPE_ID, OBJECT_TYPE_UNIT/PLAYER (reuses the existing OFF_UNIT_MOVEMENT_INFO_PTR = 0x118), plus API.md and README entries.