aboutsummaryrefslogtreecommitdiff
path: root/engines/lure/hotspots.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2010-04-14 09:33:27 +0000
committerPaul Gilbert2010-04-14 09:33:27 +0000
commitcbee83a5363851d6ec35042417ffe653f329454c (patch)
tree881064329ed79b3afa1ea54a3da8f7c6483fe689 /engines/lure/hotspots.cpp
parenta71eb594677bf3631a6264e9b92bb1ac1ff4c8a6 (diff)
downloadscummvm-rg350-cbee83a5363851d6ec35042417ffe653f329454c.tar.gz
scummvm-rg350-cbee83a5363851d6ec35042417ffe653f329454c.tar.bz2
scummvm-rg350-cbee83a5363851d6ec35042417ffe653f329454c.zip
Added a default case for characters that don't have a message set, but try to display one
svn-id: r48656
Diffstat (limited to 'engines/lure/hotspots.cpp')
-rw-r--r--engines/lure/hotspots.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index d247c343ca..5a8a13e9ec 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -765,16 +765,25 @@ void Hotspot::showMessage(uint16 messageId, uint16 destCharacterId) {
char nameBuffer[MAX_HOTSPOT_NAME_SIZE];
MemoryBlock *data = res.messagesData();
Hotspot *hotspot;
- uint16 *v = (uint16 *) data->data();
+ uint8 *msgData = (uint8 *) data->data();
uint16 v2, idVal;
messageId &= 0x7fff;
// Skip through header to find table for given character
- while (READ_LE_UINT16(v) != hotspotId()) v += 2;
+ uint headerEnd = READ_LE_UINT16(msgData + 2);
+ uint idx = 0;
+ while ((idx < headerEnd) && (READ_LE_UINT16(msgData + idx) != hotspotId()))
+ idx += 2 * sizeof(uint16);
+
+ if (idx == headerEnd) {
+ // Given character doesn't have a message set, so fall back on a simple puzzled animation
+ hotspot = new Hotspot(this, PUZZLED_ANIM_IDX);
+ res.addHotspot(hotspot);
+ return;
+ }
// Scan through secondary list
- ++v;
- v = (uint16 *) (data->data() + READ_LE_UINT16(v));
+ uint16 *v = (uint16 *) (msgData + READ_LE_UINT16(msgData + idx + sizeof(uint16)));
v2 = 0;
while ((idVal = READ_LE_UINT16(v)) != 0xffff) {
++v;