[Scummvm-git-logs] scummvm master -> e20266d60659d6d0d85d327567512c82df72f6a1

dreammaster dreammaster at scummvm.org
Sun Mar 11 20:30:24 CET 2018


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

Summary:
e20266d606 XEEN: Subtitle fixes for Clouds of Xeen intro


Commit: e20266d60659d6d0d85d327567512c82df72f6a1
    https://github.com/scummvm/scummvm/commit/e20266d60659d6d0d85d327567512c82df72f6a1
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-03-11T15:30:17-04:00

Commit Message:
XEEN: Subtitle fixes for Clouds of Xeen intro

Changed paths:
    engines/xeen/subtitles.cpp
    engines/xeen/subtitles.h
    engines/xeen/worldofxeen/clouds_cutscenes.cpp
    engines/xeen/worldofxeen/clouds_cutscenes.h


diff --git a/engines/xeen/subtitles.cpp b/engines/xeen/subtitles.cpp
index f6702fc..9a5f250 100644
--- a/engines/xeen/subtitles.cpp
+++ b/engines/xeen/subtitles.cpp
@@ -38,7 +38,7 @@ Subtitles::~Subtitles() {
 }
 
 void Subtitles::loadSubtitles() {
-	File f("special.bin", 2);
+	File f("special.bin");
 	while (f.pos() < f.size())
 		_lines.push_back(f.readString());
 	f.close();
@@ -133,5 +133,30 @@ void Subtitles::show() {
 	}
 }
 
+/*------------------------------------------------------------------------*/
+
+void CloudsSubtitles::loadSubtitles() {
+	File f("special.bin");
+	
+	// The first subtitle line contains all the text for the Clouds intro. Since ScummVM allows
+	// both voice and subtitles at the same time, unlike the original, we need to split up the
+	// first subtitle into separate lines to allow them to better interleave with the voice
+	Common::String line = f.readString();
+	for (;;) {
+		const char *lineSep = strstr(line.c_str(), "   ");
+		if (!lineSep)
+			break;
+
+		_lines.push_back(Common::String(line.c_str(), lineSep));
+		line = Common::String(lineSep + 3);
+		while (line.hasPrefix(" "))
+			line.deleteChar(0);
+	}
+
+	// Read in remaining lines
+	while (f.pos() < f.size())
+		_lines.push_back(f.readString());
+	f.close();
+}
 
 } // End of namespace Xeen
diff --git a/engines/xeen/subtitles.h b/engines/xeen/subtitles.h
index 6f97b2a..84f7a09 100644
--- a/engines/xeen/subtitles.h
+++ b/engines/xeen/subtitles.h
@@ -29,17 +29,17 @@
 namespace Xeen {
 
 class Subtitles {
-private:
+protected:
 	Common::StringArray _lines;
 	int _lineNum;
 	SpriteResource *_boxSprites;
 	int _lineEnd, _lineSize;
 	Common::String _displayLine;
-private:
+protected:
 	/**
 	 * Loads the string list of all subtitles
 	 */
-	void loadSubtitles();
+	virtual void loadSubtitles();
 
 	/**
 	 * Mark the current time
@@ -59,7 +59,7 @@ public:
 	/**
 	 * Destructor
 	 */
-	~Subtitles();
+	virtual ~Subtitles();
 
 	/**
 	 * Set which subtitle line to display
@@ -95,6 +95,16 @@ public:
 	bool waitForLineOrSound();
 };
 
+class CloudsSubtitles : public Subtitles {
+protected:
+	/**
+	 * Loads the string list of all subtitles
+	 */
+	virtual void loadSubtitles();
+public:
+	CloudsSubtitles() : Subtitles() {}
+};
+
 } // End of namespace Xeen
 
 #endif /* XEEN_SUBTITLES_H */
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
index 27f09f7..6ec66d7 100644
--- a/engines/xeen/worldofxeen/clouds_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
@@ -34,6 +34,7 @@ namespace WorldOfXeen {
 		cloudsCtr = 1
 
 bool CloudsCutscenes::showCloudsIntro() {
+	EventsManager &events = *g_vm->_events;
 	FileManager &files = *g_vm->_files;
 	Screen &screen = *g_vm->_screen;
 	Sound &sound = *g_vm->_sound;
@@ -43,6 +44,7 @@ bool CloudsCutscenes::showCloudsIntro() {
 
 	bool seenIntro = showCloudsTitle() && showCloudsIntroInner();
 
+	events.clearEvents();
 	sound.stopAllAudio();
 	screen.freePages();
 
@@ -247,16 +249,36 @@ bool CloudsCutscenes::showCloudsIntroInner() {
 	sound.setMusicPercent(60);
 	screen.restoreBackground();
 	screen.update();
-	_subtitles.reset();
+	_subtitles.setLine(0);
 
 	// Loop through each spoken line
 	int ctr1 = 0, ctr2 = 0, ctr3 = 0, ctr4 = 0, ctr5 = 0, totalCtr = 0;
 	for (int lineCtr = 0; lineCtr < 14; ++lineCtr) {
 		if (lineCtr != 6 && lineCtr != 7) {
+			// Set subtitle to display (presuming subtitles are turned on)
+			switch (lineCtr) {
+			case 0:
+				_subtitles.setLine(0);
+				break;
+			case 1:
+				_subtitles.setLine(1);
+				break;
+			case 5:
+				_subtitles.setLine(2);
+				break;
+			case 11:
+				_subtitles.setLine(3);
+				break;
+			default:
+				break;
+			}
+
+			// Play the next sample
 			sound.playSound(_INTRO_VOCS[lineCtr]);
 		}
 
-		for (int frameCtr = 0, lookup = 0; sound.isSoundPlaying() || _subtitles.active(); ) {
+		for (int frameCtr = 0, lookup = 0; sound.isSoundPlaying() || 
+				(_subtitles.active() && (lineCtr == 0 || lineCtr == 4 || lineCtr == 10 || lineCtr == 13)); ) {
 			groupo.draw(0, 0);
 			groupo.draw(0, 1, Common::Point(160, 0));
 
@@ -309,8 +331,8 @@ bool CloudsCutscenes::showCloudsIntroInner() {
 				windows[0].writeString(Res.CLOUDS_INTRO1);
 
 				ctr5 = (ctr5 + 1) % 19;
+				
 				WAIT(1);
-				_subtitles.show();
 				continue;
 			}
 
@@ -322,18 +344,13 @@ bool CloudsCutscenes::showCloudsIntroInner() {
 				windows[0].writeString(Res.CLOUDS_INTRO1);
 
 				ctr5 = (ctr5 + 1) % 19;
-				WAIT(1);
-				_subtitles.show();
 				break;
 			}
 
-			events.updateGameCounter();
-			while (events.timeElapsed() < _INTRO_FRAMES_WAIT[_INTRO_FRAMES_LOOKUP[lineCtr]][lookup]
-					&& sound.isSoundPlaying()) {
-				events.pollEventsAndWait();
-				if (events.isKeyMousePressed())
-					return false;
-			}
+			int duration = _INTRO_FRAMES_WAIT[_INTRO_FRAMES_LOOKUP[lineCtr]][lookup];
+			if (duration == 0)
+				duration = 1;
+			WAIT(duration);
 
 			++lookup;
 			if (!sound._fxOn && lookup > 30)
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.h b/engines/xeen/worldofxeen/clouds_cutscenes.h
index 39fded6..17cd6d3 100644
--- a/engines/xeen/worldofxeen/clouds_cutscenes.h
+++ b/engines/xeen/worldofxeen/clouds_cutscenes.h
@@ -39,7 +39,7 @@ private:
 	static const byte _DECODE_TABLE1[256];
 	static const byte _DECODE_TABLE2[256];
 private:
-	Subtitles _subtitles;
+	CloudsSubtitles _subtitles;
 	SpriteResource _mirror, _mirrBack;
 	int _mergeX;
 private:





More information about the Scummvm-git-logs mailing list