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 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user