diff --git a/RP_L4/RPL4FE.cpp b/RP_L4/RPL4FE.cpp index f8643f3..2c07399 100644 --- a/RP_L4/RPL4FE.cpp +++ b/RP_L4/RPL4FE.cpp @@ -413,8 +413,9 @@ namespace launch->rect.right = col3 + col_w; launch->rect.bottom = client_h - row_h; - // Steam lobby buttons (only when the Steam wire is live) - if (RPL4Lobby_Available()) + // Steam lobby buttons, offered whenever environ.ini asked for Steam. + // Painting greys them out and says so if the wire never came up. + if (RPL4Lobby_Configured()) { FEItem *host = &fe->items[fe->itemCount++]; host->group = GroupSteamHost; @@ -544,12 +545,38 @@ namespace RECT row = item->rect; if (item->group >= GroupLaunch) { - HBRUSH launch_brush = CreateSolidBrush(kGreenBright); + // + // The lobby buttons are offered whenever environ.ini asked + // for Steam, but they only work once the client is actually + // there. Dim them and say why rather than leaving them out - + // two buttons quietly missing looks like a broken build. + // + Logical steam_button = + (item->group == GroupSteamHost || item->group == GroupSteamJoin); + Logical dead = steam_button && !RPL4Lobby_Available(); + + COLORREF ink = dead ? kGreenDim : kGreenBright; + HBRUSH launch_brush = CreateSolidBrush(ink); FrameRect(mem, &row, launch_brush); DeleteObject(launch_brush); - SetTextColor(mem, kGreenBright); + SetTextColor(mem, ink); DrawTextA(mem, ItemName(item->group, item->index), -1, &row, DT_CENTER | DT_VCENTER | DT_SINGLELINE); + + // + // The reason, on its own line above the pair. It does not + // fit inside a button - they are about sixteen characters + // wide and this is more than twice that. + // + if (dead && item->group == GroupSteamHost) + { + RECT notice = row; + notice.bottom = row.top; + notice.top = row.top - (row.bottom - row.top); + SetTextColor(mem, kGreenDim); + DrawTextA(mem, "STEAM NOT RUNNING", -1, ¬ice, + DT_CENTER | DT_VCENTER | DT_SINGLELINE); + } continue; } @@ -613,8 +640,12 @@ namespace } else if (item->group == GroupSteamHost || item->group == GroupSteamJoin) { - fe->steamAction = (item->group == GroupSteamHost) ? 1 : 2; - PostMessageA(fe->menuWindow, WM_NULL, 0, 0); + // dead until the Steam client is there; the button says so + if (RPL4Lobby_Available()) + { + fe->steamAction = (item->group == GroupSteamHost) ? 1 : 2; + PostMessageA(fe->menuWindow, WM_NULL, 0, 0); + } } else { diff --git a/RP_L4/RPL4LOBBY.cpp b/RP_L4/RPL4LOBBY.cpp index f8ece7b..32d6da3 100644 --- a/RP_L4/RPL4LOBBY.cpp +++ b/RP_L4/RPL4LOBBY.cpp @@ -11,6 +11,7 @@ //######################################################################## Logical RPL4Lobby_Available() { return False; } +Logical RPL4Lobby_Configured() { return False; } Logical RPL4Lobby_InRoom() { return False; } int RPL4Lobby_Host(HINSTANCE, HWND) { return LobbyRoomLeft; } int RPL4Lobby_Join(HINSTANCE, HWND) { return LobbyRoomLeft; } @@ -919,6 +920,18 @@ Logical return SteamNetTransport_GetFakeAddressString()[0] != '\0'; } +// +// The environ.ini switch, read the same way RPL4.CPP reads it to decide +// whether to install the transport at all. Says nothing about whether the +// Steam client was actually there. +// +Logical + RPL4Lobby_Configured() +{ + const char *steam_switch = getenv("RP412STEAM"); + return (steam_switch != NULL && atoi(steam_switch) != 0) ? True : False; +} + Logical RPL4Lobby_InRoom() { diff --git a/RP_L4/RPL4LOBBY.h b/RP_L4/RPL4LOBBY.h index ccffaa4..aed69f3 100644 --- a/RP_L4/RPL4LOBBY.h +++ b/RP_L4/RPL4LOBBY.h @@ -33,6 +33,15 @@ enum RPL4LobbyOutcome Logical RPL4Lobby_Available(); +// True when this build has Steam and environ.ini asked for it, whether +// or not it actually came up. The menu offers the lobby buttons on this +// and greys them out on Available() - a player who turned Steam on and +// then launched without the client running should be told so, not left +// looking at a menu that quietly has two fewer buttons than the last +// time they saw it. +Logical + RPL4Lobby_Configured(); + // True while we sit in a lobby (races return to the room). Logical RPL4Lobby_InRoom();