Esempio n. 1
0
void ViewerWindow::loadGame(const QString &path)
{
	QDir gameDir( path );

	if( gameDir.exists() && path.size() > 0 ) {
		gameData = new GameData( &engineLog, &work, gameDir.absolutePath().toStdString() );
		gameWorld = new GameWorld( &engineLog, &work, gameData );
		renderer = new GameRenderer(&engineLog, gameData );
		viewerWidget->setRenderer(renderer);

		gameWorld->data->load();

		// Initalize all the archives.
		gameWorld->data->loadIMG("/models/gta3");
		gameWorld->data->loadIMG("/models/txd");
		gameWorld->data->loadIMG("/anim/cuts");

		loadedData(gameWorld);
	}

	QSettings settings("OpenRW", "rwviewer");
	QStringList recent = settings.value("recentGames").toStringList();
	recent.removeAll( path );
	recent.prepend( path );
	while(recent.size() > MaxRecentGames) recent.removeLast();
	settings.setValue("recentGames", recent);

	updateRecentGames();
}
Esempio n. 2
0
void *Loader::loadModule(const char *fileName)
{
    auto loadedInstace = std::shared_ptr<LoadedInstance>(new LoadedInstance());
    loadedInstace->load(fileName);

    if (loadedInstace->loaded()) {
        m_private->m_loadedInstances[fileName] = loadedInstace;
    }
    return loadedInstace->loadedData();
}
Esempio n. 3
0
void Serialise::Load(int pType)
{
	switch (pType)
	{
	case LEVEL:
		mExtension = ".lvl";
	}

	mFilename.append(mExtension);

	std::ifstream loadedData(mFilename);

	int arrayIndex = 0;
	int lineIndex = 0;
	string line;
	if (loadedData.is_open())
	{

		while (getline(loadedData, line))				// Takes the line in loadedData, puts that into the line, loops and increases.
		{
			if (line == "***")							// Check for end of file as marked by ***
			{
				return;
			}
			if (line == "LEVEL")						// Set the type of data being loaded
			{
				Serialise::type = LEVEL;
			}
			if (line == "0")							// Check for 0, load a boolean 0 to the array
			{
				mLoadedLevel[arrayIndex] = 0;
				arrayIndex++;
			}
			if (line == "1")							// Check for 1, load a boolean 1 to the array
			{
				mLoadedLevel[arrayIndex] = 1;
				arrayIndex++;
			}
			switch (lineIndex)							// Once we've reached line 340, start checking for positions
			{
			case 345:
			{mGl_goal.yloc = line.find("1"); }
				break;
			case 344:
			{mGl_goal.xloc = line.find("1"); }
				break;
			case 343:
			{mGl_enemy.yloc = line.find("1"); }
				break;
			case 342:
			{mGl_enemy.xloc = line.find("1"); }
				break;
			case 341:
			{mGl_player.yloc = line.find("1"); }
				break;
			case 340:
			{mGl_player.xloc = line.find("1"); }
				break;
			}
			lineIndex++;

		}
	}

	return;
}