[Scummvm-cvs-logs] SF.net SVN: scummvm:[34921] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Fri Nov 7 09:47:59 CET 2008


Revision: 34921
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34921&view=rev
Author:   peres001
Date:     2008-11-07 08:47:59 +0000 (Fri, 07 Nov 2008)

Log Message:
-----------
Implemented a Common::Archive subclass to handle the content of archives in Nippon Safes. Common::File is now used only to load archives.
 

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/disk.h
    scummvm/trunk/engines/parallaction/disk_ns.cpp

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2008-11-06 23:29:48 UTC (rev 34920)
+++ scummvm/trunk/engines/parallaction/disk.h	2008-11-07 08:47:59 UTC (rev 34921)
@@ -82,50 +82,42 @@
 
 #define MAX_ARCHIVE_ENTRIES			384
 
-class Archive : public Common::SeekableReadStream {
+class NSArchive : public Common::Archive {
 
-protected:
-	bool			_file;
-	uint32			_fileOffset;
-	uint32			_fileCursor;
-	uint32			_fileEndOffset;
-	Common::String	_archiveName;
+	Common::SeekableReadStream	*_stream;
+
 	char			_archiveDir[MAX_ARCHIVE_ENTRIES][32];
 	uint32			_archiveLenghts[MAX_ARCHIVE_ENTRIES];
 	uint32			_archiveOffsets[MAX_ARCHIVE_ENTRIES];
-	Common::File	_archive;
 	uint32			_numFiles;
 
-protected:
-	void resetArchivedFile();
+	uint32 			lookup(const char *name);
 
 public:
-	Archive();
+	NSArchive(Common::SeekableReadStream *stream, Common::Platform platform, uint32 features);
+	~NSArchive();
 
-	void open(const char* file);
-	void close();
-	Common::String name() const;
-	bool openArchivedFile(const char *name);
-	void closeArchivedFile();
-	int32 size() const;
-	int32 pos() const;
-	bool eos() const;
-	bool seek(int32 offs, int whence = SEEK_SET);
-	uint32 read(void *dataPtr, uint32 dataSize);
+	Common::SeekableReadStream *openFile(const Common::String &name);
+	bool hasFile(const Common::String &name);
+	int listMembers(Common::ArchiveMemberList &list);
+	Common::ArchiveMemberPtr getMember(const Common::String &name);
 };
 
 class Disk_ns : public Disk {
 
 protected:
-	Archive			_resArchive;
-	Archive			_locArchive;
-	char			_languageDir[3];
-	Parallaction	*_vm;
+	Parallaction		*_vm;
 
-protected:
-	void errorFileNotFound(const char *s);
+	NSArchive			*_resArchive;
+	NSArchive			*_locArchive;
+
+	Common::String		_resArchiveName;
+	Common::String		_language;
 	Common::SeekableReadStream *openFile(const char *filename);
 	Common::SeekableReadStream *tryOpenFile(const char *filename);
+	virtual Common::SeekableReadStream *tryOpenExternalFile(const char *filename);
+	virtual Common::SeekableReadStream *tryOpenArchivedFile(const char* name) { return 0; }
+	void errorFileNotFound(const char *filename);
 
 public:
 	Disk_ns(Parallaction *vm);
@@ -149,8 +141,7 @@
 
 protected:
 	Gfx	 *_gfx;
-	Common::SeekableReadStream *tryOpenArchivedFile(const char* name);
-	Common::SeekableReadStream *openArchivedFile(const char* name);
+	virtual Common::SeekableReadStream *tryOpenArchivedFile(const char* name);
 
 public:
 	DosDisk_ns(Parallaction *vm);
@@ -180,7 +171,6 @@
 	void unpackFrame(byte *dst, byte *src, uint16 planeSize);
 	void unpackBitmap(byte *dst, byte *src, uint16 numFrames, uint16 bytesPerPlane, uint16 height);
 	Common::SeekableReadStream *tryOpenArchivedFile(const char* name);
-	Common::SeekableReadStream *openArchivedFile(const char* name);
 	Font *createFont(const char *name, Common::SeekableReadStream &stream);
 	void loadMask(BackgroundInfo& info, const char *name);
 	void loadPath(BackgroundInfo& info, const char *name);

Modified: scummvm/trunk/engines/parallaction/disk_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk_ns.cpp	2008-11-06 23:29:48 UTC (rev 34920)
+++ scummvm/trunk/engines/parallaction/disk_ns.cpp	2008-11-07 08:47:59 UTC (rev 34921)
@@ -60,202 +60,99 @@
 #define NORMAL_ARCHIVE_DATA_OFS		0x4000
 #define SMALL_ARCHIVE_DATA_OFS		0x1966
 
-Archive::Archive() {
-	resetArchivedFile();
-}
+NSArchive::NSArchive(Common::SeekableReadStream *stream, Common::Platform platform, uint32 features) : _stream(stream) {
+	if (!_stream) {
+		error("NSArchive: invalid stream passed to constructor");
+	}
 
-void Archive::open(const char *file) {
-	debugC(1, kDebugDisk, "Archive::open(%s)", file);
+ 	bool isSmallArchive = false;
+	if (platform == Common::kPlatformAmiga) {
+		if (features & GF_DEMO) {
+ 			isSmallArchive = stream->size() == SIZEOF_SMALL_ARCHIVE;
+		} else if (features & GF_LANG_MULT) {
+ 			isSmallArchive = (stream->readUint32BE() != MKID_BE('NDOS'));
+ 		}
+ 	}
 
-	if (_archive.isOpen())
-		close();
+ 	_numFiles = (isSmallArchive) ? SMALL_ARCHIVE_FILES_NUM : NORMAL_ARCHIVE_FILES_NUM;
 
-	if (!_archive.open(file))
-		error("archive '%s' not found", file);
+	_stream->seek(ARCHIVE_FILENAMES_OFS);
+	_stream->read(_archiveDir, _numFiles*32);
 
-	_archiveName = file;
+	_stream->seek((isSmallArchive) ? SMALL_ARCHIVE_SIZES_OFS : NORMAL_ARCHIVE_SIZES_OFS);
 
-	bool isSmallArchive = false;
-	if (_vm->getPlatform() == Common::kPlatformAmiga) {
-		if (_vm->getFeatures() & GF_DEMO) {
-			isSmallArchive = _archive.size() == SIZEOF_SMALL_ARCHIVE;
-		} else if (_vm->getFeatures() & GF_LANG_MULT) {
-			isSmallArchive = (_archive.readUint32BE() != MKID_BE('NDOS'));
-		}
+ 	uint32 dataOffset = (isSmallArchive) ? SMALL_ARCHIVE_DATA_OFS : NORMAL_ARCHIVE_DATA_OFS;
+ 	for (uint16 i = 0; i < _numFiles; i++) {
+ 		_archiveOffsets[i] = dataOffset;
+		_archiveLenghts[i] = _stream->readUint32BE();
+ 		dataOffset += _archiveLenghts[i];
 	}
 
-	_numFiles = (isSmallArchive) ? SMALL_ARCHIVE_FILES_NUM : NORMAL_ARCHIVE_FILES_NUM;
-
-	_archive.seek(ARCHIVE_FILENAMES_OFS);
-	_archive.read(_archiveDir, _numFiles*32);
-
-	_archive.seek((isSmallArchive) ? SMALL_ARCHIVE_SIZES_OFS : NORMAL_ARCHIVE_SIZES_OFS);
-
-	uint32 dataOffset = (isSmallArchive) ? SMALL_ARCHIVE_DATA_OFS : NORMAL_ARCHIVE_DATA_OFS;
-	for (uint16 i = 0; i < _numFiles; i++) {
-		_archiveOffsets[i] = dataOffset;
-		_archiveLenghts[i] = _archive.readUint32BE();
-		dataOffset += _archiveLenghts[i];
-	}
-
-	return;
 }
 
-
-void Archive::close() {
-	if (!_archive.isOpen()) return;
-
-	resetArchivedFile();
-
-	_archive.close();
-	_archiveName.clear();
+NSArchive::~NSArchive() {
+	delete _stream;
 }
 
-Common::String Archive::name() const {
-	return _archiveName;
+uint32 NSArchive::lookup(const char *name) {
+	uint32 i = 0;
+ 	for ( ; i < _numFiles; i++) {
+		if (!scumm_stricmp(_archiveDir[i], name)) break;
+ 	}
+	return i;
 }
 
-bool Archive::openArchivedFile(const char *filename) {
-	debugC(3, kDebugDisk, "Archive::openArchivedFile(%s)", filename);
+Common::SeekableReadStream *NSArchive::openFile(const Common::String &name) {
+	debugC(3, kDebugDisk, "NSArchive::openFile(%s)", name.c_str());
 
-	resetArchivedFile();
+	if (name.empty())
+		return 0;
 
-	debugC(3, kDebugDisk, "Archive::openArchivedFile(%s)", filename);
+	uint32 index = lookup(name.c_str());
+	if (index == _numFiles) return 0;
 
-	if (!_archive.isOpen())
-		error("Archive::openArchivedFile: the archive is not open");
+	debugC(9, kDebugDisk, "NSArchive::openFile: '%s' found in slot %i", name.c_str(), index);
 
-	uint16 i = 0;
-	for ( ; i < _numFiles; i++) {
-		if (!scumm_stricmp(_archiveDir[i], filename)) break;
-	}
-	if (i == _numFiles) return false;
-
-	debugC(9, kDebugDisk, "Archive::openArchivedFile: '%s' found in slot %i", filename, i);
-
-	_file = true;
-
-	_fileOffset = _archiveOffsets[i];
-	_fileCursor = _archiveOffsets[i];
-	_fileEndOffset = _archiveOffsets[i] + _archiveLenghts[i];
-
-	_archive.seek(_fileOffset);
-
-	return true;
+	int offset = _archiveOffsets[index];
+	int endOffset = _archiveOffsets[index] + _archiveLenghts[index];
+	return new Common::SeekableSubReadStream(_stream, offset, endOffset, false);
 }
 
-void Archive::resetArchivedFile() {
-	_file = false;
-	_fileCursor = 0;
-	_fileOffset = 0;
-	_fileEndOffset = 0;
+bool NSArchive::hasFile(const Common::String &name) {
+	if (name.empty())
+		return false;
+	return lookup(name.c_str()) != _numFiles;
 }
 
-void Archive::closeArchivedFile() {
-	resetArchivedFile();
+int NSArchive::listMembers(Common::ArchiveMemberList &list) {
+	for (uint32 i = 0; i < _numFiles; i++) {
+		list.push_back(Common::SharedPtr<Common::GenericArchiveMember>(new Common::GenericArchiveMember(_archiveDir[i], this)));
+	}
+	return _numFiles;
 }
 
+Common::ArchiveMemberPtr NSArchive::getMember(const Common::String &name) {
+	uint32 index = lookup(name.c_str());
 
-int32 Archive::size() const {
-	return (_file == true ? _fileEndOffset - _fileOffset : 0);
-}
-
-int32 Archive::pos() const {
-	return (_file == true ? _fileCursor - _fileOffset : 0 );
-}
-
-bool Archive::eos() const {
-	return (_file == true ? _fileCursor == _fileEndOffset : true ); // FIXME (eos definition change)
-}
-
-bool Archive::seek(int32 offs, int whence) {
-	assert(_file == true && _fileCursor <= _fileEndOffset);
-
-	switch (whence) {
-	case SEEK_CUR:
-		_fileCursor += offs;
-		break;
-	case SEEK_SET:
-		_fileCursor = _fileOffset + offs;
-		break;
-	case SEEK_END:
-		_fileCursor = _fileEndOffset - offs;
-		break;
+	char *item = 0;
+	if (index < _numFiles) {
+		item = _archiveDir[index];
 	}
-	assert(_fileCursor <= _fileEndOffset && _fileCursor >= _fileOffset);
 
-	return _archive.seek(_fileCursor, SEEK_SET);
+	return Common::SharedPtr<Common::GenericArchiveMember>(new Common::GenericArchiveMember(item, this));
 }
 
-uint32 Archive::read(void *dataPtr, uint32 dataSize) {
-//	printf("read(%i, %i)\n", file->_cursor, file->_endOffset);
-	if (_file == false)
-		error("Archive::read: no archived file is currently open");
 
-	if (_fileCursor >= _fileEndOffset)
-		error("can't read beyond end of archived file");
 
-	if (_fileEndOffset - _fileCursor < dataSize)
-		dataSize = _fileEndOffset - _fileCursor;
 
-	int32 readBytes = _archive.read(dataPtr, dataSize);
-	_fileCursor += readBytes;
-
-	return readBytes;
+Disk_ns::Disk_ns(Parallaction *vm) : _vm(vm), _language("ur") {
+	_locArchive = 0;
+	_resArchive = 0;
 }
 
-
-
-
-
-/*
-	This stream class is just a wrapper around Archive, so
-	deallocation is not a problem. In fact, this class doesn't
-	delete its input (Archive) stream.
-*/
-class DummyArchiveStream : public Common::SeekableReadStream {
-
-	Archive *_input;
-
-public:
-	DummyArchiveStream(Archive &input) : _input(&input) {
-
-	}
-
-	~DummyArchiveStream() {
-		// this class exists to provide this empty destructor
-	}
-
-	bool eos() const {
-		return _input->eos();
-	}
-
-	uint32 read(void* data, uint32 dataSize) {
-		return _input->read(data, dataSize);
-	}
-
-	int32 pos() const {
-		return _input->pos();
-	}
-
-	int32 size() const {
-		return _input->size();
-	}
-
-	bool seek(int32 offset, int whence) {
-		return _input->seek(offset, whence);
-	}
-
-};
-
-
-
-Disk_ns::Disk_ns(Parallaction *vm) : _vm(vm) {
-
-}
-
 Disk_ns::~Disk_ns() {
-
+	delete _resArchive;
+	delete _locArchive;
 }
 
 void Disk_ns::errorFileNotFound(const char *s) {
@@ -270,6 +167,13 @@
 }
 
 Common::SeekableReadStream *Disk_ns::tryOpenFile(const char *filename) {
+	Common::SeekableReadStream *stream = tryOpenExternalFile(filename);
+	if (stream)
+		return stream;
+	return tryOpenArchivedFile(filename);
+}
+
+Common::SeekableReadStream *Disk_ns::tryOpenExternalFile(const char *filename) {
 	assert(filename);
 	Common::File *stream = new Common::File;
 	if (!stream->open(filename)) {
@@ -280,17 +184,31 @@
 }
 
 Common::String Disk_ns::selectArchive(const Common::String& name) {
-	Common::String oldName = _resArchive.name();
-	_resArchive.open(name.c_str());
+	if (name.compareToIgnoreCase(_resArchiveName) == 0) {
+		return _resArchiveName;
+	}
+
+	debugC(1, kDebugDisk, "Disk_ns::selectArchive(%s)", name.c_str());
+
+	Common::String oldName = _resArchiveName;
+	delete _resArchive;
+	_resArchive = new NSArchive(tryOpenExternalFile(name.c_str()), _vm->getPlatform(), _vm->getFeatures());
 	return oldName;
 }
 
 void Disk_ns::setLanguage(uint16 language) {
 	debugC(1, kDebugDisk, "setLanguage(%i)", language);
 	assert(language < 4);
-	const char *languages[] = { "it", "fr", "en", "ge" };
-	sprintf(_languageDir, "%s/", languages[language]);
-	_locArchive.open(languages[language]);
+
+	static const char *languages[] = { "it", "fr", "en", "ge" };
+
+	if (_language.compareToIgnoreCase(languages[language]) == 0) {
+		return;
+	}
+
+	_language = languages[language];
+	delete _locArchive;
+	_locArchive = new NSArchive(tryOpenExternalFile(_language.c_str()), _vm->getPlatform(), _vm->getFeatures());
 }
 
 #pragma mark -
@@ -304,28 +222,29 @@
 DosDisk_ns::~DosDisk_ns() {
 }
 
+
 Common::SeekableReadStream *DosDisk_ns::tryOpenArchivedFile(const char* name) {
 	debugC(3, kDebugDisk, "DosDisk_ns::openArchivedFile(%s)", name);
 
-	if (_resArchive.openArchivedFile(name)) {
-		return new DummyArchiveStream(_resArchive);
+	NSArchive *arc = 0;
+
+	Common::String filename(name);
+	if (filename.hasSuffix(".loc")) {
+		arc = _locArchive;
+	} else {
+		arc = _resArchive;
 	}
 
-	char path[PATH_LEN];
-	sprintf(path, "%s.pp", name);
-	if (_resArchive.openArchivedFile(path)) {
-		return new DummyArchiveStream(_resArchive);
+	Common::SeekableReadStream *stream = arc->openFile(name);
+	if (stream) {
+		return stream;
 	}
 
-	return 0;
+	char path[PATH_LEN];
+	sprintf(path, "%s.pp", name);
+	return arc->openFile(path);
 }
 
-Common::SeekableReadStream *DosDisk_ns::openArchivedFile(const char* name) {
-	Common::SeekableReadStream *stream = tryOpenArchivedFile(name);
-	if (!stream)
-		errorFileNotFound(name);
-	return stream;
-}
 
 //
 // loads a cnv from an external file
@@ -353,7 +272,7 @@
 
 Frames* DosDisk_ns::loadCnv(const char *filename) {
 
-	Common::SeekableReadStream *stream = openArchivedFile(filename);
+	Common::SeekableReadStream *stream = openFile(filename);
 
 	uint16 numFrames = stream->readByte();
 	uint16 width = stream->readByte();
@@ -390,25 +309,24 @@
 Script* DosDisk_ns::loadLocation(const char *name) {
 
 	char archivefile[PATH_LEN];
-	sprintf(archivefile, "%s%s%s.loc", _vm->_char.getBaseName(), _languageDir, name);
+	sprintf(archivefile, "%s%s/%s.loc", _vm->_char.getBaseName(), _language.c_str(), name);
 
 	debugC(3, kDebugDisk, "DosDisk_ns::loadLocation(%s): trying '%s'", name, archivefile);
 
-	if (!_locArchive.openArchivedFile(archivefile)) {
-		sprintf(archivefile, "%s%s.loc", _languageDir, name);
+	Common::SeekableReadStream *stream = tryOpenFile(archivefile);
+	if  (!stream) {
+		sprintf(archivefile, "%s/%s.loc", _language.c_str(), name);
 		debugC(3, kDebugDisk, "DosDisk_ns::loadLocation(%s): trying '%s'", name, archivefile);
-
-		if (!_locArchive.openArchivedFile(archivefile))
-			errorFileNotFound(name);
+		stream = openFile(archivefile);
 	}
 
-	return new Script(new DummyArchiveStream(_locArchive), true);
+	return new Script(stream, true);
 }
 
 Script* DosDisk_ns::loadScript(const char* name) {
 	char path[PATH_LEN];
 	sprintf(path, "%s.script", name);
-	Common::SeekableReadStream *stream = openArchivedFile(path);
+	Common::SeekableReadStream *stream = openFile(path);
 	return new Script(stream, true);
 }
 
@@ -460,9 +378,12 @@
 	byte b;
 	uint32 i = 0;
 
-	while (!stream->eos()) {
+	while (1) {
 		b = stream->readByte();
 
+		if (stream->eos())
+			break;
+
 		path[i/8] |= ((b & 0x80) >> 7) << (i & 7);
 		mask[i/4] |= ((b & 0x60) >> 5) << ((i & 3) << 1);
 		screen[i] = b & 0x1F;
@@ -507,9 +428,8 @@
 }
 
 void DosDisk_ns::loadBackground(BackgroundInfo& info, const char *filename) {
+	Common::SeekableReadStream *stream = openFile(filename);
 
-	Common::SeekableReadStream *stream = openArchivedFile(filename);
-
 	info.width = _vm->_screenWidth;	// 320
 	info.height = _vm->_screenHeight;	// 200
 
@@ -522,6 +442,7 @@
 
 	Graphics::PackBitsReadStream pbstream(*stream);
 	unpackBackground(&pbstream, (byte*)info.bg.pixels, info.mask.data, info.path.data);
+
 	delete stream;
 }
 
@@ -534,7 +455,7 @@
 void DosDisk_ns::loadMaskAndPath(BackgroundInfo& info, const char *name) {
 	char path[PATH_LEN];
 	sprintf(path, "%s.msk", name);
-	Common::SeekableReadStream *stream = openArchivedFile(path);
+	Common::SeekableReadStream *stream = openFile(path);
 	parseDepths(info, *stream);
 	info.path.create(info.width, info.height);
 	stream->read(info.path.data, info.path.size);
@@ -901,25 +822,23 @@
 	debugC(1, kDebugDisk, "AmigaDisk_ns()::loadLocation '%s'", name);
 
 	char path[PATH_LEN];
-	sprintf(path, "%s%s%s.loc.pp", _vm->_char.getBaseName(), _languageDir, name);
+	sprintf(path, "%s%s/%s.loc", _vm->_char.getBaseName(), _language.c_str(), name);
 
-	if (!_locArchive.openArchivedFile(path)) {
-		sprintf(path, "%s%s.loc.pp", _languageDir, name);
-		if (!_locArchive.openArchivedFile(path)) {
-			errorFileNotFound(name);
-		}
+	Common::SeekableReadStream *stream = tryOpenFile(path);
+	if (!stream) {
+		sprintf(path, "%s/%s.loc", _language.c_str(), name);
+		stream = openFile(path);
 	}
 
 	debugC(3, kDebugDisk, "location file found: %s", path);
-
-	return new Script(new PowerPackerStream(_locArchive), true);
+	return new Script(stream, true);
 }
 
 Script* AmigaDisk_ns::loadScript(const char* name) {
 	debugC(1, kDebugDisk, "AmigaDisk_ns::loadScript '%s'", name);
 	char path[PATH_LEN];
 	sprintf(path, "%s.script", name);
-	Common::SeekableReadStream *stream = openArchivedFile(path);
+	Common::SeekableReadStream *stream = openFile(path);
 	return new Script(stream, true);
 }
 
@@ -931,40 +850,41 @@
 
 GfxObj* AmigaDisk_ns::loadStatic(const char* name) {
 	debugC(1, kDebugDisk, "AmigaDisk_ns::loadStatic '%s'", name);
-	Common::SeekableReadStream *s = openArchivedFile(name);
+	Common::SeekableReadStream *s = openFile(name);
 	return new GfxObj(0, makeCnv(s, true), name);
 }
 
 Common::SeekableReadStream *AmigaDisk_ns::tryOpenArchivedFile(const char* name) {
 	debugC(3, kDebugDisk, "AmigaDisk_ns::openArchivedFile(%s)", name);
 
-	if (_resArchive.openArchivedFile(name)) {
-		return new DummyArchiveStream(_resArchive);
+	NSArchive *arc = 0;
+
+	Common::String filename(name);
+	if (filename.hasSuffix(".loc")) {
+		arc = _locArchive;
+	} else {
+		arc = _resArchive;
 	}
 
-	char path[PATH_LEN];
+	Common::SeekableReadStream *stream = arc->openFile(name);
+	if (stream)
+		return stream;
 
+	char path[PATH_LEN];
 	sprintf(path, "%s.pp", name);
-	if (_resArchive.openArchivedFile(path)) {
-		return new PowerPackerStream(_resArchive);
-	}
+	stream = arc->openFile(path);
+	if (stream)
+		return new PowerPackerStream(*stream);
 
 	sprintf(path, "%s.dd", name);
-	if (_resArchive.openArchivedFile(path)) {
-		return new PowerPackerStream(_resArchive);
-	}
+	stream = arc->openFile(path);
+	if (stream)
+		return new PowerPackerStream(*stream);
 
 	return 0;
 }
 
-Common::SeekableReadStream *AmigaDisk_ns::openArchivedFile(const char* name) {
-	Common::SeekableReadStream *stream = tryOpenArchivedFile(name);
-	if (!stream)
-		errorFileNotFound(name);
-	return stream;
-}
 
-
 /*
 	FIXME: mask values are not computed correctly for level 1 and 2
 
@@ -1044,7 +964,7 @@
 
 void AmigaDisk_ns::loadBackground(BackgroundInfo& info, const char *name) {
 
-	Common::SeekableReadStream *s = openArchivedFile(name);
+	Common::SeekableReadStream *s = openFile(name);
 
 	byte *pal;
 	PaletteFxRange ranges[6];
@@ -1086,7 +1006,7 @@
 	char path[PATH_LEN];
 	sprintf(path, "%s.mask", name);
 
-	Common::SeekableReadStream *s = tryOpenArchivedFile(path);
+	Common::SeekableReadStream *s = tryOpenFile(path);
 	if (!s) {
 		debugC(5, kDebugDisk, "Mask file not found");
 		return;	// no errors if missing mask files: not every location has one
@@ -1120,7 +1040,7 @@
 	char path[PATH_LEN];
 	sprintf(path, "%s.path", name);
 
-	Common::SeekableReadStream *s = tryOpenArchivedFile(path);
+	Common::SeekableReadStream *s = tryOpenFile(path);
 	if (!s)
 		return;	// no errors if missing path files: not every location has one
 
@@ -1168,9 +1088,9 @@
 	char path[PATH_LEN];
 	sprintf(path, "anims/%s", name);
 
-	Common::SeekableReadStream *s = tryOpenArchivedFile(path);
+	Common::SeekableReadStream *s = tryOpenFile(path);
 	if (!s)
-		s = openArchivedFile(name);
+		s = openFile(name);
 
 	return makeCnv(s, true);
 }
@@ -1179,7 +1099,7 @@
 	debugC(1, kDebugDisk, "AmigaDisk_ns::loadHead '%s'", name);
 	char path[PATH_LEN];
 	sprintf(path, "%s.head", name);
-	Common::SeekableReadStream *s = openArchivedFile(path);
+	Common::SeekableReadStream *s = openFile(path);
 	return new GfxObj(0, makeCnv(s, true), name);
 }
 
@@ -1193,7 +1113,7 @@
 	else
 		sprintf(path, "objs/%s.objs", name);
 
-	Common::SeekableReadStream *s = openArchivedFile(path);
+	Common::SeekableReadStream *s = openFile(path);
 	return new GfxObj(0, makeCnv(s, true), name);
 }
 
@@ -1207,9 +1127,9 @@
 	else
 		sprintf(path, "talk/%s.talk", name);
 
-	Common::SeekableReadStream *s = tryOpenArchivedFile(path);
+	Common::SeekableReadStream *s = tryOpenFile(path);
 	if (!s) {
-		s = openArchivedFile(name);
+		s = openFile(name);
 	}
 	return new GfxObj(0, makeCnv(s, true), name);
 }
@@ -1218,20 +1138,16 @@
 	debugC(1, kDebugDisk, "AmigaDisk_ns::loadTable '%s'", name);
 
 	char path[PATH_LEN];
-	Common::SeekableReadStream *stream = 0;
-
 	if (!scumm_stricmp(name, "global")) {
 		sprintf(path, "%s.table", name);
-		stream = openFile(path);
 	} else {
 		if (!(_vm->getFeatures() & GF_DEMO))
 			sprintf(path, "objs/%s.table", name);
 		else
 			sprintf(path, "%s.table", name);
-
-		stream = openArchivedFile(path);
 	}
 
+	Common::SeekableReadStream *stream = openFile(path);
 	Table *t = createTableFromStream(100, *stream);
 	delete stream;
 
@@ -1244,15 +1160,7 @@
 	char path[PATH_LEN];
 	sprintf(path, "%sfont", name);
 
-	Common::SeekableReadStream *stream = 0;
-
-	if (_vm->getFeatures() & GF_LANG_IT) {
-		// Italian version has separate font files
-		stream = openFile(path);
-	} else {
-		stream = openArchivedFile(path);
-	}
-
+	Common::SeekableReadStream *stream = openFile(path);
 	Font *font = createFont(name, *stream);
 	delete stream;
 
@@ -1261,14 +1169,14 @@
 
 
 Common::SeekableReadStream* AmigaDisk_ns::loadMusic(const char* name) {
-	return tryOpenArchivedFile(name);
+	return tryOpenFile(name);
 }
 
 Common::ReadStream* AmigaDisk_ns::loadSound(const char* name) {
 	char path[PATH_LEN];
 	sprintf(path, "%s.snd", name);
 
-	return tryOpenArchivedFile(path);
+	return tryOpenFile(path);
 }
 
 } // namespace Parallaction


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list