ADL: Load hires2 room data

This commit is contained in:
Walter van Niftrik 2016-03-10 20:47:30 +01:00 committed by Walter van Niftrik
parent fe384e0ae0
commit c44f18a818
4 changed files with 27 additions and 1 deletions

View file

@ -80,6 +80,9 @@ struct AdlGameDescription;
struct Room {
byte description;
byte connections[6];
byte track;
byte sector;
byte offset;
byte picture;
byte curPicture;
};

View file

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

View file

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

View file

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