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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Thu Apr 19 08:46:58 CEST 2007


Revision: 26546
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26546&view=rev
Author:   dreammaster
Date:     2007-04-18 23:46:56 -0700 (Wed, 18 Apr 2007)

Log Message:
-----------
Added code to prevent NPCs from moving when being talked to

Modified Paths:
--------------
    scummvm/trunk/engines/lure/hotspots.cpp
    scummvm/trunk/engines/lure/hotspots.h
    scummvm/trunk/engines/lure/luredefs.h
    scummvm/trunk/engines/lure/res.cpp
    scummvm/trunk/engines/lure/res_struct.cpp
    scummvm/trunk/engines/lure/res_struct.h

Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2007-04-18 20:59:51 UTC (rev 26545)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2007-04-19 06:46:56 UTC (rev 26546)
@@ -659,12 +659,15 @@
 		// 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 @@
 		} 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 @@
 	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 @@
 	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 @@
 
 	// 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 @@
 						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 @@
 				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;

Modified: scummvm/trunk/engines/lure/hotspots.h
===================================================================
--- scummvm/trunk/engines/lure/hotspots.h	2007-04-18 20:59:51 UTC (rev 26545)
+++ scummvm/trunk/engines/lure/hotspots.h	2007-04-19 06:46:56 UTC (rev 26546)
@@ -459,13 +459,13 @@
 		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; }

Modified: scummvm/trunk/engines/lure/luredefs.h
===================================================================
--- scummvm/trunk/engines/lure/luredefs.h	2007-04-18 20:59:51 UTC (rev 26545)
+++ scummvm/trunk/engines/lure/luredefs.h	2007-04-19 06:46:56 UTC (rev 26546)
@@ -225,6 +225,7 @@
 #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

Modified: scummvm/trunk/engines/lure/res.cpp
===================================================================
--- scummvm/trunk/engines/lure/res.cpp	2007-04-18 20:59:51 UTC (rev 26545)
+++ scummvm/trunk/engines/lure/res.cpp	2007-04-19 06:46:56 UTC (rev 26546)
@@ -445,6 +445,13 @@
 		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; 

Modified: scummvm/trunk/engines/lure/res_struct.cpp
===================================================================
--- scummvm/trunk/engines/lure/res_struct.cpp	2007-04-18 20:59:51 UTC (rev 26545)
+++ scummvm/trunk/engines/lure/res_struct.cpp	2007-04-19 06:46:56 UTC (rev 26546)
@@ -339,9 +339,8 @@
 	talkMessageId = 0;
 	talkDestCharacterId = 0;
 	talkCountdown = 0;
-	pauseCtr = 0;
 	useHotspotId = 0;
-	v2b = 0;
+	pauseCtr = 0;
 	actionHotspotId = 0;
 	talkOverride = 0;
 }
@@ -381,7 +380,7 @@
 	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 @@
 	pauseCtr = stream->readUint16LE();
 	useHotspotId = stream->readUint16LE();
 	use2HotspotId = stream->readUint16LE();
-	v2b = stream->readUint16LE();
+	talkGate = stream->readUint16LE();
 	actionHotspotId = stream->readUint16LE();
 	talkOverride = stream->readUint16LE();
 }

Modified: scummvm/trunk/engines/lure/res_struct.h
===================================================================
--- scummvm/trunk/engines/lure/res_struct.h	2007-04-18 20:59:51 UTC (rev 26545)
+++ scummvm/trunk/engines/lure/res_struct.h	2007-04-19 06:46:56 UTC (rev 26546)
@@ -435,12 +435,13 @@
 	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; }


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