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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Feb 25 22:04:52 CET 2007


Revision: 25867
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25867&view=rev
Author:   peres001
Date:     2007-02-25 13:04:51 -0800 (Sun, 25 Feb 2007)

Log Message:
-----------
made Archive behave more like Common::File, preparing for inheritance

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/animation.cpp
    scummvm/trunk/engines/parallaction/archive.cpp
    scummvm/trunk/engines/parallaction/disk.h
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/location.cpp

Modified: scummvm/trunk/engines/parallaction/animation.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/animation.cpp	2007-02-25 20:35:47 UTC (rev 25866)
+++ scummvm/trunk/engines/parallaction/animation.cpp	2007-02-25 21:04:51 UTC (rev 25867)
@@ -259,7 +259,7 @@
 	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);

Modified: scummvm/trunk/engines/parallaction/archive.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/archive.cpp	2007-02-25 20:35:47 UTC (rev 25866)
+++ scummvm/trunk/engines/parallaction/archive.cpp	2007-02-25 21:04:51 UTC (rev 25867)
@@ -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 @@
 
 	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 @@
 	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) {
+
+uint16 Archive::getArchivedFileLength() {
 //	printf("getArchivedFileLength(%s)\n", name);
 
-	for (uint16 i = 0; i < MAX_ARCHIVE_ENTRIES; i++) {
-		if (!scumm_stricmp(_archiveDir[i], name))
-			return _archiveLenghts[i];
-	}
-
-	return 0;
+	return (_file == true ? _fileEndOffset - _fileOffset : 0);
 }
 
 

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2007-02-25 20:35:47 UTC (rev 25866)
+++ scummvm/trunk/engines/parallaction/disk.h	2007-02-25 21:04:51 UTC (rev 25867)
@@ -53,14 +53,11 @@
 
 	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 @@
 	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);

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-02-25 20:35:47 UTC (rev 25866)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-02-25 21:04:51 UTC (rev 25867)
@@ -1035,7 +1035,7 @@
 	_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 @@
 
 	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);

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-02-25 20:35:47 UTC (rev 25866)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-02-25 21:04:51 UTC (rev 25867)
@@ -73,7 +73,7 @@
 			errorFileNotFound(filename);
 	}
 
-	uint32 count = _archive.getArchivedFileLength(archivefile);
+	uint32 count = _archive.getArchivedFileLength();
 	location_src = (char*)memAlloc(0x4000);
 
 	_locationScript = new Script(location_src);


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