From 2b238a835c40492b35c46f7679c3fc851ff11770 Mon Sep 17 00:00:00 2001 From: Cyd Date: Fri, 17 Jul 2026 10:08:03 -0500 Subject: [PATCH] Cockpit: backtick (\`) toggles the secondary displays Add a hide/show toggle for the single-window cockpit's secondary displays -- the five MFDs + radar panel (and their button banks) that frame the 3D viewscreen -- so the player can get an unobstructed full-window view. - L4VB16.cpp: gBTHideSecondaryDisplays gates BTDrawCockpitPanel (early return skips the whole instrument composite; the primary 3D view already fills the window, so nothing else changes). - btl4main.cpp WndProc: '`' (VK_OEM_3) flips it, edge-triggered on lParam bit 30 so auto-repeat while held doesn't flicker. Handled in WM_KEYDOWN, which the engine keyboard reader does not steal (it consumes WM_KEYUP/WM_CHAR). Co-Authored-By: Claude Opus 4.8 --- engine/MUNGA_L4/L4VB16.cpp | 8 ++++++++ game/btl4main.cpp | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/engine/MUNGA_L4/L4VB16.cpp b/engine/MUNGA_L4/L4VB16.cpp index 89a75ea..58f1fc1 100644 --- a/engine/MUNGA_L4/L4VB16.cpp +++ b/engine/MUNGA_L4/L4VB16.cpp @@ -650,10 +650,18 @@ int BTCockpitButtonAt(int px, int py, int clientW, int clientH) return -1; } +// Backtick (`) toggle: hide the SECONDARY cockpit displays -- the MFD/radar +// panel (and its button banks) that frame the 3D viewscreen -- for an +// unobstructed view. Flipped from the main WndProc (btl4main.cpp) on the '`' +// key; read here so the composite simply skips itself when hidden. The primary +// 3D viewscreen already fills the window, so hiding the panel needs nothing else. +int gBTHideSecondaryDisplays = 0; + // void BTDrawCockpitPanel(LPDIRECT3DDEVICE9 device) { if (!DevCockpitPanel() || device == NULL) return; + if (gBTHideSecondaryDisplays) return; // '`' hid the instrument panel IDirect3DSurface9 *rt = NULL; if (FAILED(device->GetRenderTarget(0, &rt)) || rt == NULL) return; D3DSURFACE_DESC d; diff --git a/game/btl4main.cpp b/game/btl4main.cpp index 536cc14..4021f05 100644 --- a/game/btl4main.cpp +++ b/game/btl4main.cpp @@ -80,6 +80,16 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) switch (uMsg) { case WM_KEYDOWN: + // Backtick (`) toggles the SECONDARY cockpit displays (the MFD/radar + // panel that frames the 3D viewscreen) on/off, for an unobstructed + // view. Edge-triggered via lParam bit 30 (the previous key state) so + // auto-repeat while the key is held does not flicker the panel. + if (wParam == VK_OEM_3 && (lParam & (1 << 30)) == 0) + { + extern int gBTHideSecondaryDisplays; + gBTHideSecondaryDisplays = !gBTHideSecondaryDisplays; + } + return 0; case WM_KEYUP: // Drive keys are NOT read here: the engine's keyboard reader // (L4CTRL.cpp:1506) GetMessage()s every WM_KEYUP / WM_CHAR out of the