aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Montoir2003-10-20 20:12:59 +0000
committerGregory Montoir2003-10-20 20:12:59 +0000
commitff5fde47ea11fb03007fc3a1f597d3202d5cd25e (patch)
treec3c4dbfac3c6f7965fdceef255712f2442c19c58
parent89a9a35a0ba7dde96d858da8b9f4f64794aedb58 (diff)
downloadscummvm-rg350-ff5fde47ea11fb03007fc3a1f597d3202d5cd25e.tar.gz
scummvm-rg350-ff5fde47ea11fb03007fc3a1f597d3202d5cd25e.tar.bz2
scummvm-rg350-ff5fde47ea11fb03007fc3a1f597d3202d5cd25e.zip
scrolling timing (copy/paste from SkyEngine)
svn-id: r10919
-rw-r--r--queen/display.cpp21
-rw-r--r--queen/display.h5
-rw-r--r--queen/queen.cpp14
-rw-r--r--queen/queen.h3
4 files changed, 41 insertions, 2 deletions
diff --git a/queen/display.cpp b/queen/display.cpp
index f11efd7fa5..a08ed60ee2 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -212,7 +212,7 @@ void Display::palSet(const uint8 *pal, int start, int end, bool updateScreen) {
_system->set_palette(tempPal + start * 4, start, end - start + 1);
if (updateScreen) {
_system->update_screen();
- _system->delay_msecs(20);
+ waitForTimer();
}
}
@@ -785,6 +785,25 @@ void Display::horizontalScroll(int16 scroll) {
}
+void Display::handleTimer() {
+
+ _gotTick = true;
+}
+
+
+void Display::waitForTimer() {
+
+ _gotTick = false;
+ while (!_gotTick) {
+ OSystem::Event event;
+
+ _system->delay_msecs(10);
+ while (_system->poll_event(&event));
+ }
+}
+
+
+
const uint8 TextRenderer::FONT[] = {
0xF8, 0xB0, 0xB0, 0x80, 0xB0, 0xB0, 0xC0, 0x00, 0xF8, 0xB0,
0xB0, 0x80, 0xB0, 0xB0, 0xC0, 0x00, 0xF8, 0xB0, 0xB0, 0x80,
diff --git a/queen/display.h b/queen/display.h
index df668cd4be..608133d861 100644
--- a/queen/display.h
+++ b/queen/display.h
@@ -100,6 +100,9 @@ public:
bool fullscreen() const { return _fullscreen; }
+ void handleTimer();
+ void waitForTimer();
+
private:
@@ -137,6 +140,8 @@ private:
Common::RandomSource _randomizer;
+ bool _gotTick;
+
Dynalum _dynalum;
OSystem *_system;
diff --git a/queen/queen.cpp b/queen/queen.cpp
index cb8d43ac92..1466bdb805 100644
--- a/queen/queen.cpp
+++ b/queen/queen.cpp
@@ -222,8 +222,22 @@ void QueenEngine::initialise(void) {
_graphics = new Graphics(_display, _resource);
_logic = new Logic(_resource, _graphics, _display);
//_sound = new Sound(_mixer, _detector->_sfx_volume);
+ _timer->installTimerProc(&timerHandler, 1000000 / 50, this); //call 50 times per second
}
+
+void QueenEngine::timerHandler(void *ptr) {
+
+ ((QueenEngine *)ptr)->gotTimerTick();
+}
+
+
+void QueenEngine::gotTimerTick() {
+
+ _display->handleTimer();
+}
+
+
void QueenEngine::delay(uint amount) {
OSystem::Event event;
diff --git a/queen/queen.h b/queen/queen.h
index 51fc6fe2e2..71231fff76 100644
--- a/queen/queen.h
+++ b/queen/queen.h
@@ -74,7 +74,8 @@ protected:
void initialise();
- static int CDECL game_thread_proc(void *param);
+ static void timerHandler(void *ptr);
+ void gotTimerTick();
};
// XXX: Temporary hack to allow Graphics to call delay()