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

megath at users.sourceforge.net megath at users.sourceforge.net
Sun Sep 13 14:48:57 CEST 2009


Revision: 44055
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44055&view=rev
Author:   megath
Date:     2009-09-13 12:48:57 +0000 (Sun, 13 Sep 2009)

Log Message:
-----------
added hide/showActor, fixed intro, reverted straight animation order

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
    scummvm/trunk/engines/teenagent/teenagent.h

Modified: scummvm/trunk/engines/teenagent/callbacks.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/callbacks.cpp	2009-09-13 12:17:33 UTC (rev 44054)
+++ scummvm/trunk/engines/teenagent/callbacks.cpp	2009-09-13 12:48:57 UTC (rev 44055)
@@ -89,6 +89,7 @@
 	switch(addr) {
 	
 	case 0x024c: //intro
+		hideActor();
 		loadScene(41, 139, 156, 3);
 		playSound(41, 12);
 		playAnimation(912, 1);
@@ -135,6 +136,7 @@
 		playAnimation(928, 1);
 		setOns(0, 112);
 		Dialog::show(scene, 0x78e1, 929, 0, 0xd1); //he's coming
+		showActor();
 		moveTo(319, 150, 1, true);
 		moveTo(63, 150, 1);
 		displayMessage(0x5da8); //fixme: with delay!

Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp	2009-09-13 12:17:33 UTC (rev 44054)
+++ scummvm/trunk/engines/teenagent/scene.cpp	2009-09-13 12:48:57 UTC (rev 44055)
@@ -37,7 +37,7 @@
 	_system(NULL), 
 	_id(0), ons(0), walkboxes(0), 
 	orientation(Object::ActorRight), 
-	current_event(SceneEvent::None) {}
+	current_event(SceneEvent::None), hide_actor(false) {}
 
 void Scene::warp(const Common::Point & _point, byte o) { 
 	Common::Point point(_point);
@@ -278,6 +278,8 @@
 			events.clear();
 			sounds.clear();
 			current_event.clear();
+			for(int i = 0; i < 4; ++i)
+				custom_animations[i].free();
 			_engine->playMusic(4);
 			init(10, Common::Point(136, 153));
 		}
@@ -322,7 +324,7 @@
 
 	bool got_any_animation = false;
 
-	for (int i = 3; i >= 0; --i) {
+	for (int i = 0; i < 4; ++i) {
 		Animation *a = custom_animations + i;
 		Surface *s = a->currentFrame();
 		if (s != NULL) {
@@ -352,35 +354,37 @@
 		}
 	}
 	
-	Surface * mark = actor_animation.currentFrame();
-	if (mark == NULL) {
-		actor_animation.free();
+	if (!hide_actor) {
+		Surface * mark = actor_animation.currentFrame();
+		if (mark == NULL) {
+			actor_animation.free();
 
-		if (destination != position) {
-			Common::Point dp(destination.x - position0.x, destination.y - position0.y);
-			int o;
-			if (ABS(dp.x) > ABS(dp.y))
-				o = dp.x > 0? Object::ActorRight: Object::ActorLeft;
-			else
-				o = dp.y > 0? Object::ActorDown: Object::ActorUp;
+			if (destination != position) {
+				Common::Point dp(destination.x - position0.x, destination.y - position0.y);
+				int o;
+				if (ABS(dp.x) > ABS(dp.y))
+					o = dp.x > 0? Object::ActorRight: Object::ActorLeft;
+				else
+					o = dp.y > 0? Object::ActorDown: Object::ActorUp;
 			
-			position.x = position0.x + dp.x * progress / progress_total;
-			position.y = position0.y + dp.y * progress / progress_total;
-			teenagent.render(surface, position, o, 1);
-			++progress;
-			if (progress >= progress_total) {
-				position = destination;
-				if (orientation == 0)
-					orientation = o; //save last orientation
-				nextEvent();
+				position.x = position0.x + dp.x * progress / progress_total;
+				position.y = position0.y + dp.y * progress / progress_total;
+				teenagent.render(surface, position, o, 1);
+				++progress;
+				if (progress >= progress_total) {
+					position = destination;
+					if (orientation == 0)
+						orientation = o; //save last orientation
+					nextEvent();
+				} else 
+					busy = true;
 			} else 
-				busy = true;
-		} else 
-			teenagent.render(surface, position, orientation, 0);
-	} else {
-		mark->render(surface);
-		busy = true;
-		got_any_animation = true;
+				teenagent.render(surface, position, orientation, 0);
+		} else {
+			mark->render(surface);
+			busy = true;
+			got_any_animation = true;
+		}
 	}
 
 	if (current_event.type == SceneEvent::WaitForAnimation && !got_any_animation) {
@@ -507,6 +511,11 @@
 			current_event.clear();
 		} break;
 		
+		case SceneEvent::HideActor: {
+			hide_actor = current_event.color != 0;
+			current_event.clear();
+		} break;
+		
 		case SceneEvent::WaitForAnimation:
 			debug(0, "waiting for the animation");
 			break;
@@ -520,6 +529,9 @@
 			error("empty/unhandler event[%d]", (int)current_event.type);
 		}
 	}
+	if (events.empty()) {
+		hide_actor = false;
+	}
 	return !current_event.empty();
 }
 

Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h	2009-09-13 12:17:33 UTC (rev 44054)
+++ scummvm/trunk/engines/teenagent/scene.h	2009-09-13 12:48:57 UTC (rev 44055)
@@ -42,8 +42,9 @@
 	enum Type { 
 		None, Message, Walk, PlayAnimation, PlayActorAnimation, 
 		LoadScene, SetOn, SetLan, PlayMusic, 
-		PlaySound, EnableObject, WaitForAnimation,
-		CreditsMessage, Quit
+		PlaySound, EnableObject, HideActor, 
+		WaitForAnimation, CreditsMessage, 
+		Quit
 	} type;
 
 	Common::String message;
@@ -161,6 +162,7 @@
 	typedef Common::List<SceneEvent> EventList;
 	EventList events;
 	SceneEvent current_event;
+	bool hide_actor;
 	
 	struct Sound {
 		byte id, delay;

Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp	2009-09-13 12:17:33 UTC (rev 44054)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp	2009-09-13 12:48:57 UTC (rev 44055)
@@ -499,6 +499,18 @@
 	scene->push(event);
 }
 
+void TeenAgentEngine::hideActor() {
+	SceneEvent event(SceneEvent::HideActor);
+	event.color = 1;
+	scene->push(event);
+}
+
+void TeenAgentEngine::showActor() {
+	SceneEvent event(SceneEvent::HideActor);
+	event.color = 0;
+	scene->push(event);
+}
+
 void TeenAgentEngine::waitAnimation() {
 	SceneEvent event(SceneEvent::WaitForAnimation);
 	scene->push(event);

Modified: scummvm/trunk/engines/teenagent/teenagent.h
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.h	2009-09-13 12:17:33 UTC (rev 44054)
+++ scummvm/trunk/engines/teenagent/teenagent.h	2009-09-13 12:48:57 UTC (rev 44055)
@@ -88,6 +88,8 @@
 	void playSoundNow(byte id);
 	void enableObject(byte id, byte scene_id = 0);
 	void disableObject(byte id, byte scene_id = 0);
+	void hideActor();
+	void showActor();
 	void waitAnimation();
 
 	Common::RandomSource random;


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