Files
BT411/game/reconstructed/btinput.hpp
T
arcattackandClaude Fable 5 2ae9bd43ae Coolant Flush end-to-end (Gitea #7): InjectCoolant id-4 handler + drain + FLUSH.PFX cloud + 'H' key
The playtest report (sound plays, no gauge drop, no cloud) traced to the
Reservoir's InjectCoolant chain being dead in three places:

- The handler was never REGISTERED: the binary's Reservoir handler table
  @0x50e680 has one entry {4, "InjectCoolant", @4aee70}; added
  Reservoir::GetMessageHandlers + the press/release handler (press starts
  the flush gated on coolantLevel@0x12C > 0 -- the old body misread +0x12C
  as currentTemperature; release stops it; novice lockout via FUN_004ac9c8).

- Reservoir::InjectCoolant (@4aefa4, 1019 bytes) was an empty stub -- the
  drain the coolant gauge reads.  Reconstructed in full: work list =
  condenser/weapon/heatable chains (+0x7cc/+0x7bc/+0x7ac, roster-walk
  emulation with the binary's duplicate-visit weighting; HeatSink-filtered
  [T2 guarded]) + the linked master sink; per sink with flowScale != 0 move
  squirtMass x flowScale x dt (clamped to the tank / sink capacity) and
  credit pendingHeat with the negative carried-heat delta capped at
  sinkMass x reservoir startingTemperature -- the set%-biased flush of the
  manual (p24), riding the existing heat model.

- Two latent ctor decode bugs surfaced and fixed: the master gate @4af408
  (and @4aeb40 HeatWatcher, swept) reads the OWNER MECH's simulationFlags
  (*(param_2+0x28)), not the resource's subsystemFlags (the misread left
  the CoolantSimulation Performance unregistered); and the capacity scale
  FILDs the bank's INTEGER HeatSinkCount ((float10)*(int*)(link+0x1d0)) --
  the float reinterpret gave ~1e-44 -> a permanently empty tank.
  Capacity = 0.05 x heatSinkCount x streamed CoolantCapacity (BLH: 6.0).

Visual: the binary's mode-1 coolant-effect renderable (FUN_00456a68, built
for classID 0xBC0 on "ReservoirState", part_014.c:5439; tick @part_007.c:
8780) starts psfx 19 = FLUSH.PFX ("Coolant flush", BTDPL.INI) when the
state changes to 1 -- BTSpawnFlushCloud (mech4.cpp) spawns it on the same
alarm edge as an attached emitter at torso height.

Input: new CONTROLS.MAP action "Flush" on 'H' (HELD; press+release both
dispatch, the held-button payload).  Diags: BT_FLUSH_LOG, BT_FLUSH_TEST.

Verified live (FOGDAY): [flush] Reservoir level 6 -> 0.13 -> 0 over ~0.6 s
held (= the manual's 3-4 punches to empty), the coolant vertBar source
Reservoir/CoolantMass drains, and the bluish condensation cloud rises from
the mech (scratchpad/flush_cloud.png vs flush_before.png).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 15:15:44 -05:00

73 lines
3.2 KiB
C++

//#############################################################################
// btinput.hpp -- the desktop input binding engine (CONTROLS.MAP + XInput).
//
// The pod's controls are a fixed physical device set (stick, throttle lever,
// pedals, ~44 lamp buttons, keypads) reaching the game through the
// LBE4ControlsManager push model. On a desktop there is no RIO, so this
// engine maps PC keys and an XInput gamepad onto the SAME channels:
//
// axes -> the virtual-controls integrators in mech4.cpp (lever / turn
// stick / torso twist), exactly where the BT_KEY_BRIDGE writes
// the analog values the RIO would have produced
// buttons -> real buttonGroup[addr] ForceUpdates (aux banks, hotbox,
// panic, throttle-head...) so the AUTHENTIC handlers fire;
// the four joystick fire buttons (0x40/45/46/47) drive the
// bring-up fire channels instead (see btinput.cpp note)
// keypads -> keyboardGroup[KeyboardPilot/KeyboardExternal] key values
// pckey -> keyboardGroup[KeyboardPC] (any authentic '+'-style hotkey)
// actions -> the port-side dev controls (view toggle, all-stop, ...)
//
// Bindings load from content/CONTROLS.MAP at first poll; if the file is
// absent the compiled-in WASD-classic profile (identical text) applies.
// Keys claimed by a binding are SUPPRESSED from the legacy WM_CHAR/-KEYUP
// keyboard feed (BTInputSuppressKey), ending the historic double-dispatch
// (W = drive AND pilot-select, F5 keyup aliasing to 't' = pilot 3, ...).
//#############################################################################
#ifndef BTINPUT_HPP
#define BTINPUT_HPP
struct BTInputState
{
// analog demands (consumed by the mech4 virtual-controls block)
float leverRate; // throttle lever sweep, per second (+fwd/-back)
float turnTarget; // turn-stick deflection target [-1,1]
int turnActive; // any turn input held (else spring-center)
float twistTarget; // torso-twist deflection target [-1,1]
int twistActive;
float elevTarget; // torso-elevation (pitch) target [-1,1]
int elevActive;
int turnAbsolute; // pad stick overrides the integrator outright
int twistAbsolute;
int elevAbsolute;
// the four pod joystick fire buttons (levels)
int fireTrigger; // 0x40 Main
int firePinky; // 0x45
int fireThumbLow; // 0x46 Middle
int fireThumbHigh; // 0x47 Upper
// port-side actions (levels; consumers keep their own edge detectors)
int viewToggle;
int lookBehind;
int allStop;
int modeCycle;
int valve;
int flush; // Gitea #7: coolant flush HELD (InjectCoolant)
int configHold;
int genSel; // 0 = none, 4..7 = Generator A..D, 8 = reconnect
};
extern BTInputState gBTInput;
// Poll everything (keys + pad), evaluate the binding table, fire button /
// keypad edges into the controls manager. Call ONCE per sim frame from the
// player drive block. Handles the foreground-focus guard (BT_KEY_NOFOCUS)
// internally.
void BTInputPoll(float dt);
// The legacy keyboard feed asks before dispatching a typed character /
// key-up value: nonzero = this key is claimed by a binding, swallow it.
extern "C" int BTInputSuppressKey(unsigned int key_value, int is_char);
#endif // BTINPUT_HPP