aboutsummaryrefslogtreecommitdiff
path: root/engines/adl
diff options
context:
space:
mode:
authorWalter van Niftrik2016-08-23 00:34:56 +0200
committerWalter van Niftrik2016-08-23 00:36:38 +0200
commit0470346ac0988471d36eb4deb3f857f52157c659 (patch)
treeb571ea78410d0aba1a8ba11a292ba1ea44a0436d /engines/adl
parentc5828a41f4cdd2f37f01d463bcf295265965b80b (diff)
downloadscummvm-rg350-0470346ac0988471d36eb4deb3f857f52157c659.tar.gz
scummvm-rg350-0470346ac0988471d36eb4deb3f857f52157c659.tar.bz2
scummvm-rg350-0470346ac0988471d36eb4deb3f857f52157c659.zip
ADL: Add initial support for #0: Mission Asteroid
Based on a patch by fuzzie
Diffstat (limited to 'engines/adl')
-rw-r--r--engines/adl/detection.cpp4
-rw-r--r--engines/adl/disk.cpp8
-rw-r--r--engines/adl/hires0.cpp168
-rw-r--r--engines/adl/hires0.h59
-rw-r--r--engines/adl/module.mk1
5 files changed, 232 insertions, 8 deletions
diff --git a/engines/adl/detection.cpp b/engines/adl/detection.cpp
index 6a85f98cf0..4bdb722af3 100644
--- a/engines/adl/detection.cpp
+++ b/engines/adl/detection.cpp
@@ -296,6 +296,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 *HiRes0Engine_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 {
@@ -311,6 +312,9 @@ bool AdlMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameD
case GAME_TYPE_HIRES2:
*engine = HiRes2Engine_create(syst, adlGd);
break;
+ case GAME_TYPE_HIRES0:
+ *engine = HiRes0Engine_create(syst, adlGd);
+ break;
case GAME_TYPE_HIRES6:
*engine = HiRes6Engine_create(syst, adlGd);
break;
diff --git a/engines/adl/disk.cpp b/engines/adl/disk.cpp
index 6476fc5b09..49e01f9d0f 100644
--- a/engines/adl/disk.cpp
+++ b/engines/adl/disk.cpp
@@ -112,14 +112,6 @@ static Common::SeekableReadStream *readImage_NIB(const Common::String &filename)
if ((volNo ^ track ^ sector) != checksum)
error("invalid NIB checksum");
- // FIXME: This is a hires0/hires2-specific hack.
- if (volNo == 0xfe) {
- if (track == 1)
- track = 2;
- else if (track == 2)
- track = 1;
- }
-
// Epilogue is de/aa plus a gap, but we don't care.
continue;
}
diff --git a/engines/adl/hires0.cpp b/engines/adl/hires0.cpp
new file mode 100644
index 0000000000..316f77a9b6
--- /dev/null
+++ b/engines/adl/hires0.cpp
@@ -0,0 +1,168 @@
+/* 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/textconsole.h"
+
+#include "adl/hires0.h"
+#include "adl/graphics.h"
+#include "adl/disk.h"
+
+namespace Adl {
+
+void HiRes0Engine::init() {
+ _graphics = new Graphics_v2(*_display);
+
+ _disk = new DiskImage();
+ if (!_disk->open(IDS_HR0_DISK_IMAGE))
+ error("Failed to open disk image '" IDS_HR0_DISK_IMAGE "'");
+
+ _disk->setMode13(true);
+
+ StreamPtr stream(_disk->createReadStream(0x1f, 0x2, 0x00, 2));
+
+ // TODO: all these strings/offsets/etc are the same as hires2
+
+ for (uint i = 0; i < IDI_HR0_NUM_MESSAGES; ++i)
+ _messages.push_back(readDataBlockPtr(*stream));
+
+ // Read parser messages
+ stream.reset(_disk->createReadStream(0x1a, 0x1));
+ _strings.verbError = readStringAt(*stream, 0x4f);
+ _strings.nounError = readStringAt(*stream, 0x8e);
+ _strings.enterCommand = readStringAt(*stream, 0xbc);
+
+ // Read time string
+ stream.reset(_disk->createReadStream(0x19, 0x7, 0xd7));
+ _strings_v2.time = readString(*stream, 0xff);
+
+ // Read line feeds
+ stream.reset(_disk->createReadStream(0x19, 0xb, 0xf8, 1));
+ _strings.lineFeeds = readString(*stream);
+
+ // Read opcode strings
+ stream.reset(_disk->createReadStream(0x1a, 0x6, 0x00, 2));
+ _strings_v2.saveInsert = readStringAt(*stream, 0x5f);
+ _strings_v2.saveReplace = readStringAt(*stream, 0xe5);
+ _strings_v2.restoreInsert = readStringAt(*stream, 0x132);
+ _strings_v2.restoreReplace = readStringAt(*stream, 0x1c2);
+ _strings.playAgain = readStringAt(*stream, 0x225);
+ _strings.pressReturn = readStringAt(*stream, 0x25f);
+
+ _messageIds.cantGoThere = IDI_HR0_MSG_CANT_GO_THERE;
+ _messageIds.dontUnderstand = IDI_HR0_MSG_DONT_UNDERSTAND;
+ _messageIds.itemDoesntMove = IDI_HR0_MSG_ITEM_DOESNT_MOVE;
+ _messageIds.itemNotHere = IDI_HR0_MSG_ITEM_NOT_HERE;
+ _messageIds.thanksForPlaying = IDI_HR0_MSG_THANKS_FOR_PLAYING;
+
+ // Load global picture data
+ stream.reset(_disk->createReadStream(0x19, 0xa, 0x80, 0));
+ byte picNr;
+ while ((picNr = stream->readByte()) != 0xff) {
+ if (stream->eos() || stream->err())
+ error("Error reading global pic list");
+
+ _pictures[picNr] = readDataBlockPtr(*stream);
+ }
+
+ // Load item picture data
+ stream.reset(_disk->createReadStream(0x1e, 0x9, 0x05));
+ for (uint i = 0; i < IDI_HR0_NUM_ITEM_PICS; ++i) {
+ stream->readByte(); // number
+ _itemPics.push_back(readDataBlockPtr(*stream));
+ }
+
+ // Load commands from executable
+ stream.reset(_disk->createReadStream(0x1d, 0x7, 0x00, 2));
+ readCommands(*stream, _roomCommands);
+
+ stream.reset(_disk->createReadStream(0x1f, 0x7, 0x00, 3));
+ readCommands(*stream, _globalCommands);
+
+ // Load dropped item offsets
+ stream.reset(_disk->createReadStream(0x1b, 0x4, 0x15));
+ for (uint i = 0; i < IDI_HR0_NUM_ITEM_OFFSETS; ++i) {
+ Common::Point p;
+ p.x = stream->readByte();
+ p.y = stream->readByte();
+ _itemOffsets.push_back(p);
+ }
+
+ // Load verbs
+ stream.reset(_disk->createReadStream(0x19, 0x0, 0x00, 3));
+ loadWords(*stream, _verbs, _priVerbs);
+
+ // Load nouns
+ stream.reset(_disk->createReadStream(0x22, 0x2, 0x00, 2));
+ loadWords(*stream, _nouns, _priNouns);
+}
+
+void HiRes0Engine::initGameState() {
+ _state.vars.resize(IDI_HR0_NUM_VARS);
+
+ StreamPtr stream(_disk->createReadStream(0x21, 0x5, 0x0e, 2));
+
+ for (uint i = 0; i < IDI_HR0_NUM_ROOMS; ++i) {
+ Room room;
+ stream->readByte(); // number
+ for (uint j = 0; j < 6; ++j)
+ room.connections[j] = stream->readByte();
+ room.data = readDataBlockPtr(*stream);
+ room.picture = stream->readByte();
+ room.curPicture = stream->readByte();
+ room.isFirstTime = stream->readByte();
+ _state.rooms.push_back(room);
+ }
+
+ stream.reset(_disk->createReadStream(0x21, 0x0));
+
+ byte id;
+ while ((id = stream->readByte()) != 0xff) {
+ Item item = Item();
+ item.id = id;
+ item.noun = stream->readByte();
+ item.room = stream->readByte();
+ item.picture = stream->readByte();
+ item.isLineArt = stream->readByte();
+ item.position.x = stream->readByte();
+ item.position.y = stream->readByte();
+ item.state = stream->readByte();
+ item.description = stream->readByte();
+
+ stream->readByte(); // Struct size
+
+ byte picListSize = stream->readByte();
+
+ // Flag to keep track of what has been drawn on the screen
+ stream->readByte();
+
+ for (uint i = 0; i < picListSize; ++i)
+ item.roomPictures.push_back(stream->readByte());
+
+ _state.items.push_back(item);
+ }
+}
+
+Engine *HiRes0Engine_create(OSystem *syst, const AdlGameDescription *gd) {
+ return new HiRes0Engine(syst, gd);
+}
+
+} // End of namespace Adl
diff --git a/engines/adl/hires0.h b/engines/adl/hires0.h
new file mode 100644
index 0000000000..624f248ea8
--- /dev/null
+++ b/engines/adl/hires0.h
@@ -0,0 +1,59 @@
+/* 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_HIRES0_H
+#define ADL_HIRES0_H
+
+#include "adl/adl_v2.h"
+
+namespace Adl {
+
+#define IDS_HR0_DISK_IMAGE "MISSION.NIB"
+
+#define IDI_HR0_NUM_ROOMS 43
+#define IDI_HR0_NUM_MESSAGES 142
+#define IDI_HR0_NUM_VARS 40
+#define IDI_HR0_NUM_ITEM_PICS 2
+#define IDI_HR0_NUM_ITEM_OFFSETS 16
+
+// Messages used outside of scripts
+#define IDI_HR0_MSG_CANT_GO_THERE 110
+#define IDI_HR0_MSG_DONT_UNDERSTAND 112
+#define IDI_HR0_MSG_ITEM_DOESNT_MOVE 114
+#define IDI_HR0_MSG_ITEM_NOT_HERE 115
+#define IDI_HR0_MSG_THANKS_FOR_PLAYING 113
+
+class HiRes0Engine : public AdlEngine_v2 {
+public:
+ HiRes0Engine(OSystem *syst, const AdlGameDescription *gd) :
+ AdlEngine_v2(syst, gd) { }
+ ~HiRes0Engine() { }
+
+private:
+ // AdlEngine
+ void init();
+ void initGameState();
+};
+
+} // End of namespace Adl
+
+#endif
diff --git a/engines/adl/module.mk b/engines/adl/module.mk
index 7ab37efc67..d17c8569b3 100644
--- a/engines/adl/module.mk
+++ b/engines/adl/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS := \
graphics.o \
graphics_v1.o \
graphics_v2.o \
+ hires0.o \
hires1.o \
hires2.o \
hires6.o \