aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter van Niftrik2016-03-16 23:12:31 +0100
committerWalter van Niftrik2016-06-06 20:35:49 +0200
commita653fa2f459957029978f14618ff634ec3485cf8 (patch)
tree72cdc23c15f6ddaeaaea3f1169bc296955e60bb8
parent0593460b1bd1d70e3848f1d5195d83384c347c92 (diff)
downloadscummvm-rg350-a653fa2f459957029978f14618ff634ec3485cf8.tar.gz
scummvm-rg350-a653fa2f459957029978f14618ff634ec3485cf8.tar.bz2
scummvm-rg350-a653fa2f459957029978f14618ff634ec3485cf8.zip
ADL: Add partial hires2 item drawing
-rw-r--r--engines/adl/graphics_v2.cpp26
-rw-r--r--engines/adl/hires1.cpp2
-rw-r--r--engines/adl/hires2.cpp47
-rw-r--r--engines/adl/hires2.h5
4 files changed, 66 insertions, 14 deletions
diff --git a/engines/adl/graphics_v2.cpp b/engines/adl/graphics_v2.cpp
index d829b9526e..c705b9ce6f 100644
--- a/engines/adl/graphics_v2.cpp
+++ b/engines/adl/graphics_v2.cpp
@@ -235,6 +235,8 @@ void Graphics_v2::fill(Common::SeekableReadStream &pic) {
}
void Graphics_v2::drawPic(Common::SeekableReadStream &pic, const Common::Point &pos, byte color) {
+ _color = color;
+
while (true) {
byte opcode = pic.readByte();
@@ -260,6 +262,30 @@ void Graphics_v2::drawPic(Common::SeekableReadStream &pic, const Common::Point &
case 0xe5:
clear();
break;
+ case 0xf0:
+ _color = 0x00;
+ break;
+ case 0xf1:
+ _color = 0x2a;
+ break;
+ case 0xf2:
+ _color = 0x55;
+ break;
+ case 0xf3:
+ _color = 0x7f;
+ break;
+ case 0xf4:
+ _color = 0x80;
+ break;
+ case 0xf5:
+ _color = 0xaa;
+ break;
+ case 0xf6:
+ _color = 0xd5;
+ break;
+ case 0xf7:
+ _color = 0xff;
+ break;
case 0xff:
return;
default:
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index 368b08cbb3..9527d4e8aa 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -237,7 +237,7 @@ void HiRes1Engine::initState() {
_state.items.clear();
f.seek(IDI_HR1_OFS_ITEMS);
while (f.readByte() != 0xff) {
- Item item;
+ Item item = { };
item.noun = f.readByte();
item.room = f.readByte();
item.picture = f.readByte();
diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp
index be2e016bb4..e5475201de 100644
--- a/engines/adl/hires2.cpp
+++ b/engines/adl/hires2.cpp
@@ -32,6 +32,14 @@
namespace Adl {
+static void readPictureMeta(Common::ReadStream &f, Picture2 &pic) {
+ pic.nr = f.readByte();
+ pic.track = f.readByte();
+ pic.sector = f.readByte();
+ pic.offset = f.readByte();
+ f.readByte();
+}
+
void HiRes2Engine::runIntro() const {
Common::File f;
openFile(f, IDS_HR2_DISK_IMAGE);
@@ -83,6 +91,14 @@ void HiRes2Engine::init() {
_messageIds.itemNotHere = IDI_HR2_MSG_ITEM_NOT_HERE;
_messageIds.thanksForPlaying = IDI_HR2_MSG_THANKS_FOR_PLAYING;
+ // Load item picture data
+ f.seek(IDI_HR2_OFS_ITEM_PICS);
+ for (uint i = 0; i < IDI_HR2_NUM_ITEM_PICS; ++i) {
+ Picture2 pic;
+ readPictureMeta(f, pic);
+ _itemPics.push_back(pic);
+ }
+
// Load commands from executable
f.seek(IDI_HR2_OFS_CMDS_1);
readCommands(f, _roomCommands);
@@ -124,7 +140,7 @@ void HiRes2Engine::initState() {
_state.items.clear();
f.seek(IDI_HR2_OFS_ITEMS);
while (f.readByte() != 0xff) {
- Item item;
+ Item item = { };
item.noun = f.readByte();
item.room = f.readByte();
item.picture = f.readByte();
@@ -134,17 +150,17 @@ void HiRes2Engine::initState() {
item.state = f.readByte();
item.description = f.readByte();
- f.readByte();
+ f.readByte(); // Struct size
- byte size = f.readByte();
+ byte picListSize = f.readByte();
+
+ // Flag to keep track of what has been drawn on the screen
+ f.readByte();
- for (uint i = 0; i < size; ++i)
+ for (uint i = 0; i < picListSize; ++i)
item.roomPictures.push_back(f.readByte());
_state.items.push_back(item);
-
- // One unknown extra byte compared to hires1
- f.readByte();
}
}
@@ -163,11 +179,7 @@ void HiRes2Engine::loadRoom(byte roomNr) {
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();
+ readPictureMeta(f, pic);
_roomData.pictures.push_back(pic);
}
@@ -191,15 +203,26 @@ void HiRes2Engine::drawPic(byte pic, Common::Point pos) const {
openFile(f, IDS_HR2_DISK_IMAGE);
f.seek(TSO(roomPic->track, roomPic->sector, roomPic->offset));
_graphics->drawPic(f, pos, 0);
+ return;
}
}
// Check global pic list here
}
+void HiRes2Engine::drawItem(const Item &item, const Common::Point &pos) const {
+ const Picture2 &pic = _itemPics[item.picture - 1];
+ Common::File f;
+ openFile(f, IDS_HR2_DISK_IMAGE);
+ f.seek(TSO(pic.track, pic.sector, pic.offset));
+ f.readByte(); // Skip clear opcode
+ _graphics->drawPic(f, pos, 0);
+}
+
void HiRes2Engine::showRoom() {
loadRoom(_state.room);
drawPic(getCurRoom().curPicture, Common::Point());
+ drawItems();
_display->updateHiResScreen();
printString(_roomData.description);
_linesPrinted = 0;
diff --git a/engines/adl/hires2.h b/engines/adl/hires2.h
index 6c7904bfaa..631b3418cc 100644
--- a/engines/adl/hires2.h
+++ b/engines/adl/hires2.h
@@ -46,6 +46,7 @@ namespace Adl {
#define IDI_HR2_OFS_NOUNS TS(0x22, 0x2)
#define IDI_HR2_OFS_ROOMS TSO(0x21, 0x5, 0x0e) // Skip bogus room 0
#define IDI_HR2_OFS_MESSAGES TSO(0x1f, 0x2, 0x04) // Skip bogus message 0
+#define IDI_HR2_OFS_ITEM_PICS TSO(0x1e, 0x9, 0x05) // Skip bogus pic 0
#define IDI_HR2_OFS_ITEMS T(0x21)
#define IDI_HR2_OFS_CMDS_0 TS(0x1f, 0x7)
@@ -54,6 +55,7 @@ namespace Adl {
#define IDI_HR2_NUM_ROOMS 135
#define IDI_HR2_NUM_MESSAGES 254
#define IDI_HR2_NUM_VARS 40
+#define IDI_HR2_NUM_ITEM_PICS 38
// Messages used outside of scripts
#define IDI_HR2_MSG_CANT_GO_THERE 123
@@ -92,7 +94,7 @@ private:
void initState();
void restartGame();
void drawPic(byte pic, Common::Point pos) const;
- void drawItem(const Item &item, const Common::Point &pos) const { }
+ void drawItem(const Item &item, const Common::Point &pos) const;
void showRoom();
void printMessage(uint idx, bool wait);
void checkInput(byte verb, byte noun);
@@ -102,6 +104,7 @@ private:
void printString(const Common::String &str);
RoomData _roomData;
+ Common::Array<Picture2> _itemPics;
uint _linesPrinted;
};