Cockpit: the COOLANT VALVE control -- the heat-management triad completes (task #13)

The pilot's third heat tool: Condenser::MoveValve (id 4, the Condenser handler
table @0x50E52C -- PE-verified, exactly one entry) registered via the
order-proof function-local accessor and GUARDED by the real FUN_004ac9c8
(task #12's BTPlayerRoleLocksAdvanced rookie-role bridge -- the old deferral
note blamed the 0xBD3 messmgr, a stale misattribution, swept).  Each press
cycles the valve 1 -> 5 -> 50 -> 0 -> 1 and RecomputeCondenserValves re-shares
the fixed total coolant flow across all six condensers -- opening one valve
wide starves the others: the pilot's cooling-triage lever.

Desktop: 'C' cycles the selected condenser's valve (BT_VALVE_SLOT picks the
roster slot; default Condenser1).  BT_VALVE_TEST scripts a headless press.

Verified live: press -> "[valve] condenser#1 valveState=5 flow=0.5 (total=10)"
-- exactly the authored redistribution math (5/(5+5x1)), through the real
role gate.

The heat-management triad is now complete and all-authentic:
  G + fire buttons  = regroup weapons across buttons     (task #6)
  F5-F8 / F9        = reassign weapon generators / mode  (task #12)
  C                 = coolant valve triage               (task #13)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-11 23:33:27 -05:00
co-authored by Claude Fable 5
parent d7b900d108
commit 80cadc98c7
5 changed files with 112 additions and 25 deletions
+58
View File
@@ -647,6 +647,7 @@ static int gBTMissileKey = 0;
static int gBTConfigKey = 0; // task #6: HOLD 'G' = the weapon-configure button
static int gBTGenSelKey = 0; // task #12: F5..F8 = SelectGeneratorA..D, F9 = mode toggle
// (0 idle; else the message id 4..8)
static int gBTValveKey = 0; // task #13: 'C' = MoveValve on the selected condenser
// Damage: each shot dispatches a REAL Entity::TakeDamageMessage to the target. Now
// that the damage zones are constructed (mech.cpp Pass-3 zone build), the engine base
@@ -1540,6 +1541,9 @@ void
: (focused && (pAsync(0x77 /*F8*/) & dn)) ? 7
: (focused && (pAsync(0x78 /*F9*/) & dn)) ? 8
: 0;
// task #13: 'C' cycles the coolant valve (BT_VALVE_SLOT
// picks the condenser roster slot; default = Condenser1).
gBTValveKey = focused && (pAsync('C') & dn) ? 1 : 0;
// gBTDrive.fire = "any weapon trigger down" (feeds the bring-up
// damage dispatcher + the beam-visual keepalive)
gBTDrive.fire = (gBTLaserKey || gBTPPCKey || gBTMissileKey) ? 1 : 0;
@@ -3123,6 +3127,60 @@ void
gBTGenSelKey = (s_gsFrame >= 600 && s_gsFrame < 610) ? 7 : 0;
}
// task #13 scripted verify (BT_VALVE_TEST=1): one MoveValve press at
// frame ~600 -- Condenser1's valveState cycles 1 -> 5, so the flow
// redistribution gives it 5/10 of the total coolant flow ([valve] log
// + its bank conduction speeds up 5x).
if ((Entity *)this == application->GetViewpointEntity()
&& getenv("BT_VALVE_TEST"))
{
static int s_vtFrame = 0;
++s_vtFrame;
gBTValveKey = (s_vtFrame >= 600 && s_vtFrame < 610) ? 1 : 0;
}
// task #13 dev harness: the COOLANT VALVE lever. 'C' edge -> dispatch
// MoveValve (id 4, the Condenser table @0x50E52C) to the selected
// condenser -- the same press payload the pod's engineering-screen aux
// buttons deliver.
if ((Entity *)this == application->GetViewpointEntity())
{
static int s_prevValve = 0;
if (gBTValveKey != s_prevValve)
{
s_prevValve = gBTValveKey;
if (gBTValveKey != 0)
{
Subsystem *condenser = 0;
const char *slotEnv = getenv("BT_VALVE_SLOT");
int wantSlot = (slotEnv != 0) ? atoi(slotEnv) : -1;
for (int s = 1; s < GetSubsystemCount(); ++s)
{
Subsystem *sub = GetSubsystem(s);
if (sub == 0)
continue;
if (wantSlot >= 0 ? (s == wantSlot)
: ((int)sub->GetClassID() == 0xBBD)) // Condenser
{
condenser = sub;
break;
}
}
if (condenser != 0)
{
if (getenv("BT_FIRE_LOG"))
DEBUG_STREAM << "[valve-tx] MoveValve -> "
<< condenser->GetName() << std::endl;
ReceiverDataMessageOf<ControlsButton> msg(
4 /*Condenser::MoveValveMessageID*/,
sizeof(ReceiverDataMessageOf<ControlsButton>),
(ControlsButton)1 /*press*/);
condenser->Dispatch(&msg);
}
}
}
}
// task #12 dev harness: the POWER-ROUTING buttons. F5..F9 edge ->
// dispatch SelectGeneratorA..D / ToggleGeneratorMode (ids 4..8) to the
// selected weapon -- the same ReceiverDataMessageOf<ControlsButton>