[Scummvm-cvs-logs] SF.net SVN: scummvm: [32462] scummvm/trunk/engines/kyra

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Sun Jun 1 15:19:45 CEST 2008


Revision: 32462
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32462&view=rev
Author:   athrxx
Date:     2008-06-01 06:19:45 -0700 (Sun, 01 Jun 2008)

Log Message:
-----------
- (hopefully) fix valgrind warning for installer file decompression
- some more pauseEngineIntern code for Hof

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra_hof.cpp
    scummvm/trunk/engines/kyra/resource.cpp
    scummvm/trunk/engines/kyra/script_tim.cpp
    scummvm/trunk/engines/kyra/script_tim.h

Modified: scummvm/trunk/engines/kyra/kyra_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-06-01 11:44:45 UTC (rev 32461)
+++ scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-06-01 13:19:45 UTC (rev 32462)
@@ -206,7 +206,12 @@
 				_activeWSA[x].nextFrame += pausedTime;
 		}
 
-		// TODO: item animation, idle animation, tim player, etc
+		_nextIdleAnim += pausedTime;
+		
+		for (int x = 0; x < _itemAnimDataSize; x++)
+			_activeItemAnim[x].nextFrame += pausedTime;
+
+		_tim->refreshTimersAfterPause(pausedTime);
 	}
 }
 

Modified: scummvm/trunk/engines/kyra/resource.cpp
===================================================================
--- scummvm/trunk/engines/kyra/resource.cpp	2008-06-01 11:44:45 UTC (rev 32461)
+++ scummvm/trunk/engines/kyra/resource.cpp	2008-06-01 13:19:45 UTC (rev 32462)
@@ -795,7 +795,7 @@
 
 class FileExpanderSource {
 public:
-	FileExpanderSource(const uint8 *data) : _dataPtr(data), _bitsLeft(8), _key(0), _index(0) {}
+	FileExpanderSource(const uint8 *data, int dataSize) : _dataPtr(data), _endofBuffer(data + dataSize), _bitsLeft(8), _key(0), _index(0) {}
 	~FileExpanderSource() {}
 
 	void advSrcRefresh();
@@ -811,6 +811,7 @@
 
 private:
 	const uint8 *_dataPtr;
+	const uint8 *_endofBuffer;
 	uint16 _key;
 	int8 _bitsLeft;
 	uint8 _index;
@@ -819,7 +820,8 @@
 void FileExpanderSource::advSrcBitsBy1() {
 	_key >>= 1;		
 	if (!--_bitsLeft) {
-		_key = ((*_dataPtr++) << 8 ) | (_key & 0xff);
+		if (_dataPtr < _endofBuffer)
+			_key = ((*_dataPtr++) << 8 ) | (_key & 0xff);
 		_bitsLeft = 8;
 	}
 }
@@ -831,7 +833,8 @@
 		_key >>= (_index + _bitsLeft);
 		_index = -_bitsLeft;
 		_bitsLeft = 8 - _index;
-		_key = (*_dataPtr++ << 8) | (_key & 0xff);
+		if (_dataPtr < _endofBuffer)
+			_key = (*_dataPtr++ << 8) | (_key & 0xff);
 	}
 	_key >>= _index;
 }
@@ -880,7 +883,8 @@
 
 void FileExpanderSource::advSrcRefresh() {
 	_key = READ_LE_UINT16(_dataPtr);
-	_dataPtr += 2;		
+	if (_dataPtr < _endofBuffer - 1)
+		_dataPtr += 2;		
 	_bitsLeft = 8;
 }
 
@@ -937,7 +941,7 @@
 	bool needrefresh = true;
 	bool postprocess = false;
 
-	_src = new FileExpanderSource(src);
+	_src = new FileExpanderSource(src, compressedSize);
 
 	while (d < dst + outsize) {
 

Modified: scummvm/trunk/engines/kyra/script_tim.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.cpp	2008-06-01 11:44:45 UTC (rev 32461)
+++ scummvm/trunk/engines/kyra/script_tim.cpp	2008-06-01 13:19:45 UTC (rev 32462)
@@ -184,6 +184,13 @@
 	} while (loop);
 }
 
+void TIMInterpreter::refreshTimersAfterPause(uint32 elapsedTime) {
+	for (int i = 0; i < 10; i++) {
+		_currentTim->func[i].lastTime += elapsedTime;
+		_currentTim->func[i].nextTime += elapsedTime;
+	}
+}
+
 int TIMInterpreter::execCommand(int cmd, const uint16 *param) {
 	if (cmd < 0 || cmd >= _commandsSize) {
 		warning("Calling unimplemented TIM command %d", cmd);

Modified: scummvm/trunk/engines/kyra/script_tim.h
===================================================================
--- scummvm/trunk/engines/kyra/script_tim.h	2008-06-01 11:44:45 UTC (rev 32461)
+++ scummvm/trunk/engines/kyra/script_tim.h	2008-06-01 13:19:45 UTC (rev 32462)
@@ -69,6 +69,7 @@
 	void stopCurFunc() { if (_currentTim) cmd_stopCurFunc(0); }
 
 	void play(const char *filename);
+	void refreshTimersAfterPause(uint32 elapsedTime);
 private:
 	KyraEngine_v1 *_vm;
 	OSystem *_system;


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