[Scummvm-cvs-logs] SF.net SVN: scummvm:[48656] scummvm/trunk/engines/lure/hotspots.cpp
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Wed Apr 14 11:33:27 CEST 2010
Revision: 48656
http://scummvm.svn.sourceforge.net/scummvm/?rev=48656&view=rev
Author: dreammaster
Date: 2010-04-14 09:33:27 +0000 (Wed, 14 Apr 2010)
Log Message:
-----------
Added a default case for characters that don't have a message set, but try to display one
Modified Paths:
--------------
scummvm/trunk/engines/lure/hotspots.cpp
Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp 2010-04-13 19:30:09 UTC (rev 48655)
+++ scummvm/trunk/engines/lure/hotspots.cpp 2010-04-14 09:33:27 UTC (rev 48656)
@@ -765,16 +765,25 @@
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;
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