[Scummvm-cvs-logs] SF.net SVN: scummvm:[44107] scummvm/trunk/engines/teenagent
megath at users.sourceforge.net
megath at users.sourceforge.net
Tue Sep 15 21:21:45 CEST 2009
Revision: 44107
http://scummvm.svn.sourceforge.net/scummvm/?rev=44107&view=rev
Author: megath
Date: 2009-09-15 19:21:45 +0000 (Tue, 15 Sep 2009)
Log Message:
-----------
return bounding boxes from the render(), slightly changed internal events arguments.
Modified Paths:
--------------
scummvm/trunk/engines/teenagent/actor.cpp
scummvm/trunk/engines/teenagent/actor.h
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/surface.h
scummvm/trunk/engines/teenagent/teenagent.cpp
Modified: scummvm/trunk/engines/teenagent/actor.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/actor.cpp 2009-09-15 14:39:24 UTC (rev 44106)
+++ scummvm/trunk/engines/teenagent/actor.cpp 2009-09-15 19:21:45 UTC (rev 44107)
@@ -27,7 +27,7 @@
namespace TeenAgent {
-void Actor::render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame) {
+Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame) {
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, };
@@ -62,7 +62,7 @@
dy = 67;
break;
default:
- return;
+ return Common::Rect();
}
index += delta_frame;
@@ -76,9 +76,8 @@
yp = 0;
if (yp + s->h > 200)
yp = 200 - s->h;
-
- if (s != NULL)
- s->render(surface, xp, yp, orientation == Object::ActorLeft);
+
+ return s != NULL? s->render(surface, xp, yp, orientation == Object::ActorLeft): Common::Rect();
}
} // End of namespace TeenAgent
Modified: scummvm/trunk/engines/teenagent/actor.h
===================================================================
--- scummvm/trunk/engines/teenagent/actor.h 2009-09-15 14:39:24 UTC (rev 44106)
+++ scummvm/trunk/engines/teenagent/actor.h 2009-09-15 19:21:45 UTC (rev 44107)
@@ -29,7 +29,7 @@
class Actor : public Animation {
public:
- void render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame);
+ Common::Rect render(Graphics::Surface *surface, const Common::Point &position, uint8 orientation, int delta_frame);
};
} // End of namespace TeenAgent
Modified: scummvm/trunk/engines/teenagent/dialog.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/dialog.cpp 2009-09-15 14:39:24 UTC (rev 44106)
+++ scummvm/trunk/engines/teenagent/dialog.cpp 2009-09-15 19:21:45 UTC (rev 44107)
@@ -40,14 +40,14 @@
if (animation1 != 0) {
SceneEvent e(SceneEvent::PlayAnimation);
e.animation = animation1;
- e.color = 0xc0 | slot1; //looped, paused
+ e.lan = 0xc0 | slot1; //looped, paused
scene->push(e);
}
if (animation2 != 0) {
SceneEvent e(SceneEvent::PlayAnimation);
e.animation = animation2;
- e.color = 0xc0 | slot2; //looped, paused
+ e.lan = 0xc0 | slot2; //looped, paused
scene->push(e);
}
@@ -70,26 +70,26 @@
//pause animation in other slot
{
SceneEvent e(SceneEvent::PauseAnimation);
- e.color = 0x80 | slot1;
+ e.lan = 0x80 | slot1;
scene->push(e);
}
{
SceneEvent e(SceneEvent::PlayAnimation);
e.animation = animation2;
- e.color = 0x80 | slot2;
+ e.lan = 0x80 | slot2;
scene->push(e);
}
} else if (color == color1 && animation1 != 0) {
//pause animation in other slot
{
SceneEvent e(SceneEvent::PauseAnimation);
- e.color = 0x80 | slot2;
+ e.lan = 0x80 | slot2;
scene->push(e);
}
{
SceneEvent e(SceneEvent::PlayAnimation);
e.animation = animation1;
- e.color = 0x80 | slot1;
+ e.lan = 0x80 | slot1;
scene->push(e);
}
}
@@ -120,20 +120,7 @@
n = 0;
}
}
- /*
- if (!message.empty()) {
- if (animation != 0) {
- SceneEvent e(SceneEvent::PlayAnimation);
- e.animation = animation;
- e.color = 0x41;
- scene->push(e);
- } //copy paste ninja was here
- SceneEvent e(SceneEvent::Message);
- e.message = message;
- e.color = color;
- scene->push(e);
- }
- */
+
SceneEvent e(SceneEvent::ClearAnimations);
scene->push(e);
}
Modified: scummvm/trunk/engines/teenagent/scene.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/scene.cpp 2009-09-15 14:39:24 UTC (rev 44106)
+++ scummvm/trunk/engines/teenagent/scene.cpp 2009-09-15 19:21:45 UTC (rev 44107)
@@ -160,7 +160,7 @@
//load lan000
for (int i = 0; i < 4; ++i) {
- animations[i].free();
+ animation[i].free();
uint16 bx = 0xd89e + (_id - 1) * 4 + i;
byte bxv = res->dseg.get_byte(bx);
@@ -171,9 +171,9 @@
Common::SeekableReadStream *s = res->loadLan000(res_id);
if (s != NULL) {
- animations[i].load(s, Animation::TypeLan);
+ animation[i].load(s, Animation::TypeLan);
if (bxv != 0 && bxv != 0xff)
- animations[i].id = bxv;
+ animation[i].id = bxv;
delete s;
}
@@ -237,9 +237,9 @@
if (s == NULL)
error("playing animation %u failed", id);
- custom_animations[idx].load(s);
- custom_animations[idx].loop = loop;
- custom_animations[idx].paused = paused;
+ custom_animation[idx].load(s);
+ custom_animation[idx].loop = loop;
+ custom_animation[idx].paused = paused;
}
void Scene::playActorAnimation(uint id, bool loop) {
@@ -277,7 +277,7 @@
current_event.clear();
message_color = 0xd1;
for (int i = 0; i < 4; ++i)
- custom_animations[i].free();
+ custom_animation[i].free();
_engine->playMusic(4);
init(10, Common::Point(136, 153));
}
@@ -327,21 +327,21 @@
bool got_any_animation = false;
for (int i = 0; i < 4; ++i) {
- Animation *a = custom_animations + i;
+ Animation *a = custom_animation + i;
Surface *s = a->currentFrame();
if (s != NULL) {
- s->render(surface);
+ animation_position[i] = s->render(surface);
busy = true;
got_any_animation = true;
continue;
}
- a = animations + i;
+ a = animation + i;
s = a->currentFrame();
if (s == NULL)
continue;
- s->render(surface);
+ animation_position[i] = s->render(surface);
if (a->id == 0)
continue;
@@ -371,7 +371,7 @@
position.x = position0.x + dp.x * progress / progress_total;
position.y = position0.y + dp.y * progress / progress_total;
- teenagent.render(surface, position, o, 1);
+ actor_animation_position = teenagent.render(surface, position, o, 1);
++progress;
if (progress >= progress_total) {
position = destination;
@@ -384,11 +384,12 @@
} else
teenagent.render(surface, position, orientation, 0);
} else {
- mark->render(surface);
+ actor_animation_position = mark->render(surface);
busy = true;
got_any_animation = true;
}
- }
+ } else
+ actor_animation_position = Common::Rect();
if (!message.empty()) {
res->font7.color = message_color;
@@ -488,25 +489,25 @@
case SceneEvent::PlayAnimation:
debug(0, "playing animation %u", current_event.animation);
- playAnimation(current_event.color & 0x3 /*slot actually :)*/, current_event.animation, (current_event.color & 0x80) != 0, (current_event.color & 0x40) != 0);
+ 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);
- custom_animations[current_event.color & 3].paused = (current_event.color & 0x80) != 0;
+ custom_animation[current_event.lan & 3].paused = (current_event.lan & 0x80) != 0;
current_event.clear();
break;
case SceneEvent::ClearAnimations:
for (byte i = 0; i < 4; ++i)
- custom_animations[i].free();
+ custom_animation[i].free();
current_event.clear();
break;
case SceneEvent::PlayActorAnimation:
debug(0, "playing actor animation %u", current_event.animation);
- playActorAnimation(current_event.animation, (current_event.color & 0x80) != 0);
+ playActorAnimation(current_event.animation, (current_event.lan & 0x80) != 0);
current_event.clear();
break;
@@ -519,11 +520,7 @@
case SceneEvent::PlaySound:
debug(0, "playing sound %u, delay: %u", current_event.sound, current_event.color);
- if (current_event.color == 0) {
- _engine->playSoundNow(current_event.sound);
- } else {
- sounds.push_back(Sound(current_event.sound, current_event.color));
- }
+ sounds.push_back(Sound(current_event.sound, current_event.color));
current_event.clear();
break;
Modified: scummvm/trunk/engines/teenagent/scene.h
===================================================================
--- scummvm/trunk/engines/teenagent/scene.h 2009-09-15 14:39:24 UTC (rev 44106)
+++ scummvm/trunk/engines/teenagent/scene.h 2009-09-15 19:21:45 UTC (rev 44107)
@@ -146,7 +146,8 @@
Surface on;
Surface *ons;
uint32 ons_count;
- Animation actor_animation, animations[4], custom_animations[4];
+ Animation actor_animation, animation[4], custom_animation[4];
+ Common::Rect actor_animation_position, animation_position[4];
Actor teenagent, teenagent_idle;
Common::Point position0, position, destination;
Modified: scummvm/trunk/engines/teenagent/surface.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/surface.cpp 2009-09-15 14:39:24 UTC (rev 44106)
+++ scummvm/trunk/engines/teenagent/surface.cpp 2009-09-15 19:21:45 UTC (rev 44107)
@@ -75,7 +75,7 @@
stream->read(pixels, w_ * h_);
}
-void Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror) {
+Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror) {
assert(x + w <= surface->w);
assert(y + h <= surface->h);
@@ -91,6 +91,7 @@
dst += surface->pitch;
src += pitch;
}
+ return Common::Rect(x + dx, y + dy, x + w + dx, y + h + dy);
}
} // End of namespace TeenAgent
Modified: scummvm/trunk/engines/teenagent/surface.h
===================================================================
--- scummvm/trunk/engines/teenagent/surface.h 2009-09-15 14:39:24 UTC (rev 44106)
+++ scummvm/trunk/engines/teenagent/surface.h 2009-09-15 19:21:45 UTC (rev 44107)
@@ -40,7 +40,7 @@
Surface();
void load(Common::SeekableReadStream *stream, Type type);
- void render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false);
+ Common::Rect render(Graphics::Surface *surface, int dx = 0, int dy = 0, bool mirror = false);
bool empty() const { return pixels == NULL; }
};
Modified: scummvm/trunk/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/trunk/engines/teenagent/teenagent.cpp 2009-09-15 14:39:24 UTC (rev 44106)
+++ scummvm/trunk/engines/teenagent/teenagent.cpp 2009-09-15 19:21:45 UTC (rev 44107)
@@ -413,7 +413,7 @@
void TeenAgentEngine::playAnimation(uint16 id, byte slot, bool async) {
SceneEvent event(SceneEvent::PlayAnimation);
event.animation = id;
- event.color = slot;
+ event.lan = slot;
scene->push(event);
if (!async)
waitAnimation();
@@ -422,7 +422,6 @@
void TeenAgentEngine::playActorAnimation(uint16 id, bool async) {
SceneEvent event(SceneEvent::PlayActorAnimation);
event.animation = id;
- event.color = 0;
scene->push(event);
if (!async)
waitAnimation();
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