From 70c94aced3d46b1a22cf099e135b9da3bec691b2 Mon Sep 17 00:00:00 2001 From: Little Cat Date: Wed, 26 Oct 2022 03:56:31 -0300 Subject: [PATCH] SCUMM HE: Command line host/join Moonbase games. Normally, GameSpy Arcade (or a third-party app) would set these settings into moonbase.ini for the game to read. But I feel like a couple of command line options would be a lot simpler. Also, doubles as a quick way to host and join a game for testing. Unfortunately this does not support the demo version. --- base/commandLine.cpp | 19 +++++++++++++++++++ engines/scumm/he/script_v80he.cpp | 2 ++ 2 files changed, 21 insertions(+) diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 3e068579804..73b442ccb1c 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -213,6 +213,14 @@ static const char HELP_STRING4[] = #ifdef ENABLE_SCUMM " --tempo=NUM Set music tempo (in percent, 50-200) for SCUMM games\n" " (default: 100)\n" +#endif +#if defined(ENABLE_HE) && defined(USE_ENET) + " --host-game Host an online game for Moonbase Commander.\n" + " This method only works on the full version of the game,\n" + " Demo users can still host a game via the main menu.\n" + " --join-game=IP[:PORT] Join an online game for Moonbase Commander.\n" + " This method only works on the full version of the game,\n" + " Demo users can still join a game via the main menu.\n" #endif " --engine-speed=NUM Set frame per second limit (0 - 100), 0 = no limit\n" " (default: 60)\n" @@ -336,6 +344,10 @@ void registerDefaults() { #ifdef ENABLE_SCUMM ConfMan.registerDefault("tempo", 0); #endif +#if defined(ENABLE_HE) && defined(USE_ENET) + ConfMan.registerDefault("host_game", false); + ConfMan.registerDefault("join_game", "null"); +#endif #if defined(ENABLE_SKY) || defined(ENABLE_QUEEN) ConfMan.registerDefault("alt_intro", false); #endif @@ -908,6 +920,13 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha END_OPTION #endif +#if defined(ENABLE_HE) && defined(USE_ENET) + DO_LONG_OPTION_BOOL("host-game") + END_OPTION + DO_LONG_OPTION("join-game") + END_OPTION +#endif + #if defined(ENABLE_SCUMM) || defined(ENABLE_GROOVIE) DO_LONG_OPTION_BOOL("demo-mode") END_OPTION diff --git a/engines/scumm/he/script_v80he.cpp b/engines/scumm/he/script_v80he.cpp index 714b18022d8..3dfd037c4b2 100644 --- a/engines/scumm/he/script_v80he.cpp +++ b/engines/scumm/he/script_v80he.cpp @@ -188,6 +188,8 @@ void ScummEngine_v80he::o80_readConfigFile() { case SO_DWORD: // number if (!strcmp((char *)option, "Benchmark")) push(2); + else if (!strcmp((char *)option, "hostip")) + push(ConfMan.getBool("host_game")); else push(atoi(entry.c_str())); break;