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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun May 27 06:33:21 CEST 2007


Revision: 26955
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26955&view=rev
Author:   dreammaster
Date:     2007-05-26 21:33:19 -0700 (Sat, 26 May 2007)

Log Message:
-----------
Reworked game saving so that restored games don't fire off hotspot activation scripts, and conversation bugfix to keep characters in place

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

Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2007-05-27 03:18:18 UTC (rev 26954)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2007-05-27 04:33:19 UTC (rev 26955)
@@ -867,7 +867,7 @@
 				setDelayCtr(4);
 			}
 
-			hotspot->talkGate = 0x2A;
+			hotspot->talkGate = GENERAL_MAGIC_ID;
 			hotspot->talkDestCharacterId = _hotspotId;
 			return PC_WAIT;
 		} 
@@ -2024,6 +2024,7 @@
 	
 	// Signal the character that they're being talked to
 	charHotspot->talkDestCharacterId = _hotspotId;
+	charHotspot->talkGate = 0;
 	_data->talkDestCharacterId = charHotspot->hotspotId;
 	_data->talkGate = 0;
 	
@@ -2067,6 +2068,7 @@
 	stream->writeUint16LE(_blockedOffset);
 	stream->writeUint16LE(_exitCtr);
 	stream->writeByte(_walkFlag);
+	stream->writeByte(_persistant);
 	stream->writeUint16LE(_startRoomNumber);
 	stream->writeUint16LE(_supportValue);
 }
@@ -2103,6 +2105,7 @@
 	_blockedOffset = stream->readUint16LE();
 	_exitCtr = stream->readUint16LE();
 	_walkFlag = stream->readByte() != 0;
+	_persistant = stream->readByte() != 0;
 	_startRoomNumber = stream->readUint16LE();
 	_supportValue = stream->readUint16LE();
 }
@@ -2214,7 +2217,7 @@
 	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) {
+		if (h.talkGate() == GENERAL_MAGIC_ID) {
 			fields.setField(ACTIVE_HOTSPOT_ID, h.talkGate());
 			fields.setField(USE_HOTSPOT_ID, h.resource()->talkDestCharacterId);
 			Script::execute(h.talkScript());
@@ -3142,9 +3145,13 @@
 			if ((entry->preSequenceId & 0x8000) != 0) break;
 		}
 
-		if (showSelections && (numLines > 1))
+		if (showSelections && (numLines > 1)) {
 			res.setTalkState(TALK_SELECT);
-		else {
+
+			// Make sure the dest character holds still while an option is selected
+			HotspotData *destHotspot = res.getHotspot(talkDestCharacter);
+			destHotspot->talkDestCharacterId = h.hotspotId();
+		} else {
 			res.setTalkState(TALK_RESPOND);
 			res.setTalkSelection(1);
 		}
@@ -4457,17 +4464,21 @@
 			Hotspot *destHotspot = res.getActiveHotspot(destHotspotId);
 			assert(destHotspot);
 			hotspot = new Hotspot(destHotspot, hotspotId);
-			res.addHotspot(hotspot);
 		}
 		else
 		{
-			hotspot = res.activateHotspot(hotspotId);
+			HotspotData *hotspotData = res.getHotspot(hotspotId);
+			assert(hotspotData);
+			hotspot = new Hotspot(hotspotData);
 		}
+
+		res.addHotspot(hotspot);
 		assert(hotspot);
+		hotspot->loadFromStream(stream);
 
-		hotspot->loadFromStream(stream);
 		debugC(ERROR_DETAILED, kLureDebugAnimations, "Loaded hotspot %xh", hotspotId);
 
+		// Get the next hotspot
 		hotspotId = stream->readUint16LE();
 	}
 }

Modified: scummvm/trunk/engines/lure/lure.cpp
===================================================================
--- scummvm/trunk/engines/lure/lure.cpp	2007-05-27 03:18:18 UTC (rev 26954)
+++ scummvm/trunk/engines/lure/lure.cpp	2007-05-27 04:33:19 UTC (rev 26955)
@@ -141,8 +141,8 @@
 	f->writeString(caption);
 	f->writeByte(0); // End of string terminator
 
+	Resources::getReference().saveToStream(f);
 	Room::getReference().saveToStream(f);
-	Resources::getReference().saveToStream(f);
 
 	delete f;
 	return true;
@@ -182,8 +182,8 @@
 	while (f->readByte() != 0) ;
 
 	// Load in the data
+	Resources::getReference().loadFromStream(f);
 	Room::getReference().loadFromStream(f);
-	Resources::getReference().loadFromStream(f);
 
 	delete f;
 	return true;

Modified: scummvm/trunk/engines/lure/luredefs.h
===================================================================
--- scummvm/trunk/engines/lure/luredefs.h	2007-05-27 03:18:18 UTC (rev 26954)
+++ scummvm/trunk/engines/lure/luredefs.h	2007-05-27 04:33:19 UTC (rev 26955)
@@ -259,6 +259,7 @@
 #define TALK_RESPONSE_MAGIC_ID 0x1092
 
 // Misc constants
+#define GENERAL_MAGIC_ID 42
 #define VOICE_ANIM_ID 0x5810
 #define PUZZLED_ANIM_ID 0x8001
 #define EXCLAMATION_ANIM_ID 0x8002


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