aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-12 16:02:41 -0400
committerMatthew Hoops2011-05-12 16:02:41 -0400
commit85b2a0574c68b2d4b211b5739f251708b2cd5873 (patch)
treefa14a6c18365a57867a40d0a17fbb181ca219d5c
parent6b8a6f486cd1235009cfb354e407878d3b2b77e9 (diff)
downloadscummvm-rg350-85b2a0574c68b2d4b211b5739f251708b2cd5873.tar.gz
scummvm-rg350-85b2a0574c68b2d4b211b5739f251708b2cd5873.tar.bz2
scummvm-rg350-85b2a0574c68b2d4b211b5739f251708b2cd5873.zip
PEGASUS: Add basic credits implementation
-rw-r--r--engines/pegasus/credits.cpp174
-rw-r--r--engines/pegasus/menu.cpp8
-rw-r--r--engines/pegasus/module.mk1
-rw-r--r--engines/pegasus/pegasus.h5
4 files changed, 186 insertions, 2 deletions
diff --git a/engines/pegasus/credits.cpp b/engines/pegasus/credits.cpp
new file mode 100644
index 0000000000..3c625faf32
--- /dev/null
+++ b/engines/pegasus/credits.cpp
@@ -0,0 +1,174 @@
+/* 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 "common/events.h"
+#include "common/textconsole.h"
+#include "video/qt_decoder.h"
+
+#include "pegasus/pegasus.h"
+
+namespace Pegasus {
+
+enum {
+ kCreditsCore = 0,
+ kCreditsSupport,
+ kCreditsOriginal,
+ kCreditsTalent,
+ kCreditsOther,
+ kCreditsMainMenu
+};
+
+static const int s_startCreditsSegment[] = { 0, 16, 25, 37, 39 };
+
+static int findButtonForFrame(int frame) {
+ int button = kCreditsCore;
+ for (int i = kCreditsCore; i < kCreditsMainMenu; i++)
+ if (frame >= s_startCreditsSegment[i])
+ button = i;
+
+ return button;
+}
+
+void PegasusEngine::runCredits() {
+ Video::QuickTimeDecoder *creditsVideo = new Video::QuickTimeDecoder();
+ if (!creditsVideo->loadFile("Images/Credits/Credits.movie"))
+ error("Could not open credits movie");
+
+ // We're not playing, just retrieving frames
+ creditsVideo->pauseVideo(true);
+
+ int curButton = kCreditsCore;
+ int frame = 0;
+
+ drawCredits(curButton, false, frame, creditsVideo);
+ _system->updateScreen();
+
+ bool continueLooping = true;
+ while (!shouldQuit() && continueLooping) {
+ Common::Event event;
+ while (_eventMan->pollEvent(event)) {
+ bool needsUpdate = false;
+
+ switch (event.type) {
+ case Common::EVENT_KEYDOWN:
+ switch (event.kbd.keycode) {
+ case Common::KEYCODE_UP:
+ if (curButton != kCreditsCore)
+ curButton--;
+ frame = s_startCreditsSegment[curButton];
+ needsUpdate = true;
+ break;
+ case Common::KEYCODE_DOWN:
+ if (curButton != kCreditsMainMenu) {
+ curButton++;
+ if (curButton == kCreditsMainMenu)
+ frame = 43;
+ else
+ frame = s_startCreditsSegment[curButton];
+ needsUpdate = true;
+ }
+ break;
+ case Common::KEYCODE_LEFT:
+ if (frame > 0) {
+ frame--;
+ curButton = findButtonForFrame(frame);
+ needsUpdate = true;
+ }
+ break;
+ case Common::KEYCODE_RIGHT:
+ if (frame < 43) {
+ frame++;
+ curButton = findButtonForFrame(frame);
+ needsUpdate = true;
+ }
+ break;
+ case Common::KEYCODE_RETURN:
+ drawCredits(curButton, true, frame, creditsVideo);
+ _system->updateScreen();
+ continueLooping = (curButton != kCreditsMainMenu);
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (needsUpdate) {
+ drawCredits(curButton, false, frame, creditsVideo);
+ _system->updateScreen();
+ }
+ }
+
+ _system->delayMillis(10);
+ }
+
+ delete creditsVideo;
+}
+
+void PegasusEngine::drawCredits(int button, bool highlight, int frame, Video::QuickTimeDecoder *video) {
+ static const int s_creditsButtonY[] = { 224, 260, 296, 332, 366, 407 };
+
+ _gfx->drawPict("Images/Credits/CredScrn.pict", 0, 0, false);
+
+ if (highlight)
+ _gfx->drawPict("Images/Credits/MainMenu.pict", 32, 412, false);
+
+ if (button == kCreditsMainMenu)
+ _gfx->drawPictTransparent("Images/Credits/SelectL.pict", 30, s_creditsButtonY[button], _gfx->getColor(0xf8, 0xf8, 0xf8));
+ else
+ _gfx->drawPictTransparent("Images/Credits/SelectS.pict", 40, s_creditsButtonY[button], _gfx->getColor(0xf8, 0xf8, 0xf8));
+
+ video->seekToTime(frame * 200);
+ _video->copyFrameToScreen(video->decodeNextFrame(), video->getWidth(), video->getHeight(), 288, 0);
+}
+
+void PegasusEngine::runDemoCredits() {
+ _gfx->drawPict("Images/Demo/DemoCredits.pict", 0, 0, true);
+
+ bool continueLooping = true;
+ while (!shouldQuit() && continueLooping) {
+ Common::Event event;
+ while (_eventMan->pollEvent(event)) {
+ switch (event.type) {
+ case Common::EVENT_MOUSEMOVE:
+ _system->updateScreen();
+ break;
+ case Common::EVENT_KEYDOWN:
+ // Break on any keypress, but ignore the meta keys
+ // Except for num lock! num lock on OS9 is 'clear' and we need that for the inventory panel (along with the tilde)
+ continueLooping = (event.kbd.keycode == Common::KEYCODE_INVALID || (event.kbd.keycode >= Common::KEYCODE_CAPSLOCK && event.kbd.keycode <= Common::KEYCODE_COMPOSE));
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ continueLooping = false;
+ break;
+ default:
+ break;
+ }
+ }
+
+ _system->delayMillis(10);
+ }
+}
+
+} // End of namespace Pegasus
diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp
index 0febdd6fb0..98cf59af8f 100644
--- a/engines/pegasus/menu.cpp
+++ b/engines/pegasus/menu.cpp
@@ -166,7 +166,9 @@ void PegasusEngine::setGameMode(int buttonSelected) {
_gameMode = kMainGameMode;
break;
case kDemoCreditsButton:
- warning("No credits just yet");
+ _sound->stopSound();
+ runDemoCredits();
+ _sound->playSound("Sounds/Main Menu.aiff", true);
break;
case kDemoQuitButton:
_gameMode = kQuitMode;
@@ -186,7 +188,9 @@ void PegasusEngine::setGameMode(int buttonSelected) {
showLoadDialog();
break;
case kCreditsButton:
- warning("No credits just yet");
+ _sound->stopSound();
+ runCredits();
+ _sound->playSound("Sounds/Main Menu.aiff", true);
break;
case kQuitButton:
_gameMode = kQuitMode;
diff --git a/engines/pegasus/module.mk b/engines/pegasus/module.mk
index 5222c81be0..507c6b19ab 100644
--- a/engines/pegasus/module.mk
+++ b/engines/pegasus/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/pegasus
MODULE_OBJS = \
+ credits.o \
detection.o \
graphics.o \
menu.o \
diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h
index bb69429a59..ad069eb802 100644
--- a/engines/pegasus/pegasus.h
+++ b/engines/pegasus/pegasus.h
@@ -228,6 +228,11 @@ private:
void runInterfaceOverview();
void drawInterfaceOverview(const OverviewHotspot &hotspot, Video::QuickTimeDecoder *video);
+ // Credits
+ void runCredits();
+ void drawCredits(int button, bool highlight, int frame, Video::QuickTimeDecoder *video);
+ void runDemoCredits();
+
// Main Game Functions
void mainGameLoop();
void loadItemLocationData();