diff options
| -rw-r--r-- | engines/cryomni3d/cryomni3d.cpp | 16 | ||||
| -rw-r--r-- | engines/cryomni3d/cryomni3d.h | 2 | 
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(); | 
