diff options
author | Paul Gilbert | 2007-04-19 06:46:56 +0000 |
---|---|---|
committer | Paul Gilbert | 2007-04-19 06:46:56 +0000 |
commit | fdea5abb34a8a00a4dfd02e8081aa550e43bedb7 (patch) | |
tree | 775eacf9de8bff7dfe7b48d783fc85937e8a93a9 /engines | |
parent | a3bde14ead0d99557b5f8fb241b2f70a54e0a718 (diff) | |
download | scummvm-rg350-fdea5abb34a8a00a4dfd02e8081aa550e43bedb7.tar.gz scummvm-rg350-fdea5abb34a8a00a4dfd02e8081aa550e43bedb7.tar.bz2 scummvm-rg350-fdea5abb34a8a00a4dfd02e8081aa550e43bedb7.zip |
Added code to prevent NPCs from moving when being talked to
svn-id: r26546
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lure/hotspots.cpp | 30 | ||||
-rw-r--r-- | engines/lure/hotspots.h | 8 | ||||
-rw-r--r-- | engines/lure/luredefs.h | 1 | ||||
-rw-r--r-- | engines/lure/res.cpp | 7 | ||||
-rw-r--r-- | engines/lure/res_struct.cpp | 7 | ||||
-rw-r--r-- | engines/lure/res_struct.h | 7 |
6 files changed, 35 insertions, 25 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 232112e95b..5cf58e2ebb 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -659,12 +659,15 @@ void Hotspot::converse(uint16 destCharacterId, uint16 messageId, bool standStill // in case the destination is already in process of talking HotspotData *hotspot = Resources::getReference().getHotspot(destCharacterId); _data->talkCountdown += hotspot->talkCountdown; + + _data->talkDestCharacterId = _hotspotId; + _data->talkGate = 0; } if (standStill) { setDelayCtr(_data->talkCountdown); _data->characterMode = CHARMODE_CONVERSING; - //TODO: HS[3Eh]=use_hotspot_id, HS[40h]=active_hotspot_id + //TODO: HS[3Eh]=character_hotspot_id, HS[40h]=active_hotspot_id } } @@ -845,8 +848,8 @@ HotspotPrecheckResult Hotspot::actionPrecheck(HotspotData *hotspot) { } else if (hotspot->actionHotspotId != _hotspotId) { if (fields.getField(88) == 2) { // loc_882 - hotspot->v2b = 0x2A; - hotspot->useHotspotId = _hotspotId; + hotspot->talkGate = 0x2A; + hotspot->talkDestCharacterId = _hotspotId; return PC_WAIT; } else { converse(NOONE_ID, 5); @@ -1349,7 +1352,7 @@ void Hotspot::doGive(HotspotData *hotspot) { endAction(); if ((hotspot->hotspotId != PRISONER_ID) || (usedId != BOTTLE_HOTSPOT_ID)) - showMessage(7); + showMessage(7, hotspot->hotspotId); uint16 sequenceOffset = res.getHotspotAction(hotspot->actionsOffset, GIVE); @@ -1380,7 +1383,7 @@ void Hotspot::doTalkTo(HotspotData *hotspot) { fields.setField(USE_HOTSPOT_ID, hotspot->hotspotId); if ((hotspot->hotspotId != SKORL_ID) && ((hotspot->roomNumber != 28) || - (hotspot->hotspotId != 0x3EB))) { + (hotspot->hotspotId != BLACKSMITH_ID))) { HotspotPrecheckResult result = actionPrecheck(hotspot); if (result == PC_WAIT) return; @@ -2156,14 +2159,14 @@ void HotspotTickHandlers::standardCharacterAnimHandler(Hotspot &h) { // Handle any active hotspot the character is using (for example, if the player is // talking to a character, this stops them from moving for the duration) - if (h.useHotspotId() != 0) { - debugC(ERROR_DETAILED, kLureDebugAnimations, "Use Hotspot Id = %xh, v2b = %d", - h.useHotspotId(), h.v2b()); - if (h.v2b() == 0x2A) { - fields.setField(ACTIVE_HOTSPOT_ID, h.v2b()); - fields.setField(USE_HOTSPOT_ID, h.useHotspotId()); + if (h.resource()->talkDestCharacterId != 0) { + debugC(ERROR_DETAILED, kLureDebugAnimations, "Use Hotspot Id = %xh, talk_gate = %d", + h.resource()->talkDestCharacterId, h.talkGate()); + if (h.talkGate() == 0x2A) { + fields.setField(ACTIVE_HOTSPOT_ID, h.talkGate()); + fields.setField(USE_HOTSPOT_ID, h.resource()->talkDestCharacterId); Script::execute(h.script()); - h.setUseHotspotId(0); + h.resource()->talkDestCharacterId = 0; } else { h.updateMovement(); return; @@ -3248,7 +3251,7 @@ void HotspotTickHandlers::barmanAnimHandler(Hotspot &h) { h.setFrameCtr(barEntry.currentCustomer->serveFlags); barEntry.currentCustomer->serveFlags &= 0xf8; - } else if (!h.useHotspotId() == 0) { + } else if (h.resource()->talkDestCharacterId == 0) { // Player is not currently talking // Clear entry from list barEntry.currentCustomer->hotspotId = 0; @@ -3271,7 +3274,6 @@ void HotspotTickHandlers::barmanAnimHandler(Hotspot &h) { barEntry.currentCustomer = &barEntry.customers[index]; Hotspot *hotspot = res.getActiveHotspot(barEntry.customers[index].hotspotId); assert(hotspot); -//DEBUG/TODO: Reaching here too early, so servee's x can be outside the bar range h.setSupportValue(hotspot->x()); // Save the position to move to h.setFrameCtr(0x80); // Flag for movement return; diff --git a/engines/lure/hotspots.h b/engines/lure/hotspots.h index 6fea355c6c..25c8247a8e 100644 --- a/engines/lure/hotspots.h +++ b/engines/lure/hotspots.h @@ -459,13 +459,13 @@ public: assert(_data); _data->useHotspotId = value; } - uint16 v2b() { + uint16 talkGate() { assert(_data); - return _data->v2b; + return _data->talkGate; } - void setV2b(uint16 value) { + void setTalkGate(uint16 value) { assert(_data); - _data->v2b = value; + _data->talkGate = value; } uint16 supportValue() { return _supportValue; } void setSupportValue(uint16 value) { _supportValue = value; } diff --git a/engines/lure/luredefs.h b/engines/lure/luredefs.h index 8c85ab46c8..33089bdbe1 100644 --- a/engines/lure/luredefs.h +++ b/engines/lure/luredefs.h @@ -225,6 +225,7 @@ enum Action { #define PLAYER_ID 0x3E8 #define RATPOUCH_ID 0x3E9 #define SKORL_ID 0x3EA +#define BLACKSMITH_ID 0x3EB #define GOEWIN_ID 0x3EF #define FIRST_NONCHARACTER_ID 0x408 #define SACK_ID 0x40D diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp index dc36e60f3e..c6517a3970 100644 --- a/engines/lure/res.cpp +++ b/engines/lure/res.cpp @@ -445,6 +445,13 @@ void Resources::setTalkingCharacter(uint16 id) { HotspotData *charHotspot = res.getHotspot(_talkingCharacter); assert(charHotspot); charHotspot->talkCountdown = 0; + + if (charHotspot->talkDestCharacterId != 0) { + HotspotData *destHotspot = res.getHotspot(charHotspot->talkDestCharacterId); + if (destHotspot != NULL) + destHotspot->talkDestCharacterId = 0; + } + charHotspot->talkDestCharacterId = 0; } _talkingCharacter = id; diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index f40c1cd397..3b2620dea6 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -339,9 +339,8 @@ HotspotData::HotspotData(HotspotResource *rec) { talkMessageId = 0; talkDestCharacterId = 0; talkCountdown = 0; - pauseCtr = 0; useHotspotId = 0; - v2b = 0; + pauseCtr = 0; actionHotspotId = 0; talkOverride = 0; } @@ -381,7 +380,7 @@ void HotspotData::saveToStream(WriteStream *stream) { stream->writeUint16LE(pauseCtr); stream->writeUint16LE(useHotspotId); stream->writeUint16LE(use2HotspotId); - stream->writeUint16LE(v2b); + stream->writeUint16LE(talkGate); stream->writeUint16LE(actionHotspotId); stream->writeUint16LE(talkOverride); } @@ -421,7 +420,7 @@ void HotspotData::loadFromStream(ReadStream *stream) { pauseCtr = stream->readUint16LE(); useHotspotId = stream->readUint16LE(); use2HotspotId = stream->readUint16LE(); - v2b = stream->readUint16LE(); + talkGate = stream->readUint16LE(); actionHotspotId = stream->readUint16LE(); talkOverride = stream->readUint16LE(); } diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h index 13c8dc16d1..ac3bd4d6cf 100644 --- a/engines/lure/res_struct.h +++ b/engines/lure/res_struct.h @@ -435,12 +435,13 @@ public: uint16 talkDestCharacterId; uint16 talkCountdown; uint16 pauseCtr; - uint16 useHotspotId; - uint16 use2HotspotId; - uint16 v2b; + uint16 useHotspotId; + uint16 talkGate; uint16 actionHotspotId; uint16 talkOverride; + uint16 use2HotspotId; + void enable() { flags |= 0x80; } void disable() { flags &= 0x7F; } Direction nonVisualDirection() { return (Direction) scriptLoadFlag; } |