aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/event.cpp
diff options
context:
space:
mode:
authorMax Horn2010-02-23 22:47:53 +0000
committerMax Horn2010-02-23 22:47:53 +0000
commit2e68de1e5ab333966adeafdc998433fe346c9815 (patch)
treef4681a123f1021c36f0efb3aa0c156dea8175d51 /engines/sci/event.cpp
parent02201e937ab7a5d408b4804225affb7ce0251cce (diff)
downloadscummvm-rg350-2e68de1e5ab333966adeafdc998433fe346c9815.tar.gz
scummvm-rg350-2e68de1e5ab333966adeafdc998433fe346c9815.tar.bz2
scummvm-rg350-2e68de1e5ab333966adeafdc998433fe346c9815.zip
SCI: Turn kernel_sleep() into SciEvent::sleep()
svn-id: r48119
Diffstat (limited to 'engines/sci/event.cpp')
-rw-r--r--engines/sci/event.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index dfc9c3c4f1..31d5ec3ed5 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -351,4 +351,25 @@ sciEvent SciEvent::get(unsigned int mask) {
return event;
}
+void SciEvent::sleep(uint32 msecs) {
+ uint32 time;
+ const uint32 wakeup_time = g_system->getMillis() + msecs;
+
+ while (true) {
+ // let backend process events and update the screen
+ get(SCI_EVENT_PEEK);
+ // TODO: we need to call Cursor::refreshPosition() before each screen update to limit the mouse cursor position
+ time = g_system->getMillis();
+ if (time + 10 < wakeup_time) {
+ g_system->delayMillis(10);
+ } else {
+ if (time < wakeup_time)
+ g_system->delayMillis(wakeup_time - time);
+ break;
+ }
+
+ }
+}
+
+
} // End of namespace Sci