[Scummvm-git-logs] scummvm master -> 0a25627a70a4c2d7c8a2d164642f4c53ef5217f2

sev- sev at scummvm.org
Tue Mar 24 00:04:27 UTC 2020


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
e82c6da8f9 DIRECTOR: LINGO: Safeguard check to puppetSound
0a25627a70 DIRECTOR: Moved transitions code to separate file


Commit: e82c6da8f98ef92162316648e577ab10a5ab749e
    https://github.com/scummvm/scummvm/commit/e82c6da8f98ef92162316648e577ab10a5ab749e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-24T01:04:11+01:00

Commit Message:
DIRECTOR: LINGO: Safeguard check to puppetSound

Changed paths:
    engines/director/lingo/lingo-builtins.cpp


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index c3901885bd..3960bb9906 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1405,6 +1405,13 @@ void LB::b_puppetSound(int nargs) {
 
 	DirectorSound *sound = g_director->getSoundManager();
 	Datum castMember = g_lingo->pop();
+
+	if (!score) {
+		warning("b_puppetSound(): no score");
+
+		return;
+	}
+
 	int castId = g_lingo->castIdFetch(castMember);
 
 	if (castId == 0) {


Commit: 0a25627a70a4c2d7c8a2d164642f4c53ef5217f2
    https://github.com/scummvm/scummvm/commit/0a25627a70a4c2d7c8a2d164642f4c53ef5217f2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-24T01:04:11+01:00

Commit Message:
DIRECTOR: Moved transitions code to separate file

Changed paths:
  A engines/director/transitions.cpp
    engines/director/frame.cpp
    engines/director/module.mk


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index ec8d5fbf4e..2a5c4e8070 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -438,150 +438,6 @@ void Frame::playSoundChannel() {
 	debug(0, "STUB: playSoundChannel(), Sound1 %d Sound2 %d", _sound1, _sound2);
 }
 
-void Frame::playTransition(Score *score) {
-	uint16 duration = _transDuration * 250; // _transDuration in 1/4 of sec
-	duration = (duration == 0 ? 250 : duration); // director supports transition duration = 0, but animation play like value = 1, idk.
-
-	if (_transChunkSize == 0)
-		_transChunkSize = 1; // equal to 1 step
-
-	uint16 stepDuration = duration / _transChunkSize;
-	uint16 steps = duration / stepDuration;
-
-	switch (_transType) {
-	case kTransCoverDown:
-		{
-			uint16 stepSize = score->_movieRect.height() / steps;
-			Common::Rect r = score->_movieRect;
-
-			for (uint16 i = 1; i < steps; i++) {
-				r.setHeight(stepSize * i);
-
-				g_system->delayMillis(stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
-		}
-		break;
-	case kTransCoverUp:
-		{
-			uint16 stepSize = score->_movieRect.height() / steps;
-			Common::Rect r = score->_movieRect;
-
-			for (uint16 i = 1; i < steps; i++) {
-				r.setHeight(stepSize * i);
-
-				g_system->delayMillis(stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
-		}
-		break;
-	case kTransCoverRight: {
-			uint16 stepSize = score->_movieRect.width() / steps;
-			Common::Rect r = score->_movieRect;
-
-			for (uint16 i = 1; i < steps; i++) {
-				r.setWidth(stepSize * i);
-
-				g_system->delayMillis(stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
-		}
-		break;
-	case kTransCoverLeft: {
-			uint16 stepSize = score->_movieRect.width() / steps;
-			Common::Rect r = score->_movieRect;
-
-			for (uint16 i = 1; i < steps; i++) {
-				r.setWidth(stepSize * i);
-
-				g_system->delayMillis(stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
-		}
-		break;
-	case kTransCoverUpLeft: {
-			uint16 stepSize = score->_movieRect.width() / steps;
-			Common::Rect r = score->_movieRect;
-
-			for (uint16 i = 1; i < steps; i++) {
-				r.setWidth(stepSize * i);
-				r.setHeight(stepSize * i);
-
-				g_system->delayMillis(stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, score->_movieRect.height() - stepSize * i, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
-		}
-		break;
-	case kTransCoverUpRight: {
-			uint16 stepSize = score->_movieRect.width() / steps;
-			Common::Rect r = score->_movieRect;
-
-			for (uint16 i = 1; i < steps; i++) {
-				r.setWidth(stepSize * i);
-				r.setHeight(stepSize * i);
-
-				g_system->delayMillis(stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
-		}
-		break;
-	case kTransCoverDownLeft: {
-			uint16 stepSize = score->_movieRect.width() / steps;
-			Common::Rect r = score->_movieRect;
-
-			for (uint16 i = 1; i < steps; i++) {
-				r.setWidth(stepSize * i);
-				r.setHeight(stepSize * i);
-
-				g_system->delayMillis(stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
-		}
-		break;
-	case kTransCoverDownRight: {
-			uint16 stepSize = score->_movieRect.width() / steps;
-			Common::Rect r = score->_movieRect;
-
-			for (uint16 i = 1; i < steps; i++) {
-				r.setWidth(stepSize * i);
-				r.setHeight(stepSize * i);
-
-				g_system->delayMillis(stepDuration);
-				processQuitEvent();
-
-				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
-				g_system->updateScreen();
-			}
-		}
-		break;
-	default:
-		warning("Frame::playTransition(): Unhandled transition type %d %d %d", _transType, duration, _transChunkSize);
-		break;
-
-	}
-}
-
 void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) {
 	for (uint16 i = 0; i <= _numChannels; i++) {
 		if (!_sprites[i]->_enabled)
diff --git a/engines/director/module.mk b/engines/director/module.mk
index ece907a35e..f0e247db81 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -16,6 +16,7 @@ MODULE_OBJS = \
 	sound.o \
 	sprite.o \
 	stxt.o \
+	transitions.o \
 	util.o \
 	lingo/lingo-gr.o \
 	lingo/lingo.o \
diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
new file mode 100644
index 0000000000..b4a9ef4080
--- /dev/null
+++ b/engines/director/transitions.cpp
@@ -0,0 +1,178 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/system.h"
+
+#include "graphics/managed_surface.h"
+
+#include "director/director.h"
+#include "director/frame.h"
+#include "director/score.h"
+#include "director/util.h"
+
+namespace Director {
+
+void Frame::playTransition(Score *score) {
+	uint16 duration = _transDuration * 250; // _transDuration in 1/4 of sec
+	duration = (duration == 0 ? 250 : duration); // director supports transition duration = 0, but animation play like value = 1, idk.
+
+	if (_transChunkSize == 0)
+		_transChunkSize = 1; // equal to 1 step
+
+	uint16 stepDuration = duration / _transChunkSize;
+	uint16 steps = duration / stepDuration;
+
+	switch (_transType) {
+	case kTransCoverDown:
+		{
+			uint16 stepSize = score->_movieRect.height() / steps;
+			Common::Rect r = score->_movieRect;
+
+			for (uint16 i = 1; i < steps; i++) {
+				r.setHeight(stepSize * i);
+
+				g_system->delayMillis(stepDuration);
+				processQuitEvent();
+
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
+				g_system->updateScreen();
+			}
+		}
+		break;
+	case kTransCoverUp:
+		{
+			uint16 stepSize = score->_movieRect.height() / steps;
+			Common::Rect r = score->_movieRect;
+
+			for (uint16 i = 1; i < steps; i++) {
+				r.setHeight(stepSize * i);
+
+				g_system->delayMillis(stepDuration);
+				processQuitEvent();
+
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height()); // transition
+				g_system->updateScreen();
+			}
+		}
+		break;
+	case kTransCoverRight: {
+			uint16 stepSize = score->_movieRect.width() / steps;
+			Common::Rect r = score->_movieRect;
+
+			for (uint16 i = 1; i < steps; i++) {
+				r.setWidth(stepSize * i);
+
+				g_system->delayMillis(stepDuration);
+				processQuitEvent();
+
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
+				g_system->updateScreen();
+			}
+		}
+		break;
+	case kTransCoverLeft: {
+			uint16 stepSize = score->_movieRect.width() / steps;
+			Common::Rect r = score->_movieRect;
+
+			for (uint16 i = 1; i < steps; i++) {
+				r.setWidth(stepSize * i);
+
+				g_system->delayMillis(stepDuration);
+				processQuitEvent();
+
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height()); // transition
+				g_system->updateScreen();
+			}
+		}
+		break;
+	case kTransCoverUpLeft: {
+			uint16 stepSize = score->_movieRect.width() / steps;
+			Common::Rect r = score->_movieRect;
+
+			for (uint16 i = 1; i < steps; i++) {
+				r.setWidth(stepSize * i);
+				r.setHeight(stepSize * i);
+
+				g_system->delayMillis(stepDuration);
+				processQuitEvent();
+
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, score->_movieRect.height() - stepSize * i, r.width(), r.height()); // transition
+				g_system->updateScreen();
+			}
+		}
+		break;
+	case kTransCoverUpRight: {
+			uint16 stepSize = score->_movieRect.width() / steps;
+			Common::Rect r = score->_movieRect;
+
+			for (uint16 i = 1; i < steps; i++) {
+				r.setWidth(stepSize * i);
+				r.setHeight(stepSize * i);
+
+				g_system->delayMillis(stepDuration);
+				processQuitEvent();
+
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, score->_movieRect.height() - stepSize * i, r.width(), r.height()); // transition
+				g_system->updateScreen();
+			}
+		}
+		break;
+	case kTransCoverDownLeft: {
+			uint16 stepSize = score->_movieRect.width() / steps;
+			Common::Rect r = score->_movieRect;
+
+			for (uint16 i = 1; i < steps; i++) {
+				r.setWidth(stepSize * i);
+				r.setHeight(stepSize * i);
+
+				g_system->delayMillis(stepDuration);
+				processQuitEvent();
+
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, score->_movieRect.width() - stepSize * i, 0, r.width(), r.height()); // transition
+				g_system->updateScreen();
+			}
+		}
+		break;
+	case kTransCoverDownRight: {
+			uint16 stepSize = score->_movieRect.width() / steps;
+			Common::Rect r = score->_movieRect;
+
+			for (uint16 i = 1; i < steps; i++) {
+				r.setWidth(stepSize * i);
+				r.setHeight(stepSize * i);
+
+				g_system->delayMillis(stepDuration);
+				processQuitEvent();
+
+				g_system->copyRectToScreen(score->_surface->getPixels(), score->_surface->pitch, 0, 0, r.width(), r.height()); // transition
+				g_system->updateScreen();
+			}
+		}
+		break;
+	default:
+		warning("Frame::playTransition(): Unhandled transition type %d %d %d", _transType, duration, _transChunkSize);
+		break;
+
+	}
+}
+
+} // End of namespace Director




More information about the Scummvm-git-logs mailing list