aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWalter van Niftrik2016-04-19 11:02:15 +0200
committerWalter van Niftrik2016-06-06 20:35:49 +0200
commitf8d75bbc8642ffe3baa56220c05f37eae31c3829 (patch)
treea1fdd99df280512bd713e452bad6fc6341c102c6 /engines
parentd435f5b4ebd0d2fe0a8d8ac260d69fb67ed7650f (diff)
downloadscummvm-rg350-f8d75bbc8642ffe3baa56220c05f37eae31c3829.tar.gz
scummvm-rg350-f8d75bbc8642ffe3baa56220c05f37eae31c3829.tar.bz2
scummvm-rg350-f8d75bbc8642ffe3baa56220c05f37eae31c3829.zip
ADL: Implement hires6 verb/noun error messages
Diffstat (limited to 'engines')
-rw-r--r--engines/adl/adl.cpp28
-rw-r--r--engines/adl/adl.h2
-rw-r--r--engines/adl/hires6.cpp37
-rw-r--r--engines/adl/hires6.h2
4 files changed, 59 insertions, 10 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index de2edde7a2..f9d04b7a2d 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -855,6 +855,22 @@ Common::String AdlEngine::getWord(const Common::String &line, uint &index) const
}
}
+Common::String AdlEngine::formatVerbError(const Common::String &verbStr) const {
+ Common::String err = _strings.verbError;
+ for (uint i = 0; i < verbStr.size(); ++i)
+ err.setChar(verbStr[i], i + 19);
+ return err;
+}
+
+Common::String AdlEngine::formatNounError(const Common::String &verbStr, const Common::String &nounStr) const {
+ Common::String err = _strings.nounError;
+ for (uint i = 0; i < verbStr.size(); ++i)
+ err.setChar(verbStr[i], i + 19);
+ for (uint i = 0; i < nounStr.size(); ++i)
+ err.setChar(nounStr[i], i + 30);
+ return err;
+}
+
void AdlEngine::getInput(uint &verb, uint &noun) {
while (1) {
_display->printString(_strings.enterCommand);
@@ -867,10 +883,7 @@ void AdlEngine::getInput(uint &verb, uint &noun) {
Common::String verbStr = getWord(line, index);
if (!_verbs.contains(verbStr)) {
- Common::String err = _strings.verbError;
- for (uint i = 0; i < verbStr.size(); ++i)
- err.setChar(verbStr[i], i + 19);
- _display->printString(err);
+ _display->printString(formatVerbError(verbStr));
continue;
}
@@ -879,12 +892,7 @@ void AdlEngine::getInput(uint &verb, uint &noun) {
Common::String nounStr = getWord(line, index);
if (!_nouns.contains(nounStr)) {
- Common::String err = _strings.nounError;
- for (uint i = 0; i < verbStr.size(); ++i)
- err.setChar(verbStr[i], i + 19);
- for (uint i = 0; i < nounStr.size(); ++i)
- err.setChar(nounStr[i], i + 30);
- _display->printString(err);
+ _display->printString(formatNounError(verbStr, nounStr));
continue;
}
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index a23f6b73c6..9b6a7eac60 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -234,6 +234,8 @@ protected:
Common::String inputString(byte prompt = 0) const;
byte inputKey(bool showCursor = true) const;
+ virtual Common::String formatVerbError(const Common::String &verbStr) const;
+ virtual Common::String formatNounError(const Common::String &verbStr, const Common::String &nounStr) const;
void loadWords(Common::ReadStream &stream, WordMap &map, Common::StringArray &pri) const;
void readCommands(Common::ReadStream &stream, Commands &commands);
void checkInput(byte verb, byte noun);
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index c44a917a1b..d743d1ace4 100644
--- a/engines/adl/hires6.cpp
+++ b/engines/adl/hires6.cpp
@@ -363,6 +363,43 @@ void HiRes6Engine::showRoom() {
_linesPrinted = 0;
}
+Common::String HiRes6Engine::formatVerbError(const Common::String &verbStr) const {
+ Common::String err = _strings.verbError;
+
+ for (uint i = 0; i < verbStr.size(); ++i)
+ err.setChar(verbStr[i], i + 24);
+
+ err.setChar(APPLECHAR(' '), 32);
+
+ uint i = 24;
+ while (err[i] != APPLECHAR(' '))
+ ++i;
+
+ err.setChar(APPLECHAR('.'), i);
+
+ return err;
+}
+
+Common::String HiRes6Engine::formatNounError(const Common::String &verbStr, const Common::String &nounStr) const {
+ Common::String err = _strings.nounError;
+
+ for (uint i = 0; i < nounStr.size(); ++i)
+ err.setChar(nounStr[i], i + 24);
+
+ for (uint i = 35; i > 31; --i)
+ err.setChar(APPLECHAR(' '), i);
+
+ uint i = 24;
+ while (err[i] != APPLECHAR(' '))
+ ++i;
+
+ err.setChar(APPLECHAR('I'), i + 1);
+ err.setChar(APPLECHAR('S'), i + 2);
+ err.setChar(APPLECHAR('.'), i + 3);
+
+ return err;
+}
+
void HiRes6Engine::printString(const Common::String &str) {
Common::String s;
uint found = 0;
diff --git a/engines/adl/hires6.h b/engines/adl/hires6.h
index 27aa95675d..439d688ded 100644
--- a/engines/adl/hires6.h
+++ b/engines/adl/hires6.h
@@ -74,6 +74,8 @@ private:
void initGameState();
void printRoomDescription();
void showRoom();
+ Common::String formatVerbError(const Common::String &verbStr) const;
+ Common::String formatNounError(const Common::String &verbStr, const Common::String &nounStr) const;
// AdlEngine_v2
void printString(const Common::String &str);