Skip to content
Permalink
Browse files

DIRECTOR: Made transition interruptable like the original

  • Loading branch information
sev- committed Mar 26, 2020
1 parent 0e2c004 commit 92225bcf6646cb2961fcff3f12a88a4d3f55dd4a
Showing with 33 additions and 13 deletions.
  1. +11 −2 engines/director/events.cpp
  2. +21 −10 engines/director/transitions.cpp
  3. +1 −1 engines/director/util.h
@@ -32,13 +32,22 @@

namespace Director {

void processQuitEvent() {
bool processQuitEvent(bool click) {
Common::Event event;

while (g_system->getEventManager()->pollEvent(event)) {
if (event.type == Common::EVENT_QUIT)
if (event.type == Common::EVENT_QUIT) {
g_director->getCurrentScore()->_stopPlay = true;
return true;
}

if (click) {
if (event.type == Common::EVENT_LBUTTONDOWN)
return true;
}
}

return false;
}

void DirectorEngine::processEvents() {
@@ -167,7 +167,8 @@ void Frame::playTransition(Score *score) {
r.moveTo(clipRect.width() / 2 - t.xpos, 0);

g_system->delayMillis(t.stepDuration);
processQuitEvent();
if (processQuitEvent(true))
break;

score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);

@@ -184,7 +185,8 @@ void Frame::playTransition(Score *score) {
r.moveTo(0, clipRect.height() / 2 - t.ypos);

g_system->delayMillis(t.stepDuration);
processQuitEvent();
if (processQuitEvent(true))
break;

score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);

@@ -199,7 +201,8 @@ void Frame::playTransition(Score *score) {
r.clip(clipRect);

g_system->delayMillis(t.stepDuration);
processQuitEvent();
if (processQuitEvent(true))
break;

g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
g_system->updateScreen();
@@ -214,7 +217,8 @@ void Frame::playTransition(Score *score) {
r.clip(clipRect);

g_system->delayMillis(t.stepDuration);
processQuitEvent();
if (processQuitEvent(true))
break;

g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
g_system->updateScreen();
@@ -228,7 +232,8 @@ void Frame::playTransition(Score *score) {
r.clip(clipRect);

g_system->delayMillis(t.stepDuration);
processQuitEvent();
if (processQuitEvent(true))
break;

g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
g_system->updateScreen();
@@ -242,7 +247,8 @@ void Frame::playTransition(Score *score) {
r.clip(clipRect);

g_system->delayMillis(t.stepDuration);
processQuitEvent();
if (processQuitEvent(true))
break;

g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
g_system->updateScreen();
@@ -255,7 +261,8 @@ void Frame::playTransition(Score *score) {
r.clip(clipRect);

g_system->delayMillis(t.stepDuration);
processQuitEvent();
if (processQuitEvent(true))
break;

g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
g_system->updateScreen();
@@ -269,7 +276,9 @@ void Frame::playTransition(Score *score) {
r.clip(clipRect);

g_system->delayMillis(t.stepDuration);
processQuitEvent();

if (processQuitEvent(true))
break;

g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
g_system->updateScreen();
@@ -284,7 +293,8 @@ void Frame::playTransition(Score *score) {
r.clip(clipRect);

g_system->delayMillis(t.stepDuration);
processQuitEvent();
if (processQuitEvent(true))
break;

g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
g_system->updateScreen();
@@ -299,7 +309,8 @@ void Frame::playTransition(Score *score) {
r.clip(clipRect);

g_system->delayMillis(t.stepDuration);
processQuitEvent();
if (processQuitEvent(true))
break;

g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, r.left, r.top, r.width(), r.height()); // transition
g_system->updateScreen();
@@ -42,7 +42,7 @@ Common::String pathMakeRelative(Common::String path, bool recursive = true);

Common::String convertMacFilename(const char *name);

void processQuitEvent(); // events.cpp
bool processQuitEvent(bool click = false); // events.cpp

} // End of namespace Director

0 comments on commit 92225bc

Please sign in to comment.
You can’t perform that action at this time.