aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/subtitles.cpp27
-rw-r--r--engines/xeen/subtitles.h18
-rw-r--r--engines/xeen/worldofxeen/clouds_cutscenes.cpp41
-rw-r--r--engines/xeen/worldofxeen/clouds_cutscenes.h2
4 files changed, 70 insertions, 18 deletions
diff --git a/engines/xeen/subtitles.cpp b/engines/xeen/subtitles.cpp
index f6702fcf73..9a5f250cf9 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 6f97b2a7f9..84f7a09d15 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 27f09f7b7f..6ec66d70af 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 39fded63ea..17cd6d3f08 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: