aboutsummaryrefslogtreecommitdiff
path: root/engines/adl/hires2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/adl/hires2.cpp')
-rw-r--r--engines/adl/hires2.cpp120
1 files changed, 68 insertions, 52 deletions
diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp
index ac1ee57fac..9f76b0f49f 100644
--- a/engines/adl/hires2.cpp
+++ b/engines/adl/hires2.cpp
@@ -33,63 +33,42 @@
namespace Adl {
-#define IDS_HR2_DISK_IMAGE "WIZARD.DSK"
-
-#define IDI_HR2_NUM_ROOMS 135
-#define IDI_HR2_NUM_MESSAGES 255
-#define IDI_HR2_NUM_VARS 40
-#define IDI_HR2_NUM_ITEM_PICS 38
-#define IDI_HR2_NUM_ITEM_OFFSETS 16
-
-// Messages used outside of scripts
-#define IDI_HR2_MSG_CANT_GO_THERE 123
-#define IDI_HR2_MSG_DONT_UNDERSTAND 19
-#define IDI_HR2_MSG_ITEM_DOESNT_MOVE 242
-#define IDI_HR2_MSG_ITEM_NOT_HERE 4
-#define IDI_HR2_MSG_THANKS_FOR_PLAYING 239
-
-class HiRes2Engine : public AdlEngine_v2 {
+class HiResBaseEngine : public AdlEngine_v2 {
public:
- HiRes2Engine(OSystem *syst, const AdlGameDescription *gd) : AdlEngine_v2(syst, gd) { }
+ HiResBaseEngine(OSystem *syst, const AdlGameDescription *gd, const byte numRooms, const byte numMsgs, const byte numItemPics);
private:
// AdlEngine
- void runIntro();
void init();
void initGameState();
-};
-
-void HiRes2Engine::runIntro() {
- // This only works for the 16-sector re-release. The original
- // release is not supported at this time, because we don't have
- // access to it.
- _disk->setSectorLimit(0);
- StreamPtr stream(_disk->createReadStream(0x00, 0xd, 0x17, 1));
-
- _display->setMode(DISPLAY_MODE_TEXT);
- Common::String str = readString(*stream);
-
- if (stream->eos() || stream->err())
- error("Error reading disk image");
-
- _display->printString(str);
- delay(2000);
+ const byte _numRooms, _numMsgs, _numItemPics;
+};
- _disk->setSectorLimit(13);
+HiResBaseEngine::HiResBaseEngine(OSystem *syst, const AdlGameDescription *gd, const byte numRooms, const byte numMsgs, const byte numItemPics) :
+ AdlEngine_v2(syst, gd),
+ _numRooms(numRooms),
+ _numMsgs(numMsgs),
+ _numItemPics(numItemPics) {
+
+ _messageIds.cantGoThere = 110;
+ _messageIds.dontUnderstand = 112;
+ _messageIds.itemDoesntMove = 114;
+ _messageIds.itemNotHere = 115;
+ _messageIds.thanksForPlaying = 113;
}
-void HiRes2Engine::init() {
+void HiResBaseEngine::init() {
_graphics = new GraphicsMan_v2(*_display);
_disk = new DiskImage();
- if (!_disk->open(IDS_HR2_DISK_IMAGE))
- error("Failed to open disk image '" IDS_HR2_DISK_IMAGE "'");
+ if (!_disk->open(getDiskImageName(0)))
+ error("Failed to open disk image '%s'", getDiskImageName(0).c_str());
_disk->setSectorLimit(13);
StreamPtr stream(_disk->createReadStream(0x1f, 0x2, 0x00, 4));
- loadMessages(*stream, IDI_HR2_NUM_MESSAGES);
+ loadMessages(*stream, _numMsgs);
// Read parser messages
stream.reset(_disk->createReadStream(0x1a, 0x1));
@@ -114,30 +93,24 @@ void HiRes2Engine::init() {
_strings.playAgain = readStringAt(*stream, 0x225);
_strings.pressReturn = readStringAt(*stream, 0x25f);
- _messageIds.cantGoThere = IDI_HR2_MSG_CANT_GO_THERE;
- _messageIds.dontUnderstand = IDI_HR2_MSG_DONT_UNDERSTAND;
- _messageIds.itemDoesntMove = IDI_HR2_MSG_ITEM_DOESNT_MOVE;
- _messageIds.itemNotHere = IDI_HR2_MSG_ITEM_NOT_HERE;
- _messageIds.thanksForPlaying = IDI_HR2_MSG_THANKS_FOR_PLAYING;
-
// Load global picture data
stream.reset(_disk->createReadStream(0x19, 0xa, 0x80, 0));
loadPictures(*stream);
// Load item picture data
stream.reset(_disk->createReadStream(0x1e, 0x9, 0x05));
- loadItemPictures(*stream, IDI_HR2_NUM_ITEM_PICS);
+ loadItemPictures(*stream, _numItemPics);
// Load commands from executable
stream.reset(_disk->createReadStream(0x1d, 0x7, 0x00, 4));
readCommands(*stream, _roomCommands);
- stream.reset(_disk->createReadStream(0x1f, 0x7, 0x00, 2));
+ stream.reset(_disk->createReadStream(0x1f, 0x7, 0x00, 3));
readCommands(*stream, _globalCommands);
// Load dropped item offsets
stream.reset(_disk->createReadStream(0x1b, 0x4, 0x15));
- loadDroppedItemOffsets(*stream, IDI_HR2_NUM_ITEM_OFFSETS);
+ loadDroppedItemOffsets(*stream, 16);
// Load verbs
stream.reset(_disk->createReadStream(0x19, 0x0, 0x00, 3));
@@ -148,18 +121,61 @@ void HiRes2Engine::init() {
loadWords(*stream, _nouns, _priNouns);
}
-void HiRes2Engine::initGameState() {
- _state.vars.resize(IDI_HR2_NUM_VARS);
+void HiResBaseEngine::initGameState() {
+ _state.vars.resize(40);
StreamPtr stream(_disk->createReadStream(0x21, 0x5, 0x0e, 7));
- loadRooms(*stream, IDI_HR2_NUM_ROOMS);
+ loadRooms(*stream, _numRooms);
stream.reset(_disk->createReadStream(0x21, 0x0, 0x00, 2));
loadItems(*stream);
}
+class HiRes2Engine : public HiResBaseEngine {
+public:
+ HiRes2Engine(OSystem *syst, const AdlGameDescription *gd);
+
+private:
+ // AdlEngine
+ void runIntro();
+};
+
+HiRes2Engine::HiRes2Engine(OSystem *syst, const AdlGameDescription *gd) :
+ HiResBaseEngine(syst, gd, 135, 255, 38) {
+
+ _messageIds.cantGoThere = 123;
+ _messageIds.dontUnderstand = 19;
+ _messageIds.itemDoesntMove = 242;
+ _messageIds.itemNotHere = 4;
+ _messageIds.thanksForPlaying = 239;
+}
+
+void HiRes2Engine::runIntro() {
+ // This only works for the 16-sector re-release. The original
+ // release is not supported at this time, because we don't have
+ // access to it.
+ _disk->setSectorLimit(0);
+ StreamPtr stream(_disk->createReadStream(0x00, 0xd, 0x17, 1));
+
+ _display->setMode(DISPLAY_MODE_TEXT);
+
+ Common::String str = readString(*stream);
+
+ if (stream->eos() || stream->err())
+ error("Error reading disk image");
+
+ _display->printString(str);
+ delay(2000);
+
+ _disk->setSectorLimit(13);
+}
+
Engine *HiRes2Engine_create(OSystem *syst, const AdlGameDescription *gd) {
return new HiRes2Engine(syst, gd);
}
+Engine *HiRes0Engine_create(OSystem *syst, const AdlGameDescription *gd) {
+ return new HiResBaseEngine(syst, gd, 43, 142, 2);
+}
+
} // End of namespace Adl