diff options
Diffstat (limited to 'engines/lure/strings.cpp')
| -rw-r--r-- | engines/lure/strings.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/engines/lure/strings.cpp b/engines/lure/strings.cpp index 9868b34e87..c9a643a1de 100644 --- a/engines/lure/strings.cpp +++ b/engines/lure/strings.cpp @@ -22,6 +22,7 @@ #include "lure/strings.h" #include "lure/disk.h" +#include "lure/res.h" #include "lure/room.h" #include "common/endian.h" @@ -261,9 +262,13 @@ char StringData::readCharacter() { } void StringData::getString(uint16 stringId, char *dest, const char *hotspotName, - const char *actionName) { + const char *characterName) { char ch; + strcpy(dest, ""); char *destPos = dest; + stringId &= 0x1fff; // Strip off any article identifier + if (stringId == 0) return; + initPosition(stringId); ch = readCharacter(); @@ -271,7 +276,7 @@ void StringData::getString(uint16 stringId, char *dest, const char *hotspotName, if (ch == '%') { // Copy over hotspot or action ch = readCharacter(); - const char *p = (ch == '1') ? hotspotName : actionName; + const char *p = (ch == '1') ? hotspotName : characterName; strcpy(destPos, p); destPos += strlen(p); } else if ((uint8) ch >= 0xa0) { @@ -300,4 +305,13 @@ char *StringData::getName(uint8 nameIndex) { return (char *) (_names->data() + nameStart); } +// getStringWithArticle +// Fills a buffer with the string specified by a given string Id with a definite article prefix + +void StringData::getStringWithArticle(uint16 stringId, char *dest) { + const char *articles[4] = {"the ", "a ", "an ", ""}; + strcpy(dest, articles[stringId >> 14]); + getString(stringId, dest + strlen(dest)); +} + } // namespace Lure |
