diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/parallaction/animation.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/archive.cpp | 23 | ||||
-rw-r--r-- | engines/parallaction/disk.h | 13 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 4 | ||||
-rw-r--r-- | engines/parallaction/location.cpp | 2 |
5 files changed, 22 insertions, 22 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp index 2bfbba16e2..25e2e937c0 100644 --- a/engines/parallaction/animation.cpp +++ b/engines/parallaction/animation.cpp @@ -259,7 +259,7 @@ void Parallaction::loadProgram(Animation *a, char *filename) { if (!_archive.openArchivedFile(vC8)) errorFileNotFound(vC8); - uint32 size = _archive.getArchivedFileLength(vC8); + uint32 size = _archive.getArchivedFileLength(); char* src = (char*)memAlloc(size+1); _archive.readArchivedFile(src, size); diff --git a/engines/parallaction/archive.cpp b/engines/parallaction/archive.cpp index 5fb69cb852..9d3aced9eb 100644 --- a/engines/parallaction/archive.cpp +++ b/engines/parallaction/archive.cpp @@ -27,6 +27,9 @@ namespace Parallaction { +Archive::Archive() { + resetArchivedFile(); +} void Archive::open(const char *file) { debugC(1, kDebugDisk, "open archive '%s'", file); @@ -67,11 +70,14 @@ void Archive::close() { if (!_archive.isOpen()) return; + resetArchivedFile(); + _archive.close(); } bool Archive::openArchivedFile(const char *name) { + resetArchivedFile(); uint16 i = 0; for ( ; i < MAX_ARCHIVE_ENTRIES; i++) { @@ -93,26 +99,23 @@ bool Archive::openArchivedFile(const char *name) { return true; } - -void Archive::closeArchivedFile() { +void Archive::resetArchivedFile() { _file = false; _fileIndex = 0; _fileCursor = 0; _fileOffset = 0; _fileEndOffset = 0; - return; } +void Archive::closeArchivedFile() { + resetArchivedFile(); +} -uint16 Archive::getArchivedFileLength(const char *name) { -// printf("getArchivedFileLength(%s)\n", name); - for (uint16 i = 0; i < MAX_ARCHIVE_ENTRIES; i++) { - if (!scumm_stricmp(_archiveDir[i], name)) - return _archiveLenghts[i]; - } +uint16 Archive::getArchivedFileLength() { +// printf("getArchivedFileLength(%s)\n", name); - return 0; + return (_file == true ? _fileEndOffset - _fileOffset : 0); } diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 45663198a1..256d94b77a 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -53,14 +53,11 @@ protected: Common::File _archive; +protected: + void resetArchivedFile(); + public: - Archive() { - _file = false; - _fileIndex = 0; - _fileOffset = 0; - _fileCursor = 0; - _fileEndOffset = 0; - } + Archive(); void open(const char *file); void close(); @@ -68,7 +65,7 @@ public: bool openArchivedFile(const char *name); void closeArchivedFile(); - uint16 getArchivedFileLength(const char *name); + uint16 getArchivedFileLength(); int16 readArchivedFile(void *buffer, uint16 size); char *readArchivedFileText(char *buf, uint16 size); diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 4404ee1896..8ad13ccdf3 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -1035,7 +1035,7 @@ void Graphics::loadStaticCnv(const char *filename, StaticCnv *cnv) { _vm->_archive.readArchivedFile(&unk, 1); cnv->_height = unk; - uint16 compressedsize = _vm->_archive.getArchivedFileLength(path) - 3; + uint16 compressedsize = _vm->_archive.getArchivedFileLength() - 3; byte *compressed = (byte*)memAlloc(compressedsize); uint16 size = cnv->_width*cnv->_height; @@ -1080,7 +1080,7 @@ void Graphics::loadCnv(const char *filename, Cnv *cnv) { cnv->_array = (byte**)memAlloc(cnv->_count * sizeof(byte*)); - uint32 size = _vm->_archive.getArchivedFileLength(path) - 3; + uint32 size = _vm->_archive.getArchivedFileLength() - 3; byte *buf = (byte*)memAlloc(size); _vm->_archive.readArchivedFile(buf, size); diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index f767b49fe6..7f6a8538af 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -73,7 +73,7 @@ void Parallaction::parseLocation(const char *filename) { errorFileNotFound(filename); } - uint32 count = _archive.getArchivedFileLength(archivefile); + uint32 count = _archive.getArchivedFileLength(); location_src = (char*)memAlloc(0x4000); _locationScript = new Script(location_src); |