Skip to content

Commit

Permalink
Fixed|Resources|libdoomsday: Loading and unloading DEH files
Browse files Browse the repository at this point in the history
Don’t attempt to actually load DEHs as data files, but instead let
the DEH import plugin read them while a reset occurs.
  • Loading branch information
skyjake committed Mar 5, 2017
1 parent 0214dee commit b3eb0e2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions doomsday/apps/libdoomsday/src/resource/resources.cpp
Expand Up @@ -161,12 +161,18 @@ DENG2_PIMPL(Resources)
bool needReset = ddPkg.hasDefinitions();
File const &sourceFile = ddPkg.sourceFile();

if (sourceFile.is<DataBundle>())
if (DataBundle const *bundle = sourceFile.maybeAs<DataBundle>())
{
// DEH patches cannot be loaded/unloaded as such; they are simply
// marked as loaded and applied all at once during a reset.
if (bundle->format() == DataBundle::Dehacked)
{
needReset = true;
}
// We can try load the data file manually right now.
// Data files are currently loaded via FS1.
if ( ( loading && File1::tryLoad(File1::LoadAsCustomFile, ddPkg.loadableUri()))
|| (!loading && File1::tryUnload(ddPkg.loadableUri())))
else if ( ( loading && File1::tryLoad(File1::LoadAsCustomFile, ddPkg.loadableUri()))
|| (!loading && File1::tryUnload(ddPkg.loadableUri())))
{
needReset = true;
}
Expand Down

0 comments on commit b3eb0e2

Please sign in to comment.