aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2007-12-09 10:08:41 +0000
committerPaul Gilbert2007-12-09 10:08:41 +0000
commitf89dbfe91c6382acfce89c9636e760cc73b0bcb2 (patch)
treea6a609c48c0bf68c2e19f3184d9efaaf06a9670a /engines
parent770d0b88d67ad86e08f6dcaa6dab00e1897bda19 (diff)
downloadscummvm-rg350-f89dbfe91c6382acfce89c9636e760cc73b0bcb2.tar.gz
scummvm-rg350-f89dbfe91c6382acfce89c9636e760cc73b0bcb2.tar.bz2
scummvm-rg350-f89dbfe91c6382acfce89c9636e760cc73b0bcb2.zip
Added code to set ACTIVE_HOTSPOT_ID and USE_HOTSPOT_ID fields correctly when an action is performed
svn-id: r29775
Diffstat (limited to 'engines')
-rw-r--r--engines/lure/hotspots.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index 8ab90ddb9c..d514807792 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -1207,6 +1207,17 @@ void Hotspot::doAction(Action action, HotspotData *hotspot) {
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 @@ void Hotspot::doUse(HotspotData *hotspot) {
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 @@ void Hotspot::doGive(HotspotData *hotspot) {
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 @@ void Hotspot::doGive(HotspotData *hotspot) {
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::doLookAction(HotspotData *hotspot, Action action) {
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);