diff options
-rw-r--r-- | engines/toltecs/script.cpp | 33 | ||||
-rw-r--r-- | engines/toltecs/toltecs.cpp | 41 | ||||
-rw-r--r-- | engines/toltecs/toltecs.h | 1 |
3 files changed, 42 insertions, 33 deletions
diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp index 4e15fa3dc1..0c9f89e711 100644 --- a/engines/toltecs/script.cpp +++ b/engines/toltecs/script.cpp @@ -806,38 +806,7 @@ void ScriptInterpreter::sfSetGameVar() { } void ScriptInterpreter::sfUpdateScreen() { - - _vm->_sound->updateSpeech(); - - _vm->_screen->updateShakeScreen(); - - // TODO: Set quit flag - if (_vm->shouldQuit()) - return; - - if (!_vm->_movieSceneFlag) - _vm->updateInput(); - else - _vm->_mouseButton = 0; - - // TODO? Check keyb - - _vm->_counter01--; - if (_vm->_counter01 <= 0) { - _vm->_counter01 = MIN(_vm->_counter02, 30); - _vm->_counter02 = 0; - _vm->updateScreen(); - _vm->_flag01 = 1; - _vm->_system->delayMillis(5); - _vm->_counter02 = 1; // ? - } else { - _vm->_screen->clearSprites(); - _vm->_flag01 = 0; - //_vm->_system->updateScreen(); - } - - // TODO - + _vm->updateScreen(); } void ScriptInterpreter::sfGetRandomNumber() { diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp index 93d43250db..7fde696732 100644 --- a/engines/toltecs/toltecs.cpp +++ b/engines/toltecs/toltecs.cpp @@ -154,7 +154,7 @@ Common::Error ToltecsEngine::run() { setupSysStrings(); -#define TEST_MENU +//#define TEST_MENU #ifdef TEST_MENU _screen->registerFont(0, 0x0D); _screen->registerFont(1, 0x0E); @@ -254,6 +254,45 @@ void ToltecsEngine::loadScene(uint resIndex) { void ToltecsEngine::updateScreen() { + _sound->updateSpeech(); + + _screen->updateShakeScreen(); + + // TODO: Set quit flag + if (shouldQuit()) + return; + + if (!_movieSceneFlag) + updateInput(); + else + _mouseButton = 0; + + // TODO? Check keyb + + _counter01--; + if (_counter01 <= 0) { + _counter01 = MIN(_counter02, 30); + _counter02 = 0; + drawScreen(); + _flag01 = 1; + _counter02 = 1; + } else { + _screen->clearSprites(); + _flag01 = 0; + } + + static uint32 prevUpdateTime = 0; + uint32 currUpdateTime; + do { + currUpdateTime = _system->getMillis(); + _counter02 = (currUpdateTime - prevUpdateTime) / 13; + } while (_counter02 == 0); + prevUpdateTime = currUpdateTime; + +} + +void ToltecsEngine::drawScreen() { + // FIXME: Quick hack, sometimes cameraY was negative (the code in updateCamera was at fault) if (_cameraY < 0) _cameraY = 0; diff --git a/engines/toltecs/toltecs.h b/engines/toltecs/toltecs.h index 851e28c263..9d7a7672c1 100644 --- a/engines/toltecs/toltecs.h +++ b/engines/toltecs/toltecs.h @@ -113,6 +113,7 @@ public: void loadScene(uint resIndex); void updateScreen(); + void drawScreen(); void updateInput(); void setGuiHeight(int16 guiHeight); |