[Scummvm-cvs-logs] SF.net SVN: scummvm:[45767] scummvm/trunk/engines/teenagent

megath at users.sourceforge.net megath at users.sourceforge.net
Sun Nov 8 23:37:04 CET 2009


Revision: 45767
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45767&view=rev
Author:   megath
Date:     2009-11-08 22:37:03 +0000 (Sun, 08 Nov 2009)

Log Message:
-----------
implemented mouse-rock-glue time challenge

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/callbacks.cpp
    scummvm/trunk/engines/teenagent/inventory.cpp
    scummvm/trunk/engines/teenagent/objects.h
    scummvm/trunk/engines/teenagent/scene.cpp
    scummvm/trunk/engines/teenagent/scene.h
    scummvm/trunk/engines/teenagent/teenagent.cpp

Modified: scummvm/trunk/engines/teenagent/callbacks.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/callbacks.cpp	2009-11-08 21:59:26 UTC (rev 45766)
+++ scummvm/trunk/engines/teenagent/callbacks.cpp	2009-11-08 22:37:03 UTC (rev 45767)
@@ -2710,35 +2710,62 @@
 		scene->getObject(3)->save();
 		return true;
 
+	case 0x8d79: //mouse falls back from the hole (cave)
+		if (CHECK_FLAG(0, 1)) {
+			inventory->add(48);
+			playSound(24, 26);
+			playActorAnimation(650, true);
+			playAnimation(651, 2, true);
+			waitAnimation();
+		} else {
+			playSound(27, 5);
+			setOns(1, 0);
+			playActorAnimation(652);
+			playSound(24, 4);
+			playSound(5, 12);
+			moveTo(186, 179, 1, true);
+			playActorAnimation(653);
+			playActorAnimation(654, true);
+			playAnimation(655, 2, true);
+			waitAnimation();
+			displayMessage(0x3bf6);
+			inventory->add(49);
+			setLan(2, 4, 27);
+			enableObject(4, 27);
+			SET_FLAG(0xdba9, 0);
+		} 
+		SET_FLAG(0, 0);
+		return true;
+
 	case 0x8d57:
-		playSound(5, 2);
-		playSound(15, 12);
-		playActorAnimation(638);
-		inventory->remove(48);
-		//fixme: add time challenge here!
-
-		/*
-		inventory->add(48);
-		playSound(24, 26);
-		playActorAnimation(650, true);
-		playAnimation(651, 2, true);
-		waitAnimation();
-		*/
-		playSound(5, 2);
-		playSound(52, 13);
-		setOns(1, 46);
-		inventory->remove(49);
-
-		//third part
-		playActorAnimation(649);
-		setOns(1, 47);
-		for (byte i = 1; i <= 37; i += 4)
-			playSound(68, i);
-		playAnimation(639, 2);
-		setOns(0, 42);
-		enableObject(6);
-		disableObject(5);
-		SET_FLAG(0xDBAB, 1);
+		if (CHECK_FLAG(0, 0)) {
+			playSound(5, 2);
+			playSound(15, 12);
+			playActorAnimation(638);
+			inventory->remove(48);
+			setTimerCallback(0x8d79, 100);
+			SET_FLAG(0, 1);
+		} else if (CHECK_FLAG(0, 1)) {
+			playSound(5, 2);
+			playSound(52, 13);
+			playActorAnimation(648);
+			setOns(1, 46);
+			inventory->remove(49);
+			setTimerCallback(0x8d79, 100);
+			SET_FLAG(0, 2);
+		} else if (CHECK_FLAG(0, 2)) {
+			playActorAnimation(649);
+			setOns(1, 47);
+			for (byte i = 1; i <= 37; i += 4)
+				playSound(68, i);
+			playAnimation(639, 2);
+			setOns(0, 42);
+			enableObject(6);
+			disableObject(5);
+			SET_FLAG(0xDBAB, 1);
+			SET_FLAG(0, 0);
+			setTimerCallback(0, 0);
+		}
 		return true;
 
 	case 0x8f1d:

Modified: scummvm/trunk/engines/teenagent/inventory.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/inventory.cpp	2009-11-08 21:59:26 UTC (rev 45766)
+++ scummvm/trunk/engines/teenagent/inventory.cpp	2009-11-08 22:37:03 UTC (rev 45767)
@@ -164,7 +164,7 @@
 		int id1 = selected_obj->id;
 		int id2 = hovered_obj->id;
 
-		debug(0, "combine(0x%02x, 0x%02x)!", id1, id2);
+		debug(0, "combine(%u, %u)!", id1, id2);
 		byte *table = res->dseg.ptr(0xC335);
 		while (table[0] != 0 && table[1] != 0) {
 			if (
@@ -173,10 +173,11 @@
 			) {
 				remove(id1);
 				remove(id2);
+				debug(0, "adding object %u", table[2]);
 				add(table[2]);
 				uint16 msg = READ_LE_UINT16(table + 3);
+				_engine->playSoundNow(69);
 				_engine->displayMessage(msg);
-				_engine->playSoundNow(69);
 				activate(false);
 				resetSelectedObject();
 				return true;

Modified: scummvm/trunk/engines/teenagent/objects.h
===================================================================
--- scummvm/trunk/engines/teenagent/objects.h	2009-11-08 21:59:26 UTC (rev 45766)
+++ scummvm/trunk/engines/teenagent/objects.h	2009-11-08 22:37:03 UTC (rev 45767)
@@ -113,7 +113,7 @@
 struct UseHotspot {
 	byte inventory_id;
 	byte object_id;
-	byte orientation; //?
+	byte orientation;
 	uint16 actor_x, actor_y;
 	uint16 callback;
 	void load(byte *src);

Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp	2009-11-08 21:59:26 UTC (rev 45766)
+++ scummvm/trunk/engines/teenagent/scene.cpp	2009-11-08 22:37:03 UTC (rev 45767)
@@ -38,7 +38,7 @@
 		_id(0), ons(0),
 		orientation(Object::kActorRight), 
 		message_timer(0), message_first_frame(0), message_last_frame(0),
-		current_event(SceneEvent::kNone), hide_actor(false) {}
+		current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0) {}
 
 void Scene::warp(const Common::Point &_point, byte o) {
 	Common::Point point(_point);
@@ -500,6 +500,15 @@
 				busy = true;
 			}
 		}
+		
+		if (!busy && callback_timer) {
+			if (--callback_timer == 0) {
+				if (_engine->inventory->active())
+					_engine->inventory->activate(false);
+				_engine->processCallback(callback);
+				callback = 0;
+			}
+		}
 
 		system->unlockScreen();
 
@@ -680,6 +689,13 @@
 		case SceneEvent::kWaitLanAnimationFrame:
 			debug(0, "waiting for the frame %d in slot %d", current_event.animation, current_event.slot);
 			break;
+			
+		case SceneEvent::kTimer:
+			callback = current_event.callback;
+			callback_timer = current_event.timer;
+			debug(0, "triggering callback %04x in %u frames", callback, callback_timer);
+			current_event.clear();
+			break;
 
 		case SceneEvent::kQuit:
 			debug(0, "quit!");
@@ -772,6 +788,8 @@
 		animation[i].free();
 		custom_animation[i].free();
 	}
+	callback = 0;
+	callback_timer = 0;
 }
 
 void Scene::clearMessage() {

Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h	2009-11-08 21:59:26 UTC (rev 45766)
+++ scummvm/trunk/engines/teenagent/scene.h	2009-11-08 22:37:03 UTC (rev 45767)
@@ -197,6 +197,8 @@
 	EventList events;
 	SceneEvent current_event;
 	bool hide_actor;
+	
+	uint16 callback, callback_timer;
 
 	struct Sound {
 		byte id, delay;

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2009-11-08 21:59:26 UTC (rev 45766)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2009-11-08 22:37:03 UTC (rev 45767)
@@ -63,6 +63,19 @@
 	case kActionUse: {
 		InventoryObject *inv = inventory->selectedObject();
 		if (inv != NULL) {
+			debug(0, "checking active object %u on %u", inv->id, dst_object->id);
+			
+			//mouse time challenge hack:
+			if (
+				(res->dseg.get_byte(0) == 1 && inv->id == 49 && dst_object->id == 5) ||
+				(res->dseg.get_byte(0) == 2 && inv->id == 29 && dst_object->id == 5)
+			) {
+				//putting rock into hole or superglue on rock
+				processCallback(0x8d57);
+				return;
+			}
+			
+			
 			const Common::Array<UseHotspot> &hotspots = use_hotspots[scene->getId() - 1];
 			for (uint i = 0; i < hotspots.size(); ++i) {
 				const UseHotspot &spot = hotspots[i];


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