diff options
author | Paul Gilbert | 2018-03-10 21:56:38 -0500 |
---|---|---|
committer | Paul Gilbert | 2018-03-10 21:56:38 -0500 |
commit | f4af55adc2e85825fd0ced648f81af4ffbe446e7 (patch) | |
tree | 09bbcfaa5a02c2b9fcab1953a6b839e8d1a881ac | |
parent | 5b72fbdcbd7f2c2c8191d6c362e84ec53628516b (diff) | |
download | scummvm-rg350-f4af55adc2e85825fd0ced648f81af4ffbe446e7.tar.gz scummvm-rg350-f4af55adc2e85825fd0ced648f81af4ffbe446e7.tar.bz2 scummvm-rg350-f4af55adc2e85825fd0ced648f81af4ffbe446e7.zip |
XEEN: Subtitle improvements, set up correct subtitles for Darkside intro
-rw-r--r-- | engines/xeen/cutscenes.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/cutscenes.h | 18 | ||||
-rw-r--r-- | engines/xeen/events.h | 6 | ||||
-rw-r--r-- | engines/xeen/subtitles.cpp | 27 | ||||
-rw-r--r-- | engines/xeen/subtitles.h | 11 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/clouds_cutscenes.cpp | 7 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/clouds_cutscenes.h | 1 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/darkside_cutscenes.cpp | 55 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/darkside_cutscenes.h | 2 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp | 2 |
10 files changed, 56 insertions, 77 deletions
diff --git a/engines/xeen/cutscenes.cpp b/engines/xeen/cutscenes.cpp index d799049b54..667354a83a 100644 --- a/engines/xeen/cutscenes.cpp +++ b/engines/xeen/cutscenes.cpp @@ -25,6 +25,10 @@ namespace Xeen { +bool Cutscenes::wait(uint numFrames, bool interruptable) { + return _subtitles.wait(numFrames, interruptable); +} + uint Cutscenes::getSpeakingFrame(uint minFrame, uint maxFrame) { uint interval = g_system->getMillis() / 100; return minFrame + interval % (maxFrame + 1 - minFrame); diff --git a/engines/xeen/cutscenes.h b/engines/xeen/cutscenes.h index b3bc778b73..4e7a5471da 100644 --- a/engines/xeen/cutscenes.h +++ b/engines/xeen/cutscenes.h @@ -25,27 +25,31 @@ #include "xeen/files.h" #include "xeen/sprites.h" +#include "xeen/subtitles.h" namespace Xeen { -#define WAIT(TIME) \ - events.timeMark5(); \ - do { \ - events.updateGameCounter(); \ - if (events.wait(1)) \ - return false; \ - } while (!g_vm->shouldExit() && events.timeElapsed5() < TIME) +#define WAIT(TIME) if (Cutscenes::wait(TIME)) return false class XeenEngine; class Cutscenes { protected: XeenEngine *_vm; + Subtitles _subtitles; protected: Cutscenes(XeenEngine *vm) : _vm(vm) {} virtual ~Cutscenes() {} /** + * Waits for a given number of frames + * @param numFrames Number of frames to wait + * @param interruptable If set, aborts if the mouse or a key is pressed + * @returns True if the wait was aborted + */ + bool wait(uint numFrames, bool interruptable = true); + + /** * Get a speaking frame from a range */ uint getSpeakingFrame(uint minFrame, uint maxFrame); diff --git a/engines/xeen/events.h b/engines/xeen/events.h index 49632596cc..0ef2c3a9e7 100644 --- a/engines/xeen/events.h +++ b/engines/xeen/events.h @@ -112,6 +112,12 @@ public: uint32 playTime() const { return _playTime; } void setPlayTime(uint32 time) { _playTime = time; } + /** + * Waits for a given number of frames + * @param numFrames Number of frames to wait + * @param interruptable If set, aborts if the mouse or a key is pressed + * @returns True if the wait was aborted + */ bool wait(uint numFrames, bool interruptable = true); /** diff --git a/engines/xeen/subtitles.cpp b/engines/xeen/subtitles.cpp index 6cebb9c735..fbcdbf5d3a 100644 --- a/engines/xeen/subtitles.cpp +++ b/engines/xeen/subtitles.cpp @@ -28,8 +28,6 @@ namespace Xeen { -#define SUBTITLE_FRAME_TIME 10 - static const char *SUBTITLE_LINE = "\f35\x3""c\v190\t000%s"; Subtitles::Subtitles() : _lineNum(-1), _boxSprites(nullptr), _lineEnd(0), _lineSize(0), _frameExpiryTime(0) { @@ -51,13 +49,11 @@ void Subtitles::reset() { } void Subtitles::markTime() { - _frameExpiryTime = g_system->getMillis() + SUBTITLE_FRAME_TIME; - //g_vm->_events->timeMark3(); + g_vm->_events->timeMark3(); } bool Subtitles::timeElapsed() const { - return g_system->getMillis() >= _frameExpiryTime; - //return g_vm->_events->timeElapsed3() > 1; + return g_vm->_events->timeElapsed3() >= 2; } void Subtitles::setLine(int line) { @@ -75,20 +71,19 @@ bool Subtitles::active() const { return _lineNum != -1; } -bool Subtitles::wait(uint minTime) { +bool Subtitles::wait(uint numFrames, bool interruptable) { EventsManager &events = *g_vm->_events; + bool result = g_vm->shouldExit(); events.updateGameCounter(); - markTime(); - while (events.timeElapsed() < minTime || active()) { - events.pollEventsAndWait(); - if (events.isKeyMousePressed()) - return false; - + while (!g_vm->shouldExit() && events.timeElapsed() < numFrames && !result) { show(); + events.pollEventsAndWait(); + result = events.isKeyMousePressed(); } - return true; + events.clearEvents(); + return result; } bool Subtitles::waitForLineOrSound() { @@ -102,7 +97,7 @@ bool Subtitles::waitForLineOrSound() { return true; } -void Subtitles::show(uint windowNum) { +void Subtitles::show() { Sound &sound = *g_vm->_sound; Windows &windows = *g_vm->_windows; @@ -131,7 +126,7 @@ void Subtitles::show(uint windowNum) { _boxSprites->draw(0, 0, Common::Point(36, 189)); // Write the subtitle line - windows[windowNum].writeString(_displayLine); + windows[0].writeString(_displayLine); if (_lineEnd == 0) reset(); diff --git a/engines/xeen/subtitles.h b/engines/xeen/subtitles.h index c041db2718..de5179d3b7 100644 --- a/engines/xeen/subtitles.h +++ b/engines/xeen/subtitles.h @@ -79,15 +79,16 @@ public: /** * Shows any active subtitle - * @param windowNum Window to render to */ - void show(uint windowNum = 0); + void show(); /** - * Delays either the specified number of frames, or until - * an entire subtitle line is shown if subtitles are on + * Waits for a given number of frames + * @param numFrames Number of frames to wait + * @param interruptable If set, aborts if the mouse or a key is pressed + * @returns True if the wait was aborted */ - bool wait(uint minTime = 0); + bool wait(uint numFrames, bool interruptable = true); /** * Wait for the end of currently playing sound or subtitles line diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp index 89a54c6836..27f09f7b7f 100644 --- a/engines/xeen/worldofxeen/clouds_cutscenes.cpp +++ b/engines/xeen/worldofxeen/clouds_cutscenes.cpp @@ -50,7 +50,6 @@ bool CloudsCutscenes::showCloudsIntro() { } bool CloudsCutscenes::showCloudsTitle() { - EventsManager &events = *_vm->_events; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; @@ -379,7 +378,6 @@ void CloudsCutscenes::showCloudsEnding(uint finalScore) { } bool CloudsCutscenes::showCloudsEnding1() { - EventsManager &events = *_vm->_events; FileManager &files = *_vm->_files; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; @@ -561,7 +559,7 @@ bool CloudsCutscenes::showCloudsEnding1() { break; } - _subtitles.show(0); + _subtitles.show(); WAIT(3); } while (sound.isSoundPlaying() || _subtitles.active()); } @@ -608,7 +606,6 @@ bool CloudsCutscenes::showCloudsEnding1() { } bool CloudsCutscenes::showCloudsEnding2() { - EventsManager &events = *_vm->_events; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; @@ -707,7 +704,6 @@ const int8 XARRAY[8] = { -2, -1, 0, 1, 2, 1, 0, -1 }; const int8 YARRAY[8] = { -2, 0, 2, 0, -1, 0, 2, 0 }; bool CloudsCutscenes::showCloudsEnding3() { - EventsManager &events = *_vm->_events; Map &map = *_vm->_map; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; @@ -949,7 +945,6 @@ bool CloudsCutscenes::showCloudsEnding4(uint finalScore) { } bool CloudsCutscenes::showCloudsEnding5() { - EventsManager &events = *_vm->_events; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; SpriteResource king("king.end"); diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.h b/engines/xeen/worldofxeen/clouds_cutscenes.h index 39fded63ea..dd632ebf8f 100644 --- a/engines/xeen/worldofxeen/clouds_cutscenes.h +++ b/engines/xeen/worldofxeen/clouds_cutscenes.h @@ -39,7 +39,6 @@ private: static const byte _DECODE_TABLE1[256]; static const byte _DECODE_TABLE2[256]; private: - Subtitles _subtitles; SpriteResource _mirror, _mirrBack; int _mergeX; private: diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp index 8886afeaa7..88f148d5a5 100644 --- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp +++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp @@ -70,7 +70,6 @@ const int LEFT_CLAW_IDLE_Y[32] = { bool DarkSideCutscenes::showDarkSideTitle(bool seenIntro) { - EventsManager &events = *g_vm->_events; Screen &screen = *g_vm->_screen; Sound &sound = *g_vm->_sound; g_vm->_files->_isDarkCc = true; @@ -197,7 +196,6 @@ bool DarkSideCutscenes::showDarkSideIntro(bool seenIntro) { } bool DarkSideCutscenes::rubCrystalBall(bool fadeIn) { - EventsManager &events = *g_vm->_events; Screen &screen = *g_vm->_screen; for (int frame = 0; frame < 32; ++frame) { @@ -363,9 +361,6 @@ bool DarkSideCutscenes::showDarkSideIntro1() { screen.horizMerge(idx); dragon.draw(0, FRAMES3[frameNum], Common::Point(XLIST3[posNum], YLIST3[posNum]), SPRFLAG_800); _subtitles.show(); - events.pollEventsAndWait(); - if (events.isKeyMousePressed()) - return false; if (idx == SCREEN_WIDTH) sound.playSound(PHAR_VOC[0]); @@ -402,7 +397,6 @@ bool DarkSideCutscenes::showDarkSideIntro1() { clawCtr = (clawCtr + 1) % 32 bool DarkSideCutscenes::showDarkSideIntro2() { - EventsManager &events = *g_vm->_events; Screen &screen = *g_vm->_screen; Sound &sound = *g_vm->_sound; SpriteResource goon("goon.int"), darkLord("darklord.int"), queen("queen.int"), @@ -416,8 +410,8 @@ bool DarkSideCutscenes::showDarkSideIntro2() { if (!rubCrystalBall(true)) return false; - // TODO: Subtitle stuff - _subtitles.setLine(1); + // Queen Kalindra? + _subtitles.setLine(9); sound.playFX(42); for (idx = 0, clawCtr = 0; idx < 11; ++idx) { @@ -444,7 +438,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { if (!sound.isSoundPlaying() && vocIndex < 3) { if (!_subtitles.active()) { if (!vocIndex) - _subtitles.setLine(9 + vocIndex); + _subtitles.setLine(10); sound.playSound(VOC_NAMES[vocIndex++]); if (vocIndex == 3) @@ -467,7 +461,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { } while (vocIndex < 3 || sound.isSoundPlaying() || _subtitles.active()); sound.playSound(VOC_NAMES[3]); - _subtitles.setLine(10); + _subtitles.setLine(11); idx = 34; do { @@ -481,8 +475,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { WAIT(3); } while (sound.isSoundPlaying() || _subtitles.active()); - // TODO: Subtitle stuff - _subtitles.setLine(0); + _subtitles.setLine(12); sound.playSound("dark3.voc"); const char *const VOC_NAMES2[2] = { "pharoh5a.voc", "pharoh5b.voc" }; @@ -494,13 +487,13 @@ bool DarkSideCutscenes::showDarkSideIntro2() { _subtitles.show(); WAIT(3); - if (!sound.isSoundPlaying() && vocIndex < 2) + if (!sound.isSoundPlaying() && vocIndex < 2) { + if (vocIndex) + _subtitles.setLine(13); sound.playSound(VOC_NAMES2[vocIndex++]); + } } while (vocIndex < 2 || sound.isSoundPlaying() || _subtitles.active()); - // TODO: Subtitle stuff - _subtitles.setLine(0); - sound.playFX(42); vocIndex = 0; @@ -548,14 +541,14 @@ bool DarkSideCutscenes::showDarkSideIntro2() { const char *const VOC_NAMES3[2] = { "alamar1.voc", "pharoh7t.voc" }; vocIndex = nwcIndex = 0; + _subtitles.setLine(14); do { ANIMATE_PHAROAH; goon.draw(0, (vocIndex == 0) ? 0 : nwcIndex, Common::Point(9, 57)); if (!sound.isSoundPlaying() && !vocIndex && !_subtitles.active()) { - // TODO: Subtitles stuff - _subtitles.setLine(0); + _subtitles.setLine(15); sound.playSound(VOC_NAMES3[vocIndex++]); sound.playFX(0); } @@ -565,8 +558,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { WAIT(3); } while (!vocIndex || sound.isSoundPlaying() || _subtitles.active()); - // TODO: Subtitle stuff - _subtitles.setLine(0); + _subtitles.setLine(16); sound.playFX(42); for (idx = 10, vocIndex = 0; idx >= 0; --idx) { @@ -589,8 +581,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { if (!rubCrystalBall()) return false; - // TODO: Subtitle stuff - _subtitles.setLine(0); + _subtitles.setLine(17); for (idx = 0, clawCtr = 0; idx < 11; ++idx) { ANIMATE_PHAROAH; @@ -615,13 +606,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { wizard.draw(0, (vocIndex == 1) ? getSpeakingFrame(0, 3) : 0, Common::Point(9, 57)); if (!sound.isSoundPlaying() && vocIndex < 2 && !_subtitles.active()) { - // TODO: Subtitle stuff - if (vocIndex == 0) { - _subtitles.setLine(0); - } else { - _subtitles.setLine(0); - } - + _subtitles.setLine((vocIndex == 0) ? 18 : 19); sound.playSound(VOC_NAMES4[vocIndex++]); sound.playFX(0); } @@ -647,8 +632,7 @@ bool DarkSideCutscenes::showDarkSideIntro2() { WAIT(3); } - // TODO: Subtitle stuff - _subtitles.setLine(0); + _subtitles.setLine(20); vocIndex = 0; do { @@ -670,7 +654,6 @@ bool DarkSideCutscenes::showDarkSideIntro2() { } bool DarkSideCutscenes::showDarkSideIntro3() { - EventsManager &events = *g_vm->_events; Screen &screen = *g_vm->_screen; Sound &sound = *g_vm->_sound; SpriteResource fly("fly.int"); @@ -685,8 +668,7 @@ bool DarkSideCutscenes::showDarkSideIntro3() { screen.loadBackground("fly.raw"); screen.saveBackground(); - // TODO: Subtitle stuff - _subtitles.setLine(0); + _subtitles.setLine(6); _subtitles.show(); screen.fadeIn(); @@ -794,7 +776,6 @@ bool DarkSideCutscenes::showDarkSideIntro3() { } bool DarkSideCutscenes::showWorldOfXeenLogo() { - EventsManager &events = *g_vm->_events; Screen &screen = *g_vm->_screen; Sound &sound = *g_vm->_sound; SpriteResource fizzle("fizzle.int"); @@ -1276,7 +1257,6 @@ bool DarkSideCutscenes::showDarkSideEnding2() { } bool DarkSideCutscenes::showDarkSideEnding3() { - EventsManager &events = *g_vm->_events; Screen &screen = *g_vm->_screen; Sound &sound = *g_vm->_sound; @@ -1583,7 +1563,7 @@ bool DarkSideCutscenes::showDarkSideEnding4() { WAIT(3); } } - _subtitles.wait(); + sc25.clear(); // I do. Kamakazi time @@ -1633,7 +1613,6 @@ bool DarkSideCutscenes::showDarkSideEnding4() { WAIT(3); } - _subtitles.wait(); sc27.clear(); // Vortex is opened and the two are sucked in, obliterating them diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.h b/engines/xeen/worldofxeen/darkside_cutscenes.h index e0bd5c00f8..1808562b11 100644 --- a/engines/xeen/worldofxeen/darkside_cutscenes.h +++ b/engines/xeen/worldofxeen/darkside_cutscenes.h @@ -24,7 +24,6 @@ #define XEEN_WORLDOFXEEN_DARKSIDE_CUTSCENES_H #include "xeen/cutscenes.h" -#include "xeen/subtitles.h" namespace Xeen { @@ -34,7 +33,6 @@ namespace WorldOfXeen { class DarkSideCutscenes : public Cutscenes { private: - Subtitles _subtitles; SpriteResource _ball, _claw, _dragon1; private: /** diff --git a/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp b/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp index 2ea5827315..13d59c43c9 100644 --- a/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp +++ b/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp @@ -439,7 +439,6 @@ bool WorldOfXeenCutscenes::worldEnding1() { } bool WorldOfXeenCutscenes::worldEnding2() { - EventsManager &events = *_vm->_events; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; Windows &windows = *_vm->_windows; @@ -590,7 +589,6 @@ bool WorldOfXeenCutscenes::worldEnding2() { } bool WorldOfXeenCutscenes::worldEnding3() { - EventsManager &events = *_vm->_events; Screen &screen = *_vm->_screen; Sound &sound = *_vm->_sound; Windows &windows = *_vm->_windows; |