aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter van Niftrik2016-03-15 23:18:43 +0100
committerWalter van Niftrik2016-06-06 20:35:49 +0200
commit0a6b7fb6a6414caa4d8654a75e07b6a33ef6cce3 (patch)
tree968f64649194a0ed437aaec36927cb1fd306a3a4
parent1e5fff86c875958408f3a5532451139626a4dc56 (diff)
downloadscummvm-rg350-0a6b7fb6a6414caa4d8654a75e07b6a33ef6cce3.tar.gz
scummvm-rg350-0a6b7fb6a6414caa4d8654a75e07b6a33ef6cce3.tar.bz2
scummvm-rg350-0a6b7fb6a6414caa4d8654a75e07b6a33ef6cce3.zip
ADL: Add loading of room picture index for hires2
-rw-r--r--engines/adl/hires2.cpp44
-rw-r--r--engines/adl/hires2.h3
2 files changed, 34 insertions, 13 deletions
diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp
index f44dfc4a2b..226a8e33da 100644
--- a/engines/adl/hires2.cpp
+++ b/engines/adl/hires2.cpp
@@ -110,17 +110,31 @@ void HiRes2Engine::initState() {
f.readByte(); // always 1, possibly disk?
_state.rooms.push_back(room);
}
-
- loadRoom(_state.room);
}
-void HiRes2Engine::loadRoom(uint i) {
+void HiRes2Engine::loadRoom(byte roomNr) {
Common::File f;
openFile(f, IDS_HR2_DISK_IMAGE);
- Room &room = getRoom(i);
+ Room &room = getRoom(roomNr);
uint offset = TSO(room.track, room.sector, room.offset);
f.seek(offset);
- _roomData.description = readStringAt(f, offset + f.readByte(), 0xff);
+ uint16 descOffset = f.readUint16LE();
+ /* uint16 commandOffset =*/ f.readUint16LE();
+
+ // 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) {
+ Picture2 pic;
+ pic.nr = f.readByte();
+ pic.track = f.readByte();
+ pic.sector = f.readByte();
+ pic.offset = f.readByte();
+ f.readByte();
+ _roomData.pictures.push_back(pic);
+ }
+ _roomData.description = readStringAt(f, offset + descOffset, 0xff);
}
void HiRes2Engine::restartGame() {
@@ -128,18 +142,24 @@ void HiRes2Engine::restartGame() {
}
void HiRes2Engine::drawPic(byte pic, Common::Point pos) const {
- // Temp hack to show a pic
-
- Common::File f;
- openFile(f, IDS_HR2_DISK_IMAGE);
- f.seek(0x1000);
+ Common::Array<Picture2>::const_iterator roomPic;
+
+ for (roomPic = _roomData.pictures.begin(); roomPic != _roomData.pictures.end(); ++roomPic) {
+ if (roomPic->nr == pic) {
+ Common::File f;
+ openFile(f, IDS_HR2_DISK_IMAGE);
+ f.seek(TSO(roomPic->track, roomPic->sector, roomPic->offset));
+ _graphics->drawPic(f, pos, 0);
+ }
+ }
- _graphics->drawPic(f, pos, 0);
+ // Check global pic list here
}
void HiRes2Engine::showRoom() {
+ loadRoom(_state.room);
_linesPrinted = 0;
- drawPic(0, Common::Point());
+ drawPic(getCurRoom().curPicture, Common::Point());
_display->updateHiResScreen();
printString(_roomData.description);
}
diff --git a/engines/adl/hires2.h b/engines/adl/hires2.h
index d88e43a5a6..58831c497d 100644
--- a/engines/adl/hires2.h
+++ b/engines/adl/hires2.h
@@ -64,6 +64,7 @@ namespace Adl {
#define IDI_HR2_OFS_STR_PRESS_RETURN TSO(0x1a, 0x8, 0x5f)
struct Picture2 {
+ byte nr;
byte track;
byte sector;
byte offset;
@@ -89,7 +90,7 @@ private:
void showRoom();
void printMessage(uint idx, bool wait);
- void loadRoom(uint i);
+ void loadRoom(byte roomNr);
void checkTextOverflow(char c);
void printString(const Common::String &str);