aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/objects.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2015-06-14 17:52:11 +0200
committerMartin Kiewitz2015-06-14 17:52:11 +0200
commit1b6a60f359eb20130f34a8f79bfe9e5d4ea25b5a (patch)
tree760c80f31b1013d9a58a5d8445e04e766dd0fb18 /engines/sherlock/objects.cpp
parentb26bc296194c3a745fa9d222862ce1ad12a13e3e (diff)
downloadscummvm-rg350-1b6a60f359eb20130f34a8f79bfe9e5d4ea25b5a.tar.gz
scummvm-rg350-1b6a60f359eb20130f34a8f79bfe9e5d4ea25b5a.tar.bz2
scummvm-rg350-1b6a60f359eb20130f34a8f79bfe9e5d4ea25b5a.zip
SHERLOCK: action processing uses fixed text class
action error messages are now localized too
Diffstat (limited to 'engines/sherlock/objects.cpp')
-rw-r--r--engines/sherlock/objects.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 0d330370e7..21ab01dea3 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -348,7 +348,7 @@ void BaseObject::checkObject() {
} else if (v < USE_COUNT) {
for (int idx = 0; idx < NAMES_COUNT; ++idx) {
- checkNameForCodes(_use[v]._names[idx], nullptr);
+ checkNameForCodes(_use[v]._names[idx]);
}
if (_use[v]._useFlag)
@@ -488,7 +488,8 @@ void BaseObject::setObjSequence(int seq, bool wait) {
}
}
-int BaseObject::checkNameForCodes(const Common::String &name, const char *const messages[]) {
+int BaseObject::checkNameForCodes(const Common::String &name, FixedTextActionId fixedTextActionId) {
+ FixedText &fixedText = *_vm->_fixedText;
People &people = *_vm->_people;
Scene &scene = *_vm->_scene;
Screen &screen = *_vm->_screen;
@@ -571,7 +572,8 @@ int BaseObject::checkNameForCodes(const Common::String &name, const char *const
int messageNum = atoi(name.c_str() + 1);
ui._infoFlag = true;
ui.clearInfo();
- screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", messages[messageNum]);
+ Common::String errorMessage = fixedText.getActionMessage(fixedTextActionId, messageNum);
+ screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, errorMessage.c_str());
ui._menuCounter = 25;
} else if (name.hasPrefix("@")) {
// Message attached to canimation
@@ -1413,7 +1415,8 @@ void Object::adjustObject() {
}
}
-int Object::pickUpObject(const char *const messages[]) {
+int Object::pickUpObject(FixedTextActionId fixedTextActionId) {
+ FixedText &fixedText = *_vm->_fixedText;
Inventory &inv = *_vm->_inventory;
People &people = *_vm->_people;
Scene &scene = *_vm->_scene;
@@ -1426,7 +1429,7 @@ int Object::pickUpObject(const char *const messages[]) {
if (pickup == 99) {
for (int idx = 0; idx < NAMES_COUNT && !talk._talkToAbort; ++idx) {
- if (checkNameForCodes(_use[0]._names[idx], nullptr)) {
+ if (checkNameForCodes(_use[0]._names[idx], kFixedTextAction_Invalid)) {
if (!talk._talkToAbort)
printed = true;
}
@@ -1442,7 +1445,8 @@ int Object::pickUpObject(const char *const messages[]) {
ui._infoFlag = true;
ui.clearInfo();
- screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, "%s", messages[message]);
+ Common::String errorMessage = fixedText.getActionMessage(fixedTextActionId, message);
+ screen.print(Common::Point(0, INFO_LINE + 1), INFO_FOREGROUND, errorMessage.c_str());
ui._menuCounter = 30;
} else {
// Pick it up
@@ -1473,7 +1477,7 @@ int Object::pickUpObject(const char *const messages[]) {
}
for (int idx = 0; idx < NAMES_COUNT && !talk._talkToAbort; ++idx) {
- if (checkNameForCodes(_use[0]._names[idx], nullptr)) {
+ if (checkNameForCodes(_use[0]._names[idx], kFixedTextAction_Invalid)) {
if (!talk._talkToAbort)
printed = true;
}