aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen
diff options
context:
space:
mode:
authorPaul Gilbert2018-03-06 18:58:31 -0500
committerPaul Gilbert2018-03-06 18:58:31 -0500
commit1d86a6a604201e23d306e7512c7b56cc36cd28c3 (patch)
tree1cdbd763e17ea5c4b658a0a035485ea3ccbbd0fe /engines/xeen
parent2a0bdd7df8a60c59d96f077d50567460cbf8e814 (diff)
downloadscummvm-rg350-1d86a6a604201e23d306e7512c7b56cc36cd28c3.tar.gz
scummvm-rg350-1d86a6a604201e23d306e7512c7b56cc36cd28c3.tar.bz2
scummvm-rg350-1d86a6a604201e23d306e7512c7b56cc36cd28c3.zip
XEEN: Simplify exit checks in World of Xeen ending
Diffstat (limited to 'engines/xeen')
-rw-r--r--engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp183
-rw-r--r--engines/xeen/worldofxeen/worldofxeen_cutscenes.h8
2 files changed, 89 insertions, 102 deletions
diff --git a/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp b/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp
index 07fde8f017..15083e563f 100644
--- a/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/worldofxeen_cutscenes.cpp
@@ -31,16 +31,16 @@ void WorldOfXeenCutscenes::showWorldOfXeenEnding(GooberState state, uint score)
_goober = state;
_finalScore = score;
- worldEnding1();
- if (!_vm->shouldExit())
- worldEnding2();
- if (!_vm->shouldExit())
- worldEnding3();
- if (!_vm->shouldExit())
- worldEnding4();
+ if (worldEnding1())
+ if (worldEnding2())
+ if (worldEnding3())
+ worldEnding4();
+
+ g_vm->_sound->stopAllAudio();
+ g_vm->_screen->fadeOut();
}
-void WorldOfXeenCutscenes::worldEnding1() {
+bool WorldOfXeenCutscenes::worldEnding1() {
EventsManager &events = *_vm->_events;
FileManager &files = *_vm->_files;
Screen &screen = *_vm->_screen;
@@ -51,7 +51,8 @@ void WorldOfXeenCutscenes::worldEnding1() {
files.setGameCc(0);
sound.playSong("outday3.m");
- showPharaohEndText(Res.WORLD_END_TEXT[0]);
+ if (!showPharaohEndText(Res.WORLD_END_TEXT[0]))
+ return false;
sound.playSound("elect.voc", 1, 0);
screen.loadBackground("skymain.raw");
@@ -88,9 +89,9 @@ void WorldOfXeenCutscenes::worldEnding1() {
screen.fadeIn();
events.updateGameCounter();
- events.wait(60);
+ WAIT(60);
- for (int idx = 0; idx < 50 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 50; ++idx) {
if (idx == 9 || idx == 22 || idx == 33 || idx == 44)
sound.playSound("whoosh.voc");
@@ -100,21 +101,21 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[1]);
w0.update();
- events.wait(2);
+ WAIT(2);
}
- for (int idx = 0; idx < 40 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 40; ++idx) {
screen.horizMerge();
events.updateGameCounter();
tower1.draw(0, 0, Common::Point(0, 0), SPRFLAG_800);
sc3a.draw(0, idx, Common::Point(91, 86), SPRFLAG_800);
w0.update();
- events.wait(2);
+ WAIT(2);
}
int frame = 40, frame2 = 0;
- for (int idx = 0, xp = 0; idx < SCREEN_WIDTH && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0, xp = 0; idx < SCREEN_WIDTH; ++idx) {
events.updateGameCounter();
screen.horizMerge(xp);
tower1.draw(0, 0, Common::Point(idx, 0), SPRFLAG_800);
@@ -133,10 +134,10 @@ void WorldOfXeenCutscenes::worldEnding1() {
if (idx > 120)
setSubtitle(Res.WORLD_END_TEXT[2]);
w0.update();
- events.wait(2);
+ WAIT(2);
}
- for (; frame2 < 60 && !_vm->shouldExit(); ++frame2) {
+ for (; frame2 < 60; ++frame2) {
events.updateGameCounter();
screen.horizMerge(frame);
tower2.draw(0, 0, Common::Point(0, 0), SPRFLAG_800);
@@ -145,11 +146,9 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[2]);
w0.update();
- events.wait(2);
+ WAIT(2);
}
- if (_vm->shouldExit())
- return;
screen.freePages();
screen.fadeOut();
screen.loadBackground("foura.raw");
@@ -159,15 +158,13 @@ void WorldOfXeenCutscenes::worldEnding1() {
w0.update();
screen.fadeIn();
- for (int idx = 0; idx < 26 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 26; ++idx) {
events.updateGameCounter();
screen.blitFrom(savedBg);
sc06.draw(0, idx, Common::Point(26, 75));
- events.wait(2);
+ WAIT(2);
}
- if (_vm->shouldExit())
- return;
screen.fadeOut();
screen.loadBackground("eg140001.raw");
savedBg.blitFrom(screen);
@@ -175,15 +172,15 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[3]);
screen.fadeIn();
- for (int idx1 = 0; idx1 < 2 && !_vm->shouldExit(); ++idx1) {
- for (int idx2 = 0; idx2 < 15 && !_vm->shouldExit(); ++idx2) {
+ for (int idx1 = 0; idx1 < 2; ++idx1) {
+ for (int idx2 = 0; idx2 < 15; ++idx2) {
events.updateGameCounter();
screen.blitFrom(savedBg);
sc14.draw(0, idx2, Common::Point(141, 63));
setSubtitle(Res.WORLD_END_TEXT[3]);
w0.update();
- events.wait(2);
+ WAIT(2);
}
}
@@ -191,15 +188,15 @@ void WorldOfXeenCutscenes::worldEnding1() {
screen.loadPage(0);
savedBg.blitFrom(screen);
- for (int idx1 = 0; idx1 < 2 && !_vm->shouldExit(); ++idx1) {
- for (int idx2 = 0; idx2 < 6 && !_vm->shouldExit(); ++idx2) {
+ for (int idx1 = 0; idx1 < 2; ++idx1) {
+ for (int idx2 = 0; idx2 < 6; ++idx2) {
events.updateGameCounter();
screen.blitFrom(savedBg);
sc14.draw(0, idx2, Common::Point(26, 21));
setSubtitle(Res.WORLD_END_TEXT[4]);
w0.update();
- events.wait(2);
+ WAIT(2);
}
}
@@ -210,7 +207,7 @@ void WorldOfXeenCutscenes::worldEnding1() {
w0.update();
frame = 0;
- for (int idx = 185; idx > 68 && !_vm->shouldExit(); idx -= 3) {
+ for (int idx = 185; idx > 68; idx -= 3) {
if (!sound.isSoundPlaying())
sound.playSound("cast.voc");
@@ -221,11 +218,11 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[4]);
w0.update();
- events.wait(2);
+ WAIT(2);
frame = (frame + 1) % 17;
}
- for (int idx = 0; idx < 17 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 17; ++idx) {
if (!sound.isSoundPlaying())
sound.playSound("cast.voc");
@@ -236,11 +233,9 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[4]);
w0.update();
- events.wait(2);
+ WAIT(2);
}
- if (_vm->shouldExit())
- return;
screen.blitFrom(savedBg);
sc17.draw(0, 0, Common::Point(33, 68), SPRFLAG_4000);
setSubtitle(Res.WORLD_END_TEXT[4]);
@@ -252,29 +247,29 @@ void WorldOfXeenCutscenes::worldEnding1() {
w0.update();
screen.fadeIn();
- for (int idx1 = 0; idx1 < 2 && !_vm->shouldExit(); ++idx1) {
- for (int idx2 = 0; idx2 < 15 && !_vm->shouldExit(); ++idx2) {
+ for (int idx1 = 0; idx1 < 2; ++idx1) {
+ for (int idx2 = 0; idx2 < 15; ++idx2) {
events.updateGameCounter();
screen.blitFrom(savedBg);
sc14.draw(0, idx2, Common::Point(141, 63));
w0.update();
- events.wait(3);
+ WAIT(3);
}
}
screen.horizMerge(0);
savedBg.blitFrom(screen);
- for (int idx1 = 0; idx1 < 3 && !_vm->shouldExit(); ++idx1) {
- for (int idx2 = 0; idx2 < 15 && !_vm->shouldExit(); ++idx2) {
+ for (int idx1 = 0; idx1 < 3; ++idx1) {
+ for (int idx2 = 0; idx2 < 15; ++idx2) {
events.updateGameCounter();
screen.blitFrom(savedBg);
sc10.draw(0, idx2, Common::Point(26, 21));
setSubtitle(Res.WORLD_END_TEXT[5]);
w0.update();
- events.wait(3);
+ WAIT(3);
}
}
@@ -282,20 +277,18 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[5]);
w0.update();
- for (int idx = 185; idx > 13 && !_vm->shouldExit(); idx -= 6) {
+ for (int idx = 185; idx > 13; idx -= 6) {
events.updateGameCounter();
screen.blitFrom(savedBg);
staff.draw(0, 0, Common::Point(196, idx), SPRFLAG_4000);
setSubtitle(Res.WORLD_END_TEXT[5]);
w0.update();
- events.wait(2);
+ WAIT(2);
}
events.updateGameCounter();
- events.wait(30);
- if (_vm->shouldExit())
- return;
+ WAIT(30);
screen.fadeOut();
screen.loadBackground("eg140001.raw");
@@ -303,19 +296,17 @@ void WorldOfXeenCutscenes::worldEnding1() {
w0.update();
screen.fadeIn();
- for (int idx1 = 0; idx1 < 2 && !_vm->shouldExit(); ++idx1) {
- for (int idx2 = 0; idx2 < 15 && !_vm->shouldExit(); ++idx2) {
+ for (int idx1 = 0; idx1 < 2; ++idx1) {
+ for (int idx2 = 0; idx2 < 15; ++idx2) {
events.updateGameCounter();
screen.blitFrom(savedBg);
sc14.draw(0, idx2, Common::Point(141, 63));
w0.update();
- events.wait(3);
+ WAIT(3);
}
}
- if (_vm->shouldExit())
- return;
screen.loadBackground("tablmain.raw");
savedBg.blitFrom(screen);
screen.loadPage(1);
@@ -325,7 +316,7 @@ void WorldOfXeenCutscenes::worldEnding1() {
w0.update();
sound.playSound("cast.voc");
- for (int idx = 0; idx < 5 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 5; ++idx) {
if (!sound.isSoundPlaying())
sound.playSound("cast.voc");
@@ -337,11 +328,11 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[6]);
w0.update();
- events.wait(2);
+ WAIT(2);
}
frame = 0;
- for (int idx = 0; idx < 16 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 16; ++idx) {
if (!sound.isSoundPlaying())
sound.playSound("cast.voc");
@@ -353,12 +344,12 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[6]);
w0.update();
- events.wait(2);
+ WAIT(2);
frame = (frame + 1) % 5;
}
frame = 0;
- for (int idx = 11; idx < 82 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 11; idx < 82; ++idx) {
if (!sound.isSoundPlaying())
sound.playSound("cast.voc");
@@ -369,18 +360,16 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[6]);
w0.update();
- events.wait(2);
+ WAIT(2);
frame = (frame + 1) % 5;
}
sound.stopSound();
- if (_vm->shouldExit())
- return;
sound.playSound("click.voc");
sound.playSound("padspell.voc");
- for (int idx = 0; idx < 14 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 14; ++idx) {
if (idx == 10)
sound.playSound("padspell.voc");
@@ -390,10 +379,10 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[6]);
w0.update();
- events.wait(2);
+ WAIT(2);
}
- for (int idx = 0; idx < 17 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 17; ++idx) {
if (idx == 10)
sound.playSound("padspell.voc");
@@ -403,32 +392,30 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[6]);
w0.update();
- events.wait(3);
+ WAIT(3);
}
- for (int idx = 0; idx < 6 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 6; ++idx) {
events.updateGameCounter();
screen.blitFrom(savedBg);
sc20[3].draw(0, idx, Common::Point(26, 55));
setSubtitle(Res.WORLD_END_TEXT[6]);
w0.update();
- events.wait(4);
+ WAIT(4);
}
- if (_vm->shouldExit())
- return;
screen.blitFrom(savedBg);
setSubtitle(Res.WORLD_END_TEXT[6]);
w0.update();
events.updateGameCounter();
- events.wait(30);
+ WAIT(30);
screen.horizMerge(SCREEN_WIDTH);
savedBg.blitFrom(screen);
screen.freePages();
- for (int idx = 0; idx < 35 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 35; ++idx) {
if (idx == 3)
sound.playSound("click.voc");
else if (idx == 5 || idx == 15)
@@ -442,11 +429,13 @@ void WorldOfXeenCutscenes::worldEnding1() {
setSubtitle(Res.WORLD_END_TEXT[7]);
w0.update();
- events.wait(3);
+ WAIT(3);
}
+
+ return true;
}
-void WorldOfXeenCutscenes::worldEnding2() {
+bool WorldOfXeenCutscenes::worldEnding2() {
EventsManager &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
@@ -470,18 +459,20 @@ void WorldOfXeenCutscenes::worldEnding2() {
screen.fadeIn();
int frame = 0;
- for (int idx = 0; idx < 61 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 61; ++idx) {
if (idx == 2 || idx == 15 || idx == 25 || idx == 33 || idx == 41)
sound.playSound("gascompr.voc");
events.updateGameCounter();
sc23[idx / 8].draw(0, frame % 8);
w0.update();
- events.wait(4);
+ WAIT(4);
}
+
+ return true;
}
-void WorldOfXeenCutscenes::worldEnding3() {
+bool WorldOfXeenCutscenes::worldEnding3() {
EventsManager &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
@@ -502,7 +493,7 @@ void WorldOfXeenCutscenes::worldEnding3() {
screen.fadeIn();
sound.playSound("comet.voc");
- for (int idx = 0; idx < 52 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 52; ++idx) {
if (idx == 28)
sound.playSound("click.voc");
if (!sound.isSoundPlaying())
@@ -511,7 +502,7 @@ void WorldOfXeenCutscenes::worldEnding3() {
events.updateGameCounter();
sc25.draw(0, idx);
w0.update();
- events.wait(2);
+ WAIT(2);
}
sound.stopSound();
@@ -525,7 +516,7 @@ void WorldOfXeenCutscenes::worldEnding3() {
screen.fadeIn(0x81);
int frame1 = 0, frame2 = 0, frame3 = 0, ctr = 0;
- for (int idx = 0; idx < 78 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 78; ++idx) {
events.updateGameCounter();
sc261[ctr / 14].draw(0, idx % 17, Common::Point(7, 4));
sc262.draw(0, frame1, Common::Point(86, 4));
@@ -558,11 +549,13 @@ void WorldOfXeenCutscenes::worldEnding3() {
frame3 = 5;
w0.update();
- events.wait(2);
+ WAIT(2);
}
+
+ return true;
}
-void WorldOfXeenCutscenes::worldEnding4() {
+bool WorldOfXeenCutscenes::worldEnding4() {
EventsManager &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Sound &sound = *_vm->_sound;
@@ -586,7 +579,7 @@ void WorldOfXeenCutscenes::worldEnding4() {
screen.loadPalette("eg250001.pal");
screen.fadeIn();
- for (int idx = 0; idx < 89 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 89; ++idx) {
if (!sound.isSoundPlaying())
sound.playSound("comet.voc");
if (idx == 19 || idx == 60)
@@ -595,11 +588,9 @@ void WorldOfXeenCutscenes::worldEnding4() {
events.updateGameCounter();
sc27.draw(0, idx);
w0.update();
- events.wait(2);
+ WAIT(2);
}
- if (_vm->shouldExit())
- return;
sound.stopSound();
screen.fadeOut();
@@ -608,7 +599,7 @@ void WorldOfXeenCutscenes::worldEnding4() {
w0.update();
screen.fadeIn();
- for (int idx = 0; idx < 138 && !_vm->shouldExit(); ++idx) {
+ for (int idx = 0; idx < 138; ++idx) {
if (!sound.isSoundPlaying() && idx > 98)
sound.playSound("rumble.voc");
@@ -616,26 +607,22 @@ void WorldOfXeenCutscenes::worldEnding4() {
sc28[idx / 10].draw(0, idx % 10, Common::Point(52, 15));
w0.update();
- events.wait(2);
+ WAIT(2);
}
sound.stopSound();
- if (_vm->shouldExit())
- return;
screen.loadPalette("white.pal");
screen.fadeIn();
sound.playSound("explosio.voc");
events.updateGameCounter();
- events.wait(10);
- if (_vm->shouldExit())
- return;
+ WAIT(10);
screen.loadPalette("eg250001.pal");
screen.fadeOut();
- for (int idx1 = 0; idx1 < 20 && !_vm->shouldExit(); ++idx1) {
- for (int idx2 = 0; idx2 < 4 && !_vm->shouldExit(); ++idx2) {
+ for (int idx1 = 0; idx1 < 20; ++idx1) {
+ for (int idx2 = 0; idx2 < 4; ++idx2) {
sc30.draw(0, idx2);
setSubtitle2(Res.WORLD_END_TEXT[8]);
w0.update();
@@ -643,17 +630,15 @@ void WorldOfXeenCutscenes::worldEnding4() {
if (!idx1 && !idx2)
screen.fadeIn();
//if (idx1 == 17) ??MUSIC
- events.wait(2);
+ WAIT(2);
}
}
screen.fadeOut();
- while (sound.isMusicPlaying() && !_vm->shouldExit()) {
+ while (sound.isMusicPlaying()) {
events.updateGameCounter();
- events.wait(2);
+ WAIT(2);
}
- if (_vm->shouldExit())
- return;
sound.playSong("outday3.m");
@@ -663,6 +648,8 @@ void WorldOfXeenCutscenes::worldEnding4() {
_goober == NON_GOOBER ? nullptr :
Common::String::format(Res.WORLD_CONGRATULATIONS2, gooberStr.c_str()).c_str()
);
+
+ return true;
}
void WorldOfXeenCutscenes::setSubtitle(const Common::String &msg) {
diff --git a/engines/xeen/worldofxeen/worldofxeen_cutscenes.h b/engines/xeen/worldofxeen/worldofxeen_cutscenes.h
index 6fee060c3d..0ffa136e50 100644
--- a/engines/xeen/worldofxeen/worldofxeen_cutscenes.h
+++ b/engines/xeen/worldofxeen/worldofxeen_cutscenes.h
@@ -54,22 +54,22 @@ private:
/**
* Part 1 of World of Xeen ending
*/
- void worldEnding1();
+ bool worldEnding1();
/**
* Part 2 of World of Xeen ending
*/
- void worldEnding2();
+ bool worldEnding2();
/**
* Part 3 of World of Xeen ending
*/
- void worldEnding3();
+ bool worldEnding3();
/**
* Part 4 of World of Xeen ending
*/
- void worldEnding4();
+ bool worldEnding4();
public:
WorldOfXeenCutscenes(XeenEngine *vm) : _vm(vm), CloudsCutscenes(vm),
DarkSideCutscenes(vm), _goober(NON_GOOBER), _finalScore(0) {}