[Scummvm-git-logs] scummvm master -> 6ee8212c37616ea6a844f16205bbe0e14d360539

eriktorbjorn noreply at scummvm.org
Sun Dec 24 07:31:39 UTC 2023


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:
54b27b02a2 SCUMM: Clean up Mac Loom "About" dialog a bit
6ee8212c37 SCUMM: Add enum for Mac GUI delay() return values


Commit: 54b27b02a2401247b673e461d9ae55c525bb4f6a
    https://github.com/scummvm/scummvm/commit/54b27b02a2401247b673e461d9ae55c525bb4f6a
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T08:30:50+01:00

Commit Message:
SCUMM: Clean up Mac Loom "About" dialog a bit

There was a lot of unnecessary code duplication, and I had already
started to forget how I meant it to work. This should make things a bit
clearer.

Changed paths:
    engines/scumm/macgui/macgui_loom.cpp


diff --git a/engines/scumm/macgui/macgui_loom.cpp b/engines/scumm/macgui/macgui_loom.cpp
index 41d6b713143..d29aa37a8be 100644
--- a/engines/scumm/macgui/macgui_loom.cpp
+++ b/engines/scumm/macgui/macgui_loom.cpp
@@ -238,10 +238,34 @@ void MacLoomGui::runAboutDialog() {
 		TEXT_END_MARKER
 	};
 
+	struct AboutPage {
+		const TextLine *text;
+		int waitFrames;
+	};
+
+	AboutPage aboutPages[] = {
+		{ nullptr,  60 },	// ~3 seconds
+		{ page1,    40 },	// ~2 seconds
+		{ page2,   130 },	// ~6.5 seconds
+		{ page3,    80 },	// ~4 seconds
+		{ page4,    80 },
+		{ page5,    80 },
+		{ page6,    80 },
+		{ page7,   260 },	// ~13 seconds
+		{ page8,     0 }
+	};
+
+	int page = 0;
+
 	// I've based the animation speed on what it looks like when Mini vMac
 	// emulates an old black-and-white Mac at normal speed. It looks a bit
 	// different in Basilisk II, but that's probably because it emulates a
 	// much faster Mac.
+	//
+	// The animation is either either growing or shrinking, depending on
+	// if growth is positive or negative. During each scene, the animation
+	// may reach its smallest point, at which time it bounces back. When
+	// it reaches its outer limit, the scene ends.
 
 	window->show();
 
@@ -301,9 +325,6 @@ void MacLoomGui::runAboutDialog() {
 			status = delay(50);
 		}
 
-		// We can't actually skip to the end of a scene, because the
-		// animation has to be drawn.
-
 		if (status == 1)
 			fastForward = true;
 
@@ -314,83 +335,46 @@ void MacLoomGui::runAboutDialog() {
 			changeScene = false;
 			scene++;
 
-			switch (scene) {
-			case 1:
+			// Animations happen on even-numbered scenes. All
+			// animations start in an inwards direction.
+			//
+			// Odd-numbered scenes are the text pages where it
+			// waits for a bit before continuing. This is where
+			// fast-forwarding (by clicking) stops. Unlike Last
+			// Crusade, we can't just skip the animation because
+			// everything has to be drawn. (Well, some could
+			// probably be skipped, but I doubt it's worth the
+			// trouble to do so.)
+
+			if ((scene % 2) == 0)
+				growth = -2;
+			else {
 				fastForward = false;
-				waitFrames = 60;	// ~3 seconds
 				darkenOnly = true;
-				window->drawSprite(lucasFilm, 134, 61);
-				break;
 
-			case 2:
-			case 6:
-			case 8:
-			case 10:
-			case 12:
-			case 14:
-			case 16:
-				growth = -2;
-				break;
+				if (aboutPages[page].text)
+					window->drawTexts(r, aboutPages[page].text);
 
-			case 3:
-				fastForward = false;
-				darkenOnly = true;
-				waitFrames = 40;	// ~2 seconds
-				window->drawTexts(r, page1);
+				waitFrames = aboutPages[page].waitFrames;
+				page++;
+			}
+
+			switch (scene) {
+			case 1:
+				window->drawSprite(lucasFilm, 134, 61);
 				break;
 
 			case 4:
-				growth = -2;
+				// All subsequent text pages are larger, which
+				// we compensate by making the inner bounce
+				// happen earlier.
+
 				innerBounce -= 8;
 				targetTop -= 16;
 				break;
 
 			case 5:
-				fastForward = false;
-				darkenOnly = true;
-				waitFrames = 130;	// ~6.5 seconds
 				window->drawSprite(loom, 95, 38);
-				window->drawTexts(r, page2);
-				break;
-
-			case 7:
-				fastForward = false;
-				darkenOnly = true;
-				waitFrames = 80;	// ~4 seconds
-				window->drawTexts(r, page3);
-				break;
-
-			case 9:
-				fastForward = false;
-				darkenOnly = true;
-				waitFrames = 80;
-				window->drawTexts(r, page4);
-				break;
-
-			case 11:
-				fastForward = false;
-				darkenOnly = true;
-				waitFrames = 80;
-				window->drawTexts(r, page5);
-				break;
-
-			case 13:
-				fastForward = false;
-				darkenOnly = true;
-				waitFrames = 80;
-				window->drawTexts(r, page6);
-				break;
-
-			case 15:
-				fastForward = false;
-				darkenOnly = true;
-				waitFrames = 260;	// ~13 seconds
-				window->drawTexts(r, page7);
-				break;
-
-			case 17:
-				fastForward = false;
-				window->drawTexts(r, page8);
 				break;
 			}
 


Commit: 6ee8212c37616ea6a844f16205bbe0e14d360539
    https://github.com/scummvm/scummvm/commit/6ee8212c37616ea6a844f16205bbe0e14d360539
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2023-12-24T08:31:20+01:00

Commit Message:
SCUMM: Add enum for Mac GUI delay() return values

This should hopefully make it clearer what's intended. The delay can
either run its normal course, be interrupted (by clicking), or be
aborted (by quitting).

Changed paths:
    engines/scumm/macgui/macgui_impl.cpp
    engines/scumm/macgui/macgui_impl.h
    engines/scumm/macgui/macgui_indy3.cpp
    engines/scumm/macgui/macgui_loom.cpp


diff --git a/engines/scumm/macgui/macgui_impl.cpp b/engines/scumm/macgui/macgui_impl.cpp
index 265140b2b7d..048623b4c59 100644
--- a/engines/scumm/macgui/macgui_impl.cpp
+++ b/engines/scumm/macgui/macgui_impl.cpp
@@ -89,7 +89,7 @@ bool MacGuiImpl::handleEvent(Common::Event event) {
 	return _windowManager->processEvent(event);
 }
 
-int MacGuiImpl::delay(uint32 ms) {
+MacGuiImpl::DelayStatus MacGuiImpl::delay(uint32 ms) {
 	uint32 to;
 
 	to = _system->getMillis() + ms;
@@ -100,10 +100,10 @@ int MacGuiImpl::delay(uint32 ms) {
 		while (_system->getEventManager()->pollEvent(event)) {
 			switch (event.type) {
 			case Common::EVENT_QUIT:
-				return 2;
+				return kDelayAborted;
 
 			case Common::EVENT_LBUTTONDOWN:
-				return 1;
+				return kDelayInterrupted;
 
 			default:
 				break;
@@ -118,7 +118,7 @@ int MacGuiImpl::delay(uint32 ms) {
 		}
 	}
 
-	return 0;
+	return kDelayDone;
 }
 
 // --------------------------------------------------------------------------
diff --git a/engines/scumm/macgui/macgui_impl.h b/engines/scumm/macgui/macgui_impl.h
index 3cde11b775a..a6252a1364d 100644
--- a/engines/scumm/macgui/macgui_impl.h
+++ b/engines/scumm/macgui/macgui_impl.h
@@ -65,6 +65,12 @@ protected:
 
 	byte _unicodeToMacRoman[96];
 
+	enum DelayStatus {
+		kDelayDone = 0,
+		kDelayInterrupted = 1,
+		kDelayAborted
+	};
+
 	enum Color {
 		kBlack = 0,
 		kBlue = 1,
@@ -130,7 +136,7 @@ protected:
 		kStyleRounded
 	};
 
-	int delay(uint32 ms = 0);
+	MacGuiImpl::DelayStatus delay(uint32 ms = 0);
 
 	virtual bool getFontParams(FontId fontId, int &id, int &size, int &slant) const;
 
diff --git a/engines/scumm/macgui/macgui_indy3.cpp b/engines/scumm/macgui/macgui_indy3.cpp
index 6295836c809..c577ecc1b43 100644
--- a/engines/scumm/macgui/macgui_indy3.cpp
+++ b/engines/scumm/macgui/macgui_indy3.cpp
@@ -1143,7 +1143,7 @@ void MacIndy3Gui::runAboutDialog() {
 	// 10 fps.
 
 	int scene = 0;
-	int status = 0;
+	DelayStatus status = kDelayDone;
 
 	int trainX = -2;
 	int trolleyX = width + 1;
@@ -1268,10 +1268,10 @@ void MacIndy3Gui::runAboutDialog() {
 		window->update();
 		status = delay((scene == 0) ? 33 : 100);
 
-		if (status == 2)
+		if (status == kDelayAborted)
 			break;
 
-		if (status == 1 || changeScene) {
+		if (status == kDelayInterrupted || changeScene) {
 			changeScene = false;
 			scene++;
 			waitFrames = 50;	// ~5 seconds
@@ -1324,7 +1324,7 @@ void MacIndy3Gui::runAboutDialog() {
 		}
 	}
 
-	if (status != 2)
+	if (status != kDelayAborted)
 		delay();
 
 	_windowManager->popCursor();
diff --git a/engines/scumm/macgui/macgui_loom.cpp b/engines/scumm/macgui/macgui_loom.cpp
index d29aa37a8be..382f6b9b8ac 100644
--- a/engines/scumm/macgui/macgui_loom.cpp
+++ b/engines/scumm/macgui/macgui_loom.cpp
@@ -270,7 +270,7 @@ void MacLoomGui::runAboutDialog() {
 	window->show();
 
 	int scene = 0;
-	int status = 0;
+	DelayStatus status = kDelayDone;
 
 	Common::Rect r(0, 0, 404, 154);
 	int growth = -2;
@@ -325,10 +325,10 @@ void MacLoomGui::runAboutDialog() {
 			status = delay(50);
 		}
 
-		if (status == 1)
+		if (status == kDelayInterrupted)
 			fastForward = true;
 
-		if (status == 2)
+		if (status == kDelayAborted)
 			break;
 
 		if (changeScene) {
@@ -385,7 +385,7 @@ void MacLoomGui::runAboutDialog() {
 		}
 	}
 
-	if (status != 2)
+	if (status != kDelayAborted)
 		delay();
 
 	_windowManager->popCursor();




More information about the Scummvm-git-logs mailing list