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

megath at users.sourceforge.net megath at users.sourceforge.net
Mon Nov 9 00:32:04 CET 2009


Revision: 45769
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45769&view=rev
Author:   megath
Date:     2009-11-08 23:32:01 +0000 (Sun, 08 Nov 2009)

Log Message:
-----------
implemented drinking guard time challenge

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/callbacks.cpp
    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 22:48:27 UTC (rev 45768)
+++ scummvm/trunk/engines/teenagent/callbacks.cpp	2009-11-08 23:32:01 UTC (rev 45769)
@@ -754,20 +754,29 @@
 		if (CHECK_FLAG(0xDB9C, 1))
 			return true;
 
-		SET_FLAG(0xDB9C, 1); //guard's drinking, boo!
+		SET_FLAG(0, 3);
+		setTimerCallback(0x516d, 40); //fail
 		playAnimation(544, 0);
+		return true;
 		
+	case 0x516d:
+		SET_FLAG(0, 0);
+		return true;
+
+	case 0x5189:
+		SET_FLAG(0, 0);
+		setTimerCallback(0, 0);
+		scene->cancelAnimation(0);
+		SET_FLAG(0xDB9C, 1); //guard's drinking, boo!
 		
+		displayAsyncMessage(0x3563, 320 * 130 + 300, 1, 5);
 		setOns(0, 16);
-		
 		enableObject(2);
 
 		playSound(17, 5);
-		displayAsyncMessageInSlot(0x3563, 1, 60, 70);
 		playAnimation(545, 0);
 
 		Dialog::show(scene, 0x0917, 0, 546, 0xd1, 0xd9, 0, 1);
-		playActorAnimation(546);
 		SET_FLAG(0xDA96, 1);
 		SET_FLAG(0xDA97, 0);
 		return true;
@@ -2235,16 +2244,16 @@
 		return false;
 
 	case 0x8117:
-		Dialog::show(scene, 0x0a41, 529);
+		Dialog::show(scene, 0x0a41, 0, 529, 0xd1, 0xd9, 0, 1);
 		playSound(5, 2);
 		playSound(5, 44);
-		playAnimation(642, 1, true);
+		playAnimation(642, 0, true);
 		playActorAnimation(641, true);
 		waitAnimation();
-		Dialog::show(scene, 0x0aff, 529);
-		Dialog::show(scene, 0x0ba0, 529);
+		Dialog::show(scene, 0x0aff, 0, 529, 0xd1, 0xd9, 0, 1);
+		Dialog::show(scene, 0x0ba0, 0, 529, 0xd1, 0xd9, 0, 1);
 		moveRel(0, 1, 0);
-		Dialog::show(scene, 0x0c10, 529);
+		Dialog::show(scene, 0x0c10, 0, 529, 0xd1, 0xd9, 0, 1);
 		inventory->remove(50);
 		processCallback(0x9d45);
 		return true;
@@ -3857,16 +3866,18 @@
 		return true;
 
 	case 0x9de5:
+		hideActor();
 		loadScene(30, scene->getPosition());
 		playAnimation(887, 1, true);
 		playAnimation(888, 2, true);
 		waitAnimation();
-		Dialog::show(scene, 0x6fb8);
+		Dialog::show(scene, 0x6fb8, 889, 890, 0xd9, 0xd0, 2, 3);
 		playSound(26, 3);
 		playAnimation(891, 1, true);
 		playAnimation(892, 2, true);
 		waitAnimation();
-		Dialog::show(scene, 0x6ff0);
+		Dialog::show(scene, 0x6ff0, 890, 889, 0xd0, 0xd9, 3, 2);
+		showActor();
 		return true;
 
 	case 0x9e54:

Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp	2009-11-08 22:48:27 UTC (rev 45768)
+++ scummvm/trunk/engines/teenagent/scene.cpp	2009-11-08 23:32:01 UTC (rev 45769)
@@ -37,7 +37,7 @@
 		_system(NULL),
 		_id(0), ons(0),
 		orientation(Object::kActorRight), 
-		message_timer(0), message_first_frame(0), message_last_frame(0),
+		message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL), 
 		current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0) {}
 
 void Scene::warp(const Common::Point &_point, byte o) {
@@ -294,6 +294,16 @@
 	actor_animation.loop = loop;
 }
 
+bool Scene::cancelAnimation(byte slot) {
+	assert(slot < 4);
+	if (custom_animation[slot].empty())
+		return false;
+	else {
+		custom_animation[slot].free();
+		return true;
+	}
+}
+
 void Scene::push(const SceneEvent &event) {
 	//debug(0, "push");
 	//event.dump();
@@ -485,8 +495,9 @@
 
 		if (!message.empty()) {
 			bool visible = true;
-			if (message_first_frame != 0) {
-				int index = actor_animation.currentIndex() + 1;
+			if (message_first_frame != 0 && message_animation != NULL) {
+				int index = message_animation->currentIndex() + 1;
+				debug(0, "message: %s first: %u index: %u", message.c_str(), message_first_frame, index);
 				if (index < message_first_frame)
 					visible = false;
 				if (index > message_last_frame) {
@@ -501,7 +512,7 @@
 			}
 		}
 		
-		if (!busy && callback_timer) {
+		if (callback_timer) {
 			if (--callback_timer == 0) {
 				if (_engine->inventory->active())
 					_engine->inventory->activate(false);
@@ -597,10 +608,18 @@
 		case SceneEvent::kCreditsMessage:
 		case SceneEvent::kMessage: {
 				message = current_event.message;
+				message_animation = NULL;
 				if (current_event.first_frame) {
 					message_timer = 0;
 					message_first_frame = current_event.first_frame;
 					message_last_frame = current_event.last_frame;
+					if (current_event.slot < 4) {
+						message_animation = custom_animation + current_event.slot;
+						//else if (!animation[current_event.slot].empty())
+						//	message_animation = animation + current_event.slot;
+					} else 
+						message_animation = &actor_animation;
+					debug(0, "async message %d-%d (slot %u)", message_first_frame, message_last_frame, current_event.slot);
 				} else {
 					message_timer = messageDuration(message);
 					message_first_frame = message_last_frame = 0;
@@ -798,6 +817,7 @@
 	message_color = 0xd1;
 	message_first_frame = 0;
 	message_last_frame = 0;
+	message_animation = NULL;
 }
 
 } // End of namespace TeenAgent

Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h	2009-11-08 22:48:27 UTC (rev 45768)
+++ scummvm/trunk/engines/teenagent/scene.h	2009-11-08 23:32:01 UTC (rev 45769)
@@ -148,6 +148,7 @@
 	Object *findObject(const Common::Point &point);
 
 	void loadObjectData();
+	bool cancelAnimation(byte slot);
 
 private:
 	void loadOns();
@@ -192,6 +193,7 @@
 	uint message_timer;
 	byte message_first_frame;
 	byte message_last_frame;
+	Animation * message_animation;
 
 	typedef Common::List<SceneEvent> EventList;
 	EventList events;

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2009-11-08 22:48:27 UTC (rev 45768)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2009-11-08 23:32:01 UTC (rev 45769)
@@ -300,10 +300,15 @@
 				}
 				break;
 			case Common::EVENT_LBUTTONDOWN:
-				examine(event.mouse, current_object);
-				break;
 			case Common::EVENT_RBUTTONDOWN:
-				use(current_object);
+				if (res->dseg.get_byte(0) == 3) {
+					processCallback(0x5189); //boo!
+					break;
+				}
+				if (event.type == Common::EVENT_LBUTTONDOWN)
+					examine(event.mouse, current_object);
+				else
+					use(current_object);
 				break;
 			case Common::EVENT_MOUSEMOVE:
 				mouse = event.mouse;


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