aboutsummaryrefslogtreecommitdiff
path: root/engines/cryomni3d
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
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')
-rw-r--r--engines/cryomni3d/cryomni3d.cpp16
-rw-r--r--engines/cryomni3d/cryomni3d.h2
2 files changed, 13 insertions, 5 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 {
diff --git a/engines/cryomni3d/cryomni3d.h b/engines/cryomni3d/cryomni3d.h
index 86803a17fc..fa60cdbfd7 100644
--- a/engines/cryomni3d/cryomni3d.h
+++ b/engines/cryomni3d/cryomni3d.h
@@ -126,7 +126,7 @@ public:
void playHNM(const Common::String &filename,
Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType,
HNMCallback beforeDraw = nullptr, HNMCallback afterDraw = nullptr);
- void displayHLZ(const Common::String &filename);
+ bool displayHLZ(const Common::String &filename, uint32 timeout = uint(-1));
bool pollEvents();
Common::Point getMousePos();