aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2012-07-08 20:11:06 +0200
committerSven Hesse2012-07-30 01:44:46 +0200
commit850472f21e73280c0bf35c76163419a7e280fea2 (patch)
tree8fb532cd8245ac96373abb7baeb2475e48f86925 /engines/gob
parentf4cd726802732f7f0990eb213c2c9d16da217eec (diff)
downloadscummvm-rg350-850472f21e73280c0bf35c76163419a7e280fea2.tar.gz
scummvm-rg350-850472f21e73280c0bf35c76163419a7e280fea2.tar.bz2
scummvm-rg350-850472f21e73280c0bf35c76163419a7e280fea2.zip
GOB: Implement the proper Once Upon A Time title sequence
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/module.mk1
-rw-r--r--engines/gob/pregob/onceupon/onceupon.cpp88
-rw-r--r--engines/gob/pregob/onceupon/onceupon.h10
-rw-r--r--engines/gob/pregob/onceupon/title.cpp117
-rw-r--r--engines/gob/pregob/onceupon/title.h55
5 files changed, 177 insertions, 94 deletions
diff --git a/engines/gob/module.mk b/engines/gob/module.mk
index 04e55dcf16..489afe509e 100644
--- a/engines/gob/module.mk
+++ b/engines/gob/module.mk
@@ -85,6 +85,7 @@ MODULE_OBJS := \
pregob/onceupon/onceupon.o \
pregob/onceupon/abracadabra.o \
pregob/onceupon/babayaga.o \
+ pregob/onceupon/title.o \
pregob/onceupon/stork.o \
pregob/onceupon/chargenchild.o \
minigames/geisha/evilfish.o \
diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp
index 7f59790d1d..6ee391ea7f 100644
--- a/engines/gob/pregob/onceupon/onceupon.cpp
+++ b/engines/gob/pregob/onceupon/onceupon.cpp
@@ -37,6 +37,7 @@
#include "gob/pregob/onceupon/onceupon.h"
#include "gob/pregob/onceupon/palettes.h"
+#include "gob/pregob/onceupon/title.h"
#include "gob/pregob/onceupon/chargenchild.h"
static const uint kLanguageCount = 5;
@@ -657,94 +658,11 @@ const PreGob::AnimProperties OnceUpon::kTitleAnimation = {
};
void OnceUpon::showTitle() {
- // Show the Once Upon A Time title animation
- // NOTE: This is currently only a mock-up. The real animation is in "ville.seq".
-
fadeOut();
setGamePalette(10);
- warning("OnceUpon::showTitle(): Actually play the SEQ");
-
- clearScreen();
-
- _vm->_video->drawPackedSprite("ville.cmp", *_vm->_draw->_backSurface);
- _vm->_draw->forceBlit();
-
- ANIFile ani (_vm, "pres.ani", 320);
- ANIList anims;
-
- loadAnims(anims, ani, 1, &kTitleAnimation);
-
- playTitleMusic();
-
- while (!_vm->shouldQuit()) {
- redrawAnim(anims);
-
- fadeIn();
-
- endFrame(true);
-
- if (hasInput())
- break;
- }
-
- freeAnims(anims);
-
- fadeOut();
- stopTitleMusic();
-}
-
-void OnceUpon::playTitleMusic() {
- // Look at what platform this is and play the appropriate music type
-
- if (_vm->getPlatform() == Common::kPlatformPC)
- playTitleMusicDOS();
- else if (_vm->getPlatform() == Common::kPlatformAmiga)
- playTitleMusicAmiga();
- else if (_vm->getPlatform() == Common::kPlatformAtariST)
- playTitleMusicAtariST();
-}
-
-void OnceUpon::playTitleMusicDOS() {
- // Play an AdLib track
-
- _vm->_sound->adlibLoadTBR("babayaga.tbr");
- _vm->_sound->adlibLoadMDY("babayaga.mdy");
- _vm->_sound->adlibSetRepeating(-1);
- _vm->_sound->adlibPlay();
-}
-
-void OnceUpon::playTitleMusicAmiga() {
- // Play a Protracker track
-
- _vm->_sound->protrackerPlay("mod.babayaga");
-}
-
-void OnceUpon::playTitleMusicAtariST() {
- // Play a Soundblaster composition
-
- static const int16 titleMusic[21] = { 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, -1};
- static const char * const titleFiles[ 3] = {"baba1.snd", "baba2.snd", "baba3.snd"};
-
- for (uint i = 0; i < ARRAYSIZE(titleFiles); i++)
- _vm->_sound->sampleLoad(_vm->_sound->sampleGetBySlot(i), SOUND_SND, titleFiles[i]);
-
- _vm->_sound->blasterPlayComposition(titleMusic, 0);
- _vm->_sound->blasterRepeatComposition(-1);
-}
-
-void OnceUpon::stopTitleMusic() {
- // Just stop everything
-
- _vm->_sound->adlibSetRepeating(0);
- _vm->_sound->blasterRepeatComposition(0);
-
- _vm->_sound->adlibStop();
- _vm->_sound->blasterStopComposition();
- _vm->_sound->protrackerStop();
-
- for (int i = 0; i < ::Gob::Sound::kSoundsCount; i++)
- _vm->_sound->sampleFree(_vm->_sound->sampleGetBySlot(i));
+ Title title(_vm);
+ title.play();
}
void OnceUpon::showChapter(int chapter) {
diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h
index 2f25060a37..41a2f5668d 100644
--- a/engines/gob/pregob/onceupon/onceupon.h
+++ b/engines/gob/pregob/onceupon/onceupon.h
@@ -237,15 +237,6 @@ private:
void handleAnimalNames(uint count, const MenuButton *buttons, const char * const *names);
- // -- Title music helpers --
-
- void playTitleMusic(); ///< Play the title music.
- void playTitleMusicDOS(); ///< Play the title music of the DOS version.
- void playTitleMusicAmiga(); ///< Play the title music of the Amiga version.
- void playTitleMusicAtariST(); ///< Play the title music of the Atari ST version.
- void stopTitleMusic(); ///< Stop the title music.
-
-
// -- Menu helpers --
MenuAction handleStartMenu(const MenuButton *animalsButton); ///< Handle the start menu.
@@ -291,6 +282,7 @@ private:
/** Play / Display the name of an animal in one language. */
void anPlayAnimalName(const Common::String &animal, uint language);
+
// -- Game sections --
bool playSection();
diff --git a/engines/gob/pregob/onceupon/title.cpp b/engines/gob/pregob/onceupon/title.cpp
new file mode 100644
index 0000000000..5163ff6822
--- /dev/null
+++ b/engines/gob/pregob/onceupon/title.cpp
@@ -0,0 +1,117 @@
+/* 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 "gob/gob.h"
+#include "gob/global.h"
+#include "gob/palanim.h"
+#include "gob/draw.h"
+
+#include "gob/sound/sound.h"
+
+#include "gob/pregob/onceupon/title.h"
+
+namespace Gob {
+
+namespace OnceUpon {
+
+Title::Title(GobEngine *vm) : SEQFile(vm, "ville.seq") {
+}
+
+Title::~Title() {
+}
+
+void Title::play() {
+ SEQFile::play(true, 0xFFFF, 15);
+
+ // After playback, fade out and stop the music
+ if (!_vm->shouldQuit())
+ _vm->_palAnim->fade(0, 0, 0);
+
+ stopMusic();
+}
+
+void Title::handleFrameEvent() {
+ // On fame 0, start the music and fade in
+ if (getFrame() == 0) {
+ playMusic();
+
+ _vm->_draw->forceBlit();
+ _vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
+ }
+}
+
+void Title::playMusic() {
+ // Look at what platform this is and play the appropriate music type
+
+ if (_vm->getPlatform() == Common::kPlatformPC)
+ playMusicDOS();
+ else if (_vm->getPlatform() == Common::kPlatformAmiga)
+ playMusicAmiga();
+ else if (_vm->getPlatform() == Common::kPlatformAtariST)
+ playMusicAtariST();
+}
+
+void Title::playMusicDOS() {
+ // Play an AdLib track
+
+ _vm->_sound->adlibLoadTBR("babayaga.tbr");
+ _vm->_sound->adlibLoadMDY("babayaga.mdy");
+ _vm->_sound->adlibSetRepeating(-1);
+ _vm->_sound->adlibPlay();
+}
+
+void Title::playMusicAmiga() {
+ // Play a Protracker track
+
+ _vm->_sound->protrackerPlay("mod.babayaga");
+}
+
+void Title::playMusicAtariST() {
+ // Play a Soundblaster composition
+
+ static const int16 titleMusic[21] = { 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0, 0, -1};
+ static const char * const titleFiles[ 3] = {"baba1.snd", "baba2.snd", "baba3.snd"};
+
+ for (uint i = 0; i < ARRAYSIZE(titleFiles); i++)
+ _vm->_sound->sampleLoad(_vm->_sound->sampleGetBySlot(i), SOUND_SND, titleFiles[i]);
+
+ _vm->_sound->blasterPlayComposition(titleMusic, 0);
+ _vm->_sound->blasterRepeatComposition(-1);
+}
+
+void Title::stopMusic() {
+ // Just stop everything
+
+ _vm->_sound->adlibSetRepeating(0);
+ _vm->_sound->blasterRepeatComposition(0);
+
+ _vm->_sound->adlibStop();
+ _vm->_sound->blasterStopComposition();
+ _vm->_sound->protrackerStop();
+
+ for (int i = 0; i < ::Gob::Sound::kSoundsCount; i++)
+ _vm->_sound->sampleFree(_vm->_sound->sampleGetBySlot(i));
+}
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
diff --git a/engines/gob/pregob/onceupon/title.h b/engines/gob/pregob/onceupon/title.h
new file mode 100644
index 0000000000..5e7ef76d40
--- /dev/null
+++ b/engines/gob/pregob/onceupon/title.h
@@ -0,0 +1,55 @@
+/* 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 GOB_PREGOB_ONCEUPON_TITLE_H
+#define GOB_PREGOB_ONCEUPON_TITLE_H
+
+#include "gob/pregob/seqfile.h"
+
+namespace Gob {
+
+namespace OnceUpon {
+
+/** The Once Upon A Time title animation sequence. */
+class Title : public SEQFile {
+public:
+ Title(GobEngine *vm);
+ ~Title();
+
+ void play();
+
+protected:
+ void handleFrameEvent();
+
+private:
+ void playMusic(); ///< Play the title music.
+ void playMusicDOS(); ///< Play the title music of the DOS version.
+ void playMusicAmiga(); ///< Play the title music of the Amiga version.
+ void playMusicAtariST(); ///< Play the title music of the Atari ST version.
+ void stopMusic(); ///< Stop the title music.
+};
+
+} // End of namespace OnceUpon
+
+} // End of namespace Gob
+
+#endif // GOB_PREGOB_ONCEUPON_TITLE_H