diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index a02f3ca5f..a542866a1 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -51,6 +51,8 @@ #include "doomerrors.h" #include "v_text.h" +// external function declarations +const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinprogdir=false); CVAR (Bool, queryiwad, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); CVAR (String, defaultiwad, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG); @@ -688,6 +690,11 @@ int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, wadfiles.Clear(); D_AddFile (wadfiles, zdoom_wad); + // [SP] Load non-free assets if available. This must be done before the IWAD. + const char *optionalassets = BaseFileSearch(OPTIONALWAD, NULL, true); + if (optionalassets) + D_AddFile(wadfiles, optionalassets); + if (picks[pick].mRequiredPath.IsNotEmpty()) { D_AddFile (wadfiles, picks[pick].mRequiredPath); diff --git a/src/d_main.cpp b/src/d_main.cpp index 6e4ec27e3..d82925436 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2087,11 +2087,6 @@ static void AddAutoloadFiles(const char *autoname) { LumpFilterIWAD.Format("%s.", autoname); // The '.' is appened to simplify parsing the string - // [SP] Load non-free assets if available. - const char *optionalassets = BaseFileSearch(OPTIONALWAD, NULL); - if (optionalassets) - D_AddFile(allwads, optionalassets); - // [SP] Dialog reaction - load lights.pk3 and brightmaps.pk3 based on user choices if (!(gameinfo.flags & GI_SHAREWARE)) {