[Scummvm-cvs-logs] SF.net SVN: scummvm:[50794] scummvm/trunk/engines/sci

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Jul 11 00:27:28 CEST 2010


Revision: 50794
          http://scummvm.svn.sourceforge.net/scummvm/?rev=50794&view=rev
Author:   m_kiewitz
Date:     2010-07-10 22:27:28 +0000 (Sat, 10 Jul 2010)

Log Message:
-----------
SCI: calling speed throttler as well from kPalette(setIntensity) if needed - fixes kq6 intro

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kmisc.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/engine/vm.cpp
    scummvm/trunk/engines/sci/graphics/palette.cpp

Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-07-10 21:47:37 UTC (rev 50793)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp	2010-07-10 22:27:28 UTC (rev 50794)
@@ -67,28 +67,7 @@
 		neededSleep = 60;
 	}
 
-	if (s->_throttleTrigger) {
-		// Some games seem to get the duration of main loop initially and then
-		// switch of animations for the whole game based on that (qfg2, iceman).
-		// We are now running full speed initially to avoid that.
-		// It seems like we dont need to do that anymore
-		//if (s->_throttleCounter < 50) {
-		//	s->_throttleCounter++;
-		//	return s->r_acc;
-		//}
-
-		uint32 curTime = g_system->getMillis();
-		uint32 duration = curTime - s->_throttleLastTime;
-
-		if (duration < neededSleep) {
-			g_sci->sleep(neededSleep - duration);
-			s->_throttleLastTime = g_system->getMillis();
-		} else {
-			s->_throttleLastTime = curTime;
-		}
-		s->_throttleTrigger = false;
-	}
-
+	s->speedThrottler(neededSleep);
 	return s->r_acc;
 }
 

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2010-07-10 21:47:37 UTC (rev 50793)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2010-07-10 22:27:28 UTC (rev 50794)
@@ -111,6 +111,21 @@
 	scriptGCInterval = GC_INTERVAL;
 }
 
+void EngineState::speedThrottler(uint32 neededSleep) {
+	if (_throttleTrigger) {
+		uint32 curTime = g_system->getMillis();
+		uint32 duration = curTime - _throttleLastTime;
+
+		if (duration < neededSleep) {
+			g_sci->sleep(neededSleep - duration);
+			_throttleLastTime = g_system->getMillis();
+		} else {
+			_throttleLastTime = curTime;
+		}
+		_throttleTrigger = false;
+	}
+}
+
 void EngineState::wait(int16 ticks) {
 	uint32 time = g_system->getMillis();
 	r_acc = make_reg(0, ((long)time - (long)lastWaitTime) * 60 / 1000);

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-07-10 21:47:37 UTC (rev 50793)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-07-10 22:27:28 UTC (rev 50794)
@@ -106,6 +106,7 @@
 	uint32 lastWaitTime; /**< The last time the game invoked Wait() */
 	uint32 _screenUpdateTime;	/**< The last time the game updated the screen */
 
+	void speedThrottler(uint32 neededSleep);
 	void wait(int16 ticks);
 
 	uint32 _throttleCounter; /**< total times kAnimate was invoked */

Modified: scummvm/trunk/engines/sci/engine/vm.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.cpp	2010-07-10 21:47:37 UTC (rev 50793)
+++ scummvm/trunk/engines/sci/engine/vm.cpp	2010-07-10 22:27:28 UTC (rev 50794)
@@ -857,8 +857,7 @@
 
 #if 0
 		// Used for debugging
-		Common::String debugMsg = kernelFunc.origName +
-									Common::String::printf("[0x%x]", kernelFuncNr) +
+		Common::String debugMsg = Common::String::printf("%s [0x%x]", kernelCall.name, kernelCallNr) +
 									Common::String::printf(", %d params: ", argc) +
 									" (";
 

Modified: scummvm/trunk/engines/sci/graphics/palette.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/palette.cpp	2010-07-10 21:47:37 UTC (rev 50793)
+++ scummvm/trunk/engines/sci/graphics/palette.cpp	2010-07-10 22:27:28 UTC (rev 50794)
@@ -411,7 +411,11 @@
 	memset(&_sysPalette.intensity[0] + fromColor, intensity, toColor - fromColor);
 	if (setPalette) {
 		setOnScreen();
-		g_sci->getEngineState()->_throttleTrigger = true;
+		EngineState *state = g_sci->getEngineState();
+		// Call speed throttler from here as well just in case we need it
+		//  At least in kq6 intro the scripts call us in a tight loop for fadein/fadeout
+		state->speedThrottler(30);
+		state->_throttleTrigger = true;
 	}
 }
 


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