gauges: register + wire the map (radar) -- the tactical display renders

MapDisplay (the radar/threat-map gauge, btl4rdr.cpp) was fully reconstructed
(ctor + Execute + DrawViewWedge/DrawStatic/DrawMoving/DrawNames) but never
registered and its data attributes never published.  Wire it up end-to-end:

DATA (the attributes the map binds):
* Mech table extended to the full 0x15..0x38 (was the 0x21 prefix): add
  RadarRange@0x2f -> radarRange, RadarLinearPosition@0x30 -> radarLinearPosition
  (Point3D* -> &localOrigin.linearPosition), RadarAngularPosition@0x31 ->
  radarAngularPosition (Quaternion* -> &localOrigin.angularPosition), DuckState
  @0x37 -> duckState; the rest bind the shared attrPad (kept dense so Find can't
  strcmp a gap).  New members set in the Mech ctor; radarRange defaults to 500
  (SetTargetRange is still stubbed) so nearby contacts are on-scale.  The map's
  position/angle attributes resolve to Point3D**/Quaternion** (AttributePointer
  is int Simulation::*, so the ATTRIBUTE_ENTRY reinterpret binds pointer members
  fine -- verified live: posPtr/anglePtr resolve).
* Sensor (named "Avionics") publishes RadarPercent/SelfTest/BadVoltage: define
  Sensor::AttributePointers[] + build the previously-empty Sensor::AttributeIndex
  chained to PoweredSubsystem::GetAttributeIndex() (= HeatSink's dense index).

WIDGET (the registration glue -- NOT in the assert-anchored decomp, so
reconstructed from the config + ctor):
* MapDisplay::methodDescription (config "map") + MapDisplay::Make.  The
  offset_position keyword "center"/"bottom" is typed as a STRING and converted
  in Make, avoiding a ModeManager named-constant registration.  Registered in
  BTL4MethodDescription[] (btl4grnd.cpp now includes btl4rdr.hpp).

Three crash fixes exposed once the map ran (each a pre-existing stub the map is
the first consumer of):
* Sensor radarPercent went hugely negative (RadarBaseline - HeatMasterEnergy(),
  where the inherited heatEnergy is un-normalized in the not-byte-exact heat-leaf
  branch) -> the radar reported non-operational.  Guard: treat an out-of-[0,1]
  heat term as no penalty (marked bring-up; real overheat penalty needs the heat
  normalization).
* ResolveOperatorEntity was a stub returning NULL -> EntityPosition(NULL) crashed
  CalculateBounds.  Fixed to the renderer linked-entity + application viewpoint
  fallback (same as HeadingPointer).
* MapName::ExtractFromEntity didn't guard a NULL entity (the binary's Verify(False)
  iterator-mismatch path compiles out at DEBUG_LEVEL 0) -> EntityPosition(NULL).
  Guarded.

Verified live (BT_DEV_GAUGES): the radar now draws the view wedge (the mech's
180-deg FOV cone) and completes the full wedge/static/moving/names cycle with
operating=1, cap=1, scale=500, position/angle resolved, 0 crashes.  Combat un-
regressed (TARGET DESTROYED after 8 hits), heap-clean under BT_HEAPCHECK.
Permanent gated diagnostic: BT_MAP_LOG traces the phase/draw pipeline.  Contacts
show 0 (the spatial-query entity classification is a follow-up); DuckState now
resolves for the duck button too.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-06 21:16:29 -05:00
co-authored by Claude Opus 4.8
parent eae631ba04
commit 48ed3a8b73
5 changed files with 181 additions and 7 deletions
+30 -1
View File
@@ -426,7 +426,30 @@ const Mech::IndexEntry
ATTRIBUTE_ENTRY(Mech, FootStep, attrPad), // 0x1e
ATTRIBUTE_ENTRY(Mech, AnimationState, attrPad), // 0x1f
ATTRIBUTE_ENTRY(Mech, ReplicantAnimationState, attrPad), // 0x20
ATTRIBUTE_ENTRY(Mech, LinearSpeed, linearSpeed) // 0x21 (live forward speed)
ATTRIBUTE_ENTRY(Mech, LinearSpeed, linearSpeed), // 0x21 (live forward speed)
ATTRIBUTE_ENTRY(Mech, ClimbRate, attrPad), // 0x22
ATTRIBUTE_ENTRY(Mech, AccelerationLastFrame, attrPad), // 0x23
ATTRIBUTE_ENTRY(Mech, AngularSpeed, attrPad), // 0x24
ATTRIBUTE_ENTRY(Mech, ArmorDamageLevel, attrPad), // 0x25
ATTRIBUTE_ENTRY(Mech, SubsystemDamageLevel, attrPad), // 0x26
ATTRIBUTE_ENTRY(Mech, MyomerDamageLevel, attrPad), // 0x27
ATTRIBUTE_ENTRY(Mech, TestButton1, attrPad), // 0x28
ATTRIBUTE_ENTRY(Mech, TestButton2, attrPad), // 0x29
ATTRIBUTE_ENTRY(Mech, TestButton3, attrPad), // 0x2a
ATTRIBUTE_ENTRY(Mech, TestButton4, attrPad), // 0x2b
ATTRIBUTE_ENTRY(Mech, TestButton5, attrPad), // 0x2c
ATTRIBUTE_ENTRY(Mech, TestButton6, attrPad), // 0x2d
ATTRIBUTE_ENTRY(Mech, ReduceButton, attrPad), // 0x2e
ATTRIBUTE_ENTRY(Mech, RadarRange, radarRange), // 0x2f (radar scale)
ATTRIBUTE_ENTRY(Mech, RadarLinearPosition, radarLinearPosition), // 0x30 (Point3D* -> localOrigin)
ATTRIBUTE_ENTRY(Mech, RadarAngularPosition, radarAngularPosition),// 0x31 (Quaternion* -> localOrigin)
ATTRIBUTE_ENTRY(Mech, RearFiring, attrPad), // 0x32
ATTRIBUTE_ENTRY(Mech, RequestDuckAnimation, attrPad), // 0x33
ATTRIBUTE_ENTRY(Mech, UnstablePercentage, attrPad), // 0x34
ATTRIBUTE_ENTRY(Mech, SuperStop, attrPad), // 0x35
ATTRIBUTE_ENTRY(Mech, IncomingLock, attrPad), // 0x36
ATTRIBUTE_ENTRY(Mech, DuckState, duckState), // 0x37 (crouch posture, int)
ATTRIBUTE_ENTRY(Mech, DistanceToMissile, attrPad) // 0x38
};
Mech::AttributeIndexSet&
@@ -572,6 +595,12 @@ Mech::Mech(
sensorSubsystem = 0; // this[0x1f7] (0xBBE) -- same hazard, zero it too
attrPad = 0.0f; // shared read pad for un-populated gauge attributes
linearSpeed = 0.0f; // live forward ground speed (LinearSpeed gauge); set per frame
radarRange = 500.0f; // radar display scale (SetTargetRange is stubbed;
// 500m default zoom so nearby contacts are visible,
// vs the config maximum_range=4000 outer detection edge)
radarLinearPosition = &localOrigin.linearPosition; // map reads the mech's live world position...
radarAngularPosition= &localOrigin.angularPosition; // ...and orientation (pointers into the base origin)
duckState = 0; // not crouching
ZeroBlock(this + 0xca, 6); // this[0xca..0xcf] = 0
ZeroBlock(this + 0x153, 6); // this[0x153..0x158] = 0