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.
This commit is contained in:
Daniel Gibson 2022-05-25 06:17:29 +02:00
parent b88b99fadb
commit 2f92bc268d
2 changed files with 27 additions and 2 deletions

View file

@ -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)
------------------------------------------------------------------------

View file

@ -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 ] );
}
}