aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter van Niftrik2016-04-09 13:29:34 +0200
committerWalter van Niftrik2016-06-06 20:35:49 +0200
commit1842d0c45f3b37442dcf94466589e0a4960bdc08 (patch)
tree049d34fa4f90e6c8fcda19183bc6cdbb8b795e71
parenta320b319eb385d3ceca16567215a7d7609247bb4 (diff)
downloadscummvm-rg350-1842d0c45f3b37442dcf94466589e0a4960bdc08.tar.gz
scummvm-rg350-1842d0c45f3b37442dcf94466589e0a4960bdc08.tar.bz2
scummvm-rg350-1842d0c45f3b37442dcf94466589e0a4960bdc08.zip
ADL: Add loadMessage function
-rw-r--r--engines/adl/adl.cpp6
-rw-r--r--engines/adl/adl.h1
-rw-r--r--engines/adl/hires1.cpp4
3 files changed, 6 insertions, 5 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 50e7af4fb6..37f1d04fad 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -123,7 +123,7 @@ void AdlEngine::openFile(Common::File &file, const Common::String &name) const {
}
void AdlEngine::printMessage(uint idx) {
- printString(_messages[idx - 1]);
+ printString(loadMessage(idx));
}
void AdlEngine::delay(uint32 ms) const {
@@ -1214,7 +1214,7 @@ Common::String AdlEngine::itemStr(uint i) const {
}
if (desc > 0) {
name += "/";
- name += toAscii(_messages[desc - 1]);
+ name += toAscii(loadMessage(desc));
}
return name;
}
@@ -1254,7 +1254,7 @@ Common::String AdlEngine::nounStr(uint i) const {
}
Common::String AdlEngine::msgStr(uint i) const {
- return Common::String::format("%d/%s", i, toAscii(_messages[i - 1]).c_str());
+ return Common::String::format("%d/%s", i, toAscii(loadMessage(i)).c_str());
}
Common::String AdlEngine::dirStr(Direction dir) const {
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index 1b6d02b895..68327690cd 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -226,6 +226,7 @@ protected:
void openFile(Common::File &file, const Common::String &name) const;
virtual void printString(const Common::String &str) = 0;
+ virtual Common::String loadMessage(uint idx) const { return _messages[idx - 1]; }
virtual void printMessage(uint idx);
void delay(uint32 ms) const;
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index cca2fe42e5..9193c27c04 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -268,7 +268,7 @@ void HiRes1Engine::printString(const Common::String &str) {
}
void HiRes1Engine::printMessage(uint idx) {
- const Common::String &msg = _messages[idx - 1];
+ const Common::String &msg = loadMessage(idx);
// Messages with hardcoded overrides don't delay after printing.
// It's unclear if this is a bug or not. In some cases the result
@@ -326,7 +326,7 @@ void HiRes1Engine::drawItem(Item &item, const Common::Point &pos) {
}
void HiRes1Engine::loadRoom(byte roomNr) {
- _roomData.description = _messages[_roomDesc[_state.room - 1] - 1];
+ _roomData.description = loadMessage(_roomDesc[_state.room - 1]);
}
void HiRes1Engine::showRoom() {