aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2006-08-07 13:13:20 +0000
committerPaul Gilbert2006-08-07 13:13:20 +0000
commitba32b916889f59045d796eec962081acc3f03250 (patch)
treeea350c4d28a45f6919d3e8e70fd54585e0df1069
parentbdff0ae58a025ba31f06da1ab660cc15e5ea1834 (diff)
downloadscummvm-rg350-ba32b916889f59045d796eec962081acc3f03250.tar.gz
scummvm-rg350-ba32b916889f59045d796eec962081acc3f03250.tar.bz2
scummvm-rg350-ba32b916889f59045d796eec962081acc3f03250.zip
Fixed signature of GetString method - it is a destination character passed, not the current action. Also added a new method to return a decoded string with the correct definite article prefix (a/an/the)
svn-id: r23689
-rw-r--r--engines/lure/strings.cpp18
-rw-r--r--engines/lure/strings.h3
2 files changed, 18 insertions, 3 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
diff --git a/engines/lure/strings.h b/engines/lure/strings.h
index f718b0c872..8c89ae5419 100644
--- a/engines/lure/strings.h
+++ b/engines/lure/strings.h
@@ -58,10 +58,11 @@ public:
~StringData();
static StringData &getReference();
- void getString(uint16 stringId, char *dest, const char *hotspotName, const char *actionName);
+ void getString(uint16 stringId, char *dest, const char *hotspotName, const char *characterName);
void getString(uint16 stringId, char *dest) {
getString(stringId, dest, NULL, NULL);
}
+ void getStringWithArticle(uint16 stringId, char *dest);
char *getName(uint8 nameIndex);
};