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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Wed Aug 30 14:19:14 CEST 2006


Revision: 23810
Author:   dreammaster
Date:     2006-08-30 05:19:05 -0700 (Wed, 30 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23810&view=rev

Log Message:
-----------
Implemented the Tell action handling, and added support for current actions with dynamic support data

Modified Paths:
--------------
    scummvm/trunk/engines/lure/hotspots.cpp
    scummvm/trunk/engines/lure/hotspots.h
Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2006-08-30 11:48:43 UTC (rev 23809)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2006-08-30 12:19:05 UTC (rev 23810)
@@ -1296,9 +1296,9 @@
 	Hotspot *character = res.getActiveHotspot(hotspot->hotspotId);
 	assert(character);
 
-	HotspotPrecheckResult result = actionPrecheck(hotspot);
-	if (result == PC_INITIAL) return;
-	else if (result != PC_EXECUTE) {
+	HotspotPrecheckResult hsResult = actionPrecheck(hotspot);
+	if (hsResult == PC_INITIAL) return;
+	else if (hsResult != PC_EXECUTE) {
 		endAction();
 		return;
 	}
@@ -1312,11 +1312,15 @@
 		uint16 result = Script::execute(sequenceOffset);
 
 		if (result == 0) {
+			// Build up sequence of commands for character to follow
+			CharacterScheduleEntry &cmdData = _currentActions.top().supportData();
 			character->setStartRoomNumber(character->roomNumber());
 			character->currentActions().clear();
-			
-			// Build up sequence of commands for character to follow
-			error("Tell command handling yet not yet implemented");
+
+			for (int index = 1; index < cmdData.numParams(); index += 3) {
+				character->currentActions().addBack((Action) cmdData.param(index),
+					character->roomNumber(), cmdData.param(index + 1), cmdData.param(index + 2));
+			}
 		}
 	}
 
@@ -3308,6 +3312,28 @@
 
 // Current action entry class methods
 
+CurrentActionEntry::CurrentActionEntry(CurrentAction newAction, uint16 roomNum) {
+	_action = newAction; 
+	_supportData = NULL; 
+	_dynamicSupportData = false;
+	_roomNumber = roomNum;
+}
+
+CurrentActionEntry::CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum) { 
+	_action = newAction; 
+	_supportData = data; 
+	_dynamicSupportData = false;
+	_roomNumber = roomNum;
+}
+
+CurrentActionEntry::CurrentActionEntry(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
+	_action = DISPATCH_ACTION;
+	_supportData = new CharacterScheduleEntry();
+	uint16 params[2] = {param1, param2};
+	_supportData->setDetails2(newAction, 2, params);
+	_roomNumber = roomNum;
+}
+
 void CurrentActionEntry::setSupportData(uint16 entryId) {
 	CharacterScheduleEntry &entry = supportData();
 

Modified: scummvm/trunk/engines/lure/hotspots.h
===================================================================
--- scummvm/trunk/engines/lure/hotspots.h	2006-08-30 11:48:43 UTC (rev 23809)
+++ scummvm/trunk/engines/lure/hotspots.h	2006-08-30 12:19:05 UTC (rev 23810)
@@ -83,17 +83,14 @@
 	CurrentAction _action;
 	CharacterScheduleEntry *_supportData;
 	uint16 _roomNumber;
+	bool _dynamicSupportData;
 public:
-	CurrentActionEntry(CurrentAction newAction, uint16 roomNum) {
-		_action = newAction; 
-		_supportData = NULL; 
-		_roomNumber = roomNum;
+	CurrentActionEntry(CurrentAction newAction, uint16 roomNum);
+	CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum);
+	CurrentActionEntry(Action newAction, uint16 roomNum, uint16 param1, uint16 param2);
+	virtual ~CurrentActionEntry() {
+		if (_dynamicSupportData) delete _supportData;
 	}
-	CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum) { 
-		_action = newAction; 
-		_supportData = data; 
-		_roomNumber = roomNum;
-	}
 
 	CurrentAction action() { return _action; }
 	CharacterScheduleEntry &supportData() { 
@@ -129,12 +126,18 @@
 	void addBack(CurrentAction newAction, CharacterScheduleEntry *rec, uint16 roomNum) {
 		_actions.push_back(new CurrentActionEntry(newAction, rec, roomNum));
 	}
+	void addBack(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
+		_actions.push_back(new CurrentActionEntry(newAction, roomNum, param1, param2));
+	}
 	void addFront(CurrentAction newAction, uint16 roomNum) {
 		_actions.push_front(new CurrentActionEntry(newAction, roomNum));
 	}
 	void addFront(CurrentAction newAction, CharacterScheduleEntry *rec, uint16 roomNum) {
 		_actions.push_front(new CurrentActionEntry(newAction, rec, roomNum));
 	}
+	void addFront(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
+		_actions.push_front(new CurrentActionEntry(newAction, roomNum, param1, param2));
+	}
 };
 
 class WalkingActionEntry {


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