aboutsummaryrefslogtreecommitdiff
path: root/engines/cryomni3d/cryomni3d.cpp
diff options
context:
space:
mode:
authorLe Philousophe2019-06-23 13:15:42 +0200
committerLe Philousophe2019-07-05 07:52:00 +0200
commit95d1f30bd7f4dc5394f0e718c791b21bc431fc65 (patch)
tree57f2cb432e95b2b9f78fc94269962b66edb089d5 /engines/cryomni3d/cryomni3d.cpp
parent215e2139fcce276dcb989a11fccbe21e45b5aed8 (diff)
downloadscummvm-rg350-95d1f30bd7f4dc5394f0e718c791b21bc431fc65.tar.gz
scummvm-rg350-95d1f30bd7f4dc5394f0e718c791b21bc431fc65.tar.bz2
scummvm-rg350-95d1f30bd7f4dc5394f0e718c791b21bc431fc65.zip
CRYOMNI3D: Add a timeout for displayHLZ
Diffstat (limited to 'engines/cryomni3d/cryomni3d.cpp')
-rw-r--r--engines/cryomni3d/cryomni3d.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp
index 35a4cceb09..452d6b7794 100644
--- a/engines/cryomni3d/cryomni3d.cpp
+++ b/engines/cryomni3d/cryomni3d.cpp
@@ -213,11 +213,11 @@ Image::ImageDecoder *CryOmni3DEngine::loadHLZ(const Common::String &filename) {
return imageDecoder;
}
-void CryOmni3DEngine::displayHLZ(const Common::String &filename) {
+bool CryOmni3DEngine::displayHLZ(const Common::String &filename, uint32 timeout) {
Image::ImageDecoder *imageDecoder = loadHLZ(filename);
if (!imageDecoder) {
- return;
+ return false;
}
if (imageDecoder->hasPalette()) {
@@ -229,10 +229,16 @@ void CryOmni3DEngine::displayHLZ(const Common::String &filename) {
g_system->copyRectToScreen(frame->getPixels(), frame->pitch, 0, 0, frame->w, frame->h);
g_system->updateScreen();
+ uint32 end;
+ if (timeout == uint(-1)) {
+ end = uint(-1);
+ } else {
+ end = g_system->getMillis() + timeout;
+ }
bool exitImg = false;
- while (!shouldAbort() && !exitImg) {
+ while (!shouldAbort() && !exitImg && g_system->getMillis() < end) {
if (pollEvents()) {
- if (checkKeysPressed(1, Common::KEYCODE_ESCAPE) || getCurrentMouseButton() == 1) {
+ if (checkKeysPressed() || getCurrentMouseButton() == 1) {
exitImg = true;
}
}
@@ -241,6 +247,8 @@ void CryOmni3DEngine::displayHLZ(const Common::String &filename) {
}
delete imageDecoder;
+
+ return exitImg || shouldAbort();
}
void CryOmni3DEngine::setCursor(const Graphics::Cursor &cursor) const {