aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/adl/adl_v2.cpp10
-rw-r--r--engines/adl/adl_v2.h1
-rw-r--r--engines/adl/hires0.cpp8
-rw-r--r--engines/adl/hires2.cpp8
-rw-r--r--engines/adl/hires4.cpp8
-rw-r--r--engines/adl/hires6.cpp7
6 files changed, 22 insertions, 20 deletions
diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp
index c251433f05..ae4c2d8d84 100644
--- a/engines/adl/adl_v2.cpp
+++ b/engines/adl/adl_v2.cpp
@@ -419,6 +419,16 @@ void AdlEngine_v2::loadMessages(Common::SeekableReadStream &stream, byte count)
_messages.push_back(readDataBlockPtr(stream));
}
+void AdlEngine_v2::loadPictures(Common::SeekableReadStream &stream) {
+ byte picNr;
+ while ((picNr = stream.readByte()) != 0xff) {
+ if (stream.eos() || stream.err())
+ error("Error reading global pic list");
+
+ _pictures[picNr] = readDataBlockPtr(stream);
+ }
+}
+
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 c2dd7f8272..4136afb857 100644
--- a/engines/adl/adl_v2.h
+++ b/engines/adl/adl_v2.h
@@ -56,6 +56,7 @@ protected:
void loadItems(Common::SeekableReadStream &stream);
void loadRooms(Common::SeekableReadStream &stream, byte count);
void loadMessages(Common::SeekableReadStream &stream, byte count);
+ void loadPictures(Common::SeekableReadStream &stream);
void checkTextOverflow(char c);
diff --git a/engines/adl/hires0.cpp b/engines/adl/hires0.cpp
index 34a1b264f3..1c18123571 100644
--- a/engines/adl/hires0.cpp
+++ b/engines/adl/hires0.cpp
@@ -73,13 +73,7 @@ void HiRes0Engine::init() {
// 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);
- }
+ loadPictures(*stream);
// Load item picture data
stream.reset(_disk->createReadStream(0x1e, 0x9, 0x05));
diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp
index e9ca86ff82..69e7e74589 100644
--- a/engines/adl/hires2.cpp
+++ b/engines/adl/hires2.cpp
@@ -96,13 +96,7 @@ void HiRes2Engine::init() {
// 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);
- }
+ loadPictures(*stream);
// Load item picture data
stream.reset(_disk->createReadStream(0x1e, 0x9, 0x05));
diff --git a/engines/adl/hires4.cpp b/engines/adl/hires4.cpp
index 41bbd95b02..7d20457b30 100644
--- a/engines/adl/hires4.cpp
+++ b/engines/adl/hires4.cpp
@@ -96,6 +96,10 @@ void HiRes4Engine::goToSideC() {
error("Failed to open disk image '%s'", getDiskImageName(2));
// As room.data is bound to the DiskImage, we need to rebind them here
+ // We cannot simply reload the rooms as that would reset their state
+
+ // FIXME: Remove DataBlockPtr-DiskImage coupling?
+
StreamPtr stream(createReadStream(_boot, 0x03, 0x1, 0x0e, 9));
for (uint i = 0; i < IDI_HR4_NUM_ROOMS; ++i) {
stream->skip(7);
@@ -111,6 +115,10 @@ void HiRes4Engine::loadCommonData() {
_messages.clear();
StreamPtr stream(createReadStream(_boot, 0x0a, 0x4, 0x00, 3));
loadMessages(*stream, IDI_HR4_NUM_MESSAGES);
+
+ _pictures.clear();
+ stream.reset(createReadStream(_boot, 0x05, 0xe, 0x80));
+ loadPictures(*stream);
}
void HiRes4Engine::initGameState() {
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index 756ead93ce..c2843ea141 100644
--- a/engines/adl/hires6.cpp
+++ b/engines/adl/hires6.cpp
@@ -219,12 +219,7 @@ void HiRes6Engine::loadDisk(byte disk) {
case 0x4a80: {
// Global pics
_pictures.clear();
- byte picNr;
- while ((picNr = stream->readByte()) != 0xff) {
- if (stream->eos() || stream->err())
- error("Error reading global pic list");
- _pictures[picNr] = readDataBlockPtr(*stream);
- }
+ loadPictures(*stream);
break;
}
case 0x4000: