2012-10-06 16:26:16 +02:00
|
|
|
/* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-02-19 02:17:41 +02:00
|
|
|
#include "engines/nancy/state/logo.h"
|
|
|
|
#include "engines/nancy/state/scene.h"
|
2021-03-07 12:58:55 +02:00
|
|
|
#include "engines/nancy/state/help.h"
|
|
|
|
#include "engines/nancy/state/map.h"
|
2021-03-08 16:43:02 +02:00
|
|
|
#include "engines/nancy/state/credits.h"
|
2021-02-19 02:17:41 +02:00
|
|
|
|
2021-01-04 23:16:23 +02:00
|
|
|
#include "engines/nancy/nancy.h"
|
|
|
|
#include "engines/nancy/resource.h"
|
|
|
|
#include "engines/nancy/iff.h"
|
2021-02-20 20:22:13 +02:00
|
|
|
#include "engines/nancy/sound.h"
|
2021-01-07 22:41:11 +02:00
|
|
|
#include "engines/nancy/input.h"
|
2021-02-20 20:22:13 +02:00
|
|
|
#include "engines/nancy/sound.h"
|
2021-02-19 02:17:41 +02:00
|
|
|
#include "engines/nancy/graphics.h"
|
|
|
|
#include "engines/nancy/cursor.h"
|
2021-03-06 12:23:15 +02:00
|
|
|
#include "engines/nancy/cheat.h"
|
2021-01-04 23:16:23 +02:00
|
|
|
|
2012-10-06 16:26:16 +02:00
|
|
|
#include "common/system.h"
|
|
|
|
#include "common/random.h"
|
|
|
|
#include "common/error.h"
|
|
|
|
#include "common/events.h"
|
|
|
|
#include "common/debug-channels.h"
|
|
|
|
#include "common/config-manager.h"
|
|
|
|
#include "common/textconsole.h"
|
2012-10-22 13:12:42 +02:00
|
|
|
#include "common/memstream.h"
|
2015-06-12 14:45:59 +02:00
|
|
|
#include "common/installshield_cab.h"
|
2021-01-04 23:16:23 +02:00
|
|
|
#include "common/str.h"
|
2012-10-06 16:26:16 +02:00
|
|
|
|
2015-06-12 14:47:23 +02:00
|
|
|
#include "graphics/surface.h"
|
|
|
|
|
2015-06-16 15:32:57 +02:00
|
|
|
#include "audio/mixer.h"
|
|
|
|
#include "audio/audiostream.h"
|
|
|
|
|
2012-10-06 16:26:16 +02:00
|
|
|
#include "engines/util.h"
|
|
|
|
|
|
|
|
namespace Nancy {
|
|
|
|
|
2021-01-04 23:16:23 +02:00
|
|
|
NancyEngine *NancyEngine::s_Engine = nullptr;
|
2012-10-06 16:26:16 +02:00
|
|
|
|
2021-03-08 01:01:27 +02:00
|
|
|
NancyEngine::NancyEngine(OSystem *syst, const NancyGameDescription *gd) : Engine(syst), _gameDescription(gd), _system(syst) {
|
2012-10-06 16:26:16 +02:00
|
|
|
DebugMan.addDebugChannel(kDebugEngine, "Engine", "Engine debug level");
|
2021-03-02 01:48:02 +02:00
|
|
|
DebugMan.addDebugChannel(kDebugActionRecord, "ActionRecord", "Action Record debug level");
|
|
|
|
DebugMan.addDebugChannel(kDebugScene, "Scene", "Scene debug level");
|
2012-10-06 16:26:16 +02:00
|
|
|
|
|
|
|
_console = new NancyConsole(this);
|
2021-02-07 02:50:45 +02:00
|
|
|
_rnd = new Common::RandomSource("Nancy");
|
|
|
|
_rnd->setSeed(_rnd->getSeed());
|
2021-01-04 23:16:23 +02:00
|
|
|
|
2021-02-19 02:17:41 +02:00
|
|
|
logo = new State::Logo(this);
|
|
|
|
scene = new State::Scene(this);
|
|
|
|
map = new State::Map(this);
|
2021-03-08 16:43:02 +02:00
|
|
|
credits = new State::Credits(this);
|
2021-03-07 12:58:55 +02:00
|
|
|
help = new State::Help(this);
|
2021-01-07 22:41:11 +02:00
|
|
|
input = new InputManager(this);
|
2021-01-23 17:21:56 +02:00
|
|
|
sound = new SoundManager(this);
|
2021-02-19 02:17:41 +02:00
|
|
|
graphicsManager = new GraphicsManager(this);
|
|
|
|
cursorManager = new CursorManager(this);
|
2021-01-07 22:41:11 +02:00
|
|
|
|
|
|
|
launchConsole = false;
|
2012-10-06 16:26:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
NancyEngine::~NancyEngine() {
|
2021-01-04 23:16:23 +02:00
|
|
|
clearBootChunks();
|
2012-10-06 16:26:16 +02:00
|
|
|
DebugMan.clearAllDebugChannels();
|
|
|
|
delete _console;
|
|
|
|
delete _rnd;
|
2021-01-04 23:16:23 +02:00
|
|
|
|
2021-02-19 02:17:41 +02:00
|
|
|
delete scene;
|
2021-01-28 18:08:44 +02:00
|
|
|
delete map;
|
2021-02-19 02:17:41 +02:00
|
|
|
delete graphicsManager;
|
2021-01-07 22:41:11 +02:00
|
|
|
delete input;
|
2021-01-23 17:21:56 +02:00
|
|
|
delete sound;
|
2012-10-06 16:26:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
GUI::Debugger *NancyEngine::getDebugger() {
|
|
|
|
return _console;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NancyEngine::hasFeature(EngineFeature f) const {
|
2021-01-04 23:16:23 +02:00
|
|
|
return (f == kSupportsReturnToLauncher) || (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime);
|
2012-10-06 16:26:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *NancyEngine::getCopyrightString() const {
|
|
|
|
return "Copyright 1989-1997 David P Gray, All Rights Reserved.";
|
|
|
|
}
|
|
|
|
|
|
|
|
GameType NancyEngine::getGameType() const {
|
|
|
|
return _gameType;
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::Platform NancyEngine::getPlatform() const {
|
|
|
|
return _platform;
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::Error NancyEngine::run() {
|
|
|
|
s_Engine = this;
|
2015-07-06 09:32:40 +02:00
|
|
|
|
2021-01-04 23:16:23 +02:00
|
|
|
initGraphics(640, 480, &GraphicsManager::pixelFormat);
|
2012-10-06 16:26:16 +02:00
|
|
|
_console = new NancyConsole(this);
|
|
|
|
|
2015-06-12 14:45:59 +02:00
|
|
|
const Common::FSNode gameDataDir(ConfMan.get("path"));
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "game");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "datafiles");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "hdsound");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "cdsound");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "hdvideo");
|
|
|
|
SearchMan.addSubDirectoryMatching(gameDataDir, "cdvideo");
|
2021-03-06 12:23:15 +02:00
|
|
|
|
2021-01-04 23:16:23 +02:00
|
|
|
Common::SeekableReadStream *stream = SearchMan.createReadStreamForMember("data1.cab");
|
|
|
|
if (!stream)
|
|
|
|
error("Failed to open data1.cab");
|
|
|
|
|
|
|
|
Common::Archive *cab = Common::makeInstallShieldArchive(stream);
|
|
|
|
if (cab)
|
|
|
|
SearchMan.add("data1.hdr", cab);
|
2021-03-06 12:23:15 +02:00
|
|
|
|
2012-10-07 17:25:52 +02:00
|
|
|
_res = new ResourceManager(this);
|
|
|
|
_res->initialize();
|
2012-10-06 16:26:16 +02:00
|
|
|
|
|
|
|
// Setup mixer
|
|
|
|
syncSoundSettings();
|
|
|
|
|
2021-01-04 23:16:23 +02:00
|
|
|
_gameFlow.minGameState = kBoot;
|
2015-07-06 09:32:40 +02:00
|
|
|
|
2021-01-07 22:41:11 +02:00
|
|
|
while (!shouldQuit()) {
|
2021-02-19 02:17:41 +02:00
|
|
|
cursorManager->setCursorType(CursorManager::kNormalArrow);
|
2021-01-29 00:46:43 +02:00
|
|
|
input->processEvents();
|
2021-03-07 12:58:55 +02:00
|
|
|
|
2021-01-04 23:16:23 +02:00
|
|
|
switch (_gameFlow.minGameState) {
|
2021-03-08 01:01:27 +02:00
|
|
|
case kBoot:
|
|
|
|
bootGameEngine();
|
|
|
|
graphicsManager->init();
|
|
|
|
cursorManager->init();
|
|
|
|
setGameState(kLogo);
|
|
|
|
break;
|
|
|
|
case kLogo:
|
|
|
|
logo->process();
|
|
|
|
break;
|
2021-03-08 16:43:02 +02:00
|
|
|
case kCredits:
|
|
|
|
credits->process();
|
|
|
|
break;
|
2021-03-08 01:01:27 +02:00
|
|
|
case kMainMenu: {
|
|
|
|
GameState prevState = getPreviousGameState();
|
|
|
|
// TODO until the game's own menus are implemented we simply open the GMM
|
|
|
|
openMainMenuDialog();
|
|
|
|
setGameState(prevState);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case kHelp:
|
|
|
|
help->process();
|
|
|
|
break;
|
|
|
|
case kScene:
|
|
|
|
scene->process();
|
|
|
|
break;
|
|
|
|
case kMap:
|
|
|
|
map->process();
|
|
|
|
break;
|
|
|
|
case kCheat: {
|
|
|
|
if (_cheatTypeIsEventFlag) {
|
|
|
|
EventFlagDialog *dialog = new EventFlagDialog(this);
|
|
|
|
dialog->runModal();
|
|
|
|
delete dialog;
|
|
|
|
} else {
|
|
|
|
CheatDialog *dialog = new CheatDialog(this);
|
|
|
|
dialog->runModal();
|
|
|
|
delete dialog;
|
2021-03-07 12:58:55 +02:00
|
|
|
}
|
2021-03-08 01:01:27 +02:00
|
|
|
setGameState(getPreviousGameState());
|
|
|
|
input->forceCleanInput();
|
|
|
|
break;
|
|
|
|
}
|
2021-03-08 16:43:02 +02:00
|
|
|
case kNone:
|
2021-03-08 01:01:27 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2015-07-06 09:32:40 +02:00
|
|
|
}
|
|
|
|
|
2021-02-19 02:17:41 +02:00
|
|
|
graphicsManager->draw();
|
|
|
|
|
|
|
|
if (_gameFlow.justChanged) {
|
|
|
|
_gameFlow.justChanged = false;
|
|
|
|
} else {
|
|
|
|
_gameFlow.previousGameState = _gameFlow.minGameState;
|
|
|
|
}
|
2015-07-06 09:32:40 +02:00
|
|
|
|
2021-01-07 22:41:11 +02:00
|
|
|
if (launchConsole) {
|
|
|
|
_console->attach();
|
|
|
|
launchConsole = false;
|
|
|
|
}
|
2021-01-04 23:16:23 +02:00
|
|
|
_console->onFrame();
|
|
|
|
|
2012-10-07 17:25:52 +02:00
|
|
|
_system->updateScreen();
|
|
|
|
_system->delayMillis(16);
|
|
|
|
}
|
|
|
|
|
2012-10-06 16:26:16 +02:00
|
|
|
return Common::kNoError;
|
|
|
|
}
|
|
|
|
|
2021-01-04 23:16:23 +02:00
|
|
|
void NancyEngine::bootGameEngine() {
|
|
|
|
clearBootChunks();
|
|
|
|
IFF *boot = new IFF(this, "boot");
|
|
|
|
if (!boot->load())
|
|
|
|
error("Failed to load boot script");
|
|
|
|
preloadCals(*boot);
|
|
|
|
|
|
|
|
addBootChunk("BSUM", boot->getChunkStream("BSUM"));
|
|
|
|
readBootSummary(*boot);
|
|
|
|
|
|
|
|
Common::String names[] = {
|
|
|
|
"INTR", "HINT", "LOGO", "SPUZ", "INV",
|
|
|
|
"FONT", "MENU", "HELP", "CRED", "LOAD",
|
|
|
|
"MAP", "CD", "TBOX", "CURS", "VIEW", "MSND",
|
|
|
|
"BUOK", "BUDE", "BULS", "GLOB", "SLID",
|
|
|
|
"SET", "CURT", "CANT", "TH1", "TH2",
|
|
|
|
"QUOT", "TMOD"
|
|
|
|
};
|
|
|
|
|
|
|
|
for (auto const &n : names) {
|
|
|
|
addBootChunk(n, boot->getChunkStream(n));
|
|
|
|
}
|
|
|
|
|
|
|
|
// The FR, LG and OB chunks get added here
|
|
|
|
|
|
|
|
Common::SeekableReadStream *font = getBootChunkStream("FONT");
|
|
|
|
if (_fontSize != font->size()) {
|
|
|
|
error("Mismatch NumFonts and FONT memory... %i, %i", _fontSize, font->size());
|
|
|
|
}
|
2021-02-07 02:50:45 +02:00
|
|
|
|
2021-01-04 23:16:23 +02:00
|
|
|
// TODO reset some vars
|
|
|
|
// TODO reset some more vars
|
|
|
|
|
|
|
|
delete boot;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NancyEngine::addBootChunk(const Common::String &name, Common::SeekableReadStream *stream) {
|
|
|
|
if (!stream)
|
|
|
|
return false;
|
|
|
|
_bootChunks[name] = stream;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::SeekableReadStream *NancyEngine::getBootChunkStream(const Common::String &name) {
|
|
|
|
if (_bootChunks.contains(name)) {
|
|
|
|
return _bootChunks[name];
|
|
|
|
}
|
|
|
|
else return nullptr;
|
|
|
|
}
|
|
|
|
|
2021-02-20 20:22:13 +02:00
|
|
|
void NancyEngine::stopAndUnloadSpecificSounds() {
|
|
|
|
// TODO missing if
|
|
|
|
|
|
|
|
sound->stopSound(logo->MSNDchannelID);
|
|
|
|
|
|
|
|
for (uint i = 0; i < 10; ++i) {
|
|
|
|
sound->stopSound(i);
|
|
|
|
}
|
|
|
|
}
|
2021-03-02 18:05:34 +02:00
|
|
|
void NancyEngine::setMouseEnabled(bool enabled) {
|
|
|
|
cursorManager->showCursor(enabled); input->setMouseInputEnabled(enabled);
|
|
|
|
}
|
2021-02-20 20:22:13 +02:00
|
|
|
|
2021-02-20 23:24:23 +02:00
|
|
|
void NancyEngine::pauseEngineIntern(bool pause) {
|
|
|
|
if (pause) {
|
|
|
|
if (getGameState() == kScene) {
|
|
|
|
scene->requestStateChange(kPause);
|
|
|
|
scene->changeGameState(true);
|
|
|
|
} else {
|
2021-03-08 16:43:02 +02:00
|
|
|
setGameState(kPause, kNone, true);
|
2021-02-20 23:24:23 +02:00
|
|
|
}
|
|
|
|
} else {
|
2021-03-08 16:43:02 +02:00
|
|
|
setGameState(getPreviousGameState(), kNone, true);
|
2021-02-20 23:24:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
graphicsManager->onPause(pause);
|
|
|
|
|
|
|
|
Engine::pauseEngineIntern(pause);
|
|
|
|
}
|
|
|
|
|
2021-01-04 23:16:23 +02:00
|
|
|
void NancyEngine::clearBootChunks() {
|
|
|
|
for (auto const& i : _bootChunks) {
|
|
|
|
delete i._value;
|
|
|
|
}
|
|
|
|
_bootChunks.clear();
|
|
|
|
}
|
|
|
|
|
2012-10-22 13:12:42 +02:00
|
|
|
void NancyEngine::preloadCals(const IFF &boot) {
|
|
|
|
const byte *buf;
|
|
|
|
uint size;
|
|
|
|
buf = boot.getChunk(ID_PCAL, size);
|
|
|
|
|
|
|
|
if (buf) {
|
|
|
|
Common::MemoryReadStream stream(buf, size);
|
|
|
|
uint16 count = stream.readUint16LE();
|
|
|
|
debugC(1, kDebugEngine, "Preloading %d CALs", count);
|
|
|
|
int nameLen = size / count;
|
|
|
|
|
|
|
|
char *name = new char[nameLen];
|
|
|
|
|
|
|
|
for (uint i = 0; i < count; i++) {
|
|
|
|
stream.read(name, nameLen);
|
|
|
|
name[nameLen - 1] = 0;
|
|
|
|
debugC(1, kDebugEngine, "Preloading CAL '%s'", name);
|
|
|
|
if (!_res->loadCifTree(name, "cal"))
|
|
|
|
error("Failed to preload CAL '%s'", name);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete[] name;
|
|
|
|
|
|
|
|
if (stream.err())
|
|
|
|
error("Error reading PCAL chunk");
|
|
|
|
} else
|
|
|
|
debugC(1, kDebugEngine, "No PCAL chunk found");
|
|
|
|
}
|
|
|
|
|
2012-10-06 16:26:16 +02:00
|
|
|
void NancyEngine::syncSoundSettings() {
|
|
|
|
Engine::syncSoundSettings();
|
|
|
|
|
|
|
|
// _sound->syncVolume();
|
|
|
|
}
|
|
|
|
|
|
|
|
Common::String NancyEngine::getSavegameFilename(int slot) {
|
|
|
|
return _targetName + Common::String::format("-%02d.SAV", slot);
|
|
|
|
}
|
|
|
|
|
2015-06-16 15:32:57 +02:00
|
|
|
Common::String NancyEngine::readFilename(Common::ReadStream *stream) const {
|
|
|
|
char buf[kMaxFilenameLen + 1];
|
|
|
|
int read = stream->read(buf, getFilenameLen());
|
|
|
|
buf[read] = 0;
|
|
|
|
return Common::String(buf);
|
|
|
|
}
|
|
|
|
|
2015-06-16 11:29:20 +02:00
|
|
|
void NancyEngine::readImageList(const IFF &boot, const Common::String &prefix, ImageList &list) {
|
2021-01-04 23:16:23 +02:00
|
|
|
Common::SeekableReadStream *bsum = getBootChunkStream("BSUM");
|
|
|
|
byte count = bsum->readByte();
|
2015-06-16 11:29:20 +02:00
|
|
|
debugC(1, kDebugEngine, "Found %i %s images", count, prefix.c_str());
|
2012-10-06 16:26:16 +02:00
|
|
|
|
2015-06-16 11:29:20 +02:00
|
|
|
for (int i = 0; i < count; ++i) {
|
|
|
|
Common::String chunkName = Common::String::format("%s%d", prefix.c_str(), i);
|
|
|
|
Common::SeekableReadStream *chunkStream = boot.getChunkStream(chunkName);
|
|
|
|
|
|
|
|
if (!chunkStream)
|
|
|
|
error("Failed to read BOOT %s", chunkName.c_str());
|
|
|
|
|
|
|
|
Image image;
|
2015-06-16 15:32:57 +02:00
|
|
|
image.name = readFilename(chunkStream);
|
2015-06-16 11:29:20 +02:00
|
|
|
chunkStream->skip(1);
|
|
|
|
image.width = chunkStream->readUint16LE();
|
|
|
|
image.height = chunkStream->readUint16LE();
|
|
|
|
|
|
|
|
if (chunkStream->err())
|
|
|
|
error("Error reading %s%d", prefix.c_str(), i);
|
|
|
|
|
|
|
|
debugC(1, kDebugEngine, "Adding %s (%dx%d)", image.name.c_str(), image.width, image.height);
|
|
|
|
list.push_back(image);
|
|
|
|
|
|
|
|
delete chunkStream;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-08 16:43:02 +02:00
|
|
|
void NancyEngine::setGameState(GameState state, GameState overridePrevious, bool keepGraphics) {
|
|
|
|
if (overridePrevious != kNone) {
|
|
|
|
_gameFlow.previousGameState = overridePrevious;
|
|
|
|
} else {
|
|
|
|
_gameFlow.previousGameState = _gameFlow.minGameState;
|
|
|
|
}
|
|
|
|
|
2021-02-19 02:17:41 +02:00
|
|
|
_gameFlow.minGameState = state;
|
|
|
|
_gameFlow.justChanged = true;
|
|
|
|
|
2021-02-20 23:24:23 +02:00
|
|
|
if (!keepGraphics) {
|
|
|
|
graphicsManager->clearObjects();
|
|
|
|
}
|
2021-02-19 02:17:41 +02:00
|
|
|
}
|
|
|
|
|
2015-06-16 11:29:20 +02:00
|
|
|
class NancyEngine_v0 : public NancyEngine {
|
|
|
|
public:
|
|
|
|
NancyEngine_v0(OSystem *syst, const NancyGameDescription *gd) : NancyEngine(syst, gd) { }
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual uint getFilenameLen() const { return 9; }
|
|
|
|
virtual void readBootSummary(const IFF &boot);
|
|
|
|
};
|
|
|
|
|
|
|
|
void NancyEngine_v0::readBootSummary(const IFF &boot) {
|
2021-01-04 23:16:23 +02:00
|
|
|
Common::SeekableReadStream *bsum = getBootChunkStream("BSUM");
|
|
|
|
bsum->seek(0xa3);
|
2021-02-19 02:17:41 +02:00
|
|
|
firstSceneID = bsum->readUint16LE();
|
|
|
|
bsum->skip(4);
|
|
|
|
startTimeHours = bsum->readUint16LE(); // this is a whole Time struct but we just take the hours for now
|
2021-01-04 23:16:23 +02:00
|
|
|
bsum->seek(0x151);
|
2015-06-16 11:29:20 +02:00
|
|
|
readImageList(boot, "FR", _frames);
|
|
|
|
readImageList(boot, "LG", _logos);
|
2021-01-04 23:16:23 +02:00
|
|
|
readImageList(boot, "OB", _objects);
|
|
|
|
bsum->seek(0x1D1);
|
|
|
|
_fontSize = bsum->readSint32LE() * 1346;
|
2021-01-06 08:38:46 +02:00
|
|
|
bsum->seek(0x1ED);
|
2021-02-19 02:17:41 +02:00
|
|
|
scene->playerTimeMinuteLength = bsum->readSint16LE();
|
|
|
|
bsum->seek(0x1F1);
|
|
|
|
overrideMovementTimeDeltas = bsum->readByte();
|
|
|
|
if (overrideMovementTimeDeltas) {
|
|
|
|
slowMovementTimeDelta = bsum->readUint16LE();
|
|
|
|
fastMovementTimeDelta = bsum->readUint16LE();
|
|
|
|
}
|
2015-06-16 11:29:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class NancyEngine_v1 : public NancyEngine_v0 {
|
|
|
|
public:
|
|
|
|
NancyEngine_v1(OSystem *syst, const NancyGameDescription *gd) : NancyEngine_v0(syst, gd) { }
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual void readBootSummary(const IFF &boot);
|
|
|
|
};
|
|
|
|
|
|
|
|
void NancyEngine_v1::readBootSummary(const IFF &boot) {
|
2021-01-04 23:16:23 +02:00
|
|
|
Common::SeekableReadStream *bsum = getBootChunkStream("BSUM");
|
|
|
|
bsum->seek(0xa3);
|
2021-02-19 02:17:41 +02:00
|
|
|
firstSceneID = bsum->readUint16LE();
|
2021-01-04 23:16:23 +02:00
|
|
|
bsum->seek(0x14b);
|
2015-06-16 11:29:20 +02:00
|
|
|
readImageList(boot, "FR", _frames);
|
|
|
|
readImageList(boot, "LG", _logos);
|
|
|
|
}
|
|
|
|
|
|
|
|
class NancyEngine_v2 : public NancyEngine_v1 {
|
|
|
|
public:
|
|
|
|
NancyEngine_v2(OSystem *syst, const NancyGameDescription *gd) : NancyEngine_v1(syst, gd) { }
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual uint getFilenameLen() const { return 32; }
|
|
|
|
virtual void readBootSummary(const IFF &boot);
|
|
|
|
};
|
|
|
|
|
|
|
|
void NancyEngine_v2::readBootSummary(const IFF &boot) {
|
2021-01-04 23:16:23 +02:00
|
|
|
Common::SeekableReadStream *bsum = getBootChunkStream("BSUM");
|
|
|
|
bsum->seek(0xa7);
|
2015-06-16 11:29:20 +02:00
|
|
|
readImageList(boot, "FR", _frames);
|
|
|
|
readImageList(boot, "LG", _logos);
|
|
|
|
}
|
|
|
|
|
|
|
|
NancyEngine *NancyEngine::create(GameType type, OSystem *syst, const NancyGameDescription *gd) {
|
2021-01-04 23:16:23 +02:00
|
|
|
switch (type) {
|
2015-06-16 11:29:20 +02:00
|
|
|
case kGameTypeNancy1:
|
|
|
|
return new NancyEngine_v0(syst, gd);
|
|
|
|
case kGameTypeNancy2:
|
|
|
|
return new NancyEngine_v1(syst, gd);
|
|
|
|
case kGameTypeNancy3:
|
|
|
|
return new NancyEngine_v2(syst, gd);
|
|
|
|
default:
|
|
|
|
error("Unknown GameType");
|
|
|
|
}
|
|
|
|
}
|
2012-10-06 16:26:16 +02:00
|
|
|
|
2021-02-19 02:17:41 +02:00
|
|
|
} // End of namespace Nancy
|