[Scummvm-cvs-logs] SF.net SVN: scummvm: [26491] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Sun Apr 15 14:12:22 CEST 2007
Revision: 26491
http://scummvm.svn.sourceforge.net/scummvm/?rev=26491&view=rev
Author: dreammaster
Date: 2007-04-15 05:12:21 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
Altered message display to correctly handle optional display of hotspot/character article prefixes
Modified Paths:
--------------
scummvm/trunk/engines/lure/strings.cpp
scummvm/trunk/engines/lure/strings.h
scummvm/trunk/engines/lure/surface.cpp
Modified: scummvm/trunk/engines/lure/strings.cpp
===================================================================
--- scummvm/trunk/engines/lure/strings.cpp 2007-04-15 12:04:47 UTC (rev 26490)
+++ scummvm/trunk/engines/lure/strings.cpp 2007-04-15 12:12:21 UTC (rev 26491)
@@ -180,7 +180,7 @@
return result;
}
-void StringData::initPosition(uint16 stringId) {
+bool StringData::initPosition(uint16 stringId) {
uint16 roomNumber = Room::getReference().roomNumber();
byte *stringTable;
@@ -234,7 +234,7 @@
if (readBit() == 0) break;
_srcPos += 2;
}
- readBit();
+ return readBit() != 0;
}
// readCharatcer
@@ -262,14 +262,15 @@
}
void StringData::getString(uint16 stringId, char *dest, const char *hotspotName,
- const char *characterName) {
+ const char *characterName, int hotspotArticle, int characterArticle) {
+ const char *articles[4] = {"the ", "a ", "an ", ""};
char ch;
strcpy(dest, "");
char *destPos = dest;
stringId &= 0x1fff; // Strip off any article identifier
if (stringId == 0) return;
- initPosition(stringId);
+ bool includeArticles = initPosition(stringId);
ch = readCharacter();
while (ch != '\0') {
@@ -277,9 +278,12 @@
// Copy over hotspot or action
ch = readCharacter();
const char *p = (ch == '1') ? hotspotName : characterName;
+ int article = !includeArticles ? 3 : ((ch == 1) ? hotspotArticle : characterArticle);
+
if (p != NULL) {
- strcpy(destPos, p);
- destPos += strlen(p);
+ strcpy(destPos, articles[article]);
+ strcat(destPos, p);
+ destPos += strlen(destPos);
}
} else if ((uint8) ch >= 0xa0) {
const char *p = getName((uint8) ch - 0xa0);
@@ -307,13 +311,4 @@
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 2007-04-15 12:04:47 UTC (rev 26490)
+++ scummvm/trunk/engines/lure/strings.h 2007-04-15 12:12:21 UTC (rev 26491)
@@ -50,7 +50,7 @@
byte _bitMask;
void add(const char *sequence, char ascii);
- void initPosition(uint16 stringId);
+ bool initPosition(uint16 stringId);
char readCharacter();
byte readBit();
public:
@@ -58,11 +58,11 @@
~StringData();
static StringData &getReference();
- void getString(uint16 stringId, char *dest, const char *hotspotName, const char *characterName);
+ void getString(uint16 stringId, char *dest, const char *hotspotName, const char *characterName,
+ int hotspotArticle = 3, int characterArticle = 3);
void getString(uint16 stringId, char *dest) {
getString(stringId, dest, NULL, NULL);
}
- void getStringWithArticle(uint16 stringId, char *dest);
char *getName(uint8 nameIndex);
};
Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp 2007-04-15 12:04:47 UTC (rev 26490)
+++ scummvm/trunk/engines/lure/surface.cpp 2007-04-15 12:12:21 UTC (rev 26491)
@@ -504,6 +504,7 @@
char srcCharName[MAX_DESC_SIZE];
char destCharName[MAX_DESC_SIZE];
char itemName[MAX_DESC_SIZE];
+ int characterArticle, hotspotArticle = 3;
HotspotData *talkingChar = res.getHotspot(characterId);
HotspotData *destCharacter = (destCharacterId == 0) ? NULL :
@@ -512,16 +513,19 @@
res.getHotspot(activeItemId);
assert(talkingChar);
- strings.getString(talkingChar->nameId, srcCharName);
+ strings.getString(talkingChar->nameId & 0x1fff, srcCharName);
+ characterArticle = talkingChar->nameId >> 14;
strcpy(destCharName, "");
if (destCharacter != NULL)
strings.getString(destCharacter->nameId, destCharName);
strcpy(itemName, "");
- if (itemHotspot != NULL)
- strings.getStringWithArticle(itemHotspot->nameId, itemName);
+ if (itemHotspot != NULL) {
+ strings.getString(itemHotspot->nameId & 0x1fff, itemName);
+ hotspotArticle = itemHotspot->nameId >> 14;
+ }
- strings.getString(descId, _desc, itemName, destCharName);
+ strings.getString(descId, _desc, itemName, destCharName, hotspotArticle, characterArticle);
// Apply word wrapping to figure out the needed size of the dialog
Surface::wordWrap(_desc, TALK_DIALOG_WIDTH - (TALK_DIALOG_EDGE_SIZE + 3) * 2,
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