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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Tue May 23 05:25:25 CEST 2006


Revision: 22576
Author:   dreammaster
Date:     2006-05-23 05:24:50 -0700 (Tue, 23 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22576&view=rev

Log Message:
-----------
Added script methods for manipulating current action support data and a stub for a script method that plays background music

Modified Paths:
--------------
    scummvm/trunk/engines/lure/scripts.cpp
    scummvm/trunk/engines/lure/scripts.h
Modified: scummvm/trunk/engines/lure/scripts.cpp
===================================================================
--- scummvm/trunk/engines/lure/scripts.cpp	2006-05-23 12:19:35 UTC (rev 22575)
+++ scummvm/trunk/engines/lure/scripts.cpp	2006-05-23 12:24:50 UTC (rev 22576)
@@ -100,7 +100,7 @@
 	HotspotData *hotspot = res.getHotspot(hotspotId);
 	
 	if (!res.getHotspotActions(offset))
-		warning("Hotspot %d set to invalid actions offset %d",
+		warning("Hotspot %xh set to invalid actions offset %d",
 			hotspotId, offset);
 	
 	hotspot->actionsOffset = offset;
@@ -157,6 +157,19 @@
 		player->roomNumber());
 }
 
+// Checks the status of the cell door, and starts music depending on it's state
+
+void Script::checkCellDoor(uint16 v1, uint16 v2, uint16 v3) {
+	// In the original game, this method checks to see if the cell door
+	// is currently open, if it is, starts a music sequence. 
+	// TODO: Implement starting music if cell door is open
+}
+
+void Script::playMusic(uint16 musicNum, uint16 v2, uint16 v3) {
+	// TODO: Play a given music
+	warning("TODO: Play music #%d", musicNum);
+}
+
 // Gets the current blocked state for the given door and stores it in the
 // general value field
 
@@ -182,17 +195,16 @@
 	Resources &r = Resources::getReference();
 	uint16 offset = r.getHotspotScript(scriptIndex);
 
-	HotspotData *rsc = r.getHotspot(charId);
-	rsc->sequenceOffset = offset;
-
 	Hotspot *hs = r.getActiveHotspot(charId);
-	hs->setCurrentAction(EXEC_HOTSPOT_SCRIPT);
+	hs->setScript(offset);
+	hs->currentActions().top().setAction(EXEC_HOTSPOT_SCRIPT);
+	hs->setOccupied(true);
 }
 
 // Decrements the number of inventory itemst he player has
 
 void Script::decrInventoryItems(uint16 v1, uint16 v2, uint16 v3) {
-	// module currently doesn't use a static counter for the number of
+	// module doesn't use a static counter for the number of
 	// inventory items, so don't do anything
 }
 
@@ -292,6 +304,30 @@
 	Dialog::showMessage(messageId, characterId);
 }
 
+// Creates a new dispatch action with the given support data entry
+
+void Script::setNewSupportData(uint16 hotspotId, uint16 index, uint16 v3) {
+	Resources &res = Resources::getReference();
+	uint16 dataId = res.getCharOffset(index);
+	CharacterScheduleEntry *entry = res.charSchedules().getEntry(dataId);
+
+	Hotspot *h = res.getActiveHotspot(hotspotId);
+	h->currentActions().addFront(DISPATCH_ACTION, entry, h->roomNumber());
+}
+
+// Replaces the existing current action with a new dispatch data entry
+
+void Script::setSupportData(uint16 hotspotId, uint16 index, uint16 v3) {
+	Resources &res = Resources::getReference();
+	uint16 dataId = res.getCharOffset(index);
+
+	CharacterScheduleEntry *entry = res.charSchedules().getEntry(dataId);
+	Hotspot *h = res.getActiveHotspot(hotspotId);
+
+	h->currentActions().pop();
+	h->currentActions().addFront(DISPATCH_ACTION, entry, h->roomNumber());
+}
+
 // Assign the given hotspot item to the player's inventory
 
 void Script::givePlayerItem(uint16 hotspotId, uint16 v2, uint16 v3) {
@@ -335,14 +371,7 @@
 	hotspot->actions |= actions;
 }
 
-// Checks the status of the cell door, and starts music depending on its state
 
-void Script::checkCellDoor(uint16 v1, uint16 v2, uint16 v3) {
-	// In the original game, this method checks to see if the cell door
-	// is currently open, if it is, starts a music sequence. 
-	// TODO: Implement starting music if cell door is open
-}
-
 typedef void(*SequenceMethodPtr)(uint16, uint16, uint16);
 
 struct SequenceMethodRecord {
@@ -364,6 +393,7 @@
 	{16, Script::displayDialog},
 	{18, Script::remoteRoomViewSetup},
 	{20, Script::checkCellDoor},
+	{21, Script::playMusic},
 	{22, Script::getDoorBlocked},
 	{23, Script::isSkorlInCell},
 	{27, Script::setBlockingHotspotScript},
@@ -379,6 +409,8 @@
 	{42, Script::doorClose},
 	{44, Script::doorOpen},
 	{47, Script::displayMessage},
+	{48, Script::setNewSupportData},
+	{49, Script::setSupportData},
 	{50, Script::givePlayerItem},
 	{51, Script::decreaseNumGroats},
 	{54, Script::setVillageSkorlTickProc},
@@ -593,6 +625,7 @@
 
 	while (!breakFlag) {
 		opcode = nextVal(scriptData, offset);
+
 		switch (opcode) {
 		case S2_OPCODE_TIMEOUT:
 			param1 = nextVal(scriptData, offset);

Modified: scummvm/trunk/engines/lure/scripts.h
===================================================================
--- scummvm/trunk/engines/lure/scripts.h	2006-05-23 12:19:35 UTC (rev 22575)
+++ scummvm/trunk/engines/lure/scripts.h	2006-05-23 12:24:50 UTC (rev 22576)
@@ -87,6 +87,8 @@
 	static void playSound(uint16 v1, uint16 v2, uint16 v3);
 	static void displayDialog(uint16 stringId, uint16 v2, uint16 v3);
 	static void remoteRoomViewSetup(uint16 v1, uint16 v2, uint16 v3);
+	static void checkCellDoor(uint16 v1, uint16 v2, uint16 v3);
+	static void playMusic(uint16 musicNum, uint16 v2, uint16 v3);
 	static void getDoorBlocked(uint16 hotspotId, uint16 v2, uint16 v3);
 	static void isSkorlInCell(uint16 v1, uint16 v2, uint16 v3);
 	static void setBlockingHotspotScript(uint16 charId, uint16 scriptIndex, uint16 v3);
@@ -102,13 +104,14 @@
 	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 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);
 	static void decreaseNumGroats(uint16 characterId, uint16 numGroats, uint16 v3);
 	static void setVillageSkorlTickProc(uint16 v1, uint16 v2, uint16 v3);
 	static void getNumGroats(uint16 v1, uint16 v2, uint16 v3);
 	static void animationLoad(uint16 hotspotId, uint16 v2, uint16 v3);
 	static void addActions(uint16 hotspotId, uint16 actions, uint16 v3);
-	static void checkCellDoor(uint16 v1, uint16 v2, uint16 v3);
 };
 
 class HotspotScript {


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