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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Aug 19 10:46:59 CEST 2009


Revision: 43533
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43533&view=rev
Author:   lordhoto
Date:     2009-08-19 08:46:59 +0000 (Wed, 19 Aug 2009)

Log Message:
-----------
Cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/script_lok.cpp

Modified: scummvm/trunk/engines/kyra/script_lok.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_lok.cpp	2009-08-19 08:37:20 UTC (rev 43532)
+++ scummvm/trunk/engines/kyra/script_lok.cpp	2009-08-19 08:46:59 UTC (rev 43533)
@@ -429,22 +429,14 @@
 	int wsaFrame = 0;
 
 	while (running) {
+		const uint32 continueTime = waitTime * _tickLength + _system->getMillis();
+
 		_movieObjects[wsaIndex]->displayFrame(wsaFrame++, 0, xpos, ypos, 0, 0, 0);
 		_animator->_updateScreen = true;
 		if (wsaFrame >= _movieObjects[wsaIndex]->frames())
 			running = false;
 
-		uint32 continueTime = waitTime * _tickLength + _system->getMillis();
-		while (_system->getMillis() < continueTime) {
-			if (worldUpdate) {
-				_sprites->updateSceneAnims();
-				_animator->updateAllObjectShapes();
-			} else {
-				_screen->updateScreen();
-			}
-			if (continueTime - _system->getMillis() >= 10)
-				delay(10);
-		}
+		delayUntil(continueTime, false, worldUpdate != 0);
 	}
 
 	_screen->showMouse();
@@ -460,18 +452,10 @@
 	int waitTime = stackPos(3);
 	int wsaIndex = stackPos(4);
 	_screen->hideMouse();
+	const uint32 continueTime = waitTime * _tickLength + _system->getMillis();
 	_movieObjects[wsaIndex]->displayFrame(frame, 0, xpos, ypos, 0, 0, 0);
 	_animator->_updateScreen = true;
-	uint32 continueTime = waitTime * _tickLength + _system->getMillis();
-	while (_system->getMillis() < continueTime) {
-		_sprites->updateSceneAnims();
-		_animator->updateAllObjectShapes();
-		if (skipFlag())
-			break;
-
-		if (continueTime - _system->getMillis() >= 10)
-			delay(10);
-	}
+	delayUntil(continueTime, false, true);
 	_screen->showMouse();
 	return 0;
 }
@@ -501,15 +485,10 @@
 	int wsaIndex = stackPos(5);
 	_screen->hideMouse();
 	for (; startFrame <= endFrame; ++startFrame) {
-		uint32 nextRun = _system->getMillis() + delayTime * _tickLength;
+		const uint32 nextRun = _system->getMillis() + delayTime * _tickLength;
 		_movieObjects[wsaIndex]->displayFrame(startFrame, 0, xpos, ypos, 0, 0, 0);
 		_animator->_updateScreen = true;
-		while (_system->getMillis() < nextRun) {
-			_sprites->updateSceneAnims();
-			_animator->updateAllObjectShapes();
-			if (nextRun - _system->getMillis() >= 10)
-				delay(10);
-		}
+		delayUntil(nextRun, false, true);
 	}
 	_screen->showMouse();
 	return 0;
@@ -693,18 +672,10 @@
 	int wsaIndex = stackPos(4);
 
 	_screen->hideMouse();
-	uint32 continueTime = waitTime * _tickLength + _system->getMillis();
+	const uint32 continueTime = waitTime * _tickLength + _system->getMillis();
 	_movieObjects[wsaIndex]->displayFrame(frame, 2, xpos, ypos, 0, 0, 0);
 	_animator->_updateScreen = true;
-	while (_system->getMillis() < continueTime) {
-		_sprites->updateSceneAnims();
-		_animator->updateAllObjectShapes();
-		if (skipFlag())
-			break;
-
-		if (continueTime - _system->getMillis() >= 10)
-			delay(10);
-	}
+	delayUntil(continueTime, false, true);
 	_screen->showMouse();
 
 	return 0;
@@ -776,37 +747,21 @@
 		if (endFrame >= startFrame) {
 			int frame = startFrame;
 			while (endFrame >= frame) {
-				uint32 continueTime = waitTime * _tickLength + _system->getMillis();
+				const uint32 continueTime = waitTime * _tickLength + _system->getMillis();
 				_movieObjects[wsaIndex]->displayFrame(frame, 0, xpos, ypos, 0, 0, 0);
 				if (waitTime)
 					_animator->_updateScreen = true;
-				while (_system->getMillis() < continueTime) {
-					_sprites->updateSceneAnims();
-					_animator->updateAllObjectShapes();
-					if (skipFlag())
-						break;
-
-					if (continueTime - _system->getMillis() >= 10)
-						delay(10);
-				}
+				delayUntil(continueTime, false, true);
 				++frame;
 			}
 		} else {
 			int frame = startFrame;
 			while (endFrame <= frame) {
-				uint32 continueTime = waitTime * _tickLength + _system->getMillis();
+				const uint32 continueTime = waitTime * _tickLength + _system->getMillis();
 				_movieObjects[wsaIndex]->displayFrame(frame, 0, xpos, ypos, 0, 0, 0);
 				if (waitTime)
 					_animator->_updateScreen = true;
-				while (_system->getMillis() < continueTime) {
-					_sprites->updateSceneAnims();
-					_animator->updateAllObjectShapes();
-					if (skipFlag())
-						break;
-
-					if (continueTime - _system->getMillis() >= 10)
-						delay(10);
-				}
+				delayUntil(continueTime, false, true);
 				--frame;
 			}
 		}
@@ -1060,16 +1015,7 @@
 		setCharacterPosition(character, 0);
 		++curPos;
 
-		nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis();
-		while (_system->getMillis() < nextFrame) {
-			_sprites->updateSceneAnims();
-			updateMousePointer();
-			_timer->update();
-			_animator->updateAllObjectShapes();
-			updateTextFade();
-			if ((nextFrame - _system->getMillis()) >= 10)
-				delay(10);
-		}
+		delayUntil(nextFrame = _timer->getDelay(5 + character) * _tickLength + _system->getMillis(), true, true);
 	}
 	return 0;
 }
@@ -1318,9 +1264,8 @@
 		assert(_amuleteAnim);
 		_screen->hideMouse();
 		snd_playSoundEffect(0x70);
-		uint32 nextTime = 0;
 		for (int i = 0; _amuleteAnim[i] != 0xFF; ++i) {
-			nextTime = _system->getMillis() + 5 * _tickLength;
+			const uint32 nextTime = _system->getMillis() + 5 * _tickLength;
 
 			uint8 code = _amuleteAnim[i];
 			if (code == 3 || code == 7)
@@ -1335,12 +1280,7 @@
 			amulet->displayFrame(code, 0, 224, 152, 0, 0, 0);
 			_animator->_updateScreen = true;
 
-			while (_system->getMillis() < nextTime) {
-				_sprites->updateSceneAnims();
-				_animator->updateAllObjectShapes();
-				if (nextTime - _system->getMillis() >= 10)
-					delay(10);
-			}
+			delayUntil(nextTime, false, true);
 		}
 		_screen->showMouse();
 	}


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