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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Fri Mar 2 23:02:20 CET 2007


Revision: 25933
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25933&view=rev
Author:   peres001
Date:     2007-03-02 14:02:19 -0800 (Fri, 02 Mar 2007)

Log Message:
-----------
added openLocation as loader for location scripts resources

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

Modified: scummvm/trunk/engines/parallaction/disk.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/disk.cpp	2007-03-02 21:50:36 UTC (rev 25932)
+++ scummvm/trunk/engines/parallaction/disk.cpp	2007-03-02 22:02:19 UTC (rev 25933)
@@ -55,5 +55,39 @@
 
 }
 
+void openLocation(const char *name, char* script) {
 
+	char archivefile[PATH_LEN];
+
+	if (_vm->_characterName[0] == 'm') {
+		sprintf(archivefile, "%s%s", _vm->_characterName+4, _vm->_languageDir);
+	} else {
+		if (_vm->_characterName[0] == 'D') strcpy(archivefile, _vm->_languageDir);
+		else {
+			sprintf(archivefile, "%s%s", _vm->_characterName, _vm->_languageDir);
+		}
+	}
+	strcat(archivefile, name);
+	strcat(archivefile, ".loc");
+
+	_vm->_archive.close();
+
+	_vm->_languageDir[2] = '\0';
+	_vm->_archive.open(_vm->_languageDir);
+	_vm->_languageDir[2] = '/';
+
+	if (!_vm->_archive.openArchivedFile(archivefile)) {
+		sprintf(archivefile, "%s%s.loc", _vm->_languageDir, name);
+		if (!_vm->_archive.openArchivedFile(archivefile))
+			error("can't find location file '%s'", name);
+	}
+
+	uint32 count = _vm->_archive.size();
+	_vm->_archive.read(script, count);
+	_vm->_archive.closeArchivedFile();
+	_vm->_archive.close();
+
+}
+
+
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/disk.h
===================================================================
--- scummvm/trunk/engines/parallaction/disk.h	2007-03-02 21:50:36 UTC (rev 25932)
+++ scummvm/trunk/engines/parallaction/disk.h	2007-03-02 22:02:19 UTC (rev 25933)
@@ -72,6 +72,7 @@
 	uint32 read(void *dataPtr, uint32 dataSize);
 };
 
+void openLocation(const char *name, char* script);
 void openTalk(const char *name, Cnv *cnv);
 
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/location.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/location.cpp	2007-03-02 21:50:36 UTC (rev 25932)
+++ scummvm/trunk/engines/parallaction/location.cpp	2007-03-02 22:02:19 UTC (rev 25933)
@@ -48,40 +48,10 @@
 	_vm->_graphics->_proportionalFont = false;
 	_vm->_graphics->setFont("topazcnv");
 
-	char archivefile[PATH_LEN];
-
-	if (_characterName[0] == 'm') {
-		sprintf(archivefile, "%s%s", _characterName+4, _languageDir);
-	} else {
-		if (_characterName[0] == 'D') strcpy(archivefile, _languageDir);
-		else {
-			sprintf(archivefile, "%s%s", _characterName, _languageDir);
-		}
-	}
-	strcat(archivefile, filename);
-	strcat(archivefile, ".loc");
-
-	if (strcmp(_disk, "null")) _archive.close();
-
-	_languageDir[2] = '\0';
-	_archive.open(_languageDir);
-	_languageDir[2] = '/';
-
-	if (!_archive.openArchivedFile(archivefile)) {
-		sprintf(archivefile, "%s%s.loc", _languageDir, filename);
-		if (!_archive.openArchivedFile(archivefile))
-			errorFileNotFound(filename);
-	}
-
-	uint32 count = _archive.size();
 	location_src = (char*)memAlloc(0x4000);
-
+	openLocation(filename, location_src);
 	_locationScript = new Script(location_src);
 
-	_archive.read(location_src, count);
-	_archive.closeArchivedFile();
-	_archive.close();
-
 	fillBuffers(*_locationScript, true);
 	while (scumm_stricmp(_tokens[0], "ENDLOCATION")) {
 //		printf("token[0] = %s", _tokens[0]);
@@ -133,8 +103,7 @@
 		}
 		if (!scumm_stricmp(_tokens[0], "DISK")) {
 			strcpy(_disk, _tokens[1]);
-			strcpy(archivefile, _disk);
-			_archive.open(archivefile);
+			_archive.open(_disk);
 		}
 		if (!scumm_stricmp(_tokens[0], "LOCALFLAGS")) {
 			_si = 1;	// _localFlagNames[0] = 'visited'


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