Port RP412's RPL4LOBBY to BT: an ISteamMatchmaking room stands in for the arcade Site-Management screen. Compiled both gates -- stubs without BT412_STEAM, the full room under it (both configs build + link clean). Lobby (game/reconstructed/btl4lobby.*): - Room screen (green-on-black, like the menu), owner = console. - Member data: FakeIP + fake console/game ports + persona + mech/color/badge (ip/cp/gp/nm/vh/cl/bd keys). - Nonced "go" launch roster -> SteamNetTransport_RegisterPeer for every peer. - Push/PullRaceResults over lobby data rebuild the shared score sheet. Front end (btl4fe.*): HOST/JOIN buttons when BTLobby_Available() (Steam transport up); the menu loop exits on a steam action and BTFrontEnd_Run routes the lobby outcome -- host builds the egg with every member as a [pilots] mesh entry (BTFrontEnd_SetHostedPilots), member returns launch mode 2. Results screen prefers the marshal's collated result names. Marshal (btl4console.*): add GetResultName / ClearResults / InjectResult so the lobby owner can refill the sheet from the collated wire scores; Result gains a name field. WinMain (btl4main.cpp): install the Steam transport on BT412STEAM env (before the front end, so the lobby is offered); branch on BTFrontEnd_LastLaunchMode() -- host owns the marshal clock + joins the mesh, member enters as a network pod on :1501 (SetNetworkCommonFlatAddress + gConsoleLossEndsMission); Push (host) / Pull (member) results, then relaunch. CMake: btl4lobby.cpp joins bt410_l4; that lib gets BT412_STEAM + the Steamworks include under the gate. build-steam/ gitignored. Deferred (untestable here -- needs Steam + multiple machines): the host->member wire egg-feed marshal (InstallNetworkRace); a member currently waits for a console connection nothing supplies, so a live host+member race is blocked on it. The lobby object does not survive the per-mission relaunch. docs/STEAM-3-MACHINE-TEST.md for BT not yet authored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
100 lines
4.3 KiB
C++
100 lines
4.3 KiB
C++
//===========================================================================//
|
|
// btl4fe.hpp -- BT412 in-game front end: local mission-egg builder.
|
|
//
|
|
// Replaces the external operator console for solo / host play: a race is
|
|
// configured from an in-process catalog and the mission egg is built LOCALLY
|
|
// (the exact NotationFile the console used to stream), then fed through the
|
|
// standard -egg load path (L4Application::SetEggNotationFileName).
|
|
//
|
|
// This is the Workstream B foundation (docs/BT412-ROADMAP.md Phase 5); the
|
|
// interactive on-screen menu, the LocalConsole marshal, and the results
|
|
// screen build on top of this egg builder.
|
|
//===========================================================================//
|
|
#ifndef BTL4FE_HPP
|
|
#define BTL4FE_HPP
|
|
|
|
//---------------------------------------------------------------------------//
|
|
// Catalogs (the console's RPConfig.xml equivalent for BattleTech).
|
|
//---------------------------------------------------------------------------//
|
|
extern const char *const kBTMaps[]; // NULL-terminated
|
|
extern const char *const kBTMechs[]; // NULL-terminated (base + variants)
|
|
extern const char *const kBTColors[]; // NULL-terminated
|
|
extern int BTCatalogCount(const char *const *list);
|
|
|
|
//---------------------------------------------------------------------------//
|
|
// One participant's loadout.
|
|
//---------------------------------------------------------------------------//
|
|
struct BTFePilot
|
|
{
|
|
char address[32]; // "ip[:port]" -- the mesh roster key
|
|
char name[24]; // pilot name (also the plasma name bitmap)
|
|
char vehicle[16]; // mech, e.g. "bhk1"
|
|
char color[16]; // "White" / "Red" / ...
|
|
char badge[8]; // e.g. "VGL"
|
|
char patch[16]; // e.g. "Yellow"
|
|
char dropzone[8]; // "one" ...
|
|
int bitmapindex; // 1..N (which ordinal/name slot)
|
|
int advancedDamage; // 0/1
|
|
int loadzones; // 0/1
|
|
};
|
|
|
|
//---------------------------------------------------------------------------//
|
|
// A whole mission before it becomes an egg.
|
|
//---------------------------------------------------------------------------//
|
|
struct BTFeMission
|
|
{
|
|
char map[16]; // e.g. "cavern"
|
|
char scenario[16]; // "freeforall"
|
|
char timeOfDay[8]; // "day" / "night"
|
|
char weather[16]; // "clear" ...
|
|
int temperature; // e.g. 27
|
|
int lengthSeconds; // mission time limit
|
|
int pilotCount;
|
|
BTFePilot pilots[8];
|
|
};
|
|
|
|
// Fill a mission with sensible solo defaults (map=grass, one local pilot).
|
|
void BTFeMission_Default(BTFeMission *mission);
|
|
|
|
// Write the mission as an egg NotationFile to `path`. Returns True on success.
|
|
// Emits [mission] / [ordinals]+4 rank bitmaps / [pilots] / per-pilot sections /
|
|
// [largebitmap]+[smallbitmap] (GDI-rendered pilot names) / role models -- the
|
|
// exact structure the console streamed (verified against content/MP.EGG).
|
|
int BTFeMission_WriteEgg(const BTFeMission *mission, const char *path);
|
|
|
|
//---------------------------------------------------------------------------//
|
|
// Front-end mode: no -egg, no -net on the command line. Build a solo egg
|
|
// from the default loadout and point the engine at it. Returns True if it
|
|
// took over (an egg was built + set), False to fall through to the old path.
|
|
//---------------------------------------------------------------------------//
|
|
int BTFrontEnd_Run();
|
|
|
|
// The mission length (seconds; 0 = endless) the player chose on the last
|
|
// LAUNCH -- WinMain arms the LocalConsole marshal with it.
|
|
int BTFrontEnd_LastMissionSeconds();
|
|
|
|
// Show the post-mission scoreboard (marshal snapshot) until dismissed.
|
|
void BTFrontEnd_ShowResults();
|
|
|
|
//---------------------------------------------------------------------------//
|
|
// Steam lobby glue (used by btl4lobby): the local pilot's loadout the lobby
|
|
// publishes as member data, and the hosted-pilot override the lobby feeds so
|
|
// the owner's egg carries every member as a pilot.
|
|
//---------------------------------------------------------------------------//
|
|
struct FEHostedPilot
|
|
{
|
|
char address[64]; // mesh (game-port) address for [pilots]
|
|
char name[32];
|
|
char vehicle[24];
|
|
char color[16];
|
|
char badge[24];
|
|
};
|
|
void BTFrontEnd_GetLoadout(char *vehicle, char *color, char *badge);
|
|
void BTFrontEnd_SetHostedPilots(const char *owner_address,
|
|
const FEHostedPilot *pilots, int count);
|
|
|
|
// The last LAUNCH's mode: 0 single-player, 1 lobby host, 2 lobby member.
|
|
int BTFrontEnd_LastLaunchMode();
|
|
|
|
#endif // BTL4FE_HPP
|