Merge glass-per-display-windows: per-display cockpit windows (Cyd, BT_GLASS_PANELS)

One window per pod display (Heat/Engineering/Comm/Weapons x2/radar +
Flight Controls), each carrying its surface with its RIO button bank
arranged pod-faithfully; CPU-expanded surfaces, buttons under the
imagery.  Runtime gate BT_GLASS_PANELS (=0 = the legacy single panel).
Merged on top of today's landed fix pile (audio-crash, experience,
parallax); the L4PADRIO overlap with the gait-detent commit resolved
preserving BOTH (his window refactor + our at-rest band snap).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

# Conflicts:
#	context/glass-cockpit.md
This commit is contained in:
arcattack
2026-07-20 14:52:38 -05:00
10 changed files with 1176 additions and 10 deletions
+33 -6
View File
@@ -45,6 +45,22 @@ const char* const ProgName = "btl4";
Application *btl4App = NULL;
HWND hWnd = NULL;
// GLASS: resolvers for the per-display windows (declared in l4vb16.h), defined
// HERE off the launcher's own app + window pointers. They deliberately do NOT
// touch the `application`/`ghWnd` globals: those are duplicate-defined and bind
// non-deterministically per link under /FORCE (CMakeLists.txt:186), so a fresh
// engine TU (L4GLASSWIN) can read the NULL copy. btl4App/hWnd live in THIS obj
// and are the real, assigned pointers -- always correct.
class GaugeRenderer;
GaugeRenderer *BTResolveGaugeRenderer()
{
return btl4App ? btl4App->GetGaugeRenderer() : 0;
}
void *BTResolveMainWindow()
{
return (void *)hWnd;
}
//===========================================================================//
// Bring-up player DRIVE input (Tier 2 locomotion).
// Populated by the keyboard handler in WndProc below (WASD / arrow keys)
@@ -319,10 +335,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// window / BT_DEV_GAUGES_DOCK=1 overlay inset), and the desktop
// plasma window. Each only when not already set, so a developer
// env overrides the preset.
if (getenv("L4CONTROLS") == NULL) putenv("L4CONTROLS=PAD,KEYBOARD");
if (getenv("BT_DEV_GAUGES") == NULL) putenv("BT_DEV_GAUGES=1");
if (getenv("L4PLASMA") == NULL) putenv("L4PLASMA=SCREEN");
if (getenv("BT_PAD_PANEL") == NULL) putenv("BT_PAD_PANEL=1");
if (getenv("L4CONTROLS") == NULL) putenv("L4CONTROLS=PAD,KEYBOARD");
if (getenv("BT_DEV_GAUGES") == NULL) putenv("BT_DEV_GAUGES=1");
if (getenv("L4PLASMA") == NULL) putenv("L4PLASMA=SCREEN");
if (getenv("BT_PAD_PANEL") == NULL) putenv("BT_PAD_PANEL=1");
// Break the secondary displays into per-display windows (surface + its RIO
// bank around it). Set BT_GLASS_PANELS=0 to fall back to the single
// combined pad panel + docked gauge strip.
if (getenv("BT_GLASS_PANELS") == NULL) putenv("BT_GLASS_PANELS=1");
}
#endif
else
@@ -352,7 +372,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
std::cout << "[boot] platform profile: "
<< (fe_menu_mode ? "MENU (front end -- no profile applied)"
: gBTPlatformPod ? "POD (RIO cockpit input; multi-surface gauges/MFDs via pod hardware or explicit L4GAUGE)"
: gBTPlatformGlass ? "GLASS (PadRIO + on-screen panel + dev MFDs + plasma window)"
: gBTPlatformGlass ? "GLASS (PadRIO + per-display cockpit windows [BT_GLASS_PANELS] + plasma window)"
: "DEV (single window + keyboard)")
<< std::endl << std::flush;
@@ -543,7 +563,14 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
{
extern int gBTGaugeDockBottom;
extern int BTGaugeStripHeightFor(int width);
if (getenv("BT_DEV_GAUGES") != 0 && getenv("BT_DEV_GAUGES_WINDOW") == 0)
// BT_GLASS_PANELS breaks the gauges into their own per-display windows, so
// the world window keeps its normal size (no bottom strip).
int glassOwnsGauges = 0;
#ifdef BT_GLASS
{ extern int BTGlassPanelsActive(); glassOwnsGauges = BTGlassPanelsActive(); }
#endif
if (!glassOwnsGauges &&
getenv("BT_DEV_GAUGES") != 0 && getenv("BT_DEV_GAUGES_WINDOW") == 0)
{
gBTGaugeDockBottom = 1;
// Readability default (user-reported: the strip at 800 wide is a