Cockpit surround: composite the gauges around the 3D view (default desktop layout)

Under BT_DEV_GAUGES the DEFAULT is now the pod-faithful cockpit surround: the 3D
world CENTERED with the six gauge surfaces composited AROUND it in the single main
window at 1/2 native scale, plus clickable RIO button lamps. Iterated as a visual
reference with the user, then landed in the engine.

- L4VB16.cpp/.h: BTCockpitLayout + BTCockpitComputeLayout (layout single source of
  truth, computed from the backbuffer canvas); BTDrawCockpitPanels (band fill ->
  button lamp quads -> 9-entry surface loop, phosphor-green mono / amber palette
  sec, Eng-sibling slot map -> GDI-atlas flight labels; D3DSBT_ALL state-block
  isolation = the floating-rocks trap); BTCockpitMouseDown/Up (client->bb hit-test
  + glass press/release/right-latch contract); BTApplyWorldViewport + DevGaugeDocked
  cockpit branches; shared BTLampBrightnessOf inline. Hooked at the top of
  BTDrawGaugeInset (before BT_SHOT, so shots include it).
- btl4main.cpp: glass preset (cockpit default, per-display panels opt-in); mode
  resolution -> gBTGaugeCockpit with work-area-clamped window sizing (-res = view
  size); WndProc WM_L/RBUTTON routing.
- L4VIDEO.cpp: BTWorldAspectOf cockpit branch (view rect on-screen aspect).
- L4VIDRND.cpp: CameraShipHUDRenderable::Render made viewport-relative.

Buttons = the L4GLASSWIN address banks x0.5 (Heat 0x2F, Mfd2 0x27, Comm 0x37, Mfd1
0x0F, Mfd3 0x07 red; radar rails 0x10-0x1B yellow; flight 0x38-0x47 blue, labeled).
Full rect is the hit target; the surface draws over it so only the lamp edge shows.
Precedence: BT_GLASS_PANELS=1 stands cockpit down > BT_COCKPIT=1 > _WINDOW/_DOCK
opt-out > cockpit default; BT_COCKPIT=0 = dock-bottom. Green tunable via
BT_COCKPIT_TINT. Renders in ALL builds; only the PadRIO click/lamp seam is
BT_GLASS-gated.

Verified (awaiting playtest): both build/ + build-glass/ compile (0 error C);
glass BT_SHOT matches the mockup; 500-click storm during a live mission survived
(Gitea #18 Receiver-gap fix holds); BT_COCKPIT=0 dock-bottom unregressed;
BT_GLASS_PANELS=1 stands cockpit down; pod build renders the panels.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-20 20:39:34 -05:00
co-authored by Claude Opus 4.8
parent 5ba5697a08
commit 129b27499d
7 changed files with 793 additions and 41 deletions
+49
View File
@@ -807,3 +807,52 @@ screenshots silently omitted the gauge panel (audit runs 1-2 captured cockpit-on
Moved the capture after the inset (L4VIDEO.cpp) — dock shots again show what the screen shows.
Also noted: BT_DEV_GAUGES_DOCK alone does NOT enable the composite — DevGaugeComposite() gates
on BT_DEV_GAUGES (L4VB16.cpp:105); set BOTH.
---
## Cockpit surround — the default desktop layout (2026-07-20)
Replaces dock-bottom as the DEFAULT under `BT_DEV_GAUGES`: the 3D world CENTERED with the six
gauge surfaces composited AROUND it in the single main window at ½ native scale, plus clickable
RIO button lamps. Iterated as a visual reference with the user (scratchpad/cockpit_pod.py) then
landed in the engine.
**Files.**
- `engine/MUNGA_L4/l4vb16.h``BTCockpitLayout`/`BTCockpitBtn` structs, the compute/draw/mouse
declarations, and `BTLampBrightnessOf` (shared inline lamp decode, dedup of L4GLASSWIN's).
- `engine/MUNGA_L4/L4VB16.cpp``gBTGaugeCockpit`/`gBTCockpitCanvasW/H`; `BTCockpitCanvasFor` +
`BTCockpitComputeLayout` (layout single source of truth); `BTDrawCockpitPanels` (band fill →
button lamp quads → 9-entry surface loop with green tint / palette sec + Eng-sibling slot map →
GDI-atlas flight labels; wrapped in a `D3DSBT_ALL` state block = the floating-rocks isolation);
`BTCockpitMouseDown/Up` (client→bb hit-test + glass press/release/right-latch contract);
`BTApplyWorldViewport` + `DevGaugeDocked` cockpit branches. Hooked at the top of
`BTDrawGaugeInset` (before BT_SHOT, so shots include it).
- `game/btl4main.cpp` — glass preset (cockpit default, panels opt-in), mode resolution +
work-area-clamped window sizing (`-res` = the view size), WndProc `WM_L/RBUTTON` routing.
- `engine/MUNGA_L4/L4VIDEO.cpp``BTWorldAspectOf` cockpit branch (view rect on-screen aspect).
- `engine/MUNGA_L4/L4VIDRND.cpp``CameraShipHUDRenderable::Render` made viewport-relative
(camera-seat banner + ranking window land over the view, not clipped into the surround bands).
**Layout math.** `SCALE=0.5; MFD 320×240, radar 240×320; OVL=44 (corner overlap into the view);
LAMP=16 (visible lamp edge, user asked for larger than glass's 10); REDCELL=64 (hidden hit depth);
RAILW=26; sideBand=276, topBand=212, bottomBand=336; canvas=(viewW+552, viewH+548).` Corner MFDs
overlap the view corner by OVL both axes; Mfd2 drops 25% of its height into the top; sec flush
below (view bottom clean). Buttons: the full rect is the click target, the surface draws over it so
only the LAMP edge shows (PaintGlass painter trick). Address banks = L4GLASSWIN
BuildMfd/BuildRadar/BuildFlight.
**Gating precedence** (resolved once → `gBTGaugeCockpit`): `BTGlassPanelsActive` (BT_GLASS_PANELS)
> `BT_COCKPIT=1` > `BT_DEV_GAUGES_WINDOW` / `BT_DEV_GAUGES_DOCK` > **cockpit default**. `BT_COCKPIT=0`
= dock-bottom. `DevGaugeDocked()` includes cockpit so the separate window stands down. Green tint
`BT_COCKPIT_TINT=RRGGBB` (default 0x27E8 ≈ rgb(33,255,66)); radar stays palette amber.
**Pod-build seam.** Panels + dim lamps render in ALL builds; only `PadRIO::SetScreenButton/
GetLampState` are `#ifdef BT_GLASS` (via `CkEmit`/`CkLampState`). Pod build: cockpit draws, clicks
no-op. Labels: lazy GDI DIB → MANAGED A8R8G8B8 texture cache (survives device reset).
**Verified (2026-07-20, awaiting human playtest):** both build/ (BT_GLASS off) and build-glass/
compile (0 error C). Glass BT_SHOT matches the mockup (green MFDs, amber radar, red/yellow/blue
lamps, labeled flight blocks, reticle centered on target). 500-click PostMessage storm during a
live mission SURVIVED (no AV — the Gitea #18 Receiver-gap fix holds); 20 hits logged with correct
addresses/coords. BT_COCKPIT=0 dock-bottom pixel-unregressed. BT_GLASS_PANELS=1 stands cockpit
down (Cyd's windows up). Pod build renders the panels.