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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Mon Apr 23 00:42:03 CEST 2007


Revision: 26572
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26572&view=rev
Author:   dreammaster
Date:     2007-04-22 15:42:01 -0700 (Sun, 22 Apr 2007)

Log Message:
-----------
General bugfixes, added animation handlers for creating potion and freeing Goewin, and in-progress work on completing original game's action precheck code

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.h
    scummvm/trunk/engines/lure/scripts.cpp
    scummvm/trunk/engines/lure/scripts.h

Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2007-04-22 22:33:42 UTC (rev 26571)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2007-04-22 22:42:01 UTC (rev 26572)
@@ -487,14 +487,26 @@
 // Makes the character face the given hotspot
 
 void Hotspot::faceHotspot(HotspotData *hotspot) {
+	Resources &res = Resources::getReference();
+	Room &room = Room::getReference();
+	Screen &screen = Screen::getReference();
+
 	if (hotspot->hotspotId >= START_NONVISUAL_HOTSPOT_ID) {
 		// Non visual hotspot
 		setDirection(hotspot->nonVisualDirection());
 
 	} else {
 		// Visual hotspot
-		int xp = x() - hotspot->startX;
-		int yp = y() + heightCopy() - (hotspot->startY + hotspot->heightCopy);
+		int xp, yp;
+		
+		HotspotOverrideData *hsEntry = res.getHotspotOverride(hotspot->hotspotId);
+		if (hsEntry != NULL) {
+			xp = x() - hsEntry->xs;
+			yp = y() + heightCopy() - (hsEntry->ys + hotspot->heightCopy);
+		} else {
+			xp = x() - hotspot->startX;
+			yp = y() + heightCopy() - (hotspot->startY + hotspot->heightCopy);
+		}
 
 		if (ABS(yp) >= ABS(xp)) {
 			if (yp < 0) setDirection(DOWN);
@@ -506,8 +518,8 @@
 	}
 
 	if (hotspotId() == PLAYER_ID) {
-		Room::getReference().update();
-		Screen::getReference().update();
+		room.update();
+		screen.update();
 	}
 }
 
@@ -819,7 +831,7 @@
 		if (actionCtr() >= 6) {
 			warning("actionCtr exceeded");
 			setActionCtr(0);
-			converse(0, 0xD);
+			converse(NOONE_ID, 0xD);
 			return PC_EXCESS;
 		} 
 
@@ -833,11 +845,12 @@
 		} else {
 			// loc_886
 			setActionCtr(0);
-			converse(0, 0xE);
+			converse(NOONE_ID, 0xE);
 			return PC_FAILED;
 		}
 	} else {
 		setActionCtr(1);
+
 		if ((hotspot->hotspotId >= FIRST_NONCHARACTER_ID) ||
 			((hotspot->actionHotspotId != _hotspotId) && 
 			 (hotspot->characterMode == CHARMODE_WAIT_FOR_PLAYER))) {
@@ -846,15 +859,14 @@
 				return PC_WAIT;
 
 		} else if (hotspot->actionHotspotId != _hotspotId) {
-			if (fields.getField(88) == 2) {
-				// loc_882
-				hotspot->talkGate = 0x2A;
-				hotspot->talkDestCharacterId = _hotspotId;
-				return PC_WAIT;
-			} else {
+			if (fields.getField(82) != 2) {
 				converse(NOONE_ID, 5);
 				setDelayCtr(4);
 			}
+
+			hotspot->talkGate = 0x2A;
+			hotspot->talkDestCharacterId = _hotspotId;
+			return PC_WAIT;
 		} 
 	}
 
@@ -1369,7 +1381,7 @@
 		} else if (sequenceOffset == 0) {
 			// Move item into character's inventory
 			HotspotData *usedItem = res.getHotspot(usedId);
-			usedItem->roomNumber = hotspotId();
+			usedItem->roomNumber = hotspot->hotspotId;
 		} else if (sequenceOffset > 1) {
 			showMessage(result);
 		}
@@ -1979,6 +1991,7 @@
 	// Signal the character that they're being talked to
 	charHotspot->talkDestCharacterId = _hotspotId;
 	_data->talkDestCharacterId = charHotspot->hotspotId;
+	_data->talkGate = 0;
 	
 	// Set the active talk data
 	res.setTalkStartEntry(0);
@@ -2078,9 +2091,9 @@
 		return followerAnimHandler;
 	case 0x7EFA:
 		return skorlAnimHandler;
-	case 0x7F37:
+	case STANDARD_ANIM_2_TICK_PROC:
 		return standardAnimHandler2;
-	case 0x7F3A:
+	case STANDARD_ANIM_TICK_PROC:
 		return standardAnimHandler;
 	case 0x7F54:
 		return sonicRatAnimHandler;
@@ -2090,6 +2103,8 @@
 		return playerSewerExitAnimHandler;
 	case 0x8009:
 		return fireAnimHandler;
+	case 0x80C6:
+		return sparkleAnimHandler;
 	case 0x813F:
 		return teaAnimHandler;
 	case 0x8180:
@@ -2907,6 +2922,46 @@
 	h.setOccupied(true);
 }
 
+void HotspotTickHandlers::sparkleAnimHandler(Hotspot &h) {
+	Resources &res = Resources::getReference();
+	Hotspot *player = res.getActiveHotspot(PLAYER_ID);
+	ValueTableData &fields = res.fieldList();
+
+	h.setRoomNumber(player->roomNumber());
+	h.setPosition(player->x() - 14, player->y() - 10);
+	h.setActionCtr(h.actionCtr() + 1);
+	if (h.actionCtr() == 6) {
+		uint16 animId;
+		if ((fields.getField(11) == 2) || (fields.getField(28) != 0)) {
+			fields.setField(28, 0);
+			animId = PLAYER_ANIM_ID;
+		} else {
+			fields.setField(28, fields.getField(28) + 1);
+			animId = SELENA_ANIM_ID;
+		}
+
+		player->setAnimation(animId);
+	}
+
+	if (h.executeScript()) {
+		HotspotData *data = h.resource();
+		res.deactivateHotspot(&h);
+		data->roomNumber = 0x1A8;
+
+		if (fields.getField(28) != 0) {
+			Hotspot *ratpouch = res.getActiveHotspot(RATPOUCH_ID);
+			assert(ratpouch);
+			ratpouch->converse(NOONE_ID, 0x854, false);
+
+			uint16 dataId = res.getCharOffset(4);
+			CharacterScheduleEntry *entry = res.charSchedules().getEntry(dataId);
+
+			ratpouch->currentActions().addFront(DISPATCH_ACTION, entry, ratpouch->roomNumber());
+			ratpouch->setActionCtr(0);
+		}
+	}
+}
+
 void HotspotTickHandlers::teaAnimHandler(Hotspot &h) {
 	if (h.frameCtr() > 0) {
 		h.decrFrameCtr();
@@ -3099,10 +3154,13 @@
 			selectedLine, descId);
 
 		// Get the response the destination character will say
-		if (descId != TALK_MAGIC_ID) 
+		if (descId != TALK_MAGIC_ID) {
 			// Set up to display the question and response in talk dialogs
 			h.converse(talkDestCharacter, descId, false);
-		res.setTalkState(TALK_RESPOND_2);
+			res.setTalkState(TALK_RESPOND_2);
+		} else {
+			res.setTalkState(TALK_RESPOND_3);
+		}
 		break;
 
 	case TALK_RESPOND_2:
@@ -3114,6 +3172,8 @@
 		if (res.getTalkingCharacter() != 0)
 			return;
 
+	case TALK_RESPOND_3:
+		// Respond
 		selectedLine = res.getTalkSelection();
 		entry = talkSelections[selectedLine-1];
 

Modified: scummvm/trunk/engines/lure/hotspots.h
===================================================================
--- scummvm/trunk/engines/lure/hotspots.h	2007-04-22 22:33:42 UTC (rev 26571)
+++ scummvm/trunk/engines/lure/hotspots.h	2007-04-22 22:42:01 UTC (rev 26572)
@@ -69,6 +69,7 @@
 	static void droppingTorchAnimHandler(Hotspot &h);
 	static void playerSewerExitAnimHandler(Hotspot &h);
 	static void fireAnimHandler(Hotspot &h);
+	static void sparkleAnimHandler(Hotspot &h);
 	static void teaAnimHandler(Hotspot &h);
 	static void goewinCaptiveAnimHandler(Hotspot &h);
 	static void prisonerAnimHandler(Hotspot &h);

Modified: scummvm/trunk/engines/lure/luredefs.h
===================================================================
--- scummvm/trunk/engines/lure/luredefs.h	2007-04-22 22:33:42 UTC (rev 26571)
+++ scummvm/trunk/engines/lure/luredefs.h	2007-04-22 22:42:01 UTC (rev 26572)
@@ -31,7 +31,7 @@
 
 #define SUPPORT_FILENAME "lure.dat"
 #define LURE_DAT_MAJOR 1
-#define LURE_DAT_MINOR 17
+#define LURE_DAT_MINOR 18
 
 #define LURE_DEBUG 1
 
@@ -231,6 +231,7 @@
 #define SACK_ID 0x40D
 #define PRISONER_ID 0x412
 #define SID_ID 0x420
+#define OIL_BURNER_ID 0x424
 #define TRANSFORM_ID 0x425
 #define NELLIE_ID 0x429
 #define EWAN_ID 0x436
@@ -245,10 +246,12 @@
 
 // Tick proc constants
 #define STANDARD_CHARACTER_TICK_PROC 0x4f82 
-#define TALK_TICK_PROC_ID 0x8ABD
 #define PLAYER_TICK_PROC_ID 0x5E44
 #define VOICE_TICK_PROC_ID 0x625E
 #define PUZZLED_TICK_PROC_ID 0x6571
+#define STANDARD_ANIM_2_TICK_PROC 0x7F37
+#define STANDARD_ANIM_TICK_PROC 0x7f3a
+#define TALK_TICK_PROC_ID 0x8ABD
 
 // String constants
 #define STRANGER_ID 0x17A
@@ -264,6 +267,8 @@
 #define BLACKSMITH_HAMMERING_ANIM_ID 0x9c11
 #define EWAN_ANIM_ID 0x59E4
 #define EWAN_ALT_ANIM_ID 0x59ED
+#define PLAYER_ANIM_ID 0x5C80
+#define SELENA_ANIM_ID 0x5CAA
 
 #define CONVERSE_COUNTDOWN_SIZE 40
 #define IDLE_COUNTDOWN_SIZE 15

Modified: scummvm/trunk/engines/lure/res.h
===================================================================
--- scummvm/trunk/engines/lure/res.h	2007-04-22 22:33:42 UTC (rev 26571)
+++ scummvm/trunk/engines/lure/res.h	2007-04-22 22:42:01 UTC (rev 26572)
@@ -34,7 +34,7 @@
 namespace Lure {
 
 enum TalkState {TALK_NONE, TALK_START, TALK_SELECT, TALK_RESPOND, TALK_RESPONSE_WAIT,
-	TALK_RESPOND_2};
+	TALK_RESPOND_2, TALK_RESPOND_3};
 
 #define MAX_TALK_SELECTIONS 4
 typedef TalkEntryData *TalkSelections[MAX_TALK_SELECTIONS];

Modified: scummvm/trunk/engines/lure/scripts.cpp
===================================================================
--- scummvm/trunk/engines/lure/scripts.cpp	2007-04-22 22:33:42 UTC (rev 26571)
+++ scummvm/trunk/engines/lure/scripts.cpp	2007-04-22 22:42:01 UTC (rev 26572)
@@ -57,8 +57,9 @@
 void Script::setHotspotScript(uint16 hotspotId, uint16 scriptIndex, uint16 v3) {
 	Resources &r = Resources::getReference();
 	uint16 offset = r.getHotspotScript(scriptIndex);
-	HotspotData *rsc = r.getHotspot(hotspotId);
-	rsc->sequenceOffset = offset;
+	Hotspot *hotspot = r.getActiveHotspot(hotspotId);
+	assert(hotspot);
+	hotspot->setScript(offset);
 }
 
 void Script::method2(uint16 v1, uint16 v2, uint16 v3) {
@@ -330,6 +331,21 @@
 	hotspot->flags = (hotspot->flags & 0xdf) | 0x80;
 }
 
+// Display a message
+
+void Script::displayMessage2(uint16 messageId, uint16 hotspotId, uint16 v3) {
+	Hotspot *hotspot = Resources::getReference().getActiveHotspot(hotspotId);
+	assert(hotspot);
+	hotspot->showMessage(messageId);
+}
+
+void Script::startOilBurner(uint16 v1, uint16 v2, uint16 v3) {
+	Hotspot *hotspot = Resources::getReference().getActiveHotspot(OIL_BURNER_ID);
+	assert(hotspot);
+	hotspot->setPosition(152, hotspot->y());
+	hotspot->setTickProc(STANDARD_ANIM_TICK_PROC);
+}
+
 // Transforms the player
 
 void Script::transformPlayer(uint16 v1, uint16 v2, uint16 v3) {
@@ -556,7 +572,9 @@
 	{33, Script::cutSack},
 	{34, Script::increaseNumGroats},
 	{35, Script::enableHotspot},
-	{37, Script::transformPlayer},
+	{36, Script::displayMessage2},
+	{37, Script::startOilBurner},
+	{38, Script::transformPlayer},
 	{39, Script::jailClose},
 	{40, Script::checkDroppedDesc},
 	{42, Script::doorClose},

Modified: scummvm/trunk/engines/lure/scripts.h
===================================================================
--- scummvm/trunk/engines/lure/scripts.h	2007-04-22 22:33:42 UTC (rev 26571)
+++ scummvm/trunk/engines/lure/scripts.h	2007-04-22 22:42:01 UTC (rev 26572)
@@ -105,6 +105,8 @@
 	static void cutSack(uint16 hotspotId, uint16 v2, uint16 v3);
 	static void increaseNumGroats(uint16 characterId, uint16 numGroats, uint16 v3);
 	static void enableHotspot(uint16 hotspotId, uint16 v2, uint16 v3);
+	static void displayMessage2(uint16 messageId, uint16 hotspotId, uint16 v3);
+	static void startOilBurner(uint16 v1, uint16 v2, uint16 v3);
 	static void transformPlayer(uint16 v1, uint16 v2, uint16 v3);
 	static void jailClose(uint16 v1, uint16 v2, uint16 v3);
 	static void checkDroppedDesc(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