The mechs could always tilt their aim up/down -- Torso models the full vertical axis (currentElevation, rate, VerticalLimitTop/Bottom, recenter) and EVERY 1995 control mode routes stickPosition.y into Torso::SetAnalogElevationAxis -- but the desktop bridge hard-zeroed stick Y, so the axis was dead on a keyboard rig. The one pod control the remap left unwired. - btinput: JoystickY axis -> elevTarget/elevActive/elevAbsolute - mech4 shim: sElev integrator (same walk/spring model as the twist; X recenters pitch too via gBTElevRecenter) - mechmppr bridge: feeds stickPosition.y every bridged frame (the old unconditional zero removed); both mode branches covered - CONTROLS.MAP (+ numpad profile + compiled default): R/F = aim up/down, pad LeftStickY = elevation (was unused) - torso.hpp: CurrentElevation()/ElevationVelocity() accessors (diag) - [mppr] trace gains stickY (note: the trace reads AFTER the next frame's device push re-zeroes the stick -- input flows regardless) Verified live: R held -> torso elevation climbs at the authored rate and clamps at 0.349066 rad = exactly 20.0 deg (the Blackhawk's VerticalLimitTop); release holds the aim. The eyepoint correctly stays level -- pitch aims the GUNS and reads on the HUD's vertical elevation tape, as in the pod. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
72 lines
3.1 KiB
C++
72 lines
3.1 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 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
|