aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/util.cpp24
-rw-r--r--engines/wage/wage.cpp36
-rw-r--r--engines/wage/wage.h3
3 files changed, 62 insertions, 1 deletions
diff --git a/engines/wage/util.cpp b/engines/wage/util.cpp
index 8dac0d2935..1390c496ce 100644
--- a/engines/wage/util.cpp
+++ b/engines/wage/util.cpp
@@ -99,4 +99,28 @@ const char *getIndefiniteArticle(String &word) {
return "a ";
}
+enum {
+ GENDER_HE = 0,
+ GENDER_SHE = 1,
+ GENDER_IT = 2
+};
+
+const char *prependGenderSpecificPronoun(int gender) {
+ if (gender == GENDER_HE)
+ return "his ";
+ else if (gender == GENDER_SHE)
+ return "her ";
+ else
+ return "its ";
+}
+
+const char *getGenderSpecificPronoun(int gender, bool capitalize) {
+ if (gender == GENDER_HE)
+ return capitalize ? "He" : "he";
+ else if (gender == GENDER_SHE)
+ return capitalize ? "She" : "she";
+ else
+ return capitalize ? "It" : "it";
+}
+
} // End of namespace Wage
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 5841b470b4..d87a7c1413 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -360,7 +360,41 @@ void WageEngine::onMove(Designed *what, Designed *from, Designed *to) {
}
void WageEngine::encounter(Chr *player, Chr *chr) {
- warning("STUB WageEngine::encounter()");
+ Common::String msg("You encounter ");
+ if (!chr->_nameProperNoun)
+ msg += getIndefiniteArticle(chr->_name);
+ msg += chr->_name;
+ msg += ".";
+ appendText(msg);
+
+ if (!chr->_initialComment.empty())
+ appendText(chr->_initialComment);
+
+ if (chr->_armor[Chr::HEAD_ARMOR] != NULL) {
+ msg = chr->getNameWithDefiniteArticle(true);
+ msg += " is wearing ";
+ msg += getIndefiniteArticle(chr->_armor[Chr::HEAD_ARMOR]->_name);
+ msg += ".";
+ appendText(msg);
+ }
+ if (chr->_armor[Chr::BODY_ARMOR] != NULL) {
+ msg = getGenderSpecificPronoun(chr->_gender, true);
+ msg += " is protected by ";
+ msg += prependGenderSpecificPronoun(chr->_gender);
+ msg += chr->_armor[Chr::BODY_ARMOR]->_name;
+ msg += ".";
+ appendText(msg);
+ }
+ if (chr->_armor[Chr::SHIELD_ARMOR] != NULL) {
+ Obj *obj = chr->_armor[Chr::SHIELD_ARMOR];
+ msg = getGenderSpecificPronoun(chr->_gender, true);
+ msg += " carries ";
+ if (!obj->_namePlural)
+ msg += getIndefiniteArticle(obj->_name);
+ msg += obj->_name;
+ msg += ".";
+ appendText(msg);
+ }
}
void WageEngine::performCombatAction(Chr *npc, Chr *player) {
diff --git a/engines/wage/wage.h b/engines/wage/wage.h
index 91d940470b..bbf3b991ab 100644
--- a/engines/wage/wage.h
+++ b/engines/wage/wage.h
@@ -99,6 +99,9 @@ enum {
Common::String readPascalString(Common::SeekableReadStream *in);
Common::Rect *readRect(Common::SeekableReadStream *in);
const char *getIndefiniteArticle(String &word);
+const char *prependGenderSpecificPronoun(int gender);
+const char *getGenderSpecificPronoun(int gender, bool capitalize);
+
typedef Common::Array<byte *> Patterns;