[Scummvm-cvs-logs] SF.net SVN: scummvm:[41756] scummvm/trunk/engines/gob/script.cpp

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Mon Jun 22 12:15:14 CEST 2009


Revision: 41756
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41756&view=rev
Author:   drmccoy
Date:     2009-06-22 10:15:14 +0000 (Mon, 22 Jun 2009)

Log Message:
-----------
Implemented loading TOTs from video file again

Modified Paths:
--------------
    scummvm/trunk/engines/gob/script.cpp

Modified: scummvm/trunk/engines/gob/script.cpp
===================================================================
--- scummvm/trunk/engines/gob/script.cpp	2009-06-22 10:14:49 UTC (rev 41755)
+++ scummvm/trunk/engines/gob/script.cpp	2009-06-22 10:15:14 UTC (rev 41756)
@@ -30,6 +30,7 @@
 #include "gob/script.h"
 #include "gob/dataio.h"
 #include "gob/parse.h"
+#include "gob/videoplayer.h"
 
 namespace Gob {
 
@@ -276,28 +277,40 @@
 
 	delete fileBase;
 
-	if (_vm->_dataIO->existData(_totFile.c_str())) {
-		if (lom) {
-			if (!loadLOM(_totFile)) {
-				unload();
-				return false;
-			}
-		} else {
-			if (!loadTOT(_totFile)) {
-				unload();
-				return false;
-			}
+	if (lom) {
+		if (!loadLOM(_totFile)) {
+			unload();
+			return false;
 		}
-	} else
-		return false;
+	} else {
+		if (!loadTOT(_totFile)) {
+			unload();
+			return false;
+		}
+	}
 
 	return true;
 }
 
 bool Script::loadTOT(const Common::String &fileName) {
-	_totSize = _vm->_dataIO->getDataSize(_totFile.c_str());
-	_totData = _vm->_dataIO->getData(_totFile.c_str());
+	if (_vm->_dataIO->existData(fileName.c_str())) {
+		_totSize = _vm->_dataIO->getDataSize(_totFile.c_str());
+		_totData = _vm->_dataIO->getData(_totFile.c_str());
+	} else  {
+		Common::MemoryReadStream *videoExtraData = _vm->_vidPlayer->getExtraData(fileName.c_str());
 
+		if (videoExtraData) {
+			warning("Loading TOT \"%s\" from video file", fileName.c_str());
+
+			_totSize = videoExtraData->size();
+			_totData = new byte[_totSize];
+
+			videoExtraData->read(_totData, _totSize);
+
+			delete videoExtraData;
+		}
+	}
+
 	return (_totData != 0);
 }
 
@@ -305,6 +318,8 @@
 	warning("Urban Stub: loadLOM %s", _totFile.c_str());
 
 	_lomHandle = _vm->_dataIO->openData(_totFile.c_str());
+	if (_lomHandle < 0)
+		return false;
 
 	DataStream *stream = _vm->_dataIO->openAsStream(_lomHandle);
 


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