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

megath at users.sourceforge.net megath at users.sourceforge.net
Sun Nov 15 11:15:40 CET 2009


Revision: 45914
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45914&view=rev
Author:   megath
Date:     2009-11-15 10:15:39 +0000 (Sun, 15 Nov 2009)

Log Message:
-----------
added face animation.

Modified Paths:
--------------
    scummvm/trunk/engines/teenagent/actor.cpp
    scummvm/trunk/engines/teenagent/actor.h
    scummvm/trunk/engines/teenagent/scene.cpp

Modified: scummvm/trunk/engines/teenagent/actor.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/actor.cpp	2009-11-15 09:51:54 UTC (rev 45913)
+++ scummvm/trunk/engines/teenagent/actor.cpp	2009-11-15 10:15:39 UTC (rev 45914)
@@ -27,13 +27,21 @@
 
 namespace TeenAgent {
 
-Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame) {
+Actor::Actor() : head_index(0) {}
+
+//idle animation lists at dseg: 0x6540
+
+Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame, bool render_head) {
 	const uint8 frames_left_right[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
 	const uint8 frames_up[] = {18, 19, 20, 21, 22, 23, 24, 25, };
 	const uint8 frames_down[] = {10, 11, 12, 13, 14, 15, 16, 17, };
 
-	Surface *s = NULL;
+	const uint8 frames_head_left_right[] = {39, 26, 27, 28, 29, 30, 31, };
+	const uint8 frames_head_up[] = { 41, 37, 38, };
+	const uint8 frames_head_down[] = {40, 32, 33, 34, 35, 36};
 
+	Surface *s = NULL, *head = NULL;
+
 	if (delta_frame == 0) {
 		index = 0; //static animation
 	}
@@ -41,6 +49,13 @@
 	switch (orientation) {
 	case Object::kActorLeft:
 	case Object::kActorRight:
+		if (render_head) {
+			if (head_index >= sizeof(frames_head_left_right))
+				head_index = 0;
+			head = frames + frames_head_left_right[head_index];
+			++head_index;
+		}
+
 		if (index >= sizeof(frames_left_right))
 			index = 1;
 		s = frames + frames_left_right[index];
@@ -48,6 +63,13 @@
 		dy = 62;
 		break;
 	case Object::kActorUp:
+		if (render_head) {
+			if (head_index >= sizeof(frames_head_up))
+				head_index = 0;
+			head = frames + frames_head_up[head_index];
+			++head_index;
+		}
+
 		if (index >= sizeof(frames_up))
 			index = 1;
 		s = frames + frames_up[index];
@@ -55,6 +77,13 @@
 		dy = 62;
 		break;
 	case Object::kActorDown:
+		if (render_head) {
+			if (head_index >= sizeof(frames_head_down))
+				head_index = 0;
+			head = frames + frames_head_down[head_index];
+			++head_index;
+		}
+
 		if (index >= sizeof(frames_down))
 			index = 1;
 		s = frames + frames_down[index];
@@ -77,7 +106,15 @@
 	if (yp + s->h > 200)
 		yp = 200 - s->h;
 	
-	return s != NULL? s->render(surface, xp, yp, orientation == Object::kActorLeft): Common::Rect();
+	Common::Rect dirty;
+	
+	if (s)
+		dirty = s->render(surface, xp, yp, orientation == Object::kActorLeft);
+
+	if (head)
+		dirty.extend(head->render(surface, xp, yp, orientation == Object::kActorLeft));
+
+	return dirty;
 }
 
 } // End of namespace TeenAgent

Modified: scummvm/trunk/engines/teenagent/actor.h
===================================================================
--- scummvm/trunk/engines/teenagent/actor.h	2009-11-15 09:51:54 UTC (rev 45913)
+++ scummvm/trunk/engines/teenagent/actor.h	2009-11-15 10:15:39 UTC (rev 45914)
@@ -28,8 +28,10 @@
 namespace TeenAgent {
 
 class Actor : public Animation {
+	uint head_index;
 public:
-	Common::Rect render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame);
+	Actor();
+	Common::Rect render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame, bool head);
 };
 
 } // End of namespace TeenAgent

Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp	2009-11-15 09:51:54 UTC (rev 45913)
+++ scummvm/trunk/engines/teenagent/scene.cpp	2009-11-15 10:15:39 UTC (rev 45914)
@@ -654,7 +654,7 @@
 					position.x += (ABS(dp.x) < speed_x? dp.x: SIGN(dp.x) * speed_x);
 					position.y += (ABS(dp.y) < speed_y? dp.y: SIGN(dp.y) * speed_y);
 					
-					actor_animation_position = teenagent.render(surface, position, o, 1);
+					actor_animation_position = teenagent.render(surface, position, o, 1, false);
 					if (position == destination) {
 						path.pop_front();
 						if (path.empty()) {
@@ -668,7 +668,7 @@
 					} else
 						busy = true;
 				} else
-					actor_animation_position = teenagent.render(surface, position, orientation, 0);
+					actor_animation_position = teenagent.render(surface, position, orientation, 0, false);
 			}
 		}
 


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