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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Jun 14 10:36:52 CEST 2010


Revision: 49647
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49647&view=rev
Author:   thebluegr
Date:     2010-06-14 08:36:52 +0000 (Mon, 14 Jun 2010)

Log Message:
-----------
SCI: Limit the screen refresh rate to 60fps

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/event.cpp
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-06-14 06:33:24 UTC (rev 49646)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-06-14 08:36:52 UTC (rev 49647)
@@ -877,6 +877,7 @@
 	// Time state:
 	s->lastWaitTime = g_system->getMillis();
 	s->gameStartTime = g_system->getMillis();
+	s->_screenUpdateTime = g_system->getMillis();
 
 #ifdef USE_OLD_MUSIC_FUNCTIONS
 	s->_sound._it = NULL;

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-06-14 06:33:24 UTC (rev 49646)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-06-14 08:36:52 UTC (rev 49647)
@@ -113,6 +113,7 @@
 
 	uint32 gameStartTime; /**< The time at which the interpreter was started */
 	uint32 lastWaitTime; /**< The last time the game invoked Wait() */
+	uint32 _screenUpdateTime;	/**< The last time the game updated the screen */
 
 	void wait(int16 ticks);
 

Modified: scummvm/trunk/engines/sci/event.cpp
===================================================================
--- scummvm/trunk/engines/sci/event.cpp	2010-06-14 06:33:24 UTC (rev 49646)
+++ scummvm/trunk/engines/sci/event.cpp	2010-06-14 08:36:52 UTC (rev 49647)
@@ -319,8 +319,14 @@
 	//sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 };
 	sciEvent event = { 0, 0, 0, 0 };
 
-	// Update the screen here, since it's called very often
-	g_system->updateScreen();
+	// Update the screen here, since it's called very often.
+	// Throttle the screen update rate to 60fps.
+	uint32 curTime = g_system->getMillis();
+	uint32 duration = curTime - g_sci->getEngineState()->_screenUpdateTime;
+	if (duration >= 1000 / 60) {
+		g_system->updateScreen();
+		g_sci->getEngineState()->_screenUpdateTime = g_system->getMillis();
+	}
 
 	// Get all queued events from graphics driver
 	do {

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2010-06-14 06:33:24 UTC (rev 49646)
+++ scummvm/trunk/engines/sci/sci.cpp	2010-06-14 08:36:52 UTC (rev 49647)
@@ -325,7 +325,7 @@
 		_vocabulary->parser_base = make_reg(_gamestate->_segMan->getSysStringsSegment(), SYS_STRING_PARSER_BASE);
 	}
 
-	_gamestate->gameStartTime = _gamestate->lastWaitTime = g_system->getMillis();
+	_gamestate->gameStartTime = _gamestate->lastWaitTime = _gamestate->_screenUpdateTime = g_system->getMillis();
 
 	srand(g_system->getMillis()); // Initialize random number generator
 


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