[Scummvm-cvs-logs] SF.net SVN: scummvm: [29775] scummvm/trunk/engines/lure/hotspots.cpp

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun Dec 9 11:08:41 CET 2007


Revision: 29775
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29775&view=rev
Author:   dreammaster
Date:     2007-12-09 02:08:41 -0800 (Sun, 09 Dec 2007)

Log Message:
-----------
Added code to set ACTIVE_HOTSPOT_ID and USE_HOTSPOT_ID fields correctly when an action is performed

Modified Paths:
--------------
    scummvm/trunk/engines/lure/hotspots.cpp

Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2007-12-09 06:06:22 UTC (rev 29774)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2007-12-09 10:08:41 UTC (rev 29775)
@@ -1207,6 +1207,17 @@
 	debugC(ERROR_INTERMEDIATE, kLureDebugHotspots,  "Action charId=%xh Action=%d/%s", 
 		_hotspotId, (int)action, stringList.getString((int)action));
 
+	// Set the ACTIVE_HOTSPOT_ID and USE_HOTSPOT_ID fields
+	if (hotspot != NULL) {
+		ValueTableData &fields = Resources::getReference().fieldList();
+		fields.setField(ACTIVE_HOTSPOT_ID, hotspot->hotspotId);
+		if ((action == USE) || (action == GIVE) || (action == ASK)) {
+			fields.setField(USE_HOTSPOT_ID, _currentActions.top().supportData().param(1));
+		} else {
+			fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId);
+		}
+	}
+
 	ActionProcPtr actionProcList[NPC_JUMP_ADDRESS + 1] = {
 		&Hotspot::doNothing, 
 		&Hotspot::doGet, 
@@ -1446,9 +1457,6 @@
 	Resources &res = Resources::getReference();
 	uint16 usedId = _currentActions.top().supportData().param(1);
 	HotspotData *usedHotspot = res.getHotspot(usedId);
-	ValueTableData &fields = res.fieldList();
-	fields.setField(ACTIVE_HOTSPOT_ID, hotspot->hotspotId);
-	fields.setField(USE_HOTSPOT_ID, usedHotspot->hotspotId);
 	_data->useHotspotId = usedId;
 
 	if (usedHotspot->roomNumber != hotspotId()) {
@@ -1490,9 +1498,6 @@
 	Resources &res = Resources::getReference();
 	uint16 usedId = _currentActions.top().supportData().param(1);
 	HotspotData *usedHotspot = res.getHotspot(usedId);
-	ValueTableData &fields = res.fieldList();
-	fields.setField(ACTIVE_HOTSPOT_ID, hotspot->hotspotId);
-	fields.setField(USE_HOTSPOT_ID, usedId);
 	_data->useHotspotId = usedId;
 
 	if (usedHotspot->roomNumber != hotspotId()) {
@@ -1523,7 +1528,7 @@
 		sequenceOffset = Script::execute(sequenceOffset);
 		if (sequenceOffset == NOONE_ID) {
 			// Start a conversation based on the index of field #6
-			uint16 index = fields.getField(GIVE_TALK_INDEX);
+			uint16 index = res.fieldList().getField(GIVE_TALK_INDEX);
 			uint16 id = res.getGiveTalkId(index);
 			startTalk(hotspot, id);
 
@@ -1673,13 +1678,10 @@
 
 void Hotspot::doAsk(HotspotData *hotspot) {
 	Resources &res = Resources::getReference();
-	ValueTableData &fields = res.fieldList();
 	uint16 usedId = _currentActions.top().supportData().param(1);
 	Hotspot *destCharacter = res.getActiveHotspot(hotspot->hotspotId);
 	assert(destCharacter);
 	HotspotData *usedHotspot = res.getHotspot(usedId);
-	fields.setField(ACTIVE_HOTSPOT_ID, hotspot->hotspotId);
-	fields.setField(USE_HOTSPOT_ID, usedId);
 	_data->useHotspotId = usedId;
 
 	HotspotPrecheckResult result = actionPrecheck(hotspot);


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