diff options
author | Walter van Niftrik | 2016-04-08 12:35:23 +0200 |
---|---|---|
committer | Walter van Niftrik | 2016-06-06 20:35:49 +0200 |
commit | ae405707cc398af3afbd7c5c00723eec2a5538f7 (patch) | |
tree | c434033da3e737362c6c81c5b0dafc88e3c33b7c /engines/adl | |
parent | 266e63453f386b5a0b043c4cdc5e278b8b6134a3 (diff) | |
download | scummvm-rg350-ae405707cc398af3afbd7c5c00723eec2a5538f7.tar.gz scummvm-rg350-ae405707cc398af3afbd7c5c00723eec2a5538f7.tar.bz2 scummvm-rg350-ae405707cc398af3afbd7c5c00723eec2a5538f7.zip |
ADL: Add skeleton for hires6
Diffstat (limited to 'engines/adl')
-rw-r--r-- | engines/adl/detection.cpp | 22 | ||||
-rw-r--r-- | engines/adl/detection.h | 3 | ||||
-rw-r--r-- | engines/adl/hires2.h | 4 | ||||
-rw-r--r-- | engines/adl/hires6.cpp | 152 | ||||
-rw-r--r-- | engines/adl/hires6.h | 64 | ||||
-rw-r--r-- | engines/adl/module.mk | 1 |
6 files changed, 243 insertions, 3 deletions
diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp index 0a8a98f248..12405e7c5e 100644 --- a/engines/adl/detection.cpp +++ b/engines/adl/detection.cpp @@ -74,6 +74,7 @@ static const PlainGameDescriptor adlGames[] = { { "hires0", "Hi-Res Adventure #0: Mission Asteroid" }, { "hires1", "Hi-Res Adventure #1: Mystery House" }, { "hires2", "Hi-Res Adventure #2: Wizard and the Princess" }, + { "hires6", "Hi-Res Adventure #6: The Dark Crystal" }, { 0, 0 } }; @@ -136,6 +137,23 @@ static const AdlGameDescription gameDescriptions[] = { }, GAME_TYPE_HIRES0 }, + { // Hi-Res Adventure #6: The Dark Crystal - Apple II - Roberta Williams Anthology + { + "hires6", 0, + { + { "DARK1A.DSK", 0, "00c2646d6943d1405717332a6f42d493", 143360 }, + { "DARK2A.NIB", 0, "271eb92db107e8d5829437f8ba77991e", 232960 }, + { "DARK1B.NIB", 0, "dbedd736617343ade0e6bead8bf2b10c", 232960 }, + { "DARK2B.NIB", 0, "cb72044a9b391c4285f4752f746bea2e", 232960 }, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformApple2GS, // FIXME + ADGF_UNSTABLE, + GUIO2(GAMEOPTION_MONO, GAMEOPTION_SCANLINES) + }, + GAME_TYPE_HIRES6 + }, { AD_TABLE_END_MARKER, GAME_TYPE_NONE } }; @@ -276,6 +294,7 @@ void AdlMetaEngine::removeSaveState(const char *target, int slot) const { Engine *HiRes1Engine_create(OSystem *syst, const AdlGameDescription *gd); Engine *HiRes2Engine_create(OSystem *syst, const AdlGameDescription *gd); +Engine *HiRes6Engine_create(OSystem *syst, const AdlGameDescription *gd); bool AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *gd) const { if (!gd) @@ -290,6 +309,9 @@ bool AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameD case GAME_TYPE_HIRES2: *engine = HiRes2Engine_create(syst, adlGd); break; + case GAME_TYPE_HIRES6: + *engine = HiRes6Engine_create(syst, adlGd); + break; default: error("Unknown GameType"); } diff --git a/engines/adl/detection.h b/engines/adl/detection.h index bd01529abc..533466c094 100644 --- a/engines/adl/detection.h +++ b/engines/adl/detection.h @@ -34,7 +34,8 @@ enum GameType { GAME_TYPE_NONE, GAME_TYPE_HIRES0, GAME_TYPE_HIRES1, - GAME_TYPE_HIRES2 + GAME_TYPE_HIRES2, + GAME_TYPE_HIRES6 }; struct AdlGameDescription { diff --git a/engines/adl/hires2.h b/engines/adl/hires2.h index a882b68114..b99fd6639c 100644 --- a/engines/adl/hires2.h +++ b/engines/adl/hires2.h @@ -20,8 +20,8 @@ * */ -#ifndef ADL_HIRES1_H -#define ADL_HIRES1_H +#ifndef ADL_HIRES2_H +#define ADL_HIRES2_H #include "common/str.h" diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp new file mode 100644 index 0000000000..7c9292fe07 --- /dev/null +++ b/engines/adl/hires6.cpp @@ -0,0 +1,152 @@ +/* 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/debug.h" +#include "common/error.h" +#include "common/file.h" +#include "common/stream.h" +#include "common/memstream.h" + +#include "adl/hires6.h" +#include "adl/display.h" +#include "adl/graphics.h" +#include "adl/disk.h" + +namespace Adl { + +static const char *disks[] = { "DARK1A.DSK", "DARK1B.NIB", "DARK2A.NIB", "DARK2B.NIB" }; + +#define SECTORS_PER_TRACK 16 +#define BYTES_PER_SECTOR 256 + +static Common::MemoryReadStream *loadSectors(DiskImage *disk, byte track, byte sector = SECTORS_PER_TRACK - 1, byte count = SECTORS_PER_TRACK) { + const int bufSize = count * BYTES_PER_SECTOR; + byte *const buf = (byte *)malloc(bufSize); + byte *p = buf; + + while (count-- > 0) { + StreamPtr stream(disk->createReadStream(track, sector, 0, 0)); + stream->read(p, BYTES_PER_SECTOR); + + if (stream->err() || stream->eos()) + error("Error loading from disk image"); + + p += BYTES_PER_SECTOR; + if (sector > 0) + --sector; + else { + ++track; + + // Skip VTOC track + if (track == 17) + ++track; + + sector = SECTORS_PER_TRACK - 1; + } + } + + return new Common::MemoryReadStream(buf, bufSize, DisposeAfterUse::YES); +} + +void HiRes6Engine::runIntro() const { + DiskImage_DSK *boot(new DiskImage_DSK()); + + if (!boot->open(disks[0])) + error("Failed to open disk image '%s'", disks[0]); + + StreamPtr stream(loadSectors(boot, 11, 1, 96)); + + _display->setMode(DISPLAY_MODE_HIRES); + _display->loadFrameBuffer(*stream); + _display->updateHiResScreen(); + delay(256 * 8609 / 1000); + + _display->loadFrameBuffer(*stream); + _display->updateHiResScreen(); + delay(256 * 8609 / 1000); + + _display->loadFrameBuffer(*stream); + + delete boot; + + // Load copyright string from boot file + Files_DOS33 *files(new Files_DOS33()); + + if (!files->open(disks[0])) + error("Failed to open disk image '%s'", disks[0]); + + stream.reset(files->createReadStream("\010\010\010\010\010\010")); + Common::String copyright(readStringAt(*stream, 0x103, APPLECHAR('\r'))); + + delete files; + + _display->updateHiResScreen(); + _display->home(); + _display->setMode(DISPLAY_MODE_MIXED); + _display->moveCursorTo(Common::Point(0, 21)); + _display->printString(copyright); + delay(256 * 8609 / 1000); +} + +void HiRes6Engine::init() { + DiskImage_DSK *boot(new DiskImage_DSK()); + _graphics = new Graphics_v2(*_display); + + if (!boot->open(disks[0])) + error("Failed to open disk image '%s'", disks[0]); + + StreamPtr stream(loadSectors(boot, 7)); + + // Read parser messages + _strings.verbError = readStringAt(*stream, 0x666); + _strings.nounError = readStringAt(*stream, 0x6bd); + _strings.enterCommand = readStringAt(*stream, 0x6e9); + + // Read line feeds + _strings.lineFeeds = readStringAt(*stream, 0x408); + + // Read opcode strings (TODO) + _strings_v2.saveInsert = readStringAt(*stream, 0xad8); + readStringAt(*stream, 0xb95); // Confirm save + // _strings_v2.saveReplace + _strings_v2.restoreInsert = readStringAt(*stream, 0xc07); + // _strings_v2.restoreReplace + _strings.playAgain = readStringAt(*stream, 0xcdf, 0xff); + + _messageIds.cantGoThere = IDI_HR6_MSG_CANT_GO_THERE; + _messageIds.dontUnderstand = IDI_HR6_MSG_DONT_UNDERSTAND; + _messageIds.itemDoesntMove = IDI_HR6_MSG_ITEM_DOESNT_MOVE; + _messageIds.itemNotHere = IDI_HR6_MSG_ITEM_NOT_HERE; + _messageIds.thanksForPlaying = IDI_HR6_MSG_THANKS_FOR_PLAYING; + + delete boot; +} + +void HiRes6Engine::initState() { +} + +Engine *HiRes6Engine_create(OSystem *syst, const AdlGameDescription *gd) { + return new HiRes6Engine(syst, gd); +} + +} // End of namespace Adl diff --git a/engines/adl/hires6.h b/engines/adl/hires6.h new file mode 100644 index 0000000000..ecc0a6ad68 --- /dev/null +++ b/engines/adl/hires6.h @@ -0,0 +1,64 @@ +/* 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 ADL_HIRES6_H +#define ADL_HIRES6_H + +#include "common/str.h" + +#include "adl/adl_v2.h" +#include "adl/disk.h" + +namespace Common { +class ReadStream; +class Point; +} + +namespace Adl { + +#define IDI_HR6_NUM_ROOMS 35 +#define IDI_HR6_NUM_MESSAGES 255 +#define IDI_HR6_NUM_VARS 40 +#define IDI_HR6_NUM_ITEM_PICS 15 +#define IDI_HR6_NUM_ITEM_OFFSETS 16 + +// Messages used outside of scripts +#define IDI_HR6_MSG_CANT_GO_THERE 249 +#define IDI_HR6_MSG_DONT_UNDERSTAND 247 +#define IDI_HR6_MSG_ITEM_DOESNT_MOVE 253 +#define IDI_HR6_MSG_ITEM_NOT_HERE 254 +#define IDI_HR6_MSG_THANKS_FOR_PLAYING 252 + +class HiRes6Engine : public AdlEngine_v2 { +public: + HiRes6Engine(OSystem *syst, const AdlGameDescription *gd) : AdlEngine_v2(syst, gd) { } + +private: + // AdlEngine + void runIntro() const; + void init(); + void initState(); +}; + +} // End of namespace Adl + +#endif diff --git a/engines/adl/module.mk b/engines/adl/module.mk index 7f097a42d5..c726a6b28a 100644 --- a/engines/adl/module.mk +++ b/engines/adl/module.mk @@ -12,6 +12,7 @@ MODULE_OBJS := \ graphics_v2.o \ hires1.o \ hires2.o \ + hires6.o \ speaker.o MODULE_DIRS += \ |