aboutsummaryrefslogtreecommitdiff
path: root/engines/adl
diff options
context:
space:
mode:
authorWalter van Niftrik2016-04-13 22:01:15 +0200
committerWalter van Niftrik2016-06-06 20:35:49 +0200
commite79f26c9bcda2c08ef7a7628960c71cff336daaf (patch)
tree4ab8b528befc9e6cbf3fb7815851bd86819693b2 /engines/adl
parentd2175a70ce3873e09f9f7b7bc84dcc1b614ae054 (diff)
downloadscummvm-rg350-e79f26c9bcda2c08ef7a7628960c71cff336daaf.tar.gz
scummvm-rg350-e79f26c9bcda2c08ef7a7628960c71cff336daaf.tar.bz2
scummvm-rg350-e79f26c9bcda2c08ef7a7628960c71cff336daaf.zip
ADL: Implement hires6 item descriptions
Diffstat (limited to 'engines/adl')
-rw-r--r--engines/adl/adl.cpp7
-rw-r--r--engines/adl/adl.h1
-rw-r--r--engines/adl/adl_v3.cpp4
-rw-r--r--engines/adl/adl_v3.h3
-rw-r--r--engines/adl/console.cpp8
-rw-r--r--engines/adl/hires6.cpp8
-rw-r--r--engines/adl/hires6.h1
7 files changed, 25 insertions, 7 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index edcd804aee..c17855d47c 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -127,6 +127,13 @@ void AdlEngine::printMessage(uint idx) {
printString(loadMessage(idx));
}
+Common::String AdlEngine::getItemDescription(const Item &item) const {
+ if (item.description > 0)
+ return loadMessage(item.description);
+ else
+ return Common::String();
+}
+
void AdlEngine::delay(uint32 ms) const {
uint32 start = g_system->getMillis();
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index 0cf9024339..a23f6b73c6 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -228,6 +228,7 @@ protected:
virtual void printString(const Common::String &str) = 0;
virtual Common::String loadMessage(uint idx) const = 0;
virtual void printMessage(uint idx);
+ virtual Common::String getItemDescription(const Item &item) const;
void delay(uint32 ms) const;
Common::String inputString(byte prompt = 0) const;
diff --git a/engines/adl/adl_v3.cpp b/engines/adl/adl_v3.cpp
index 4f2b3449ee..d0e924296e 100644
--- a/engines/adl/adl_v3.cpp
+++ b/engines/adl/adl_v3.cpp
@@ -45,6 +45,10 @@ Common::String AdlEngine_v3::loadMessage(uint idx) const {
return str;
}
+Common::String AdlEngine_v3::getItemDescription(const Item &item) const {
+ return _itemDesc[item.id - 1];
+}
+
typedef Common::Functor1Mem<ScriptEnv &, int, AdlEngine_v3> OpcodeV3;
#define SetOpcodeTable(x) table = &x;
#define Opcode(x) table->push_back(new OpcodeV3(this, &AdlEngine_v3::x))
diff --git a/engines/adl/adl_v3.h b/engines/adl/adl_v3.h
index 7d4790f045..f022adf3b7 100644
--- a/engines/adl/adl_v3.h
+++ b/engines/adl/adl_v3.h
@@ -44,13 +44,14 @@ protected:
// AdlEngine
virtual void setupOpcodeTables();
virtual Common::String loadMessage(uint idx) const;
+ Common::String getItemDescription(const Item &item) const;
int o3_isVarGT(ScriptEnv &e);
int o3_isItemInRoom(ScriptEnv &e);
int o3_isNounNotInRoom(ScriptEnv &e);
int o3_skipOneCommand(ScriptEnv &e);
-private:
+ Common::Array<Common::String> _itemDesc;
byte _curDisk;
};
diff --git a/engines/adl/console.cpp b/engines/adl/console.cpp
index 0415bcd506..c35e8b02aa 100644
--- a/engines/adl/console.cpp
+++ b/engines/adl/console.cpp
@@ -299,11 +299,9 @@ void Console::printItem(const Item &item) {
if (item.noun > 0)
name = _engine->_priNouns[item.noun - 1];
- if (item.description > 0) {
- desc = toAscii(_engine->loadMessage(item.description));
- if (desc.lastChar() == '\r')
- desc.deleteLastChar();
- }
+ desc = toAscii(_engine->getItemDescription(item));
+ if (desc.lastChar() == '\r')
+ desc.deleteLastChar();
switch (item.state) {
case IDI_ITEM_NOT_MOVED:
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index 7f6de17f65..eaf468c3cc 100644
--- a/engines/adl/hires6.cpp
+++ b/engines/adl/hires6.cpp
@@ -115,7 +115,7 @@ void HiRes6Engine::init() {
if (!boot->open(disks[0]))
error("Failed to open disk image '%s'", disks[0]);
- StreamPtr stream(loadSectors(boot, 7));
+ StreamPtr stream(loadSectors(boot, 0x7));
// Read parser messages
_strings.verbError = readStringAt(*stream, 0x666);
@@ -139,6 +139,12 @@ void HiRes6Engine::init() {
_messageIds.itemNotHere = IDI_HR6_MSG_ITEM_NOT_HERE;
_messageIds.thanksForPlaying = IDI_HR6_MSG_THANKS_FOR_PLAYING;
+ // Item descriptions
+ stream.reset(loadSectors(boot, 0x6, 0xb, 2));
+ stream->seek(0x34);
+ for (uint i = 0; i < IDI_HR6_NUM_ITEM_DESCS; ++i)
+ _itemDesc.push_back(readString(*stream, 0xff));
+
// Load dropped item offsets
stream.reset(boot->createReadStream(0x8, 0x9, 0x16));
for (uint i = 0; i < IDI_HR6_NUM_ITEM_OFFSETS; ++i) {
diff --git a/engines/adl/hires6.h b/engines/adl/hires6.h
index 9f886aaeb7..443a9ca5a9 100644
--- a/engines/adl/hires6.h
+++ b/engines/adl/hires6.h
@@ -38,6 +38,7 @@ namespace Adl {
#define IDI_HR6_NUM_ROOMS 35
#define IDI_HR6_NUM_MESSAGES 256
#define IDI_HR6_NUM_VARS 40
+#define IDI_HR6_NUM_ITEM_DESCS 15
#define IDI_HR6_NUM_ITEM_PICS 15
#define IDI_HR6_NUM_ITEM_OFFSETS 16