1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00

Add -playassets command-line option

This is used if you're loading a level file from STDIN. The game needs
to know the actual level assets directory you're referring to, since
when it gets the level from STDIN, it doesn't know the actual filename
of the level.

Fixes #309.
This commit is contained in:
Misa 2020-06-21 15:56:31 -07:00 committed by Ethan Lee
parent d45ff4c269
commit 93b13cadac
3 changed files with 20 additions and 1 deletions

View File

@ -382,6 +382,7 @@ public:
int playrx;
int playry;
int playgc;
std::string playassets;
void quittomenu();
void returntolab();

View File

@ -1623,7 +1623,14 @@ bool editorclass::load(std::string& _path)
}
FILESYSTEM_unmountassets();
FILESYSTEM_mountassets(_path.c_str());
if (game.playassets != "")
{
FILESYSTEM_mountassets(game.playassets.c_str());
}
else
{
FILESYSTEM_mountassets(_path.c_str());
}
tinyxml2::XMLDocument doc;
if (!FILESYSTEM_loadTiXml2Document(_path.c_str(), doc))

View File

@ -53,6 +53,7 @@ int saverx = 0;
int savery = 0;
int savegc = 0;
int savemusic = 0;
std::string playassets;
std::string playtestname;
@ -113,6 +114,15 @@ int main(int argc, char *argv[])
printf("-playing option requires one argument.\n");
return 1;
}
} else if (strcmp(argv[i], "-playassets") == 0) {
if (i + 1 < argc) {
i++;
// Even if this is a directory, FILESYSTEM_mountassets() expects '.vvvvvv' on the end
playassets = "levels/" + std::string(argv[i]) + ".vvvvvv";
} else {
printf("%s option requires one argument.\n", argv[i]);
return 1;
}
}
}
@ -280,6 +290,7 @@ int main(int argc, char *argv[])
if (startinplaytest) {
game.levelpage = 0;
game.playcustomlevel = 0;
game.playassets = playassets;
ed.directoryList.clear();
ed.directoryList.push_back(playtestname);