Gauges: fix blank per-weapon loop/generator lamps (4A/1B/5D boxes)
The SubsystemCluster per-weapon MFD panels render two image-strip lamps in the TEMP/STATUS area: the cooling-loop number (btploop, 1..6) and the generator letter (btpbus, A..D). Both drew as completely empty boxes. Three stacked databinding bugs, all now fixed: 1. Color drop (btl4gau2.cpp): AnimatedSubsystemLamp/AnimatedSourceLamp ctors dropped the bg/fg color params the binary passes (bg=0xff,fg=0, same as the neighboring temp bar) and hardcoded 0,0 -> OneOfSeveral:: Execute did SetColor(0)+DrawBitMapOpaque(0), i.e. black-on-black. Restored 0xff,0 (verified vs @004c70a4 / caller SubsystemCluster @004c8140). 2. Shadow-field trap (btl4gau2.hpp, gotcha #2): both lamp classes re-declared `int selected;` while already inheriting it from OneOfSeveral (@0xAC). The CoolingLoop/PowerSource connection wrote the derived shadow copy while OneOfSeveral::Execute read the base @0xAC (always 0) -> every lamp stuck on frame 0 ("OFF"). Removed the redeclarations so &selected binds the inherited member. Loop numbers now render (verified: PPC->4, Myomers->5, ERMLaser->1/6, etc.). 3. Attribute-table shift (powersub.cpp + btl4gau2.cpp, gotcha #8): the generator-letter lamp resolved its source via ResolveLink(AttributePointerOf(subsystem,"InputVoltage")), but the BT_DEV_GAUGES audio attribute rows shifted the chained attribute ids so AttributePointerOf no longer landed on voltageSource@0x1D0 -> the link always resolved to 0 (OFF) even though the master PoweredSubsystem ctor DID bind voltageSource to its Generator. New BTPowerSourceFrame bridge reads the NAMED member via PoweredSubsystem::ResolveVoltageSource() and returns Generator::generatorNumber (@0x1E0), bypassing the attribute table -- the same pattern as the BTCoolingLoopFrame fix. Generator letters now render (verified: PPC_1->GeneratorA="A", Myomers-> GeneratorD="D", SRM6->GeneratorB="B"). Result: the "4 A / 1 B / 5 D" boxes render with both the loop number and generator letter, matching the reference. Kept BT_LOOP_LOG-gated [loopfeed]/[busfeed] feed diagnostics; both pod + glass builds clean. Awaiting live playtest verification. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
c79b9953f9
commit
e634709e5d
@@ -663,6 +663,60 @@ Subsystem *
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// BTPowerSourceFrame -- complete-type bridge for the AnimatedSourceLamp
|
||||
// (btpbus/btebus generator-letter lamp). The binary's PowerSourceConnection
|
||||
// sampler (@004c3258) resolves the subsystem's InputVoltage link and reads
|
||||
// resolved+0x1E0 == Generator::generatorNumber (1..4 -> btpbus frames A..D; 0
|
||||
// == OFF).
|
||||
//
|
||||
// The port cannot reproduce the binary's path -- it walked
|
||||
// ResolveLink( AttributePointerOf(subsystem,"InputVoltage") )
|
||||
// but AttributePointerOf now returns the WRONG slot: the BT_DEV_GAUGES audio
|
||||
// attribute rows shifted the chained attribute ids, so the name->pointer lookup
|
||||
// no longer lands on voltageSource@0x1D0 (the same regression that broke the
|
||||
// CoolingLoop lamp -- see btl4gau2.cpp). The link therefore always resolved to
|
||||
// 0 and every generator lamp drew frame 0 ("OFF") even though the master
|
||||
// PoweredSubsystem ctor DID bind voltageSource to its Generator.
|
||||
//
|
||||
// This bridge takes the subsystem directly and reads the NAMED member via
|
||||
// PoweredSubsystem::ResolveVoltageSource() (voltageSource.Resolve()), bypassing
|
||||
// the attribute table entirely -- exactly the BTCoolingLoopFrame pattern.
|
||||
//
|
||||
int BTPowerSourceFrame(void *subsystem_v)
|
||||
{
|
||||
static int s_log = -1;
|
||||
if (s_log < 0) s_log = getenv("BT_LOOP_LOG") ? 1 : 0;
|
||||
static int s_n = 0;
|
||||
int trace = s_log && (s_n++ < 40);
|
||||
|
||||
Subsystem *sub = (Subsystem *)subsystem_v;
|
||||
if (sub == 0 || !sub->IsDerivedFrom(*PoweredSubsystem::GetClassDerivations()))
|
||||
{
|
||||
if (trace) DEBUG_STREAM << "[busfeed] " << (sub ? sub->GetName() : "(null)")
|
||||
<< " -> 0 (not a PoweredSubsystem)\n" << std::flush;
|
||||
return 0;
|
||||
}
|
||||
Generator *gen = (Generator *)((PoweredSubsystem *)sub)->ResolveVoltageSource();
|
||||
if (gen == 0)
|
||||
{
|
||||
if (trace) DEBUG_STREAM << "[busfeed] " << sub->GetName()
|
||||
<< " -> 0 (voltageSource unbound)\n" << std::flush;
|
||||
return 0;
|
||||
}
|
||||
if (gen->GetClassID() != RegisteredClass::GeneratorClassID)
|
||||
{
|
||||
if (trace) DEBUG_STREAM << "[busfeed] " << sub->GetName()
|
||||
<< " -> 0 (source not a Generator)\n" << std::flush;
|
||||
return 0;
|
||||
}
|
||||
int frame = gen->generatorNumber; // @0x1E0 (A..D)
|
||||
if (trace) DEBUG_STREAM << "[busfeed] " << sub->GetName() << " -> frame " << frame
|
||||
<< " (generator '" << gen->GetName() << "')\n" << std::flush;
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
||||
//#############################################################################
|
||||
// Voltage-source linkage helpers
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user