aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/worldofxeen
diff options
context:
space:
mode:
Diffstat (limited to 'engines/xeen/worldofxeen')
-rw-r--r--engines/xeen/worldofxeen/clouds_cutscenes.h9
-rw-r--r--engines/xeen/worldofxeen/cutscenes.cpp100
-rw-r--r--engines/xeen/worldofxeen/cutscenes.h79
-rw-r--r--engines/xeen/worldofxeen/darkside_cutscenes.cpp78
-rw-r--r--engines/xeen/worldofxeen/darkside_cutscenes.h8
-rw-r--r--engines/xeen/worldofxeen/worldofxeen.cpp3
6 files changed, 248 insertions, 29 deletions
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.h b/engines/xeen/worldofxeen/clouds_cutscenes.h
index 2c2ed602ea..ff935a75fe 100644
--- a/engines/xeen/worldofxeen/clouds_cutscenes.h
+++ b/engines/xeen/worldofxeen/clouds_cutscenes.h
@@ -23,17 +23,14 @@
#ifndef XEEN_WORLDOFXEEN_CLOUDS_CUTSCENES_H
#define XEEN_WORLDOFXEEN_CLOUDS_CUTSCENES_H
+#include "xeen/worldofxeen/cutscenes.h"
#include "xeen/xeen.h"
namespace Xeen {
-class XeenEngine;
-
-class CloudsCutscenes {
-private:
- XeenEngine *_vm;
+class CloudsCutscenes : public Cutscenes {
public:
- CloudsCutscenes(XeenEngine *vm) : _vm(vm) {}
+ CloudsCutscenes(XeenEngine *vm) : Cutscenes(vm) {}
/**
* Shows the Clouds of Xeen title screen
diff --git a/engines/xeen/worldofxeen/cutscenes.cpp b/engines/xeen/worldofxeen/cutscenes.cpp
new file mode 100644
index 0000000000..20b4158c32
--- /dev/null
+++ b/engines/xeen/worldofxeen/cutscenes.cpp
@@ -0,0 +1,100 @@
+/* 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 "xeen/worldofxeen/cutscenes.h"
+#include "xeen/xeen.h"
+
+namespace Xeen {
+
+static const char *SUBTITLE_LINE = "\xC" "35\x3" "c\xB" "190\x9" "000%s";
+
+void Cutscenes::resetSubtitles() {
+ _subtitleLineNum = _subtitleSize = 0;
+}
+
+void Cutscenes::showSubtitles(uint windowIndex) {
+ Screen &screen = *_vm->_screen;
+ Sound &sound = *_vm->_sound;
+
+ if (sound._soundOn) {
+ // Sound is on, so subtitles aren't needed
+ resetSubtitles();
+ } else {
+ if (timeElapsed() > 1) {
+ ++_subtitleSize;
+ const Common::String &line = _subtitles[_subtitleLineNum];
+ Common::String lineStr(line.c_str(), line.c_str() + _subtitleSize);
+ _subtitleLine = Common::String::format(SUBTITLE_LINE, lineStr.c_str());
+
+ // If displayed a full line, then move to the next line
+ if (_subtitleSize == line.size()) {
+ _subtitleSize = 0;
+ if (++_subtitleLineNum == _subtitles.size())
+ _subtitleLineNum = 0;
+ }
+ }
+
+ // Draw the box sprite
+ if (!_boxSprites)
+ // Not already loaded, so load it
+ _boxSprites = new SpriteResource("box.vga");
+ _boxSprites->draw(screen, 0, Common::Point(36, 189));
+
+ // Write the subtitle line
+ screen._windows[windowIndex].writeString(_subtitleLine);
+ }
+
+ screen.update();
+}
+
+void Cutscenes::freeSubtitles() {
+ delete _boxSprites;
+ _boxSprites = nullptr;
+ _subtitles.clear();
+}
+
+bool Cutscenes::subtitlesWait(uint minTime) {
+ EventsManager &events = *_vm->_events;
+
+ events.updateGameCounter();
+ recordTime();
+ while (events.timeElapsed() < minTime || _subtitleSize != 0) {
+ events.pollEventsAndWait();
+ if (events.isKeyMousePressed())
+ return false;
+
+ showSubtitles();
+ }
+
+ return true;
+}
+
+void Cutscenes::recordTime() {
+ _vm->_events->timeMark1();
+}
+
+uint Cutscenes::timeElapsed() {
+ return _vm->_events->timeElapsed1();
+}
+
+
+} // End of namespace Xeen
diff --git a/engines/xeen/worldofxeen/cutscenes.h b/engines/xeen/worldofxeen/cutscenes.h
new file mode 100644
index 0000000000..895094d3dd
--- /dev/null
+++ b/engines/xeen/worldofxeen/cutscenes.h
@@ -0,0 +1,79 @@
+/* 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.
+ *
+ */
+
+#ifndef XEEN_WORLDOFXEEN_CUTSCENES_H
+#define XEEN_WORLDOFXEEN_CUTSCENES_H
+
+#include "xeen/files.h"
+#include "xeen/sprites.h"
+
+namespace Xeen {
+
+class XeenEngine;
+
+class Cutscenes {
+protected:
+ XeenEngine *_vm;
+ StringArray _subtitles;
+ SpriteResource *_boxSprites;
+ uint _timeElapsed;
+ Common::String _subtitleLine;
+ uint _subtitleLineNum, _subtitleSize;
+protected:
+ Cutscenes(XeenEngine *vm) : _vm(vm), _timeElapsed(0), _boxSprites(nullptr),
+ _subtitleLineNum(0), _subtitleSize(0) {}
+
+ /**
+ * Resets the subtitles position
+ */
+ void resetSubtitles();
+
+ /**
+ * Free subtitles
+ */
+ void freeSubtitles();
+
+ /**
+ * Shows subtitles
+ */
+ void showSubtitles(uint windowIndex = 0);
+
+ /**
+ * Delays either the specified number of frames, or until
+ * an entire subtitle line is shown if subtitles are on
+ */
+ bool subtitlesWait(uint minTime);
+
+ /**
+ * Records the current execution time
+ */
+ void recordTime();
+
+ /**
+ * Returns the number of ticks since the last recordTime
+ */
+ uint timeElapsed();
+};
+
+} // End of namespace Xeen
+
+#endif /* XEEN_WORLDOFXEEN_CUTSCENES_H */
diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
index a30f354d67..0c806dec41 100644
--- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
@@ -81,7 +81,7 @@ bool DarkSideCutscenes::showDarkSideTitle() {
++nwcFrame;
}
- if (events.wait(2, true))
+ if (events.wait(2))
return false;
}
@@ -112,14 +112,14 @@ bool DarkSideCutscenes::showDarkSideTitle() {
break;
}
- if (events.wait(2, true))
+ if (events.wait(2))
return false;
}
if (_vm->shouldQuit())
return false;
// Pause for a bit
- if (events.wait(10, true))
+ if (events.wait(10))
return false;
sound.setMusicVolume(95);
@@ -130,7 +130,7 @@ bool DarkSideCutscenes::showDarkSideTitle() {
screen.fadeIn(4);
events.updateGameCounter();
- events.wait(60, true);
+ events.wait(60);
return true;
}
@@ -149,6 +149,7 @@ bool DarkSideCutscenes::showDarkSideIntro() {
};
screen.fadeOut(8);
+ screen.loadPalette("dark.pal");
screen.loadBackground("pyramid2.raw");
screen.loadPage(0);
screen.loadPage(1);
@@ -158,14 +159,14 @@ bool DarkSideCutscenes::showDarkSideIntro() {
SpriteResource sprites[3] = {
SpriteResource("title.int"), SpriteResource("pyratop.int"), SpriteResource("pyramid.int")
};
- File voc[2];
- voc[0].open("pharoh1a.voc");
- voc[1].open("pharoh1b.voc");
screen.vertMerge(SCREEN_HEIGHT);
screen.loadPage(0);
screen.loadPage(1);
+ // Play the intro music
+ sound.playSong("bigtheme.m");
+
// Show Might and Magic Darkside of Xeen title, and gradualy scroll
// the background vertically down to show the Pharoah's base
int yp = 0;
@@ -196,7 +197,7 @@ bool DarkSideCutscenes::showDarkSideIntro() {
yCtr -= timeExpired;
yp = MIN((uint)(yp + timeExpired), (uint)200);
- if (events.wait(1, true))
+ if (events.wait(1))
return false;
if (fadeFlag) {
@@ -211,7 +212,8 @@ bool DarkSideCutscenes::showDarkSideIntro() {
screen.freePages();
events.updateGameCounter();
- events.wait(30, true);
+ if (events.wait(30))
+ return false;
// Zoom into the Pharoah's base closeup view
for (int idx = 14; idx >= 0; --idx) {
@@ -222,36 +224,74 @@ bool DarkSideCutscenes::showDarkSideIntro() {
if (idx == 2)
sound.setMusicVolume(48);
- if (events.wait(2, true))
+ if (events.wait(2))
return false;
}
- // TODO: More
- sound.playSong(voc[0]);
- sound.playSong(voc[1]);
-
return true;
}
bool DarkSideCutscenes::showDarkSideEnding() {
EventsManager &events = *_vm->_events;
Screen &screen = *_vm->_screen;
-// Sound &sound = *_vm->_sound;
+ Sound &sound = *_vm->_sound;
- //Voc voc("ido2.voc");
- // Music newBright("newbrigh.m");
+ File ido2("ido2.voc");
SpriteResource box("box.vga");
-// newBright.play();
+ sound.playSong("dngon3.m");
screen.loadBackground("scene1.raw");
screen.loadPalette("endgame.pal");
screen.update();
screen.fadeIn(4);
events.updateGameCounter();
+ if (events.wait(30))
+ return false;
+
+ screen.loadBackground("scene2-b.raw");
+ screen.update();
+ screen.saveBackground();
+
+ SpriteResource faceEnd("face.end");
+ events.updateGameCounter();
+ screen.restoreBackground();
+ faceEnd.draw(screen, 0, Common::Point(29, 76), SPRFLAG_4000);
+ screen.update();
+
+ screen.fadeIn(4);
+ if (events.wait(1, false))
+ return false;
+
+ _subtitles.load("special.bin");
+ recordTime();
+ resetSubtitles();
+
+ // Alamar stands up
+ for (int idx = 74; idx > 20; idx -= 2) {
+ if (idx == 60)
+ sound.songCommand(207);
+ else if (idx == 22)
+ sound.stopSong();
+
+ events.updateGameCounter();
+ screen.restoreBackground();
+ faceEnd.draw(screen, 0, Common::Point(29, idx), SPRFLAG_4000);
+ screen.update();
- // TODO
+ if (events.wait(2))
+ return false;
+ }
+
+ // Alamar says "Come to me"
+ sound.playSound("come2.voc");
+ if (!subtitlesWait(27))
+ return false;
+
+ // TODO
events.wait(5000);
+
+ freeSubtitles();
return true;
}
diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.h b/engines/xeen/worldofxeen/darkside_cutscenes.h
index 1b78e3ea2d..567b70e05f 100644
--- a/engines/xeen/worldofxeen/darkside_cutscenes.h
+++ b/engines/xeen/worldofxeen/darkside_cutscenes.h
@@ -23,15 +23,15 @@
#ifndef XEEN_WORLDOFXEEN_DARKSIDE_CUTSCENES_H
#define XEEN_WORLDOFXEEN_DARKSIDE_CUTSCENES_H
+#include "xeen/worldofxeen/cutscenes.h"
+
namespace Xeen {
class XeenEngine;
-class DarkSideCutscenes {
-private:
- XeenEngine *_vm;
+class DarkSideCutscenes : public Cutscenes {
public:
- DarkSideCutscenes(XeenEngine *vm) : _vm(vm) {}
+ DarkSideCutscenes(XeenEngine *vm) : Cutscenes(vm) {}
/**
* Shows the Dark Side of Xeen title screen
diff --git a/engines/xeen/worldofxeen/worldofxeen.cpp b/engines/xeen/worldofxeen/worldofxeen.cpp
index a71efbb162..ccdbf8cf3b 100644
--- a/engines/xeen/worldofxeen/worldofxeen.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen.cpp
@@ -40,9 +40,12 @@ void WorldOfXeenEngine::showIntro() {
if (gDebugLevel == 0)
return;
+ showDarkSideEnding();
+ /*
bool completed = showDarkSideTitle();
if (!_seenDarkSideIntro && completed)
showDarkSideIntro();
+ */
}
} // End of namespace Xeen