aboutsummaryrefslogtreecommitdiff
path: root/engines/toltecs
diff options
context:
space:
mode:
authorBenjamin Haisch2010-10-31 20:03:54 +0000
committerWillem Jan Palenstijn2011-11-20 22:43:10 +0100
commit9698127c5d78c92f99032d55dec5fe1feb773ae4 (patch)
tree44c20447455601f948a42c1f7bb05c0c62695912 /engines/toltecs
parentce7f9a088c03e502eaf0709b18c6c02937673f9f (diff)
downloadscummvm-rg350-9698127c5d78c92f99032d55dec5fe1feb773ae4.tar.gz
scummvm-rg350-9698127c5d78c92f99032d55dec5fe1feb773ae4.tar.bz2
scummvm-rg350-9698127c5d78c92f99032d55dec5fe1feb773ae4.zip
TOLTECS: - Undef menu test code (oops)
- Rename updateScreen to drawScreen - Move code from sfUpdateScreen to engine updateScreen - Use better screen sync code to get closer to the original game's speed
Diffstat (limited to 'engines/toltecs')
-rw-r--r--engines/toltecs/script.cpp33
-rw-r--r--engines/toltecs/toltecs.cpp41
-rw-r--r--engines/toltecs/toltecs.h1
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);