ADL: Load hires4 global pictures

This commit is contained in:
Walter van Niftrik 2016-08-28 13:46:11 +02:00
parent 9dc3c78827
commit 90d2dd3b40
6 changed files with 22 additions and 20 deletions

View File

@ -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()");

View File

@ -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);

View File

@ -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));

View File

@ -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));

View File

@ -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() {

View File

@ -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: