Say when the Steam buttons are off rather than removing them
With RP412STEAM=1 but no Steam client, the lobby buttons were not drawn at all - the menu simply had two fewer buttons than last time, with the only explanation a line near the top of rpl4.log that scrolls past during a normal startup. It reads as a broken build, and it cost someone a puzzled look today. The buttons are now laid out whenever environ.ini asks for Steam, and greyed out when the wire did not come up, with STEAM NOT RUNNING above them. Clicks on a greyed button do nothing - a dead control that still fires would be worse than the silence it replaces. Two conditions rather than one, so RPL4Lobby_Configured joins Available: configured is the ini switch, available is whether the transport got a FakeIP. Configured keeps the #ifdef in the lobby module, so a build without the Steam SDK still shows no buttons at all rather than a pair that can never work. The notice does not fit inside a button - they are about sixteen characters wide and "HOST STEAM GAME - STEAM NOT RUNNING" is more than twice that, so appending it clipped mid-word. It goes on its own line above the pair instead. Verified both ways, with the Steam client up and with it unavailable: bright and clickable, dim and inert. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+37
-6
@@ -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
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user