From c44f18a818c36bf714cf59b1a56589b138842503 Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Thu, 10 Mar 2016 20:47:30 +0100 Subject: ADL: Load hires2 room data --- engines/adl/adl.h | 3 +++ engines/adl/hires1.cpp | 2 +- engines/adl/hires2.cpp | 21 +++++++++++++++++++++ engines/adl/hires2.h | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/engines/adl/adl.h b/engines/adl/adl.h index df917b1868..abdbaff28a 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -80,6 +80,9 @@ struct AdlGameDescription; struct Room { byte description; byte connections[6]; + byte track; + byte sector; + byte offset; byte picture; byte curPicture; }; diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp index c77504497e..4bdf47a1a6 100644 --- a/engines/adl/hires1.cpp +++ b/engines/adl/hires1.cpp @@ -242,7 +242,7 @@ void HiRes1Engine::initState() { _roomDesc.clear(); f.seek(IDI_HR1_OFS_ROOMS); for (uint i = 0; i < IDI_HR1_NUM_ROOMS; ++i) { - Room room; + Room room = { }; f.readByte(); _roomDesc.push_back(f.readByte()); for (uint j = 0; j < 6; ++j) diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp index 44abc22bca..4f8ba48837 100644 --- a/engines/adl/hires2.cpp +++ b/engines/adl/hires2.cpp @@ -64,6 +64,27 @@ void HiRes2Engine::loadData() { } void HiRes2Engine::initState() { + Common::File f; + + if (!f.open(IDS_HR2_DISK_IMAGE)) + error("Failed to open file '" IDS_HR2_DISK_IMAGE "'"); + + _state.rooms.clear(); + f.seek(IDI_HR2_OFS_ROOMS); + for (uint i = 0; i < IDI_HR2_NUM_ROOMS; ++i) { + Room room = { }; + f.readByte(); // number + for (uint j = 0; j < 6; ++j) + room.connections[j] = f.readByte(); + room.track = f.readByte(); + room.sector = f.readByte(); + room.offset = f.readByte(); + f.readByte(); // always 1, possibly disk? + room.picture = f.readByte(); + room.curPicture = f.readByte(); + f.readByte(); // always 1, possibly disk? + _state.rooms.push_back(room); + } } void HiRes2Engine::restartGame() { diff --git a/engines/adl/hires2.h b/engines/adl/hires2.h index e37af5a4b2..01bb29f2e5 100644 --- a/engines/adl/hires2.h +++ b/engines/adl/hires2.h @@ -44,6 +44,8 @@ namespace Adl { #define IDI_HR2_OFS_INTRO_TEXT TSO(0x00, 0xd, 0x17) #define IDI_HR2_OFS_VERBS T(0x19) #define IDI_HR2_OFS_NOUNS TS(0x22, 0x2) +#define IDI_HR2_OFS_ROOMS TSO(0x21, 0x5, 0x0e) // Skip bogus room 0 +#define IDI_HR2_NUM_ROOMS 135 class HiRes2Engine : public AdlEngine { public: -- cgit v1.2.3