[Scummvm-cvs-logs] SF.net SVN: scummvm: [23689] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Mon Aug 7 15:13:31 CEST 2006
Revision: 23689
Author: dreammaster
Date: 2006-08-07 06:13:20 -0700 (Mon, 07 Aug 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=23689&view=rev
Log Message:
-----------
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)
Modified Paths:
--------------
scummvm/trunk/engines/lure/strings.cpp
scummvm/trunk/engines/lure/strings.h
Modified: scummvm/trunk/engines/lure/strings.cpp
===================================================================
--- scummvm/trunk/engines/lure/strings.cpp 2006-08-07 13:11:32 UTC (rev 23688)
+++ scummvm/trunk/engines/lure/strings.cpp 2006-08-07 13:13:20 UTC (rev 23689)
@@ -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 @@
}
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 @@
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 @@
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
Modified: scummvm/trunk/engines/lure/strings.h
===================================================================
--- scummvm/trunk/engines/lure/strings.h 2006-08-07 13:11:32 UTC (rev 23688)
+++ scummvm/trunk/engines/lure/strings.h 2006-08-07 13:13:20 UTC (rev 23689)
@@ -58,10 +58,11 @@
~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);
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list