Пример #1
0
Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) {
	if (_fallBack && SearchMan.hasFile(filename)) {
		return SearchMan.createReadStreamForMember(filename);
	}

	return createReadStreamForMember(filename);
}
Пример #2
0
Common::SeekableReadStream *XARCArchive::createReadStreamForMember(const Common::String &name) const {
	for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) {
		if ((*it)->getName() == name) {
			// Found it
			return createReadStreamForMember((const XARCMember *)it->get());
		}
	}

	// Not found
	return 0;
}
Пример #3
0
// Get a stream to file in the archive
//  - same as createReadStreamForMember except it checks if the file exists and will assert / output a debug message if not
Common::SeekableReadStream *ResourceManager::getFileStream(const Common::String &name) const {

	// Check if the file exits in the archive
	if (!hasFile(name)) {
		debugC(2, kLastExpressDebugResource, "Error opening file: %s", name.c_str());
		return NULL;
	}

	debugC(2, kLastExpressDebugResource, "Opening file: %s", name.c_str());

	return createReadStreamForMember(name);
}
Пример #4
0
Font *ResourceManager::loadFont() const {
	// Open the resource
	Common::SeekableReadStream *stream = createReadStreamForMember("font.dat");
	if (!stream)
		return NULL;

	// Create the new background
	Font *f = new Font();
	if (!f->load(stream)) {
		delete f;
		// stream should be freed by the Font instance
		return NULL;
	}

	return f;
}
Пример #5
0
Cursor *ResourceManager::loadCursor() const {
	// Open the resource
	Common::SeekableReadStream *stream = createReadStreamForMember("cursors.tbm");
	if (!stream)
		return NULL;

	// Create the new background
	Cursor *c = new Cursor();
	if (!c->load(stream)) {
		delete c;
		// stream should be freed by the Cursor instance
		return NULL;
	}

	return c;
}
Пример #6
0
Background *ResourceManager::loadBackground(const Common::String &name) const {
	// Open the resource
	Common::SeekableReadStream *stream = createReadStreamForMember(name + ".bg");
	if (!stream)
		return NULL;

	// Create the new background & load the data
	Background *bg = new Background();
	if (!bg->load(stream)) {
		delete bg;
		// stream should be freed by the Background instance
		return NULL;
	}

	return bg;
}