[Scummvm-cvs-logs] SF.net SVN: scummvm:[44108] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Tue Sep 15 22:08:35 CEST 2009
Revision: 44108
http://scummvm.svn.sourceforge.net/scummvm/?rev=44108&view=rev
Author: megath
Date: 2009-09-15 20:08:28 +0000 (Tue, 15 Sep 2009)
Log Message:
-----------
implemented proper dialog positioning
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/dialog.cpp
scummvm/trunk/engines/teenagent/scene.cpp
scummvm/trunk/engines/teenagent/scene.h
scummvm/trunk/engines/teenagent/surface.cpp
scummvm/trunk/engines/teenagent/teenagent.cpp
Modified: scummvm/trunk/engines/teenagent/dialog.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/dialog.cpp 2009-09-15 19:21:45 UTC (rev 44107)
+++ scummvm/trunk/engines/teenagent/dialog.cpp 2009-09-15 20:08:28 UTC (rev 44108)
@@ -98,6 +98,10 @@
SceneEvent e(SceneEvent::Message);
e.message = message;
e.color = color;
+ if (animation1 != 0 && color == color1)
+ e.lan = slot1;
+ if (animation2 != 0 && color == color2)
+ e.lan = slot2;
scene->push(e);
message.clear();
}
Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp 2009-09-15 19:21:45 UTC (rev 44107)
+++ scummvm/trunk/engines/teenagent/scene.cpp 2009-09-15 20:08:28 UTC (rev 44108)
@@ -382,7 +382,7 @@
} else
busy = true;
} else
- teenagent.render(surface, position, orientation, 0);
+ actor_animation_position = teenagent.render(surface, position, orientation, 0);
} else {
actor_animation_position = mark->render(surface);
busy = true;
@@ -480,21 +480,36 @@
break;
case SceneEvent::CreditsMessage:
- case SceneEvent::Message:
- //debug(0, "pop(%04x)", current_event.message);
- message = current_event.message;
- message_pos = messagePosition(message, position);
- message_color = current_event.color;
+ case SceneEvent::Message: {
+ message = current_event.message;
+ Common::Point p(
+ (actor_animation_position.left + actor_animation_position.right) / 2,
+ actor_animation_position.top
+ );
+ //FIXME: rewrite it:
+ if (current_event.lan < 4) {
+ const Surface * s = custom_animation[current_event.lan].currentFrame(0);
+ if (s == NULL)
+ s = animation[current_event.lan].currentFrame(0);
+ if (s != NULL) {
+ p.x = s->x + s->w / 2;
+ p.y = s->y;
+ } else
+ warning("no animation in slot %u", current_event.lan);
+ }
+ message_pos = messagePosition(message, p);
+ message_color = current_event.color;
+ }
break;
case SceneEvent::PlayAnimation:
- debug(0, "playing animation %u", current_event.animation);
+ debug(0, "playing animation %u in slot %u", current_event.animation, current_event.lan & 3);
playAnimation(current_event.lan & 0x3, current_event.animation, (current_event.lan & 0x80) != 0, (current_event.lan & 0x40) != 0);
current_event.clear();
break;
case SceneEvent::PauseAnimation:
- debug(0, "pause animation in slot %u", current_event.color & 3);
+ debug(0, "pause animation in slot %u", current_event.lan & 3);
custom_animation[current_event.lan & 3].paused = (current_event.lan & 0x80) != 0;
current_event.clear();
break;
@@ -582,18 +597,17 @@
return obj;
}
-Common::Point Scene::messagePosition(const Common::String &str, const Common::Point &position) {
+Common::Point Scene::messagePosition(const Common::String &str, Common::Point position) {
Resources *res = Resources::instance();
uint w = res->font7.render(NULL, 0, 0, str);
- Common::Point message_pos = position;
- message_pos.x -= w / 2;
- message_pos.y -= 62;
- if (message_pos.x + w > 320)
- message_pos.x = 320 - w;
- if (message_pos.x < 0)
- message_pos.x = 0;
+ position.x -= w / 2;
+ position.y -= res->font7.height + 3;
+ if (position.x + w > 320)
+ position.x = 320 - w;
+ if (position.x < 0)
+ position.x = 0;
- return message_pos;
+ return position;
}
void Scene::displayMessage(const Common::String &str, byte color) {
Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h 2009-09-15 19:21:45 UTC (rev 44107)
+++ scummvm/trunk/engines/teenagent/scene.h 2009-09-15 20:08:28 UTC (rev 44108)
@@ -130,7 +130,7 @@
byte palette[768];
void setPalette(OSystem *system, const byte *palette, unsigned mul = 1);
- static Common::Point messagePosition(const Common::String &str, const Common::Point &position);
+ static Common::Point messagePosition(const Common::String &str, Common::Point position);
bool processEventQueue();
inline bool nextEvent() {
Modified: scummvm/trunk/engines/teenagent/surface.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/surface.cpp 2009-09-15 19:21:45 UTC (rev 44107)
+++ scummvm/trunk/engines/teenagent/surface.cpp 2009-09-15 20:08:28 UTC (rev 44108)
@@ -76,8 +76,8 @@
}
Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror) {
- assert(x + w <= surface->w);
- assert(y + h <= surface->h);
+ assert(x + dx + w <= surface->w);
+ assert(y + dy + h <= surface->h);
byte *src = (byte *)pixels;
byte *dst = (byte *)surface->getBasePtr(dx + x, dy + y);
Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp 2009-09-15 19:21:45 UTC (rev 44107)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp 2009-09-15 20:08:28 UTC (rev 44108)
@@ -338,6 +338,7 @@
SceneEvent event(SceneEvent::Message);
event.message = str;
event.color = color;
+ event.lan = 4;
scene->push(event);
}
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