aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-06-21 22:21:40 +0200
committerThierry Crozat2019-07-28 15:09:14 +0100
commitcefdf8220a782b90f30e43567786e081501d21d1 (patch)
tree25ba2f73c6b0095ea2246d6d340f20fcd51f2f0f /engines
parentd1edf0e467c48ec78866453a977e05657cf09f10 (diff)
downloadscummvm-rg350-cefdf8220a782b90f30e43567786e081501d21d1.tar.gz
scummvm-rg350-cefdf8220a782b90f30e43567786e081501d21d1.tar.bz2
scummvm-rg350-cefdf8220a782b90f30e43567786e081501d21d1.zip
SUPERNOVA2: Delete supernova2, it's getting merged
Diffstat (limited to 'engines')
-rw-r--r--engines/supernova2/configure.engine3
-rw-r--r--engines/supernova2/console.cpp37
-rw-r--r--engines/supernova2/console.h49
-rw-r--r--engines/supernova2/detection.cpp212
-rw-r--r--engines/supernova2/graphics.cpp287
-rw-r--r--engines/supernova2/graphics.h87
-rw-r--r--engines/supernova2/imageid.h33
-rw-r--r--engines/supernova2/module.mk23
-rw-r--r--engines/supernova2/ms2_def.h329
-rw-r--r--engines/supernova2/resman.cpp446
-rw-r--r--engines/supernova2/resman.h84
-rw-r--r--engines/supernova2/rooms.cpp4915
-rw-r--r--engines/supernova2/rooms.h812
-rw-r--r--engines/supernova2/screen.cpp642
-rw-r--r--engines/supernova2/screen.h201
-rw-r--r--engines/supernova2/screenstatic.cpp542
-rw-r--r--engines/supernova2/sound.cpp81
-rw-r--r--engines/supernova2/sound.h82
-rw-r--r--engines/supernova2/state.cpp2305
-rw-r--r--engines/supernova2/state.h275
-rw-r--r--engines/supernova2/supernova2.cpp647
-rw-r--r--engines/supernova2/supernova2.h135
22 files changed, 0 insertions, 12227 deletions
diff --git a/engines/supernova2/configure.engine b/engines/supernova2/configure.engine
deleted file mode 100644
index c935a04fd3..0000000000
--- a/engines/supernova2/configure.engine
+++ /dev/null
@@ -1,3 +0,0 @@
-# This file is included from the main "configure" script
-# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine supernova2 "Mission Supernova 2" no
diff --git a/engines/supernova2/console.cpp b/engines/supernova2/console.cpp
deleted file mode 100644
index d6e805fe1e..0000000000
--- a/engines/supernova2/console.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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 "gui/debugger.h"
-
-#include "supernova2/supernova2.h"
-#include "supernova2/state.h"
-#include "supernova2/console.h"
-
-namespace Supernova2 {
-
-Console::Console(Supernova2Engine *vm, GameManager *gm)
-{
- _vm = vm;
- _gm = gm;
-}
-
-}
diff --git a/engines/supernova2/console.h b/engines/supernova2/console.h
deleted file mode 100644
index fd7cfe0075..0000000000
--- a/engines/supernova2/console.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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 SUPERNOVA2_CONSOLE_H
-#define SUPERNOVA2_CONSOLE_H
-
-#include "gui/debugger.h"
-
-namespace Supernova2 {
-
-class Supernova2Engine;
-class GameManager;
-
-enum {
- kDebugGeneral = 1 << 0
-};
-
-class Console : public GUI::Debugger {
-public:
- Console(Supernova2::Supernova2Engine *vm, Supernova2::GameManager *gm);
- virtual ~Console() {}
-
-private:
- Supernova2Engine *_vm;
- GameManager *_gm;
-};
-
-}
-
-#endif
diff --git a/engines/supernova2/detection.cpp b/engines/supernova2/detection.cpp
deleted file mode 100644
index ecc2d9c2a3..0000000000
--- a/engines/supernova2/detection.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/* 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 "base/plugins.h"
-#include "common/file.h"
-#include "common/savefile.h"
-#include "common/system.h"
-#include "graphics/thumbnail.h"
-#include "engines/advancedDetector.h"
-
-#include "supernova2/supernova2.h"
-
-static const PlainGameDescriptor supernova2Game[] = {
- {"msn2", "Mission Supernova 2"},
- {nullptr, nullptr}
-};
-
-namespace Supernova2 {
-static const ADGameDescription gameDescriptions[] = {
- // Mission Supernova 2
- {
- "msn2",
- nullptr,
- AD_ENTRY1s("ms2_data.000", "e595610cba4a6d24a763e428d05cc83f", 24805),
- Common::DE_DEU,
- Common::kPlatformDOS,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
- },
- {
- "msn2",
- nullptr,
- AD_ENTRY1s("ms2_data.000", "e595610cba4a6d24a763e428d05cc83f", 24805),
- Common::EN_ANY,
- Common::kPlatformDOS,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)
- },
-
- AD_TABLE_END_MARKER
-};
-}
-
-class Supernova2MetaEngine: public AdvancedMetaEngine {
-public:
- Supernova2MetaEngine() : AdvancedMetaEngine(Supernova2::gameDescriptions, sizeof(ADGameDescription), supernova2Game) {
-// _singleId = "supernova";
- }
-
- virtual const char *getName() const {
- return "Mission Supernova 2";
- }
-
- virtual const char *getOriginalCopyright() const {
- return "Mission Supernova 2(c) 1994 Thomas and Steffen Dingel";
- }
-
- virtual bool hasFeature(MetaEngineFeature f) const;
- virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const;
- virtual SaveStateList listSaves(const char *target) const;
- virtual void removeSaveState(const char *target, int slot) const;
- virtual int getMaximumSaveSlot() const {
- return 99;
- }
- virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
-};
-
-bool Supernova2MetaEngine::hasFeature(MetaEngineFeature f) const {
- switch (f) {
- case kSupportsLoadingDuringStartup:
- // fallthrough
- case kSupportsListSaves:
- // fallthrough
- case kSupportsDeleteSave:
- // fallthrough
- case kSavesSupportMetaInfo:
- // fallthrough
- case kSavesSupportThumbnail:
- // fallthrough
- case kSavesSupportCreationDate:
- // fallthrough
- case kSavesSupportPlayTime:
- return true;
- default:
- return false;
- }
-}
-
-bool Supernova2MetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
- if (desc) {
- *engine = new Supernova2::Supernova2Engine(syst);
- }
-
- return desc != nullptr;
-}
-
-SaveStateList Supernova2MetaEngine::listSaves(const char *target) const {
- Common::StringArray filenames;
- Common::String pattern("ms2_save.###");
-
- filenames = g_system->getSavefileManager()->listSavefiles(pattern);
-
- SaveStateList saveFileList;
- for (Common::StringArray::const_iterator file = filenames.begin();
- file != filenames.end(); ++file) {
- int saveSlot = atoi(file->c_str() + file->size() - 3);
- if (saveSlot >= 0 && saveSlot <= getMaximumSaveSlot()) {
- Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(*file);
- if (savefile) {
- uint saveHeader = savefile->readUint32LE();
- if (saveHeader == SAVEGAME_HEADER) {
- byte saveVersion = savefile->readByte();
- if (saveVersion <= SAVEGAME_VERSION) {
- int saveFileDescSize = savefile->readSint16LE();
- char* saveFileDesc = new char[saveFileDescSize];
- savefile->read(saveFileDesc, saveFileDescSize);
- saveFileList.push_back(SaveStateDescriptor(saveSlot, saveFileDesc));
- delete [] saveFileDesc;
- }
- }
- delete savefile;
- }
- }
- }
-
- Common::sort(saveFileList.begin(), saveFileList.end(), SaveStateDescriptorSlotComparator());
- return saveFileList;
-}
-
-void Supernova2MetaEngine::removeSaveState(const char *target, int slot) const {
- Common::String filename = Common::String::format("ms2_save.%03d", slot);
- g_system->getSavefileManager()->removeSavefile(filename);
-}
-
-SaveStateDescriptor Supernova2MetaEngine::querySaveMetaInfos(const char *target, int slot) const {
- Common::String fileName = Common::String::format("ms2_save.%03d", slot);
- Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(fileName);
-
- if (savefile) {
- uint saveHeader = savefile->readUint32LE();
- if (saveHeader != SAVEGAME_HEADER) {
- delete savefile;
- return SaveStateDescriptor();
- }
- byte saveVersion = savefile->readByte();
- if (saveVersion > SAVEGAME_VERSION){
- delete savefile;
- return SaveStateDescriptor();
- }
-
- int descriptionSize = savefile->readSint16LE();
- char* description = new char[descriptionSize];
- savefile->read(description, descriptionSize);
- SaveStateDescriptor desc(slot, description);
- delete [] description;
-
- uint32 saveDate = savefile->readUint32LE();
- int day = (saveDate >> 24) & 0xFF;
- int month = (saveDate >> 16) & 0xFF;
- int year = saveDate & 0xFFFF;
- desc.setSaveDate(year, month, day);
-
- uint16 saveTime = savefile->readUint16LE();
- int hour = (saveTime >> 8) & 0xFF;
- int minutes = saveTime & 0xFF;
- desc.setSaveTime(hour, minutes);
-
- uint32 playTime =savefile->readUint32LE();
- desc.setPlayTime(playTime * 1000);
-
- if (Graphics::checkThumbnailHeader(*savefile)) {
- Graphics::Surface *thumbnail;
- if (!Graphics::loadThumbnail(*savefile, thumbnail)) {
- delete savefile;
- return SaveStateDescriptor();
- }
- desc.setThumbnail(thumbnail);
- }
-
- delete savefile;
-
- return desc;
- }
-
- return SaveStateDescriptor();
-}
-
-
-#if PLUGIN_ENABLED_DYNAMIC(SUPERNOVA2)
-REGISTER_PLUGIN_DYNAMIC(SUPERNOVA2, PLUGIN_TYPE_ENGINE, Supernova2MetaEngine);
-#else
-REGISTER_PLUGIN_STATIC(SUPERNOVA2, PLUGIN_TYPE_ENGINE, Supernova2MetaEngine);
-#endif
diff --git a/engines/supernova2/graphics.cpp b/engines/supernova2/graphics.cpp
deleted file mode 100644
index 0021534cd9..0000000000
--- a/engines/supernova2/graphics.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-/* 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/algorithm.h"
-#include "common/file.h"
-#include "common/stream.h"
-#include "common/system.h"
-#include "common/config-manager.h"
-#include "graphics/palette.h"
-#include "graphics/surface.h"
-
-#include "supernova2/graphics.h"
-#include "supernova2/ms2_def.h"
-#include "supernova2/screen.h"
-#include "supernova2/supernova2.h"
-
-namespace Supernova2 {
-
-MS2Image::MS2Image() {
- _palette = nullptr;
- _encodedImage = nullptr;
- _filenumber = -1;
- _pitch = 0;
- _numSections = 0;
- _numClickFields = 0;
-
- for (int i = 0; i < kMaxSections; ++i) {
- _section[i].x1 = 0;
- _section[i].x2 = 0;
- _section[i].y1 = 0;
- _section[i].y2 = 0;
- _section[i].next = 0;
- _section[i].addressLow = 0xFFFF;
- _section[i].addressHigh = 0xFF;
- }
-
- for (int i = 0; i < kMaxClickFields; ++i) {
- _clickField[i].x1 = 0;
- _clickField[i].x2 = 0;
- _clickField[i].y1 = 0;
- _clickField[i].y2 = 0;
- _clickField[i].next = 0;
- }
-}
-
-MS2Image::~MS2Image() {
- destroy();
-}
-
-bool MS2Image::init(int filenumber) {
- Common::File file;
- if (!file.open(Common::String::format("ms2_data.%03d", filenumber))) {
- warning("Image data file ms2_data.%03d could not be read!", filenumber);
- return false;
- }
-
- _filenumber = filenumber;
- loadStream(file);
-
- return true;
-}
-
-bool MS2Image::loadFromEngineDataFile() {
- Common::String name;
- if (_filenumber == 28)
- name = "IMG1";
- else
- return false;
-
- Common::String cur_lang = ConfMan.get("language");
-
- // Note: we don't print any warning or errors here if we cannot find the file
- // or the format is not as expected. We will get those warning when reading the
- // strings anyway (actually the engine will even refuse to start).
- Common::File f;
- if (!f.open(SUPERNOVA2_DAT))
- return false;
-
- char id[5], lang[5];
- id[4] = lang[4] = '\0';
- f.read(id, 3);
- if (strncmp(id, "MS2", 3) != 0)
- return false;
- int version = f.readByte();
- if (version != SUPERNOVA2_DAT_VERSION)
- return false;
-
- while (!f.eos()) {
- f.read(id, 4);
- f.read(lang, 4);
- uint32 size = f.readUint32LE();
- if (f.eos())
- break;
- if (name == id && cur_lang == lang) {
- return f.read(_encodedImage, size) == size;
- } else
- f.skip(size);
- }
-
- return false;
-}
-
-bool MS2Image::loadStream(Common::SeekableReadStream &stream) {
- destroy();
-
- uint size = 0;
- size = (stream.readUint16LE() + 0xF) >> 4;
- size |= (stream.readUint16LE() & 0xF) << 12;
- size += 0x70; // zus_paragraph
- size *= 16; // a paragraph is 16 bytes
- _encodedImage = new byte[size];
-
- _palette = new byte[717];
- g_system->getPaletteManager()->grabPalette(_palette, 16, 239);
-
- byte pal_diff;
- byte flag = stream.readByte();
- if (flag == 0) {
- pal_diff = 0;
- _palette[141] = 0xE0;
- _palette[142] = 0xE0;
- _palette[143] = 0xE0;
- } else {
- pal_diff = 1;
- for (int i = flag * 3; i != 0; --i) {
- _palette[717 - i] = stream.readByte() << 2;
- }
- }
-
- _numSections = stream.readByte();
- for (uint i = 0; i < kMaxSections; ++i) {
- _section[i].addressHigh = 0xff;
- _section[i].addressLow = 0xffff;
- _section[i].x2 = 0;
- _section[i].next = 0;
- }
- for (int i = 0; i < _numSections; ++i) {
- _section[i].x1 = stream.readUint16LE();
- _section[i].x2 = stream.readUint16LE();
- _section[i].y1 = stream.readByte();
- _section[i].y2 = stream.readByte();
- _section[i].next = stream.readByte();
- _section[i].addressLow = stream.readUint16LE();
- _section[i].addressHigh = stream.readByte();
- }
-
- _numClickFields = stream.readByte();
- for (int i = 0; i < _numClickFields; ++i) {
- _clickField[i].x1 = stream.readUint16LE();
- _clickField[i].x2 = stream.readUint16LE();
- _clickField[i].y1 = stream.readByte();
- _clickField[i].y2 = stream.readByte();
- _clickField[i].next = stream.readByte();
- }
- for (int i = _numClickFields; i < kMaxClickFields; ++i) {
- _clickField[i].x1 = 0;
- _clickField[i].x2 = 0;
- _clickField[i].y1 = 0;
- _clickField[i].y2 = 0;
- _clickField[i].next = 0;
- }
-
- // Images may be in the engine data file. So first try to read
- // it from there.
- if (!loadFromEngineDataFile()) {
- // Load the image from the stream
- byte zwCodes[256] = {0};
- byte numRepeat = stream.readByte();
- byte numZw = stream.readByte();
- stream.read(zwCodes, numZw);
- numZw += numRepeat;
-
- byte input = 0;
- uint i = 0;
-
- while (stream.read(&input, 1)) {
- if (input < numRepeat) {
- ++input;
- byte value = stream.readByte();
- for (--value; input > 0; --input) {
- _encodedImage[i++] = value;
- }
- } else if (input < numZw) {
- input = zwCodes[input - numRepeat];
- --input;
- _encodedImage[i++] = input;
- _encodedImage[i++] = input;
- } else {
- input -= pal_diff;
- _encodedImage[i++] = input;
- }
- }
- }
-
- loadSections();
-
- return true;
-}
-
-bool MS2Image::loadSections() {
- bool isPoster = _filenumber == 38;
- bool isCypheredText = _filenumber == 28 && ConfMan.get("language") == "en";
- int imageWidth = isPoster || isCypheredText ? 640 : 320;
- int imageHeight = isPoster || isCypheredText ? 480 : 200;
- _pitch = imageWidth;
-
- for (int section = 0; section < _numSections; ++section) {
- Graphics::Surface *surface = new Graphics::Surface;
- _sectionSurfaces.push_back(surface);
- if (isPoster) {
- surface->create(imageWidth, imageHeight, g_system->getScreenFormat());
- byte *surfacePixels = static_cast<byte *>(surface->getPixels());
- for (int i = 0; i < imageWidth * imageHeight / 8; ++i) {
- *surfacePixels++ = (_encodedImage[i] & 0x80) ? kColorWhite63 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x40) ? kColorWhite63 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x20) ? kColorWhite63 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x10) ? kColorWhite63 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x08) ? kColorWhite63 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x04) ? kColorWhite63 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x02) ? kColorWhite63 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x01) ? kColorWhite63 : kColorBlack;
- }
- } else if (isCypheredText) {
- surface->create(imageWidth, imageHeight, g_system->getScreenFormat());
- byte *surfacePixels = static_cast<byte *>(surface->getPixels());
- for (int i = 0; i < imageWidth * imageHeight / 8; ++i) {
- *surfacePixels++ = (_encodedImage[i] & 0x80) ? kColorWhite44 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x40) ? kColorWhite44 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x20) ? kColorWhite44 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x10) ? kColorWhite44 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x08) ? kColorWhite44 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x04) ? kColorWhite44 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x02) ? kColorWhite44 : kColorBlack;
- *surfacePixels++ = (_encodedImage[i] & 0x01) ? kColorWhite44 : kColorBlack;
- }
- } else {
-
- uint32 offset = (_section[section].addressHigh << 16) + _section[section].addressLow;
- if (offset == kInvalidAddress || _section[section].x2 == 0) {
- return false;
- }
- int width = _section[section].x2 - _section[section].x1 + 1;
- int height = _section[section].y2 - _section[section].y1 + 1;
- surface->create(width, height, g_system->getScreenFormat());
- byte *surfacePixels = static_cast<byte *>(surface->getPixels());
- Common::copy(_encodedImage + offset, _encodedImage + offset + width * height, surfacePixels);
- }
- }
-
- return true;
-}
-
-void MS2Image::destroy() {
- if (_palette) {
- delete[] _palette;
- _palette = nullptr;
- }
- if (_encodedImage) {
- delete[] _encodedImage;
- _encodedImage = nullptr;
- }
- for (Common::Array<Graphics::Surface *>::iterator it = _sectionSurfaces.begin();
- it != _sectionSurfaces.end(); ++it) {
- (*it)->free();
- }
-}
-
-}
diff --git a/engines/supernova2/graphics.h b/engines/supernova2/graphics.h
deleted file mode 100644
index 4559900faa..0000000000
--- a/engines/supernova2/graphics.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 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 SUPERNOVA2_GRAPHICS_H
-#define SUPERNOVA2_GRAPHICS_H
-
-#include "common/scummsys.h"
-#include "image/image_decoder.h"
-
-namespace Common {
-class SeekableReadStream;
-}
-
-namespace Graphics {
-struct Surface;
-}
-
-namespace Supernova2 {
-
-class MS2Image : public Image::ImageDecoder {
-public:
- MS2Image();
- virtual ~MS2Image();
-
- virtual void destroy();
- virtual bool loadStream(Common::SeekableReadStream &stream);
- virtual const Graphics::Surface *getSurface() const { return _sectionSurfaces[0]; }
- virtual const byte *getPalette() const { return _palette; }
-
- bool init(int filenumber);
-
- static const int kMaxSections = 50;
- static const int kMaxClickFields = 80;
- static const uint32 kInvalidAddress = 0x00FFFFFF;
-
- int _filenumber;
- int _pitch;
- int _numSections;
- int _numClickFields;
- Common::Array<Graphics::Surface *> _sectionSurfaces;
- byte *_palette;
- byte *_encodedImage;
-
- struct Section {
- int16 x1;
- int16 x2;
- byte y1;
- byte y2;
- byte next;
- uint16 addressLow;
- byte addressHigh;
- } _section[kMaxSections];
-
- struct ClickField {
- int16 x1;
- int16 x2;
- byte y1;
- byte y2;
- byte next;
- } _clickField[kMaxClickFields];
-
-private:
- bool loadFromEngineDataFile();
- bool loadSections();
-};
-
-}
-#endif
diff --git a/engines/supernova2/imageid.h b/engines/supernova2/imageid.h
deleted file mode 100644
index 6a284e0769..0000000000
--- a/engines/supernova2/imageid.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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 SUPERNOVA2_IMAGEID_H
-#define SUPERNOVA2_IMAGEID_H
-
-namespace Supernova2 {
-
-enum ImageId {
-};
-
-}
-
-#endif
diff --git a/engines/supernova2/module.mk b/engines/supernova2/module.mk
deleted file mode 100644
index 7135c9c7a5..0000000000
--- a/engines/supernova2/module.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-MODULE := engines/supernova2
-
-MODULE_OBJS := \
- detection.o \
- state.o \
- graphics.o \
- resman.o \
- rooms.o \
- screen.o \
- console.o \
- sound.o \
- supernova2.o
-
-MODULE_DIRS += \
- engines/supernova2
-
-# This module can be built as a plugin
-ifeq ($(ENABLE_SUPERNOVA2), DYNAMIC_PLUGIN)
-PLUGIN := 1
-endif
-
-# Include common rules
-include $(srcdir)/rules.mk
diff --git a/engines/supernova2/ms2_def.h b/engines/supernova2/ms2_def.h
deleted file mode 100644
index c51d72d9e2..0000000000
--- a/engines/supernova2/ms2_def.h
+++ /dev/null
@@ -1,329 +0,0 @@
-/* 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 SUPERNOVA2_MS2_DEF_H
-#define SUPERNOVA2_MS2_DEF_H
-
-#include "common/scummsys.h"
-
-namespace Supernova2 {
-
-const int kTextSpeed[] = {19, 14, 10, 7, 4};
-const int kMsecPerTick = 55;
-
-const int kMaxSection = 40;
-const int kMaxDialog = 2;
-const int kMaxObject = 30;
-const int kMaxCarry = 30;
-
-const int kSleepAutosaveSlot = 999;
-
-const byte kShownFalse = 0;
-const byte kShownTrue = 1;
-
-enum MessagePosition {
- kMessageNormal,
- kMessageLeft,
- kMessageRight,
- kMessageCenter,
- kMessageTop
-};
-
-enum ObjectType {
- NULLTYPE = 0,
- TAKE = 1,
- OPENABLE = 2,
- OPENED = 4,
- CLOSED = 8,
- EXIT = 16,
- PRESS = 32,
- COMBINABLE = 64,
- CARRIED = 128,
- UNNECESSARY = 256,
- WORN = 512,
- TALK = 1024,
- OCCUPIED = 2048,
- CAUGHT = 4096
-};
-typedef uint16 ObjectTypes;
-
-enum Action {
- ACTION_WALK,
- ACTION_LOOK,
- ACTION_TAKE,
- ACTION_OPEN,
- ACTION_CLOSE,
- ACTION_PRESS,
- ACTION_PULL,
- ACTION_USE,
- ACTION_TALK,
- ACTION_GIVE
-};
-
-enum RoomId {
- INTRO,AIRPORT,TAXISTAND,STREET,GAMES,CABIN,KIOSK,
- CULTURE_PALACE,CHECKOUT,CITY1,CITY2,ELEVATOR,APARTMENT,SHIP,
-
- PYRAMID,PYR_ENTRANCE,UPSTAIRS1,DOWNSTAIRS1,
- BOTTOM_RIGHT_DOOR,BOTTOM_LEFT_DOOR,UPSTAIRS2,DOWNSTAIRS2,
- UPPER_DOOR,PUZZLE_FRONT,PUZZLE_BEHIND,
- FORMULA1_F,FORMULA1_N,FORMULA2_F,FORMULA2_N,TOMATO_F,TOMATO_N,
- MONSTER_F,MONSTER1_N,MONSTER2_N,UPSTAIRS3,DOWNSTAIRS3,
- LCORRIDOR1,LCORRIDOR2,HOLE_ROOM,IN_HOLE,FLOORDOOR,FLOORDOOR_U,
- BST_DOOR,HALL,COFFIN_ROOM,MASK,
-
- MUSEUM,MUS_ENTRANCE,MUS1,MUS2,MUS3,MUS4,MUS5,MUS6,MUS7,MUS8,
- MUS9,MUS10,MUS11,MUS_ROUND,
- MUS12,MUS13,MUS14,MUS15,MUS16,MUS17,MUS18,MUS19,MUS20,MUS21,MUS22,
- NUMROOMS,NULLROOM
-};
-
-enum ObjectId {
- INVALIDOBJECT = -1,
- NULLOBJECT = 0,
- TAXI=1,WALLET,TRANSMITTER,KNIFE,ROD,OCCUPIED_CABIN,MONEY,
- SLOT1,CHAIR,CORRIDOR,G_RIGHT,G_LEFT,PYRA_ENTRANCE,DOOR,BUTTON,
- PART0,PART1,PART2,PART3,PART4,PART5,PART6,PART7,
- PART8,PART9,PART10,PART11,PART12,PART13,PART14,PART15,
- TKNIFE,ROPE,NOTE,MOUTH,
- HOLE1,HOLE2,HOLE3,HOLE4,HOLE5,HOLE6,HOLE7,HOLE8,HOLE9,HOLE10,
- HOLE11,HOLE12,HOLE13,HOLE14,HOLE15,HOLE16,HOLE17,HOLE18,HOLE19,HOLE20,
- HOLE21,HOLE22,HOLE23,HOLE24,HOLE25,SIGN,
- SLOT,HOLE,STONES,
- BST1,BST2,BST3,BST4,BST5,BST6,BST7,BST8,
- BST9,BST10,BST11,BST12,BST13,BST14,BST15,BST16,
- COFFIN,SUN,MONSTER,EYE,EYE1,EYE2,L_BALL,R_BALL,
- PRIZE,REAR_STREET,
- BMASK,BOTTLE,PLAYER,TOOTHBRUSH,BOOKS,LEXICON,PLANT,SNAKE,
- CUP,JOYSTICK,BOTTLE1,BOTTLE2,BOTTLE3,BOTTLE4,BOX,FACES,
- SELLER,POSTER,AXACUSSER,KP_ENTRANCE,CHIP,CARD,
- SCRIBBLE1,SCRIBBLE2,BELL,KEYPAD,DOOR_L,DOOR_R,ID_CARD,
- MAGNET,UNDER_BED,KEY,HATCH,CABINET,DISCMAN,
- SMALL_DOOR,BACK_MONEY,WALL,SUCTION_CUP,IMITATION,SP_KEYCARD,ALARM_CRACKER,
- ENCRYPTED_DOOR,ALARM_SYSTEM,MUS_STREET,BIG_DOOR,MUSIC_SYSTEM,
- HANDLE,SWITCH,DOOR_SWITCH,SUIT,CABLE,RCABLE,
- MUSCARD,HEAD, DISPLAY
-};
-
-enum StringId {
- kNoString = -1,
-kStringCommandGo, kStringCommandLook, kStringCommandTake, kStringCommandOpen, kStringCommandClose,
-kStringCommandPress, kStringCommandPull, kStringCommandUse, kStringCommandTalk, kStringCommandGive,
-kStringConversationEnd, kStringStatusCommandGo, kStringStatusCommandLook, kStringStatusCommandTake, kStringStatusCommandOpen,
-kStringStatusCommandClose, kStringStatusCommandPress, kStringStatusCommandPull, kStringStatusCommandUse, kStringStatusCommandTalk,
-kStringStatusCommandGive, kPhrasalVerbParticleGiveTo, kPhrasalVerbParticleUseWith, kString23, kString24,
-kString25, kString26, kString27, kStringTextSpeed, kStringLeaveGame,
-kString30, kString31, kStringGenericInteract1, kStringGenericInteract2, kStringGenericInteract3,
-kStringGenericInteract4, kStringGenericInteract5, kStringGenericInteract6, kStringGenericInteract7, kStringGenericInteract8,
-kStringGenericInteract9, kStringGenericInteract10, kStringGenericInteract11, kStringGenericInteract12, kStringGenericInteract13,
-kStringIntro1, kStringIntro2, kStringIntro3, kStringIntro4, kStringIntro5,
-kStringOutro1, kStringOutro2, kStringOutro3, kStringOutro4, kStringOutro5,
-kStringShout1, kStringShout2, kStringShout3, kStringShout4, kStringShout5,
-kStringShout6, kStringShout7, kStringShout8, kStringShout9, kStringShout10,
-kStringShout11, kStringShout12, kStringShout13, kStringShout14, kStringShout15,
-kStringMuseum8, kStringMuseum9, kStringMuseum7, kStringMuseum6, kStringMuseum15,
-kStringMuseum16, kStringMuseum10, kStringMuseum12, kStringMuseum13, kStringMuseum14,
-kStringMuseum1, kStringMuseum2, kStringMuseum3, kStringMuseum4, kStringMuseum5,
-kStringMuseum23, kStringMuseum24, kStringMuseum17, kStringMuseum18, kStringMuseum19,
-kStringMuseum20, kStringMuseum21, kStringMuseum22, kStringDinosaur, kStringDinosaurDescription,
-kStringEntrance, kStringDoor, kStringRoad, kStringCamera, kStringCameraDescription,
-kStringMainEntrance, kStringCorridor, kStringDinosaurDescription2, kStringDinosaurHead, kStringDinosaurHeadDescription,
-kStringAlarmSystem, kStringSuctionCup, kStringWall, kStringOpening, kStringLetter,
-kStringMassive, kStringInscriptionDescription, kStringPyramid0, kStringPyramid1, kStringPyramid2,
-kStringPyramid3, kStringPyramid4, kStringPiece, kStringPyramid5, kStringPyramid6,
-kStringPyramid7, kStringPyramid8, kStringPyramid9, kStringPyramid10, kStringPyramid11,
-kStringPyramid12, kStringPyramid13, kStringPyramid14, kStringPyramid15, kStringPyramid17,
-kStringPyramid18, kStringPyramid19, kStringDirection1, kStringDirection2, kStringDirection3,
-kStringDirection4, kStringRope, kStringSign, kStringSignDescription, kStringEntrance1Description,
-kStringPyramid, kStringPyramidDescription, kStringSun, kStringSunDescription, kStringSign5Description,
-kStringRight, kStringLeft, kStringButton, kStringInscription, kStringTomato,
-kStringFunnyDescription, kStringKnife1, kStringKnife1Description, kStringMonster, kStringRopeDescription,
-kStringEyes, kStringMouth, kStringMonster1Description, kStringNote, kStringNoteDescription,
-kStringOpeningDescription1, kStringOpeningDescription2, kStringNoteDescription1, kStringSlot, kStringSlotDescription3,
-kStringOpeningDescription3, kStringStones, kStringPlate, kStringCoffin, kStringExit,
-kStringCreepy, kStringToothbrush, kStringToothbrushDescription1, kStringToothpaste, kStringBall,
-kStringBallDescription, kStringEye, kStringEyeDescription, kStringDefaultDescription, kStringLooksMetal,
-kStringTaxiArrives, kStringNothingHappens, kStringEmpty, kStringWalletOpen, kStringAttachMagnet,
-kStringPoleMagnet, kStringCunning, kStringMustBuyFirst, kStringInsertChip, kStringTransferCD,
-kStringCDNotInserted, kStringRemoveChip, kStringChipNotInserted, kStringWhatFor, kStringMMCD,
-kStringChipEmpty, kStringListeningToCD, kStringNoChip, kStringTipsy, kStringXa,
-kStringAirportEntrance, kStringAirport, kStringDowntown, kStringCulturePalace, kStringEarth,
-kStringPrivateApartment, kStringLeaveTaxi, kStringPay, kStringAddress, kStringCheater,
-kStringNotEnoughMoney, kStringTaxiAccelerating, kString5MinutesLater, kStringAlreadyHavePole, kStringSawPole,
-kStringOnlyShop, kStringCabinOccupiedSay, kStringTakeMoney, kStringAlreadyPaid, kStringNoMoney,
-kStringPay10Xa, kStringWillPassOut, kStringRest, kStringCypher, kStringWillTakeIt,
-kStringTooExpensive, kStringWouldBuy, kStringMeHorstHummel, kStringHaveMusicChip, kStringGreatMask,
-kStringThreeYears, kStringStrongDrink, kStringMusicDevice, kStringArtusToothbrush, kStringSellInBulk,
-kStringRarityBooks, kStringEncyclopedia, kStringLargestDictionary, kStringOver400Words, kStringNotSale,
-kStringGaveOne, kStringExcited, kStringFromGame, kStringRobust, kStringCheapSwill,
-kStringStickers, kStringDishes, kStringUgly, kStringSellsWell, kStringThatCosts,
-kStringTakeALook, kStringNonsense, kStringImSorry, kStringGoodEvening, kStringHello,
-kStringScaredMe, kStringHowSo, kStringDisguise, kStringWhatDisguise, kStringStopPretending,
-kStringYouDisguised, kStringIAmHorstHummel, kStringGiveItUp, kStringGestures, kStringMovesDifferently,
-kStringHeIsRobot, kStringYouAreCrazy, kStringYouIdiot, kStringShutUp, kStringKnife,
-kStringKnifeDescription, kStringMoney, kStringDiscman, kStringDiscmanDescription, kStringSuctionCupDescription,
-kStringSpecialCard, kStringSpecialCardDescription, kStringAlarmCracker, kStringAlarmCrackerDescription, kStringKeycard,
-kStringSpaceship, kStringSpaceshipDescription, kStringVehicles, kStringVehiclesDescription, kStringVehicle,
-kStringVehicleDescription, kStringEntranceDescription, kStringWallet, kStringWalletDescription, kStringDevice,
-kStringDeviceDescription, kStringIdCard, kStringIdCardDescription, kStringStaircase, kStringStaircaseDescription,
-kStringBusinessStreet, kStringBusinessStreetDescription, kStringRod, kStringPost, kStringRailing,
-kStringPoster, kStringPosterDescription, kStringCabin, kStringCabinFree, kStringCabinOccupied,
-kStringFeet, kStringFeetDescription, kStringHood, kStringHoodDescription, kString400Xa,
-kString10Xa, kStringSlotDescription1, kStringSlotDescription2, kStringChair, kStringChairDescription,
-kStringScribble, kStringFace, kStringFaceDescription, kStringBooks, kStringDictionary,
-kStringPlant, kStringMask, kStringSnake, kStringCup, kStringJoystick,
-kStringToothbrushDescription, kStringMusic, kStringMusicDescription, kStringBottle, kStringBottleDescription,
-kStringBox, kStringSeller, kStringWhat, kStringNotInformed, kStringHorstHummel,
-kStringNiceWeather, kStringTellTicket, kStringHereIsXa, kString500Xa, kString1000Xa,
-kString5000Xa, kString10000Xa, kStringThankYou, kStringWhatYouOffer, kStringHello2,
-kStringWhatYouWant, kStringWhoAreYou, kStringHorstHummel2, kStringNeverHeard, kStringYouDontKnow,
-kStringImOnTV, kStringIDontKnow, kStringFunny, kStringAha, kStringICan,
-kStringFromWhom, kStringCost, kStringAsYouSay, kStringGetCard, kStringOnlyParticipation,
-kStringWhatForIt, kStringMakeOffer, kStringGoodOffer, kStringGiveCard, kStringIdiot,
-kStringCheckout1, kStringCheckout2, kStringCheckout3, kStringYes, kStringNo,
-kStringCheckout4, kStringCheckout5, kStringCheckout6, kStringCheckout7, kStringCheckout8,
-kStringCheckout9, kStringCheckout10, kStringCheckout11, kStringCheckout12, kStringCheckout13,
-kStringCheckout14, kStringCheckout15, kStringCheckout16, kStringCheckout17, kStringCheckout18,
-kStringCheckout19, kStringCheckout20, kStringCheckout21, kStringCheckout22, kStringCheckout23,
-kStringCheckout24, kStringCheckout25, kStringCheckout26, kStringCheckout27, kStringCheckout28,
-kStringCheckout29, kStringCheckout30, kStringCheckout31, kStringCheckout32, kStringCheckout33,
-kStringCheckout34, kStringCheckout35, kStringCheckout36, kStringCheckout37, kStringCheckout38,
-kStringCheckout39, kStringCheckout40, kStringCheckout41, kStringCheckout42, kStringCheckout43,
-kStringCheckout44, kStringCheckout45, kStringCheckout46, kStringCheckout47, kStringCheckout48,
-kStringCheckout49, kStringAtMusicContest, kStringNoImitation, kStringGoodJoke, kStringCommon,
-kStringIWillProof, kStringIWillPerform, kStringAppearance32, kStringAppearance1, kStringAppearance2,
-kStringAppearance3, kStringAppearance4, kStringAppearance5, kStringAppearance6, kStringAppearance7,
-kStringAppearance8, kStringAppearance9, kStringAppearance10, kStringAppearance11, kStringAppearance12,
-kStringAppearance13, kStringAppearance14, kStringAppearance15, kStringAppearance16, kStringAppearance17,
-kStringAppearance18, kStringAppearance19, kStringAppearance20, kStringAppearance21, kStringAppearance22,
-kStringAppearance23, kStringAppearance24, kStringAppearance25, kStringAppearance26, kStringAppearance27,
-kStringAppearance28, kStringAppearance29, kStringAppearance30, kStringAppearance31, kStringElevator1,
-kStringElevator2, kStringElevator3, kStringElevator4, kStringElevator5, kStringElevator6,
-kStringElevator7, kStringElevator8, kStringElevator9, kStringElevator10, kStringElevator11,
-kStringElevator12, kStringElevator13, kStringElevator14, kStringElevator15, kStringElevator16,
-kStringElevator17, kStringElevator18, kStringElevator19, kStringElevator20, kStringElevator21,
-kStringElevator22, kStringElevator23, kStringElevator24, kStringElevator25, kStringElevator26,
-kStringElevator27, kStringElevator28, kStringElevator29, kStringElevator30, kStringElevator31,
-kStringElevator32, kStringElevator33, kStringElevator34, kStringElevator35, kStringElevator36,
-kStringElevator37, kStringElevator38, kStringElevator39, kStringElevator40, kStringElevator41,
-kStringElevator42, kStringElevator43, kStringElevator44, kStringElevator45, kStringElevator46,
-kStringElevator47, kStringElevator48, kStringElevator49, kStringElevator50, kStringElevator51,
-kStringElevator52, kStringElevator53, kStringElevator54, kStringElevator55, kStringElevator56,
-kStringElevator57, kStringElevator58, kStringElevator59, kStringElevator60, kStringElevator61,
-kStringElevator62, kStringElevator63, kStringElevator64, kStringElevator65, kStringApartment1,
-kStringApartment2, kStringApartment3, kStringApartment4, kStringApartment5, kStringApartment6,
-kStringApartment7, kStringApartment8, kStringShip0, kStringShip1, kStringShip2,
-kStringShip3, kStringShip4, kStringShip5, kStringShip6, kStringShip7,
-kStringShip8, kStringShip9, kStringShip10, kStringShip11, kStringShip12,
-kStringShip13, kStringShip14, kStringShip15, kStringShip16, kStringShip17,
-kStringShip18, kStringShip19, kStringFascinating, kStringTaxis, kStringTaxisDescription,
-kStringAxacussan, kStringParticipationCard, kStringAxacussian, kStringSign1Description, kStringSign2Description,
-kStringSign3Description, kStringSign4Description, kStringBell, kStringDisplay, kStringKeypad,
-kStringKeypadDescription, kStringChip, kStringChipDescription, kStringHatch, kStringHatchDescription,
-kStringMusicSystem, kStringMusicSystemDescription, kStringSpeakers, kStringSpeakersDescription, kStringPencils,
-kStringPencilsDescription, kStringMetalBlocks, kStringMetalBlocksDescription, kStringImage, kStringImageDescription,
-kStringCabinet, kStringCabinetDescription, kStringElevator, kStringUnderBed, kStringUnderBedDescription,
-kStringKey, kStringKeyDescription, kStringSwitch, kStringHandle, kStringHatch2,
-kStringSpaceSuit, kStringSpaceSuitDescription, kStringCable, kStringCableDescription1, kStringCableDescription2,
-kStringIntro6, kStringIntro7, kStringIntro8, kStringIntroTV1, kStringIntroTV2,
-kStringIntroTV3, kStringIntroTV4, kStringIntroTV5, kStringIntroTV6, kStringIntroTV7,
-kStringIntroTV8, kStringIntroTV9, kStringIntroTV10, kStringIntroTV11, kStringIntroTV12,
-kStringIntroTV13, kStringIntroTV14, kStringIntroTV15, kStringIntroTV16, kStringIntro9,
-kStringIntro10, kStringIntro11, kStringIntro12, kStringIntro13, kStringIntro14,
-kStringMonsterDescription, kStringPyramid16, kStringMuseum11, kStringDialogSeparator
-};
-
-ObjectType operator|(ObjectType a, ObjectType b);
-ObjectType operator&(ObjectType a, ObjectType b);
-ObjectType operator^(ObjectType a, ObjectType b);
-ObjectType &operator|=(ObjectType &a, ObjectType b);
-ObjectType &operator&=(ObjectType &a, ObjectType b);
-ObjectType &operator^=(ObjectType &a, ObjectType b);
-
-struct Object {
- Object()
- : _name(kNoString)
- , _description(kStringDefaultDescription)
- , _id(INVALIDOBJECT)
- , _roomId(NULLROOM)
- , _type(NULLTYPE)
- , _click(0)
- , _click2(0)
- , _section(0)
- , _exitRoom(NULLROOM)
- , _direction(0)
- {}
- Object(byte roomId, StringId name, StringId description, ObjectId id, ObjectType type,
- byte click, byte click2, byte section = 0, RoomId exitRoom = NULLROOM, byte direction = 0)
- : _name(name)
- , _description(description)
- , _id(id)
- , _roomId(roomId)
- , _type(type)
- , _click(click)
- , _click2(click2)
- , _section(section)
- , _exitRoom(exitRoom)
- , _direction(direction)
- {}
-
- void resetProperty(ObjectType type = NULLTYPE) {
- _type = type;
- }
-
- void setProperty(ObjectType type) {
- _type |= type;
- }
-
- void disableProperty(ObjectType type) {
- _type &= ~type;
- }
-
- bool hasProperty(ObjectType type) const {
- return _type & type;
- }
-
- static bool combine(Object &obj1, Object &obj2, ObjectId id1, ObjectId id2) {
- if (obj1.hasProperty(COMBINABLE))
- return (((obj1._id == id1) && (obj2._id == id2)) ||
- ((obj1._id == id2) && (obj2._id == id1)));
- else
- return false;
- }
-
- byte _roomId;
- StringId _name;
- StringId _description;
- ObjectId _id;
- ObjectTypes _type;
- byte _click;
- byte _click2;
- byte _section;
- RoomId _exitRoom;
- byte _direction;
-};
-
-#define ticksToMsec(x) (x * kMsecPerTick)
-
-}
-
-#endif // SUPERNOVA2_MS2_DEF_H
diff --git a/engines/supernova2/resman.cpp b/engines/supernova2/resman.cpp
deleted file mode 100644
index 0cde229f2d..0000000000
--- a/engines/supernova2/resman.cpp
+++ /dev/null
@@ -1,446 +0,0 @@
-/* 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 "audio/audiostream.h"
-#include "audio/decoders/raw.h"
-#include "audio/mixer.h"
-#include "audio/mods/protracker.h"
-#include "common/memstream.h"
-#include "common/system.h"
-#include "graphics/cursorman.h"
-#include "graphics/palette.h"
-
-#include "supernova2/graphics.h"
-#include "supernova2/resman.h"
-#include "supernova2/screen.h"
-#include "supernova2/supernova2.h"
-
-namespace Supernova2 {
-
-struct AudioInfo {
- int _filenumber;
- int _offsetStart;
- int _offsetEnd;
-};
-
-static Common::MemoryReadStream *convertToMod(const char *filename, int version = 2);
-
-static const AudioInfo audioInfo[kAudioNumSamples] = {
- {55, 18230, -1},
- {47, 0, 16010},
- {47, 16010, 17020},
- {49, 8010, -1},
- {49, 0, 8010},
- {53, 30020, -1},
- {55, 7010, 17020},
- {55, 0, 7010},
- {53, 5010, 30020},
- {55, 18230, -1},
- {55, 17020, 18230},
- {53, 0, 5010},
- {47, 17020, -1},
- {51, 9020, -1},
- {51, 0, 6010},
- {50, 0, -1},
- {51, 6010, 9020},
- {54, 0, -1},
- {48, 0, -1}
-};
-
-static const byte mouseNormal[64] = {
- 0xff,0x3f,0xff,0x1f,0xff,0x0f,0xff,0x07,
- 0xff,0x03,0xff,0x01,0xff,0x00,0x7f,0x00,
- 0x3f,0x00,0x1f,0x00,0x0f,0x00,0x0f,0x00,
- 0xff,0x00,0x7f,0x18,0x7f,0x38,0x7f,0xfc,
-
- 0x00,0x00,0x00,0x40,0x00,0x60,0x00,0x70,
- 0x00,0x78,0x00,0x7c,0x00,0x7e,0x00,0x7f,
- 0x80,0x7f,0xc0,0x7f,0xe0,0x7f,0x00,0x7e,
- 0x00,0x66,0x00,0x43,0x00,0x03,0x00,0x00
-};
-
-static const byte mouseWait[64] = {
- 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,
- 0x01,0x80,0x01,0x80,0x11,0x88,0x31,0x8c,
- 0x31,0x8c,0x11,0x88,0x01,0x80,0x01,0x80,
- 0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
-
- 0x00,0x00,0xfe,0x7f,0xf4,0x2f,0xf4,0x2f,
- 0x14,0x28,0x24,0x24,0x44,0x22,0x84,0x21,
- 0x84,0x21,0xc4,0x23,0xe4,0x27,0x74,0x2e,
- 0x34,0x2c,0x14,0x28,0xfe,0x7f,0x00,0x00
-};
-
-
-ResourceManager::ResourceManager()
- : _audioRate(11931) {
- initSoundFiles();
- initGraphics();
-}
-
-void ResourceManager::initSoundFiles() {
- // Sound
- // Note:
- // - samples start with a header of 6 bytes: 01 SS SS 00 AD 00
- // where SS SS (LE uint16) is the size of the sound sample + 2
- // - samples end with a footer of 4 bytes: 00 00
- // Skip those in the buffer
- Common::File file;
-
- for (int i = 0; i < kAudioNumSamples; ++i) {
- if (!file.open(Common::String::format("ms2_data.%03d", audioInfo[i]._filenumber))) {
- error("File %s could not be read!", file.getName());
- }
-
- int length = 0;
- byte *buffer = nullptr;
-
- if (audioInfo[i]._offsetEnd == -1) {
- file.seek(0, SEEK_END);
- length = file.pos() - audioInfo[i]._offsetStart - 10;
- } else {
- length = audioInfo[i]._offsetEnd - audioInfo[i]._offsetStart - 10;
- }
- buffer = new byte[length];
- file.seek(audioInfo[i]._offsetStart + 6);
- file.read(buffer, length);
- file.close();
-
- byte streamFlag = Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN;
- _soundSamples[i].reset(Audio::makeRawStream(buffer, length, _audioRate,
- streamFlag, DisposeAfterUse::YES));
- }
- initSiren();
-
- _musicIntroBuffer.reset(convertToMod("ms2_data.052"));
- _musicMadMonkeysBuffer.reset(convertToMod("ms2_data.056"));
-}
-
-void ResourceManager::initGraphics() {
- Screen::initPalette();
- initCursorGraphics();
- initImages();
-}
-
-void ResourceManager::initCursorGraphics() {
- const uint16 *bufferNormal = reinterpret_cast<const uint16 *>(mouseNormal);
- const uint16 *bufferWait = reinterpret_cast<const uint16 *>(mouseWait);
- for (uint i = 0; i < sizeof(mouseNormal) / 4; ++i) {
- for (uint bit = 0; bit < 16; ++bit) {
- uint mask = 0x8000 >> bit;
- uint bitIndex = i * 16 + bit;
-
- _cursorNormal[bitIndex] = (READ_LE_UINT16(bufferNormal + i) & mask) ?
- kColorCursorTransparent : kColorBlack;
- if (READ_LE_UINT16(bufferNormal + i + 16) & mask)
- _cursorNormal[bitIndex] = kColorLightRed;
-
- _cursorWait[bitIndex] = (READ_LE_UINT16(bufferWait + i) & mask) ?
- kColorCursorTransparent : kColorBlack;
- if (READ_LE_UINT16(bufferWait + i + 16) & mask)
- _cursorWait[bitIndex] = kColorLightRed;
- }
- }
-}
-
-void ResourceManager::initImages() {
- for (int i = 0; i < kNumImageFiles; ++i) {
- if (!_images[i].init(i))
- error("Failed reading image file ms2_data.%03d", i);
- }
-}
-
-Audio::SeekableAudioStream *ResourceManager::getSoundStream(AudioId index) {
- Audio::SeekableAudioStream *stream = _soundSamples[index].get();
- stream->rewind();
-
- return stream;
-}
-
-Audio::AudioStream *ResourceManager::getSoundStream(MusicId index) {
- switch (index) {
- case kMusicIntro:
- _musicIntro.reset(Audio::makeProtrackerStream(_musicIntroBuffer.get()));
- return _musicIntro.get();
- case kMusicMadMonkeys:
- _musicMadMonkeys.reset(Audio::makeProtrackerStream(_musicMadMonkeysBuffer.get()));
- return _musicMadMonkeys.get();
- default:
- error("Invalid music constant in playAudio()");
- }
-}
-
-Audio::AudioStream *ResourceManager::getSirenStream() {
- return _sirenStream.get();
-}
-
-MS2Image *ResourceManager::getImage(int filenumber) {
- if (filenumber < 47)
- return &_images[filenumber];
- else
- return nullptr;
-}
-
-// Generate a tone which minimal length is the length and ends at the end
-// of sine period
-// NOTE: Size of the SineTable has to be the same as audioRate and a multiple of 4
-byte *ResourceManager::generateTone(byte *buffer, int frequency, int length, int audioRate, Common::SineTable &table) {
- int i = 0;
-
- // Make sure length is a multiple of audioRate / frequency to end on a full sine wave and not in the middle.
- // Also the length we have is a minimum length, so only increase it.
- int r = 1 + (length - 1) * frequency / audioRate;
- length = (1 + 2 * r * audioRate / frequency) / 2;
- for(; i < length; i++) {
- buffer[i] = (byte)
- ((table.at((i * frequency) % audioRate) * 127) + 127);
- }
- return buffer + length;
-}
-
-// Tones with frequencies between 1500 Hz and 1800 Hz, frequencies go up and down
-// with a step of 10 Hz.
-void ResourceManager::initSiren() {
- int audioRate = 44000;
- int length = audioRate / 90; // minimal length of each tone
-
- // * 60 for the minimal length, another 20 * length as a spare, for longer tones
- byte *buffer = new byte[length * 80];
- byte *pBuffer = buffer;
- Common::SineTable table(audioRate);
-
- for (int i = 0; i < 30; i++)
- pBuffer = generateTone(pBuffer, 1800 - i * 10, length, audioRate, table);
-
- for (int i = 0; i < 30; i++)
- pBuffer = generateTone(pBuffer, 1500 + i * 10, length, audioRate, table);
-
- byte streamFlag = Audio::FLAG_UNSIGNED;
-
- _sirenStream.reset(Audio::makeLoopingAudioStream(
- Audio::makeRawStream(buffer, pBuffer - buffer, audioRate,
- streamFlag, DisposeAfterUse::YES), 0));
-}
-
-static Common::MemoryReadStream *convertToMod(const char *filename, int version) {
- // MS2 format
- struct {
- uint16 seg;
- uint16 start;
- uint16 end;
- uint16 loopStart;
- uint16 loopEnd;
- char volume;
- char dummy[5];
- } instr2[22];
- int nbInstr2; // 22 for version1, 15 for version 2
- int16 songLength;
- char arrangement[128];
- int16 patternNumber;
- int32 note2[28][64][4];
-
- nbInstr2 = ((version == 1) ? 22 : 15);
-
- Common::File msnFile;
- msnFile.open(filename);
- if (!msnFile.isOpen()) {
- warning("Data file '%s' not found", msnFile.getName());
- return nullptr;
- }
-
- for (int i = 0 ; i < nbInstr2 ; ++i) {
- instr2[i].seg = msnFile.readUint16LE();
- instr2[i].start = msnFile.readUint16LE();
- instr2[i].end = msnFile.readUint16LE();
- instr2[i].loopStart = msnFile.readUint16LE();
- instr2[i].loopEnd = msnFile.readUint16LE();
- instr2[i].volume = msnFile.readByte();
- msnFile.read(instr2[i].dummy, 5);
- }
- songLength = msnFile.readSint16LE();
- msnFile.read(arrangement, 128);
- patternNumber = msnFile.readSint16LE();
- for (int p = 0 ; p < patternNumber ; ++p) {
- for (int n = 0 ; n < 64 ; ++n) {
- for (int k = 0 ; k < 4 ; ++k) {
- note2[p][n][k] = msnFile.readSint32LE();
- }
- }
- }
-
- // MOD format
- struct {
- char iname[22];
- uint16 length;
- char finetune;
- char volume;
- uint16 loopStart;
- uint16 loopLength;
- } instr[31];
- int32 note[28][64][4];
-
- // We can't recover some MOD effects since several of them are mapped to 0.
- // Assume the MSN effect of value 0 is Arpeggio (MOD effect of value 0).
- const char invConvEff[8] = {0, 1, 2, 3, 10, 12, 13 ,15};
-
- // Reminder from convertToMsn
- // 31 30 29 28 27 26 25 24 - 23 22 21 20 19 18 17 16 - 15 14 13 12 11 10 09 08 - 07 06 05 04 03 02 01 00
- // h h h h g g g g f f f f e e e e d d d d c c c c b b b b a a a a
- //
- // MSN:
- // hhhh (4 bits) Cleared to 0
- // dddd c (5 bits) Sample index | after mapping through convInstr
- // ccc (3 bits) Effect type | after mapping through convEff
- // bbbb aaaa (8 bits) Effect value | unmodified
- // gggg ffff eeee (12 bits) Sample period | unmodified
- //
- // MS2:
- // hhhh (4 bits) Cleared to 0
- // dddd (4 bits) Sample index | after mapping through convInstr
- // cccc (4 bits) Effect type | unmodified
- // bbbb aaaa (8 bits) Effect value | unmodified
- // gggg ffff eeee (12 bits) Sample period | transformed (0xE000 / p) - 256
- //
- // MOD:
- // hhhh dddd (8 bits) Sample index
- // cccc (4 bits) Effect type for this channel/division
- // bbbb aaaa (8 bits) Effect value
- // gggg ffff eeee (12 bits) Sample period
-
- // Can we recover the instruments mapping? I don't think so as part of the original instrument index is cleared.
- // And it doesn't really matter as long as we are consistent.
- // However we need to make sure 31 (or 15 in MS2) is mapped to 0 in MOD.
- // We just add 1 to all other values, and this means a 1 <-> 1 mapping for the instruments
- for (int p = 0; p < patternNumber; ++p) {
- for (int n = 0; n < 64; ++n) {
- for (int k = 0; k < 4; ++k) {
- int32* l = &(note[p][n][k]);
- *l = note2[p][n][k];
- int32 i = 0;
- if (nbInstr2 == 22) { // version 1
- i = ((*l & 0xF800) >> 11);
- int32 e = ((*l & 0x0700) >> 8);
- int32 e1 = invConvEff[e];
- *l &= 0x0FFF00FF;
- *l |= (e1 << 8);
- } else { // version 2
- int32 h = (*l >> 16);
- i = ((*l & 0xF000) >> 12);
- *l &= 0x00000FFF;
- if (h)
- h = 0xE000 / (h + 256);
- *l |= (h << 16);
- if (i == 15)
- i = 31;
- }
-
- // Add back index in note
- if (i != 31) {
- ++i;
- *l |= ((i & 0x0F) << 12);
- *l |= ((i & 0xF0) << 24);
- }
- }
- }
- }
-
- for (int i = 0; i < 31; ++i) {
- // iname is not stored in the mod file. Just set it to 'instrument#'
- // finetune is not stored either. Assume 0.
- memset(instr[i].iname, 0, 22);
- sprintf(instr[i].iname, "instrument%d", i+1);
- instr[i].length = 0;
- instr[i].finetune = 0;
- instr[i].volume = 0;
- instr[i].loopStart = 0;
- instr[i].loopLength = 0;
-
- if (i < nbInstr2) {
- instr[i].length = ((instr2[i].end - instr2[i].start) >> 1);
- instr[i].loopStart = ((instr2[i].loopStart - instr2[i].start) >> 1);
- instr[i].loopLength = (( instr2[i].loopEnd - instr2[i].loopStart) >> 1);
- instr[i].volume = instr2[i].volume;
- }
- }
-
- // The ciaaSpeed is kind of useless and not present in the MSN file.
- // Traditionally 0x78 in SoundTracker. Was used in NoiseTracker as a restart point.
- // ProTracker uses 0x7F. FastTracker uses it as a restart point, whereas ScreamTracker 3 uses 0x7F like ProTracker.
- // You can use this to roughly detect which tracker made a MOD, and detection gets more accurate for more obscure MOD types.
- char ciaaSpeed = 0x7F;
-
- // The mark cannot be recovered either. Since we have 4 channels and 31 instrument it can be either ID='M.K.' or ID='4CHN'.
- // Assume 'M.K.'
- const char mark[4] = { 'M', '.', 'K', '.' };
-
- Common::MemoryWriteStreamDynamic buffer(DisposeAfterUse::NO);
-
- buffer.write(msnFile.getName(), 19);
- buffer.writeByte(0);
-
- for (int i = 0 ; i < 31 ; ++i) {
- buffer.write(instr[i].iname, 22);
- buffer.writeUint16BE(instr[i].length);
- buffer.writeByte(instr[i].finetune);
- buffer.writeByte(instr[i].volume);
- buffer.writeUint16BE(instr[i].loopStart);
- buffer.writeUint16BE(instr[i].loopLength);
- }
- buffer.writeByte((char)songLength);
- buffer.writeByte(ciaaSpeed);
- buffer.write(arrangement, 128);
- buffer.write(mark, 4);
-
- for (int p = 0 ; p < patternNumber ; ++p) {
- for (int n = 0 ; n < 64 ; ++n) {
- for (int k = 0 ; k < 4 ; ++k) {
-// buffer.writeUint32BE(*((uint32*)(note[p][n]+k)));
- buffer.writeSint32BE(note[p][n][k]);
- }
- }
- }
-
- uint nb;
- char buf[4096];
- while ((nb = msnFile.read(buf, 4096)) > 0)
- buffer.write(buf, nb);
-
- return new Common::MemoryReadStream(buffer.getData(), buffer.size(), DisposeAfterUse::YES);
-}
-
-int ResourceManager::getAudioRate() {
- return _audioRate;
-}
-
-const byte *ResourceManager::getCursor(CursorId id) const {
- switch (id) {
- case kCursorNormal:
- return _cursorNormal;
- case kCursorWait:
- return _cursorWait;
- default:
- return nullptr;
- }
-}
-
-
-}
diff --git a/engines/supernova2/resman.h b/engines/supernova2/resman.h
deleted file mode 100644
index d3fa460284..0000000000
--- a/engines/supernova2/resman.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 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 SUPERNOVA2_RESOURCES_H
-#define SUPERNOVA2_RESOURCES_H
-
-#include "audio/audiostream.h"
-#include "common/ptr.h"
-#include "common/sinetables.h"
-
-#include "supernova2/graphics.h"
-#include "supernova2/sound.h"
-
-
-namespace Common {
-class MemoryReadStream;
-class SineTable;
-}
-
-namespace Supernova2 {
-
-class ResourceManager {
-public:
- enum CursorId {
- kCursorNormal,
- kCursorWait
- };
-
-public:
- static const int kNumImageFiles = 47;
-
-public:
- ResourceManager();
-
- Audio::SeekableAudioStream *getSoundStream(AudioId index);
- Audio::AudioStream *getSoundStream(MusicId index);
- Audio::AudioStream *getSirenStream();
- MS2Image *getImage(int filenumber);
- const byte *getCursor(CursorId id) const;
- int getAudioRate();
-
-private:
- void initSoundFiles();
- void initGraphics();
- void initCursorGraphics();
- void initImages();
- void initSiren();
- byte *generateTone(byte *buffer, int frequency, int length, int audioRate, Common::SineTable &table);
-
-private:
- Common::ScopedPtr<Audio::SeekableAudioStream> _soundSamples[kAudioNumSamples];
- Common::ScopedPtr<Common::MemoryReadStream> _musicIntroBuffer;
- Common::ScopedPtr<Common::MemoryReadStream> _musicMadMonkeysBuffer;
- Common::ScopedPtr<Audio::AudioStream> _musicIntro;
- Common::ScopedPtr<Audio::AudioStream> _sirenStream;
- Common::ScopedPtr<Audio::AudioStream> _musicMadMonkeys;
- int _audioRate;
- MS2Image _images[kNumImageFiles];
- byte _cursorNormal[256];
- byte _cursorWait[256];
-};
-
-}
-
-#endif
diff --git a/engines/supernova2/rooms.cpp b/engines/supernova2/rooms.cpp
deleted file mode 100644
index 1bec6107d8..0000000000
--- a/engines/supernova2/rooms.cpp
+++ /dev/null
@@ -1,4915 +0,0 @@
-/* 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/system.h"
-#include "common/config-manager.h"
-#include "graphics/palette.h"
-#include "graphics/cursorman.h"
-
-#include "supernova2/screen.h"
-#include "supernova2/supernova2.h"
-#include "supernova2/state.h"
-#include "supernova2/rooms.h"
-#include "supernova2/graphics.h"
-
-namespace Supernova2 {
-
-Room::Room() {
- _seen = false;
- _fileNumber = 0;
- _id = NULLROOM;
- _vm = nullptr;
- _gm = nullptr;
-
- for (int i = 0; i < kMaxSection; ++i)
- _shown[i] = kShownFalse;
- for (int i = 0; i < kMaxDialog; ++i)
- _sentenceRemoved[i] = 0;
-}
-
-Room::~Room() {
-}
-
-bool Room::serialize(Common::WriteStream *out) {
- if (out->err())
- return false;
-
- out->writeSint32LE(_id);
- for (int i = 0; i < kMaxSection; ++i)
- out->writeByte(_shown[i]);
- for (int i = 0; i < kMaxDialog ; ++i)
- out->writeByte(_sentenceRemoved[i]);
-
- int numObjects = 0;
- while ((numObjects < kMaxObject) && (_objectState[numObjects]._id != INVALIDOBJECT))
- ++numObjects;
- out->writeSint32LE(numObjects);
-
- for (int i = 0; i < numObjects; ++i) {
- out->writeSint32LE(_objectState[i]._name);
- out->writeSint32LE(_objectState[i]._description);
- out->writeByte(_objectState[i]._roomId);
- out->writeSint32LE(_objectState[i]._id);
- out->writeSint32LE(_objectState[i]._type);
- out->writeByte(_objectState[i]._click);
- out->writeByte(_objectState[i]._click2);
- out->writeByte(_objectState[i]._section);
- out->writeSint32LE(_objectState[i]._exitRoom);
- out->writeByte(_objectState[i]._direction);
- }
-
- out->writeByte(_seen);
-
- return !out->err();
-}
-
-bool Room::deserialize(Common::ReadStream *in, int version) {
- if (in->err())
- return false;
-
- in->readSint32LE();
-
- for (int i = 0; i < kMaxSection; ++i)
- _shown[i] = in->readByte();
-
- // Prior to version 3, _sentenceRemoved was part of _shown (the last two values)
- // But on the other hand dialog was not implemented anyway, so we don't even try to
- // recover it.
- for (int i = 0; i < kMaxDialog ; ++i)
- _sentenceRemoved[i] = version < 3 ? 0 : in->readByte();
-
- int numObjects = in->readSint32LE();
- for (int i = 0; i < numObjects; ++i) {
- _objectState[i]._name = static_cast<StringId>(in->readSint32LE());
- _objectState[i]._description = static_cast<StringId>(in->readSint32LE());
- _objectState[i]._roomId = in->readByte();
- _objectState[i]._id = static_cast<ObjectId>(in->readSint32LE());
- _objectState[i]._type = static_cast<ObjectType>(in->readSint32LE());
- _objectState[i]._click = in->readByte();
- _objectState[i]._click2 = in->readByte();
- _objectState[i]._section = in->readByte();
- _objectState[i]._exitRoom = static_cast<RoomId>(in->readSint32LE());
- _objectState[i]._direction = in->readByte();
- }
-
- _seen = in->readByte();
-
- return !in->err();
-}
-
-bool Room::hasSeen() {
- return _seen;
-}
-void Room::setRoomSeen(bool seen) {
- _seen = seen;
-}
-
-int Room::getFileNumber() const {
- return _fileNumber;
-}
-RoomId Room::getId() const {
- return _id;
-}
-
-void Room::setSectionVisible(uint section, bool visible) {
- if (section < kMaxSection)
- _shown[section] = visible ? kShownTrue : kShownFalse;
- else
- _shown[section - 128] = visible ? kShownFalse : kShownTrue;
-}
-
-bool Room::isSectionVisible(uint index) const {
- return _shown[index] == kShownTrue;
-}
-
-void Room::removeSentenceByMask(int mask, int number) {
- if (number > 0) {
- _sentenceRemoved[number - 1] |= mask;
- }
-}
-
-void Room::removeSentence(int sentence, int number) {
- if (number > 0)
- _sentenceRemoved[number - 1] |= (1 << sentence);
-}
-
-void Room::addSentence(int sentence, int number) {
- if (number > 0)
- _sentenceRemoved[number - 1] &= ~(1 << sentence);
-}
-
-void Room::addAllSentences(int number) {
- if (number > 0)
- _sentenceRemoved[number - 1] = 0;
-}
-
-bool Room::sentenceRemoved(int sentence, int number) {
- if (number <= 0)
- return false;
- return (_sentenceRemoved[number - 1] & (1 << sentence));
-}
-
-bool Room::allSentencesRemoved(int maxSentence, int number) {
- if (number <= 0)
- return false;
- for (int i = 0, flag = 1 ; i < maxSentence ; ++i, flag <<= 1)
- if (!(_sentenceRemoved[number - 1] & flag))
- return false;
- return true;
-}
-
-Object *Room::getObject(uint index) {
- return &_objectState[index];
-}
-
-void Room::animation() {
-}
-
-void Room::onEntrance() {
-}
-
-bool Room::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Intro::Intro(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = -1;
- _id = INTRO;
-
- _objectState[0] = Object(_id, kStringKnife, kStringKnifeDescription, KNIFE, TAKE | CARRIED | COMBINABLE, 255, 255, 0);
- _objectState[1] = Object(_id, kStringMoney, kStringDefaultDescription, MONEY, TAKE | CARRIED | COMBINABLE, 255, 255, 0);
- _objectState[2] = Object(_id, kStringDiscman, kStringDiscmanDescription, DISCMAN, TAKE | CARRIED | COMBINABLE, 255, 255, 0);
- _objectState[3] = Object(_id, kStringSuctionCup, kStringSuctionCupDescription, SUCTION_CUP, TAKE | COMBINABLE, 255, 255, 0);
- _objectState[4] = Object(_id, kStringDefaultDescription, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 0, 0, 0);
- _objectState[5] = Object(_id, kStringSpecialCard, kStringSpecialCardDescription, SP_KEYCARD, TAKE | COMBINABLE, 255, 255, 0);
- _objectState[6] = Object(_id, kStringAlarmCracker, kStringAlarmCrackerDescription, ALARM_CRACKER, TAKE | COMBINABLE, 255, 255, 0);
- _objectState[7] = Object(_id, kStringDinosaurHead, kStringDefaultDescription, NULLOBJECT, TAKE, 255, 255, 0);
- _objectState[8] = Object(_id, kStringKeycard, kStringDefaultDescription, MUSCARD, TAKE, 255, 255, 0);
-
- _introText =
- _vm->getGameString(kStringIntro1) + '\0' +
- _vm->getGameString(kStringIntro2) + '\0' +
- _vm->getGameString(kStringIntro3) + '\0' +
- _vm->getGameString(kStringIntro4) + '\0' +
- _vm->getGameString(kStringIntro5) + '\0' +
- "^Matthias Neef#" + '\0' +
- "^Sascha Otterbach#" + '\0' +
- "^Thomas Mazzoni#" + '\0' +
- "^Matthias Klein#" + '\0' +
- "^Gerrit Rothmaier#" + '\0' +
- "^Thomas Hassler#" + '\0' +
- "^Rene Kach#" + '\0' +
- '\233' + '\0';
-}
-
-void Intro::onEntrance() {
- _gm->_guiEnabled = false;
- _vm->_allowSaveGame = false;
- _vm->_allowLoadGame = false;
-
- titleScreen();
- if (!(thoughts1() && tvDialogue() && thoughts2()))
- _gm->_rooms[AIRPORT]->setRoomSeen(true);
- _vm->paletteFadeOut();
-
- for (int i = 0; i < 3; ++i)
- _gm->_inventory.add(*_gm->_rooms[INTRO]->getObject(i));
-
- _gm->changeRoom(AIRPORT);
- _gm->_guiEnabled = true;
- _vm->_allowSaveGame = true;
- _vm->_allowLoadGame = true;
-}
-
-void Intro::titleScreen() {
- CursorMan.showMouse(false);
- _vm->_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(0);
- _vm->_screen->setGuiBrightness(0);
- _vm->paletteBrightness();
- _vm->setCurrentImage(1);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
- _gm->wait(15);
- _vm->renderImage(1);
- _gm->wait(15);
- _vm->renderImage(2);
- const Common::String title1 = "V1.02";
- _vm->_screen->renderText(title1, 295, 190, 3);
-
- _vm->playSound(kMusicIntro);
- Marquee marquee(_vm->_screen, Marquee::kMarqueeIntro, _introText.c_str());
- while (!_vm->shouldQuit()) {
- _gm->updateEvents();
- marquee.renderCharacter();
- if (_gm->_mouseClicked || _gm->_keyPressed)
- break;
- g_system->updateScreen();
- g_system->delayMillis(_vm->_delay);
- }
- _vm->stopSound();
- _vm->paletteFadeOut();
- CursorMan.showMouse(true);
-}
-
-bool Intro::displayThoughtMessage(StringId id) {
- Common::KeyCode key = Common::KEYCODE_INVALID;
- const Common::String& text = _vm->getGameString(id);
- _vm->renderMessage(text, kMessageNormal);
- if (_gm->waitOnInput((text.size() + 20) * _vm->_textSpeed / 10, key)) {
- _vm->removeMessage();
- return key != Common::KEYCODE_ESCAPE && !_vm->shouldQuit();
- }
- _vm->removeMessage();
- return true;
-}
-
-bool Intro::thoughts1() {
- if(_vm->shouldQuit())
- return false;
-
- _vm->setCurrentImage(41);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
-
- if(!displayThoughtMessage(kStringIntro6))
- return false;
-
- if(!displayThoughtMessage(kStringIntro7))
- return false;
-
- if(!displayThoughtMessage(kStringIntro8))
- return false;
-
- _vm->paletteFadeOut();
- return true;
-}
-
-bool Intro::thoughts2() {
- if(_vm->shouldQuit())
- return false;
-
- _vm->setCurrentImage(41);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
-
- if(!displayThoughtMessage(kStringIntro9))
- return false;
-
- if(!displayThoughtMessage(kStringIntro10))
- return false;
-
- if(!displayThoughtMessage(kStringIntro11))
- return false;
-
- _vm->paletteFadeOut();
-
- _vm->setCurrentImage(2);
- _vm->renderImage(0);
- _vm->renderImage(1);
- _vm->paletteFadeIn();
-
- for (int i = 0; i < 35; i++)
- {
- _vm->renderImage((i % 3) + 2);
- _gm->wait(3);
- }
- _vm->paletteFadeOut();
-
- _vm->setCurrentImage(41);
- _vm->renderImage(0);
- _vm->renderImage(1);
- _vm->paletteFadeIn();
-
- if(!displayThoughtMessage(kStringIntro12))
- return false;
-
- if(!displayThoughtMessage(kStringIntro13))
- return false;
-
- if(!displayThoughtMessage(kStringIntro14))
- return false;
-
- _vm->paletteFadeOut();
- return true;
-}
-
-bool Intro::tvDialogue() {
- if(_vm->shouldQuit())
- return false;
-
- _vm->setCurrentImage(39);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
- _gm->wait(50);
- _vm->setCurrentImage(40);
- _vm->renderImage(0);
- for (int i = 1; i < 11; i++)
- {
- _gm->wait(3);
- _vm->renderImage(i);
- }
- _vm->playSound(kAudioIntroDing);
- _gm->wait(30);
- _vm->renderImage(11);
- _vm->playSound(kAudioIntroDing);
- _gm->wait(60);
-
- _vm->_system->fillScreen(kColorBlack);
- _vm->setCurrentImage(42);
- _vm->renderImage(0);
-
- if(!_gm->talk(1, 1+128, 0, kMessageLeft, kStringIntroTV1))
- return false;
-
- _vm->renderImage(4);
- _gm->wait(3);
- _vm->renderImage(6);
-
- if(!_gm->talk(8, 6, 7, kMessageLeft, kStringIntroTV2))
- return false;
- debug("%d", _vm->shouldQuit());
-
- _vm->renderImage(10);
-
- if(!_gm->talkRest(8, 6, _gm->_restTime))
- return false;
-
- _vm->removeMessage();
-
- if(!_gm->talk(8, 6, 0, kMessageLeft, kStringIntroTV3))
- return false;
-
- if(!_gm->talk(8, 6, 0, kMessageLeft, kStringIntroTV4))
- return false;
-
- _vm->renderImage(10 + 128);
- _gm->wait(3);
- _vm->renderImage(5);
- _gm->wait(3);
- _vm->renderImage(7);
-
- if(!_gm->talk(9, 7, 0, kMessageCenter, kStringIntroTV5))
- return false;
-
- if(!_gm->talk(9, 7, 0, kMessageCenter, kStringIntroTV6))
- return false;
-
- if(!_gm->talk(9, 7, 0, kMessageCenter, kStringIntroTV7))
- return false;
-
- if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV8))
- return false;
-
- if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV9))
- return false;
-
- if(!_gm->talk(9, 7, 0, kMessageCenter, kStringIntroTV10))
- return false;
-
- if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV11))
- return false;
-
- if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV12))
- return false;
-
- if(!_gm->talk(9, 7, 8, kMessageCenter, kStringIntroTV13))
- return false;
-
- _vm->renderImage(4);
-
- if(!_gm->talkRest(9, 7, 1))
- return false;
-
- _vm->renderImage(4 + 128);
-
- if(!_gm->talkRest(9, 7, 3))
- return false;
-
- _vm->renderImage(4);
-
- if(!_gm->talkRest(9, 7, 1))
- return false;
-
- _vm->renderImage(6);
-
- if(!_gm->talkRest(9, 7, _gm->_restTime - 5))
- return false;
-
- _vm->removeMessage();
-
- if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV14))
- return false;
-
- if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV15))
- return false;
-
- if(!_gm->talk(9, 7, 0, kMessageCenter, kStringIntroTV16))
- return false;
-
- return true;
-}
-
-Airport::Airport(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 2;
- _id = AIRPORT;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringSpaceship, kStringSpaceshipDescription, NULLOBJECT, NULLTYPE, 0, 0, 0, NULLROOM, 0);
- _objectState[1] = Object(_id, kStringVehicles, kStringVehiclesDescription, NULLOBJECT, EXIT, 1, 1, 0, TAXISTAND, 8);
-}
-
-void Airport::onEntrance() {
- if (hasSeen() == false) {
- _vm->renderMessage(kStringAirportEntrance);
- }
- setRoomSeen(true);
-}
-
-TaxiStand::TaxiStand(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 3;
- _id = TAXISTAND;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[7] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringVehicle, kStringVehicleDescription, TAXI, NULLTYPE, 2, 2, 0, NULLROOM, 11);
- _objectState[1] = Object(_id, kStringVehicle, kStringVehicleDescription, NULLOBJECT, NULLTYPE, 1, 1, 0);
- _objectState[2] = Object(_id, kStringEntrance, kStringEntranceDescription, DOOR, EXIT | OPENABLE | CLOSED, 3, 3, 0, NULLROOM, 1);
- _objectState[3] = Object(_id, kStringWallet, kStringWalletDescription, WALLET, TAKE, 0, 0, 7 + 128);
- _objectState[4] = Object(_id, kStringDevice, kStringDeviceDescription, TRANSMITTER, TAKE | PRESS, 255, 255, 0);
- _objectState[5] = Object(_id, kStringIdCard, kStringIdCardDescription, ID_CARD, TAKE | COMBINABLE, 255, 255, 0);
- _objectState[6] = Object(_id, kStringAirport, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, AIRPORT, 22);
-}
-
-void TaxiStand::onEntrance() {
- setRoomSeen(true);
-}
-
-void TaxiStand::animation() {
- if (isSectionVisible(4)) {
- setSectionVisible(1, kShownFalse);
- setSectionVisible(2, kShownFalse);
- setSectionVisible(3, kShownFalse);
- setSectionVisible(4, kShownFalse);
- }
- else if (isSectionVisible(3))
- setSectionVisible(4, kShownTrue);
- else if (isSectionVisible(2))
- setSectionVisible(3, kShownTrue);
- else if (isSectionVisible(1))
- setSectionVisible(2, kShownTrue);
- else
- setSectionVisible(1, kShownTrue);
- _gm->setAnimationTimer(7);
-}
-
-bool TaxiStand::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_WALK && obj1._id == TAXI && isSectionVisible(6))
- _gm->taxi();
- else if ((verb == ACTION_WALK || verb == ACTION_OPEN) && obj1._id == DOOR)
- _vm->renderMessage(obj1._description);
- else
- return false;
- return true;
-}
-
-Street::Street(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 5;
- _id = STREET;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringEntrance, kStringDefaultDescription, NULLOBJECT, EXIT, 0, 0, 0, GAMES, 10);
- _objectState[1] = Object(_id, kStringStaircase, kStringStaircaseDescription, NULLOBJECT, NULLTYPE, 2, 2, 0);
- _objectState[2] = Object(_id, kStringBusinessStreet, kStringBusinessStreetDescription, REAR_STREET, EXIT, 3, 3, 0, KIOSK, 3);
- _objectState[3] = Object(_id, kStringRod, kStringLooksMetal, ROD, COMBINABLE, 7, 7, 22);
- _objectState[4] = Object(_id, kStringRod, kStringLooksMetal, ROD, COMBINABLE, 6, 6, 0);
- _objectState[5] = Object(_id, kStringPost, kStringLooksMetal, NULLOBJECT, NULLTYPE, 4, 4, 0);
- _objectState[6] = Object(_id, kStringRailing, kStringLooksMetal, NULLOBJECT, NULLTYPE, 5, 5, 0);
-}
-
-void Street::onEntrance() {
- setRoomSeen(true);
-}
-
-void Street::animation() {
- static int ltab[36] = {
- 8, 9 + 128, 10, 11 + 128, 6, 12, 13 + 128, 9, 14, 15 + 128, 19,
- 16, 17 + 128, 9 + 128, 18, 19 + 128, 6 + 128, 20, 21 + 128,
- 8 + 128, 9, 10 + 128, 11, 6, 12 + 128, 13, 14 + 128, 15, 19,
- 16 + 128, 17, 18 + 128, 19 + 128, 6 + 128, 20 + 128, 21
- };
-
- static int i, banks, light;
-
- if (isSectionVisible(7))
- setSectionVisible(7, kShownFalse);
- else
- setSectionVisible(7, kShownTrue);
-
- if (++i == 4) {
- i = 0;
- switch (banks) {
- case 0:
- setSectionVisible(1, kShownTrue);
- break;
- case 1:
- setSectionVisible(2, kShownTrue);
- break;
- case 2:
- setSectionVisible(3, kShownTrue);
- break;
- case 3:
- setSectionVisible(4, kShownTrue);
- break;
- case 4:
- setSectionVisible(5, kShownTrue);
- break;
- case 5:
- // fall through
- case 7:
- // fall through
- case 9:
- setSectionVisible(1, kShownFalse);
- setSectionVisible(2, kShownFalse);
- setSectionVisible(3, kShownFalse);
- setSectionVisible(4, kShownFalse);
- setSectionVisible(5, kShownFalse);
- break;
- case 6:
- // fall through
- case 8:
- setSectionVisible(1, kShownTrue);
- setSectionVisible(2, kShownTrue);
- setSectionVisible(3, kShownTrue);
- setSectionVisible(4, kShownTrue);
- setSectionVisible(5, kShownTrue);
- break;
- }
- banks++;
- if (banks == 10) banks = 0;
- }
- setSectionVisible(ltab[light], kShownTrue);
- light++;
- if (light == 36)
- light = 0;
- _gm->setAnimationTimer(2);
-}
-
-bool Street::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_USE && Object::combine(obj1, obj2, KNIFE, ROD)) {
- if (getObject(3)->_type & CARRIED)
- _vm->renderMessage(kStringAlreadyHavePole);
- else {
- _vm->renderMessage(kStringSawPole);
- _gm->takeObject(*getObject(3));
- _vm->playSound(kAudioSuccess);
- }
- } else if (verb == ACTION_WALK && obj1._id == REAR_STREET) {
- Common::String text = _vm->getGameString(kStringOnlyShop);
- _vm->renderMessage(text);
- _gm->waitOnInput((text.size() + 20) * _vm->_textSpeed / 10);
- _vm->removeMessage();
- return false;
- } else
- return false;
- return true;
-}
-
-Games::Games(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 6;
- _id = GAMES;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringPoster, kStringPosterDescription, POSTER, UNNECESSARY, 3, 3, 0);
- _objectState[1] = Object(_id, kStringCabin, kStringCabinFree, NULLOBJECT, EXIT, 1, 1, 0, CABIN, 9);
- _objectState[2] = Object(_id, kStringCabin, kStringCabinOccupied, OCCUPIED_CABIN, NULLTYPE, 0, 0, 0);
- _objectState[3] = Object(_id, kStringFeet, kStringFeetDescription, NULLOBJECT, NULLTYPE, 2, 2, 0);
- _objectState[4] = Object(_id, kStringExit, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, STREET, 22);
-}
-
-void Games::onEntrance() {
- setRoomSeen(true);
-}
-
-bool Games::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_WALK && obj1._id == OCCUPIED_CABIN) {
- _vm->renderMessage(kStringCabinOccupiedSay);
- } else if (verb == ACTION_LOOK && obj1._id == POSTER) {
- _gm->_state._taxiPossibility &= ~4; // add culture palace
- return false;
- } else
- return false;
- return true;
-}
-
-Cabin::Cabin(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 7;
- _id = CABIN;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringExit, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, GAMES, 22);
- _objectState[1] = Object(_id, kStringHood, kStringHoodDescription, NULLOBJECT, NULLTYPE, 0, 0, 0);
- _objectState[2] = Object(_id, kString400Xa, kStringDefaultDescription, PRIZE, TAKE, 255, 255, 2 + 180);
- _objectState[3] = Object(_id, kString10Xa, kStringDefaultDescription, BACK_MONEY, TAKE, 255, 255, 2 + 128);
- _objectState[4] = Object(_id, kStringSlot, kStringSlotDescription1, SLOT1, COMBINABLE, 2, 2, 0);
- _objectState[5] = Object(_id, kStringSlot, kStringSlotDescription2, NULLOBJECT, COMBINABLE, 3, 3, 0);
- _objectState[6] = Object(_id, kStringChair, kStringChairDescription, CHAIR, NULLTYPE, 4, 4, 0);
- _objectState[7] = Object(_id, kStringScribble, kStringDefaultDescription, SCRIBBLE1, NULLTYPE, 5, 5, 0);
- _objectState[8] = Object(_id, kStringScribble, kStringDefaultDescription, SCRIBBLE2, NULLTYPE, 6, 6, 0);
- _objectState[9] = Object(_id, kStringFace, kStringFaceDescription, NULLOBJECT, NULLTYPE, 7, 7, 0);
- _objectState[10] = Object(_id, kStringSign, kStringDefaultDescription, SIGN, UNNECESSARY, 1, 1, 0);
-}
-
-void Cabin::onEntrance() {
- setRoomSeen(true);
-}
-
-void Cabin::animation() {
- if (_shown[kMaxSection - 1]) {
- if (isSectionVisible(1))
- _vm->renderImage(1 + 128);
- else
- _vm->renderImage(1);
- }
- _gm->setAnimationTimer(4);
-}
-
-bool Cabin::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_USE && Object::combine(obj1, obj2, MONEY, SLOT1)) {
- if (isSectionVisible(2))
- _vm->renderMessage(kStringTakeMoney);
- else if (_shown[kMaxSection - 1])
- _vm->renderMessage(kStringAlreadyPaid);
- else if (_gm->_state._money < 10)
- _vm->renderMessage(kStringNoMoney);
- else {
- _vm->renderMessage(kStringPay10Xa);
- _gm->takeMoney(-10);
- _shown[kMaxSection - 1] = true;
- }
- } else if (verb == ACTION_USE && obj1._id == CHAIR) {
- if (_shown[kMaxSection - 1]) {
- if (_shown[kMaxSection - 2]) {
- _vm->paletteFadeOut();
- _vm->setCurrentImage(31);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
- _shown[kMaxSection - 1] = true;
- _gm->getInput();
- _vm->paletteFadeOut();
- _vm->setCurrentImage(7);
- _vm->renderImage(0);
- setSectionVisible(1, kShownFalse);
- _shown[kMaxSection - 1] = false;
- _vm->renderRoom(*this);
- _vm->renderImage(2);
- _gm->drawGUI();
- _vm->paletteFadeIn();
- getObject(3)->_click = 8;
- } else {
- _gm->_state._tipsy = false;
- _vm->paletteFadeOut();
- _vm->_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(255);
- Common::String text = _vm->getGameString(kStringWillPassOut);
- _vm->renderMessage(text);
- _gm->waitOnInput((text.size() + 20) * _vm->_textSpeed / 10);
- _vm->removeMessage();
- _vm->paletteFadeOut();
- _vm->saveGame(kSleepAutosaveSlot, "autosave");
- _gm->_inventory.clear();
- _gm->changeRoom(PYRAMID);
- _gm->drawGUI();
- }
- } else
- _vm->renderMessage(kStringRest);
- } else if (verb == ACTION_TAKE && obj1._id == PRIZE) {
- _vm->renderImage(2 + 128);
- obj1._click = 255;
- _gm->takeMoney(400);
- } else if (verb == ACTION_TAKE && obj1._id == BACK_MONEY) {
- _vm->renderImage(2 + 128);
- obj1._click = 255;
- _gm->takeMoney(10);
- } else if (verb == ACTION_LOOK && obj1._id == SCRIBBLE1) {
- _vm->renderMessage(kStringCypher);
- } else if (verb == ACTION_LOOK && obj1._id == SCRIBBLE2) {
- _gm->animationOff();
- _vm->setCurrentImage(28);
- _vm->renderImage(0);
- _gm->getInput();
- _vm->setCurrentImage(7);
- _vm->renderRoom(*this);
- _gm->drawGUI();
- _gm->_state._addressKnown = true;
- _gm->animationOn();
- } else if (verb == ACTION_LOOK && obj1._id == SIGN) {
- _gm->animationOff();
- _vm->setCurrentImage(38);
- _vm->renderImage(0);
- _gm->getInput();
- _vm->setCurrentImage(7);
- _vm->renderRoom(*this);
- _gm->drawGUI();
- _gm->animationOn();
- } else
- return false;
- return true;
-}
-
-Kiosk::Kiosk(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 19;
- _id = KIOSK;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[5] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringExit, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, STREET, 22);
- _objectState[1] = Object(_id, kStringBooks, kStringDefaultDescription, BOOKS, UNNECESSARY, 0, 0, 0);
- _objectState[2] = Object(_id, kStringDictionary, kStringDefaultDescription, LEXICON, UNNECESSARY, 1, 1, 0);
- _objectState[3] = Object(_id, kStringPlant, kStringDefaultDescription, PLANT, UNNECESSARY, 2, 2, 0);
- _objectState[4] = Object(_id, kStringMask, kStringDefaultDescription, BMASK, UNNECESSARY, 4, 4, 2 + 128);
- _objectState[5] = Object(_id, kStringSnake, kStringDefaultDescription, SNAKE, UNNECESSARY, 3, 3, 0);
- _objectState[6] = Object(_id, kStringCup, kStringDefaultDescription, CUP, UNNECESSARY, 5, 5, 0);
- _objectState[7] = Object(_id, kStringJoystick, kStringDefaultDescription, JOYSTICK, UNNECESSARY, 6, 6, 0);
- _objectState[8] = Object(_id, kStringToothbrush, kStringToothbrushDescription, TOOTHBRUSH, TAKE, 7, 7, 5 + 128);
- _objectState[9] = Object(_id, kStringMusic, kStringMusicDescription, PLAYER, TAKE | COMBINABLE, 8, 8, 4 + 128);
- _objectState[10] = Object(_id, kStringBottle, kStringBottleDescription, BOTTLE, TAKE, 9, 9, 3 + 128);
- _objectState[11] = Object(_id, kStringBottle, kStringDefaultDescription, BOTTLE1, UNNECESSARY, 10, 10, 0);
- _objectState[12] = Object(_id, kStringBottle, kStringDefaultDescription, BOTTLE2, UNNECESSARY, 11, 11, 0);
- _objectState[13] = Object(_id, kStringBottle, kStringDefaultDescription, BOTTLE3, UNNECESSARY, 12, 12, 0);
- _objectState[14] = Object(_id, kStringBottle, kStringDefaultDescription, BOTTLE4, UNNECESSARY, 13, 13, 0);
- _objectState[15] = Object(_id, kStringBox, kStringDefaultDescription, BOX, UNNECESSARY, 14, 14, 0);
- _objectState[16] = Object(_id, kStringFace, kStringDefaultDescription, FACES, UNNECESSARY, 15, 15, 0);
- _objectState[17] = Object(_id, kStringSeller, kStringDefaultDescription, SELLER, TALK, 16, 16, 0);
-}
-
-void Kiosk::onEntrance() {
- static StringId dialEntry[2] = {
- kStringGoodEvening,
- kStringHello
- };
-
- if (!hasSeen()) {
- _gm->dialog(2, _gm->_dials, dialEntry, 0);
- _vm->renderImage(6);
- _vm->playSound(kAudioKiosk);
- _gm->wait(8);
- _vm->renderImage(6 + 128);
- _gm->reply(kStringScaredMe, 1, 1 +128);
- _gm->say(kStringHowSo);
- _gm->reply(kStringDisguise, 1, 1 +128);
- _gm->say(kStringWhatDisguise);
- _gm->reply(kStringStopPretending, 1, 1 +128);
- _gm->reply(kStringYouDisguised, 1, 1 +128);
- _gm->say(kStringIAmHorstHummel);
- _gm->reply(kStringGiveItUp, 1, 1 +128);
- _gm->reply(kStringGestures, 1, 1 +128);
- _gm->reply(kStringMovesDifferently, 1, 1 +128);
- _gm->say(kStringHeIsRobot);
- _gm->reply(kStringYouAreCrazy, 1, 1 +128);
- _gm->say(kStringYouIdiot);
- _gm->reply(kStringShutUp, 1, 1 +128);
- _gm->drawGUI();
- setRoomSeen(true);
- }
-}
-
-void Kiosk::animation() {
-}
-
-bool Kiosk::interact(Action verb, Object &obj1, Object &obj2) {
- static StringId dialPrice[2] = {
- kStringWillTakeIt,
- kStringTooExpensive
- };
- static StringId dialSay[3] = {
- kStringWouldBuy,
- kStringMeHorstHummel,
- kStringHaveMusicChip
- };
- static StringId dialSeller[16][3] = {
- {kStringGreatMask, kStringThreeYears, kNoString},
- {kStringStrongDrink, kNoString, kNoString},
- {kStringMusicDevice, kNoString, kNoString},
- {kStringArtusToothbrush, kStringSellInBulk, kNoString},
- {kStringRarityBooks, kNoString, kNoString},
- {kStringEncyclopedia, kStringLargestDictionary, kStringOver400Words},
- {kStringNotSale, kNoString, kNoString},
- {kStringGaveOne, kStringExcited, kNoString},
- {kStringFromGame, kNoString, kNoString},
- {kStringRobust, kNoString, kNoString},
- {kStringCheapSwill, kNoString, kNoString},
- {kStringCheapSwill, kNoString, kNoString},
- {kStringCheapSwill, kNoString, kNoString},
- {kStringCheapSwill, kNoString, kNoString},
- {kStringStickers, kNoString, kNoString},
- {kStringDishes, kStringUgly, kStringSellsWell}
- };
-
- if (verb == ACTION_TAKE && !(obj1._type & CARRIED) &&
- obj1._id >= BOTTLE && obj1._id <= TOOTHBRUSH) {
- int price = 0;
- switch (obj1._id) {
- case BOTTLE:
- price = 30;
- break;
- case PLAYER:
- price = 50;
- break;
- case TOOTHBRUSH:
- price = 5;
- break;
- default:
- break;
- }
- Common::String format = _vm->getGameString(kStringThatCosts);
- Common::String cost = Common::String::format(format.c_str(), price);
- _vm->renderMessage(cost, kMessageTop);
- _gm->reply(cost.c_str(), 1, 1 +128);
-
- if (_gm->_state._money < price)
- _gm->say(dialPrice[1]);
- else if (_gm->dialog(2, _gm->_dials, dialPrice, 0) == 0) {
- _gm->takeObject(obj1);
- _gm->takeMoney(-price);
- }
- _gm->drawGUI();
- } else if (verb == ACTION_LOOK && obj1._id >= BMASK && obj1._id <= FACES) {
- for(int i = 0; i < 3; i++) {
- _gm->reply(dialSeller[obj1._id - BMASK][i], 1, 1 + 128);
- }
- } else if (verb == ACTION_TALK && obj1._id >= SELLER) {
- int i = 2;
- if (getObject(9)->_type & CARRIED)
- i++;
- switch (_gm->dialog(i, _gm->_dials, dialSay, 0)) {
- case 0:
- _gm->reply(kStringTakeALook, 1, 1 + 128);
- break;
- case 1:
- _gm->reply(kStringNonsense, 1, 1 + 128);
- break;
- case 2:
- _gm->reply(kStringImSorry, 1, 1 + 128);
- break;
- }
- _gm->drawGUI();
- } else
- return false;
- return true;
-}
-
-CulturePalace::CulturePalace(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 20;
- _id = CULTURE_PALACE;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringEntrance, kStringDefaultDescription, NULLOBJECT, EXIT, 1, 1, 0, CHECKOUT, 6);
- _objectState[1] = Object(_id, kStringCulturePalace, kStringFascinating, NULLOBJECT, NULLTYPE, 0, 0, 0);
- _objectState[2] = Object(_id, kStringTaxis, kStringTaxisDescription, NULLOBJECT, NULLTYPE, 3, 3, 0);
- _objectState[3] = Object(_id, kStringAxacussan, kStringDefaultDescription, AXACUSSER, TALK, 4, 4, 0);
- _objectState[4] = Object(_id, kStringParticipationCard, kStringDefaultDescription, CARD, TAKE, 255, 255, 0);
-}
-
-void CulturePalace::onEntrance() {
- setRoomSeen(true);
-}
-
-void CulturePalace::animation() {
- static int i;
- if (isSectionVisible(4))
- setSectionVisible(4, kShownFalse);
- else
- setSectionVisible(4, kShownTrue);
- i--;
- if (i <= 0) {
- if (isSectionVisible(3)) {
- setSectionVisible(3, kShownFalse);
- i = 4;
- } else {
- setSectionVisible(3, kShownTrue);
- i = 10;
- }
- }
- _gm->setAnimationTimer(2);
-}
-
-void CulturePalace::notEnoughMoney() {
- _gm->reply(kStringWhat, 2, 1);
- _gm->reply(kStringNotInformed, 2, 1);
- _vm->renderImage(1 + 128);
- setSectionVisible(2, kShownFalse);
-}
-
-bool CulturePalace::interact(Action verb, Object &obj1, Object &obj2) {
- static StringId dial1[3] = {
- kStringHorstHummel,
- kStringNiceWeather,
- kStringTellTicket,
- };
- static byte dials1[] = {1, 1, 2};
-
- static StringId dial2[2] = {
- kStringHereIsXa,
- kStringYouAreCrazy
- };
- static StringId dial3[4] = {
- kString500Xa,
- kString1000Xa,
- kString5000Xa,
- kString10000Xa
- };
-
- int e;
- if (verb == ACTION_TALK && obj1._id == AXACUSSER) {
- if (_shown[kMaxSection - 3]) {
- _vm->renderImage(1);
- _gm->reply(kStringThankYou, 2, 1);
- } else if (_shown[kMaxSection - 2]) {
- _vm->renderImage(1);
- _gm->reply(kStringWhatYouOffer, 2, 1);
- } else {
- _gm->say(kStringHello2);
- _vm->renderImage(1);
- _gm->reply(kStringWhatYouWant, 2, 1);
- addSentence(1, 1);
- switch (_gm->dialog(3, dials1, dial1, 1)) {
- case 0:
- _gm->reply(kStringWhoAreYou, 2, 1);
- _gm->say(kStringHorstHummel2);
- _gm->reply(kStringNeverHeard, 2, 1);
- _gm->say(kStringYouDontKnow);
- _gm->say(kStringImOnTV);
- _gm->reply(kStringIDontKnow, 2, 1);
- _gm->say(kStringFunny);
- break;
- case 1:
- _gm->reply(kStringAha, 2, 1);
- break;
- case 2:
- _gm->reply(kStringICan, 2, 1);
- _gm->say(kStringFromWhom);
- _gm->reply(kStringCost, 2, 1);
- if(!_gm->_state._money)
- addSentence(2, 1);
- else if (_gm->dialog(2, _gm->_dials, dial2, 0)) {
- _gm->reply(kStringAsYouSay, 2, 1);
- addSentence(2, 1);
- } else {
- _gm->takeMoney(-1);
- _gm->reply(kStringGetCard, 2, 1);
- _gm->reply(kStringOnlyParticipation, 2, 1);
- _gm->say(kStringWhatForIt);
- _gm->reply(kStringMakeOffer, 2, 1);
- _shown[kMaxSection - 2] = true;
- }
- break;
- }
- }
- _vm->renderImage(1 + 128);
- setSectionVisible(2, kShownFalse);
- _gm->drawGUI();
- }
- else if (verb == ACTION_GIVE && obj2._id == AXACUSSER && _shown[kMaxSection - 2]) {
- _vm->renderImage(1);
- if (obj1._id != MONEY)
- notEnoughMoney();
- else {
- if (_gm->_state._money >= 10000) {
- if ((e = _gm->dialog(4, _gm->_dials, dial3, 0)) >= 2) {
- _gm->reply(kStringGoodOffer, 2, 1);
- _vm->playSound(kAudioSuccess);
- _gm->reply(kStringGiveCard, 2, 1);
- if (e == 2)
- _gm->takeMoney(-5000);
- else
- _gm->takeMoney(-10000);
- _gm->takeObject(*getObject(4));
- _vm->renderImage(1 + 128);
- setSectionVisible(2, false);
- _gm->reply(kStringIdiot, 0, 0);
- _shown[kMaxSection - 2] = false;
- _shown[kMaxSection - 3] = true;
- _gm->_rooms[CHECKOUT]->addSentence(1,1);
- _gm->drawGUI();
- } else {
- notEnoughMoney();
- _gm->drawGUI();
- }
- } else
- notEnoughMoney();
- }
- } else
- return false;
- return true;
-}
-
-Checkout::Checkout(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 21;
- _id = CHECKOUT;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringEntrance, kStringDefaultDescription, KP_ENTRANCE, EXIT, 0, 0, 0, NULLROOM, 3);
- _objectState[1] = Object(_id, kStringExit, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, CULTURE_PALACE, 22);
- _objectState[2] = Object(_id, kStringAxacussian, kStringDefaultDescription, AXACUSSER, TALK, 1, 1, 0);
-}
-
-void Checkout::onEntrance() {
- if (!_shown[kMaxSection - 3]) {
- _shown[kMaxSection - 3] = true;
- _gm->reply(kStringAtMusicContest, 1, 1 + 128);
- _gm->say(kStringNoImitation);
- _gm->reply(kStringGoodJoke, 1, 1 + 128);
- _gm->say(kStringIAmHorstHummel);
- _gm->reply(kStringCommon, 1, 1 + 128);
- _gm->say(kStringIWillProof);
- _gm->say(kStringIWillPerform);
- _gm->drawGUI();
- }
- setRoomSeen(true);
-}
-
-void Checkout::animation() {
-}
-
-bool Checkout::interact(Action verb, Object &obj1, Object &obj2) {
- static StringId dialCheckout1[3] = {
- kStringCheckout1,
- kStringCheckout2,
- kStringCheckout3
- };
- static StringId dialCheckout2[2] = {
- kStringYes,
- kStringNo
- };
- static StringId dialStage1[3] = {
- kStringCheckout4,
- kStringCheckout5,
- kStringCheckout6
- };
- static StringId dialStage2[2] = {
- kStringCheckout7,
- kStringCheckout8
- };
- static StringId dialStage3[3] = {
- kStringCheckout9,
- kStringCheckout10,
- kStringCheckout11
- };
- static StringId dialStage4[3] = {
- kStringCheckout12,
- kStringCheckout13
- };
- if (verb == ACTION_WALK && obj1._id == KP_ENTRANCE) {
- if (_shown[kMaxSection - 4]) {
- _vm->renderImage(2);
- _gm->reply(kStringCheckout14, 0, 0);
- _vm->renderImage(2 + 128);
- } else if (_shown[kMaxSection - 2] == 0) {
- _vm->renderImage(2);
- _gm->reply(kStringCheckout15, 0, 0);
- _vm->renderImage(2 + 128);
- if (_gm->_rooms[CULTURE_PALACE]->getObject(4)->_type & CARRIED) {
- _gm->say(kStringCheckout16);
- _gm->reply(kStringCheckout17, 0, 0);
- } else
- _gm->say(kStringCheckout18);
- _gm->drawGUI();
- } else if (_shown[kMaxSection - 2] == 1) {
- _gm->reply(kStringCheckout19, 1, 1 + 128);
- } else {
- if (_gm->_state._tipsy) {
- _vm->setCurrentImage(22);
- _vm->renderImage(0);
- if (_shown[kMaxSection - 5] && _gm->_state._admission >= 2)
- appearance();
- else {
- _gm->dialog(3, _gm->_dials, dialStage1, 0);
- _gm->dialog(2, _gm->_dials, dialStage2, 0);
- _vm->renderMessage(kStringCheckout20, 100, 70);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringCheckout21, 200, 40);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->say(kStringCheckout22);
- _gm->dialog(3, _gm->_dials, dialStage3, 0);
- _vm->renderMessage(kStringCheckout23, 120, 70);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->say(kStringCheckout24);
- _vm->renderMessage(kStringCheckout25, 40, 100);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->dialog(2, _gm->_dials, dialStage4, 0);
- _vm->playSound(kAudioStage1);
- while(_vm->_sound->isPlaying())
- _gm->wait(1);
- _vm->playSound(kAudioStage1);
- while(_vm->_sound->isPlaying())
- _gm->wait(1);
- _vm->playSound(kAudioStage2);
- while(_vm->_sound->isPlaying())
- _gm->wait(1);
- _vm->playSound(kAudioStage2);
- _vm->renderMessage(kStringCheckout26, 250, 80);
- while(_vm->_sound->isPlaying())
- _gm->wait(1);
- _vm->playSound(kAudioStage1);
- while(_vm->_sound->isPlaying())
- _gm->wait(1);
- _vm->removeMessage();
- _vm->playSound(kAudioStage2);
- _vm->renderMessage(kStringCheckout27, 140, 60);
- while(_vm->_sound->isPlaying())
- _gm->wait(1);
- _vm->playSound(kAudioStage2);
- while(_vm->_sound->isPlaying())
- _gm->wait(1);
- _gm->wait(2);
- _vm->removeMessage();
- _vm->playSound(kAudioStage2);
- _vm->renderMessage(kStringCheckout26, 180, 50);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringCheckout28, 50, 110);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->say(kStringCheckout29);
- _vm->renderRoom(*this);
- if (_shown[kMaxSection - 5])
- _vm->renderMessage(kStringCheckout30);
- else
- _vm->renderMessage(kStringCheckout31);
- _shown[kMaxSection - 4] = true;
- _gm->drawGUI();
- }
- } else {
- _vm->renderMessage(kStringCheckout32);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringCheckout33);
- }
- }
- } else if (verb == ACTION_GIVE && obj1._id == CHIP && obj2._id == AXACUSSER &&
- _shown[kMaxSection - 2] == 1) {
- _gm->_inventory.remove(obj1);
- _shown[kMaxSection - 5] = true;
- _gm->reply(kStringCheckout37, 1, 1 + 128);
- _shown[kMaxSection - 2] = 2;
- _gm->drawGUI();
- } else if (verb == ACTION_GIVE && obj1._id == CARD && obj2._id == AXACUSSER) {
- _gm->_inventory.remove(*_gm->_rooms[CULTURE_PALACE]->getObject(4));
- _gm->reply(kStringCheckout34, 1, 1 + 128);
- _gm->reply(kStringCheckout35, 1, 1 + 128);
- if (_gm->dialog(2, _gm->_dials, dialCheckout2, 0) == 1) {
- _gm->reply(kStringCheckout36, 1, 1 + 128);
- _shown[kMaxSection - 2] = 1;
- } else {
- _gm->reply(kStringCheckout37, 1, 1 + 128);
- _shown[kMaxSection - 2] = 2;
- }
- _gm->drawGUI();
- } else if (verb == ACTION_TALK && obj1._id == AXACUSSER) {
- if (_shown[kMaxSection - 4]) {
- _gm->say(kStringCheckout38);
- _gm->reply(kStringCheckout39, 1, 1 + 128);
- _gm->drawGUI();
- } else {
- switch (_shown[kMaxSection - 2]) {
- case 0:
- addSentence(2, 1);
- switch (_gm->dialog(3, _gm->_dials, dialCheckout1, 1)) {
- case 0:
- _gm->reply(kStringCheckout40, 1, 1 + 128);
- _gm->say(kStringNo);
- _gm->reply(kStringCheckout41, 1, 1 + 128);
- _gm->say(kStringCheckout42);
- break;
- case 1:
- _gm->reply(kStringCheckout43, 1, 1 + 128);
- if (_gm->_rooms[CULTURE_PALACE]->getObject(4)->_type & CARRIED) {
- _gm->say(kStringCheckout44);
- return interact(ACTION_GIVE,
- *_gm->_rooms[CULTURE_PALACE]->getObject(4),
- *_gm->_rooms[CHECKOUT]->getObject(2));
- } else {
- _gm->say(kStringNo);
- _gm->reply(kStringCheckout45, 1, 1 + 128);
- _gm->say(kStringCheckout46);
- }
- break;
- case 2:
- _gm->reply(kStringCheckout47, 1, 1 + 128);
- break;
- }
- _gm->drawGUI();
- break;
- case 1:
- _gm->reply(kStringCheckout48, 1, 1 + 128);
- break;
- case 2:
- _gm->reply(kStringCheckout49, 1, 1 + 128);
- break;
- }
- }
- } else
- return false;
- return true;
-}
-
-void Checkout::shouting() {
- static int i = 0;
- switch(i)
- {
- case 50:
- _vm->renderMessage(kStringShout1, 100, 60);
- break;
- case 130:
- _vm->renderMessage(kStringShout2, 50, 90);
- break;
- case 200:
- _vm->renderMessage(kStringShout3, 200, 80);
- break;
- case 300:
- _vm->renderMessage(kStringShout4, 70, 30);
- break;
- case 400:
- _vm->renderMessage(kStringShout5, 190, 90);
- break;
- case 450:
- _vm->renderMessage(kStringShout6, 160, 60);
- break;
- case 500:
- _vm->renderMessage(kStringShout7, 180, 70);
- break;
- case 530:
- _vm->renderMessage(kStringShout8, 50, 20);
- break;
- case 610:
- _vm->renderMessage(kStringShout9, 230, 50);
- break;
- case 650:
- _vm->renderMessage(kStringShout10, 100, 90);
- break;
- case 720:
- _vm->renderMessage(kStringShout11, 176, 65);
- break;
- case 800:
- _vm->renderMessage(kStringShout12, 60, 20);
- break;
- case 850:
- _vm->renderMessage(kStringShout13, 160, 40);
- break;
- case 930:
- _vm->renderMessage(kStringShout14, 60, 95);
- break;
- case 1000:
- _vm->renderMessage(kStringShout15, 100, 65);
- break;
- case 70:
- // fall through
- case 150:
- // fall through
- case 220:
- // fall through
- case 320:
- // fall through
- case 420:
- // fall through
- case 470:
- // fall through
- case 520:
- // fall through
- case 550:
- // fall through
- case 630:
- // fall through
- case 680:
- // fall through
- case 740:
- // fall through
- case 820:
- // fall through
- case 870:
- // fall through
- case 950:
- // fall through
- case 1020:
- _vm->removeMessage();
- break;
- default: {} //do nothing
- }
- i++;
-}
-
-void Checkout::appearance() {
- _vm->_allowSaveGame = false;
- _vm->_allowLoadGame = false;
- int xp = 0;
- CursorMan.showMouse(false);
- _vm->playSound(kMusicMadMonkeys);
- Common::KeyCode k = Common::KEYCODE_INVALID;
- while(_vm->_sound->isPlaying()) {
- if (_gm->waitOnInput(1, k))
- break;
- shouting();
- }
- _vm->_sound->stop();
- _vm->removeMessage();
- CursorMan.showMouse(true);
- _vm->removeMessage();
- _vm->playSound(kAudioAppearance1);
- while (_vm->_sound->isPlaying() && !_vm->shouldQuit())
- _gm->wait(1);
- _vm->paletteFadeOut();
-
- _vm->setCurrentImage(39);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
- _gm->wait(50);
- _vm->setCurrentImage(40);
- _vm->renderImage(0);
- for (int i = 1; i < 11; i++) {
- _gm->wait(3);
- _vm->renderImage(i);
- }
- _vm->playSound(kAudioAppearance2);
- _gm->wait(30);
- _vm->renderImage(11);
- _vm->playSound(kAudioAppearance2);
- _gm->wait(60);
-
- _vm->_system->fillScreen(kColorBlack);
- _vm->setCurrentImage(42);
- _vm->renderImage(0);
- _vm->renderImage(11);
- _gm->talk(1, 1 + 128, 0, kMessageLeft, kStringAppearance1);
- _gm->talk(1, 1 + 128, 0, kMessageLeft, kStringAppearance2);
- _vm->renderImage(4);
- _gm->wait(3);
- _vm->renderImage(6);
- _gm->talk(8, 6, 0, kMessageLeft, kStringAppearance3);
- _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance4);
- _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance5);
- _gm->talk(3, 3 + 128, 0, kMessageRight, kStringAppearance6);
- _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance7);
- _gm->talk(8, 6, 0, kMessageLeft, kStringAppearance8);
- _gm->talk(12, 13, 4, kMessageCenter, kStringAppearance9);
- _vm->renderImage(4);
- _gm->talkRest(12, 13, 1);
- _vm->renderImage(4 + 128);
- _gm->talkRest(12, 13, 4);
- _vm->renderImage(4);
- _gm->talkRest(12, 13, 1);
- _vm->renderImage(6);
- _gm->talkRest(12, 13, _gm->_restTime + 6);
- _vm->removeMessage();
- _gm->talk(3, 3 + 128, 0, kMessageRight, kStringAppearance10);
- _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance11);
- _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance12);
- _gm->talk(3, 3 + 128, 0, kMessageRight, kStringAppearance13);
- _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance14);
- _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance15);
- _gm->talk(3, 3 + 128, 0, kMessageRight, kStringAppearance16);
- _gm->talk(12, 13, 2, kMessageCenter, kStringAppearance17);
- _vm->renderImage(4);
- _gm->talkRest(12, 13, 1);
- _vm->renderImage(4 + 128);
- _gm->talkRest(12, 13, 4);
- _vm->renderImage(4);
- _gm->talkRest(12, 13, 1);
- _vm->renderImage(6);
- _gm->talkRest(12, 13, _gm->_restTime + 6);
- _vm->removeMessage();
- _gm->talk(8, 6, 0, kMessageLeft, kStringAppearance18);
- _gm->talk(12, 13, 1, kMessageCenter, kStringAppearance19);
- _vm->renderImage(4);
- _gm->talkRest(12, 13, 1);
- _vm->renderImage(4 + 128);
- _gm->talkRest(12, 13, 4);
- _vm->renderImage(4);
- _gm->talkRest(12, 13, 1);
- _vm->renderImage(6);
- _gm->talkRest(12, 13, _gm->_restTime + 6);
- _vm->removeMessage();
- _gm->talk(8, 6, 0, kMessageLeft, kStringAppearance20);
- _gm->talk(12, 13, 1, kMessageCenter, kStringAppearance21);
- _vm->renderImage(17);
- _gm->wait(2);
- _vm->renderImage(18);
- _gm->wait(2);
- _vm->renderImage(19);
- _gm->wait(2);
- _vm->renderImage(20);
- _gm->wait(3);
- _vm->renderImage(21);
- _vm->renderImage(19);
- _gm->wait(1);
- _vm->renderImage(21+128);
- _vm->renderImage(22);
- _vm->renderImage(18);
- _gm->wait(1);
- _vm->renderImage(22+128);
- _vm->renderImage(23);
- _gm->wait(1);
- _vm->renderImage(23+128);
- _vm->renderImage(24);
- _vm->renderImage(17);
- _gm->wait(1);
- _vm->renderImage(24+128);
- _vm->renderImage(25);
- _gm->wait(1);
- _vm->renderImage(25+128);
- _vm->renderImage(32);
- _vm->renderImage(11);
- _vm->renderImage(26);
- _vm->playSound(kAudioAppearance3);
- _gm->wait(2);
- _vm->renderImage(32+128);
- _vm->renderImage(33);
- _vm->renderImage(27);
- _gm->wait(2);
- _vm->renderImage(33+128);
- _vm->renderImage(34);
- _vm->renderImage(28);
- _gm->wait(2);
- _vm->renderImage(29);
- _gm->wait(2);
- _vm->renderImage(30);
- _gm->wait(2);
- _vm->renderImage(31);
- _gm->wait(2);
- _gm->wait(50);
- _vm->paletteFadeOut();
-
- _vm->_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(255);
- _vm->_screen->setGuiBrightness(255);
- _vm->paletteBrightness();
- _vm->renderMessage(kStringAppearance22);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringAppearance23);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringAppearance24);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringAppearance25);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringAppearance26);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringAppearance27);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->_screen->setViewportBrightness(0);
- _vm->_screen->setGuiBrightness(0);
- _vm->paletteBrightness();
- _vm->setCurrentImage(44);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
-
- MS2Image *image = _vm->_screen->getCurrentImage();
-
- int i = 0;
- do {
- _vm->renderImage(1);
- _gm->wait(1);
- _vm->renderImage(1 + 128);
- image->_section[1].x1 += xp;
- image->_section[1].x2 += xp;
- image->_section[1].y1 -= 2;
- image->_section[1].y2 -= 2;
- i++;
- if (i == 6) {
- i = 0;
- xp++;
- }
- } while (image->_section[1].y1 < 200);
- _vm->paletteFadeOut();
- _vm->_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(255);
- _vm->_screen->setGuiBrightness(255);
- _vm->paletteBrightness();
- _vm->renderMessage(kStringAppearance28);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringAppearance29);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringAppearance30);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringAppearance31);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->changeRoom(SHIP);
- _gm->_state._dark = true;
- _vm->_screen->setViewportBrightness(1);
- _vm->paletteBrightness();
- _gm->drawGUI();
- _vm->_allowSaveGame = true;
- _vm->_allowLoadGame = true;
-}
-
-City1::City1(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 23;
- _id = CITY1;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringSign, kStringSign1Description, NULLOBJECT, NULLTYPE, 2, 2, 0);
- _objectState[1] = Object(_id, kStringSign, kStringSign2Description, NULLOBJECT, NULLTYPE, 3, 3, 0);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR_L, EXIT | OPENABLE, 0, 0, 1, ELEVATOR, 10);
- _objectState[3] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR_R, EXIT | OPENABLE, 1, 1, 2, ELEVATOR, 14);
-}
-
-void City1::onEntrance() {
- setRoomSeen(true);
-}
-
-void City1::animation() {
-}
-
-bool City1::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_OPEN && obj1._id == DOOR_L) {
- _objectState[0]._click = 255;
- } else if (verb == ACTION_CLOSE && obj1._id == DOOR_L) {
- _objectState[0]._click = 2;
- } else if (verb == ACTION_OPEN && obj1._id == DOOR_R) {
- _objectState[1]._click = 255;
- } else if (verb == ACTION_CLOSE && obj1._id == DOOR_R) {
- _objectState[1]._click = 3;
- } else if (verb == ACTION_WALK && obj1._id == DOOR_L) {
- _gm->_state._elevatorNumber = 1;
- } else if (verb == ACTION_WALK && obj1._id == DOOR_R) {
- _gm->_state._elevatorNumber = 2;
- }
- _gm->_rooms[ELEVATOR]->getObject(5)->_exitRoom = CITY1;
- _gm->_state._elevatorE = 0;
- return false;
-}
-
-City2::City2(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 23;
- _id = CITY2;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringSign, kStringSign3Description, NULLOBJECT, NULLTYPE, 2, 2, 0);
- _objectState[1] = Object(_id, kStringSign, kStringSign4Description, NULLOBJECT, NULLTYPE, 3, 3, 0);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR_L, EXIT | OPENABLE, 0, 0, 1, ELEVATOR, 10);
- _objectState[3] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR_R, EXIT | OPENABLE, 1, 1, 2, ELEVATOR, 14);
-}
-
-void City2::onEntrance() {
- setRoomSeen(true);
-}
-
-void City2::animation() {
-}
-
-bool City2::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_OPEN && obj1._id == DOOR_L) {
- _objectState[0]._click = 255;
- } else if (verb == ACTION_CLOSE && obj1._id == DOOR_L) {
- _objectState[0]._click = 2;
- } else if (verb == ACTION_OPEN && obj1._id == DOOR_R) {
- _objectState[1]._click = 255;
- } else if (verb == ACTION_CLOSE && obj1._id == DOOR_R) {
- _objectState[1]._click = 3;
- } else if (verb == ACTION_WALK && obj1._id == DOOR_L) {
- _gm->_state._elevatorNumber = 3;
- } else if (verb == ACTION_WALK && obj1._id == DOOR_R) {
- _gm->_state._elevatorNumber = 4;
- }
- _gm->_rooms[ELEVATOR]->getObject(5)->_exitRoom = CITY2;
- _gm->_state._elevatorE = 0;
- return false;
-}
-
-Elevator::Elevator(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 24;
- _id = ELEVATOR;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringSlot, kStringDefaultDescription, SLOT, COMBINABLE, 0, 0, 0);
- _objectState[1] = Object(_id, kStringBell, kStringDefaultDescription, BELL, PRESS, 1, 1, 0);
- _objectState[2] = Object(_id, kStringDisplay, kStringDefaultDescription, DISPLAY, NULLTYPE, 2, 2, 0);
- _objectState[3] = Object(_id, kStringKeypad, kStringKeypadDescription, KEYPAD, PRESS, 3, 3, 0);
- _objectState[4] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | CLOSED, 4, 4, 0, APARTMENT, 3);
- _objectState[5] = Object(_id, kStringExit, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED | CLOSED, 255, 255, 0, CITY1, 22);
-}
-
-void Elevator::onEntrance() {
- if (_gm->_state._elevatorE)
- _objectState[5]._type &= ~OPENED;
- else
- _objectState[5]._type |= OPENED;
-}
-
-void Elevator::animation() {
-}
-
-bool Elevator::interact(Action verb, Object &obj1, Object &obj2) {
- static StringId dialLuke1[4] = {
- kStringElevator2,
- kStringElevator3,
- kStringElevator4,
- kStringElevator5
- };
- static byte dialsLuke1[3] = {2,1,1};
- static StringId dialBoss1[2] = {
- kStringElevator6,
- kStringElevator7
- };
- Common::String input;
-
- if (verb == ACTION_LOOK && obj1._id == DISPLAY) {
- Common::String format = _vm->getGameString(kStringElevator1);
- Common::String display =
- Common::String::format(format.c_str(), _gm->_state._elevatorE);
- _vm->renderMessage(display);
- } else if (verb == ACTION_PRESS && obj1._id == BELL) {
- _vm->renderImage(8);
- _vm->playSound(kAudioElevatorBell);
- while(_vm->_sound->isPlaying())
- _gm->wait(1);
- _vm->renderImage(8 + 128);
- if (_gm->_state._elevatorNumber == 4 && _gm->_state._elevatorE == 4 && !_gm->_state._toMuseum) {
- _gm->wait(18);
- _vm->renderImage(1);
- _gm->wait(3);
- _vm->renderImage(2);
- setSectionVisible(1, kShownFalse);
- _gm->wait(3);
- _vm->renderImage(3);
- setSectionVisible(2, kShownFalse);
- _gm->reply(kStringWhatYouWant, 4, 3);
- switch (_gm->dialog(3, dialsLuke1, dialLuke1, 1)) {
- case 0:
- _gm->reply(kStringElevator11, 4, 3);
- _vm->renderImage(2);
- setSectionVisible(3, kShownFalse);
- _gm->wait(3);
- _vm->renderImage(1);
- setSectionVisible(2, kShownFalse);
- _gm->wait(3);
- _vm->renderImage(1 + 128);
- _vm->renderMessage(kStringElevator12);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderImage(1);
- _gm->wait(3);
- _vm->renderImage(2);
- setSectionVisible(1, kShownFalse);
- _gm->wait(3);
- _vm->renderImage(3);
- setSectionVisible(2, kShownFalse);
- _gm->reply(kStringElevator13, 4, 3);
- setSectionVisible(3, kShownFalse);
- setSectionVisible(4, kShownFalse);
- _vm->paletteFadeOut();
- _vm->_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(255);
- _vm->renderMessage(kStringElevator14);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->_screen->setViewportBrightness(0);
- _vm->setCurrentImage(26);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
- _gm->reply(kStringElevator15, 1, 1 + 128);
- _gm->say(kStringYes);
- _gm->reply(kStringElevator16, 1, 1 + 128);
- _gm->reply(kStringElevator17, 1, 1 + 128);
- if (_gm->dialog(2, _gm->_dials, dialBoss1, 0)) {
- _gm->reply(kStringElevator18, 1, 1 + 128);
- _gm->reply(kStringElevator19, 1, 1 + 128);
- _gm->say(kStringElevator20);
- }
- _gm->reply(kStringElevator21, 1, 1 + 128);
- _gm->reply(kStringElevator22, 1, 1 + 128);
- _gm->reply(kStringElevator23, 1, 1 + 128);
- _gm->reply(kStringElevator24, 1, 1 + 128);
- _gm->reply(kStringElevator25, 1, 1 + 128);
- _gm->reply(kStringElevator26, 1, 1 + 128);
- _gm->reply(kStringElevator27, 1, 1 + 128);
- _gm->reply(kStringElevator28, 1, 1 + 128);
- jobDescription();
- return true;
- case 1:
- _gm->reply(kStringElevator59, 4, 3);
- _vm->renderImage(2);
- setSectionVisible(3, kShownFalse);
- setSectionVisible(4, kShownFalse);
- _gm->wait(3);
- _vm->renderImage(1);
- setSectionVisible(2, kShownFalse);
- _vm->renderImage(1 + 128);
- break;
- case 2:
- _gm->reply(kStringElevator60, 4, 3);
- _vm->renderImage(2);
- setSectionVisible(3, kShownFalse);
- setSectionVisible(4, kShownFalse);
- _gm->wait(3);
- _vm->renderImage(1);
- setSectionVisible(2, kShownFalse);
- _vm->renderImage(1 + 128);
- break;
- }
- _gm->drawGUI();
- } else
- _vm->renderMessage(kStringElevator61);
- } else if ((verb == ACTION_USE || verb == ACTION_PRESS) && obj1._id == KEYPAD) {
- _vm->renderMessage(kStringElevator62);
- do {
- _gm->edit(input, 237, 66, 2);
- } while ((_gm->_key.keycode != Common::KEYCODE_RETURN) &&
- (_gm->_key.keycode != Common::KEYCODE_ESCAPE) && !_vm->shouldQuit());
- _vm->removeMessage();
- if (_gm->_key.keycode == Common::KEYCODE_RETURN && input[0] != 0) {
- for (unsigned i = 0; i < input.size(); i++) {
- if (input[i] < '0' || input[i] > '9') {
- _vm->renderMessage(kStringElevator63);
- return true;
- }
- }
- int64 number = input.asUint64();
- if (number > 60)
- _vm->renderMessage(kStringElevator63);
- else if (number != _gm->_state._elevatorE) {
- if (isSectionVisible(6)) {
- _vm->renderImage(6 + 128);
- _objectState[4]._type &= ~OPENED;
- _vm->playSound(kAudioElevator1);
- }
- _vm->renderMessage(kStringElevator64);
- _gm->_state._elevatorE = number;
- if (number)
- _objectState[5]._type &= ~OPENED;
- else
- _objectState[5]._type |= OPENED;
- }
- }
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, ID_CARD, SLOT)) {
- if (_gm->_state._elevatorNumber == 1 && _gm->_state._elevatorE == 32) {
- _vm->renderImage(6);
- _objectState[4]._type |= OPENED;
- _vm->playSound(kAudioTaxiOpen);
- } else
- _vm->renderMessage(kStringElevator65);
- } else
- return false;
- return true;
-}
-
-void Elevator::jobDescription() {
- static StringId dialBoss2[3] = {
- kStringElevator8,
- kStringElevator9,
- kStringElevator10
- };
- byte dialsBoss2[4] = {1,1,1,1};
-
- _gm->reply(kStringElevator29, 1, 1 + 128);
- _gm->reply(kStringElevator30, 1, 1 + 128);
- _gm->reply(kStringElevator31, 1, 1 + 128);
- _gm->reply(kStringElevator32, 1, 1 + 128);
- _vm->setCurrentImage(30);
- _vm->renderImage(0);
- _gm->waitOnInput(72);
- _gm->reply(kStringElevator33, 0, 0);
- _gm->reply(kStringElevator34, 0, 0);
- _gm->reply(kStringElevator35, 0, 0);
- _gm->reply(kStringElevator36, 0, 0);
- _gm->reply(kStringElevator37, 0, 0);
- _gm->reply(kStringElevator38, 0, 0);
- _gm->reply(kStringElevator39, 0, 0);
- _gm->reply(kStringElevator40, 0, 0);
- _gm->reply(kStringElevator41, 0, 0);
- _gm->reply(kStringElevator42, 0, 0);
- _gm->reply(kStringElevator43, 0, 0);
- _gm->reply(kStringElevator44, 0, 0);
- _gm->reply(kStringElevator45, 0, 0);
- _gm->reply(kStringElevator46, 0, 0);
- _gm->reply(kStringElevator47, 0, 0);
- _gm->reply(kStringElevator48, 0, 0);
- _vm->setCurrentImage(26);
- _vm->_system->fillScreen(kColorBlack);
- _vm->renderImage(0);
- _gm->reply(kStringElevator49, 1, 1 + 128);
- int e;
- do {
- addSentence(0, 2);
- switch (e = _gm->dialog(4, dialsBoss2, dialBoss2, 2)) {
- case 0:
- _gm->reply(kStringElevator50, 1, 1 + 128);
- jobDescription();
- return;
- case 1:
- _gm->reply(kStringElevator51, 1, 1 + 128);
- break;
- case 2:
- _gm->reply(kStringElevator52, 1, 1 + 128);
- break;
- }
- if (e == 1 || e == 2)
- _gm->reply(kStringElevator53, 1, 1 + 128);
- } while (e != 3);
- _gm->reply(kStringElevator54, 1, 1 + 128);
- _vm->paletteFadeOut();
- _vm->_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(255);
- _vm->renderMessage(kStringElevator55);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->_screen->setViewportBrightness(0);
- _gm->_state._tipsy = false;
- _gm->_state._toMuseum = true;
- _vm->saveGame(kSleepAutosaveSlot, "autosave");
- _gm->_inventory.clear();
- _gm->takeObject(*_gm->_rooms[INTRO]->getObject(3));
- _gm->takeObject(*_gm->_rooms[INTRO]->getObject(5));
- _gm->takeObject(*_gm->_rooms[INTRO]->getObject(6));
- _gm->takeObject(*_gm->_rooms[INTRO]->getObject(8));
- _vm->setCurrentImage(29);
- _gm->changeRoom(MUSEUM);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
- _vm->renderMessage(kStringElevator56);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringElevator57);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringElevator58);
- _gm->drawGUI();
-
- // 21:72:72
- _gm->_state._startTime = g_system->getMillis() - 130363200;
-}
-
-Apartment::Apartment(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 25;
- _id = APARTMENT;
- _shown[0] = kShownTrue;
- _shown[3] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringChip, kStringChipDescription, CHIP, TAKE | COMBINABLE, 255, 255, 1);
- _objectState[1] = Object(_id, kStringHatch, kStringHatchDescription, HATCH, OPENABLE | CLOSED | COMBINABLE, 0, 1, 1);
- _objectState[2] = Object(_id, kStringDefaultDescription, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 255, 255, 0);
- _objectState[3] = Object(_id, kStringMusicSystem, kStringMusicSystemDescription, MUSIC_SYSTEM, COMBINABLE, 4, 4, 0);
- _objectState[4] = Object(_id, kStringSpeakers, kStringSpeakersDescription, NULLOBJECT, NULLTYPE, 5, 5, 0);
- _objectState[5] = Object(_id, kStringPencils, kStringPencilsDescription, NULLOBJECT, UNNECESSARY, 6, 6, 0);
- _objectState[6] = Object(_id, kStringMetalBlocks, kStringMetalBlocksDescription, MAGNET, TAKE | COMBINABLE, 10, 10, 3 + 128);
- _objectState[7] = Object(_id, kStringImage, kStringImageDescription, NULLOBJECT, UNNECESSARY, 7, 7, 0);
- _objectState[8] = Object(_id, kStringCabinet, kStringCabinetDescription, CABINET, OPENABLE | CLOSED, 8, 8, 0);
- _objectState[9] = Object(_id, kStringChair, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 9, 9, 0);
- _objectState[10] = Object(_id, kStringElevator, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, ELEVATOR, 22);
- _objectState[11] = Object(_id, kStringUnderBed, kStringUnderBedDescription, UNDER_BED, NULLTYPE, 11, 11, 0);
- _objectState[12] = Object(_id, kStringKey, kStringKeyDescription, KEY, TAKE | COMBINABLE, 255, 255, 0);
-}
-
-void Apartment::onEntrance() {
- setRoomSeen(true);
-}
-
-void Apartment::animation() {
-}
-
-bool Apartment::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_USE && Object::combine(obj1, obj2, ROD, UNDER_BED)) {
- if (_objectState[12]._type & CARRIED)
- _vm->renderMessage(kStringApartment1);
- else if (_shown[kMaxSection - 1]) {
- _vm->renderMessage(kStringApartment2);
- _gm->takeObject(_objectState[12]);
- _vm->playSound(kAudioSuccess);
- } else {
- _vm->renderMessage(kStringApartment3);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringApartment4);
- }
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, KEY, HATCH)) {
- if (_objectState[1]._type & OPENED)
- _vm->renderMessage(kStringApartment5);
- else {
- _vm->renderImage(1);
- _vm->playSound(kAudioTaxiOpen);
- _objectState[1]._type |= OPENED;
- _objectState[1]._click = 1;
- if (!(_objectState[0]._type & CARRIED)) {
- _vm->renderImage(2);
- _objectState[0]._click = 2;
- }
- }
- } else if (verb == ACTION_CLOSE && obj1._id == HATCH && obj1._type & OPENED) {
- _vm->renderImage(1 + 128);
- setSectionVisible(2, false);
- _vm->playSound(kAudioElevator1);
- obj1._type &= ~OPENED;
- obj1._click = 0;
- if (!(_objectState[0]._type & CARRIED))
- _objectState[0]._click = 255;
- } else if (verb == ACTION_TAKE && obj1._id == CHIP && !(obj1._type & CARRIED)) {
- setSectionVisible(2, kShownFalse);
- return false;
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, KEY, CABINET)) {
- _vm->renderMessage(kStringApartment6);
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, CHIP, MUSIC_SYSTEM)) {
- _vm->renderMessage(kStringApartment7);
- } else if (verb == ACTION_PRESS && obj1._id == MUSIC_SYSTEM) {
- _vm->renderMessage(kStringApartment8);
- } else
- return false;
- return true;
-}
-
-Ship::Ship(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 45;
- _id = SHIP;
- _shown[0] = kShownTrue;
- _shown[8] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringSwitch, kStringDefaultDescription, SWITCH, PRESS | COMBINABLE, 0, 0, 0);
- _objectState[1] = Object(_id, kStringHandle, kStringDefaultDescription, HANDLE, NULLTYPE, 255, 255, 0);
- _objectState[2] = Object(_id, kStringHatch2, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 255, 255, 0, SHIP, 19);
- _objectState[3] = Object(_id, kStringSwitch, kStringDefaultDescription, DOOR_SWITCH, PRESS | COMBINABLE, 255, 255, 0);
- _objectState[4] = Object(_id, kStringSpaceSuit, kStringSpaceSuitDescription, SUIT, TAKE, 255, 255, 1);
- _objectState[5] = Object(_id, kStringCable, kStringCableDescription1, RCABLE, COMBINABLE, 255, 255, 0);
- _objectState[6] = Object(_id, kStringCable, kStringCableDescription2, CABLE, TAKE | COMBINABLE, 255, 255, 8 + 128);
-
- _outroText =
- _vm->getGameString(kStringIntro1) + '\0' +
- _vm->getGameString(kStringIntro2) + '\0' +
- _vm->getGameString(kStringIntro3) + '\0' +
- _vm->getGameString(kStringIntro4) + '\0' +
- _vm->getGameString(kStringIntro5) + '\0' +
- "^Matthias Neef#" + '\0' +
- "^Sascha Otterbach#" + '\0' +
- "^Thomas Mazzoni#" + '\0' +
- "^Matthias Klein#" + '\0' +
- "^Gerrit Rothmaier#" + '\0' +
- "^Thomas Hassler#" + '\0' +
- "^Rene Kach#" + '\0' +
- '\233' + '\0';
- Common::String waitString = "##################";
- _outroText2 =
- waitString + '\0' +
- _vm->getGameString(kStringOutro1) + '\0' +
- _vm->getGameString(kStringOutro2) + '\0' +
- _vm->getGameString(kStringOutro3) + '\0' +
- _vm->getGameString(kStringOutro4) + '\0' +
- _vm->getGameString(kStringOutro5) + '\0' +
- '\233' + '\0';
-}
-
-void Ship::onEntrance() {
- setRoomSeen(true);
-}
-
-void Ship::animation() {
-}
-
-bool Ship::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_PRESS && obj1._id == SWITCH) {
- if (_gm->_state._dark) {
- _gm->_state._dark = false;
- _vm->_screen->setViewportBrightness(255);
- _objectState[1]._click = 1;
- _objectState[2]._click = 2;
- _objectState[3]._click = 3;
- _objectState[5]._click = 4;
- _objectState[6]._click = 5;
- _objectState[2]._type = EXIT | OPENABLE | CLOSED;
- _gm->drawMapExits();
- }
- } else if (verb == ACTION_PRESS && obj1._id == DOOR_SWITCH &&
- !isSectionVisible(7)) {
- _vm->renderImage(3);
- _gm->wait(2);
- _vm->renderImage(6);
- _vm->playSound(kAudioShip1);
- while (_vm->_sound->isPlaying() && !_vm->shouldQuit())
- _gm->wait(1);
- _vm->renderImage(6 + 128);
- _vm->renderImage(7);
- _objectState[3]._description = kStringShip1;
- _objectState[2]._description = kStringShip2;
- } else if (verb == ACTION_PULL && obj1._id == HANDLE) {
- _vm->renderImage(2);
- _vm->playSound(kAudioTaxiOpen);
- obj1._click = 255;
- _objectState[4]._click = 9;
- } else if (verb == ACTION_TAKE && obj1._id == SUIT && !(obj1._type & CARRIED)) {
- setSectionVisible(2, kShownFalse);
- _gm->takeObject(obj1);
- } else if (verb == ACTION_USE && obj1._id == SUIT) {
- if (!(obj1._type & CARRIED)) {
- setSectionVisible(2, kShownFalse);
- _gm->takeObject(obj1);
- }
- if ((_shown[kMaxSection - 1] = !_shown[kMaxSection - 1]))
- _vm->renderMessage(kStringShip3);
- else
- _vm->renderMessage(kStringShip4);
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, CABLE, RCABLE)) {
- _objectState[6]._description = kStringDefaultDescription;
- if (_objectState[6]._click == 5)
- _vm->renderImage(8 + 128);
- if (_objectState[6]._type & CARRIED)
- _gm->_inventory.remove(_objectState[6]);
- if (isSectionVisible(11) || isSectionVisible(10))
- _vm->renderMessage(kStringShip5);
- else if (isSectionVisible(9)) {
- _vm->renderImage(9 + 128);
- _vm->renderImage(11);
- if (!_shown[kMaxSection - 1])
- kill();
- _objectState[6]._click = 8;
- _gm->wait(2);
- _vm->renderImage(4);
- _vm->playSound(kAudioShip2);
- _gm->wait(3);
- _vm->renderImage(5);
- _objectState[2]._type |= OPENED;
- _objectState[2]._description = kStringDefaultDescription;
- } else {
- _vm->renderImage(10);
- if (!_shown[kMaxSection - 1])
- kill();
- _objectState[6]._click = 7;
- }
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, CABLE, DOOR_SWITCH) && isSectionVisible(7)) {
- _objectState[6]._description = kStringDefaultDescription;
- if (_objectState[6]._click == 5)
- _vm->renderImage(8 + 128);
- if (_objectState[6]._type & CARRIED)
- _gm->_inventory.remove(_objectState[6]);
- if (isSectionVisible(11) || isSectionVisible(9))
- _vm->renderMessage(kStringShip5);
- else if (isSectionVisible(10)) {
- _vm->renderImage(10 + 128);
- _vm->renderImage(11);
- if (!_shown[kMaxSection - 1])
- kill();
- _objectState[6]._click = 8;
- _gm->wait(2);
- _vm->renderImage(4);
- _vm->playSound(kAudioShip2);
- _gm->wait(3);
- _vm->renderImage(5);
- _objectState[2]._type |= OPENED;
- _objectState[2]._description = kStringDefaultDescription;
- } else {
- _vm->renderImage(9);
- _objectState[6]._click = 6;
- }
- } else if (verb == ACTION_TAKE && obj1._id == CABLE && obj1._type & CARRIED) {
- if (isSectionVisible(8)) {
- obj1._description = kStringDefaultDescription;
- _gm->takeObject(obj1);
- } else
- _vm->renderMessage(kStringShip6);
- } else if (verb == ACTION_WALK && obj1._type == (EXIT | OPENABLE | CLOSED | OPENED)) {
- _vm->setCurrentImage(46);
- _vm->renderImage(0);
- _gm->wait(16);
- _vm->renderMessage(kStringShip7, kMessageRight);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->reply(kStringShip8, 1, 1 + 128);
- _vm->renderMessage(kStringShip9, kMessageRight);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->reply(kStringShip10, 1, 1 + 128);
- _gm->reply(kStringShip11, 1, 1 + 128);
- _gm->reply(kStringShip12, 1, 1 + 128);
- _gm->reply(kStringShip13, 1, 1 + 128);
- _vm->renderMessage(kStringShip14, kMessageRight);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->reply(kStringShip15, 1, 1 + 128);
- _vm->renderMessage(kStringShip16, kMessageRight);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->reply(kStringAha, 1, 1 + 128);
- _gm->reply(kStringShip17, 1, 1 + 128);
- _vm->renderMessage(kStringShip18, kMessageRight);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->reply(kStringShip19, 1, 1 + 128);
- _gm->wait(16);
- CursorMan.showMouse(false);
- _vm->renderImage(2);
- for (int i = 3; i < 12; i++) {
- _vm->renderImage(i);
- if (i == 9)
- _vm->playSound(kAudioShip3);
- _gm->wait(2);
- _vm->renderImage(i + 128);
- }
- _vm->renderImage(12);
- _gm->wait(18);
- // TODO some palette stuff
- outro();
- } else
- return false;
- return true;
-}
-
-void Ship::outro() {
- _vm->_screen->paletteFadeOut(100);
- _vm->renderImage(13);
- // Because the screen is partialy faded out, the original values (63, 20, 20)
- // should be multiplied by 2.55, but are multiplied by 3.5, because the color
- // looks closer to the original
- byte palette[768];
- _vm->_system->getPaletteManager()->grabPalette(palette, 0, 255);
- palette[282] = 220;
- palette[283] = 70;
- palette[284] = 70;
- // Restore marquee colors
- for (int i = 0; i < 3; i++) {
- palette[kColorPurple * 3 + i] *= 2.5;
- palette[kColorLightYellow * 3 + i] *= 2.5;
- }
- _vm->_system->getPaletteManager()->setPalette(palette, 0, 255);
- _vm->playSound(kMusicMadMonkeys);
- _vm->renderBox(0, 190, 320, 10, kColorBlack);
- Marquee marquee(_vm->_screen, Marquee::kMarqueeOutro, _outroText.c_str());
- for(int i = 0; i < 2; i++) {
- while (!_vm->shouldQuit()) {
- _gm->updateEvents();
-
- if (!marquee.renderCharacter() || _gm->_mouseClicked || _gm->_keyPressed)
- break;
- g_system->updateScreen();
- g_system->delayMillis(_vm->_delay);
- }
- marquee.reset();
- }
- Marquee marquee2(_vm->_screen, Marquee::kMarqueeOutro, _outroText2.c_str());
- while (!_vm->shouldQuit()) {
- _gm->updateEvents();
-
- if (!marquee2.renderCharacter() || _gm->_mouseClicked || _gm->_keyPressed)
- break;
- g_system->updateScreen();
- g_system->delayMillis(_vm->_delay);
- }
- // TODO: End with some end of music
- int volume;
- do {
- volume = _vm->_sound->getVolume() - 10;
- _vm->_sound->setVolume(volume);
- _gm->waitOnInput(1);
- } while (volume > 10 && !_vm->shouldQuit());
- Common::Event event;
- event.type = Common::EVENT_RTL;
- _vm->getEventManager()->pushEvent(event);
-}
-
-void Ship::kill() {
- _vm->playSound(kAudioShipDeath);
- while (_vm->_sound->isPlaying() && !_vm->shouldQuit())
- _gm->wait(1);
- _gm->dead(kStringShip0);
-}
-
-Pyramid::Pyramid(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 8;
- _id = PYRAMID;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, TAKE | COMBINABLE, 255, 255, 1 + 128);
- _objectState[1] = Object(_id, kStringSign, kStringSignDescription, SIGN, COMBINABLE, 25, 25, 0);
- _objectState[2] = Object(_id, kStringEntrance, kStringEntrance1Description, PYRA_ENTRANCE, EXIT, 27, 27, 0, PYR_ENTRANCE, 7);
- _objectState[3] = Object(_id, kStringPyramid, kStringPyramidDescription, NULLOBJECT, NULLTYPE, 26, 26, 0);
- _objectState[4] = Object(_id, kStringSun, kStringSunDescription, SUN, NULLTYPE, 28, 28, 0);
- _objectState[5] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE1, COMBINABLE, 0, 0, 0);
- _objectState[6] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE2, COMBINABLE, 1, 0, 0);
- _objectState[7] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE3, COMBINABLE, 2, 0, 0);
- _objectState[8] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE4, COMBINABLE, 3, 0, 0);
- _objectState[9] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE5, COMBINABLE, 4, 0, 0);
- _objectState[10] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE6, COMBINABLE, 5, 0, 0);
- _objectState[11] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE7, COMBINABLE, 6, 0, 0);
- _objectState[12] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE8, COMBINABLE, 7, 0, 0);
- _objectState[13] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE9, COMBINABLE, 8, 0, 0);
- _objectState[14] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE10, COMBINABLE, 9, 0, 0);
- _objectState[15] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE11, COMBINABLE, 10, 0, 0);
- _objectState[16] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE12, COMBINABLE, 11, 0, 0);
- _objectState[17] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE13, COMBINABLE, 12, 0, 0);
- _objectState[18] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE14, COMBINABLE, 13, 0, 0);
- _objectState[19] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE15, COMBINABLE, 14, 0, 0);
- _objectState[20] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE16, COMBINABLE, 15, 0, 0);
- _objectState[21] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE17, COMBINABLE, 16, 0, 0);
- _objectState[22] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE18, COMBINABLE, 17, 0, 0);
- _objectState[23] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE19, COMBINABLE, 18, 0, 0);
- _objectState[24] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE20, COMBINABLE, 19, 0, 0);
- _objectState[25] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE21, COMBINABLE, 20, 0, 0);
- _objectState[26] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE22, COMBINABLE, 21, 0, 0);
- _objectState[27] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE23, COMBINABLE, 22, 0, 0);
- _objectState[28] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE24, COMBINABLE, 23, 0, 0);
- _objectState[29] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE25, COMBINABLE, 24, 0, 0);
-}
-
-void Pyramid::onEntrance() {
- setRoomSeen(true);
-}
-
-void Pyramid::animation() {
-}
-
-bool Pyramid::interact(Action verb, Object &obj1, Object &obj2) {
- Object *rope, *hole;
- rope = hole = nullptr;
-
- if (obj1._id == ROPE)
- rope = &obj1;
- if (obj2._id == ROPE)
- rope = &obj2;
- if (obj1._id >= HOLE1 && obj1._id <= HOLE25)
- hole = &obj1;
- if (obj2._id >= HOLE1 && obj2._id <= HOLE25)
- hole = &obj2;
-
- if (verb == ACTION_WALK && obj1._id == PYRA_ENTRANCE) {
- _gm->_state._eventCallback = kPyramidEndFn;
- _gm->_state._eventTime = g_system->getMillis() + 3600000; //hour
- _gm->_state._pyraS = 4;
- _gm->_state._pyraZ = 10;
- _gm->_state._pyraDirection = 0;
- _gm->passageConstruction();
- return false;
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, ROPE, SIGN)) {
- if (rope->_type & CARRIED) {
- _vm->renderImage(1);
- _gm->_inventory.remove(*rope);
- _objectState[0]._click = 29;
- } else
- _vm->renderMessage(kStringPyramid1);
- } else if (verb == ACTION_USE && hole != nullptr && rope != nullptr) {
- if (rope->_type & CARRIED)
- _vm->renderMessage(kStringPyramid2);
- else {
- int number = hole->_id - HOLE1;
- int start = number / 5 * 5 + 2;
- for (int i = 1; i <= 26; i++)
- _vm->renderImage(i + 128);
- for (int i = start; i <= start + number % 5; i++)
- _vm->renderImage(i);
- _objectState[0]._click = 30;
- if (number == 18) {
- _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownTrue);
- _gm->_rooms[HOLE_ROOM]->getObject(2)->_click = 5;
- _gm->_rooms[HOLE_ROOM]->getObject(3)->_type = EXIT;
- } else {
- _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownFalse);
- _gm->_rooms[HOLE_ROOM]->getObject(2)->_click = 255;
- _gm->_rooms[HOLE_ROOM]->getObject(3)->_type = NULLTYPE;
- }
- }
- } else if (verb == ACTION_PULL && rope != nullptr && !(rope->_type & CARRIED) &&
- !isSectionVisible(1)) {
- for (int i = 2; i <= 26; i++)
- _vm->renderImage(i + 128);
- _vm->renderImage(1);
- _objectState[0]._click = 29;
- _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownFalse);
- _gm->_rooms[HOLE_ROOM]->getObject(2)->_click = 255;
- _gm->_rooms[HOLE_ROOM]->getObject(3)->_type = NULLTYPE;
- } else if (verb == ACTION_TAKE && rope != nullptr && !(rope->_type & CARRIED)) {
- for (int i = 2; i <= 26; i++)
- _vm->renderImage(i + 128);
- _gm->takeObject(*rope);
- _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownFalse);
- _gm->_rooms[HOLE_ROOM]->getObject(2)->_click = 255;
- _gm->_rooms[HOLE_ROOM]->getObject(3)->_type = NULLTYPE;
- } else if (verb == ACTION_WALK && obj1._id == SUN) {
- _vm->renderMessage(kStringPyramid3);
- } else
- return false;
- return true;
-}
-
-PyrEntrance::PyrEntrance(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 9;
- _id = PYR_ENTRANCE;
- _shown[0] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[8] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringSign, kStringSign5Description, SIGN, NULLTYPE, 255, 255, 0);
- _objectState[1] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[2] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[3] = Object(_id, kStringCorridor, kStringDefaultDescription, CORRIDOR, EXIT, 0, 0, 0, PYR_ENTRANCE, 2);
-}
-
-void PyrEntrance::onEntrance() {
- if (_gm->_state._pyraS == 8 && _gm->_state._pyraZ == 5) {
- _gm->setAnimationTimer(1);
- _waitTime = g_system->getMillis() + 60000;
- }
-}
-
-void PyrEntrance::animation() {
- if (_gm->_state._pyraS == 8 && _gm->_state._pyraZ == 5) {
- if (g_system->getMillis() >= _waitTime) { // around 1 minute
- _vm->renderMessage(kStringPyramid4);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _gm->_state._pyraZ++;
- _gm->_state._pyraDirection = 0;
- _gm->changeRoom(FLOORDOOR);
- _vm->setCurrentImage(14);
- _vm->renderRoom(*_gm->_rooms[FLOORDOOR]);
- _gm->drawMapExits();
- _gm->wait(3);
- _vm->renderImage(5);
- _gm->wait(3);
- _vm->renderImage(6);
- _gm->_rooms[FLOORDOOR]->setSectionVisible(5, kShownFalse);
- _gm->wait(3);
- _vm->renderImage(7);
- _gm->_rooms[FLOORDOOR]->setSectionVisible(6, kShownFalse);
- _gm->wait(3);
- _vm->renderImage(8);
- _gm->_rooms[FLOORDOOR]->setSectionVisible(7, kShownFalse);
- _gm->wait(3);
- _vm->renderImage(9);
- _gm->_rooms[FLOORDOOR]->setSectionVisible(8, kShownFalse);
- _vm->playSound(kAudioShip3);
- _gm->screenShake();
- _gm->_rooms[FLOORDOOR]->setSectionVisible(kMaxSection - 1, kShownTrue);
- } else {
- _gm->setAnimationTimer(1);
- }
- } else
- _gm->setAnimationTimer(kMaxTimerValue);
-}
-
-bool PyrEntrance::interact(Action verb, Object &obj1, Object &obj2) {
- static RoomEntry roomTab[29] = {
- {2, 8, 6, 0, FLOORDOOR},
- {0, 8, 4, 2, FLOORDOOR_U},
- {0, 4, 11, 2, PYRAMID},
- {0, 0, 2, 1, UPSTAIRS1},
- {1, 1, 2, 3, DOWNSTAIRS1},
- {0, 5, 8, 3, BOTTOM_RIGHT_DOOR},
- {0, 4, 8, 1, BOTTOM_LEFT_DOOR},
- {1, 5, 8, 3, UPPER_DOOR},
- {1, 4, 8, 1, UPPER_DOOR},
- {0, 4, 8, 0, UPSTAIRS2},
- {1, 4, 7, 2, DOWNSTAIRS2},
- {1, 6, 6, 2, PUZZLE_FRONT},
- {1, 6, 7, 0, PUZZLE_BEHIND},
- {0, 3, 6, 0, FORMULA1_N},
- {0, 3, 7, 0, FORMULA1_F},
- {0, 4, 6, 0, FORMULA2_N},
- {0, 4, 7, 0, FORMULA2_F},
- {0, 8, 9, 2, TOMATO_N},
- {0, 8, 8, 2, TOMATO_F},
- {1, 4, 2, 0, MONSTER_F},
- {1, 10, 8, 0, MONSTER_F},
- {1, 4, 1, 0, MONSTER1_N},
- {1, 10, 7, 0, MONSTER2_N},
- {0, 2, 4, 2, DOWNSTAIRS3},
- {1, 2, 5, 0, UPSTAIRS3},
- {1, 2, 5, 3, LCORRIDOR1},
- {1, 1, 5, 1, LCORRIDOR2},
- {1, 1, 5, 3, HOLE_ROOM},
- {0, 7, 4, 0, BST_DOOR}
- };
- if (!_gm->move(verb, obj1))
- return false;
- if (_gm->_rooms[FLOORDOOR]->isSectionVisible(kMaxSection - 1))
- roomTab[0]._e = 1;
- else
- roomTab[0]._e = 2;
- for (int i = 0; i < 29; i++) {
- if (_gm->_state._pyraE == roomTab[i]._e &&
- _gm->_state._pyraS == roomTab[i]._s &&
- _gm->_state._pyraZ == roomTab[i]._z &&
- _gm->_state._pyraDirection == roomTab[i]._r) {
- _gm->changeRoom(roomTab[i]._exitRoom);
- _gm->_newRoom = true;
- return true;
- }
- }
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-Upstairs1::Upstairs1(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 10;
- _id = UPSTAIRS1;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[2] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringCorridor, kStringDefaultDescription, CORRIDOR, EXIT, 0, 0, 0, PYR_ENTRANCE, 2);
-}
-
-void Upstairs1::onEntrance() {
- setRoomSeen(true);
-}
-
-void Upstairs1::animation() {
-}
-
-bool Upstairs1::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR) {
- if (_gm->_state._pyraE)
- _gm->_state._pyraE = 0;
- else
- _gm->_state._pyraE = 1;
- }
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-Downstairs1::Downstairs1(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 10;
- _id = DOWNSTAIRS1;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[3] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringCorridor, kStringDefaultDescription, CORRIDOR, EXIT, 3, 3, 0, PYR_ENTRANCE, 2);
-}
-
-void Downstairs1::onEntrance() {
- setRoomSeen(true);
-}
-
-void Downstairs1::animation() {
-}
-
-bool Downstairs1::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR) {
- if (_gm->_state._pyraE)
- _gm->_state._pyraE = 0;
- else
- _gm->_state._pyraE = 1;
- }
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-BottomRightDoor::BottomRightDoor(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 12;
- _id = BOTTOM_RIGHT_DOOR;
- _shown[0] = kShownTrue;
- _shown[19] = kShownTrue;
- _shown[23] = kShownTrue;
- _shown[29] = kShownTrue;
- _shown[30] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringDoor, kStringMassive, DOOR, EXIT | OPENABLE | CLOSED, 0, 0, 0, PYR_ENTRANCE, 2);
- _objectState[3] = Object(_id, kStringButton, kStringDefaultDescription, BUTTON, PRESS, 19, 19, 0);
-}
-
-void BottomRightDoor::onEntrance() {
- setRoomSeen(true);
-}
-
-void BottomRightDoor::animation() {
-}
-
-bool BottomRightDoor::interact(Action verb, Object &obj1, Object &obj2) {
- if (_gm->move(verb, obj1)) {
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else if (verb == ACTION_PRESS && obj1._id == BUTTON) {
- if (isSectionVisible(22)) {
- _vm->renderImage(21);
- setSectionVisible(22, kShownFalse);
- _gm->wait(2);
- _vm->renderImage(20);
- setSectionVisible(21, kShownFalse);
- _gm->wait(2);
- _vm->renderImage(19);
- setSectionVisible(20, kShownFalse);
- _objectState[2]._type = EXIT | OPENABLE | CLOSED;
- _objectState[2]._id = DOOR;
- _objectState[2]._description = kStringMassive;
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(22, kShownFalse);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(21, kShownFalse);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(20, kShownFalse);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(19, kShownTrue);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(27, kShownFalse);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(28, kShownFalse);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(24, kShownFalse);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->getObject(2)->_type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[BOTTOM_LEFT_DOOR]->getObject(2)->_id = DOOR;
- _gm->_rooms[BOTTOM_LEFT_DOOR]->getObject(2)->_description = kStringMassive;
- _gm->_rooms[UPPER_DOOR]->setSectionVisible(26, kShownTrue);
- _gm->_rooms[UPPER_DOOR]->setSectionVisible(27, kShownTrue);
- _gm->_rooms[UPPER_DOOR]->setSectionVisible(19, kShownFalse);
- _gm->_rooms[UPPER_DOOR]->setSectionVisible(25, kShownFalse);
- _gm->_rooms[UPPER_DOOR]->getObject(2)->_type = EXIT;
- _gm->_rooms[UPPER_DOOR]->getObject(2)->_id = CORRIDOR;
- _gm->_rooms[UPPER_DOOR]->getObject(2)->_description = kStringDefaultDescription;
- } else {
- _vm->renderImage(20);
- setSectionVisible(19, kShownFalse);
- _gm->wait(2);
- _vm->renderImage(21);
- _gm->wait(2);
- _vm->renderImage(22);
- _objectState[2]._type = EXIT;
- _objectState[2]._id = CORRIDOR;
- _objectState[2]._description = kStringDefaultDescription;
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(20, kShownTrue);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(21, kShownTrue);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(22, kShownTrue);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(19, kShownFalse);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(27, kShownTrue);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(28, kShownTrue);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->setSectionVisible(24, kShownTrue);
- _gm->_rooms[BOTTOM_LEFT_DOOR]->getObject(2)->_type = EXIT;
- _gm->_rooms[BOTTOM_LEFT_DOOR]->getObject(2)->_id = CORRIDOR;
- _gm->_rooms[BOTTOM_LEFT_DOOR]->getObject(2)->_description = kStringDefaultDescription;
- _gm->_rooms[UPPER_DOOR]->setSectionVisible(26, kShownFalse);
- _gm->_rooms[UPPER_DOOR]->setSectionVisible(27, kShownFalse);
- _gm->_rooms[UPPER_DOOR]->setSectionVisible(19, kShownTrue);
- _gm->_rooms[UPPER_DOOR]->setSectionVisible(25, kShownTrue);
- _gm->_rooms[UPPER_DOOR]->getObject(2)->_type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[UPPER_DOOR]->getObject(2)->_id = DOOR;
- _gm->_rooms[UPPER_DOOR]->getObject(2)->_description = kStringMassive;
- }
- _vm->playSound(kAudioShip3);
- _gm->screenShake();
- } else
- return false;
- return true;
-}
-
-BottomLeftDoor::BottomLeftDoor(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 12;
- _id = BOTTOM_LEFT_DOOR;
- _shown[0] = kShownTrue;
- _shown[19] = kShownTrue;
- _shown[29] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringDoor, kStringMassive, DOOR, EXIT | OPENABLE | CLOSED, 0, 0, 0, PYR_ENTRANCE, 2);
-}
-
-void BottomLeftDoor::onEntrance() {
- setRoomSeen(true);
-}
-
-void BottomLeftDoor::animation() {
-}
-
-bool BottomLeftDoor::interact(Action verb, Object &obj1, Object &obj2) {
- if (_gm->move(verb, obj1)) {
- if (verb == ACTION_WALK && obj1._id == G_LEFT)
- _gm->changeRoom(UPSTAIRS2);
- else
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else
- return false;
- return true;
-}
-
-Upstairs2::Upstairs2(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 10;
- _id = UPSTAIRS2;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringCorridor, kStringDefaultDescription, CORRIDOR, EXIT, 0, 0, 0, PYR_ENTRANCE, 2);
-}
-
-void Upstairs2::onEntrance() {
- setRoomSeen(true);
-}
-
-void Upstairs2::animation() {
-}
-
-bool Upstairs2::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR) {
- if (_gm->_state._pyraE)
- _gm->_state._pyraE = 0;
- else
- _gm->_state._pyraE = 1;
- }
- if (obj1._id == G_RIGHT)
- _gm->changeRoom(BOTTOM_LEFT_DOOR);
- else
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-Downstairs2::Downstairs2(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 10;
- _id = DOWNSTAIRS2;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[3] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringCorridor, kStringDefaultDescription, CORRIDOR, EXIT, 3, 3, 0, PYR_ENTRANCE, 2);
-}
-
-void Downstairs2::onEntrance() {
- setRoomSeen(true);
-}
-
-void Downstairs2::animation() {
-}
-
-bool Downstairs2::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR) {
- if (_gm->_state._pyraE)
- _gm->_state._pyraE = 0;
- else
- _gm->_state._pyraE = 1;
- }
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
- return true;
-}
-
-UpperDoor::UpperDoor(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 12;
- _id = UPPER_DOOR;
- _shown[0] = kShownTrue;
- _shown[26] = kShownTrue;
- _shown[27] = kShownTrue;
- _shown[30] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, CORRIDOR, EXIT, 0, 0, 0, PYR_ENTRANCE, 2);
-}
-
-void UpperDoor::onEntrance() {
- setRoomSeen(true);
-}
-
-void UpperDoor::animation() {
-}
-
-bool UpperDoor::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-PuzzleFront::PuzzleFront(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 12;
- _id = PUZZLE_FRONT;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[7] = kShownTrue;
- _shown[8] = kShownTrue;
- _shown[9] = kShownTrue;
- _shown[10] = kShownTrue;
- _shown[11] = kShownTrue;
- _shown[12] = kShownTrue;
- _shown[13] = kShownTrue;
- _shown[14] = kShownTrue;
- _shown[15] = kShownTrue;
- _shown[30] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringDoor, kStringMassive, DOOR, EXIT | OPENABLE | CLOSED, 255, 255, 0, PYR_ENTRANCE, 2);
- _objectState[3] = Object(_id, kStringPiece, kStringDefaultDescription, PART0, PRESS, 3, 3, 0);
- _objectState[4] = Object(_id, kStringPiece, kStringDefaultDescription, PART1, PRESS, 4, 4, 0);
- _objectState[5] = Object(_id, kStringPiece, kStringDefaultDescription, PART2, PRESS, 5, 5, 0);
- _objectState[6] = Object(_id, kStringPiece, kStringDefaultDescription, PART3, PRESS, 6, 6, 0);
- _objectState[7] = Object(_id, kStringPiece, kStringDefaultDescription, PART4, PRESS, 7, 7, 0);
- _objectState[8] = Object(_id, kStringPiece, kStringDefaultDescription, PART5, PRESS, 8, 8, 0);
- _objectState[9] = Object(_id, kStringPiece, kStringDefaultDescription, PART6, PRESS, 9, 9, 0);
- _objectState[10] = Object(_id, kStringPiece, kStringDefaultDescription, PART7, PRESS, 10, 10, 0);
- _objectState[11] = Object(_id, kStringPiece, kStringDefaultDescription, PART8, PRESS, 11, 11, 0);
- _objectState[12] = Object(_id, kStringPiece, kStringDefaultDescription, PART9, PRESS, 12, 12, 0);
- _objectState[13] = Object(_id, kStringPiece, kStringDefaultDescription, PART10, PRESS, 13, 13, 0);
- _objectState[14] = Object(_id, kStringPiece, kStringDefaultDescription, PART11, PRESS, 14, 14, 0);
- _objectState[15] = Object(_id, kStringPiece, kStringDefaultDescription, PART12, PRESS, 15, 15, 0);
- _objectState[16] = Object(_id, kStringPiece, kStringDefaultDescription, PART13, PRESS, 16, 16, 0);
- _objectState[17] = Object(_id, kStringPiece, kStringDefaultDescription, PART14, PRESS, 17, 17, 0);
- _objectState[18] = Object(_id, kStringPiece, kStringDefaultDescription, PART15, PRESS, 18, 18, 0);
-}
-
-void PuzzleFront::onEntrance() {
- setRoomSeen(true);
-}
-
-void PuzzleFront::animation() {
-}
-
-bool PuzzleFront::interact(Action verb, Object &obj1, Object &obj2) {
- MS2Image *image = _vm->_screen->getCurrentImage();
- if (_gm->move(verb, obj1)) {
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else if (verb == ACTION_PRESS && obj1._id >= PART0 && obj1._id <= PART15) {
- int pos = obj1._id - PART0;
- int newPos = 0;
- if (pos > 3 && _gm->_puzzleField[pos - 4] == 255)
- newPos = pos - 4;
- else if (pos < 12 && _gm->_puzzleField[pos + 4] == 255)
- newPos = pos + 4;
- else if ((pos % 4) > 0 && _gm->_puzzleField[pos - 1] == 255)
- newPos = pos - 1;
- else if ((pos % 4) < 3 && _gm->_puzzleField[pos + 1] == 255)
- newPos = pos + 1;
- else {
- _vm->renderMessage(kStringPyramid5);
- return true;
- }
- int a = _gm->_puzzleField[pos] + 1;
- _vm->renderImage(a + 128);
- image->_section[a].x1 = 95 + (newPos % 4) * 33;
- image->_section[a].x2 = image->_section[a].x1 + 31;
- image->_section[a].y1 = 24 + (newPos / 4) * 25;
- image->_section[a].y2 = image->_section[a].y1 + 23;
- _vm->renderImage(a);
- _vm->playSound(kAudioTaxiOpen);
- _gm->_state._puzzleTab[a - 1] = newPos;
- _gm->_puzzleField[pos] = 255;
- _gm->_puzzleField[newPos] = a - 1;
- _objectState[pos + 3]._click = 255;
- _objectState[newPos + 3]._click = newPos + 3;
- for (int i = 0; i < 15; i++)
- if (_gm->_state._puzzleTab[i] != i)
- return true;
-
- _gm->wait(2);
- _vm->renderImage(16);
- for (int i = 1; i < 16; i++)
- setSectionVisible(i, kShownFalse);
- _gm->wait(2);
- _vm->renderImage(17);
- _gm->wait(2);
- _vm->renderImage(18);
- _objectState[2]._type = EXIT;
- _objectState[2]._id = CORRIDOR;
- _objectState[2]._description = kStringDefaultDescription;
- _objectState[2]._click = 0;
-
- _gm->_rooms[PUZZLE_BEHIND]->setSectionVisible(31, kShownFalse);
- _gm->_rooms[PUZZLE_BEHIND]->setSectionVisible(26, kShownTrue);
- _gm->_rooms[PUZZLE_BEHIND]->setSectionVisible(27, kShownTrue);
- _gm->_rooms[PUZZLE_BEHIND]->setSectionVisible(29, kShownTrue);
- _gm->_rooms[PUZZLE_BEHIND]->getObject(2)->_type = EXIT;
- _gm->_rooms[PUZZLE_BEHIND]->getObject(2)->_id = CORRIDOR;
- _gm->_rooms[PUZZLE_BEHIND]->getObject(2)->_description = kStringDefaultDescription;
- _vm->playSound(kAudioShip3);
- _gm->screenShake();
- } else
- return false;
- return true;
-}
-
-PuzzleBehind::PuzzleBehind(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 12;
- _id = PUZZLE_BEHIND;
- _shown[0] = kShownTrue;
- _shown[29] = kShownTrue;
- _shown[31] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringDoor, kStringMassive, DOOR, EXIT | OPENABLE | CLOSED, 0, 0, 0, PYR_ENTRANCE, 2);
-}
-
-void PuzzleBehind::onEntrance() {
- setRoomSeen(true);
-}
-
-void PuzzleBehind::animation() {
-}
-
-bool PuzzleBehind::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-Formula1F::Formula1F(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 14;
- _id = FORMULA1_F;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[15] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 12, 12, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 11, 11, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringInscription, kStringInscriptionDescription, CORRIDOR, EXIT, 1, 1, 0, PYR_ENTRANCE, 2);
-}
-
-void Formula1F::onEntrance() {
- setRoomSeen(true);
-}
-
-void Formula1F::animation() {
-}
-
-bool Formula1F::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR)
- _gm->changeRoom(FORMULA1_N);
- else
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-Formula1N::Formula1N(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 13;
- _id = FORMULA1_N;
- _shown[0] = kShownTrue;
- _shown[5] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 8, 8, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 7, 7, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringInscription, kStringInscriptionDescription, NULLOBJECT, NULLTYPE, 2, 2, 0);
-}
-
-void Formula1N::onEntrance() {
- setRoomSeen(true);
-}
-
-void Formula1N::animation() {
-}
-
-bool Formula1N::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-Formula2F::Formula2F(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 14;
- _id = FORMULA2_F;
- _shown[0] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[14] = kShownTrue;
- _shown[15] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 12, 12, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 11, 11, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringInscription, kStringInscriptionDescription, CORRIDOR, EXIT, 2, 2, 0, PYR_ENTRANCE, 2);
-}
-
-void Formula2F::onEntrance() {
- setRoomSeen(true);
-}
-
-void Formula2F::animation() {
-}
-
-bool Formula2F::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR)
- _gm->changeRoom(FORMULA2_N);
- else
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-Formula2N::Formula2N(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 13;
- _id = FORMULA2_N;
- _shown[0] = kShownTrue;
- _shown[6] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 8, 8, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 7, 7, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringInscription, kStringInscriptionDescription, NULLOBJECT, NULLTYPE, 3, 3, 0);
-}
-
-void Formula2N::onEntrance() {
- setRoomSeen(true);
-}
-
-void Formula2N::animation() {
-}
-
-bool Formula2N::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-TomatoF::TomatoF(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 14;
- _id = TOMATO_F;
- _shown[0] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[15] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 12, 12, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 11, 11, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringTomato, kStringFunnyDescription, CORRIDOR, EXIT, 3, 3, 0, PYR_ENTRANCE, 2);
-}
-
-void TomatoF::onEntrance() {
- setRoomSeen(true);
-}
-
-void TomatoF::animation() {
-}
-
-bool TomatoF::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR)
- _gm->changeRoom(TOMATO_N);
- else
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-TomatoN::TomatoN(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 13;
- _id = TOMATO_N;
- _shown[0] = kShownTrue;
- _shown[7] = kShownTrue;
- _shown[8] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 8, 8, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 7, 7, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringKnife1, kStringKnife1Description, TKNIFE, TAKE | COMBINABLE, 5, 5, 7);
- _objectState[3] = Object(_id, kStringTomato, kStringFunnyDescription, NULLOBJECT, UNNECESSARY, 4, 4, 0);
-}
-
-void TomatoN::onEntrance() {
- setRoomSeen(true);
-}
-
-void TomatoN::animation() {
-}
-
-bool TomatoN::interact(Action verb, Object &obj1, Object &obj2) {
- if (_gm->move(verb, obj1)) {
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else if (verb == ACTION_TAKE && obj1._id == TKNIFE) {
- _gm->takeObject(obj1);
- setSectionVisible(8, kShownFalse);
- } else
- return false;
- return true;
-}
-
-MonsterF::MonsterF(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 14;
- _id = MONSTER_F;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[14] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 12, 12, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 11, 11, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringMonster, kStringMonsterDescription, CORRIDOR, EXIT, 0, 0, 0, PYR_ENTRANCE, 2);
-}
-
-void MonsterF::onEntrance() {
- setRoomSeen(true);
-}
-
-void MonsterF::animation() {
-}
-
-bool MonsterF::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR) {
- if (_gm->_state._pyraS == 4)
- _gm->changeRoom(MONSTER1_N);
- else
- _gm->changeRoom(MONSTER2_N);
- } else
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-Monster1N::Monster1N(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 13;
- _id = MONSTER1_N;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 8, 8, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 7, 7, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringRope, kStringRopeDescription, ROPE, TAKE | COMBINABLE, 255, 255, 2);
- _objectState[3] = Object(_id, kStringEyes, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 6, 6, 0);
- _objectState[4] = Object(_id, kStringMouth, kStringDefaultDescription, MOUTH, NULLTYPE, 1, 1, 0);
- _objectState[5] = Object(_id, kStringMonster, kStringMonster1Description, MONSTER, NULLTYPE, 0, 0, 0);
-}
-
-void Monster1N::onEntrance() {
- setRoomSeen(true);
-}
-
-void Monster1N::animation() {
-}
-
-bool Monster1N::interact(Action verb, Object &obj1, Object &obj2) {
- if (_gm->move(verb, obj1)) {
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else if ((verb == ACTION_OPEN || verb == ACTION_PULL) && obj1._id == MOUTH) {
- if (obj1._type & OPENED)
- _vm->renderMessage(kStringGenericInteract8);
- else {
- obj1._type |= OPENED;
- if (isSectionVisible(kMaxSection - 1))
- _vm->renderImage(2);
- else {
- _objectState[2]._click = 1;
- _vm->renderImage(4);
- setSectionVisible(2, kShownFalse);
- }
- _vm->playSound(kAudioTaxiOpen);
- }
- } else if (verb == ACTION_CLOSE && obj1._id == MOUTH) {
- if (obj1._type & OPENED) {
- _vm->renderImage(1);
- setSectionVisible(2, kShownFalse);
- obj1._type &= ~OPENED;
- _vm->playSound(kAudioElevator1);
- } else
- _vm->renderMessage(kStringGenericInteract11);
- } else if (verb == ACTION_TAKE && (obj1._id == ROPE || obj1._id == NOTE)) {
- _gm->takeObject(obj1);
- setSectionVisible(3, kShownFalse);
- setSectionVisible(4, kShownFalse);
- setSectionVisible(kMaxSection - 1, kShownTrue);
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, TKNIFE, MONSTER)) {
- _vm->renderMessage(kStringPyramid6);
- } else
- return false;
- return true;
-}
-
-Monster2N::Monster2N(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 13;
- _id = MONSTER2_N;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 8, 8, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 7, 7, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringNote, kStringNoteDescription, NOTE, TAKE | COMBINABLE, 255, 255, 2);
- _objectState[3] = Object(_id, kStringEyes, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 6, 6, 0);
- _objectState[4] = Object(_id, kStringMouth, kStringDefaultDescription, MOUTH, NULLTYPE, 1, 1, 0);
- _objectState[5] = Object(_id, kStringMonster, kStringMonster1Description, MONSTER, NULLTYPE, 0, 0, 0);
-}
-
-void Monster2N::onEntrance() {
- setRoomSeen(true);
-}
-
-void Monster2N::animation() {
-}
-
-bool Monster2N::interact(Action verb, Object &obj1, Object &obj2) {
- if (_gm->move(verb, obj1)) {
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else if ((verb == ACTION_OPEN || verb == ACTION_PULL) && obj1._id == MOUTH) {
- if (obj1._type & OPENED)
- _vm->renderMessage(kStringGenericInteract8);
- else {
- obj1._type |= OPENED;
- if (isSectionVisible(kMaxSection - 1))
- _vm->renderImage(2);
- else {
- _objectState[2]._click = 1;
- _vm->renderImage(3);
- setSectionVisible(2, kShownFalse);
- }
- _vm->playSound(kAudioTaxiOpen);
- }
- } else if (verb == ACTION_CLOSE && obj1._id == MOUTH) {
- if (obj1._type & OPENED) {
- _vm->renderImage(1);
- setSectionVisible(2, kShownFalse);
- obj1._type &= ~OPENED;
- _vm->playSound(kAudioElevator1);
- } else
- _vm->renderMessage(kStringGenericInteract11);
- } else if (verb == ACTION_TAKE && (obj1._id == ROPE || obj1._id == NOTE)) {
- _gm->takeObject(obj1);
- setSectionVisible(3, kShownFalse);
- setSectionVisible(4, kShownFalse);
- setSectionVisible(kMaxSection - 1, kShownTrue);
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, TKNIFE, MONSTER)) {
- _vm->renderMessage(kStringPyramid6);
- } else
- return false;
- return true;
-}
-
-Upstairs3::Upstairs3(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 10;
- _id = UPSTAIRS3;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringCorridor, kStringDefaultDescription, CORRIDOR, EXIT, 0, 0, 0, PYR_ENTRANCE, 2);
-}
-
-void Upstairs3::onEntrance() {
- setRoomSeen(true);
-}
-
-void Upstairs3::animation() {
-}
-
-bool Upstairs3::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR) {
- if (_gm->_state._pyraE)
- _gm->_state._pyraE = 0;
- else
- _gm->_state._pyraE = 1;
- }
- if (obj1._id == G_LEFT)
- _gm->changeRoom(LCORRIDOR1);
- else
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-Downstairs3::Downstairs3(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 10;
- _id = DOWNSTAIRS3;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[3] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringCorridor, kStringDefaultDescription, CORRIDOR, EXIT, 3, 3, 0, PYR_ENTRANCE, 2);
-}
-
-void Downstairs3::onEntrance() {
- setRoomSeen(true);
-}
-
-void Downstairs3::animation() {
-}
-
-bool Downstairs3::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == CORRIDOR) {
- if (_gm->_state._pyraE)
- _gm->_state._pyraE = 0;
- else
- _gm->_state._pyraE = 1;
- }
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-LCorridor1::LCorridor1(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 9;
- _id = LCORRIDOR1;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[17] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringCorridor, kStringDefaultDescription, CORRIDOR, EXIT, 6, 6, 0, PYR_ENTRANCE, 2);
-}
-
-void LCorridor1::onEntrance() {
- setRoomSeen(true);
-}
-
-void LCorridor1::animation() {
-}
-
-bool LCorridor1::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- if (obj1._id == G_RIGHT)
- _gm->changeRoom(UPSTAIRS3);
- else if (obj1._id == CORRIDOR)
- _gm->changeRoom(HOLE_ROOM);
- else
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-LCorridor2::LCorridor2(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 9;
- _id = LCORRIDOR2;
- _shown[0] = kShownTrue;
- _shown[17] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringCorridor, kStringDefaultDescription, CORRIDOR, EXIT, 6, 6, 0, PYR_ENTRANCE, 2);
-}
-
-void LCorridor2::onEntrance() {
- setRoomSeen(true);
-}
-
-void LCorridor2::animation() {
-}
-
-bool LCorridor2::interact(Action verb, Object &obj1, Object &obj2) {
- if (!_gm->move(verb, obj1))
- return false;
- _gm->passageConstruction();
- _gm->_newRoom = true;
- return true;
-}
-
-HoleRoom::HoleRoom(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 9;
- _id = HOLE_ROOM;
- _shown[0] = kShownTrue;
- _shown[8] = kShownTrue;
- _shown[15] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 1, 1, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 2, 2, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, NULLTYPE, 255, 255, 0);
- _objectState[3] = Object(_id, kStringOpening, kStringOpeningDescription1, HOLE, EXIT, 3, 3, 0, IN_HOLE, 12);
- _objectState[4] = Object(_id, kStringOpening, kStringOpeningDescription2, NULLOBJECT, NULLTYPE, 4, 4, 0);
-}
-
-void HoleRoom::onEntrance() {
- setRoomSeen(true);
-}
-
-void HoleRoom::animation() {
-}
-
-bool HoleRoom::interact(Action verb, Object &obj1, Object &obj2) {
- if (_gm->move(verb, obj1)) {
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else if (verb == ACTION_USE &&
- (Object::combine(obj1, obj2, ROPE, G_RIGHT) ||
- Object::combine(obj1, obj2, ROPE, G_LEFT))) {
- _vm->renderMessage(kStringPyramid7);
- } else if (verb == ACTION_USE &&
- (Object::combine(obj1, obj2, TKNIFE, G_RIGHT) ||
- Object::combine(obj1, obj2, TKNIFE, G_LEFT))) {
- _vm->renderMessage(kStringPyramid8);
- } else if (verb == ACTION_TAKE && obj1._id == ROPE && !(obj1._type & CARRIED)) {
- _vm->renderMessage(kStringPyramid9);
- } else if (verb == ACTION_WALK && obj1._id == HOLE && !isSectionVisible(16)) {
- _vm->renderMessage(kStringPyramid10);
- } else if (verb == ACTION_USE && obj1._id == ROPE && isSectionVisible(16)) {
- _gm->changeRoom(IN_HOLE);
- _gm->_newRoom = true;
- } else
- return false;
- return true;
-}
-
-InHole::InHole(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 11;
- _id = IN_HOLE;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, EXIT, 0, 0, 0, HOLE_ROOM, 2);
- _objectState[1] = Object(_id, kStringNote, kStringNoteDescription1, NULLOBJECT, TAKE, 255, 255, 1 + 128);
- _objectState[2] = Object(_id, kStringSlot, kStringSlotDescription3, SLOT, COMBINABLE, 1, 1, 0);
-}
-
-void InHole::onEntrance() {
- setRoomSeen(true);
-}
-
-void InHole::animation() {
-}
-
-bool InHole::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_USE && Object::combine(obj1, obj2, TKNIFE, SLOT)) {
- if (isSectionVisible(kMaxSection - 1))
- _vm->renderMessage(kStringPyramid11);
- else {
- _vm->renderImage(1);
- _objectState[1]._click = 2;
- setSectionVisible(kMaxSection - 1, kShownTrue);
- }
- } else if (verb == ACTION_TAKE && obj1._id == ROPE) {
- _vm->renderMessage(kStringPyramid9);
- } else if (verb == ACTION_USE && obj1._id == ROPE) {
- _gm->changeRoom(HOLE_ROOM);
- _gm->_newRoom = true;
- } else
- return false;
- return true;
-}
-
-Floordoor::Floordoor(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 14;
- _id = FLOORDOOR;
- _shown[0] = kShownTrue;
- _shown[14] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 12, 12, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 11, 11, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringKnife1, kStringDefaultDescription, TKNIFE, TAKE | COMBINABLE, 255, 255, 9);
- _objectState[3] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, TAKE, 255, 255, 11+128);
- _objectState[4] = Object(_id, kStringOpening, kStringOpeningDescription3, HOLE, EXIT, 4, 4, 0, FLOORDOOR_U, 12);
- _objectState[5] = Object(_id, kStringStones, kStringDefaultDescription, STONES, COMBINABLE, 5, 5, 0);
-}
-
-void Floordoor::onEntrance() {
- setRoomSeen(true);
-}
-
-void Floordoor::animation() {
-}
-
-bool Floordoor::interact(Action verb, Object &obj1, Object &obj2) {
- if (_gm->move(verb, obj1)) {
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else if (verb == ACTION_WALK && obj1._id == HOLE) {
- if (isSectionVisible(11)) {
- _gm->_state._pyraZ = 4;
- _gm->_state._pyraDirection = 2;
- _gm->_state._pyraE = 0;
- return false;
- } else
- _vm->renderMessage(kStringPyramid12);
- } else if (verb == ACTION_USE && obj1._id == ROPE && isSectionVisible(11)) {
- _gm->_state._pyraZ = 4;
- _gm->_state._pyraDirection = 2;
- _gm->_state._pyraE = 0 ;
- _gm->changeRoom(FLOORDOOR_U);
- _gm->_newRoom = true;
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, TKNIFE, STONES)) {
- _vm->renderImage(10);
- if (obj1._id == TKNIFE)
- _gm->_inventory.remove(obj1);
- else
- _gm->_inventory.remove(obj2);
- _objectState[2]._click = 6;
- } else if (verb == ACTION_USE &&
- (Object::combine(obj1, obj2, TKNIFE, G_RIGHT) ||
- Object::combine(obj1, obj2, TKNIFE, G_LEFT))) {
- _vm->renderMessage(kStringPyramid8);
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, ROPE, TKNIFE) &&
- isSectionVisible(10)) {
- _vm->renderImage(11);
- setSectionVisible(10, kShownFalse);
- if (obj1._id == ROPE)
- _gm->_inventory.remove(obj1);
- else
- _gm->_inventory.remove(obj2);
- _objectState[2]._click = 255;
- _objectState[3]._click = 7;
- _objectState[3]._type &= ~COMBINABLE;
- } else if (verb == ACTION_USE &&
- (Object::combine(obj1, obj2, ROPE, G_RIGHT) ||
- Object::combine(obj1, obj2, ROPE, G_LEFT) ||
- Object::combine(obj1, obj2, ROPE, STONES))) {
- _vm->renderMessage(kStringPyramid7);
- } else if (verb == ACTION_TAKE && obj1._id == ROPE && !(obj1._type & CARRIED)) {
- _gm->takeObject(obj1);
- obj1._type |= COMBINABLE;
- _vm->renderImage(9);
- _vm->renderImage(10);
- _objectState[2]._click = 6;
- } else if (verb == ACTION_TAKE && obj1._id == TKNIFE && !(obj1._type & CARRIED)) {
- _gm->takeObject(obj1);
- setSectionVisible(10, kShownFalse);
- } else
- return false;
- return true;
-}
-
-FloordoorU::FloordoorU(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 14;
- _id = FLOORDOOR_U;
- _shown[0] = kShownTrue;
- _shown[12] = kShownTrue;
- _shown[13] = kShownTrue;
- _shown[15] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 12, 12, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 11, 11, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, NULLTYPE, 10, 10, 0, FLOORDOOR, 2);
- _objectState[3] = Object(_id, kStringOpening, kStringDefaultDescription, HOLE, EXIT, 8, 8, 0, FLOORDOOR, 2);
- _objectState[4] = Object(_id, kStringPlate, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 9, 9, 0);
-}
-
-void FloordoorU::onEntrance() {
- setRoomSeen(true);
-}
-
-void FloordoorU::animation() {
-}
-
-bool FloordoorU::interact(Action verb, Object &obj1, Object &obj2) {
- if (_gm->move(verb, obj1)) {
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else if (verb == ACTION_WALK && obj1._id == HOLE) {
- _gm->_state._pyraZ = 6;
- _gm->_state._pyraDirection = 0;
- _gm->_state._pyraE = 1;
- return false;
- } else if (verb == ACTION_USE && obj1._id == ROPE) {
- _gm->_state._pyraZ = 6;
- _gm->_state._pyraDirection = 0;
- _gm->_state._pyraE = 1;
- _gm->changeRoom(FLOORDOOR);
- _gm->_newRoom = true;
- } else if (verb == ACTION_TAKE && obj1._id == ROPE) {
- _vm->renderMessage(kStringPyramid9);
- } else
- return false;
- return true;
-}
-
-BstDoor::BstDoor(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 15;
- _id = BST_DOOR;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 18, 18, 0, PYR_ENTRANCE, 14);
- _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 17, 17, 0, PYR_ENTRANCE, 10);
- _objectState[2] = Object(_id, kStringLetter, kStringDefaultDescription, BST1, PRESS, 0, 0, 0);
- _objectState[3] = Object(_id, kStringLetter, kStringDefaultDescription, BST2, PRESS, 1, 0, 0);
- _objectState[4] = Object(_id, kStringLetter, kStringDefaultDescription, BST3, PRESS, 2, 0, 0);
- _objectState[5] = Object(_id, kStringLetter, kStringDefaultDescription, BST4, PRESS, 3, 0, 0);
- _objectState[6] = Object(_id, kStringLetter, kStringDefaultDescription, BST5, PRESS, 4, 0, 0);
- _objectState[7] = Object(_id, kStringLetter, kStringDefaultDescription, BST6, PRESS, 5, 0, 0);
- _objectState[8] = Object(_id, kStringLetter, kStringDefaultDescription, BST7, PRESS, 6, 0, 0);
- _objectState[9] = Object(_id, kStringLetter, kStringDefaultDescription, BST8, PRESS, 7, 0, 0);
- _objectState[10] = Object(_id, kStringLetter, kStringDefaultDescription, BST9, PRESS, 8, 0, 0);
- _objectState[11] = Object(_id, kStringLetter, kStringDefaultDescription, BST10, PRESS, 9, 0, 0);
- _objectState[12] = Object(_id, kStringLetter, kStringDefaultDescription, BST11, PRESS, 10, 0, 0);
- _objectState[13] = Object(_id, kStringLetter, kStringDefaultDescription, BST12, PRESS, 11, 0, 0);
- _objectState[14] = Object(_id, kStringLetter, kStringDefaultDescription, BST13, PRESS, 12, 0, 0);
- _objectState[15] = Object(_id, kStringLetter, kStringDefaultDescription, BST14, PRESS, 13, 0, 0);
- _objectState[16] = Object(_id, kStringLetter, kStringDefaultDescription, BST15, PRESS, 14, 0, 0);
- _objectState[17] = Object(_id, kStringLetter, kStringDefaultDescription, BST16, PRESS, 15, 0, 0);
- _objectState[18] = Object(_id, kStringDoor, kStringMassive, DOOR, EXIT | OPENABLE | CLOSED, 16, 16, 0, HALL, 2);
-
- char germanPassword[16] = {0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0};
- char englishPassword[16] = {0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0};
- if (ConfMan.get("language") == "en")
- for (int i = 0; i < 16; i++)
- _password[i] = englishPassword[i];
- else
- for (int i = 0; i < 16; i++)
- _password[i] = germanPassword[i];
-}
-
-void BstDoor::onEntrance() {
- if (ConfMan.get("language") == "en")
- _vm->_screen->renderMessage("You are almost there", kMessageNormal, 105, 130);
-}
-
-void BstDoor::animation() {
-}
-
-bool BstDoor::interact(Action verb, Object &obj1, Object &obj2) {
- if (_gm->move(verb, obj1)) {
- _gm->passageConstruction();
- _gm->_newRoom = true;
- } else if (verb == ACTION_PRESS && obj1._id >= BST1 && obj1._id <= BST16) {
- int number = obj1._id - (BST1 - 1);
- if (isSectionVisible(number))
- _vm->renderImage(number + 128);
- else
- _vm->renderImage(number);
- _vm->playSound(kAudioTaxiOpen);
- for (number = 1; number <= 16; number++) {
- if (isSectionVisible(number) != _password[number - 1])
- return true;
- }
- _gm->wait(2);
- _vm->renderImage(17);
- for (number = 1; number <= 16; number++) {
- setSectionVisible(number, kShownFalse);
- _objectState[number + 1]._click = 255;
- }
- _gm->wait(2);
- _vm->renderImage(18);
- _gm->wait(2);
- _vm->renderImage(19);
- _objectState[18]._type = EXIT;
- _objectState[18]._description = kStringDefaultDescription;
- _vm->playSound(kAudioShip3);
- _gm->screenShake();
- } else
- return false;
- return true;
-}
-
-Hall::Hall(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 16;
- _id = HALL;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringCoffin, kStringDefaultDescription, NULLOBJECT, EXIT, 0, 0, 0, COFFIN_ROOM, 2);
- _objectState[1] = Object(_id, kStringExit, kStringDefaultDescription, CORRIDOR, EXIT, 255, 255, 0, PYR_ENTRANCE, 22);
-}
-
-void Hall::onEntrance() {
- setRoomSeen(true);
-}
-
-void Hall::animation() {
-}
-
-bool Hall::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_WALK && obj1._id == CORRIDOR) {
- _gm->_state._pyraDirection = 2;
- _gm->passageConstruction();
- }
- return false;
-}
-
-CoffinRoom::CoffinRoom(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 17;
- _id = COFFIN_ROOM;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringExit, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, HALL, 22);
- _objectState[1] = Object(_id, kStringCoffin, kStringCreepy, COFFIN, NULLTYPE, 0, 0, 0);
- _objectState[2] = Object(_id, kStringToothbrush, kStringToothbrushDescription1, NULLOBJECT, NULLTYPE, 1, 1, 0);
- _objectState[3] = Object(_id, kStringToothpaste, kStringToothbrushDescription1, NULLOBJECT, NULLTYPE, 2, 2, 0);
- _objectState[4] = Object(_id, kStringBall, kStringBallDescription, L_BALL, NULLTYPE, 3, 3, 0);
- _objectState[5] = Object(_id, kStringBall, kStringBallDescription, R_BALL, NULLTYPE, 4, 4, 0);
-}
-
-void CoffinRoom::onEntrance() {
- setRoomSeen(true);
-}
-
-void CoffinRoom::animation() {
-}
-
-bool CoffinRoom::interact(Action verb, Object &obj1, Object &obj2) {
- char change;
- if (verb == ACTION_OPEN && obj1._id == COFFIN && !isSectionVisible(1)) {
- _vm->renderMessage(kStringPyramid13);
- } else if (verb == ACTION_PRESS && (obj1._id == L_BALL || obj1._id == R_BALL)) {
- if (obj1._id == L_BALL) {
- if ((change = !isSectionVisible(2))) {
- _vm->renderImage(2);
- _vm->playSound(kAudioTaxiOpen);
- } else
- _vm->renderMessage(kStringPyramid14);
- } else {
- if ((change = !isSectionVisible(3))) {
- _vm->renderImage(3);
- _vm->playSound(kAudioTaxiOpen);
- } else
- _vm->renderMessage(kStringPyramid14);
- } if (change) {
- if (isSectionVisible(2) && isSectionVisible(3)) {
- _vm->playSound(kAudioShip2);
- _vm->renderImage(4);
- _gm->wait(4);
- _vm->renderImage(5);
- _gm->wait(4);
- _vm->renderImage(5);
- _gm->wait(4);
- _vm->renderImage(5);
- _gm->wait(4);
- _vm->renderImage(1);
- setSectionVisible(4, kShownFalse);
- setSectionVisible(5, kShownFalse);
- setSectionVisible(6, kShownFalse);
- setSectionVisible(7, kShownFalse);
- }
- else
- _vm->renderMessage(kStringPyramid15);
- }
- } else if (verb == ACTION_LOOK && obj1._id == COFFIN && isSectionVisible(1)) {
- _gm->changeRoom(MASK);
- _gm->_newRoom = true;
- } else
- return false;
- return true;
-}
-
-Mask::Mask(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 18;
- _id = MASK;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringExit, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, COFFIN_ROOM, 22);
- _objectState[1] = Object(_id, kStringEye, kStringEyeDescription, EYE1, NULLTYPE, 0, 0, 0);
- _objectState[2] = Object(_id, kStringEye, kStringEyeDescription, EYE2, NULLTYPE, 1, 1, 0);
- _objectState[3] = Object(_id, kStringMouth, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 2, 2, 0);
-}
-
-void Mask::onEntrance() {
- setRoomSeen(true);
-}
-
-void Mask::animation() {
-}
-
-bool Mask::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_OPEN && (obj1._id == EYE1 || obj1._id == EYE2)) {
- if (obj1._type & OPENED)
- _vm->renderMessage(kStringPyramid16);
- else
- _vm->renderImage(obj1._id - EYE1 + 1);
- if (isSectionVisible(1) && isSectionVisible(2)) {
- _gm->reply(kStringPyramid17, 3, 3 + 128);
- _gm->reply(kStringPyramid18, 3, 3 + 128);
- _gm->reply(kStringPyramid19, 3, 3 + 128);
- _vm->playSound(kAudioAppearance1);
- while(_vm->_sound->isPlaying())
- _gm->wait(1);
- _vm->paletteFadeOut();
- _vm->loadGame(kSleepAutosaveSlot);
- _gm->changeRoom(CABIN);
- _gm->setAnimationTimer(1);
- _gm->_newRoom = true;
- _gm->drawGUI();
- _gm->_rooms[CABIN]->setSectionVisible(2, kShownTrue);
- _gm->_rooms[CABIN]->setSectionVisible(kMaxSection - 1, kShownFalse);
- _gm->_rooms[CABIN]->setSectionVisible(kMaxSection - 2, kShownTrue);
- _gm->_rooms[CABIN]->setSectionVisible(1, kShownFalse);
- _gm->_rooms[CABIN]->getObject(2)->_click = 8;
- _gm->_state._eventTime = kMaxTimerValue;
- }
- return true;
- }
- return false;
-}
-
-Museum::Museum(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 29;
- _id = MUSEUM;
- _shown[0] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDinosaur, kStringDinosaurDescription, NULLOBJECT, NULLTYPE, 0, 0, 0);
- _objectState[1] = Object(_id, kStringEntrance, kStringDefaultDescription, BIG_DOOR, EXIT | OPENABLE | CLOSED, 1, 1, 0, NULLROOM, 0);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE | CLOSED, 2, 2, 1, MUS_ENTRANCE, 9);
- _objectState[3] = Object(_id, kStringRoad, kStringDefaultDescription, MUS_STREET, EXIT, 3, 3, 0);
-}
-
-void Museum::onEntrance() {
- _gm->setAnimationTimer(1);
- if (_gm->_state._alarmCracked && !_gm->_state._alarmOn) {
- _gm->_state._eventTime = kMaxTimerValue;
- _gm->_state._alarmOn = false;
- _gm->_state._haste = false;
- _vm->renderMessage(kStringMuseum1);
- _gm->waitOnInput(_gm->_messageDuration);
- _gm->_state._sirenOn = false;
- _vm->stopSound();
- _vm->paletteFadeOut();
- _vm->_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(255);
- _vm->renderMessage(kStringMuseum2);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->_screen->setViewportBrightness(0);
- _vm->setCurrentImage(26);
- bool hasDinosaurHead = false;
- if (_gm->_rooms[MUS_ROUND]->getObject(4)->_type & CARRIED)
- hasDinosaurHead = true;
- _vm->loadGame(kSleepAutosaveSlot);
- _vm->renderImage(0);
- _vm->paletteFadeIn();
- if (hasDinosaurHead) {
- _gm->reply(kStringMuseum3, 1, 1 + 128);
- _gm->reply(kStringMuseum4, 1, 1 + 128);
- _gm->takeMoney(30000);
- _vm->playSound(kAudioAppearance1);
- } else {
- _gm->reply(kStringMuseum5, 1, 1 + 128);
- _gm->say(kStringMuseum23);
- _gm->reply(kStringMuseum24, 1, 1 + 128);
- }
- _vm->paletteFadeOut();
- _gm->changeRoom(CITY2);
- _gm->_newRoom = true;
- _gm->drawGUI();
- }
-}
-
-void Museum::animation() {
-}
-
-bool Museum::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_WALK && obj1._id == MUS_STREET) {
- if (!_gm->_state._alarmOn &&
- !(_gm->_rooms[MUS_ROUND]->getObject(4)->_type & CARRIED)) {
- _vm->renderMessage(kStringMuseum10);
- } else {
- _gm->_state._eventTime = kMaxTimerValue;
- if (_gm->_state._alarmOn) {
- _vm->renderMessage(kStringMuseum11);
- if (_gm->_state._sirenOn) {
- _vm->stopSound();
- _gm->_state._sirenOn = false;
- }
- } else
- _vm->renderMessage(kStringMuseum12);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->paletteFadeOut();
- _vm->_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(255);
- _vm->_screen->setGuiBrightness(255);
- _vm->_screen->paletteBrightness();
- _vm->renderMessage(kStringMuseum13);
- _gm->waitOnInput(_gm->_messageDuration);
- _vm->removeMessage();
- _vm->_screen->setViewportBrightness(0);
- _vm->_screen->setGuiBrightness(0);
- _vm->_screen->paletteBrightness();
- bool hasDinosaurHead = false;
- if (_gm->_rooms[MUS_ROUND]->getObject(4)->_type & CARRIED)
- hasDinosaurHead = true;
- _vm->loadGame(kSleepAutosaveSlot);
- if (_gm->_state._money >= 8)
- _gm->takeMoney(-8);
- if (hasDinosaurHead)
- _gm->takeObject(*_gm->_rooms[INTRO]->getObject(7));
- _gm->changeRoom(CULTURE_PALACE);
- _gm->_newRoom = true;
- _gm->_state._alarmOn = false;
- _gm->_state._haste = false;
- _gm->drawGUI();
- }
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, SP_KEYCARD, DOOR) &&
- !(_objectState[2]._type & OPENED)) {
- if (_gm->crackDoor(20)) {
- _vm->renderImage(1);
- _objectState[2]._type = EXIT | OPENABLE | OPENED;
- _vm->playSound(kAudioTaxiOpen);
- }
- } else if (verb == ACTION_CLOSE && obj1._id == DOOR && (obj1._type & OPENED)) {
- _vm->renderImage(1 + 128);
- _objectState[2]._type = EXIT | OPENABLE | CLOSED;
- _vm->playSound(kAudioElevator1);
- } else if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, SP_KEYCARD, BIG_DOOR)) {
- _vm->renderMessage(kStringMuseum14);
- } else if (verb == ACTION_WALK && obj1._id == DOOR) {
- _gm->_state._haste = true;
- return false;
- } else
- return false;
- return true;
-}
-
-MusEntrance::MusEntrance(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 32;
- _id = MUS_ENTRANCE;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, ENCRYPTED_DOOR, EXIT | OPENABLE | OPENED, 1, 1, 2, MUSEUM, 23);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 0, 0, 1, MUS11, 2);
-}
-
-void MusEntrance::onEntrance() {
- setRoomSeen(true);
-}
-
-void MusEntrance::animation() {
-}
-
-bool MusEntrance::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_OPEN && obj1._id == DOOR)
- _gm->_rooms[MUS11]->getObject(2)->_type |= OPENED;
- else if (verb == ACTION_CLOSE && obj1._id == DOOR)
- _gm->_rooms[MUS11]->getObject(2)->_type &= ~OPENED;
- else if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, SP_KEYCARD, ENCRYPTED_DOOR) &&
- !(_objectState[0]._type & OPENED)) {
- if (_gm->crackDoor(20)) {
- _vm->renderImage(2);
- _objectState[0]._type = EXIT | OPENABLE | OPENED;
- _vm->playSound(kAudioTaxiOpen);
- }
- return true;
- } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR &&
- (obj1._type & OPENED)) {
- _vm->renderImage(2 + 128);
- _objectState[0]._type = EXIT | OPENABLE | CLOSED;
- _vm->playSound(kAudioElevator1);
- return true;
- }
- return false;
-}
-
-Mus1::Mus1(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 35;
- _id = MUS1;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[13] = kShownTrue;
- _shown[15] = kShownTrue;
- _shown[26] = kShownTrue;
- _shown[27] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 1, 1, 8, MUS2, 22);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 4, 4, 11, MUS8, 9);
-}
-
-void Mus1::onEntrance() {
- _gm->securityEntrance();
- setRoomSeen(true);
-}
-
-void Mus1::animation() {
-}
-
-bool Mus1::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- return false;
-}
-
-Mus2::Mus2(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 35;
- _id = MUS2;
- _shown[0] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[13] = kShownTrue;
- _shown[14] = kShownTrue;
- _shown[22] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 0, 0, 7, MUS1, 2);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 1, 1, 8, MUS3, 22);
-}
-
-void Mus2::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus2::animation() {
-}
-
-bool Mus2::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- return false;
-}
-
-Mus3::Mus3(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 35;
- _id = MUS3;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[13] = kShownTrue;
- _shown[23] = kShownTrue;
- _shown[28] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 0, 0, 7, MUS2, 2);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 5, 5, 12, MUS10, 19);
-}
-
-void Mus3::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus3::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus3::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- return false;
-}
-
-Mus4::Mus4(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 35;
- _id = MUS4;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[14] = kShownTrue;
- _shown[20] = kShownTrue;
- _shown[21] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 1, 1, 8, MUS5, 22);
- _objectState[1] = Object(_id, kStringCamera, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 7, 7, 0);
-
-}
-
-void Mus4::onEntrance() {
- setRoomSeen(true);
-}
-
-void Mus4::animation() {
-}
-
-bool Mus4::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- return false;
-}
-
-Mus5::Mus5(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 35;
- _id = MUS5;
- _shown[0] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[14] = kShownTrue;
- _shown[24] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 0, 0, 7, MUS4, 2);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, ENCRYPTED_DOOR, EXIT | OPENABLE | CLOSED | COMBINABLE, 1, 1, 8, MUS6, 22);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 2, 2, 9, MUS9, 5);
-
-}
-
-void Mus5::onEntrance() {
- _gm->securityEntrance();
- setRoomSeen(true);
-}
-
-void Mus5::animation() {
-}
-
-bool Mus5::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, SP_KEYCARD, ENCRYPTED_DOOR) &&
- !(_objectState[1]._type & OPENED)) {
- if (_gm->crackDoor(50)) {
- _vm->renderImage(8);
- _objectState[1]._type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS6]->getObject(0)->_type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS6]->setSectionVisible(7, kShownTrue);
- _vm->playSound(kAudioTaxiOpen);
- }
- } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR &&
- (obj1._type & OPENED)) {
- _vm->renderImage(8 + 128);
- _objectState[1]._type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS6]->getObject(0)->_type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS6]->setSectionVisible(7, kShownFalse);
- _vm->playSound(kAudioElevator1);
- } else
- return false;
- return true;
-}
-
-Mus6::Mus6(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 35;
- _id = MUS6;
- _shown[0] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[13] = kShownTrue;
- _shown[19] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, ENCRYPTED_DOOR, EXIT | OPENABLE | CLOSED | COMBINABLE, 0, 0, 7, MUS5, 2);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 1, 1, 8, MUS7, 22);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, BIG_DOOR, EXIT | OPENABLE | CLOSED, 6, 6, 0);
-}
-
-void Mus6::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus6::animation() {
-}
-
-bool Mus6::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, SP_KEYCARD, ENCRYPTED_DOOR) &&
- !(_objectState[0]._type & OPENED)) {
- if (_gm->crackDoor(50)) {
- _vm->renderImage(7);
- _objectState[0]._type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS5]->getObject(1)->_type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS5]->setSectionVisible(8, kShownTrue);
- _vm->playSound(kAudioTaxiOpen);
- }
- } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR &&
- (obj1._type & OPENED)) {
- _vm->renderImage(7 + 128);
- _objectState[0]._type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS5]->getObject(1)->_type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS5]->setSectionVisible(8, kShownFalse);
- _vm->playSound(kAudioElevator1);
- } else if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, SP_KEYCARD, BIG_DOOR))
- _vm->renderMessage(kStringMuseum14);
- else
- return false;
- return true;
-}
-
-Mus7::Mus7(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 35;
- _id = MUS7;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[14] = kShownTrue;
- _shown[16] = kShownTrue;
- _shown[25] = kShownTrue;
- _shown[28] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 0, 0, 7, MUS6, 2);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 3, 3, 10, MUS11, 15);
-}
-
-void Mus7::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus7::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus7::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- return false;
-}
-
-Mus8::Mus8(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 34;
- _id = MUS8;
- _shown[0] = kShownTrue;
- _shown[12] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 0, 0, 1, MUS1, 10);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, ENCRYPTED_DOOR, EXIT | OPENABLE | CLOSED | COMBINABLE, 1, 1, 2, MUS9, 14);
-}
-
-void Mus8::onEntrance() {
- _gm->securityEntrance();
- setRoomSeen(true);
-}
-
-void Mus8::animation() {
-}
-
-bool Mus8::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, SP_KEYCARD, ENCRYPTED_DOOR) &&
- !(_objectState[1]._type & OPENED)) {
- if (_gm->crackDoor(50)) {
- _vm->renderImage(2);
- _objectState[1]._type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS9]->getObject(0)->_type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS9]->setSectionVisible(1, kShownTrue);
- _vm->playSound(kAudioTaxiOpen);
- }
- } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR &&
- (obj1._type & OPENED)) {
- _vm->renderImage(2 + 128);
- _objectState[1]._type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS9]->getObject(0)->_type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS9]->setSectionVisible(1, kShownFalse);
- _vm->playSound(kAudioElevator1);
- } else
- return false;
- return true;
-}
-
-Mus9::Mus9(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 34;
- _id = MUS9;
- _shown[0] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[10] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, ENCRYPTED_DOOR, EXIT | OPENABLE | CLOSED | COMBINABLE, 0, 0, 1, MUS8, 10);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 1, 1, 2, MUS5, 14);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, SMALL_DOOR, EXIT | OPENABLE | CLOSED, 3, 3, 0, MUS_ROUND, 21);
-}
-
-void Mus9::onEntrance() {
- _gm->securityEntrance();
- setRoomSeen(true);
-}
-
-void Mus9::animation() {
-}
-
-bool Mus9::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, SP_KEYCARD, ENCRYPTED_DOOR) &&
- !(_objectState[0]._type & OPENED)) {
- if (_gm->crackDoor(50)) {
- _vm->renderImage(1);
- _objectState[0]._type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS8]->getObject(1)->_type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS8]->setSectionVisible(2, kShownTrue);
- _vm->playSound(kAudioTaxiOpen);
- }
- } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR &&
- (obj1._type & OPENED)) {
- _vm->renderImage(1 + 128);
- _objectState[0]._type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS8]->getObject(1)->_type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS8]->setSectionVisible(2, kShownFalse);
- _vm->playSound(kAudioElevator1);
- } else if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, SP_KEYCARD, SMALL_DOOR) &&
- !(_objectState[2]._type & OPENED)) {
- if (_gm->crackDoor(50)) {
- _vm->renderImage(6);
- setSectionVisible(5, kShownFalse);
- _objectState[2]._type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS_ROUND]->getObject(0)->_type = EXIT | OPENABLE | OPENED;
- _vm->playSound(kAudioTaxiOpen);
- }
- } else if (verb == ACTION_CLOSE && obj1._id == SMALL_DOOR &&
- (obj1._type & OPENED)) {
- _vm->renderImage(5);
- setSectionVisible(6, kShownFalse);
- _objectState[2]._type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS_ROUND]->getObject(0)->_type = EXIT | OPENABLE | CLOSED;
- _vm->playSound(kAudioElevator1);
- } else
- return false;
- return true;
-}
-
-Mus10::Mus10(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 34;
- _id = MUS10;
- _shown[0] = kShownTrue;
- _shown[11] = kShownTrue;
- _shown[13] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 0, 0, 1, MUS3, 10);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 1, 1, 2, MUS11, 14);
- _objectState[2] = Object(_id, kStringMainEntrance, kStringDefaultDescription, BIG_DOOR, EXIT | OPENABLE | CLOSED, 4, 4, 0);
-}
-
-void Mus10::onEntrance() {
- _gm->securityEntrance();
- setRoomSeen(true);
-}
-
-void Mus10::animation() {
-}
-
-bool Mus10::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- if (verb == ACTION_USE && Object::combine(obj1, obj2, SP_KEYCARD, BIG_DOOR)) {
- _vm->renderMessage(kStringMuseum14);
- return true;
- }
- return false;
-}
-
-Mus11::Mus11(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 34;
- _id = MUS11;
- _shown[0] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[9] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 0, 0, 1, MUS10, 10);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, DOOR, EXIT | OPENABLE, 1, 1, 2, MUS7, 14);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, SMALL_DOOR, EXIT | OPENABLE, 2, 2, 0, MUS_ENTRANCE, 21);
-}
-
-void Mus11::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus11::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus11::interact(Action verb, Object &obj1, Object &obj2) {
- _gm->museumDoorInteract(verb, obj1, obj2);
- if (verb == ACTION_OPEN && obj1._id == SMALL_DOOR && !(obj1._type & OPENED)) {
- obj1._type |= OPENED;
- _vm->renderImage(4);
- setSectionVisible(3, kShownFalse);
- _vm->playSound(kAudioTaxiOpen);
- } else if (verb == ACTION_CLOSE && obj1._id == SMALL_DOOR &&
- (obj1._type & OPENED)) {
- obj1._type &= ~OPENED;
- _vm->renderImage(3);
- setSectionVisible(4, kShownFalse);
- _vm->playSound(kAudioElevator1);
- } else
- return false;
- return true;
-}
-
-MusRound::MusRound(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 33;
- _id = MUS_ROUND;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, ENCRYPTED_DOOR, EXIT | OPENABLE | OPENED | COMBINABLE, 0, 0, 1, MUS9, 2);
- _objectState[1] = Object(_id, kStringCorridor, kStringDefaultDescription, NULLOBJECT, EXIT, 1, 1, 0, MUS13, 10);
- _objectState[2] = Object(_id, kStringCorridor, kStringDefaultDescription, NULLOBJECT, EXIT, 2, 2, 0, MUS12, 14);
- _objectState[3] = Object(_id, kStringDinosaur, kStringDinosaurDescription2, NULLOBJECT, NULLTYPE, 3, 3, 0);
- _objectState[4] = Object(_id, kStringDinosaurHead, kStringDinosaurHeadDescription, HEAD, TAKE, 4, 4, 2);
-}
-
-void MusRound::onEntrance() {
- setRoomSeen(true);
-}
-
-void MusRound::animation() {
-}
-
-bool MusRound::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, SP_KEYCARD, ENCRYPTED_DOOR) &&
- !(_objectState[0]._type & OPENED)) {
- if (_gm->crackDoor(50)) {
- _vm->renderImage(1);
- _objectState[0]._type = EXIT | OPENABLE | OPENED;
- _gm->_rooms[MUS9]->getObject(2)->_type = EXIT | OPENABLE | OPENED;
- _vm->playSound(kAudioTaxiOpen);
- }
- } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR &&
- (obj1._type & OPENED)) {
- _vm->renderImage(1 + 128);
- _objectState[0]._type = EXIT | OPENABLE | CLOSED;
- _gm->_rooms[MUS9]->getObject(2)->_type = EXIT | OPENABLE | CLOSED;
- _vm->playSound(kAudioElevator1);
- } else if (verb == ACTION_TAKE && obj1._id == HEAD && !(obj1._type & CARRIED)) {
- _gm->takeObject(obj1);
- _vm->playSound(kAudioSuccess);
- } else
- return false;
- return true;
-}
-
-Mus12::Mus12(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 37;
- _id = MUS12;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[13] = kShownTrue;
- _shown[17] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringCorridor, kStringDefaultDescription, NULLOBJECT, EXIT, 6, 6, 0, MUS_ROUND, 10);
-}
-
-void Mus12::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus12::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus12::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus13::Mus13(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 37;
- _id = MUS13;
- _shown[0] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[14] = kShownTrue;
- _shown[16] = kShownTrue;
- _objectState[0] = Object(_id, kStringCorridor, kStringDefaultDescription, NULLOBJECT, EXIT, 7, 7, 0, MUS_ROUND, 14);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE, 0, 0, 7, MUS14, 10);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE, 3, 3, 10, MUS15, 16);
-}
-
-void Mus13::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus13::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus13::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus14::Mus14(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 37;
- _id = MUS14;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[8] = kShownTrue;
- _shown[15] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED, 1, 1, 8, MUS13, 14);
-}
-
-void Mus14::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus14::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus14::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus15::Mus15(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 36;
- _id = MUS15;
- _shown[0] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[8] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED, 0, 0, 3, MUS13, 2);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE, 1, 1, 4, MUS16, 22);
-}
-
-void Mus15::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus15::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus15::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus16::Mus16(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 36;
- _id = MUS16;
- _shown[0] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[10] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED, 0, 0, 3, MUS15, 2);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE, 1, 1, 4, MUS17, 22);
-}
-
-void Mus16::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus16::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus16::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus17::Mus17(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 37;
- _id = MUS17;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[9] = kShownTrue;
- _shown[17] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED, 2, 2, 9, MUS16, 6);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE, 1, 1, 8, MUS21, 14);
- _objectState[2] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE, 3, 3, 10, MUS18, 16);
- _objectState[3] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE, 4, 4, 11, MUS20, 8);
-}
-
-void Mus17::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus17::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus17::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus18::Mus18(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 36;
- _id = MUS18;
- _shown[0] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[11] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED, 0, 0, 3, MUS17, 2);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE, 1, 1, 4, MUS19, 22);
-}
-
-void Mus18::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus18::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus18::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus19::Mus19(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 37;
- _id = MUS19;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[11] = kShownTrue;
- _shown[15] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED, 4, 4, 11, MUS18, 8);
-}
-
-void Mus19::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus19::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus19::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus20::Mus20(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 36;
- _id = MUS20;
- _shown[0] = kShownTrue;
- _shown[1] = kShownTrue;
- _shown[4] = kShownTrue;
- _shown[7] = kShownTrue;
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED, 1, 1, 4, MUS17, 22);
-}
-
-void Mus20::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus20::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus20::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus21::Mus21(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 37;
- _id = MUS21;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[6] = kShownTrue;
- _shown[7] = kShownTrue;
- _shown[18] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED, 0, 0, 7, MUS17, 10);
- _objectState[1] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE, 3, 3, 10, MUS22, 16);
-}
-
-void Mus21::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus21::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus21::interact(Action verb, Object &obj1, Object &obj2) {
- return false;
-}
-
-Mus22::Mus22(Supernova2Engine *vm, GameManager *gm) {
- _vm = vm;
- _gm = gm;
-
- _fileNumber = 36;
- _id = MUS22;
- _shown[0] = kShownTrue;
- _shown[2] = kShownTrue;
- _shown[3] = kShownTrue;
- _shown[5] = kShownTrue;
- _shown[9] = kShownTrue;
-
- _objectState[0] = Object(_id, kStringDoor, kStringDefaultDescription, NULLOBJECT, EXIT | OPENABLE | OPENED, 0, 0, 3, MUS21, 2);
- _objectState[1] = Object(_id, kStringAlarmSystem, kStringDefaultDescription, ALARM_SYSTEM, COMBINABLE, 2, 2, 0);
- _objectState[2] = Object(_id, kStringSuctionCup, kStringDefaultDescription, SUCTION_CUP, TAKE | COMBINABLE, 255, 255, 0);
- _objectState[3] = Object(_id, kStringWall, kStringDefaultDescription, WALL, COMBINABLE, 4, 4, 0);
-}
-
-void Mus22::onEntrance() {
- _gm->pressureAlarmEntrance();
-}
-
-void Mus22::animation() {
- _gm->pressureAlarmCount();
-}
-
-bool Mus22::interact(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_USE && Object::combine(obj1, obj2, SUCTION_CUP, WALL)) {
- if (isSectionVisible(6))
- _vm->renderMessage(kStringMuseum17);
- else {
- _vm->renderImage(6);
- _vm->renderMessage(kStringMuseum18);
- _objectState[2]._click = 3;
- if (obj1._id == SUCTION_CUP)
- _gm->_inventory.remove(obj1);
- else
- _gm->_inventory.remove(obj2);
- }
- } else if (verb == ACTION_TAKE && obj1._id == SUCTION_CUP &&
- !(obj1._type & CARRIED)) {
- _vm->renderImage(2);
- setSectionVisible(6, kShownFalse);
- _vm->renderImage(5);
- _gm->takeObject(obj1);
- _vm->renderMessage(kStringMuseum19);
- } else if (verb == ACTION_USE &&
- Object::combine(obj1, obj2, ALARM_CRACKER, ALARM_SYSTEM)) {
- if (_gm->_state._alarmCracked)
- _vm->renderMessage(kStringMuseum20);
- else {
- _vm->renderMessage(kStringMuseum21);
- _gm->crack(20);
- if (!_gm->_state._alarmOn) {
- _vm->renderMessage(kStringMuseum22);
- _vm->playSound(kAudioSuccess);
- _gm->_state._alarmCracked = true;
- }
- }
- } else
- return false;
- return true;
-}
-
-}
diff --git a/engines/supernova2/rooms.h b/engines/supernova2/rooms.h
deleted file mode 100644
index 46a86eda17..0000000000
--- a/engines/supernova2/rooms.h
+++ /dev/null
@@ -1,812 +0,0 @@
-/* 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 SUPERNOVA2_ROOMS_H
-#define SUPERNOVA2_ROOMS_H
-
-#include "common/str.h"
-
-#include "supernova2/ms2_def.h"
-
-namespace Common {
-class ReadStream;
-class WriteStream;
-}
-
-namespace Supernova2 {
-
-class GameManager;
-class Supernova2Engine;
-
-struct RoomEntry {
- int _e;
- int _s;
- int _z;
- int _r;
- RoomId _exitRoom;
-};
-
-class Room {
-public:
- Room();
-
- bool hasSeen();
- void setRoomSeen(bool seen);
- int getFileNumber() const;
- RoomId getId() const;
- void setSectionVisible(uint section, bool visible);
- bool isSectionVisible(uint index) const;
- void removeSentence(int sentence, int number);
- void removeSentenceByMask(int mask, int number);
- void addSentence(int sentence, int number);
- void addAllSentences(int number);
- bool sentenceRemoved(int sentence, int number);
- bool allSentencesRemoved(int maxSentence, int number);
- Object *getObject(uint index);
-
- virtual ~Room();
- virtual void animation();
- virtual void onEntrance();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
- virtual bool serialize(Common::WriteStream *out);
- virtual bool deserialize(Common::ReadStream *in, int version);
-
-protected:
- int _fileNumber;
- char _shown[kMaxSection];
- byte _sentenceRemoved[kMaxDialog];
- Object _objectState[kMaxObject];
- RoomId _id;
- Supernova2Engine *_vm;
- GameManager *_gm;
-
-private:
- bool _seen;
-};
-
-class Intro : public Room {
-public:
- Intro(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
-
-private:
- void titleScreen();
- bool tvSay(int mod1, int mod2, int rest, MessagePosition pos, StringId id);
- bool tvRest(int mod1, int mod2, int rest);
- bool displayThoughtMessage(StringId id);
- bool thoughts1();
- bool tvDialogue();
- bool thoughts2();
-
- Common::String _introText;
-};
-
-class Airport : public Room {
-public:
- Airport(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
-
-private:
-};
-
-class TaxiStand : public Room {
-public:
- TaxiStand(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Street : public Room {
-public:
- Street(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Games : public Room {
-public:
- Games(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Cabin : public Room {
-public:
- Cabin(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
- bool _paid;
-};
-
-class Kiosk : public Room {
-public:
- Kiosk(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class CulturePalace : public Room {
-public:
- CulturePalace(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
- void notEnoughMoney();
-};
-
-class Checkout : public Room {
-public:
- Checkout(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
- void appearance();
- void shouting();
-};
-
-class City1 : public Room {
-public:
- City1(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class City2 : public Room {
-public:
- City2(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Elevator : public Room {
-public:
- Elevator(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
- void jobDescription();
-};
-
-class Apartment : public Room {
-public:
- Apartment(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Ship : public Room {
-public:
- Ship(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
- Common::String _outroText;
- Common::String _outroText2;
-
-private:
- void kill();
- void outro();
-};
-
-class Pyramid : public Room {
-public:
- Pyramid(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class PyrEntrance : public Room {
-public:
- PyrEntrance(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
- uint32 _waitTime;
-};
-
-class Upstairs1 : public Room {
-public:
- Upstairs1(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Downstairs1 : public Room {
-public:
- Downstairs1(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class BottomRightDoor : public Room {
-public:
- BottomRightDoor(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class BottomLeftDoor : public Room {
-public:
- BottomLeftDoor(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Upstairs2 : public Room {
-public:
- Upstairs2(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Downstairs2 : public Room {
-public:
- Downstairs2(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class UpperDoor : public Room {
-public:
- UpperDoor(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class PuzzleFront : public Room {
-public:
- PuzzleFront(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class PuzzleBehind : public Room {
-public:
- PuzzleBehind(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Formula1F : public Room {
-public:
- Formula1F(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Formula1N : public Room {
-public:
- Formula1N(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Formula2F : public Room {
-public:
- Formula2F(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Formula2N : public Room {
-public:
- Formula2N(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class TomatoF : public Room {
-public:
- TomatoF(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class TomatoN : public Room {
-public:
- TomatoN(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class MonsterF : public Room {
-public:
- MonsterF(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Monster1N : public Room {
-public:
- Monster1N(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Monster2N : public Room {
-public:
- Monster2N(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Upstairs3 : public Room {
-public:
- Upstairs3(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Downstairs3 : public Room {
-public:
- Downstairs3(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class LCorridor1 : public Room {
-public:
- LCorridor1(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class LCorridor2 : public Room {
-public:
- LCorridor2(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class HoleRoom : public Room {
-public:
- HoleRoom(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class InHole : public Room {
-public:
- InHole(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Floordoor : public Room {
-public:
- Floordoor(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class FloordoorU : public Room {
-public:
- FloordoorU(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class BstDoor : public Room {
-public:
- BstDoor(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
- char _password[16];
-};
-
-class Hall : public Room {
-public:
- Hall(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class CoffinRoom : public Room {
-public:
- CoffinRoom(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mask : public Room {
-public:
- Mask(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Museum : public Room {
-public:
- Museum(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class MusEntrance : public Room {
-public:
- MusEntrance(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus1 : public Room {
-public:
- Mus1(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus2 : public Room {
-public:
- Mus2(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus3 : public Room {
-public:
- Mus3(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus4 : public Room {
-public:
- Mus4(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus5 : public Room {
-public:
- Mus5(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus6 : public Room {
-public:
- Mus6(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus7 : public Room {
-public:
- Mus7(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus8 : public Room {
-public:
- Mus8(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus9 : public Room {
-public:
- Mus9(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus10 : public Room {
-public:
- Mus10(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus11 : public Room {
-public:
- Mus11(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class MusRound : public Room {
-public:
- MusRound(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus12 : public Room {
-public:
- Mus12(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus13 : public Room {
-public:
- Mus13(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus14 : public Room {
-public:
- Mus14(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus15 : public Room {
-public:
- Mus15(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus16 : public Room {
-public:
- Mus16(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus17 : public Room {
-public:
- Mus17(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus18 : public Room {
-public:
- Mus18(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus19 : public Room {
-public:
- Mus19(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus20 : public Room {
-public:
- Mus20(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus21 : public Room {
-public:
- Mus21(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-class Mus22 : public Room {
-public:
- Mus22(Supernova2Engine *vm, GameManager *gm);
- virtual void onEntrance();
- virtual void animation();
- virtual bool interact(Action verb, Object &obj1, Object &obj2);
-
-private:
-};
-
-}
-#endif // SUPERNOVA2_ROOMS_H
diff --git a/engines/supernova2/screen.cpp b/engines/supernova2/screen.cpp
deleted file mode 100644
index fd2eabec19..0000000000
--- a/engines/supernova2/screen.cpp
+++ /dev/null
@@ -1,642 +0,0 @@
-/* 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/str.h"
-#include "common/system.h"
-#include "common/config-manager.h"
-#include "engines/util.h"
-#include "graphics/cursorman.h"
-#include "graphics/palette.h"
-#include "graphics/surface.h"
-
-#include "supernova2/imageid.h"
-#include "supernova2/state.h"
-#include "supernova2/screen.h"
-#include "supernova2/supernova2.h"
-
-#include "supernova2/screenstatic.cpp"
-
-namespace Supernova2 {
-
-ScreenBuffer::ScreenBuffer()
- : _x(0)
- , _y(0)
- , _width(0)
- , _height(0)
- , _pixels(nullptr) {
-}
-
-ScreenBufferStack::ScreenBufferStack()
- : _last(_buffer) {
-}
-
-void ScreenBufferStack::push(int x, int y, int width, int height) {
- if (_last == ARRAYEND(_buffer))
- return;
-
- Graphics::Surface *screenSurface = g_system->lockScreen();
-
- if (x < 0) {
- width += x;
- x = 0;
- }
-
- if (x + width > screenSurface->w)
- width = screenSurface->w - x;
-
- if (y < 0) {
- height += y;
- y = 0;
- }
-
- if (y + height > screenSurface->h)
- height = screenSurface->h - y;
-
- _last->_pixels = new byte[width * height];
- byte *pixels = _last->_pixels;
- const byte *screen = static_cast<const byte *>(screenSurface->getBasePtr(x, y));
- for (int i = 0; i < height; ++i) {
- Common::copy(screen, screen + width, pixels);
- screen += screenSurface->pitch;
- pixels += width;
- }
- g_system->unlockScreen();
-
- _last->_x = x;
- _last->_y = y;
- _last->_width = width;
- _last->_height = height;
-
- ++_last;
-}
-
-void ScreenBufferStack::restore() {
- if (_last == _buffer)
- return;
-
- --_last;
- g_system->lockScreen()->copyRectToSurface(_last->_pixels, _last->_width, _last->_x,
- _last->_y, _last->_width, _last->_height);
- g_system->unlockScreen();
-
- delete[] _last->_pixels;
-}
-
-Marquee::Marquee(Screen *screen, MarqueeId id, const char *text)
- : _text(text)
- , _textBegin(text)
- , _delay(0)
- , _color(kColorPurple)
- , _loop(false)
- , _screen(screen) {
- if (id == kMarqueeIntro) {
- _y = 191;
- _loop = true;
- } else if (id == kMarqueeOutro) {
- _y = 191;
- }
-
- _textWidth = Screen::textWidth(_text);
- _x = kScreenWidth / 2 - _textWidth / 2;
- _screen->_textCursorX = _x;
- _screen->_textCursorY = _y;
- _screen->_textColor = _color;
-}
-
-void Marquee::clearText() {
- _screen->renderBox(_x, _y - 1, _textWidth + 1, 9, kColorBlack);
-}
-
-void Marquee::reset() {
- _text = _textBegin;
- clearText();
- _textWidth = Screen::textWidth(_text);
- _x = kScreenWidth / 2 - _textWidth / 2;
- _screen->_textCursorX = _x;
-}
-
-bool Marquee::renderCharacter() {
- if (_delay != 0) {
- _delay--;
- return true;
- }
-
- switch (*_text) {
- case '\233':
- if (_loop) {
- _loop = false;
- _text = _textBegin;
- clearText();
- _textWidth = Screen::textWidth(_text);
- _x = kScreenWidth / 2 - _textWidth / 2;
- _screen->_textCursorX = _x;
- }
- else
- return false;
- break;
- case '\0':
- clearText();
- _text++;
- _textWidth = Screen::textWidth(_text);
- _x = kScreenWidth / 2 - _textWidth / 2;
- _screen->_textCursorX = _x;
- _color = kColorBlue;
- _screen->_textColor = kColorPurple;
- break;
- case '^':
- _color = kColorLightYellow;
- _screen->_textColor = _color;
- _text++;
- break;
- case '#':
- _delay = 50;
- _text++;
- break;
- default:
- _screen->renderText((uint16)*_text++);
- _delay = 1;
- break;
- }
- return true;
-}
-
-Screen::Screen(Supernova2Engine *vm, ResourceManager *resMan)
- : _vm(vm)
- , _resMan(resMan)
- , _currentImage(nullptr)
- , _viewportBrightness(255)
- , _guiBrightness(255)
- , _screenWidth(320)
- , _screenHeight(200)
- , _textColor(kColorBlack)
- , _textCursorX(0)
- , _textCursorY(0)
- , _messageShown(false) {
-
- changeCursor(ResourceManager::kCursorNormal);
-}
-
-int Screen::getGuiBrightness() const {
- return _guiBrightness;
-}
-
-void Screen::setViewportBrightness(int brightness) {
- _viewportBrightness = brightness;
-}
-
-int Screen::getViewportBrightness() const {
- return _viewportBrightness;
-}
-
-void Screen::setGuiBrightness(int brightness) {
- _guiBrightness = brightness;
-}
-
-MS2Image *Screen::getCurrentImage() {
- return _currentImage;
-}
-
-const Screen::ImageInfo *Screen::getImageInfo(ImageId id) const {
- return &imageInfo[(int)id];
-}
-
-bool Screen::isMessageShown() const {
- return _messageShown;
-}
-
-Common::Point Screen::getTextCursorPos() {
- return Common::Point(_textCursorX, _textCursorY);
-}
-
-void Screen::setTextCursorPos(int x, int y) {
- _textCursorX = x;
- _textCursorY = y;
-}
-
-byte Screen::getTextCursorColor() {
- return _textColor;
-}
-
-void Screen::setTextCursorColor(byte color) {
- _textColor = color;
-}
-
-void Screen::renderMessage(StringId stringId, MessagePosition position,
- Common::String var1, Common::String var2) {
- Common::String text = _vm->getGameString(stringId);
-
- if (!var1.empty()) {
- if (!var2.empty())
- text = Common::String::format(text.c_str(), var1.c_str(), var2.c_str());
- else
- text = Common::String::format(text.c_str(), var1.c_str());
- }
-
- renderMessage(text, position);
-}
-
-void Screen::renderMessage(const Common::String &text, MessagePosition position) {
- if (!text.empty())
- renderMessage(text.c_str(), position);
-}
-
-void Screen::renderText(const uint16 character) {
- char text[2];
- text[0] = character & 0xFF;
- text[1] = 0;
- renderText(text, _textCursorX, _textCursorY, _textColor);
-}
-
-void Screen::renderText(const char *text) {
- renderText(text, _textCursorX, _textCursorY, _textColor);
-}
-
-void Screen::renderText(StringId stringId) {
- renderText(_vm->getGameString(stringId));
-}
-
-void Screen::renderText(const Common::String &text) {
- if (!text.empty())
- renderText(text.c_str());
-}
-
-void Screen::renderText(const GuiElement &guiElement) {
- renderText(guiElement.getText(), guiElement.getTextPos().x,
- guiElement.getTextPos().y, guiElement.getTextColor());
-}
-
-void Screen::renderText(const uint16 character, int x, int y, byte color) {
- char text[2];
- text[0] = character & 0xFF;
- text[1] = 0;
- renderText(text, x, y, color);
-}
-
-void Screen::renderText(const char *text, int x, int y, byte color) {
- Graphics::Surface *screen = _vm->_system->lockScreen();
- byte *cursor = static_cast<byte *>(screen->getBasePtr(x, y));
- const byte *basePtr = cursor;
-
- byte c;
- while ((c = *text++) != '\0') {
- if (c < 32) {
- continue;
- } else if (c == 225) {
- c = 128;
- }
-
- for (uint i = 0; i < 5; ++i) {
- if (font[c - 32][i] == 0xff) {
- break;
- }
-
- byte *ascentLine = cursor;
- for (byte j = font[c - 32][i]; j != 0; j >>= 1) {
- if (j & 1) {
- *cursor = color;
- }
- cursor += kScreenWidth;
- }
- cursor = ++ascentLine;
- }
- ++cursor;
- }
- _vm->_system->unlockScreen();
-
- uint numChars = cursor - basePtr;
- uint absPosition = y * kScreenWidth + x + numChars;
- _textCursorX = absPosition % kScreenWidth;
- _textCursorY = absPosition / kScreenWidth;
- _textColor = color;
-}
-
-void Screen::renderText(const Common::String &text, int x, int y, byte color) {
- if (!text.empty())
- renderText(text.c_str(), x, y, color);
-}
-
-void Screen::renderText(StringId stringId, int x, int y, byte color) {
- renderText(_vm->getGameString(stringId), x, y, color);
-}
-
-void Screen::renderImageSection(const MS2Image *image, int section, bool invert) {
- // Note: inverting means we are removing the section. So we should get the rect for that
- // section but draw the background (section 0) instead.
- if (section > image->_numSections - 1)
- return;
-
- Common::Rect sectionRect(image->_section[section].x1,
- image->_section[section].y1,
- image->_section[section].x2 + 1,
- image->_section[section].y2 + 1);
- if (image->_filenumber == 38 ||
- (image->_filenumber == 28 && ConfMan.get("language") == "en")) {
- sectionRect.setWidth(640);
- sectionRect.setHeight(480);
- if (_screenWidth != 640) {
- _screenWidth = 640;
- _screenHeight = 480;
- initGraphics(_screenWidth, _screenHeight);
- }
- } else {
- if (_screenWidth != 320) {
- _screenWidth = 320;
- _screenHeight = 200;
- initGraphics(_screenWidth, _screenHeight);
- }
- }
-
- uint offset = 0;
- int pitch = sectionRect.width();
- if (invert) {
- pitch = image->_pitch;
- offset = image->_section[section].y1 * pitch +
- image->_section[section].x1;
- section = 0;
- }
-
- void *pixels = image->_sectionSurfaces[section]->getPixels();
- _vm->_system->copyRectToScreen(static_cast<const byte *>(pixels) + offset,
- pitch, sectionRect.left, sectionRect.top,
- sectionRect.width(), sectionRect.height());
-}
-
-void Screen::renderImage(ImageId id, bool removeImage) {
- ImageInfo info = imageInfo[id];
- const MS2Image *image = _resMan->getImage(info.filenumber);
-
- if (_currentImage != image)
- setCurrentImage(info.filenumber);
-
- do {
- renderImageSection(image, info.section, removeImage);
- info.section = image->_section[info.section].next;
- } while (info.section != 0);
-}
-
-void Screen::renderImage(int section) {
- bool removeImage = false;
- if (section > 128) {
- removeImage = true;
- section -= 128;
- }
-
- if (!_currentImage || section >= kMaxSection)
- return;
-
- do {
- renderImageSection(_currentImage, section, removeImage);
- section = _currentImage->_section[section].next;
- } while (section != 0);
-}
-
-bool Screen::setCurrentImage(int filenumber) {
- _currentImage = _resMan->getImage(filenumber);
- _vm->_system->getPaletteManager()->setPalette(_currentImage->getPalette(), 16, 239);
- paletteBrightness();
-
- return true;
-}
-
-void Screen::saveScreen(int x, int y, int width, int height) {
- _screenBuffer.push(x, y, width, height);
-}
-
-void Screen::saveScreen(const GuiElement &guiElement) {
- saveScreen(guiElement.left, guiElement.top, guiElement.width(), guiElement.height());
-}
-
-void Screen::restoreScreen() {
- _screenBuffer.restore();
-}
-
-void Screen::renderRoom(Room &room) {
- if (room.getId() == INTRO)
- return;
-
- if (setCurrentImage(room.getFileNumber())) {
- for (int i = 0; i < _currentImage->_numSections; ++i) {
- int section = i;
- if (room.isSectionVisible(section)) {
- do {
- renderImageSection(_currentImage, section, false);
- section = _currentImage->_section[section].next;
- } while (section != 0);
- }
- }
- }
-}
-
-int Screen::textWidth(const uint16 key) {
- char text[2];
- text[0] = key & 0xFF;
- text[1] = 0;
- return textWidth(text);
-}
-
-int Screen::textWidth(const char *text) {
- int charWidth = 0;
- while (*text != '\0') {
- byte c = *text++;
- if (c < 32) {
- continue;
- } else if (c == 225) {
- c = 35;
- }
-
- for (uint i = 0; i < 5; ++i) {
- if (font[c - 32][i] == 0xff) {
- break;
- }
- ++charWidth;
- }
- ++charWidth;
- }
-
- return charWidth;
-}
-
-int Screen::textWidth(const Common::String &text) {
- return Screen::textWidth(text.c_str());
-}
-
-void Screen::renderMessage(const char *text, MessagePosition position, int positionX, int positionY) {
- Common::String t(text);
- char *row[20];
- Common::String::iterator p = t.begin();
- uint numRows = 0;
- int rowWidthMax = 0;
- int x = 0;
- int y = 0;
- byte textColor = 0;
-
- while (*p != '\0') {
- row[numRows] = p;
- ++numRows;
- while ((*p != '\0') && (*p != '|')) {
- ++p;
- }
- if (*p == '|') {
- *p = '\0';
- ++p;
- }
- }
- for (uint i = 0; i < numRows; ++i) {
- int rowWidth = textWidth(row[i]);
- if (rowWidth > rowWidthMax)
- rowWidthMax = rowWidth;
- }
-
- switch (position) {
- case kMessageNormal:
- x = 160 - rowWidthMax / 2;
- textColor = kColorWhite99;
- break;
- case kMessageTop:
- x = 160 - rowWidthMax / 2;
- textColor = kColorLightYellow;
- break;
- case kMessageCenter:
- x = 160 - rowWidthMax / 2;
- textColor = kColorLightRed;
- break;
- case kMessageLeft:
- x = 3;
- textColor = kColorLightYellow;
- break;
- case kMessageRight:
- x = 317 - rowWidthMax;
- textColor = kColorLightGreen;
- break;
- }
-
- if (position == kMessageNormal) {
- y = 70 - ((numRows * 9) / 2);
- } else if (position == kMessageTop) {
- y = 5;
- } else {
- y = 142;
- }
-
- if (positionX != -1 && positionY != -1) {
- x = positionX;
- y = positionY;
- }
-
- int message_columns = x - 3;
- int message_rows = y - 3;
- int message_width = rowWidthMax + 6;
- int message_height = numRows * 9 + 5;
- saveScreen(message_columns, message_rows, message_width, message_height);
- renderBox(message_columns, message_rows, message_width, message_height, kColorWhite25);
- for (uint i = 0; i < numRows; ++i) {
- renderText(row[i], x, y, textColor);
- y += 9;
- }
-
- _messageShown = true;
-}
-
-void Screen::removeMessage() {
- if (_messageShown) {
- restoreScreen();
- _messageShown = false;
- }
-}
-
-void Screen::renderBox(int x, int y, int width, int height, byte color) {
- Graphics::Surface *screen = _vm->_system->lockScreen();
- screen->fillRect(Common::Rect(x, y, x + width, y + height), color);
- _vm->_system->unlockScreen();
-}
-
-void Screen::renderBox(const GuiElement &guiElement) {
- renderBox(guiElement.left, guiElement.top, guiElement.width(),
- guiElement.height(), guiElement.getBackgroundColor());
-}
-
-void Screen::initPalette() {
- g_system->getPaletteManager()->setPalette(initVGAPalette, 0, 256);
-}
-
-void Screen::paletteBrightness() {
- byte palette[768];
-
- _vm->_system->getPaletteManager()->grabPalette(palette, 0, 255);
- for (uint i = 0; i < 48; ++i) {
- palette[i] = (initVGAPalette[i] * _guiBrightness) >> 8;
- }
- for (uint i = 0; i < 717; ++i) {
- const byte *imagePalette;
- if (_currentImage && _currentImage->getPalette()) {
- imagePalette = _currentImage->getPalette();
- } else {
- imagePalette = palette + 48;
- }
- palette[i + 48] = (imagePalette[i] * _viewportBrightness) >> 8;
- }
- _vm->_system->getPaletteManager()->setPalette(palette, 0, 255);
-}
-
-void Screen::paletteFadeOut(int minBrightness) {
- while (_guiBrightness > minBrightness + 10) {
- _guiBrightness -= 10;
- if (_viewportBrightness > _guiBrightness)
- _viewportBrightness = _guiBrightness;
- paletteBrightness();
- _vm->_system->updateScreen();
- _vm->_system->delayMillis(_vm->_delay);
- }
- _guiBrightness = minBrightness;
- _viewportBrightness = minBrightness;
- paletteBrightness();
- _vm->_system->updateScreen();
-}
-
-void Screen::paletteFadeIn(int maxViewportBrightness) {
- while (_guiBrightness < 245) {
- if (_viewportBrightness < maxViewportBrightness)
- _viewportBrightness += 10;
- _guiBrightness += 10;
- paletteBrightness();
- _vm->_system->updateScreen();
- _vm->_system->delayMillis(_vm->_delay);
- }
- _guiBrightness = 255;
- _viewportBrightness = maxViewportBrightness;
- paletteBrightness();
- _vm->_system->updateScreen();
-}
-
-void Screen::setColor63(byte value) {
- byte color[3] = {value, value, value};
- _vm->_system->getPaletteManager()->setPalette(color, 63, 1);
-}
-
-void Screen::changeCursor(ResourceManager::CursorId id) {
- CursorMan.replaceCursor(_resMan->getCursor(id),
- 16, 16, 0, 0, kColorCursorTransparent);
- CursorMan.replaceCursorPalette(initVGAPalette, 0, 16);
- CursorMan.showMouse(true);
-}
-
-}
diff --git a/engines/supernova2/screen.h b/engines/supernova2/screen.h
deleted file mode 100644
index 21d5cf600b..0000000000
--- a/engines/supernova2/screen.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/* 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 SUPERNOVA2_SCREEN_H
-#define SUPERNOVA2_SCREEN_H
-
-#include "common/array.h"
-#include "common/rect.h"
-#include "common/scummsys.h"
-
-#include "supernova2/imageid.h"
-#include "supernova2/ms2_def.h"
-#include "supernova2/resman.h"
-
-namespace Supernova2 {
-
-class Supernova2Engine;
-class GameManager;
-class ResourceManager;
-class GuiElement;
-class Room;
-class MS2Image;
-class Screen;
-
-const int kScreenWidth = 320;
-const int kScreenHeight = 200;
-const int kFontWidth = 4;
-const int kFontHeight = 8;
-
-enum Color {
- kColorBlack = 0,
- kColorWhite25 = 1,
- kColorWhite35 = 2,
- kColorWhite44 = 3,
- kColorWhite99 = 4,
- kColorDarkGreen = 5,
- kColorGreen = 6,
- kColorDarkRed = 7,
- kColorRed = 8,
- kColorDarkBlue = 9,
- kColorBlue = 10,
- kColorWhite63 = 11,
- kColorLightBlue = 12,
- kColorLightGreen = 13,
- kColorLightYellow = 14,
- kColorLightRed = 15,
- kColorPurple = 35,
- kColorCursorTransparent = kColorWhite25
-};
-
-class ScreenBuffer {
- friend class ScreenBufferStack;
-
-public:
- ScreenBuffer();
-
-private:
- byte *_pixels;
- int _x;
- int _y;
- int _width;
- int _height;
-};
-
-class ScreenBufferStack {
-public:
- ScreenBufferStack();
-
- void push(int x, int y, int width, int height);
- void restore();
-
-private:
- ScreenBuffer _buffer[8];
- ScreenBuffer *_last;
-};
-
-class Marquee {
-public:
- enum MarqueeId {
- kMarqueeIntro,
- kMarqueeOutro
- };
-
- Marquee(Screen *screen, MarqueeId id, const char *text);
-
- bool renderCharacter();
- void reset();
-
-private:
- void clearText();
-
- Screen *_screen;
- const char *const _textBegin;
- const char *_text;
- bool _loop;
- int _delay;
- int _color;
- int _x;
- int _y;
- int _textWidth;
-};
-
-class Screen {
- friend class Marquee;
-
-public:
- struct ImageInfo {
- int filenumber;
- int section;
- };
-
-public:
- static void initPalette();
- static int textWidth(const uint16 key);
- static int textWidth(const char *text);
- static int textWidth(const Common::String &text);
-
-public:
- Screen(Supernova2Engine *vm, ResourceManager *resMan);
-
- int getViewportBrightness() const;
- void setViewportBrightness(int brightness);
- int getGuiBrightness() const;
- void setGuiBrightness(int brightness);
- MS2Image *getCurrentImage();
- const ImageInfo *getImageInfo(ImageId id) const;
- bool isMessageShown() const;
- void paletteFadeIn(int maxViewportBrightness);
- void paletteFadeOut(int minBrightness);
- void paletteBrightness();
- void renderImage(ImageId id, bool removeImage = false);
- void renderImage(int section);
- bool setCurrentImage(int filenumber);
- void saveScreen(int x, int y, int width, int height);
- void saveScreen(const GuiElement &guiElement);
- void restoreScreen();
- void renderRoom(Room &room);
- void renderMessage(const char *text, MessagePosition position = kMessageNormal, int positionX = -1, int positionY = -1);
- void renderMessage(const Common::String &text, MessagePosition position = kMessageNormal);
- void renderMessage(StringId stringId, MessagePosition position = kMessageNormal,
- Common::String var1 = "", Common::String var2 = "");
- void removeMessage();
- void renderText(const uint16 character);
- void renderText(const char *text);
- void renderText(const Common::String &text);
- void renderText(StringId stringId);
- void renderText(const uint16 character, int x, int y, byte color);
- void renderText(const char *text, int x, int y, byte color);
- void renderText(const Common::String &text, int x, int y, byte color);
- void renderText(StringId stringId, int x, int y, byte color);
- void renderText(const GuiElement &guiElement);
- void renderBox(int x, int y, int width, int height, byte color);
- void renderBox(const GuiElement &guiElement);
- void setColor63(byte value);
- Common::Point getTextCursorPos();
- void setTextCursorPos(int x, int y);
- byte getTextCursorColor();
- void setTextCursorColor(byte color);
- void update();
- void changeCursor(ResourceManager::CursorId);
-
-private:
- void renderImageSection(const MS2Image *image, int section, bool invert);
-
-private:
- Supernova2Engine *_vm;
- ResourceManager *_resMan;
- MS2Image *_currentImage;
- ScreenBufferStack _screenBuffer;
- int _screenWidth;
- int _screenHeight;
- int _textCursorX;
- int _textCursorY;
- int _textColor;
- byte _viewportBrightness;
- byte _guiBrightness;
- bool _messageShown;
-};
-
-}
-
-#endif
diff --git a/engines/supernova2/screenstatic.cpp b/engines/supernova2/screenstatic.cpp
deleted file mode 100644
index b325f50fa7..0000000000
--- a/engines/supernova2/screenstatic.cpp
+++ /dev/null
@@ -1,542 +0,0 @@
-/* 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.
-*
-*/
-
-namespace Supernova2 {
-
-static const Screen::ImageInfo imageInfo[] = {
- { 0, 0}, { 0, 1}, { 0, 2},
- { 1, 0},
- { 2, 0},
- { 3, 0}, { 3, 1}, { 3, 2}, { 3, 3}, { 3, 4}, { 3, 5},
- { 3, 6}, { 3, 7}, { 3, 8}, { 3, 9}, { 3, 10}, { 3, 11},
- { 4, 0}, { 4, 1}, { 4, 2}, { 4, 3},
- { 5, 0}, { 5, 1}, { 5, 2}, { 5, 3}, { 5, 4}, { 5, 5},
- { 5, 6}, { 5, 7}, { 5, 8}, { 5, 9},
- { 6, 0}, { 6, 1}, { 6, 2}, { 6, 3}, { 6, 4}, { 6, 5},
- { 6, 6}, { 6, 7}, { 6, 8}, { 6, 9}, { 6, 10}, { 6, 11},
- { 6, 12}, { 6, 13}, { 6, 14}, { 6, 15}, { 6, 16}, { 6, 17},
- { 6, 18}, { 6, 19}, { 6, 20}, { 6, 21},
- { 7, 0}, { 7, 1}, { 7, 2}, { 7, 3}, { 7, 4}, { 7, 5},
- { 7, 6}, { 7, 7}, { 7, 8}, { 7, 9}, { 7, 10}, { 7, 11},
- { 7, 12}, { 7, 13}, { 7, 14}, { 7, 15}, { 7, 16}, { 7, 17},
- { 7, 18}, { 7, 19}, { 7, 20}, { 7, 21}, { 7, 22},
- { 8, 0}, { 8, 1}, { 8, 2}, { 8, 3}, { 8, 4}, { 8, 5},
- { 8, 6}, { 8, 7}, { 8, 8}, { 8, 9}, { 8, 10}, { 8, 11},
- { 8, 12},
- { 9, 0}, { 9, 1}, { 9, 2}, { 9, 3}, { 9, 4}, { 9, 5},
- { 9, 6}, { 9, 7}, { 9, 8}, { 9, 9}, { 9, 10}, { 9, 11},
- { 9, 12}, { 9, 13}, { 9, 14}, { 9, 15}, { 9, 16}, { 9, 17},
- { 9, 18}, { 9, 19}, { 9, 20}, { 9, 21}, { 9, 22}, { 9, 23},
- {10, 0}, {10, 1}, {10, 2}, {10, 3}, {10, 4}, {10, 5},
- {10, 6}, {10, 7}, {10, 8}, {10, 9}, {10, 10}, {10, 11},
- {10, 12}, {10, 13}, {10, 14}, {10, 15}, {10, 16},
- {11, 0},
- {12, 0}, {12, 1}, {12, 2}, {12, 3},
- {13, 0}, {13, 1}, {13, 2}, {13, 3}, {13, 4}, {13, 5},
- {13, 6}, {13, 7}, {13, 8}, {13, 9}, {13, 10}, {13, 11},
- {13, 12}, {13, 13},
- {14, 0}, {14, 1}, {14, 2}, {14, 3}, {14, 4}, {14, 5},
- {14, 6}, {14, 7}, {14, 8}, {14, 9}, {14, 10}, {14, 11},
- {14, 12}, {14, 13}, {14, 14}, {14, 15}, {14, 16}, {14, 17},
- {14, 18}, {14, 19},
- {15, 0}, {15, 1}, {15, 2}, {15, 3}, {15, 4}, {15, 5},
- {16, 0}, {16, 1}, {16, 2}, {16, 3}, {16, 4}, {16, 5},
- {16, 6}, {16, 7}, {16, 8}, {16, 9}, {16, 10}, {16, 11},
- {16, 12}, {16, 13}, {16, 14}, {16, 15}, {16, 16}, {16, 17},
- {16, 18}, {16, 19}, {16, 20}, {16, 21}, {16, 22}, {16, 23},
- {16, 24}, {16, 25}, {16, 26}, {16, 27}, {16, 28}, {16, 29},
- {16, 30}, {16, 31}, {16, 32}, {16, 33},
- {17, 0}, {17, 1}, {17, 2}, {17, 3}, {17, 4}, {17, 5},
- {17, 6}, {17, 7}, {17, 8}, {17, 9}, {17, 10}, {17, 11},
- {17, 12}, {17, 13}, {17, 14}, {17, 15},
- {18, 0}, {18, 1}, {18, 2}, {18, 3}, {18, 4}, {18, 5},
- {18, 6}, {18, 7}, {18, 8}, {18, 9}, {18, 10}, {18, 11},
- {18, 12}, {18, 13}, {18, 14}, {18, 15}, {18, 16}, {18, 17},
- {18, 18}, {18, 19}, {18, 20}, {18, 21},
- {19, 0}, {19, 1}, {19, 2}, {19, 3}, {19, 4}, {19, 5},
- {19, 6}, {19, 7}, {19, 8}, {19, 9}, {19, 10}, {19, 11},
- {19, 12}, {19, 13}, {19, 14}, {19, 15}, {19, 16}, {19, 17},
- {19, 18}, {19, 19}, {19, 20}, {19, 21}, {19, 22}, {19, 23},
- {19, 24}, {19, 25}, {19, 26}, {19, 27}, {19, 28}, {19, 29},
- {19, 30}, {19, 31}, {19, 32}, {19, 33}, {19, 34}, {19, 35},
- {19, 36}, {19, 37}, {19, 38}, {19, 39}, {19, 40},
- {20, 0},
- {21, 0}, {21, 1}, {21, 2}, {21, 3}, {21, 4}, {21, 5},
- {21, 6}, {21, 7}, {21, 8}, {21, 9}, {21, 10}, {21, 11},
- {21, 12}, {21, 13}, {21, 14}, {21, 15}, {21, 16}, {21, 17},
- {21, 18}, {21, 19}, {21, 20}, {21, 21}, {21, 22}, {21, 23},
- {21, 24}, {21, 25}, {21, 26}, {21, 27}, {21, 28}, {21, 29},
- {21, 30}, {21, 31}, {21, 32}, {21, 33}, {21, 34}, {21, 35},
- {21, 36}, {21, 37}, {21, 38},
- {22, 0}, {22, 1}, {22, 2}, {22, 3}, {22, 4}, {22, 5},
- {22, 6}, {22, 7}, {22, 8}, {22, 9}, {22, 10}, {22, 11},
- {22, 12}, {22, 13}, {22, 14}, {22, 15}, {22, 16}, {22, 17},
- {22, 18},
- {23, 0},
- {24, 0}, {24, 1}, {24, 2}, {24, 3}, {24, 4}, {24, 5},
- {24, 6}, {24, 7}, {24, 8},
- {25, 0}, {25, 1}, {25, 2}, {25, 3}, {25, 4}, {25, 5},
- {25, 6}, {25, 7}, {25, 8}, {25, 9}, {25, 10}, {25, 11},
- {25, 12}, {25, 13}, {25, 14}, {25, 15}, {25, 16}, {25, 17},
- {25, 18},
- {26, 0},
- {27, 0},
- {28, 0}, {28, 1}, {28, 2}, {28, 3}, {28, 4}, {28, 5},
- {28, 6}, {28, 7}, {28, 8}, {28, 9}, {28, 10}, {28, 11},
- {28, 12}, {28, 13}, {28, 14}, {28, 15}, {28, 16}, {28, 17},
- {28, 18}, {28, 19}, {28, 20}, {28, 21}, {28, 22},
- {29, 0}, {29, 1}, {29, 2}, {29, 3}, {29, 4}, {29, 5},
- {29, 6}, {29, 7}, {29, 8}, {29, 9}, {29, 10}, {29, 11},
- {29, 12}, {29, 13},
- {30, 0}, {30, 1},
- {31, 0}, {31, 1}, {31, 2}, {31, 3}, {31, 4}, {31, 5},
- {31, 6},
- {32, 0}, {32, 1}, {32, 2}, {32, 3},
- {33, 0}, {33, 1}, {33, 2}, {33, 3}, {33, 4}, {33, 5},
- {34, 0}, {34, 1}, {34, 2}, {34, 3}, {34, 4}, {34, 5},
- {34, 6}, {34, 7}, {34, 8}, {34, 9}, {34, 10}, {34, 11},
- {34, 12}, {34, 13}, {34, 14}, {34, 15}, {34, 16}, {34, 17},
- {35, 0}, {35, 1}, {35, 2}, {35, 3}, {35, 4}, {35, 5},
- {35, 6}, {35, 7}, {35, 8}, {35, 9}, {35, 10}, {35, 11},
- {35, 12}, {35, 13}, {35, 14}, {35, 15}, {35, 16}, {35, 17},
- {35, 18}, {35, 19}, {35, 20}, {35, 21},
- {36, 0}, {36, 1}, {36, 2}, {36, 3}, {36, 4}, {36, 5},
- {37, 0}, {37, 1}, {37, 2}, {37, 3}, {37, 4}, {37, 5},
- {37, 6}, {37, 7}, {37, 8}, {37, 9}, {37, 10}, {37, 11},
- {37, 12}, {37, 13}, {37, 14}, {37, 15}, {37, 16}, {37, 17},
- {37, 18}, {37, 19}, {37, 20}, {37, 21}, {37, 22}, {37, 23},
- {37, 24}, {37, 25}, {37, 26},
- {38, 0}, {38, 1}, {38, 2}, {38, 3}, {38, 4}, {38, 5},
- {38, 6}, {38, 7}, {38, 8}, {38, 9}, {38, 10}, {38, 11},
- {38, 12},
- {39, 0},
- {40, 0}, {40, 1}, {40, 2}, {40, 3}, {40, 4}, {40, 5},
- {40, 6}, {40, 7},
- {41, 0}, {41, 1}, {41, 2}, {41, 3},
- {42, 0}, {42, 1}, {42, 2}, {42, 3}, {42, 4}, {42, 5},
- {42, 6}, {42, 7}, {42, 8}, {42, 9}, {42, 10}, {42, 11},
- {43, 0}, {43, 1}, {43, 2}, {43, 3}, {43, 4}, {43, 5},
- {43, 6}, {43, 7}, {43, 8}, {43, 9}, {43, 10}, {43, 11},
- {43, 12}, {43, 13}, {43, 14}, {43, 15}, {43, 16}, {43, 17},
- {43, 18}, {43, 19}, {43, 20}, {43, 21}, {43, 22}, {43, 23},
- {43, 24}, {43, 25}, {43, 26}, {43, 27}, {43, 28}, {43, 29},
- {43, 30}, {43, 31},
- {55, 0}
-};
-
-// Default palette
-static const byte initVGAPalette[768] = {
- 0x00, 0x00, 0x00,
- 0x40, 0x40, 0x40,
- 0x58, 0x58, 0x58,
- 0x70, 0x70, 0x70,
- 0xfc, 0xfc, 0xfc,
- 0x00, 0xd0, 0x00,
- 0x00, 0xfc, 0x00,
- 0xd8, 0x00, 0x00,
- 0xfc, 0x00, 0x00,
- 0x00, 0x00, 0x78,
- 0x00, 0x00, 0xb0,
- 0xa0, 0xa0, 0xa0,
- 0x50, 0xc8, 0xfc,
- 0x28, 0xfc, 0x28,
- 0xf0, 0xf0, 0x00,
- 0xfc, 0x28, 0x28,
- 0x00, 0x00, 0x00,
- 0x14, 0x14, 0x14,
- 0x20, 0x20, 0x20,
- 0x2c, 0x2c, 0x2c,
- 0x38, 0x38, 0x38,
- 0x44, 0x44, 0x44,
- 0x50, 0x50, 0x50,
- 0x60, 0x60, 0x60,
- 0x70, 0x70, 0x70,
- 0x80, 0x80, 0x80,
- 0x90, 0x90, 0x90,
- 0xa0, 0xa0, 0xa0,
- 0xb4, 0xb4, 0xb4,
- 0xc8, 0xc8, 0xc8,
- 0xe0, 0xe0, 0xe0,
- 0xfc, 0xfc, 0xfc,
- 0x00, 0x00, 0xfc,
- 0x40, 0x00, 0xfc,
- 0x7c, 0x00, 0xfc,
- 0xbc, 0x00, 0xfc,
- 0xfc, 0x00, 0xfc,
- 0xfc, 0x00, 0xbc,
- 0xfc, 0x00, 0x7c,
- 0xfc, 0x00, 0x40,
- 0xfc, 0x00, 0x00,
- 0xfc, 0x40, 0x00,
- 0xfc, 0x7c, 0x00,
- 0xfc, 0xbc, 0x00,
- 0xfc, 0xfc, 0x00,
- 0xbc, 0xfc, 0x00,
- 0x7c, 0xfc, 0x00,
- 0x40, 0xfc, 0x00,
- 0x00, 0xfc, 0x00,
- 0x00, 0xfc, 0x40,
- 0x00, 0xfc, 0x7c,
- 0x00, 0xfc, 0xbc,
- 0x00, 0xfc, 0xfc,
- 0x00, 0xbc, 0xfc,
- 0x00, 0x7c, 0xfc,
- 0x00, 0x40, 0xfc,
- 0x7c, 0x7c, 0xfc,
- 0x9c, 0x7c, 0xfc,
- 0xbc, 0x7c, 0xfc,
- 0xdc, 0x7c, 0xfc,
- 0xfc, 0x7c, 0xfc,
- 0xfc, 0x7c, 0xdc,
- 0xfc, 0x7c, 0xbc,
- 0xfc, 0x7c, 0x9c,
- 0xfc, 0x7c, 0x7c,
- 0xfc, 0x9c, 0x7c,
- 0xfc, 0xbc, 0x7c,
- 0xfc, 0xdc, 0x7c,
- 0xfc, 0xfc, 0x7c,
- 0xdc, 0xfc, 0x7c,
- 0xbc, 0xfc, 0x7c,
- 0x9c, 0xfc, 0x7c,
- 0x7c, 0xfc, 0x7c,
- 0x7c, 0xfc, 0x9c,
- 0x7c, 0xfc, 0xbc,
- 0x7c, 0xfc, 0xdc,
- 0x7c, 0xfc, 0xfc,
- 0x7c, 0xdc, 0xfc,
- 0x7c, 0xbc, 0xfc,
- 0x7c, 0x9c, 0xfc,
- 0xb4, 0xb4, 0xfc,
- 0xc4, 0xb4, 0xfc,
- 0xd8, 0xb4, 0xfc,
- 0xe8, 0xb4, 0xfc,
- 0xfc, 0xb4, 0xfc,
- 0xfc, 0xb4, 0xe8,
- 0xfc, 0xb4, 0xd8,
- 0xfc, 0xb4, 0xc4,
- 0xfc, 0xb4, 0xb4,
- 0xfc, 0xc4, 0xb4,
- 0xfc, 0xd8, 0xb4,
- 0xfc, 0xe8, 0xb4,
- 0xfc, 0xfc, 0xb4,
- 0xe8, 0xfc, 0xb4,
- 0xd8, 0xfc, 0xb4,
- 0xc4, 0xfc, 0xb4,
- 0xb4, 0xfc, 0xb4,
- 0xb4, 0xfc, 0xc4,
- 0xb4, 0xfc, 0xd8,
- 0xb4, 0xfc, 0xe8,
- 0xb4, 0xfc, 0xfc,
- 0xb4, 0xe8, 0xfc,
- 0xb4, 0xd8, 0xfc,
- 0xb4, 0xc4, 0xfc,
- 0x00, 0x00, 0x70,
- 0x1c, 0x00, 0x70,
- 0x38, 0x00, 0x70,
- 0x54, 0x00, 0x70,
- 0x70, 0x00, 0x70,
- 0x70, 0x00, 0x54,
- 0x70, 0x00, 0x38,
- 0x70, 0x00, 0x1c,
- 0x70, 0x00, 0x00,
- 0x70, 0x1c, 0x00,
- 0x70, 0x38, 0x00,
- 0x70, 0x54, 0x00,
- 0x70, 0x70, 0x00,
- 0x54, 0x70, 0x00,
- 0x38, 0x70, 0x00,
- 0x1c, 0x70, 0x00,
- 0x00, 0x70, 0x00,
- 0x00, 0x70, 0x1c,
- 0x00, 0x70, 0x38,
- 0x00, 0x70, 0x54,
- 0x00, 0x70, 0x70,
- 0x00, 0x54, 0x70,
- 0x00, 0x38, 0x70,
- 0x00, 0x1c, 0x70,
- 0x38, 0x38, 0x70,
- 0x44, 0x38, 0x70,
- 0x54, 0x38, 0x70,
- 0x60, 0x38, 0x70,
- 0x70, 0x38, 0x70,
- 0x70, 0x38, 0x60,
- 0x70, 0x38, 0x54,
- 0x70, 0x38, 0x44,
- 0x70, 0x38, 0x38,
- 0x70, 0x44, 0x38,
- 0x70, 0x54, 0x38,
- 0x70, 0x60, 0x38,
- 0x70, 0x70, 0x38,
- 0x60, 0x70, 0x38,
- 0x54, 0x70, 0x38,
- 0x44, 0x70, 0x38,
- 0x38, 0x70, 0x38,
- 0x38, 0x70, 0x44,
- 0x38, 0x70, 0x54,
- 0x38, 0x70, 0x60,
- 0x38, 0x70, 0x70,
- 0x38, 0x60, 0x70,
- 0x38, 0x54, 0x70,
- 0x38, 0x44, 0x70,
- 0x50, 0x50, 0x70,
- 0x58, 0x50, 0x70,
- 0x60, 0x50, 0x70,
- 0x68, 0x50, 0x70,
- 0x70, 0x50, 0x70,
- 0x70, 0x50, 0x68,
- 0x70, 0x50, 0x60,
- 0x70, 0x50, 0x58,
- 0x70, 0x50, 0x50,
- 0x70, 0x58, 0x50,
- 0x70, 0x60, 0x50,
- 0x70, 0x68, 0x50,
- 0x70, 0x70, 0x50,
- 0x68, 0x70, 0x50,
- 0x60, 0x70, 0x50,
- 0x58, 0x70, 0x50,
- 0x50, 0x70, 0x50,
- 0x50, 0x70, 0x58,
- 0x50, 0x70, 0x60,
- 0x50, 0x70, 0x68,
- 0x50, 0x70, 0x70,
- 0x50, 0x68, 0x70,
- 0x50, 0x60, 0x70,
- 0x50, 0x58, 0x70,
- 0x00, 0x00, 0x40,
- 0x10, 0x00, 0x40,
- 0x20, 0x00, 0x40,
- 0x30, 0x00, 0x40,
- 0x40, 0x00, 0x40,
- 0x40, 0x00, 0x30,
- 0x40, 0x00, 0x20,
- 0x40, 0x00, 0x10,
- 0x40, 0x00, 0x00,
- 0x40, 0x10, 0x00,
- 0x40, 0x20, 0x00,
- 0x40, 0x30, 0x00,
- 0x40, 0x40, 0x00,
- 0x30, 0x40, 0x00,
- 0x20, 0x40, 0x00,
- 0x10, 0x40, 0x00,
- 0x00, 0x40, 0x00,
- 0x00, 0x40, 0x10,
- 0x00, 0x40, 0x20,
- 0x00, 0x40, 0x30,
- 0x00, 0x40, 0x40,
- 0x00, 0x30, 0x40,
- 0x00, 0x20, 0x40,
- 0x00, 0x10, 0x40,
- 0x20, 0x20, 0x40,
- 0x28, 0x20, 0x40,
- 0x30, 0x20, 0x40,
- 0x38, 0x20, 0x40,
- 0x40, 0x20, 0x40,
- 0x40, 0x20, 0x38,
- 0x40, 0x20, 0x30,
- 0x40, 0x20, 0x28,
- 0x40, 0x20, 0x20,
- 0x40, 0x28, 0x20,
- 0x40, 0x30, 0x20,
- 0x40, 0x38, 0x20,
- 0x40, 0x40, 0x20,
- 0x38, 0x40, 0x20,
- 0x30, 0x40, 0x20,
- 0x28, 0x40, 0x20,
- 0x20, 0x40, 0x20,
- 0x20, 0x40, 0x28,
- 0x20, 0x40, 0x30,
- 0x20, 0x40, 0x38,
- 0x20, 0x40, 0x40,
- 0x20, 0x38, 0x40,
- 0x20, 0x30, 0x40,
- 0x20, 0x28, 0x40,
- 0x2c, 0x2c, 0x40,
- 0x30, 0x2c, 0x40,
- 0x34, 0x2c, 0x40,
- 0x3c, 0x2c, 0x40,
- 0x40, 0x2c, 0x40,
- 0x40, 0x2c, 0x3c,
- 0x40, 0x2c, 0x34,
- 0x40, 0x2c, 0x30,
- 0x40, 0x2c, 0x2c,
- 0x40, 0x30, 0x2c,
- 0x40, 0x34, 0x2c,
- 0x40, 0x3c, 0x2c,
- 0x40, 0x40, 0x2c,
- 0x3c, 0x40, 0x2c,
- 0x34, 0x40, 0x2c,
- 0x30, 0x40, 0x2c,
- 0x2c, 0x40, 0x2c,
- 0x2c, 0x40, 0x30,
- 0x2c, 0x40, 0x34,
- 0x2c, 0x40, 0x3c,
- 0x2c, 0x40, 0x40,
- 0x2c, 0x3c, 0x40,
- 0x2c, 0x34, 0x40,
- 0x2c, 0x30, 0x40,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00
-};
-
-static const byte font[][5] = {
- {0x00,0x00,0x00,0xff,0x00},
- {0x5f,0xff,0x00,0x00,0x00},
- {0x03,0x00,0x03,0xff,0x00},
- {0x14,0x7f,0x14,0x7f,0x14},
- {0x24,0x2a,0x7f,0x2a,0x12},
- {0x61,0x10,0x08,0x04,0x43},
- {0x38,0x4e,0x59,0x26,0x50},
- {0x03,0xff,0x00,0x00,0x00},
- {0x3e,0x41,0xff,0x00,0x00},
- {0x41,0x3e,0xff,0x00,0x00},
- {0x10,0x54,0x38,0x54,0x10},
- {0x10,0x10,0x7c,0x10,0x10},
- {0x80,0x40,0xff,0x00,0x00},
- {0x10,0x10,0x10,0x10,0x10},
- {0x40,0xff,0x00,0x00,0x00},
- {0x60,0x10,0x08,0x04,0x03},
-
- {0x3e,0x41,0x41,0x41,0x3e}, /* digits */
- {0x04,0x02,0x7f,0xff,0x00},
- {0x42,0x61,0x51,0x49,0x46},
- {0x22,0x41,0x49,0x49,0x36},
- {0x18,0x14,0x12,0x7f,0x10},
- {0x27,0x45,0x45,0x45,0x39},
- {0x3e,0x49,0x49,0x49,0x32},
- {0x01,0x61,0x19,0x07,0x01},
- {0x36,0x49,0x49,0x49,0x36},
- {0x26,0x49,0x49,0x49,0x3e},
-
- {0x44,0xff,0x00,0x00,0x00},
- {0x80,0x44,0xff,0x00,0x00},
- {0x10,0x28,0x44,0xff,0x00},
- {0x28,0x28,0x28,0x28,0x28},
- {0x44,0x28,0x10,0xff,0x00},
- {0x02,0x01,0x51,0x09,0x06},
- {0x3e,0x41,0x5d,0x5d,0x1e},
-
- {0x7c,0x12,0x11,0x12,0x7c}, /* uppercase letters*/
- {0x7f,0x49,0x49,0x49,0x36},
- {0x3e,0x41,0x41,0x41,0x22},
- {0x7f,0x41,0x41,0x22,0x1c},
- {0x7f,0x49,0x49,0x49,0xff},
- {0x7f,0x09,0x09,0x09,0xff},
- {0x3e,0x41,0x41,0x49,0x3a},
- {0x7f,0x08,0x08,0x08,0x7f},
- {0x41,0x7f,0x41,0xff,0x00},
- {0x20,0x40,0x40,0x3f,0xff},
- {0x7f,0x08,0x14,0x22,0x41},
- {0x7f,0x40,0x40,0x40,0xff},
- {0x7f,0x02,0x04,0x02,0x7f},
- {0x7f,0x02,0x0c,0x10,0x7f},
- {0x3e,0x41,0x41,0x41,0x3e},
- {0x7f,0x09,0x09,0x09,0x06},
- {0x3e,0x41,0x51,0x21,0x5e},
- {0x7f,0x09,0x19,0x29,0x46},
- {0x26,0x49,0x49,0x49,0x32},
- {0x01,0x01,0x7f,0x01,0x01},
- {0x3f,0x40,0x40,0x40,0x3f},
- {0x07,0x18,0x60,0x18,0x07},
- {0x1f,0x60,0x18,0x60,0x1f},
- {0x63,0x14,0x08,0x14,0x63},
- {0x03,0x04,0x78,0x04,0x03},
- {0x61,0x51,0x49,0x45,0x43},
-
- {0x7f,0x41,0x41,0xff,0x00},
- {0x03,0x04,0x08,0x10,0x60},
- {0x41,0x41,0x7f,0xff,0x00},
- {0x02,0x01,0x02,0xff,0x00},
- {0x80,0x80,0x80,0x80,0x80},
- {0x01,0x02,0xff,0x00,0x00},
-
- {0x38,0x44,0x44,0x44,0x7c}, /* lowercase letters */
- {0x7f,0x44,0x44,0x44,0x38},
- {0x38,0x44,0x44,0x44,0x44},
- {0x38,0x44,0x44,0x44,0x7f},
- {0x38,0x54,0x54,0x54,0x58},
- {0x04,0x7e,0x05,0x01,0xff},
- {0x98,0xa4,0xa4,0xa4,0x7c},
- {0x7f,0x04,0x04,0x04,0x78},
- {0x7d,0xff,0x00,0x00,0x00},
- {0x80,0x80,0x7d,0xff,0x00},
- {0x7f,0x10,0x28,0x44,0xff},
- {0x7f,0xff,0x00,0x00,0x00},
- {0x7c,0x04,0x7c,0x04,0x78},
- {0x7c,0x04,0x04,0x04,0x78},
- {0x38,0x44,0x44,0x44,0x38},
- {0xfc,0x24,0x24,0x24,0x18},
- {0x18,0x24,0x24,0x24,0xfc},
- {0x7c,0x08,0x04,0x04,0xff},
- {0x48,0x54,0x54,0x54,0x24},
- {0x04,0x3e,0x44,0x40,0xff},
- {0x7c,0x40,0x40,0x40,0x3c},
- {0x0c,0x30,0x40,0x30,0x0c},
- {0x3c,0x40,0x3c,0x40,0x3c},
- {0x44,0x28,0x10,0x28,0x44},
- {0x9c,0xa0,0xa0,0xa0,0x7c},
- {0x44,0x64,0x54,0x4c,0x44},
-
- {0x08,0x36,0x41,0xff,0x00},
- {0x77,0xff,0x00,0x00,0x00},
- {0x41,0x36,0x08,0xff,0x00},
- {0x02,0x01,0x02,0x01,0xff},
- {0xff,0x00,0x00,0x00,0x00},
-
- {0xfe,0x49,0x49,0x4e,0x30}, /* sharp S */
-
- {0x7c,0x41,0x40,0x41,0x3c}, /* umlauts */
-
- {0x04,0x06,0x7f,0x06,0x04}, /* arrows */
- {0x20,0x60,0xfe,0x60,0x20},
-
- {0x38,0x45,0x44,0x45,0x7c}, /* umlauts */
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0x79,0x14,0x12,0x14,0x79},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0x38,0x45,0x44,0x45,0x38},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0xff,0x00,0x00,0x00,0x00},
- {0x3d,0x42,0x42,0x42,0x3d},
- {0x3d,0x40,0x40,0x40,0x3d},
-};
-
-}
diff --git a/engines/supernova2/sound.cpp b/engines/supernova2/sound.cpp
deleted file mode 100644
index d16873d031..0000000000
--- a/engines/supernova2/sound.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/* 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 "audio/audiostream.h"
-#include "audio/mixer.h"
-#include "audio/decoders/raw.h"
-#include "audio/mods/protracker.h"
-#include "common/system.h"
-
-#include "supernova2/resman.h"
-#include "supernova2/sound.h"
-#include "supernova2/supernova2.h"
-
-namespace Supernova2 {
-
-Sound::Sound(Audio::Mixer *mixer, ResourceManager *resMan)
- : _mixer(mixer)
- , _resMan(resMan) {
-}
-
-void Sound::play(AudioId index) {
- Audio::AudioStream *stream = _resMan->getSoundStream(index);
-
- stop();
- _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, stream,
- -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
-}
-
-void Sound::play(MusicId index) {
- Audio::AudioStream *stream = _resMan->getSoundStream(index);
-
- stop();
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, stream,
- -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
-}
-
-void Sound::playSiren() {
- Audio::AudioStream *stream = _resMan->getSirenStream();
-
- stop();
- _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, stream,
- -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
-}
-
-bool Sound::isPlaying() {
- return _mixer->isSoundHandleActive(_soundHandle);
-}
-
-void Sound::stop() {
- if (_mixer->isSoundHandleActive(_soundHandle))
- _mixer->stopHandle(_soundHandle);
-}
-
-int Sound::getVolume() {
- return _mixer->getChannelVolume(_soundHandle);
-}
-
-void Sound::setVolume(int volume) {
- _mixer->setChannelVolume(_soundHandle, volume);
-}
-
-}
diff --git a/engines/supernova2/sound.h b/engines/supernova2/sound.h
deleted file mode 100644
index 13ea4dd48c..0000000000
--- a/engines/supernova2/sound.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* 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 SUPERNOVA2_SOUND_H
-#define SUPERNOVA2_SOUND_H
-
-#include "audio/mixer.h"
-
-namespace Supernova2 {
-
-class Supernova2Engine;
-class ResourceManager;
-
-enum AudioId {
- kAudioIntroDing,
- kAudioSuccess,
- kAudioTaxiOpen,
- kAudioTaxiLeaving,
- kAudioTaxiArriving,
- kAudioKiosk,
- kAudioStage1,
- kAudioStage2,
- kAudioAppearance1,
- kAudioAppearance2,
- kAudioAppearance3,
- kAudioElevatorBell,
- kAudioElevator1,
- kAudioShip1,
- kAudioShip2,
- kAudioShip3,
- kAudioShipDeath,
- kAudioDeath,
- kAudioCaught,
- kAudioNumSamples
-};
-
-enum MusicId {
- kMusicIntro = 52,
- kMusicMadMonkeys = 56
-};
-
-class Sound {
-public:
-
-public:
- Sound(Audio::Mixer *mixer, ResourceManager *resMan);
-
- void play(AudioId index);
- void play(MusicId index);
- void playSiren();
- void setVolume(int volume);
- int getVolume();
- void stop();
- bool isPlaying();
-private:
- Audio::Mixer *_mixer;
- ResourceManager *_resMan;
- Audio::SoundHandle _soundHandle;
-};
-
-}
-
-#endif
diff --git a/engines/supernova2/state.cpp b/engines/supernova2/state.cpp
deleted file mode 100644
index 67aa17292a..0000000000
--- a/engines/supernova2/state.cpp
+++ /dev/null
@@ -1,2305 +0,0 @@
-/* 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/system.h"
-#include "graphics/cursorman.h"
-#include "graphics/palette.h"
-#include "gui/message.h"
-
-#include "supernova2/screen.h"
-#include "supernova2/supernova2.h"
-#include "supernova2/state.h"
-
-namespace Supernova2 {
-
-bool GameManager::serialize(Common::WriteStream *out) {
- if (out->err())
- return false;
-
- // GameState
- out->writeSint16LE(_state._money);
- out->writeSint32LE(_state._startTime - g_system->getMillis());
- out->writeByte(_state._addressKnown);
- out->writeByte(_state._poleMagnet);
- out->writeByte(_state._admission);
- out->writeByte(_state._tipsy);
- out->writeByte(_state._dark);
- out->writeByte(_state._elevatorE);
- out->writeByte(_state._elevatorNumber);
- out->writeByte(_state._toMuseum);
- out->writeSint16LE(_state._pyraE);
- out->writeByte(_state._pyraS);
- out->writeByte(_state._pyraZ);
- out->writeByte(_state._alarmOn);
- out->writeByte(_state._alarmCracked);
- out->writeByte(_state._haste);
- out->writeByte(_state._pressureCounter);
- out->writeByte(_state._sirenOn);
- out->writeSint16LE(_state._pyraDirection);
- out->writeUint32LE(_state._eventTime - g_system->getMillis());
- out->writeSint32LE(_state._eventCallback);
- out->writeByte(_state._taxiPossibility);
- for (int i = 0; i < 15; i++) {
- out->writeSint16LE(_state._puzzleTab[i]);
- }
-
- // Inventory
- out->writeSint32LE(_inventory.getSize());
- out->writeSint32LE(_inventoryScroll);
- for (int i = 0; i < _inventory.getSize(); ++i) {
- Object *objectStateBegin = _rooms[_inventory.get(i)->_roomId]->getObject(0);
- byte objectIndex = _inventory.get(i) - objectStateBegin;
- out->writeSint32LE(_inventory.get(i)->_roomId);
- out->writeSint32LE(objectIndex);
- }
-
- // Rooms
- out->writeByte(_lastRoom->getId());
- out->writeByte(_currentRoom->getId());
- for (int i = 0; i < NUMROOMS; ++i) {
- _rooms[i]->serialize(out);
- }
-
- return !out->err();
-}
-
-
-bool GameManager::deserialize(Common::ReadStream *in, int version) {
- if (in->err())
- return false;
-
- // GameState
- _state._money = in->readSint16LE();
- _state._startTime = in->readSint32LE() + g_system->getMillis();
- _state._addressKnown = in->readByte();
- _state._poleMagnet = in->readByte();
- _state._admission = in->readByte();
- _state._tipsy = in->readByte();
- _state._dark = in->readByte();
- _state._elevatorE = in->readByte();
- _state._elevatorNumber = in->readByte();
- _state._toMuseum = in->readByte();
- _state._pyraE = in->readSint16LE();
- _state._pyraS = in->readByte();
- _state._pyraZ = in->readByte();
- _state._alarmOn = in->readByte();
- _state._alarmCracked = in->readByte();
- _state._haste = in->readByte();
- _state._pressureCounter = in->readByte();
- _state._sirenOn = in->readByte();
- _state._pyraDirection = in->readSint16LE();
- _state._eventTime = in->readUint32LE() + g_system->getMillis();
- _state._eventCallback = (EventFunction)in->readSint32LE();
- _state._taxiPossibility = in->readByte();
- for (int i = 0; i < 15; i++)
- _state._puzzleTab[i] = in->readSint16LE();
- _vm->setGameString(kStringMoney, Common::String::format("%d Xa", _state._money));
-
- _oldTime = g_system->getMillis();
-
- // Inventory
- int inventorySize = in->readSint32LE();
- _inventoryScroll = in->readSint32LE();
- _inventory.clear();
- for (int i = 0; i < inventorySize; ++i) {
- RoomId objectRoom = static_cast<RoomId>(in->readSint32LE());
- int objectIndex = in->readSint32LE();
- _inventory.add(*_rooms[objectRoom]->getObject(objectIndex));
- }
-
- // Rooms
- RoomId lastRoomId = static_cast<RoomId>(in->readByte());
- RoomId curRoomId = static_cast<RoomId>(in->readByte());
- for (int i = 0; i < NUMROOMS; ++i) {
- _rooms[i]->deserialize(in, version);
- }
- delete _rooms[BST_DOOR];
- _rooms[BST_DOOR] = new BstDoor(_vm, this);
- _lastRoom = _rooms[lastRoomId];
- changeRoom(curRoomId);
-
- // Some additional variables
- _state._previousRoom = _rooms[INTRO];
- _guiEnabled = true;
- _animationEnabled = true;
-
- return !in->err();
-}
-
-void Inventory::add(Object &obj) {
- if (_numObjects < kMaxCarry) {
- _inventory[_numObjects++] = &obj;
- obj.setProperty(CARRIED);
- }
-
- if (getSize() > _inventoryScroll + 8) {
- _inventoryScroll = getSize() - 8;
- _inventoryScroll += _inventoryScroll % 2;
- }
-}
-
-void Inventory::remove(Object &obj) {
- for (int i = 0; i < _numObjects; ++i) {
- if (_inventory[i] == &obj) {
- if (_inventoryScroll >= 2 && getSize() % 2)
- _inventoryScroll -= 2;
-
- --_numObjects;
- while (i < _numObjects) {
- _inventory[i] = _inventory[i + 1];
- ++i;
- }
- obj.disableProperty(CARRIED);
- }
- }
-}
-
-void Inventory::clear() {
- for (int i = 0; i < _numObjects; ++i)
- _inventory[i]->disableProperty(CARRIED);
- _numObjects = 0;
- _inventoryScroll = 0;
-}
-
-Object *Inventory::get(int index) const {
- if (index < _numObjects)
- return _inventory[index];
-
- return _nullObject;
-}
-
-Object *Inventory::get(ObjectId id) const {
- for (int i = 0; i < _numObjects; ++i) {
- if (_inventory[i]->_id == id)
- return _inventory[i];
- }
-
- return _nullObject;
-}
-
-
-GuiElement::GuiElement()
- : _isHighlighted(false)
- , _bgColorNormal(kColorWhite25)
- , _bgColorHighlighted(kColorWhite44)
- , _bgColor(kColorWhite25)
- , _textColorNormal(kColorGreen)
- , _textColorHighlighted(kColorLightGreen)
- , _textColor(kColorGreen)
-{
- memset(_text, 0, sizeof(_text));
-}
-
-void GuiElement::setText(const char *text) {
- strncpy(_text, text, sizeof(_text) - 1);
-}
-
-void GuiElement::setTextPosition(int x, int y) {
- _textPosition = Common::Point(x, y);
-}
-
-void GuiElement::setSize(int x1, int y1, int x2, int y2) {
- this->left = x1;
- this->top = y1;
- this->right = x2;
- this->bottom = y2;
-
- _textPosition = Common::Point(x1 + 1, y1 + 1);
-}
-
-void GuiElement::setColor(int bgColor, int textColor, int bgColorHighlighted, int textColorHightlighted) {
- _bgColor = bgColor;
- _textColor = textColor;
- _bgColorNormal = bgColor;
- _textColorNormal = textColor;
- _bgColorHighlighted = bgColorHighlighted;
- _textColorHighlighted = textColorHightlighted;
-}
-
-void GuiElement::setHighlight(bool isHighlighted_) {
- if (isHighlighted_) {
- _bgColor = _bgColorHighlighted;
- _textColor = _textColorHighlighted;
- } else {
- _bgColor = _bgColorNormal;
- _textColor = _textColorNormal;
- }
-}
-
-StringId GameManager::guiCommands[] = {
- kStringCommandGo, kStringCommandLook, kStringCommandTake, kStringCommandOpen, kStringCommandClose,
- kStringCommandPress, kStringCommandPull, kStringCommandUse, kStringCommandTalk, kStringCommandGive
-};
-
-StringId GameManager::guiStatusCommands[] = {
- kStringStatusCommandGo, kStringStatusCommandLook, kStringStatusCommandTake, kStringStatusCommandOpen, kStringStatusCommandClose,
- kStringStatusCommandPress, kStringStatusCommandPull, kStringStatusCommandUse, kStringStatusCommandTalk, kStringStatusCommandGive
-};
-
-GameManager::GameManager(Supernova2Engine *vm, Sound *sound)
- : _inventory(&_nullObject, _inventoryScroll)
- , _vm(vm)
- , _sound(sound)
- , _mouseClickType(Common::EVENT_INVALID) {
- initRooms();
- changeRoom(INTRO);
- initState();
- initGui();
-}
-
-GameManager::~GameManager() {
- destroyRooms();
-}
-
-void GameManager::destroyRooms() {
- delete _rooms[INTRO];
- delete _rooms[AIRPORT];
- delete _rooms[TAXISTAND];
- delete _rooms[STREET];
- delete _rooms[GAMES];
- delete _rooms[CABIN];
- delete _rooms[KIOSK];
- delete _rooms[CULTURE_PALACE];
- delete _rooms[CHECKOUT];
- delete _rooms[CITY1];
- delete _rooms[CITY2];
- delete _rooms[ELEVATOR];
- delete _rooms[APARTMENT];
- delete _rooms[SHIP];
- delete _rooms[PYRAMID];
- delete _rooms[PYR_ENTRANCE];
- delete _rooms[UPSTAIRS1];
- delete _rooms[DOWNSTAIRS1];
- delete _rooms[BOTTOM_RIGHT_DOOR];
- delete _rooms[BOTTOM_LEFT_DOOR];
- delete _rooms[UPSTAIRS2];
- delete _rooms[DOWNSTAIRS2];
- delete _rooms[UPPER_DOOR];
- delete _rooms[PUZZLE_FRONT];
- delete _rooms[PUZZLE_BEHIND];
- delete _rooms[FORMULA1_F];
- delete _rooms[FORMULA1_N];
- delete _rooms[FORMULA2_F];
- delete _rooms[FORMULA2_N];
- delete _rooms[TOMATO_F];
- delete _rooms[TOMATO_N];
- delete _rooms[MONSTER_F];
- delete _rooms[MONSTER1_N];
- delete _rooms[MONSTER2_N];
- delete _rooms[UPSTAIRS3];
- delete _rooms[DOWNSTAIRS3];
- delete _rooms[LCORRIDOR1];
- delete _rooms[LCORRIDOR2];
- delete _rooms[HOLE_ROOM];
- delete _rooms[IN_HOLE];
- delete _rooms[FLOORDOOR];
- delete _rooms[FLOORDOOR_U];
- delete _rooms[BST_DOOR];
- delete _rooms[HALL];
- delete _rooms[COFFIN_ROOM];
- delete _rooms[MASK];
- delete _rooms[MUSEUM];
- delete _rooms[MUS_ENTRANCE];
- delete _rooms[MUS1];
- delete _rooms[MUS2];
- delete _rooms[MUS3];
- delete _rooms[MUS4];
- delete _rooms[MUS5];
- delete _rooms[MUS6];
- delete _rooms[MUS7];
- delete _rooms[MUS8];
- delete _rooms[MUS9];
- delete _rooms[MUS10];
- delete _rooms[MUS11];
- delete _rooms[MUS_ROUND];
- delete _rooms[MUS12];
- delete _rooms[MUS13];
- delete _rooms[MUS14];
- delete _rooms[MUS15];
- delete _rooms[MUS16];
- delete _rooms[MUS17];
- delete _rooms[MUS18];
- delete _rooms[MUS19];
- delete _rooms[MUS20];
- delete _rooms[MUS21];
- delete _rooms[MUS22];
-}
-
-void GameManager::initState() {
- _currentInputObject = &_nullObject;
- _inputObject[0] = &_nullObject;
- _inputObject[1] = &_nullObject;
- _inputVerb = ACTION_WALK;
- _processInput = false;
- _guiEnabled = true;
- _animationEnabled = true;
- _roomBrightness = 255;
- _mouseClicked = false;
- _keyPressed = false;
- _mouseX = -1;
- _mouseY = -1;
- _mouseField = -1;
- _inventoryScroll = 0;
- _restTime = 0;
- _oldTime = g_system->getMillis();
- _timerPaused = 0;
- _timePaused = false;
- _messageDuration = 0;
- _animationTimer = 0;
- _mapOn = false;
- _steps = false;
- _cracking = false;
- _alarmBefore = false;
- RoomId startSecurityTab[10] = {MUS6, MUS7, MUS11, MUS10, MUS3, MUS2, MUS1, MUS8, MUS9, MUS5};
- for (int i = 0; i < 10; i++)
- _securityTab[i] = startSecurityTab[i];
-
- _currentSentence = -1;
- for (int i = 0 ; i < 6 ; ++i) {
- _sentenceNumber[i] = -1;
- _texts[i] = kNoString;
- _rows[i] = 0;
- _rowsStart[i] = 0;
- _dials[i] = 1;
- }
-
- _prevImgId = 0;
-
- _state._money = 20;
- _state._startTime = 0;
- _state._addressKnown = false;
- _state._previousRoom = _currentRoom;
- _state._poleMagnet = false;
- _state._admission = 0;
- _state._tipsy = false;
- _state._dark = false;
- _state._elevatorE = 0;
- _state._elevatorNumber = 0;
- _state._toMuseum = false;
- _state._pyraE = 0;
- _state._pyraS = 4;
- _state._pyraZ = 10;
- _state._alarmOn = false;
- _state._alarmCracked = false;
- _state._haste = false;
- _state._pressureCounter = 0;
- _state._sirenOn = false;
- _state._pyraDirection = 0;
- _state._eventTime = kMaxTimerValue;
- _state._eventCallback = kNoFn;
- _state._taxiPossibility = 4;
- int16 startPuzzleTab[15] = {12, 3, 14, 1, 11, 0, 2, 13, 9, 5, 4, 10, 7, 6, 8};
- for (int i = 0; i < 15; i++)
- _state._puzzleTab[i] = startPuzzleTab[i];
-}
-
-void GameManager::initRooms() {
- _rooms[INTRO] = new Intro(_vm, this);
- _rooms[AIRPORT] = new Airport(_vm, this);
- _rooms[TAXISTAND] = new TaxiStand(_vm, this);
- _rooms[STREET] = new Street(_vm, this);
- _rooms[GAMES] = new Games(_vm, this);
- _rooms[CABIN] = new Cabin(_vm, this);
- _rooms[KIOSK] = new Kiosk(_vm, this);
- _rooms[CULTURE_PALACE] = new CulturePalace(_vm, this);
- _rooms[CHECKOUT] = new Checkout(_vm, this);
- _rooms[CITY1] = new City1(_vm, this);
- _rooms[CITY2] = new City2(_vm, this);
- _rooms[ELEVATOR] = new Elevator(_vm, this);
- _rooms[APARTMENT] = new Apartment(_vm, this);
- _rooms[SHIP] = new Ship(_vm, this);
- _rooms[PYRAMID] = new Pyramid(_vm, this);
- _rooms[PYR_ENTRANCE] = new PyrEntrance(_vm, this);
- _rooms[UPSTAIRS1] = new Upstairs1(_vm, this);
- _rooms[DOWNSTAIRS1] = new Downstairs1(_vm, this);
- _rooms[BOTTOM_RIGHT_DOOR] = new BottomRightDoor(_vm, this);
- _rooms[BOTTOM_LEFT_DOOR] = new BottomLeftDoor(_vm, this);
- _rooms[UPSTAIRS2] = new Upstairs2(_vm, this);
- _rooms[DOWNSTAIRS2] = new Downstairs2(_vm, this);
- _rooms[UPPER_DOOR] = new UpperDoor(_vm, this);
- _rooms[PUZZLE_FRONT] = new PuzzleFront(_vm, this);
- _rooms[PUZZLE_BEHIND] = new PuzzleBehind(_vm, this);
- _rooms[FORMULA1_F] = new Formula1F(_vm, this);
- _rooms[FORMULA1_N] = new Formula1N(_vm, this);
- _rooms[FORMULA2_F] = new Formula2F(_vm, this);
- _rooms[FORMULA2_N] = new Formula2N(_vm, this);
- _rooms[TOMATO_F] = new TomatoF(_vm, this);
- _rooms[TOMATO_N] = new TomatoN(_vm, this);
- _rooms[MONSTER_F] = new MonsterF(_vm, this);
- _rooms[MONSTER1_N] = new Monster1N(_vm, this);
- _rooms[MONSTER2_N] = new Monster2N(_vm, this);
- _rooms[UPSTAIRS3] = new Upstairs3(_vm, this);
- _rooms[DOWNSTAIRS3] = new Downstairs3(_vm, this);
- _rooms[LCORRIDOR1] = new LCorridor1(_vm, this);
- _rooms[LCORRIDOR2] = new LCorridor2(_vm, this);
- _rooms[HOLE_ROOM] = new HoleRoom(_vm, this);
- _rooms[IN_HOLE] = new InHole(_vm, this);
- _rooms[FLOORDOOR] = new Floordoor(_vm, this);
- _rooms[FLOORDOOR_U] = new FloordoorU(_vm, this);
- _rooms[BST_DOOR] = new BstDoor(_vm, this);
- _rooms[HALL] = new Hall(_vm, this);
- _rooms[COFFIN_ROOM] = new CoffinRoom(_vm, this);
- _rooms[MASK] = new Mask(_vm, this);
- _rooms[MUSEUM] = new Museum(_vm, this);
- _rooms[MUS_ENTRANCE] = new MusEntrance(_vm, this);
- _rooms[MUS1] = new Mus1(_vm, this);
- _rooms[MUS2] = new Mus2(_vm, this);
- _rooms[MUS3] = new Mus3(_vm, this);
- _rooms[MUS4] = new Mus4(_vm, this);
- _rooms[MUS5] = new Mus5(_vm, this);
- _rooms[MUS6] = new Mus6(_vm, this);
- _rooms[MUS7] = new Mus7(_vm, this);
- _rooms[MUS8] = new Mus8(_vm, this);
- _rooms[MUS9] = new Mus9(_vm, this);
- _rooms[MUS10] = new Mus10(_vm, this);
- _rooms[MUS11] = new Mus11(_vm, this);
- _rooms[MUS_ROUND] = new MusRound(_vm, this);
- _rooms[MUS12] = new Mus12(_vm, this);
- _rooms[MUS13] = new Mus13(_vm, this);
- _rooms[MUS14] = new Mus14(_vm, this);
- _rooms[MUS15] = new Mus15(_vm, this);
- _rooms[MUS16] = new Mus16(_vm, this);
- _rooms[MUS17] = new Mus17(_vm, this);
- _rooms[MUS18] = new Mus18(_vm, this);
- _rooms[MUS19] = new Mus19(_vm, this);
- _rooms[MUS20] = new Mus20(_vm, this);
- _rooms[MUS21] = new Mus21(_vm, this);
- _rooms[MUS22] = new Mus22(_vm, this);
-}
-
-void GameManager::initGui() {
- int cmdCount = ARRAYSIZE(_guiCommandButton);
- int cmdAvailableSpace = 320 - (cmdCount - 1) * 2;
- for (int i = 0; i < cmdCount; ++i) {
- const Common::String &text = _vm->getGameString(guiCommands[i]);
- cmdAvailableSpace -= Screen::textWidth(text);
- }
-
- int commandButtonX = 0;
- for (int i = 0; i < ARRAYSIZE(_guiCommandButton); ++i) {
- const Common::String &text = _vm->getGameString(guiCommands[i]);
- int width;
- if (i < cmdCount - 1) {
- int space = cmdAvailableSpace / (cmdCount - i);
- cmdAvailableSpace -= space;
- width = Screen::textWidth(text) + space;
- } else
- width = 320 - commandButtonX;
-
- _guiCommandButton[i].setSize(commandButtonX, 150, commandButtonX + width, 159);
- _guiCommandButton[i].setText(text.c_str());
- _guiCommandButton[i].setColor(kColorWhite25, kColorDarkGreen, kColorWhite44, kColorGreen);
- commandButtonX += width + 2;
- }
-
- for (int i = 0; i < ARRAYSIZE(_guiInventory); ++i) {
- int inventoryX = 136 * (i % 2);
- int inventoryY = 161 + 10 * (i / 2);
-
- _guiInventory[i].setSize(inventoryX, inventoryY, inventoryX + 135, inventoryY + 9);
- _guiInventory[i].setColor(kColorWhite25, kColorDarkRed, kColorWhite35, kColorRed);
- }
- _guiInventoryArrow[0].setSize(272, 161, 279, 180);
- _guiInventoryArrow[0].setColor(kColorWhite25, kColorDarkRed, kColorWhite35, kColorRed);
- _guiInventoryArrow[0].setText("\x82");
- _guiInventoryArrow[0].setTextPosition(273, 166);
- _guiInventoryArrow[1].setSize(272, 181, 279, 200);
- _guiInventoryArrow[1].setColor(kColorWhite25, kColorDarkRed, kColorWhite35, kColorRed);
- _guiInventoryArrow[1].setText("\x83");
- _guiInventoryArrow[1].setTextPosition(273, 186);
-}
-
-void GameManager::updateEvents() {
- handleTime();
- if (_animationEnabled && !_vm->_screen->isMessageShown() && _animationTimer == 0)
- _currentRoom->animation();
-
- if (_state._eventCallback != kNoFn && g_system->getMillis() >= _state._eventTime) {
- _vm->_allowLoadGame = false;
- _vm->_allowSaveGame = false;
- _state._eventTime = kMaxTimerValue;
- EventFunction fn = _state._eventCallback;
- _state._eventCallback = kNoFn;
- switch (fn) {
- case kNoFn:
- break;
- case kSoberFn:
- sober();
- break;
- case kPyramidEndFn:
- pyramidEnd();
- break;
- case kCaughtFn:
- caught();
- break;
- }
- _vm->_allowLoadGame = true;
- _vm->_allowSaveGame = true;
- return;
- }
-
- _mouseClicked = false;
- _keyPressed = false;
- Common::Event event;
- while (g_system->getEventManager()->pollEvent(event)) {
- switch (event.type) {
- case Common::EVENT_KEYDOWN:
- _keyPressed = true;
- processInput(event.kbd);
- break;
- case Common::EVENT_LBUTTONUP:
- // fallthrough
- case Common::EVENT_RBUTTONUP:
- _mouseClicked = true;
- // fallthrough
- case Common::EVENT_MOUSEMOVE:
- _mouseClickType = event.type;
- _mouseX = event.mouse.x;
- _mouseY = event.mouse.y;
- if (_guiEnabled)
- processInput();
- break;
- default:
- break;
- }
- }
-}
-void GameManager::processInput(Common::KeyState &state) {
- _key = state;
-
- switch (state.keycode) {
- case Common::KEYCODE_F1:
- // help
- break;
- case Common::KEYCODE_F2:
- // show game doc
- break;
- case Common::KEYCODE_F3:
- // show game info
- break;
- case Common::KEYCODE_F4:
- _vm->setTextSpeed();
- break;
- case Common::KEYCODE_F5:
- // load/save
- break;
- case Common::KEYCODE_x:
- if (state.flags & Common::KBD_ALT) {
- if (_vm->quitGameDialog())
- _vm->quitGame();
- }
- break;
- case Common::KEYCODE_d:
- if (state.flags & Common::KBD_CTRL)
- _vm->_console->attach();
- break;
- default:
- break;
- }
-}
-
-void GameManager::resetInputState() {
- setObjectNull(_inputObject[0]);
- setObjectNull(_inputObject[1]);
- _inputVerb = ACTION_WALK;
- _processInput = false;
- _mouseClicked = false;
- _keyPressed = false;
- _key.reset();
- _mouseClickType = Common::EVENT_MOUSEMOVE;
-
- processInput();
-}
-
-
-void GameManager::processInput() {
- enum {
- onNone,
- onObject,
- onCmdButton,
- onInventory,
- onInventoryArrowUp,
- onInventoryArrowDown
- } mouseLocation;
-
- if (_mouseField >= 0 && _mouseField < 256)
- mouseLocation = onObject;
- else if (_mouseField >= 256 && _mouseField < 512)
- mouseLocation = onCmdButton;
- else if (_mouseField >= 512 && _mouseField < 768)
- mouseLocation = onInventory;
- else if (_mouseField == 768)
- mouseLocation = onInventoryArrowUp;
- else if (_mouseField == 769)
- mouseLocation = onInventoryArrowDown;
- else
- mouseLocation = onNone;
-
- if (_mouseClickType == Common::EVENT_LBUTTONUP) {
- if (_vm->_screen->isMessageShown() && !_cracking) {
- // Hide the message and consume the event
- _vm->removeMessage();
- if (mouseLocation != onCmdButton)
- return;
- }
-
- switch(mouseLocation) {
- case onObject:
- case onInventory:
- // Fallthrough
- if (_inputVerb == ACTION_GIVE || _inputVerb == ACTION_USE) {
- if (isNullObject(_inputObject[0])) {
- _inputObject[0] = _currentInputObject;
- if (!_inputObject[0]->hasProperty(COMBINABLE))
- _processInput = true;
- } else {
- _inputObject[1] = _currentInputObject;
- _processInput = true;
- }
- } else {
- _inputObject[0] = _currentInputObject;
- if (!isNullObject(_currentInputObject))
- _processInput = true;
- }
- break;
- case onCmdButton:
- resetInputState();
- _inputVerb = static_cast<Action>(_mouseField - 256);
- break;
- case onInventoryArrowUp:
- if (_inventoryScroll >= 2)
- _inventoryScroll -= 2;
- break;
- case onInventoryArrowDown:
- if (_inventoryScroll < _inventory.getSize() - ARRAYSIZE(_guiInventory))
- _inventoryScroll += 2;
- break;
- case onNone:
- break;
- }
-
- } else if (_mouseClickType == Common::EVENT_RBUTTONUP) {
- if (_vm->_screen->isMessageShown()) {
- // Hide the message and consume the event
- _vm->removeMessage();
- return;
- }
-
- if (isNullObject(_currentInputObject))
- return;
-
- if (mouseLocation == onObject || mouseLocation == onInventory) {
- _inputObject[0] = _currentInputObject;
- ObjectTypes type = _inputObject[0]->_type;
- if (type & OPENABLE)
- _inputVerb = (type & OPENED) ? ACTION_CLOSE : ACTION_OPEN;
- else if (type & PRESS)
- _inputVerb = ACTION_PRESS;
- else if (type & TALK)
- _inputVerb = ACTION_TALK;
- else
- _inputVerb = ACTION_LOOK;
-
- _processInput = true;
- }
-
- } else if (_mouseClickType == Common::EVENT_MOUSEMOVE) {
- int field = -1;
- int click = -1;
-
- if ((_mouseY >= _guiCommandButton[0].top) && (_mouseY <= _guiCommandButton[0].bottom)) {
- /* command row */
- field = 9;
- while (_mouseX < _guiCommandButton[field].left - 1)
- field--;
- field += 256;
- } else if ((_mouseX >= 283) && (_mouseX <= 317) && (_mouseY >= 163) && (_mouseY <= 197)) {
- /* exit box */
- field = _exitList[(_mouseX - 283) / 7 + 5 * ((_mouseY - 163) / 7)];
- } else if ((_mouseY >= 161) && (_mouseX <= 270)) {
- /* inventory box */
- field = (_mouseX + 1) / 136 + ((_mouseY - 161) / 10) * 2;
- if (field + _inventoryScroll < _inventory.getSize())
- field += 512;
- else
- field = -1;
- } else if ((_mouseY >= 161) && (_mouseX >= 271) && (_mouseX < 279)) {
- /* inventory arrows */
- field = (_mouseY > 180) ? 769 : 768;
- } else {
- /* normal item */
- for (int i = 0; (_currentRoom->getObject(i)->_id != INVALIDOBJECT) &&
- (field == -1) && i < kMaxObject; i++) {
- click = _currentRoom->getObject(i)->_click;
- const MS2Image *image = _vm->_screen->getCurrentImage();
- if (click != 255 && image) {
- const MS2Image::ClickField *clickField = image->_clickField;
- do {
- if ((_mouseX >= clickField[click].x1) && (_mouseX <= clickField[click].x2) &&
- (_mouseY >= clickField[click].y1) && (_mouseY <= clickField[click].y2))
- field = i;
-
- click = clickField[click].next;
- } while ((click != 0) && (field == -1));
- }
- }
- }
-
- if (_mouseField != field) {
- switch (mouseLocation) {
- case onInventoryArrowUp:
- case onInventoryArrowDown:
- // Fallthrough
- _guiInventoryArrow[_mouseField - 768].setHighlight(false);
- break;
- case onInventory:
- _guiInventory[_mouseField - 512].setHighlight(false);
- break;
- case onCmdButton:
- _guiCommandButton[_mouseField - 256].setHighlight(false);
- break;
- case onObject:
- case onNone:
- // Fallthrough
- break;
- }
-
- setObjectNull(_currentInputObject);
-
- _mouseField = field;
- if (_mouseField >= 0 && _mouseField < 256)
- mouseLocation = onObject;
- else if (_mouseField >= 256 && _mouseField < 512)
- mouseLocation = onCmdButton;
- else if (_mouseField >= 512 && _mouseField < 768)
- mouseLocation = onInventory;
- else if (_mouseField == 768)
- mouseLocation = onInventoryArrowUp;
- else if (_mouseField == 769)
- mouseLocation = onInventoryArrowDown;
- else
- mouseLocation = onNone;
-
- switch (mouseLocation) {
- case onInventoryArrowUp:
- case onInventoryArrowDown:
- // Fallthrough
- _guiInventoryArrow[_mouseField - 768].setHighlight(true);
- break;
- case onInventory:
- _guiInventory[_mouseField - 512].setHighlight(true);
- _currentInputObject = _inventory.get(_mouseField - 512 + _inventoryScroll);
- break;
- case onCmdButton:
- _guiCommandButton[_mouseField - 256].setHighlight(true);
- break;
- case onObject:
- _currentInputObject = _currentRoom->getObject(_mouseField);
- break;
- case onNone:
- break;
- }
- }
- }
-}
-
-void GameManager::setObjectNull(Object *&obj) {
- obj = &_nullObject;
-}
-
-bool GameManager::isNullObject(Object *obj) {
- return obj == &_nullObject;
-}
-
-void GameManager::sentence(int number, bool brightness) {
- if (number < 0)
- return;
- _vm->renderBox(0, 141 + _rowsStart[number] * 10, 320, _rows[number] * 10 - 1, brightness ? kColorWhite44 : kColorWhite25);
- if (_texts[_rowsStart[number]] == kStringDialogSeparator)
- _vm->renderText(kStringConversationEnd, 1, 142 + _rowsStart[number] * 10, brightness ? kColorRed : kColorDarkRed);
- else {
- for (int r = _rowsStart[number]; r < _rowsStart[number] + _rows[number]; ++r)
- _vm->renderText(_texts[r], 1, 142 + r * 10, brightness ? kColorGreen : kColorDarkGreen);
- }
-}
-
-void GameManager::say(StringId textId) {
- Common::String str = _vm->getGameString(textId);
- if (!str.empty())
- say(str.c_str());
-}
-
-void GameManager::say(const char *text) {
- Common::String t(text);
- char *row[6];
- Common::String::iterator p = t.begin();
- uint numRows = 0;
- while (*p) {
- row[numRows++] = p;
- while ((*p != '\0') && (*p != '|')) {
- ++p;
- }
- if (*p == '|') {
- *p = 0;
- ++p;
- }
- }
-
- _vm->renderBox(0, 138, 320, 62, kColorBlack);
- _vm->renderBox(0, 141, 320, numRows * 10 - 1, kColorWhite25);
- for (uint r = 0; r < numRows; ++r)
- _vm->renderText(row[r], 1, 142 + r * 10, kColorDarkGreen);
- waitOnInput((t.size() + 20) * _vm->_textSpeed / 10);
- _vm->renderBox(0, 138, 320, 62, kColorBlack);
-}
-
-void GameManager::reply(StringId textId, int aus1, int aus2) {
- Common::String str = _vm->getGameString(textId);
- if (!str.empty())
- reply(str.c_str(), aus1, aus2);
-}
-
-void GameManager::reply(const char *text, int aus1, int aus2) {
- if (*text != '|')
- _vm->renderMessage(text, kMessageTop);
-
- for (int z = (strlen(text) + 20) * _vm->_textSpeed / 40; z > 0; --z) {
- if (aus1)
- _vm->renderImage(aus1);
- waitOnInput(2);
- if (_keyPressed || _mouseClicked)
- z = 1;
- if (aus2)
- _vm->renderImage(aus2);
- waitOnInput(2);
- if (_keyPressed || _mouseClicked)
- z = 1;
- }
- if (*text != '|')
- _vm->removeMessage();
-}
-
-int GameManager::dialog(int num, byte rowLength[6], StringId text[6], int number) {
- _vm->_allowLoadGame = false;
- _guiEnabled = false;
-
- bool remove[6];
- for (int i = 0; i < 6; ++i)
- remove[i] = _currentRoom->sentenceRemoved(i, number);
-
- _vm->renderBox(0, 138, 320, 62, kColorBlack);
-
- for (int i = 0; i < 6 ; ++i)
- _sentenceNumber[i] = -1;
-
- int r = 0, rq = 0;
- for (int i = 0; i < num; ++i) {
- if (!remove[i]) {
- _rowsStart[i] = r;
- _rows[i] = rowLength[i];
- for (int j = 0; j < _rows[i]; ++j, ++r, ++rq) {
- _texts[r] = text[rq];
- _sentenceNumber[r] = i;
- }
- sentence(i, false);
- } else
- rq += rowLength[i];
- }
-
- _currentSentence = -1;
- do {
- do {
- updateEvents();
- mousePosDialog(_mouseX, _mouseY);
- g_system->updateScreen();
- g_system->delayMillis(_vm->_delay);
- } while (!_mouseClicked && !_vm->shouldQuit());
- } while (_currentSentence == -1 && !_vm->shouldQuit());
-
- _vm->renderBox(0, 138, 320, 62, kColorBlack);
-
- if (number && _currentSentence != -1 && _texts[_rowsStart[_currentSentence]] != kStringDialogSeparator)
- _currentRoom->removeSentence(_currentSentence, number);
-
- _guiEnabled = true;
- _vm->_allowLoadGame = true;
-
- return _currentSentence;
-}
-
-void GameManager::mousePosDialog(int x, int y) {
- int a = y < 141 ? -1 : _sentenceNumber[(y - 141) / 10];
- if (a != _currentSentence) {
- sentence(_currentSentence, false);
- _currentSentence = a;
- sentence(_currentSentence, true);
- }
-}
-
-void GameManager::takeObject(Object &obj) {
- if (obj.hasProperty(CARRIED))
- return;
-
- if (obj._section != 0)
- _vm->renderImage(obj._section);
- obj._click = obj._click2 = 255;
- _inventory.add(obj);
-}
-
-void GameManager::drawCommandBox() {
- for (int i = 0; i < ARRAYSIZE(_guiCommandButton); ++i) {
- _vm->renderBox(_guiCommandButton[i]);
- int space = (_guiCommandButton[i].width() - Screen::textWidth(_guiCommandButton[i].getText())) / 2;
- _vm->renderText(_guiCommandButton[i].getText(),
- _guiCommandButton[i].getTextPos().x + space,
- _guiCommandButton[i].getTextPos().y,
- _guiCommandButton[i].getTextColor());
- }
-}
-
-void GameManager::drawInventory() {
- for (int i = 0; i < ARRAYSIZE(_guiInventory); ++i) {
- _vm->renderBox(_guiInventory[i]);
- _vm->renderText(_inventory.get(i + _inventoryScroll)->_name,
- _guiInventory[i].getTextPos().x,
- _guiInventory[i].getTextPos().y,
- _guiInventory[i].getTextColor());
- }
-
- _vm->renderBox(_guiInventoryArrow[0]);
- _vm->renderBox(_guiInventoryArrow[1]);
- if (_inventory.getSize() > ARRAYSIZE(_guiInventory)) {
- if (_inventoryScroll != 0)
- _vm->renderText(_guiInventoryArrow[0]);
- if (_inventoryScroll + ARRAYSIZE(_guiInventory) < _inventory.getSize())
- _vm->renderText(_guiInventoryArrow[1]);
- }
-}
-
-uint16 GameManager::getKeyInput(bool blockForPrintChar) {
- while (!_vm->shouldQuit()) {
- updateEvents();
- if (_keyPressed) {
- if (blockForPrintChar) {
- if (Common::isPrint(_key.keycode) ||
- _key.keycode == Common::KEYCODE_BACKSPACE ||
- _key.keycode == Common::KEYCODE_DELETE ||
- _key.keycode == Common::KEYCODE_RETURN ||
- _key.keycode == Common::KEYCODE_SPACE ||
- _key.keycode == Common::KEYCODE_ESCAPE ||
- _key.keycode == Common::KEYCODE_UP ||
- _key.keycode == Common::KEYCODE_DOWN ||
- _key.keycode == Common::KEYCODE_LEFT ||
- _key.keycode == Common::KEYCODE_RIGHT) {
- if (_key.flags & Common::KBD_SHIFT)
- return toupper(_key.ascii);
- else
- return tolower(_key.ascii);
- }
- } else {
- return _key.ascii;
- }
- }
- g_system->updateScreen();
- g_system->delayMillis(_vm->_delay);
- }
- return 0;
-}
-
-void GameManager::getInput() {
- while (!_vm->shouldQuit()) {
- updateEvents();
- if (_mouseClicked || _keyPressed)
- break;
- g_system->updateScreen();
- g_system->delayMillis(_vm->_delay);
- }
-}
-
-void GameManager::changeRoom(RoomId id) {
- _currentRoom = _rooms[id];
- _newRoom = true;
-}
-
-void GameManager::wait(int ticks) {
- if (_vm->shouldQuit())
- return;
- uint32 end = g_system->getMillis() + ticksToMsec(ticks);
- do {
- g_system->delayMillis(_vm->_delay);
- updateEvents();
- g_system->updateScreen();
- } while (g_system->getMillis() < end && !_vm->shouldQuit());
-}
-
-void GameManager::waitOnInput(int ticks) {
- if (_vm->shouldQuit())
- return;
- uint32 end = g_system->getMillis() + ticksToMsec(ticks);
- do {
- g_system->delayMillis(_vm->_delay);
- updateEvents();
- g_system->updateScreen();
- } while (g_system->getMillis() < end && !_vm->shouldQuit() && !_keyPressed && !_mouseClicked);
-}
-
-bool GameManager::waitOnInput(int ticks, Common::KeyCode &keycode) {
- if (_vm->shouldQuit())
- return false;
- keycode = Common::KEYCODE_INVALID;
- uint32 end = g_system->getMillis() + ticksToMsec(ticks);
- do {
- g_system->delayMillis(_vm->_delay);
- updateEvents();
- g_system->updateScreen();
- if (_keyPressed) {
- keycode = _key.keycode;
- _key.reset();
- return true;
- } else if (_mouseClicked)
- return true;
- } while (g_system->getMillis() < end && !_vm->shouldQuit());
- return false;
-}
-
-void GameManager::setAnimationTimer(int ticks) {
- _animationTimer = ticksToMsec(ticks);
-}
-
-void GameManager::handleTime() {
- if (_timerPaused)
- return;
- int32 newTime = g_system->getMillis();
- int32 delta = newTime - _oldTime;
-
- if (_animationTimer > delta)
- _animationTimer -= delta;
- else
- _animationTimer = 0;
-
- _oldTime = newTime;
-}
-
-void GameManager::pauseTimer(bool pause) {
- if (pause == _timerPaused)
- return;
-
- if (pause) {
- _timerPaused = true;
- } else {
- _oldTime = g_system->getMillis();
- _timerPaused = false;
- }
-}
-
-void GameManager::screenShake() {
- for (int i = 0; i < 12; ++i) {
- _vm->_system->setShakePos(8);
- wait(1);
- _vm->_system->setShakePos(0);
- wait(1);
- }
-}
-
-void GameManager::showMenu() {
- _vm->renderBox(0, 138, 320, 62, 0);
- _vm->renderBox(0, 140, 320, 9, kColorWhite25);
- drawCommandBox();
- _vm->renderBox(281, 161, 39, 39, kColorWhite25);
- drawInventory();
-}
-
-void GameManager::drawMapExits() {
-// TODO: Preload _exitList on room entry instead on every call
- _vm->renderBox(281, 161, 39, 39, kColorWhite25);
-
- if ((_currentRoom >= _rooms[PYR_ENTRANCE] && _currentRoom <= _rooms[HOLE_ROOM]) ||
- (_currentRoom >= _rooms[FLOORDOOR] && _currentRoom <= _rooms[BST_DOOR]))
- compass();
- else {
- for (int i = 0; i < 25; i++)
- _exitList[i] = -1;
- for (int i = 0; i < kMaxObject; i++) {
- if (_currentRoom->getObject(i)->hasProperty(EXIT)) {
- byte r = _currentRoom->getObject(i)->_direction;
- _exitList[r] = i;
- int x = 284 + 7 * (r % 5);
- int y = 164 + 7 * (r / 5);
- _vm->renderBox(x, y, 5, 5, kColorDarkRed);
- }
- }
- }
-}
-
-void GameManager::animationOff() {
- _animationEnabled = false;
-}
-
-void GameManager::animationOn() {
- _animationEnabled = true;
-}
-
-void GameManager::edit(Common::String &input, int x, int y, uint length) {
- bool isEditing = true;
- uint cursorIndex = input.size();
- // NOTE: Pixels for char needed = kFontWidth + 2px left and right side bearing
- int overdrawWidth = ((int)((length + 1) * (kFontWidth + 2)) > (kScreenWidth - x)) ?
- kScreenWidth - x : (length + 1) * (kFontWidth + 2);
-
- _guiEnabled = false;
- while (isEditing) {
- _vm->_screen->setTextCursorPos(x, y);
- _vm->_screen->setTextCursorColor(kColorWhite99);
- _vm->renderBox(x, y - 1, overdrawWidth, 9, kColorWhite35);
- for (uint i = 0; i < input.size(); ++i) {
- // Draw char highlight depending on cursor position
- if (i == cursorIndex) {
- _vm->renderBox(_vm->_screen->getTextCursorPos().x, y - 1,
- Screen::textWidth(input[i]), 9, kColorWhite99);
- _vm->_screen->setTextCursorColor(kColorWhite35);
- _vm->renderText(input[i]);
- _vm->_screen->setTextCursorColor(kColorWhite99);
- } else
- _vm->renderText(input[i]);
- }
-
- if (cursorIndex == input.size()) {
- _vm->renderBox(_vm->_screen->getTextCursorPos().x + 1, y - 1, 6, 9, kColorWhite35);
- _vm->renderBox(_vm->_screen->getTextCursorPos().x, y - 1, 1, 9, kColorWhite99);
- }
-
- getKeyInput(true);
- if (_vm->shouldQuit())
- break;
- switch (_key.keycode) {
- case Common::KEYCODE_RETURN:
- case Common::KEYCODE_ESCAPE:
- isEditing = false;
- break;
- case Common::KEYCODE_UP:
- case Common::KEYCODE_DOWN:
- cursorIndex = input.size();
- break;
- case Common::KEYCODE_LEFT:
- if (cursorIndex != 0)
- --cursorIndex;
- break;
- case Common::KEYCODE_RIGHT:
- if (cursorIndex != input.size())
- ++cursorIndex;
- break;
- case Common::KEYCODE_DELETE:
- if (cursorIndex != input.size())
- input.deleteChar(cursorIndex);
- break;
- case Common::KEYCODE_BACKSPACE:
- if (cursorIndex != 0) {
- --cursorIndex;
- input.deleteChar(cursorIndex);
- }
- break;
- default:
- if (Common::isPrint(_key.ascii) && input.size() < length) {
- input.insertChar(_key.ascii, cursorIndex);
- ++cursorIndex;
- }
- break;
- }
- }
- _guiEnabled = true;
-}
-
-void GameManager::takeMoney(int amount) {
- _state._money += amount;
- _vm->setGameString(kStringMoney, Common::String::format("%d Xa", _state._money));
-}
-
-void GameManager::drawStatus() {
- int index = static_cast<int>(_inputVerb);
- _vm->renderBox(0, 140, 320, 9, kColorWhite25);
- _vm->renderText(_vm->getGameString(guiStatusCommands[index]), 1, 141, kColorDarkGreen);
-
- if (isNullObject(_inputObject[0]))
- _vm->renderText(_currentInputObject->_name);
- else {
- _vm->renderText(_inputObject[0]->_name);
- if (_inputVerb == ACTION_GIVE)
- _vm->renderText(kPhrasalVerbParticleGiveTo);
- else if (_inputVerb == ACTION_USE)
- _vm->renderText(kPhrasalVerbParticleUseWith);
-
- _vm->renderText(_currentInputObject->_name);
- }
-}
-
-void GameManager::dead(StringId messageId) {
- _vm->paletteFadeOut();
- _guiEnabled = false;
- _vm->setCurrentImage(43);
- _vm->renderImage(0);
- _vm->renderMessage(messageId);
- _vm->_sound->play(kAudioDeath);
- _vm->paletteFadeIn();
- getInput();
- _vm->paletteFadeOut();
- _vm->removeMessage();
-
- destroyRooms();
- initRooms();
- initState();
- changeRoom(AIRPORT);
- initGui();
- _inventory.clear();
- g_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(255);
- _vm->_screen->setGuiBrightness(255);
- _vm->paletteBrightness();
-
- _guiEnabled = true;
-}
-
-int GameManager::invertSection(int section) {
- if (section < 128)
- section += 128;
- else
- section -= 128;
-
- return section;
-}
-
-bool GameManager::genericInteract(Action verb, Object &obj1, Object &obj2) {
- if (verb == ACTION_OPEN && obj1._id == WALLET) {
- if (_rooms[TAXISTAND]->getObject(4)->_type & CARRIED)
- _vm->renderMessage(kStringEmpty);
- else {
- _vm->renderMessage(kStringWalletOpen);
- takeObject(*_rooms[TAXISTAND]->getObject(4));
- takeObject(*_rooms[TAXISTAND]->getObject(5));
- takeMoney(1);
- _vm->playSound(kAudioSuccess);
- }
- } else if (verb == ACTION_PRESS && obj1._id == TRANSMITTER) {
- if (_currentRoom == _rooms[TAXISTAND]) {
- if (_currentRoom->getObject(0)->_type != EXIT) {
- _vm->renderImage(5);
- wait(3);
- _vm->renderImage(6);
- _vm->playSound(kAudioTaxiOpen);
- _currentRoom->getObject(0)->_type = EXIT;
- drawMapExits();
- }
- } else if (_currentRoom == _rooms[STREET] ||
- _currentRoom == _rooms[CULTURE_PALACE] ||
- _currentRoom == _rooms[CITY1] ||
- _currentRoom == _rooms[CITY2]) {
- Common::String t = _vm->getGameString(kStringTaxiArrives);
- _vm->renderMessage(t);
- waitOnInput((t.size() + 20) * _vm->_textSpeed / 10);
- _vm->removeMessage();
- taxi();
- } else
- _vm->renderMessage(kStringNothingHappens);
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, ROD, MAGNET)) {
- Object *o1, *o2;
- if (obj2._id == ROD) {
- o1 = &obj2;
- o2 = &obj1;
- } else {
- o1 = &obj1;
- o2 = &obj2;
- }
- if (!(o1->_type & CARRIED))
- return false;
-
- if (!(o2->_type & CARRIED))
- takeObject(*o2);
-
- _vm->renderMessage(kStringAttachMagnet);
- o1->_name = kStringPoleMagnet;
- o1->_description = kStringCunning;
- _inventory.remove(*o2);
- _rooms[APARTMENT]->setSectionVisible(kMaxSection - 1, kShownTrue);
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, CHIP, PLAYER)) {
- Object *o1, *o2;
- if (obj2._id == CHIP) {
- o1 = &obj2;
- o2 = &obj1;
- } else {
- o1 = &obj1;
- o2 = &obj2;
- }
- if (!(o2->_type & CARRIED))
- _vm->renderMessage(kStringMustBuyFirst);
- else {
- if (!(o1->_type & CARRIED))
- {
- _vm->renderImage(1);
- _vm->renderImage(2 + 128);
- _currentRoom->getObject(0)->_click = 255;
- } else
- _inventory.remove(*o1);
-
- _vm->renderMessage(kStringInsertChip);
- if (_state._admission)
- _state._admission = 2;
- else
- _state._admission = 1;
- }
- } else if (verb == ACTION_USE && Object::combine(obj1, obj2, DISCMAN, PLAYER)) {
- switch (_state._admission) {
- case 1:
- // fall through
- case 2:
- _vm->renderMessage(kStringTransferCD);
- _state._admission = 2;
- _vm->playSound(kAudioSuccess);
- break;
- default:
- _vm->renderMessage(kStringCDNotInserted);
- }
- } else if (verb == ACTION_OPEN && obj1._id == PLAYER) {
- switch (_state._admission) {
- case 1:
- _state._admission = 0;
- playerTakeOut();
- break;
- case 2:
- _state._admission = 3;
- playerTakeOut();
- break;
- default:
- _vm->renderMessage(kStringChipNotInserted);
- }
- } else if (verb == ACTION_OPEN && obj1._id == DISCMAN) {
- _vm->renderMessage(kStringWhatFor);
- } else if (verb == ACTION_PRESS && obj1._id == DISCMAN) {
- _vm->renderMessage(kStringMMCD);
- playCD();
- } else if (verb == ACTION_PRESS && obj1._id == PLAYER) {
- switch (_state._admission) {
- case 1:
- _vm->renderMessage(kStringChipEmpty);
- break;
- case 2:
- _vm->renderMessage(kStringListeningToCD);
- playCD();
- break;
- default:
- _vm->renderMessage(kStringNoChip);
- }
- } else if ((verb == ACTION_OPEN || verb == ACTION_USE) &&
- obj1._id == BOTTLE && (obj1._type & CARRIED)) {
- _vm->renderMessage(kStringTipsy);
- _state._tipsy = true;
- _state._eventTime = g_system->getMillis() + 60000;
- _state._eventCallback = kSoberFn;
- } else if (verb == ACTION_LOOK && obj1._id == MUSCARD) {
- _vm->setCurrentImage(30);
- _vm->renderImage(0);
- //karte_an = true
- waitOnInput(100000);
- //karte_an = false
- _vm->removeMessage();
- _vm->renderRoom(*_currentRoom);
- drawGUI();
- } else
- return false;
- return true;
-}
-
-void GameManager::drawGUI() {
- drawMapExits();
- drawInventory();
- drawStatus();
- drawCommandBox();
-}
-
-void GameManager::playCD() {
- CursorMan.showMouse(false);
- _vm->playSound(kMusicMadMonkeys);
- Common::KeyCode k = Common::KEYCODE_INVALID;
- while(_vm->_sound->isPlaying())
- if (waitOnInput(1, k))
- break;
- _vm->_sound->stop();
- _vm->removeMessage();
- CursorMan.showMouse(true);
-}
-
-void GameManager::handleInput() {
- bool validCommand = genericInteract(_inputVerb, *_inputObject[0], *_inputObject[1]);
- if (!validCommand)
- validCommand = _currentRoom->interact(_inputVerb, *_inputObject[0], *_inputObject[1]);
- if (!validCommand) {
- switch (_inputVerb) {
- case ACTION_LOOK:
- _vm->renderMessage(_inputObject[0]->_description);
- break;
-
- case ACTION_WALK:
- if (_inputObject[0]->hasProperty(CARRIED)) {
- // You already carry this.
- _vm->renderMessage(kStringGenericInteract1);
- } else if (!_inputObject[0]->hasProperty(EXIT)) {
- // You're already there.
- _vm->renderMessage(kStringGenericInteract2);
- } else if (_inputObject[0]->hasProperty(OPENABLE) && !_inputObject[0]->hasProperty(OPENED)) {
- // This is closed
- _vm->renderMessage(kStringGenericInteract3);
- } else {
- _lastRoom = _currentRoom;
- changeRoom(_inputObject[0]->_exitRoom);
- }
-
- break;
-
- case ACTION_TAKE:
- if (_inputObject[0]->hasProperty(OPENED)) {
- // You already have that
- _vm->renderMessage(kStringGenericInteract4);
- } else if (_inputObject[0]->hasProperty(UNNECESSARY)) {
- // You do not need that.
- _vm->renderMessage(kStringGenericInteract5);
- } else if (!_inputObject[0]->hasProperty(TAKE)) {
- // You can't take that.
- _vm->renderMessage(kStringGenericInteract6);
- } else
- takeObject(*_inputObject[0]);
-
- break;
-
- case ACTION_OPEN:
- if (!_inputObject[0]->hasProperty(OPENABLE)) {
- // This can't be opened
- _vm->renderMessage(kStringGenericInteract7);
- } else if (_inputObject[0]->hasProperty(OPENED)) {
- // This is already opened.
- _vm->renderMessage(kStringGenericInteract8);
- } else if (_inputObject[0]->hasProperty(CLOSED)) {
- // This is locked.
- _vm->renderMessage(kStringGenericInteract9);
- } else {
- _vm->renderImage(_inputObject[0]->_section);
- _inputObject[0]->setProperty(OPENED);
- byte i = _inputObject[0]->_click;
- _inputObject[0]->_click = _inputObject[0]->_click2;
- _inputObject[0]->_click2 = i;
- _vm->_sound->play(kAudioTaxiOpen);
- }
- break;
-
- case ACTION_CLOSE:
- if (!_inputObject[0]->hasProperty(OPENABLE) ||
- (_inputObject[0]->hasProperty(CLOSED) &&
- _inputObject[0]->hasProperty(OPENED))) {
- // This can't be closed.
- _vm->renderMessage(kStringGenericInteract10);
- } else if (!_inputObject[0]->hasProperty(OPENED)) {
- // This is already closed.
- _vm->renderMessage(kStringGenericInteract11);
- } else {
- _vm->renderImage(invertSection(_inputObject[0]->_section));
- _inputObject[0]->disableProperty(OPENED);
- byte i = _inputObject[0]->_click;
- _inputObject[0]->_click = _inputObject[0]->_click2;
- _inputObject[0]->_click2 = i;
- _vm->_sound->play(kAudioElevator1);
- }
- break;
-
- case ACTION_GIVE:
- if (_inputObject[0]->hasProperty(CARRIED)) {
- // Better keep it!
- _vm->renderMessage(kStringGenericInteract12);
- }
- break;
-
- default:
- // This is not possible.
- _vm->renderMessage(kStringGenericInteract13);
- }
- }
-}
-
-void GameManager::executeRoom() {
- if (_currentRoom == _rooms[PUZZLE_FRONT])
- puzzleConstruction();
- if (_state._sirenOn && !_vm->_sound->isPlaying())
- _vm->_sound->playSiren();
- if (_processInput && !_vm->_screen->isMessageShown() && _guiEnabled) {
- handleInput();
- if (_mouseClicked) {
- Common::Event event;
- event.type = Common::EVENT_MOUSEMOVE;
- event.mouse = Common::Point(0, 0);
- _vm->getEventManager()->pushEvent(event);
- event.type = Common::EVENT_MOUSEMOVE;
- event.mouse = Common::Point(_mouseX, _mouseY);
- _vm->getEventManager()->pushEvent(event);
- }
-
- resetInputState();
- }
-
- if (_guiEnabled) {
- if (!_vm->_screen->isMessageShown()) {
- g_system->fillScreen(kColorBlack);
- _vm->renderRoom(*_currentRoom);
- }
- if (_currentRoom->getId() < MUSEUM)
- drawMapExits();
- else
- drawClock();
- drawInventory();
- drawStatus();
- drawCommandBox();
- }
-
- if (_vm->_screen->getViewportBrightness() == 0)
- _vm->paletteFadeIn();
-
- if (!_currentRoom->hasSeen() && _newRoom) {
- _newRoom = false;
- _currentRoom->onEntrance();
- }
-}
-
-void GameManager::leaveTaxi() {
- _currentRoom = _state._previousRoom;
- _vm->renderRoom(*_currentRoom);
- _guiEnabled = true;
-}
-
-void GameManager::taxiUnknownDestination() {
- _vm->renderImage(invertSection(2));
- _vm->renderImage(0);
- _vm->renderImage(1);
- _vm->renderImage(4);
- waitOnInput(_vm->_textSpeed * 3);
- _vm->renderImage(invertSection(4));
- _vm->renderImage(0);
- _vm->renderImage(1);
- _vm->renderImage(2);
-}
-
-void GameManager::taxiPayment(int price, int destination) {
- static StringId answers[] = {
- kStringPay,
- kStringLeaveTaxi
- };
- if (dialog(2, _dials, answers, 0)) {
- leaveTaxi();
- } else if (_state._money < price) {
- Common::String t = _vm->getGameString(kStringNotEnoughMoney);
- _vm->renderMessage(t);
- waitOnInput((t.size() + 20) * _vm->_textSpeed / 10);
- _vm->removeMessage();
- leaveTaxi();
- } else {
- takeMoney(-price);
- _vm->renderImage(invertSection(5));
- _vm->renderImage(invertSection(6));
- _vm->renderImage(0);
- _vm->renderImage(1);
- _vm->renderImage(3);
-
- Common::String t = _vm->getGameString(kStringTaxiAccelerating);
- _vm->renderMessage(t);
- _vm->playSound(kAudioTaxiLeaving);
- while(_vm->_sound->isPlaying())
- wait(1);
- waitOnInput((t.size() + 20) * _vm->_textSpeed / 10);
- _vm->removeMessage();
-
- _vm->paletteFadeOut();
- _vm->_system->fillScreen(kColorBlack);
- _vm->_screen->setViewportBrightness(255);
- _vm->_screen->setGuiBrightness(255);
- _vm->paletteBrightness();
-
- Common::String t2 = _vm->getGameString(kString5MinutesLater);
- _vm->renderMessage(t2);
- _vm->playSound(kAudioTaxiArriving);
- while(_vm->_sound->isPlaying())
- wait(1);
- waitOnInput((t2.size() + 20) * _vm->_textSpeed / 10);
- _vm->removeMessage();
- _vm->paletteFadeOut();
-
- switch (destination) {
- case 0:
- changeRoom(TAXISTAND);
- break;
- case 1:
- changeRoom(STREET);
- break;
- case 2:
- changeRoom(CULTURE_PALACE);
- break;
- case 10:
- changeRoom(CITY1);
- break;
- case 11:
- changeRoom(CITY2);
- break;
- }
- }
-}
-
-void GameManager::taxi() {
- _vm->_allowSaveGame = false;
- static StringId dest[] = {
- kStringAirport,
- kStringDowntown,
- kStringCulturePalace,
- kStringEarth,
- kStringPrivateApartment,
- kStringLeaveTaxi
- };
- Common::String input;
- int possibility = _state._taxiPossibility;
-
- _state._previousRoom = _currentRoom;
- _currentRoom = _rooms[INTRO];
- _vm->setCurrentImage(4);
- _vm->renderImage(0);
- _vm->renderImage(1);
- _vm->renderImage(2);
-
- if (_state._previousRoom == _rooms[TAXISTAND]) possibility += 1;
- else if (_state._previousRoom == _rooms[STREET]) possibility += 2;
- else if (_state._previousRoom == _rooms[CULTURE_PALACE]) possibility += 4;
- int answer;
- do {
- _currentRoom->removeSentenceByMask(possibility, 1);
- switch (answer = dialog(6, _dials, dest, 1)) {
- case 3:
- _state._taxiPossibility += 8;
- possibility += 8;
- taxiUnknownDestination();
- break;
- case 5:
- leaveTaxi();
- break;
- case 4:
- _vm->renderMessage(kStringAddress);
- do {
- edit(input, 101, 70, 18);
- } while ((_key.keycode != Common::KEYCODE_RETURN) && (_key.keycode != Common::KEYCODE_ESCAPE) && !_vm->shouldQuit());
-
- _vm->removeMessage();
- if (_key.keycode == Common::KEYCODE_ESCAPE) {
- leaveTaxi();
- break;
- }
- input.toUppercase();
- if (input == "115AY2,96A" || input == "115AY2,96B")
- answer = 10;
- else if (input == "341,105A" || input == "341,105B") {
- if (_state._addressKnown)
- answer = 11;
- else {
- Common::String t = _vm->getGameString(kStringCheater);
- _vm->renderMessage(t);
- waitOnInput((t.size() + 20) * _vm->_textSpeed / 10);
- _vm->removeMessage();
-
- leaveTaxi();
- break;
- }
- } else {
- answer = 3;
- input = "";
- taxiUnknownDestination();
- break;
- }
- _vm->renderImage(invertSection(2));
- _vm->renderImage(0);
- _vm->renderImage(1);
- _vm->renderImage(6);
- _vm->playSound(kAudioSuccess);
- taxiPayment(14, answer);
- break;
- default:
- _vm->renderImage(invertSection(2));
- _vm->renderImage(0);
- _vm->renderImage(1);
- _vm->renderImage(5);
- taxiPayment(8, answer);
- break;
- }
- _rooms[INTRO]->addAllSentences(1);
- } while(answer == 3 && !_vm->shouldQuit());
- _vm->_allowSaveGame = true;
-
-}
-
-void GameManager::playerTakeOut() {
- _vm->renderMessage(kStringRemoveChip);
- Object *o = _rooms[APARTMENT]->getObject(0);
- o->_section = 0;
- takeObject(*o);
-}
-
-void GameManager::sober() {
- _state._tipsy = false;
-}
-
-bool GameManager::talk(int mod1, int mod2, int rest, MessagePosition pos, StringId id) {
- Common::KeyCode key = Common::KEYCODE_INVALID;
- const Common::String& text = _vm->getGameString(id);
-
- _vm->renderMessage(text, pos);
- int animation_count = (text.size() + 20) * (10 - rest) * _vm->_textSpeed / 400;
- _restTime = (text.size() + 20) * rest * _vm->_textSpeed / 400;
-
- while (animation_count) {
- if (mod1)
- _vm->renderImage(mod1);
-
- if (waitOnInput(2, key)) {
- _vm->removeMessage();
- return key != Common::KEYCODE_ESCAPE && !_vm->shouldQuit();
- }
- if (mod2)
- _vm->renderImage(mod2);
-
- if (waitOnInput(2, key)) {
- _vm->removeMessage();
- return key != Common::KEYCODE_ESCAPE && !_vm->shouldQuit();
- }
- animation_count--;
- }
- if (_restTime == 0)
- _vm->removeMessage();
-
- return true;
-}
-
-bool GameManager::talkRest(int mod1, int mod2, int rest) {
- Common::KeyCode key = Common::KEYCODE_INVALID;
- while (rest) {
- _vm->renderImage(mod1);
- if (waitOnInput(2, key)) {
- _vm->removeMessage();
- return key != Common::KEYCODE_ESCAPE && !_vm->shouldQuit();
- }
- _vm->renderImage(mod2);
- if (waitOnInput(2, key)) {
- _vm->removeMessage();
- return key != Common::KEYCODE_ESCAPE && !_vm->shouldQuit();
- }
- rest--;
- }
- return true;
-}
-
-void GameManager::pyramidEnd() {
- _vm->renderMessage(kStringPyramid0);
- waitOnInput(_messageDuration);
- _vm->removeMessage();
- _vm->paletteFadeOut();
- _vm->loadGame(kSleepAutosaveSlot);
- changeRoom(CABIN);
- drawGUI();
- _rooms[CABIN]->setSectionVisible(kMaxSection - 1, kShownFalse);
- _rooms[CABIN]->setSectionVisible(kMaxSection - 2, kShownTrue);
- _rooms[CABIN]->setSectionVisible(1, kShownFalse);
-}
-
-void GameManager::passageConstruction() {
- static ConstructionEntry constructionTab[9] = {
- {0, 4, 10, 2, 13},
- {0, 4, 9, 2, 14},
- {0, 4, 8, 3, 2},
- {1, 4, 7, 3, 1},
- {1, 5, 7, 3, 3},
- {1, 6, 7, 3, 5},
- {1, 4, 7, 1, 2},
- {1, 2, 5, 1, 1},
- {0, 4, 9, 2, 20}
- };
-
- changeRoom(PYR_ENTRANCE);
- _rooms[PYR_ENTRANCE]->setSectionVisible(1,
- !wall(_state._pyraS, _state._pyraZ, _state._pyraDirection, 0, -1));
- _rooms[PYR_ENTRANCE]->setSectionVisible(2,
- !wall(_state._pyraS, _state._pyraZ, _state._pyraDirection, 0, 1));
- _rooms[PYR_ENTRANCE]->setSectionVisible(7,
- wall(_state._pyraS, _state._pyraZ, _state._pyraDirection, 1, 0));
-
- if (!_rooms[PYR_ENTRANCE]->isSectionVisible(7)) {
- _rooms[PYR_ENTRANCE]->getObject(3)->_type = EXIT;
- _rooms[PYR_ENTRANCE]->getObject(3)->_click = 0;
- _rooms[PYR_ENTRANCE]->setSectionVisible(3,
- !wall(_state._pyraS, _state._pyraZ, _state._pyraDirection, 1, -1));
- _rooms[PYR_ENTRANCE]->setSectionVisible(4,
- !wall(_state._pyraS, _state._pyraZ, _state._pyraDirection, 1, 1));
- _rooms[PYR_ENTRANCE]->setSectionVisible(8,
- wall(_state._pyraS, _state._pyraZ, _state._pyraDirection, 2, 0));
- if (!_rooms[PYR_ENTRANCE]->isSectionVisible(8)) {
- _rooms[PYR_ENTRANCE]->setSectionVisible(5,
- !wall(_state._pyraS, _state._pyraZ, _state._pyraDirection, 2, -1));
- _rooms[PYR_ENTRANCE]->setSectionVisible(6,
- !wall(_state._pyraS, _state._pyraZ, _state._pyraDirection, 2, 1));
- } else {
- _rooms[PYR_ENTRANCE]->setSectionVisible(5, kShownFalse);
- _rooms[PYR_ENTRANCE]->setSectionVisible(6, kShownFalse);
- }
- } else {
- _rooms[PYR_ENTRANCE]->getObject(3)->_type = NULLTYPE;
- _rooms[PYR_ENTRANCE]->getObject(3)->_click = 255;
- _rooms[PYR_ENTRANCE]->setSectionVisible(3, kShownFalse);
- _rooms[PYR_ENTRANCE]->setSectionVisible(4, kShownFalse);
- _rooms[PYR_ENTRANCE]->setSectionVisible(8, kShownFalse);
- }
- for (int i = 0; i < 9; i++) {
- bool b = (_state._pyraE == constructionTab[i]._e &&
- _state._pyraS == constructionTab[i]._s &&
- _state._pyraZ == constructionTab[i]._z &&
- _state._pyraDirection == constructionTab[i]._r);
- if (constructionTab[i]._a > 12)
- _rooms[PYR_ENTRANCE]->setSectionVisible(constructionTab[i]._a, b);
- else if (b)
- _rooms[PYR_ENTRANCE]->setSectionVisible(constructionTab[i]._a, kShownTrue);
- }
-
- _rooms[PYR_ENTRANCE]->setSectionVisible(18, kShownFalse);
- _rooms[PYR_ENTRANCE]->setSectionVisible(19, kShownFalse);
- _rooms[PYR_ENTRANCE]->setSectionVisible(21, kShownFalse);
- _rooms[PYR_ENTRANCE]->getObject(0)->_click = 255;
-
- if (_state._pyraE == 0 && _state._pyraS == 4 && _state._pyraZ == 10) {
- switch (_state._pyraDirection) {
- case 0:
- _rooms[PYR_ENTRANCE]->setSectionVisible(19, kShownTrue);
- _rooms[PYR_ENTRANCE]->getObject(0)->_click = 8;
- break;
- case 2:
- _rooms[PYR_ENTRANCE]->setSectionVisible(18, kShownTrue);
- _rooms[PYR_ENTRANCE]->getObject(0)->_click = 7;
- break;
- case 1:
- _rooms[PYR_ENTRANCE]->setSectionVisible(21, kShownTrue);
- _rooms[PYR_ENTRANCE]->getObject(0)->_click = 9;
- break;
- }
- }
- _rooms[PYR_ENTRANCE]->setSectionVisible(9,
- _rooms[PYR_ENTRANCE]->isSectionVisible(7) &
- !_rooms[PYR_ENTRANCE]->isSectionVisible(1));
- _rooms[PYR_ENTRANCE]->setSectionVisible(10,
- _rooms[PYR_ENTRANCE]->isSectionVisible(7) &
- !_rooms[PYR_ENTRANCE]->isSectionVisible(2));
- _rooms[PYR_ENTRANCE]->setSectionVisible(11,
- _rooms[PYR_ENTRANCE]->isSectionVisible(8) &
- !_rooms[PYR_ENTRANCE]->isSectionVisible(3));
- _rooms[PYR_ENTRANCE]->setSectionVisible(12,
- _rooms[PYR_ENTRANCE]->isSectionVisible(8) &
- !_rooms[PYR_ENTRANCE]->isSectionVisible(4));
-}
-
-byte GameManager::wall(int s, int z, int direction, int stepsForward, int stepsRight) {
- static char vertical[2][12][11] = {
- {
- {0,0,0,0,0,0,0,0,0,0,0},
- {0,1,0,0,0,0,0,0,0,0,0},
- {1,0,1,0,0,0,0,0,0,0,0},
- {1,0,1,0,1,0,0,0,0,0,0},
- {0,1,0,0,1,0,0,1,0,0,0},
- {0,0,1,0,0,0,1,0,1,0,0},
- {0,0,0,1,1,0,1,0,0,0,0},
- {0,0,0,1,1,0,0,1,0,0,0},
- {0,0,0,0,0,1,0,1,0,0,0},
- {0,0,0,0,0,1,1,0,1,0,0},
- {0,0,0,0,1,0,0,0,1,0,0},
- {0,0,0,0,1,0,0,0,0,0,0}
- },
- {
- {0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,1,0,0,0,0,0,0},
- {0,0,0,0,1,0,0,0,0,0,0},
- {0,1,0,1,0,0,0,0,0,0,0},
- {0,1,0,1,1,0,0,0,0,0,0},
- {1,0,0,0,1,0,0,0,0,0,0},
- {0,0,0,0,0,1,0,0,1,0,0},
- {0,0,0,0,0,0,1,1,0,0,1},
- {0,0,0,0,0,1,0,1,0,0,1},
- {0,0,0,0,1,0,1,0,1,1,0},
- {0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0}
- }
- };
-
- static char horizontal[2][11][12] = {
- {
- {0,1,1,0,0,0,0,0,0,0,0,0},
- {0,0,1,0,0,0,0,0,0,0,0,0},
- {0,1,0,1,1,0,0,0,0,0,0,0},
- {0,1,1,0,0,0,0,0,0,0,0,0},
- {0,0,1,0,0,1,1,0,1,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,1,0,0,0,0},
- {0,0,0,0,1,1,0,0,0,0,0,0},
- {0,0,0,0,0,1,0,1,1,0,0,0},
- {0,0,0,0,0,1,1,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0}
- },
- {
- {0,0,0,0,0,0,0,0,0,0,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0},
- {0,1,0,0,1,0,0,0,0,0,0,0},
- {0,0,0,0,1,0,0,0,0,0,0,0},
- {0,0,1,1,0,0,0,0,0,0,0,0},
- {0,1,1,0,0,1,0,0,0,0,0,0},
- {0,0,0,0,0,0,1,0,1,0,0,0},
- {0,0,0,0,0,1,1,0,0,0,0,0},
- {0,0,0,0,0,1,0,1,1,0,1,0},
- {0,0,0,0,0,1,1,0,0,1,0,0},
- {0,0,0,0,0,0,0,0,0,0,0,0}
- }
- };
- int newR;
- if (stepsRight) {
- if (stepsRight > 0)
- newR = (direction + 1) & 3;
- else {
- newR = (direction - 1) & 3;
- stepsRight = -stepsRight;
- }
- switch (direction) {
- case 0:
- return wall(s, z - stepsForward, newR, stepsRight, 0);
- case 2:
- return wall(s, z + stepsForward, newR, stepsRight, 0);
- case 1:
- return wall(s + stepsForward, z, newR, stepsRight, 0);
- case 3:
- return wall(s - stepsForward, z, newR, stepsRight, 0);
- }
- }
- switch (direction) {
- case 0:
- return vertical [_state._pyraE][z + 1 - stepsForward][s] == 0;
- case 2:
- return vertical [_state._pyraE][z + stepsForward][s] == 0;
- case 1:
- return horizontal[_state._pyraE][z][s + stepsForward] == 0;
- case 3:
- return horizontal[_state._pyraE][z][s + 1 - stepsForward] == 0;
- }
- return 0;
-}
-
-bool GameManager::move(Action verb, Object &obj) {
- if (verb == ACTION_WALK && obj._id == CORRIDOR) {
- switch (_state._pyraDirection) {
- case 0:
- _state._pyraZ--;
- break;
- case 1:
- _state._pyraS++;
- break;
- case 2:
- _state._pyraZ++;
- break;
- case 3:
- _state._pyraS--;
- break;
- }
- } else if (verb == ACTION_WALK && obj._id == G_RIGHT) {
- _state._pyraDirection++;
- _state._pyraDirection &= 3;
- } else if (verb == ACTION_WALK && obj._id == G_LEFT) {
- _state._pyraDirection--;
- _state._pyraDirection &= 3;
- } else
- return false;
- return true;
-}
-
-void GameManager::compass() {
- static StringId dirs[7] = {
- kStringDirection1,
- kStringDirection2,
- kStringDirection3,
- kStringDirection4,
- kStringDirection1,
- kStringDirection2,
- kStringDirection3
- };
- _vm->renderBox(281, 161, 39, 39, kColorWhite63);
- _vm->renderBox(295, 180, 13, 3, kColorWhite44);
- _vm->renderBox(300, 175, 3, 13, kColorWhite44);
- _vm->renderText(dirs[_state._pyraDirection ], 299, 163, kColorBlack);
- _vm->renderText(dirs[_state._pyraDirection + 1], 312, 179, kColorBlack);
- _vm->renderText(dirs[_state._pyraDirection + 2], 299, 191, kColorBlack);
- _vm->renderText(dirs[_state._pyraDirection + 3], 283, 179, kColorBlack);
-}
-
-void GameManager::puzzleConstruction() {
- _vm->setCurrentImage(12);
- MS2Image *image = _vm->_screen->getCurrentImage();
- for (int i = 0; i < 16; i ++) {
- _puzzleField[i] = 255;
- }
- for (int i = 0; i < 15; i++) {
- image->_section[i + 1].x1 = 95 + (_state._puzzleTab[i] % 4) * 33;
- image->_section[i + 1].x2 = image->_section[i + 1].x1 + 31;
- image->_section[i + 1].y1 = 24 + (_state._puzzleTab[i] / 4) * 25;
- image->_section[i + 1].y2 = image->_section[i + 1].y1 + 23;
-
- _puzzleField[_state._puzzleTab[i]] = i;
- }
-}
-
-void GameManager::alarm() {
- _vm->_sound->playSiren();
- _state._sirenOn = true;
- if (_vm->_screen->isMessageShown())
- _vm->removeMessage();
- _vm->renderMessage(kStringMuseum7);
- _state._eventTime = g_system->getMillis() + 16200;
- _state._eventCallback = kCaughtFn;
- _state._alarmOn = true;
-}
-
-void GameManager::caught() {
- if (_vm->_screen->isMessageShown())
- _vm->removeMessage();
- if (_currentRoom < _rooms[MUS1]) {
- } else if (_currentRoom <= _rooms[MUS2]) {
- _vm->renderImage( 8);
- _vm->renderImage(18);
- } else if (_currentRoom == _rooms[MUS3]) {
- _vm->renderImage(12);
- _vm->renderImage(30);
- } else if (_currentRoom == _rooms[MUS4]) {
- _vm->renderImage( 8);
- _vm->renderImage(18);
- } else if (_currentRoom == _rooms[MUS5]) {
- _vm->renderImage( 9);
- _vm->renderImage(29);
- } else if (_currentRoom <= _rooms[MUS7]) {
- _vm->renderImage( 7);
- _vm->renderImage(17);
- } else if (_currentRoom <= _rooms[MUS9]) {
- _vm->renderImage( 1);
- _vm->renderImage( 7);
- } else if (_currentRoom <= _rooms[MUS11]) {
- _vm->renderImage( 2);
- _vm->renderImage( 8);
- }
- caught2();
-}
-
-void GameManager::caught2() {
- _vm->renderMessage(kStringMuseum8);
- _vm->playSound(kAudioCaught);
- waitOnInput(_messageDuration);
- _vm->removeMessage();
- _state._sirenOn = false;
- _mapOn = false;
- _state._haste = false;
- dead(kStringMuseum9);
-}
-
-void GameManager::drawClock() {
- int time = (g_system->getMillis() - _state._startTime) / 600;
- int second = time % 100;
- Room *r;
- if (!_mapOn) {
- _vm->renderBox(281, 161, 39, 39, kColorWhite25);
- char s[9] = "00";
- s[1] = time % 10 + 48;
- time /= 10;
- s[0] = time % 10 + 48;
- time /= 10;
- _vm->renderText(s, 293, 180, kColorWhite99);
- strcpy(s, " 0:00");
- s[4] = time % 10 + 48;
- time /= 10;
- s[3] = time % 10 + 48;
- time /= 10;
- s[1] = time % 10 + 48;
- time /= 10;
- if (time)
- s[0] = time % 10 + 48;
- _vm->renderText(s, 285, 170, kColorWhite99);
- }
- if ((r = _rooms[_securityTab[second / 10]]) == _currentRoom) {
- //arrow();
- _state._alarmCracked = false;
- caught();
- }
- for (int i = 0; i < 3; i++) {
- Object *o = r->getObject(i);
- if ((o->_id == DOOR || o->_id == ENCRYPTED_DOOR || o->_id == SMALL_DOOR) &&
- (o->_type & OPENED) && ! _state._alarmOn)
- alarm();
- }
- if (!_state._alarmOn && _currentRoom == _rooms[MUS4] &&
- second >= 21 && second <= 40)
- alarm();
- if (_currentRoom == _rooms[MUS_ENTRANCE] && second >= 22 && second <= 29) {
- if (!_steps && !_state._alarmCracked) {
- _steps = true;
- _vm->renderMessage(kStringMuseum6);
- }
- } else _steps = false;
-}
-
-void GameManager::crack(int time) {
- _alarmBefore = _state._alarmOn;
- _cracking = true;
- _vm->_screen->changeCursor(ResourceManager::kCursorWait);
- int t = 0;
- int z;
- int zv = 0;
- do {
- do {
- wait(1);
- } while ((z = (g_system->getMillis() - _state._startTime) / 600) == zv);
- zv = z;
- drawClock();
- t++;
- } while (t < time && _state._alarmOn == _alarmBefore);
- _cracking = false;
- _vm->_screen->changeCursor(ResourceManager::kCursorNormal);
- if (_state._alarmOn == _alarmBefore)
- _vm->removeMessage();
-}
-
-bool GameManager::crackDoor(int time) {
- _vm->renderMessage(kStringMuseum15);
- crack(time);
- if (_state._alarmOn != _alarmBefore) {
- waitOnInput(_messageDuration);
- _vm->removeMessage();
- _vm->renderMessage(kStringMuseum16);
- }
- return !_state._alarmOn;
-}
-
-void GameManager::museumDoorInteract(Action verb, Object &obj1, Object &obj2) {
- static struct {
- int _r1;
- int _o1;
- int _r2;
- int _o2;
- } doorTab[11] = {
- {MUS1, 0, MUS2, 0},
- {MUS2, 1, MUS3, 0},
- {MUS3, 1, MUS10, 0},
- {MUS10, 1, MUS11, 0},
- {MUS11, 1, MUS7, 1},
- {MUS7, 0, MUS6, 1},
- {MUS6, 0, MUS5, 1},
- {MUS5, 0, MUS4, 0},
- {MUS5, 2, MUS9, 1},
- {MUS9, 0, MUS8, 1},
- {MUS8, 0, MUS1, 1}
- };
- Room *r;
- if (verb == ACTION_OPEN && obj1._id == DOOR) {
- for (int i = 0; i < 11; i++) {
- if ((_currentRoom == _rooms[doorTab[i]._r1]) &&
- &obj1 == _currentRoom->getObject(doorTab[i]._o1)) {
- r = _rooms[doorTab[i]._r2];
- r->getObject(doorTab[i]._o2)->_type |= OPENED;
- r->setSectionVisible(r->getObject(doorTab[i]._o2)->_section, kShownTrue);
- } else if ((_currentRoom == _rooms[doorTab[i]._r2]) &&
- &obj1 == _currentRoom->getObject(doorTab[i]._o2)) {
- r = _rooms[doorTab[i]._r1];
- r->getObject(doorTab[i]._o1)->_type |= OPENED;
- r->setSectionVisible(r->getObject(doorTab[i]._o1)->_section, kShownTrue);
- }
- }
- } else if (verb == ACTION_CLOSE && obj1._id == DOOR) {
- for (int i = 0; i < 11; i++) {
- if ((_currentRoom == _rooms[doorTab[i]._r1]) &&
- &obj1 == _currentRoom->getObject(doorTab[i]._o1)) {
- r = _rooms[doorTab[i]._r2];
- r->getObject(doorTab[i]._o2)->_type &= ~OPENED;
- r->setSectionVisible(r->getObject(doorTab[i]._o2)->_section, kShownFalse);
- } else if ((_currentRoom == _rooms[doorTab[i]._r2]) &&
- &obj1 == _currentRoom->getObject(doorTab[i]._o2)) {
- r = _rooms[doorTab[i]._r1];
- r->getObject(doorTab[i]._o1)->_type &= ~OPENED;
- r->setSectionVisible(r->getObject(doorTab[i]._o1)->_section, kShownFalse);
- }
- }
- }
-}
-
-void GameManager::securityEntrance() {
- static struct {
- RoomId _r;
- int _a1;
- int _a2;
- } securityList[11] = {
- {MUS1 ,11,31},
- {MUS2 , 7,17},
- {MUS3 , 7,17},
- {MUS10, 1, 7},
- {MUS11, 1, 7},
- {MUS7 ,10,32},
- {MUS6 , 8,18},
- {MUS5 , 8,18},
- {MUS9 , 2, 8},
- {MUS8 , 2, 8},
- {MUS1 , 0, 0}
- };
-
- int time = (g_system->getMillis() - _state._startTime) / 600;
- int second = time % 100;
-
- if (_rooms[_securityTab[second / 10]] == _currentRoom) {
- int i;
- for (i = 0; _currentRoom != _rooms[securityList[i]._r]; i++) {}
- if (_lastRoom == _rooms[securityList[i + 1]._r]) {
- _vm->renderImage(securityList[i]._a1);
- _vm->renderImage(securityList[i]._a2);
- caught2();
- } else
- caught();
- }
-}
-
-void GameManager::pressureAlarmEntrance() {
- _state._pressureCounter = 0;
- securityEntrance();
-}
-
-void GameManager::pressureAlarmCount() {
- if (!(_state._alarmOn ||
- (_currentRoom == _rooms[MUS22] && _currentRoom->isSectionVisible(6)))) {
- _state._pressureCounter++;
- if ((_currentRoom >= _rooms[MUS12] && _state._pressureCounter > 8) ||
- _state._pressureCounter > 16)
- alarm();
- }
- setAnimationTimer(11);
-}
-
-}
-
diff --git a/engines/supernova2/state.h b/engines/supernova2/state.h
deleted file mode 100644
index 1a76a55587..0000000000
--- a/engines/supernova2/state.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/* 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 SUPERNOVA2_STATE_H
-#define SUPERNOVA2_STATE_H
-
-#include "common/events.h"
-#include "common/rect.h"
-#include "common/keyboard.h"
-#include "supernova2/rooms.h"
-#include "supernova2/sound.h"
-#include "supernova2/resman.h"
-
-namespace Supernova2 {
-
-struct ConstructionEntry {
- int _e;
- int _s;
- int _z;
- int _r;
- int _a;
-};
-
-const int32 kMaxTimerValue = 0x7FFFFFFF;
-
-enum EventFunction { kNoFn, kSoberFn, kPyramidEndFn, kCaughtFn};
-
-struct GameState {
- int16 _money;
- int32 _startTime;
- bool _addressKnown;
- Room *_previousRoom;
- bool _poleMagnet;
- char _admission;
- bool _tipsy;
- bool _dark;
- char _elevatorE;
- char _elevatorNumber;
- bool _toMuseum;
- EventFunction _eventCallback;
- uint32 _eventTime;
- int16 _pyraE;
- char _pyraS;
- char _pyraZ;
- int16 _pyraDirection;
- int16 _puzzleTab[15];
- bool _alarmCracked;
- bool _alarmOn;
- bool _haste;
- byte _pressureCounter;
- bool _sirenOn;
- byte _taxiPossibility;
-};
-
-class Inventory {
-public:
- Inventory(Object *nullObject, int &inventoryScroll)
- : _numObjects(0)
- , _nullObject(nullObject)
- , _inventoryScroll(inventoryScroll) {
- for (int i = 0; i < kMaxCarry; ++i)
- _inventory[i] = nullptr;
- }
-
- void add(Object &obj);
- void remove(Object &obj);
- void clear();
- Object *get(int index) const;
- Object *get(ObjectId id) const;
- int getSize() const { return _numObjects; }
-
-private:
- Object *_inventory[kMaxCarry];
- Object *_nullObject;
- int &_inventoryScroll;
- int _numObjects;
-};
-
-class GuiElement : public Common::Rect {
-public:
- GuiElement();
-
- void setSize(int x1, int y1, int x2, int y2);
- void setText(const char *text);
- void setTextPosition(int x, int y);
- void setColor(int bgColor, int textColor, int bgColorHighlighted, int textColorHightlighted);
- void setHighlight(bool isHighlighted);
-
- const char *getText() const {
- return _text;
- }
- int getBackgroundColor() const {
- return _bgColor;
- }
- int getTextColor() const {
- return _textColor;
- }
- const Common::Point &getTextPos() const {
- return _textPosition;
- }
- bool isHighlighted() const {
- return _isHighlighted;
- }
-
-private:
- Common::Point _textPosition;
- char _text[128];
- int _bgColor;
- int _textColor;
- int _bgColorNormal;
- int _bgColorHighlighted;
- int _textColorNormal;
- int _textColorHighlighted;
- bool _isHighlighted;
-};
-
-class GameManager {
-public:
- GameManager(Supernova2Engine *vm, Sound *sound);
- ~GameManager();
-
- void updateEvents();
- void processInput(Common::KeyState &state);
- void processInput();
- void executeRoom();
- bool serialize(Common::WriteStream *out);
- bool deserialize(Common::ReadStream *in, int version);
-
- static StringId guiCommands[];
- static StringId guiStatusCommands[];
- Supernova2Engine *_vm;
- Sound *_sound;
- Common::KeyState _key;
- Common::EventType _mouseClickType;
- bool _mouseClicked;
- bool _keyPressed;
- int _mouseX;
- int _mouseY;
- int _mouseField;
- Room *_currentRoom;
- Room *_lastRoom;
- bool _newRoom;
- Room *_rooms[NUMROOMS];
- Inventory _inventory;
- GameState _state;
- bool _processInput;
- bool _guiEnabled;
- bool _animationEnabled;
- byte _roomBrightness;
- Action _inputVerb;
- Object _nullObject;
- Object *_currentInputObject;
- Object *_inputObject[2];
- int32 _oldTime;
- uint _timePaused;
- bool _timerPaused;
- int32 _messageDuration;
- int32 _animationTimer;
- int _inventoryScroll;
- int _exitList[25];
- GuiElement _guiCommandButton[10];
- GuiElement _guiInventory[8];
- GuiElement _guiInventoryArrow[2];
- // Dialog
- int _currentSentence;
- int _sentenceNumber[6];
- StringId _texts[6];
- byte _rows[6];
- byte _rowsStart[6];
- byte _dials[6];
-
- //state
- unsigned char _puzzleField[16];
- bool _mapOn;
- bool _steps;
- bool _cracking;
- bool _alarmBefore;
- RoomId _securityTab[10];
- int _restTime;
-
- void takeObject(Object &obj);
- void setObjectNull(Object *&obj);
- bool isNullObject(Object *obj);
-
- void initState();
- void initRooms();
- void destroyRooms();
- void initGui();
- bool genericInteract(Action verb, Object &obj1, Object &obj2);
- uint16 getKeyInput(bool blockForPrintChar = false);
- void getInput();
- void wait(int ticks);
- void waitOnInput(int ticks);
- bool waitOnInput(int ticks, Common::KeyCode &keycode);
- void screenShake();
- void roomBrightness() {}
- void showMenu();
- void animationOff();
- void animationOn();
- void edit(Common::String &input, int x, int y, uint length);
- int invertSection(int section);
- void drawMapExits();
- void drawStatus();
- void drawCommandBox();
- void drawInventory();
- void changeRoom(RoomId id);
- void resetInputState();
- void handleInput();
- void handleTime();
- void pauseTimer(bool pause);
- void loadTime() {}
- void saveTime() {}
- void setAnimationTimer(int ticks);
- void dead(StringId messageId);
- int dialog(int num, byte rowLength[6], StringId text[6], int number);
- void sentence(int number, bool brightness);
- void say(StringId textId);
- void say(const char *text);
- void reply(StringId textId, int aus1, int aus2);
- void reply(const char *text, int aus1, int aus2);
- void mousePosDialog(int x, int y);
- void takeMoney(int amount);
- void taxi();
- void leaveTaxi();
- void taxiUnknownDestination();
- void taxiPayment(int price, int destination);
- void playerTakeOut();
- void sober();
- void playCD();
- void drawGUI();
- bool talk(int mod1, int mod2, int rest, MessagePosition pos, StringId id);
- bool talkRest(int mod1, int mod2, int rest);
- void pyramidEnd();
- void passageConstruction();
- byte wall(int s, int z, int direction, int stepsForward, int stepsRight);
- bool move(Action verb, Object &obj);
- void compass();
- void puzzleConstruction();
- void drawClock();
- void caught();
- void caught2();
- void alarm();
- void crack(int time);
- bool crackDoor(int time);
- void museumDoorInteract(Action verb, Object &obj1, Object &obj2);
- void securityEntrance();
- void pressureAlarmCount();
- void pressureAlarmEntrance();
-
-private:
- int _prevImgId;
-};
-
-}
-
-#endif // SUPERNOVA2_STATE_H
diff --git a/engines/supernova2/supernova2.cpp b/engines/supernova2/supernova2.cpp
deleted file mode 100644
index 6023d4d5f3..0000000000
--- a/engines/supernova2/supernova2.cpp
+++ /dev/null
@@ -1,647 +0,0 @@
-/* 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/config-manager.h"
-#include "common/debug.h"
-#include "common/debug-channels.h"
-#include "common/endian.h"
-#include "common/error.h"
-#include "common/events.h"
-#include "common/file.h"
-#include "common/fs.h"
-#include "common/memstream.h"
-#include "common/savefile.h"
-#include "common/str.h"
-#include "common/system.h"
-#include "common/translation.h"
-#include "engines/util.h"
-#include "graphics/cursorman.h"
-#include "graphics/surface.h"
-#include "graphics/screen.h"
-#include "graphics/palette.h"
-#include "graphics/thumbnail.h"
-#include "gui/saveload.h"
-
-#include "supernova2/resman.h"
-#include "supernova2/screen.h"
-#include "supernova2/sound.h"
-#include "supernova2/supernova2.h"
-#include "supernova2/state.h"
-
-namespace Supernova2 {
-
-ObjectType operator|(ObjectType a, ObjectType b) {
- return static_cast<ObjectType>(+a | +b);
-}
-
-ObjectType operator&(ObjectType a, ObjectType b) {
- return static_cast<ObjectType>(+a & +b);
-}
-
-ObjectType operator^(ObjectType a, ObjectType b) {
- return static_cast<ObjectType>(+a ^ +b);
-}
-
-ObjectType &operator|=(ObjectType &a, ObjectType b) {
- return a = a | b;
-}
-
-ObjectType &operator&=(ObjectType &a, ObjectType b) {
- return a = a & b;
-}
-
-ObjectType &operator^=(ObjectType &a, ObjectType b) {
- return a = a ^ b;
-}
-
-Supernova2Engine::Supernova2Engine(OSystem *syst)
- : Engine(syst)
- , _console(nullptr)
- , _gm(nullptr)
- , _sound(nullptr)
- , _resMan(nullptr)
- , _screen(nullptr)
- , _allowLoadGame(true)
- , _allowSaveGame(true)
- , _sleepAutoSave(nullptr)
- , _sleepAuoSaveVersion(-1)
- , _delay(33)
- , _textSpeed(kTextSpeed[2]) {
- if (ConfMan.hasKey("textspeed"))
- _textSpeed = ConfMan.getInt("textspeed");
-
- DebugMan.addDebugChannel(kDebugGeneral , "general", "Supernova 2 general debug channel");
-}
-
-Supernova2Engine::~Supernova2Engine() {
- DebugMan.clearAllDebugChannels();
-
- delete _sleepAutoSave;
- delete _console;
- delete _gm;
- delete _sound;
- delete _resMan;
- delete _screen;
-}
-
-Common::Error Supernova2Engine::run() {
- init();
-
- while (!shouldQuit()) {
- uint32 start = _system->getMillis();
- _gm->updateEvents();
- _gm->executeRoom();
- _console->onFrame();
- _system->updateScreen();
- int end = _delay - (_system->getMillis() - start);
- if (end > 0)
- _system->delayMillis(end);
- }
-
- _mixer->stopAll();
-
- return Common::kNoError;
-}
-
-void Supernova2Engine::init() {
- Graphics::ModeList modes;
- modes.push_back(Graphics::Mode(320, 200));
- modes.push_back(Graphics::Mode(640, 480));
- initGraphicsModes(modes);
- initGraphics(320, 200);
-
- Common::Error status = loadGameStrings();
- if (status.getCode() != Common::kNoError)
- error("Failed reading game strings");
-
- _resMan = new ResourceManager();
- _sound = new Sound(_mixer, _resMan);
- _gm = new GameManager(this, _sound);
- _screen = new Screen(this, _resMan);
- _console = new Console(this, _gm);
-
- setTotalPlayTime(0);
-
- int saveSlot = ConfMan.getInt("save_slot");
- if (saveSlot >= 0) {
- if (loadGameState(saveSlot).getCode() != Common::kNoError)
- error("Failed to load save game from slot %i", saveSlot);
- }
-}
-
-bool Supernova2Engine::hasFeature(EngineFeature f) const {
- switch (f) {
- case kSupportsRTL:
- return true;
- case kSupportsLoadingDuringRuntime:
- return true;
- case kSupportsSavingDuringRuntime:
- return true;
- default:
- return false;
- }
-}
-
-void Supernova2Engine::pauseEngineIntern(bool pause) {
- _mixer->pauseAll(pause);
- _gm->pauseTimer(pause);
-}
-
-Common::Error Supernova2Engine::loadGameStrings() {
- Common::String cur_lang = ConfMan.get("language");
- Common::String string_id("TEXT");
-
- // Note: we don't print any warning or errors here if we cannot find the file
- // or the format is not as expected. We will get those warning when reading the
- // strings anyway (actually the engine will even refuse to start).
- Common::File f;
- if (!f.open(SUPERNOVA2_DAT)) {
- GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file."), SUPERNOVA2_DAT);
- return Common::kReadingFailed;
- }
-
- // Validate the data file header
- char id[5], lang[5];
- id[4] = lang[4] = '\0';
- f.read(id, 3);
- if (strncmp(id, "MS2", 3) != 0) {
- GUIErrorMessageFormat(_("The '%s' engine data file is corrupt."), SUPERNOVA2_DAT);
- return Common::kReadingFailed;
- }
-
- int version = f.readByte();
- if (version != SUPERNOVA2_DAT_VERSION) {
- GUIErrorMessageFormat(
- _("Incorrect version of the '%s' engine data file found. Expected %d but got %d."),
- SUPERNOVA2_DAT, SUPERNOVA2_DAT_VERSION, version);
- return Common::kReadingFailed;
- }
-
- while (!f.eos()) {
- f.read(id, 4);
- f.read(lang, 4);
- uint32 size = f.readUint32LE();
- if (f.eos())
- break;
- if (string_id == id && cur_lang == lang) {
- while (size > 0) {
- Common::String s;
- char ch;
- while ((ch = (char)f.readByte()) != '\0')
- s += ch;
- _gameStrings.push_back(s);
- size -= s.size() + 1;
- }
- return Common::kNoError;
- } else
- f.skip(size);
- }
-
- Common::Language l = Common::parseLanguage(cur_lang);
- GUIErrorMessageFormat(_("Unable to locate the text for %s language in '%s' engine data file."), Common::getLanguageDescription(l), SUPERNOVA2_DAT);
- return Common::kReadingFailed;
-}
-
-const Common::String &Supernova2Engine::getGameString(int idx) const {
- if (idx < 0 || idx >= (int)_gameStrings.size())
- return _nullString;
- return _gameStrings[idx];
-}
-
-void Supernova2Engine::setGameString(int idx, const Common::String &string) {
- if (idx < 0)
- return;
- while ((int)_gameStrings.size() <= idx)
- _gameStrings.push_back(Common::String());
- _gameStrings[idx] = string;
-}
-
-void Supernova2Engine::playSound(AudioId sample) {
- if (!shouldQuit())
- _sound->play(sample);
-}
-
-void Supernova2Engine::playSound(MusicId index) {
- if (!shouldQuit())
- _sound->play(index);
-}
-
-void Supernova2Engine::renderImage(int section) {
- if (section > 128)
- _gm->_currentRoom->setSectionVisible(section - 128, false);
- else
- _gm->_currentRoom->setSectionVisible(section, true);
-
- _screen->renderImage(section);
-}
-
-void Supernova2Engine::renderImage(ImageId id, bool removeImage) {
- _gm->_currentRoom->setSectionVisible(_screen->getImageInfo(id)->section, !removeImage);
- _screen->renderImage(id, removeImage);
-}
-
-bool Supernova2Engine::setCurrentImage(int filenumber) {
- return _screen->setCurrentImage(filenumber);
-}
-
-void Supernova2Engine::saveScreen(int x, int y, int width, int height) {
- _screen->saveScreen(x, y, width, height);
-}
-
-void Supernova2Engine::saveScreen(const GuiElement &guiElement) {
- _screen->saveScreen(guiElement);
-}
-
-void Supernova2Engine::restoreScreen() {
- _screen->restoreScreen();
-}
-
-void Supernova2Engine::renderRoom(Room &room) {
- _screen->renderRoom(room);
-}
-
-void Supernova2Engine::renderMessage(const char *text, MessagePosition position) {
- _gm->_messageDuration = (Common::strnlen(text, 512) + 20) * _textSpeed / 10;
- _screen->renderMessage(text, position);
-}
-
-void Supernova2Engine::renderMessage(const Common::String &text, MessagePosition position) {
- _gm->_messageDuration = (text.size() + 20) * _textSpeed / 10;
- _screen->renderMessage(text, position);
-}
-
-void Supernova2Engine::renderMessage(StringId stringId, MessagePosition position, Common::String var1, Common::String var2) {
- _gm->_messageDuration = (getGameString(stringId).size() + 20) * _textSpeed / 10;
- _screen->renderMessage(stringId, position, var1, var2);
-}
-
-void Supernova2Engine::renderMessage(StringId stringId, int x, int y) {
- _gm->_messageDuration = (getGameString(stringId).size() + 20) * _textSpeed / 10;
- _screen->renderMessage(getGameString(stringId).c_str(), kMessageNormal, x, y);
-}
-
-void Supernova2Engine::removeMessage() {
- _screen->removeMessage();
-}
-
-void Supernova2Engine::renderText(const uint16 character) {
- _screen->renderText(character);
-}
-
-void Supernova2Engine::renderText(const char *text) {
- _screen->renderText(text);
-}
-
-void Supernova2Engine::renderText(const Common::String &text) {
- _screen->renderText(text);
-}
-
-void Supernova2Engine::renderText(StringId stringId) {
- _screen->renderText(stringId);
-}
-
-void Supernova2Engine::renderText(const GuiElement &guiElement) {
- _screen->renderText(guiElement);
-}
-
-void Supernova2Engine::renderText(const uint16 character, int x, int y, byte color) {
- _screen->renderText(character, x, y, color);
-}
-
-void Supernova2Engine::renderText(const char *text, int x, int y, byte color) {
- _screen->renderText(text, x, y, color);
-}
-
-void Supernova2Engine::renderText(const Common::String &text, int x, int y, byte color) {
- _screen->renderText(text, x, y, color);
-}
-
-void Supernova2Engine::renderText(StringId stringId, int x, int y, byte color) {
- _screen->renderText(stringId, x, y, color);
-}
-
-void Supernova2Engine::renderBox(int x, int y, int width, int height, byte color) {
- _screen->renderBox(x, y, width, height, color);
-}
-
-void Supernova2Engine::renderBox(const GuiElement &guiElement) {
- _screen->renderBox(guiElement);
-}
-
-void Supernova2Engine::paletteBrightness() {
- _screen->paletteBrightness();
-}
-
-void Supernova2Engine::paletteFadeOut(int minBrightness) {
- if (!shouldQuit())
- _screen->paletteFadeOut(minBrightness);
-}
-
-void Supernova2Engine::paletteFadeIn() {
- if (!shouldQuit()) {
- _gm->roomBrightness();
- _screen->paletteFadeIn(_gm->_roomBrightness);
- }
-}
-
-void Supernova2Engine::setColor63(byte value) {
- _screen->setColor63(value);
-}
-
-void Supernova2Engine::setTextSpeed() {
- const Common::String &textSpeedString = getGameString(kStringTextSpeed);
- int stringWidth = Screen::textWidth(textSpeedString);
- int textX = (kScreenWidth - stringWidth) / 2;
- int textY = 100;
- stringWidth += 4;
- int boxX = stringWidth > 110 ? (kScreenWidth - stringWidth) / 2 : 105;
- int boxY = 97;
- int boxWidth = stringWidth > 110 ? stringWidth : 110;
- int boxHeight = 27;
-
- _gm->animationOff();
- _gm->saveTime();
- saveScreen(boxX, boxY, boxWidth, boxHeight);
-
- renderBox(boxX, boxY, boxWidth, boxHeight, kColorBlue);
- renderText(textSpeedString, textX, textY, kColorWhite99); // Text speed
-
- // Find the closest index in kTextSpeed for the current _textSpeed.
- // Important note: values in kTextSpeed decrease with the index.
- int speedIndex = 0;
- while (speedIndex < 4 && _textSpeed < (kTextSpeed[speedIndex] + kTextSpeed[speedIndex+1]) / 2)
- ++speedIndex;
-
- char nbString[2];
- nbString[1] = 0;
- for (int i = 0; i < 5; ++i) {
- byte color = i == speedIndex ? kColorWhite63 : kColorWhite35;
- renderBox(110 + 21 * i, 111, 16, 10, color);
-
- nbString[0] = '1' + i;
- renderText(nbString, 115 + 21 * i, 112, kColorWhite99);
- }
- do {
- _gm->getInput();
- int key = _gm->_keyPressed ? _gm->_key.keycode : Common::KEYCODE_INVALID;
- if (!_gm->_keyPressed && _gm->_mouseClicked && _gm->_mouseY >= 111 && _gm->_mouseY < 121 && (_gm->_mouseX + 16) % 21 < 16)
- key = Common::KEYCODE_0 - 5 + (_gm->_mouseX + 16) / 21;
- if (key == Common::KEYCODE_ESCAPE)
- break;
- else if (key >= Common::KEYCODE_1 && key <= Common::KEYCODE_5) {
- speedIndex = key - Common::KEYCODE_1;
- _textSpeed = kTextSpeed[speedIndex];
- ConfMan.setInt("textspeed", _textSpeed);
- break;
- }
- } while (!shouldQuit());
- _gm->resetInputState();
-
- restoreScreen();
- _gm->loadTime();
- _gm->animationOn();
-}
-
-bool Supernova2Engine::quitGameDialog() {
- bool quit = false;
-
- GuiElement guiQuitBox;
- guiQuitBox.setColor(kColorRed, kColorWhite99, kColorRed, kColorWhite99);
- guiQuitBox.setSize(112, 97, 112 + 96, 97 + 27);
- guiQuitBox.setText(getGameString(kStringLeaveGame).c_str());
- guiQuitBox.setTextPosition(guiQuitBox.left + 3, guiQuitBox.top + 3);
- GuiElement guiQuitYes;
- guiQuitYes.setColor(kColorWhite35, kColorWhite99, kColorWhite35, kColorWhite99);
- guiQuitYes.setSize(115, 111, 158, 121);
- guiQuitYes.setText(getGameString(kStringYes).c_str());
- guiQuitYes.setTextPosition(132, 112);
- GuiElement guiQuitNo;
- guiQuitNo.setColor(kColorWhite35, kColorWhite99, kColorWhite35, kColorWhite99);
- guiQuitNo.setSize(162, 111, 205, 121);
- guiQuitNo.setText(getGameString(kStringNo).c_str());
- guiQuitNo.setTextPosition(173, 112);
-
- _gm->animationOff();
- saveScreen(guiQuitBox);
-
- renderBox(guiQuitBox);
- renderText(guiQuitBox);
- renderBox(guiQuitYes);
- renderText(guiQuitYes);
- renderBox(guiQuitNo);
- renderText(guiQuitNo);
-
- do {
- _gm->getInput();
- if (_gm->_keyPressed) {
- if (_gm->_key.keycode == Common::KEYCODE_j) {
- quit = true;
- break;
- } else if (_gm->_key.keycode == Common::KEYCODE_n) {
- quit = false;
- break;
- }
- }
- if (_gm->_mouseClicked) {
- if (guiQuitYes.contains(_gm->_mouseX, _gm->_mouseY)) {
- quit = true;
- break;
- } else if (guiQuitNo.contains(_gm->_mouseX, _gm->_mouseY)) {
- quit = false;
- break;
- }
- }
- } while (true);
-
- _gm->resetInputState();
- restoreScreen();
- _gm->animationOn();
-
- return quit;
-}
-
-bool Supernova2Engine::canLoadGameStateCurrently() {
- return _allowLoadGame;
-}
-
-Common::Error Supernova2Engine::loadGameState(int slot) {
- return (loadGame(slot) ? Common::kNoError : Common::kReadingFailed);
-}
-
-bool Supernova2Engine::canSaveGameStateCurrently() {
- // Do not allow saving when either _allowSaveGame, _animationEnabled or _guiEnabled is false or if _haste is true
- return _allowSaveGame && _gm->_animationEnabled && _gm->_guiEnabled &&
- !_gm->_state._haste;
-}
-
-Common::Error Supernova2Engine::saveGameState(int slot, const Common::String &desc) {
- return (saveGame(slot, desc) ? Common::kNoError : Common::kWritingFailed);
-}
-
-bool Supernova2Engine::serialize(Common::WriteStream *out) {
- if (!_gm->serialize(out))
- return false;
- out->writeByte(_screen->getGuiBrightness());
- out->writeByte(_screen->getViewportBrightness());
- return true;
-}
-
-bool Supernova2Engine::deserialize(Common::ReadStream *in, int version) {
- if (!_gm->deserialize(in, version))
- return false;
- if (version >= 5) {
- _screen->setGuiBrightness(in->readByte());
- _screen->setViewportBrightness(in->readByte());
- } else {
- _screen->setGuiBrightness(255);
- _screen->setViewportBrightness(255);
- }
- return true;
-}
-
-bool Supernova2Engine::loadGame(int slot) {
- stopSound();
- if (slot < 0)
- return false;
-
- // Make sure no message is displayed as this would otherwise delay the
- // switch to the new location until a mouse click.
- removeMessage();
-
- if (slot == kSleepAutosaveSlot) {
- if (_sleepAutoSave != nullptr && deserialize(_sleepAutoSave, _sleepAuoSaveVersion)) {
- // We no longer need the sleep autosave
- delete _sleepAutoSave;
- _sleepAutoSave = nullptr;
- return true;
- }
- // Old version used to save it literally in the kSleepAutosaveSlot, so
- // continue to try to load it from there.
- }
-
- Common::String filename = Common::String::format("ms2_save.%03d", slot);
- Common::InSaveFile *savefile = _saveFileMan->openForLoading(filename);
- if (!savefile)
- return false;
-
- uint saveHeader = savefile->readUint32LE();
- if (saveHeader != SAVEGAME_HEADER) {
- warning("No header found in '%s'", filename.c_str());
- delete savefile;
- return false; //Common::kUnknownError
- }
-
- byte saveVersion = savefile->readByte();
- if (saveVersion > SAVEGAME_VERSION) {
- warning("Save game version %i not supported", saveVersion);
- delete savefile;
- return false; //Common::kUnknownError;
- }
-
- int descriptionSize = savefile->readSint16LE();
- savefile->skip(descriptionSize);
- savefile->skip(6);
- setTotalPlayTime(savefile->readUint32LE() * 1000);
- Graphics::skipThumbnail(*savefile);
- if (!deserialize(savefile, saveVersion)) {
- delete savefile;
- return false;
- };
-
- // With version 9 onward the sleep auto-save is save at the end of a normal save.
- delete _sleepAutoSave;
- _sleepAutoSave = nullptr;
- if (saveVersion >= 9) {
- _sleepAuoSaveVersion = saveVersion;
- byte hasAutoSave = savefile->readByte();
- if (hasAutoSave) {
- _sleepAutoSave = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
- uint nb;
- char buf[4096];
- while ((nb = savefile->read(buf, 4096)) > 0)
- _sleepAutoSave->write(buf, nb);
- }
- }
-
- delete savefile;
-
- return true;
-}
-
-bool Supernova2Engine::saveGame(int slot, const Common::String &description) {
- if (slot < 0)
- return false;
-
- if (slot == kSleepAutosaveSlot) {
- delete _sleepAutoSave;
- _sleepAutoSave = new Common::MemoryReadWriteStream(DisposeAfterUse::YES);
- _sleepAuoSaveVersion = SAVEGAME_VERSION;
- serialize(_sleepAutoSave);
- return true;
- }
-
- Common::String filename = Common::String::format("ms2_save.%03d", slot);
- Common::OutSaveFile *savefile = _saveFileMan->openForSaving(filename);
- if (!savefile)
- return false;
-
- savefile->writeUint32LE(SAVEGAME_HEADER);
- savefile->writeByte(SAVEGAME_VERSION);
-
- TimeDate currentDate;
- _system->getTimeAndDate(currentDate);
- uint32 saveDate = (currentDate.tm_mday & 0xFF) << 24 | ((currentDate.tm_mon + 1) & 0xFF) << 16 | ((currentDate.tm_year + 1900) & 0xFFFF);
- uint16 saveTime = (currentDate.tm_hour & 0xFF) << 8 | ((currentDate.tm_min) & 0xFF);
-
- savefile->writeSint16LE(description.size() + 1);
- savefile->write(description.c_str(), description.size() + 1);
- savefile->writeUint32LE(saveDate);
- savefile->writeUint16LE(saveTime);
- savefile->writeUint32LE(getTotalPlayTime() / 1000);
- Graphics::saveThumbnail(*savefile);
- serialize(savefile);
-
- if (_sleepAutoSave == nullptr)
- savefile->writeByte(0);
- else {
- savefile->writeByte(1);
- savefile->write(_sleepAutoSave->getData(), _sleepAutoSave->size());
- }
-
- savefile->finalize();
- delete savefile;
-
- return true;
-}
-
-void Supernova2Engine::errorTempSave(bool saving) {
- GUIErrorMessage(saving
- ? "Failed to save temporary game state. Make sure your save game directory is set in ScummVM and that you can write to it."
- : "Failed to load temporary game state.");
- error("Unrecoverable error");
-}
-
-void Supernova2Engine::stopSound() {
- _sound->stop();
-}
-
-}
diff --git a/engines/supernova2/supernova2.h b/engines/supernova2/supernova2.h
deleted file mode 100644
index 071955f47f..0000000000
--- a/engines/supernova2/supernova2.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* 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 SUPERNOVA_SUPERNOVA2_H
-#define SUPERNOVA_SUPERNOVA2_H
-
-#include "common/array.h"
-#include "common/events.h"
-#include "common/random.h"
-#include "common/scummsys.h"
-#include "engines/engine.h"
-#include "common/file.h"
-
-#include "supernova2/console.h"
-#include "supernova2/graphics.h"
-#include "supernova2/ms2_def.h"
-#include "supernova2/rooms.h"
-#include "supernova2/sound.h"
-#include "supernova2/imageid.h"
-
-namespace Common {
- class MemoryReadWriteStream;
-}
-
-namespace Supernova2 {
-
-#define SAVEGAME_HEADER MKTAG('M','S','N','2')
-#define SAVEGAME_VERSION 9
-
-#define SUPERNOVA2_DAT "supernova2.dat"
-#define SUPERNOVA2_DAT_VERSION 1
-
-class GuiElement;
-class ResourceManager;
-class Sound;
-class console;
-class GameManager;
-class Screen;
-
-class Supernova2Engine : public Engine {
-public:
- explicit Supernova2Engine(OSystem *syst);
- ~Supernova2Engine();
-
- virtual Common::Error run();
- virtual Common::Error loadGameState(int slot);
- virtual bool canLoadGameStateCurrently();
- virtual Common::Error saveGameState(int slot, const Common::String &desc);
- virtual bool canSaveGameStateCurrently();
- virtual bool hasFeature(EngineFeature f) const;
- virtual void pauseEngineIntern(bool pause);
-
- GameManager *_gm;
- Console *_console;
- Sound *_sound;
- ResourceManager *_resMan;
- Screen *_screen;
- bool _allowLoadGame;
- bool _allowSaveGame;
- Common::StringArray _gameStrings;
- Common::String _nullString;
- int _sleepAuoSaveVersion;
- Common::MemoryReadWriteStream* _sleepAutoSave;
-
- uint _delay;
- int _textSpeed;
-
- Common::Error loadGameStrings();
- void init();
- bool loadGame(int slot);
- bool saveGame(int slot, const Common::String &description);
- bool serialize(Common::WriteStream *out);
- bool deserialize(Common::ReadStream *in, int version);
- bool quitGameDialog();
- void errorTempSave(bool saving);
- void setTextSpeed();
- const Common::String &getGameString(int idx) const;
- void setGameString(int idx, const Common::String &string);
-
- // forwarding calls
- void playSound(AudioId sample);
- void playSound(MusicId index);
- void paletteFadeIn();
- void paletteFadeOut(int minBrightness = 0);
- void paletteBrightness();
- void renderImage(int section);
- void renderImage(ImageId id, bool removeImage = false);
- bool setCurrentImage(int filenumber);
- void saveScreen(int x, int y, int width, int height);
- void saveScreen(const GuiElement &guiElement);
- void restoreScreen();
- void renderRoom(Room &room);
- void renderMessage(const char *text, MessagePosition position = kMessageNormal);
- void renderMessage(const Common::String &text, MessagePosition position = kMessageNormal);
- void renderMessage(StringId stringId, MessagePosition position = kMessageNormal,
- Common::String var1 = "", Common::String var2 = "");
- void renderMessage(StringId stringId, int x, int y);
- void removeMessage();
- void renderText(const uint16 character);
- void renderText(const char *text);
- void renderText(const Common::String &text);
- void renderText(StringId stringId);
- void renderText(const uint16 character, int x, int y, byte color);
- void renderText(const char *text, int x, int y, byte color);
- void renderText(const Common::String &text, int x, int y, byte color);
- void renderText(StringId stringId, int x, int y, byte color);
- void renderText(const GuiElement &guiElement);
- void renderBox(int x, int y, int width, int height, byte color);
- void renderBox(const GuiElement &guiElement);
- void setColor63(byte value);
- void stopSound();
-};
-
-}
-
-#endif