aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/kyra_v2.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2007-04-15 13:44:49 +0000
committerJohannes Schickel2007-04-15 13:44:49 +0000
commit8c4e539a40f816400d89ba45e04f85869642318c (patch)
tree712d7366cc9e13060134df637dd32b66c1e04eba /engines/kyra/kyra_v2.cpp
parent1b71599d86b66b53e601ec7c5781c63d4d07d595 (diff)
downloadscummvm-rg350-8c4e539a40f816400d89ba45e04f85869642318c.tar.gz
scummvm-rg350-8c4e539a40f816400d89ba45e04f85869642318c.tar.bz2
scummvm-rg350-8c4e539a40f816400d89ba45e04f85869642318c.zip
Readded lost files.
svn-id: r26496
Diffstat (limited to 'engines/kyra/kyra_v2.cpp')
-rw-r--r--engines/kyra/kyra_v2.cpp129
1 files changed, 129 insertions, 0 deletions
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
new file mode 100644
index 0000000000..9593817013
--- /dev/null
+++ b/engines/kyra/kyra_v2.cpp
@@ -0,0 +1,129 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2006 The ScummVM project
+ *
+ * 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.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "kyra/kyra.h"
+#include "kyra/kyra_v2.h"
+#include "kyra/screen.h"
+#include "kyra/resource.h"
+#include "kyra/wsamovie.h"
+#include "kyra/sound.h"
+
+#include "common/system.h"
+
+namespace Kyra {
+
+KyraEngine_v2::KyraEngine_v2(OSystem *system, const GameFlags &flags) : KyraEngine(system, flags) {
+ memset(_gameShapes, 0, sizeof(_gameShapes));
+ _mouseSHPBuf = 0;
+}
+
+KyraEngine_v2::~KyraEngine_v2() {
+ delete [] _mouseSHPBuf;
+}
+
+int KyraEngine_v2::init() {
+ KyraEngine::init();
+
+ if (_res->getFileSize("6.FNT")) {
+ _screen->loadFont(Screen::FID_6_FNT, "6.FNT");
+ }
+ if (_res->getFileSize("8FAT.FNT")) {
+ _screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT");
+ }
+ _screen->loadFont(Screen::FID_GOLDFONT_FNT, "GOLDFONT.FNT");
+ _screen->setAnimBlockPtr(3500);
+ _screen->setScreenDim(0);
+
+ assert(_introStringsSize == 21);
+ for (int i = 0; i < 21; i++) {
+ _introStringsDuration[i] = strlen(_introStrings[i]) * 8;
+ }
+
+ // No mouse display in demo
+ if (_flags.isDemo)
+ return 0;
+
+ _mouseSHPBuf = _res->fileData("PWGMOUSE.SHP", 0);
+ assert(_mouseSHPBuf);
+
+ for (int i = 0; i < 2; i++) {
+ _gameShapes[i] = _screen->getPtrToShape(_mouseSHPBuf, i);
+ assert(_gameShapes[i]);
+ }
+
+ _screen->setMouseCursor(0, 0, _gameShapes[0]);
+ return 0;
+}
+
+int KyraEngine_v2::go() {
+ if (_flags.isDemo) {
+ static const char *soundFileList[] = {
+ "K2_DEMO",
+ "LOLSYSEX"
+ };
+ _sound->setSoundFileList(soundFileList, 2);
+ } else {
+ // TODO: move this to proper place
+ static const char *soundFileList[] = {
+ "K2INTRO"
+ };
+ _sound->setSoundFileList(soundFileList, 1);
+ }
+ _sound->loadSoundFile(0);
+
+ // Temporary measure to work around the fact that there's
+ // several WSA files with identical names in different PAK files.
+ _res->unloadPakFile("OUTFARM.PAK");
+ _res->unloadPakFile("FLYTRAP.PAK");
+
+ seq_playSequences(kSequenceVirgin, kSequenceWestwood);
+ mainMenu();
+
+ return 0;
+}
+
+void KyraEngine_v2::mainMenu() {
+ bool running = true;
+
+ while (running && !_quitFlag) {
+ seq_playSequences(kSequenceTitle);
+ _screen->showMouse();
+
+ switch (gui_handleMainMenu()) {
+ case 0:
+ break;
+ case 1:
+ seq_playSequences(kSequenceOverview, kSequenceLibrary);
+ break;
+ case 2:
+ break;
+ case 3:
+ running = false;
+ break;
+ default:
+ break;
+ }
+ _screen->hideMouse();
+ }
+}
+
+} // end of namespace Kyra