aboutsummaryrefslogtreecommitdiff
path: root/engines/lure
diff options
context:
space:
mode:
authorPaul Gilbert2007-02-14 02:37:53 +0000
committerPaul Gilbert2007-02-14 02:37:53 +0000
commit31c0cb7f13652e384682fe995d2afd947b7f642a (patch)
tree1d928c059d73c8a2424fcc044c7ffecf77339c78 /engines/lure
parent2ef15f51a7eb043f56d29db74afd3f87a9f19394 (diff)
downloadscummvm-rg350-31c0cb7f13652e384682fe995d2afd947b7f642a.tar.gz
scummvm-rg350-31c0cb7f13652e384682fe995d2afd947b7f642a.tar.bz2
scummvm-rg350-31c0cb7f13652e384682fe995d2afd947b7f642a.zip
Added proper support for showing a hotspot or character's name in dialogs where the message contains a placeholder mark for it
svn-id: r25582
Diffstat (limited to 'engines/lure')
-rw-r--r--engines/lure/hotspots.cpp16
-rw-r--r--engines/lure/hotspots.h2
-rw-r--r--engines/lure/surface.cpp8
-rw-r--r--engines/lure/surface.h1
4 files changed, 24 insertions, 3 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index b17eb1e82e..c628fa7baa 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -70,6 +70,7 @@ Hotspot::Hotspot(HotspotData *res): _pathFinder(this) {
_override = resources.getHotspotOverride(res->hotspotId);
setAnimation(_data->animRecordId);
_tickHandler = HotspotTickHandlers::getHandler(_data->tickProcOffset);
+ _nameBuffer[0] = '\0';
_frameCtr = 0;
_skipFlag = false;
@@ -156,6 +157,7 @@ Hotspot::Hotspot(Hotspot *character, uint16 objType): _pathFinder(this) {
_frameWidth = _width;
_frameStartsUsed = false;
+ _nameBuffer[0] = '\0';
}
Hotspot::~Hotspot() {
@@ -354,6 +356,15 @@ uint16 Hotspot::nameId() {
return _data->nameId;
}
+const char *Hotspot::getName()
+{
+ // If name hasn't been loaded yet, then do so
+ if (!_nameBuffer[0] && (nameId() != 0))
+ StringData::getReference().getString(nameId(), _nameBuffer);
+
+ return &_nameBuffer[0];
+}
+
void Hotspot::setPosition(int16 newX, int16 newY) {
_startX = newX;
_startY = newY;
@@ -670,7 +681,10 @@ void Hotspot::showMessage(uint16 messageId, uint16 destCharacterId) {
} else if (idVal >= 0x8000) {
// Handle string display
idVal &= 0x7fff;
- Dialog::show(idVal);
+ hotspot = res.getActiveHotspot(res.fieldList().getField(ACTIVE_HOTSPOT_ID));
+ const char *itemName = (hotspot == NULL) ? NULL : hotspot->getName();
+
+ Dialog::show(idVal, itemName, this->getName());
} else if (idVal != 0) {
// Handle message as a talking dialog (the character talking to themselves)
diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h
index 6d9b8cb8e7..b8a3f56d87 100644
--- a/engines/lure/hotspots.h
+++ b/engines/lure/hotspots.h
@@ -248,6 +248,7 @@ private:
uint16 _frameWidth;
bool _frameStartsUsed;
uint16 _frameStarts[MAX_NUM_FRAMES];
+ char _nameBuffer[MAX_HOTSPOT_NAME_SIZE];
// Runtime fields
uint16 _frameCtr;
@@ -356,6 +357,7 @@ public:
if (_data) _data->roomNumber = roomNum;
}
uint16 nameId();
+ const char *getName();
bool isActiveAnimation();
void setPosition(int16 newX, int16 newY);
void setDestPosition(int16 newX, int16 newY) { _destX = newX; _destY = newY; }
diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp
index 0065c608fc..54292ac460 100644
--- a/engines/lure/surface.cpp
+++ b/engines/lure/surface.cpp
@@ -485,14 +485,18 @@ void Dialog::show(const char *text) {
mouse.cursorOn();
}
-void Dialog::show(uint16 stringId) {
+void Dialog::show(uint16 stringId, const char *hotspotName, const char *characterName) {
char buffer[MAX_DESC_SIZE];
StringData &sl = StringData::getReference();
- sl.getString(stringId, buffer);
+ sl.getString(stringId, buffer, hotspotName, characterName);
show(buffer);
}
+void Dialog::show(uint16 stringId) {
+ show(stringId, NULL, NULL);
+}
+
/*--------------------------------------------------------------------------*/
TalkDialog::TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId) {
diff --git a/engines/lure/surface.h b/engines/lure/surface.h
index 95f776412b..cc737fafd0 100644
--- a/engines/lure/surface.h
+++ b/engines/lure/surface.h
@@ -76,6 +76,7 @@ public:
class Dialog {
public:
static void show(const char *text);
+ static void show(uint16 stringId, const char *hotspotName, const char *characterName);
static void show(uint16 stringId);
};