aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/adl/adl_v2.cpp56
-rw-r--r--engines/adl/adl_v2.h6
-rw-r--r--engines/adl/hires2.cpp55
-rw-r--r--engines/adl/hires2.h7
4 files changed, 62 insertions, 62 deletions
diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp
index 8fcb45a52d..8b7a623654 100644
--- a/engines/adl/adl_v2.cpp
+++ b/engines/adl/adl_v2.cpp
@@ -25,6 +25,7 @@
#include "adl/adl_v2.h"
#include "adl/display.h"
+#include "adl/graphics.h"
namespace Adl {
@@ -194,6 +195,61 @@ void AdlEngine_v2::printString(const Common::String &str) {
_display->updateTextScreen();
}
+void AdlEngine_v2::drawItem(const Item &item, const Common::Point &pos) const {
+ StreamPtr stream(_itemPics[item.picture - 1]->createReadStream());
+ stream->readByte(); // Skip clear opcode
+ _graphics->drawPic(*stream, pos);
+}
+
+void AdlEngine_v2::loadRoom(byte roomNr) {
+ Room &room = getRoom(roomNr);
+ StreamPtr stream(room.data->createReadStream());
+
+ uint16 descOffset = stream->readUint16LE();
+ uint16 commandOffset = stream->readUint16LE();
+
+ _roomData.pictures.clear();
+ // There's no picture count. The original engine always checks at most
+ // five pictures. We use the description offset to bound our search.
+ uint16 picCount = (descOffset - 4) / 5;
+
+ for (uint i = 0; i < picCount; ++i) {
+ byte nr = stream->readByte();
+ _roomData.pictures[nr] = readDataBlockPtr(*stream);
+ }
+
+ _roomData.description = readStringAt(*stream, descOffset, 0xff);
+
+ _roomData.commands.clear();
+ if (commandOffset != 0) {
+ stream->seek(commandOffset);
+ readCommands(*stream, _roomData.commands);
+ }
+}
+
+void AdlEngine_v2::showRoom() {
+ drawPic(getCurRoom().curPicture, Common::Point());
+ drawItems();
+ _display->updateHiResScreen();
+ printString(_roomData.description);
+ _linesPrinted = 0;
+}
+
+DataBlockPtr AdlEngine_v2::readDataBlockPtr(Common::ReadStream &f) const {
+ byte track = f.readByte();
+ byte sector = f.readByte();
+ byte offset = f.readByte();
+ byte size = f.readByte();
+
+ if (f.eos() || f.err())
+ error("Error reading DataBlockPtr");
+
+ if (track == 0 && sector == 0 && offset == 0 && size == 0)
+ return DataBlockPtr();
+
+ return _disk->getDataBlock(track, sector, offset, size);
+}
+
int AdlEngine_v2::o2_isFirstTime(ScriptEnv &e) {
OP_DEBUG_0("\t&& IS_FIRST_TIME()");
diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h
index 66dbcf33d5..c8dc189ecd 100644
--- a/engines/adl/adl_v2.h
+++ b/engines/adl/adl_v2.h
@@ -47,6 +47,11 @@ protected:
byte roomArg(byte room) const;
void advanceClock();
void printString(const Common::String &str);
+ void drawItem(const Item &item, const Common::Point &pos) const;
+ void loadRoom(byte roomNr);
+ void showRoom();
+
+ DataBlockPtr readDataBlockPtr(Common::ReadStream &f) const;
void checkTextOverflow(char c);
@@ -72,6 +77,7 @@ protected:
uint _linesPrinted;
DiskImage *_disk;
+ Common::Array<DataBlockPtr> _itemPics;
private:
int askForSlot(const Common::String &question);
diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp
index 4d18b2e7bc..a1303b652c 100644
--- a/engines/adl/hires2.cpp
+++ b/engines/adl/hires2.cpp
@@ -33,21 +33,6 @@
namespace Adl {
-DataBlockPtr HiRes2Engine::readDataBlockPtr(Common::ReadStream &f) const {
- byte track = f.readByte();
- byte sector = f.readByte();
- byte offset = f.readByte();
- byte size = f.readByte();
-
- if (f.eos() || f.err())
- error("Error reading DataBlockPtr");
-
- if (track == 0 && sector == 0 && offset == 0 && size == 0)
- return DataBlockPtr();
-
- return _disk->getDataBlock(track, sector, offset, size);
-}
-
void HiRes2Engine::runIntro() const {
StreamPtr stream(_disk->createReadStream(0x00, 0xd, 0x17, 1));
@@ -202,46 +187,6 @@ void HiRes2Engine::restartGame() {
initState();
}
-void HiRes2Engine::drawItem(const Item &item, const Common::Point &pos) const {
- StreamPtr stream(_itemPics[item.picture - 1]->createReadStream());
- stream->readByte(); // Skip clear opcode
- _graphics->drawPic(*stream, pos);
-}
-
-void HiRes2Engine::loadRoom(byte roomNr) {
- Room &room = getRoom(roomNr);
- StreamPtr stream(room.data->createReadStream());
-
- uint16 descOffset = stream->readUint16LE();
- uint16 commandOffset = stream->readUint16LE();
-
- _roomData.pictures.clear();
- // There's no picture count. The original engine always checks at most
- // five pictures. We use the description offset to bound our search.
- uint16 picCount = (descOffset - 4) / 5;
-
- for (uint i = 0; i < picCount; ++i) {
- byte nr = stream->readByte();
- _roomData.pictures[nr] = readDataBlockPtr(*stream);
- }
-
- _roomData.description = readStringAt(*stream, descOffset, 0xff);
-
- _roomData.commands.clear();
- if (commandOffset != 0) {
- stream->seek(commandOffset);
- readCommands(*stream, _roomData.commands);
- }
-}
-
-void HiRes2Engine::showRoom() {
- drawPic(getCurRoom().curPicture, Common::Point());
- drawItems();
- _display->updateHiResScreen();
- printString(_roomData.description);
- _linesPrinted = 0;
-}
-
Engine *HiRes2Engine_create(OSystem *syst, const AdlGameDescription *gd) {
return new HiRes2Engine(syst, gd);
}
diff --git a/engines/adl/hires2.h b/engines/adl/hires2.h
index b8212e0795..f2ffbf8744 100644
--- a/engines/adl/hires2.h
+++ b/engines/adl/hires2.h
@@ -60,13 +60,6 @@ private:
void init();
void initState();
void restartGame();
- void drawItem(const Item &item, const Common::Point &pos) const;
- void loadRoom(byte roomNr);
- void showRoom();
-
- DataBlockPtr readDataBlockPtr(Common::ReadStream &f) const;
-
- Common::Array<DataBlockPtr> _itemPics;
};
} // End of namespace Adl