[Scummvm-cvs-logs] SF.net SVN: scummvm: [25582] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Wed Feb 14 03:37:54 CET 2007
Revision: 25582
http://scummvm.svn.sourceforge.net/scummvm/?rev=25582&view=rev
Author: dreammaster
Date: 2007-02-13 18:37:53 -0800 (Tue, 13 Feb 2007)
Log Message:
-----------
Added proper support for showing a hotspot or character's name in dialogs where the message contains a placeholder mark for it
Modified Paths:
--------------
scummvm/trunk/engines/lure/hotspots.cpp
scummvm/trunk/engines/lure/hotspots.h
scummvm/trunk/engines/lure/surface.cpp
scummvm/trunk/engines/lure/surface.h
Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp 2007-02-14 02:35:48 UTC (rev 25581)
+++ scummvm/trunk/engines/lure/hotspots.cpp 2007-02-14 02:37:53 UTC (rev 25582)
@@ -70,6 +70,7 @@
_override = resources.getHotspotOverride(res->hotspotId);
setAnimation(_data->animRecordId);
_tickHandler = HotspotTickHandlers::getHandler(_data->tickProcOffset);
+ _nameBuffer[0] = '\0';
_frameCtr = 0;
_skipFlag = false;
@@ -156,6 +157,7 @@
_frameWidth = _width;
_frameStartsUsed = false;
+ _nameBuffer[0] = '\0';
}
Hotspot::~Hotspot() {
@@ -354,6 +356,15 @@
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 @@
} 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)
Modified: scummvm/trunk/engines/lure/hotspots.h
===================================================================
--- scummvm/trunk/engines/lure/hotspots.h 2007-02-14 02:35:48 UTC (rev 25581)
+++ scummvm/trunk/engines/lure/hotspots.h 2007-02-14 02:37:53 UTC (rev 25582)
@@ -248,6 +248,7 @@
uint16 _frameWidth;
bool _frameStartsUsed;
uint16 _frameStarts[MAX_NUM_FRAMES];
+ char _nameBuffer[MAX_HOTSPOT_NAME_SIZE];
// Runtime fields
uint16 _frameCtr;
@@ -356,6 +357,7 @@
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; }
Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp 2007-02-14 02:35:48 UTC (rev 25581)
+++ scummvm/trunk/engines/lure/surface.cpp 2007-02-14 02:37:53 UTC (rev 25582)
@@ -485,14 +485,18 @@
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) {
Modified: scummvm/trunk/engines/lure/surface.h
===================================================================
--- scummvm/trunk/engines/lure/surface.h 2007-02-14 02:35:48 UTC (rev 25581)
+++ scummvm/trunk/engines/lure/surface.h 2007-02-14 02:37:53 UTC (rev 25582)
@@ -76,6 +76,7 @@
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);
};
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