Skip to content

Commit

Permalink
libdoomsday|Game: Added a simple way to specify addition data file paths
Browse files Browse the repository at this point in the history
Work in progress: this is not meant to be final in any way. The long
term plan is to allow to user to select packages to use in game
profiles.
  • Loading branch information
skyjake committed Jan 24, 2016
1 parent 9dfa92b commit f41c356
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 4 additions & 0 deletions doomsday/apps/libdoomsday/include/doomsday/game.h
Expand Up @@ -96,6 +96,10 @@ class LIBDOOMSDAY_PUBLIC Game : public de::IObject

void addRequiredPackage(de::String const &packageId);

void setUserFiles(de::StringList const &nativePaths);

de::StringList const &userFiles() const;

/**
* Returns the list of required package IDs for loading the game.
*/
Expand Down
17 changes: 14 additions & 3 deletions doomsday/apps/libdoomsday/src/game.cpp
Expand Up @@ -52,6 +52,7 @@ DENG2_PIMPL(Game)
pluginid_t pluginId = 0; ///< Unique identifier of the registering plugin.
Record params;
StringList requiredPackages; ///< Packages required for starting the game.
StringList userFiles;

Manifests manifests; ///< Required resource files (e.g., doomu.wad).

Expand Down Expand Up @@ -113,6 +114,16 @@ void Game::addRequiredPackage(String const &packageId)
d->requiredPackages.append(packageId);
}

void Game::setUserFiles(StringList const &nativePaths)
{
d->userFiles = nativePaths;
}

StringList const &Game::userFiles() const
{
return d->userFiles;
}

StringList Game::requiredPackages() const
{
return d->requiredPackages;
Expand Down Expand Up @@ -175,15 +186,15 @@ String Game::description() const
_E(l) "ID: " _E(.) "%3 "
_E(l) "PluginId: " _E(.) "%4\n"
_E(D)_E(b) "Packages:\n" _E(.)_E(.) "%5\n"
_E(D)_E(b) "Startup resources:\n" _E(.)_E(.) "%6\n"
_E(D)_E(b) "Other resources:\n" _E(.)_E(.) "%7\n"
//_E(D)_E(b) "Startup resources:\n" _E(.)_E(.) "%6\n"
_E(D)_E(b) "Custom resources:\n" _E(.)_E(.) "%7\n"
_E(D)_E(b) "Status: " _E(.) "%8")
.arg(title())
.arg(author())
.arg(id())
.arg(int(pluginId()))
.arg(" - " _E(>) + String::join(d->requiredPackages, _E(<) "\n - " _E(>)) + _E(<))
.arg(filesAsText(FF_STARTUP))
//.arg(filesAsText(FF_STARTUP))
.arg(filesAsText(0, false))
.arg(statusAsText());
}
Expand Down
7 changes: 7 additions & 0 deletions doomsday/apps/libdoomsday/src/game_init.cpp
Expand Up @@ -291,6 +291,13 @@ int loadAddonResourcesBusyWorker(void *context)
{
DoomsdayApp::GameChangeParameters &parms = *(DoomsdayApp::GameChangeParameters *) context;

// User-selected files specified in the game itself.
for(String const &path : DoomsdayApp::game().userFiles())
{
NativePath const nativePath(path);
Session::profile().resourceFiles << nativePath.withSeparators('/');
}

char const *startupFiles = CVar_String(Con_FindVariable("file-startup"));

/**
Expand Down

0 comments on commit f41c356

Please sign in to comment.