mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-07 03:12:36 +01:00
use openFilePath to open data files
This commit is contained in:
parent
23e25ed751
commit
810c6658d0
@ -52,8 +52,8 @@ void GameData::load()
|
||||
index.indexGameDirectory(datpath);
|
||||
index.indexTree(datpath);
|
||||
|
||||
// Initalize all the archives.
|
||||
loadIMG("models/gta3.img");
|
||||
/// @todo cuts.img files should be loaded differently to gta3.img
|
||||
loadIMG("anim/cuts.img");
|
||||
|
||||
parseDAT("data/default.dat");
|
||||
@ -101,8 +101,7 @@ void GameData::parseDAT(const std::string& path)
|
||||
if(cmd == "IDE")
|
||||
{
|
||||
auto path = line.substr(space+1);
|
||||
auto systempath = index.findFilePath(path).native();
|
||||
loadIDE(systempath);
|
||||
loadIDE(path);
|
||||
}
|
||||
else if(cmd == "SPLASH")
|
||||
{
|
||||
@ -111,14 +110,13 @@ void GameData::parseDAT(const std::string& path)
|
||||
else if(cmd == "COLFILE")
|
||||
{
|
||||
int zone = atoi(line.substr(space+1,1).c_str());
|
||||
std::string file = line.substr(space+3);
|
||||
loadCOL(zone, file);
|
||||
auto path = line.substr(space+3);
|
||||
loadCOL(zone, path);
|
||||
}
|
||||
else if(cmd == "IPL")
|
||||
{
|
||||
auto path = line.substr(space+1);
|
||||
auto systempath = index.findFilePath(path).native();
|
||||
loadIPL(systempath);
|
||||
loadIPL(path);
|
||||
}
|
||||
else if(cmd == "TEXDICTION")
|
||||
{
|
||||
@ -135,9 +133,10 @@ void GameData::parseDAT(const std::string& path)
|
||||
|
||||
void GameData::loadIDE(const std::string& path)
|
||||
{
|
||||
auto systempath = index.findFilePath(path).native();
|
||||
LoaderIDE idel;
|
||||
|
||||
if(idel.load(path)) {
|
||||
if(idel.load(systempath)) {
|
||||
objectTypes.insert(idel.objects.begin(), idel.objects.end());
|
||||
}
|
||||
else {
|
||||
@ -182,9 +181,10 @@ void GameData::loadIMG(const std::string& name)
|
||||
index.indexArchive(syspath);
|
||||
}
|
||||
|
||||
void GameData::loadIPL(const std::string& name)
|
||||
void GameData::loadIPL(const std::string& path)
|
||||
{
|
||||
iplLocations.insert({name, name});
|
||||
auto systempath = index.findFilePath(path).native();
|
||||
iplLocations.insert({path, systempath});
|
||||
}
|
||||
|
||||
bool GameData::loadZone(const std::string& path)
|
||||
@ -281,9 +281,9 @@ void GameData::loadHandling(const std::string& path)
|
||||
l.loadHandling(syspath, vehicleInfo);
|
||||
}
|
||||
|
||||
SCMFile *GameData::loadSCM(const std::string &name)
|
||||
SCMFile *GameData::loadSCM(const std::string &path)
|
||||
{
|
||||
auto scm_h = openFile(name);
|
||||
auto scm_h = index.openFilePath(path);
|
||||
SCMFile* scm = new SCMFile;
|
||||
scm->loadFile(scm_h->data, scm_h->length);
|
||||
scm_h.reset();
|
||||
@ -292,11 +292,11 @@ SCMFile *GameData::loadSCM(const std::string &name)
|
||||
|
||||
void GameData::loadGXT(const std::string &name)
|
||||
{
|
||||
auto d = openFile(name);
|
||||
auto file = index.openFilePath(name);
|
||||
|
||||
LoaderGXT loader;
|
||||
|
||||
loader.load( texts, d );
|
||||
loader.load( texts, file );
|
||||
}
|
||||
|
||||
void GameData::loadWaterpro(const std::string& path)
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
*/
|
||||
void loadIMG(const std::string& name);
|
||||
|
||||
void loadIPL(const std::string& name);
|
||||
void loadIPL(const std::string& path);
|
||||
|
||||
/**
|
||||
* Loads the Zones from a zon/IPL file
|
||||
@ -100,7 +100,7 @@ public:
|
||||
|
||||
void loadHandling(const std::string& path);
|
||||
|
||||
SCMFile* loadSCM(const std::string& name);
|
||||
SCMFile* loadSCM(const std::string& path);
|
||||
|
||||
void loadGXT(const std::string& name);
|
||||
|
||||
|
@ -119,7 +119,7 @@ RWGame::RWGame(int argc, char* argv[])
|
||||
|
||||
data->loadDynamicObjects(config.getGameDataPath() + "/data/object.dat");
|
||||
|
||||
data->loadGXT(config.getGameLanguage() + ".gxt");
|
||||
data->loadGXT("text/" + config.getGameLanguage() + ".gxt");
|
||||
|
||||
getRenderer()->water.setWaterTable(data->waterHeights, 48, data->realWater, 128*128);
|
||||
|
||||
@ -230,7 +230,7 @@ void RWGame::loadGame(const std::string& savename)
|
||||
|
||||
newGame();
|
||||
|
||||
startScript("main.scm");
|
||||
startScript("data/main.scm");
|
||||
|
||||
if(! SaveGame::loadGame(*state, savename) )
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ void IngameState::startTest()
|
||||
|
||||
void IngameState::startGame()
|
||||
{
|
||||
game->startScript("main.scm");
|
||||
game->startScript("data/main.scm");
|
||||
game->getScript()->startThread(0);
|
||||
getWorld()->sound.playBackground( getWorld()->data->getDataPath() + "/audio/City.wav" );
|
||||
}
|
||||
|
@ -12,8 +12,6 @@ BOOST_AUTO_TEST_CASE(test_object_data)
|
||||
|
||||
gd.load();
|
||||
|
||||
gd.loadIDE(Global::getGamePath() + "/data/maps/generic.ide");
|
||||
|
||||
{
|
||||
auto def = gd.findObjectType<ObjectData>(1100);
|
||||
|
||||
|
@ -12,7 +12,7 @@ BOOST_AUTO_TEST_SUITE(TextTests)
|
||||
BOOST_AUTO_TEST_CASE(load_test)
|
||||
{
|
||||
{
|
||||
auto d = Global::get().e->data->openFile("english.gxt");
|
||||
auto d = Global::get().e->data->index.openFilePath("text/english.gxt");
|
||||
|
||||
GameTexts texts;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user