diff options
| author | Eugene Sandulenko | 2019-11-07 00:43:38 +0100 | 
|---|---|---|
| committer | Eugene Sandulenko | 2019-11-13 22:07:08 +0100 | 
| commit | d45e0362215bfa8f46bf550ba3ef52fb2c9cbd1b (patch) | |
| tree | 397225c744342fd9eb3e04ff93273bcdcc931d8f | |
| parent | 4f98377ee0cf7bb2ca7bc276e4ec9809ecd0c7c9 (diff) | |
| download | scummvm-rg350-d45e0362215bfa8f46bf550ba3ef52fb2c9cbd1b.tar.gz scummvm-rg350-d45e0362215bfa8f46bf550ba3ef52fb2c9cbd1b.tar.bz2 scummvm-rg350-d45e0362215bfa8f46bf550ba3ef52fb2c9cbd1b.zip  | |
GRIFFON: Simplified quit event handling
| -rw-r--r-- | engines/griffon/cutscenes.cpp | 51 | 
1 files changed, 19 insertions, 32 deletions
diff --git a/engines/griffon/cutscenes.cpp b/engines/griffon/cutscenes.cpp index 58c7c6ee04..6077e24876 100644 --- a/engines/griffon/cutscenes.cpp +++ b/engines/griffon/cutscenes.cpp @@ -40,6 +40,18 @@  namespace Griffon { +#define POLL_AND_CHECK_QUIT() 		if (g_system->getEventManager()->pollEvent(_event)) { \ +		if (_event.type == Common::EVENT_QUIT) { \ +			_shouldQuit = true; \ +			return; \ +		} \ +	} + +#define CHECK_QUIT() 		if (_event.type == Common::EVENT_QUIT) { \ +		_shouldQuit = true; \ +		return; \ +	} +  const char *story[48] = {  	"The Griffon Legend",  	"http://syn9.thehideoutgames.com/", @@ -143,10 +155,7 @@ void GriffonEngine::showLogos() {  		g_system->copyRectToScreen(_videoBuffer->getPixels(), _videoBuffer->pitch, 0, 0, _videoBuffer->w, _videoBuffer->h);  		g_system->updateScreen(); -		if (g_system->getEventManager()->pollEvent(_event)) { -			if (_event.type == Common::EVENT_QUIT) -				_shouldQuit = true; -		} +		POLL_AND_CHECK_QUIT();  		_ticksPassed = _ticks;  		_ticks = g_system->getMillis(); @@ -260,8 +269,7 @@ void GriffonEngine::intro() {  			if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)  				return; -			if (_event.type == Common::EVENT_QUIT) -				_shouldQuit = true; +			CHECK_QUIT();  		}  		g_system->delayMillis(10); @@ -309,12 +317,7 @@ void GriffonEngine::endOfGame() {  		g_system->copyRectToScreen(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h); -		if (g_system->getEventManager()->pollEvent(_event)) { -			if (_event.type == Common::EVENT_QUIT) { -				_shouldQuit = true; -				return; -			} -		} +		POLL_AND_CHECK_QUIT();  		g_system->updateScreen();  		g_system->delayMillis(10); @@ -400,10 +403,7 @@ void GriffonEngine::endOfGame() {  			if (_event.kbd.keycode == Common::KEYCODE_ESCAPE)  				break; -			if (_event.type == Common::EVENT_QUIT) { -				_shouldQuit = true; -				return; -			} +			CHECK_QUIT();  		}  		g_system->updateScreen(); @@ -432,12 +432,7 @@ void GriffonEngine::endOfGame() {  		g_system->copyRectToScreen(_videoBuffer3->getPixels(), _videoBuffer3->pitch, 0, 0, _videoBuffer3->w, _videoBuffer3->h);  		g_system->updateScreen(); -		if (g_system->getEventManager()->pollEvent(_event)) { -			if (_event.type == Common::EVENT_QUIT) { -				_shouldQuit = true; -				return; -			} -		} +		POLL_AND_CHECK_QUIT();  		g_system->delayMillis(10); @@ -494,10 +489,7 @@ void GriffonEngine::endOfGame() {  		}  		if (g_system->getEventManager()->pollEvent(_event)) { -			if (_event.type == Common::EVENT_QUIT) { -				_shouldQuit = true; -				return; -			} +			CHECK_QUIT();  			if (_event.type == Common::EVENT_KEYDOWN && keywait < _ticks)  				break; @@ -525,12 +517,7 @@ void GriffonEngine::theEnd() {  		g_system->copyRectToScreen(_videoBuffer2->getPixels(), _videoBuffer2->pitch, 0, 0, _videoBuffer2->w, _videoBuffer2->h);  		g_system->updateScreen(); -		if (g_system->getEventManager()->pollEvent(_event)) { -			if (_event.type == Common::EVENT_QUIT) { -				_shouldQuit = true; -				return; -			} -		} +		POLL_AND_CHECK_QUIT();  		g_system->delayMillis(10);  | 
