From 2f92bc268debd9e25f24383de1e44b099734517f Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Wed, 25 May 2022 06:17:29 +0200 Subject: [PATCH] Support loading The Lost Mission and librecoopd3xp via mods menu by adding special cases for them that set `fs_game_base d3xp`. Unfortunately there is no more generic way to do this, as mods have no way to tell the engine if they need fs_game_base. --- Changelog.md | 2 ++ neo/framework/Session_menu.cpp | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index e274d277..1fe5781d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -72,6 +72,8 @@ Note: Numbers starting with a "#" like #330 refer to the bugreport with that num * Improved compatibility with Wayland (#426) * Work around assertion in AlphaLabs4 due to "ride_of_death" yeeting the dead "monster_zsec_shotgun_12" into the void (#409) +* Support loading some mods known to need `fs_game_base d3xp` via Mods menu + (currently, *The Lost Mission* and *LibreCoop d3xp* are supported) 1.5.1 (2021-03-14) ------------------------------------------------------------------------ diff --git a/neo/framework/Session_menu.cpp b/neo/framework/Session_menu.cpp index b830c1f7..97bbe5f2 100644 --- a/neo/framework/Session_menu.cpp +++ b/neo/framework/Session_menu.cpp @@ -552,6 +552,30 @@ void idSessionLocal::UpdateMPLevelShot( void ) { guiMainMenu->SetStateString( "current_levelshot", screenshot ); } +// helper function to load a mod (from mods menu) +static void loadMod(const idStr& modName) +{ + // add special case for mods known to need fs_game_base d3xp + static const char* d3xpMods[] = { + // TODO: if there are more mods that need d3xp as base + // (and that are supported by dhewm3), add them here + "d3le", // The Lost Mission + "librecoopd3xp" + }; + const char* baseMod = ""; + for ( int i=0; i < sizeof(d3xpMods)/sizeof(d3xpMods[0]); ++i ) { + if ( modName.Icmp( d3xpMods[i] ) == 0 ) { + baseMod = "d3xp"; + break; + } + } + + cvarSystem->SetCVarString( "fs_game", modName ); + cvarSystem->SetCVarString( "fs_game_base", baseMod ); + + cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "reloadEngine menu\n" ); +} + /* ============== idSessionLocal::HandleMainMenuCommands @@ -605,8 +629,7 @@ void idSessionLocal::HandleMainMenuCommands( const char *menuCommand ) { if ( !idStr::Icmp( cmd, "loadMod" ) ) { int choice = guiActive->State().GetInt( "modsList_sel_0" ); if ( choice >= 0 && choice < modsList.Num() ) { - cvarSystem->SetCVarString( "fs_game", modsList[ choice ] ); - cmdSystem->BufferCommandText( CMD_EXEC_APPEND, "reloadEngine menu\n" ); + loadMod( modsList[ choice ] ); } }