diff options
author | Paul Gilbert | 2014-05-11 22:41:01 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-05-11 22:41:01 -0400 |
commit | 604bca43de0c19e64689ce6e12ad3f854549100c (patch) | |
tree | 3eface0c5e991c6e523ece3d0bffc9649d18cac8 /engines/mads/nebular/dialogs_nebular.cpp | |
parent | 5e13514d28df811dfcd4f1829b327ce8606ed5ee (diff) | |
download | scummvm-rg350-604bca43de0c19e64689ce6e12ad3f854549100c.tar.gz scummvm-rg350-604bca43de0c19e64689ce6e12ad3f854549100c.tar.bz2 scummvm-rg350-604bca43de0c19e64689ce6e12ad3f854549100c.zip |
MADS: Implement the dialog textNoun method
Diffstat (limited to 'engines/mads/nebular/dialogs_nebular.cpp')
-rw-r--r-- | engines/mads/nebular/dialogs_nebular.cpp | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 8b6418e928..ff2249a3b3 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -195,10 +195,49 @@ Common::String DialogsNebular::getVocab(int vocabId) { return vocab; } -bool DialogsNebular::textNoun(Common::String &dialogText, int nounNum, - const Common::String &valStr) { - error("TODO: textNoun"); - return false; +bool DialogsNebular::textNoun(Common::String &dest, int nounId, const Common::String &source) { + // Ensure the destination has parameter specifications + if (!source.hasPrefix(":")) + return false; + + // Extract the first (singular) result value + Common::String param1 = Common::String(source.c_str() + 1); + Common::String param2; + const char *sepChar = strchr(source.c_str() + 1, ':'); + if (sepChar) { + param1 = Common::String(source.c_str() + 1, sepChar); + + // Get the second, plural form + param2 = Common::String(sepChar + 1); + } + + // Get the vocab to use + MADSAction &action = _vm->_game->_scene._action; + Common::String vocab = _vm->_dialogs->getVocab(action._activeAction._verbId); + Common::String *str; + + if (vocab.hasSuffix("s") || vocab.hasSuffix("S")) { + str = ¶m2; + } else { + str = ¶m1; + + if (param1 == "a ") { + switch (toupper(vocab[0])) { + case 'A': + case 'E': + case 'I': + case 'O': + case 'U': + param1 = "an "; + break; + default: + break; + } + } + } + + dest += *str; + return true; } bool DialogsNebular::commandCheck(const char *idStr, Common::String &valStr, |