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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun Apr 29 13:30:30 CEST 2007


Revision: 26675
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26675&view=rev
Author:   dreammaster
Date:     2007-04-29 04:30:29 -0700 (Sun, 29 Apr 2007)

Log Message:
-----------
Reworked hotspot actions so that talking to characters work properly

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

Modified: scummvm/trunk/engines/lure/debugger.cpp
===================================================================
--- scummvm/trunk/engines/lure/debugger.cpp	2007-04-29 11:28:13 UTC (rev 26674)
+++ scummvm/trunk/engines/lure/debugger.cpp	2007-04-29 11:30:29 UTC (rev 26675)
@@ -105,13 +105,12 @@
 
 bool Debugger::cmd_listRooms(int argc, const char **argv) {
 	RoomDataList &rooms = Resources::getReference().roomData();
-	RoomDataList::iterator i;
 	StringData &strings = StringData::getReference();
 	char buffer[MAX_DESC_SIZE];
 	int ctr = 0;
 
 	DebugPrintf("Available rooms are:\n");
-	for (i = rooms.begin(); i != rooms.end(); ++i) {
+	for (RoomDataList::iterator i = rooms.begin(); i != rooms.end(); ++i) {
 		RoomData *room = *i;
 		strings.getString(room->roomNumber, buffer);
 		// DEBUG: Explictly note the second drawbridge room as "Alt" for now
@@ -131,6 +130,18 @@
 	}
 	DebugPrintf("\n");
 	DebugPrintf("Current room: %d\n", Room::getReference().roomNumber());
+
+	Resources &res = Resources::getReference();
+	HotspotDataList &list = res.hotspotData();
+	for (HotspotDataList::iterator i = list.begin(); i != list.end(); ++i)
+	{
+		HotspotData *data = *i;
+		strings.getString(data->nameId, buffer);
+
+		DebugPrintf("%xh - %s\n", data->hotspotId, buffer);
+	}
+	DebugPrintf("\n");
+
 	return true;
 }
 
@@ -298,8 +309,8 @@
 		DebugPrintf("Talk bubble offset = %d,%d\n", hs->talkX, hs->talkY);
 		DebugPrintf("load offset = %xh, script load = %d\n", hs->loadOffset, hs->scriptLoadFlag);
 		DebugPrintf("Animation Id = %xh, Colour offset = %d\n", hs->animRecordId, hs->colourOffset);
-		DebugPrintf("Script offset = %xh, Tick Script offset = %xh\n", 
-			hs->sequenceOffset, hs->tickSequenceOffset);
+		DebugPrintf("Talk Script offset = %xh, Tick Script offset = %xh\n", 
+			hs->talkScriptOffset, hs->tickScriptOffset);
 		DebugPrintf("Tick Proc offset = %xh\n", hs->tickProcOffset);
 		DebugPrintf("Tick timeout = %d\n", hs->tickTimeout);
 		DebugPrintf("NPC Shcedule = %xh\n", hs->npcSchedule);

Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2007-04-29 11:28:13 UTC (rev 26674)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2007-04-29 11:30:29 UTC (rev 26675)
@@ -62,7 +62,7 @@
 	_talkX = res->talkX;
 	_talkY = res->talkY;
 	_layer = res->layer;
-	_sequenceOffset = res->sequenceOffset;
+	_hotspotScriptOffset = res->hotspotScriptOffset;
 	_tickCtr = res->tickTimeout;
 	_colourOffset = res->colourOffset;
 
@@ -404,7 +404,7 @@
 }
 
 bool Hotspot::executeScript() {
-	if (_data->sequenceOffset == 0xffff)
+	if (_data->hotspotScriptOffset == 0xffff)
 		return false;
 	else
 		return HotspotScript::execute(this);
@@ -672,7 +672,7 @@
 		HotspotData *hotspot = Resources::getReference().getHotspot(destCharacterId);
 		_data->talkCountdown += hotspot->talkCountdown;
 		
-		_data->talkDestCharacterId = _hotspotId;
+		_data->talkDestCharacterId = destCharacterId;
 		_data->talkGate = 0;
 	}
 
@@ -845,7 +845,7 @@
 		} else {
 			// loc_886
 			setActionCtr(0);
-			converse(NOONE_ID, 0xE);
+			showMessage(14, NOONE_ID);
 			return PC_FAILED;
 		}
 	} else {
@@ -860,7 +860,7 @@
 
 		} else if (hotspot->actionHotspotId != _hotspotId) {
 			if (fields.getField(82) != 2) {
-				converse(NOONE_ID, 5);
+				showMessage(5, hotspot->hotspotId);
 				setDelayCtr(4);
 			}
 
@@ -2019,7 +2019,7 @@
 	stream->writeUint16LE(_talkX);
 	stream->writeUint16LE(_talkY);
 	stream->writeByte(_layer);
-	stream->writeUint16LE(_sequenceOffset);
+	stream->writeUint16LE(_hotspotScriptOffset);
 	stream->writeUint16LE(_tickCtr);
 	stream->writeByte(_colourOffset);
 	stream->writeUint16LE(_animId);
@@ -2054,7 +2054,7 @@
 	_talkX = stream->readUint16LE();
 	_talkY = stream->readUint16LE();
 	_layer = stream->readByte();
-	_sequenceOffset = stream->readUint16LE();
+	_hotspotScriptOffset = stream->readUint16LE();
 	_tickCtr = stream->readUint16LE();
 	_colourOffset = stream->readByte();
 	setAnimation(stream->readUint16LE());
@@ -2180,7 +2180,7 @@
 		if (h.talkGate() == 0x2A) {
 			fields.setField(ACTIVE_HOTSPOT_ID, h.talkGate());
 			fields.setField(USE_HOTSPOT_ID, h.resource()->talkDestCharacterId);
-			Script::execute(h.script());
+			Script::execute(h.talkScript());
 			h.resource()->talkDestCharacterId = 0;
 		} else {
 			h.updateMovement();
@@ -2970,7 +2970,7 @@
 
 	if (h.executeScript()) {
 		// Signal that the tea is done
-		h.setScript(0xB82);
+		h.setHotspotScript(0xB82);
 		Resources::getReference().fieldList().setField(27, 1);
 	}
 }
@@ -2997,14 +2997,14 @@
 	if (h.actionCtr() != 0) {
 		if (h.executeScript() == 0) {
 			h.setActionCtr(0);
-			h.setScript(0x3E0);
+			h.setHotspotScript(0x3E0);
 		}
 		return;
 	}
 
 	if ((fields.getField(PRISONER_DEAD) == 0) && (rnd.getRandomNumber(65536) >= 6)) {
 		h.setActionCtr(1);
-		h.setScript(0x3F6);
+		h.setHotspotScript(0x3F6);
 	}
 }
 
@@ -3028,7 +3028,7 @@
 	if (h.executeScript()) {
 		// Script is done - set new script to one of two alternates randomly
 		Common::RandomSource rnd;
-		h.setScript(rnd.getRandomNumber(100) >= 50 ? 0x54 : 0); 
+		h.setHotspotScript(rnd.getRandomNumber(100) >= 50 ? 0x54 : 0); 
 		h.setFrameCtr(20 + rnd.getRandomNumber(63));
 	}
 }
@@ -3514,7 +3514,7 @@
 
 	switch (h.actionCtr()) {
 	case 1:
-		h.setScript(RACK_SERF_SCRIPT_ID_1);
+		h.setHotspotScript(RACK_SERF_SCRIPT_ID_1);
 		h.setActionCtr(2);
 		break;
 
@@ -3524,7 +3524,7 @@
 		break;
 
 	case 3:
-		h.setScript(RACK_SERF_SCRIPT_ID_2);
+		h.setHotspotScript(RACK_SERF_SCRIPT_ID_2);
 		h.setActionCtr(4);
 		h.setLayer(2);
 

Modified: scummvm/trunk/engines/lure/hotspots.h
===================================================================
--- scummvm/trunk/engines/lure/hotspots.h	2007-04-29 11:28:13 UTC (rev 26674)
+++ scummvm/trunk/engines/lure/hotspots.h	2007-04-29 11:30:29 UTC (rev 26675)
@@ -249,7 +249,7 @@
 	uint16 _frameNumber;
 	Direction _direction;
 	uint8 _layer;
-	uint16 _sequenceOffset;
+	uint16 _hotspotScriptOffset;
 	uint16 _tickCtr;
 	uint8 _colourOffset;
 	bool _persistant;
@@ -359,7 +359,11 @@
 	uint16 yCorrection() { return _yCorrection; }
 	uint16 charRectY() { return _charRectY; }
 	uint16 roomNumber() { return _roomNumber; }
-	uint16 script() { return _sequenceOffset; }
+	uint16 talkScript() { 
+		assert(_data);
+		return _data->talkScriptOffset; 
+	}
+	uint16 hotspotScript() { return _hotspotScriptOffset; }
 	uint8 layer() { return _layer; }
 	uint16 tickCtr() { return _tickCtr; }
 	bool skipFlag() { return _skipFlag; }
@@ -404,10 +408,10 @@
 	void setHeight(uint16 newHeight) { 
 		_height = newHeight;
 	}
-	void setScript(uint16 offset) {
+	void setHotspotScript(uint16 offset) {
 		assert(_data != NULL);
-		_sequenceOffset = offset;
-		_data->sequenceOffset = offset; 
+		_hotspotScriptOffset = offset;
+		_data->hotspotScriptOffset = offset; 
 	}
 	void setLayer(uint8 newLayer) {
 		assert(_data != NULL);

Modified: scummvm/trunk/engines/lure/luredefs.h
===================================================================
--- scummvm/trunk/engines/lure/luredefs.h	2007-04-29 11:28:13 UTC (rev 26674)
+++ scummvm/trunk/engines/lure/luredefs.h	2007-04-29 11:30:29 UTC (rev 26675)
@@ -31,7 +31,7 @@
 
 #define SUPPORT_FILENAME "lure.dat"
 #define LURE_DAT_MAJOR 1
-#define LURE_DAT_MINOR 18
+#define LURE_DAT_MINOR 19
 
 #define LURE_DEBUG 1
 

Modified: scummvm/trunk/engines/lure/res_struct.cpp
===================================================================
--- scummvm/trunk/engines/lure/res_struct.cpp	2007-04-29 11:28:13 UTC (rev 26674)
+++ scummvm/trunk/engines/lure/res_struct.cpp	2007-04-29 11:30:29 UTC (rev 26675)
@@ -321,10 +321,11 @@
 	talkY = rec->talkY;
 	colourOffset = FROM_LE_16(rec->colourOffset);
 	animRecordId = FROM_LE_16(rec->animRecordId);
-	sequenceOffset = FROM_LE_16(rec->sequenceOffset);
+	hotspotScriptOffset = FROM_LE_16(rec->hotspotScriptOffset);
+	talkScriptOffset = FROM_LE_16(rec->talkScriptOffset);
 	tickProcOffset = FROM_LE_16(rec->tickProcOffset);
 	tickTimeout = FROM_LE_16(rec->tickTimeout);
-	tickSequenceOffset = FROM_LE_16(rec->tickSequenceOffset);
+	tickScriptOffset = FROM_LE_16(rec->tickScriptOffset);
 	npcSchedule = FROM_LE_16(rec->npcSchedule);
 	characterMode = (CharacterMode) FROM_LE_16(rec->characterMode);
 	delayCtr = FROM_LE_16(rec->delayCtr);
@@ -362,10 +363,10 @@
 	stream->writeUint16LE(widthCopy);
 	stream->writeUint16LE(heightCopy);
 	stream->writeUint16LE(yCorrection);
-	stream->writeUint16LE(sequenceOffset);
+	stream->writeUint16LE(hotspotScriptOffset);
 	stream->writeUint16LE(tickProcOffset);
 	stream->writeUint16LE(tickTimeout);
-	stream->writeUint16LE(tickSequenceOffset);
+	stream->writeUint16LE(tickScriptOffset);
 	stream->writeUint16LE(characterMode);
 	stream->writeUint16LE(delayCtr);
 
@@ -402,10 +403,10 @@
 	widthCopy = stream->readUint16LE();
 	heightCopy = stream->readUint16LE();
 	yCorrection = stream->readUint16LE();
-	sequenceOffset = stream->readUint16LE();
+	hotspotScriptOffset = stream->readUint16LE();
 	tickProcOffset = stream->readUint16LE();
 	tickTimeout = stream->readUint16LE();
-	tickSequenceOffset = stream->readUint16LE();
+	tickScriptOffset = stream->readUint16LE();
 	characterMode = (CharacterMode) stream->readUint16LE();
 	delayCtr = stream->readUint16LE();
 

Modified: scummvm/trunk/engines/lure/res_struct.h
===================================================================
--- scummvm/trunk/engines/lure/res_struct.h	2007-04-29 11:28:13 UTC (rev 26674)
+++ scummvm/trunk/engines/lure/res_struct.h	2007-04-29 11:30:29 UTC (rev 26675)
@@ -78,10 +78,11 @@
 	int8 talkY;
 	uint16 colourOffset;
 	uint16 animRecordId;
-	uint16 sequenceOffset;
+	uint16 hotspotScriptOffset;
+	uint16 talkScriptOffset;
 	uint16 tickProcOffset;
 	uint16 tickTimeout;
-	uint16 tickSequenceOffset;
+	uint16 tickScriptOffset;
 	uint16 npcSchedule;
 	uint16 characterMode;
 	uint16 delayCtr;
@@ -416,10 +417,11 @@
 	int8 talkY;
 	uint16 colourOffset;
 	uint16 animRecordId;
-	uint16 sequenceOffset;
+	uint16 hotspotScriptOffset;
+	uint16 talkScriptOffset;
 	uint16 tickProcOffset;
 	uint16 tickTimeout;
-	uint16 tickSequenceOffset;
+	uint16 tickScriptOffset;
 	uint16 npcSchedule;
 	CharacterMode characterMode;
 	uint16 delayCtr;

Modified: scummvm/trunk/engines/lure/scripts.cpp
===================================================================
--- scummvm/trunk/engines/lure/scripts.cpp	2007-04-29 11:28:13 UTC (rev 26674)
+++ scummvm/trunk/engines/lure/scripts.cpp	2007-04-29 11:30:29 UTC (rev 26675)
@@ -59,7 +59,7 @@
 	uint16 offset = r.getHotspotScript(scriptIndex);
 	Hotspot *hotspot = r.getActiveHotspot(hotspotId);
 	assert(hotspot);
-	hotspot->setScript(offset);
+	hotspot->setHotspotScript(offset);
 }
 
 void Script::method2(uint16 v1, uint16 v2, uint16 v3) {
@@ -265,7 +265,7 @@
 	uint16 offset = r.getHotspotScript(scriptIndex);
 
 	Hotspot *hs = r.getActiveHotspot(charId);
-	hs->setScript(offset);
+	hs->setHotspotScript(offset);
 	hs->currentActions().top().setAction(EXEC_HOTSPOT_SCRIPT);
 	hs->setOccupied(true);
 }
@@ -359,7 +359,7 @@
 	
 	Hotspot *activeHotspot = res.addHotspot(TRANSFORM_ID);
 	activeHotspot->setFrameNumber(0);
-	activeHotspot->setScript(0x630);
+	activeHotspot->setHotspotScript(0x630);
 }
 
 // Marks the jail door in room 14 for closing
@@ -396,6 +396,15 @@
 	joinRec->blocked = 0;
 }
 
+// Makes the specified NPC wait for the player to walk to them
+
+void Script::npcWait(uint16 hotspotId, uint16 v2, uint16 v3) {
+       Hotspot *hotspot = Resources::getReference().getActiveHotspot(hotspotId);
+       assert(hotspot);
+       hotspot->setCharacterMode(CHARMODE_WAIT_FOR_INTERACT);
+       hotspot->setDelayCtr(130);
+}
+
 // Lookup the given message Id for the specified character and display in a dialog
 
 void Script::displayMessage(uint16 messageId, uint16 characterId, uint16 unknownVal) {
@@ -579,6 +588,7 @@
 	{40, Script::checkDroppedDesc},
 	{42, Script::doorClose},
 	{44, Script::doorOpen},
+	{45, Script::npcWait},
 	{47, Script::displayMessage},
 	{48, Script::setNewSupportData},
 	{49, Script::setSupportData},
@@ -936,7 +946,7 @@
 {
 	Resources &r = Resources::getReference();
 	MemoryBlock *scriptData = r.hotspotScriptData();
-	uint16 offset = h->script();
+	uint16 offset = h->hotspotScript();
 	int16 opcode = 0;
 	int16 param1, param2;
 	uint32 actions;
@@ -954,7 +964,7 @@
 			debugC(ERROR_DETAILED, kLureDebugScripts, "SET FRAME_CTR = %d", param1);
 
 			h->setTickCtr(param1);
-			h->setScript(offset);
+			h->setHotspotScript(offset);
 			breakFlag = true;
 			break;
 
@@ -1029,7 +1039,7 @@
 			debugC(ERROR_DETAILED, kLureDebugScripts, "SET FRAME NUMBER = %d", opcode);
 
 			h->setFrameNumber(opcode);
-			h->setScript(offset);
+			h->setHotspotScript(offset);
 			breakFlag = true;
 			break;
 		}

Modified: scummvm/trunk/engines/lure/scripts.h
===================================================================
--- scummvm/trunk/engines/lure/scripts.h	2007-04-29 11:28:13 UTC (rev 26674)
+++ scummvm/trunk/engines/lure/scripts.h	2007-04-29 11:30:29 UTC (rev 26675)
@@ -113,6 +113,7 @@
 	static void doorClose(uint16 hotspotId, uint16 v2, uint16 v3);
 	static void displayMessage(uint16 messageId, uint16 characterId, uint16 unknownVal);
 	static void doorOpen(uint16 hotspotId, uint16 v2, uint16 v3);
+	static void npcWait(uint16 hotspotId, uint16 v2, uint16 v3);
 	static void setNewSupportData(uint16 hotspotId, uint16 index, uint16 v3);
 	static void setSupportData(uint16 hotspotId, uint16 index, uint16 v3);
 	static void givePlayerItem(uint16 hotspotId, uint16 v2, uint16 v3);


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