SCI: Limit the screen refresh rate to 60fps
svn-id: r49647
This commit is contained in:
parent
58487da20b
commit
cfdbfaa28e
4 changed files with 11 additions and 3 deletions
|
@ -877,6 +877,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
|
|||
// 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;
|
||||
|
|
|
@ -113,6 +113,7 @@ public:
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -319,8 +319,14 @@ sciEvent EventManager::get(unsigned int mask) {
|
|||
//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
|
||||
// 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 {
|
||||
|
|
|
@ -325,7 +325,7 @@ bool SciEngine::initGame() {
|
|||
_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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue