diff options
author | Vladimir Menshakov | 2009-09-15 19:21:45 +0000 |
---|---|---|
committer | Vladimir Menshakov | 2009-09-15 19:21:45 +0000 |
commit | e78bd81ac081789a743afbe8ca8e885c53476a99 (patch) | |
tree | 12e3d3b64df09912ebb061bb29d96c7a8c1df06d /engines | |
parent | 2244060d7f790416102a9ef035bbe61f86717835 (diff) | |
download | scummvm-rg350-e78bd81ac081789a743afbe8ca8e885c53476a99.tar.gz scummvm-rg350-e78bd81ac081789a743afbe8ca8e885c53476a99.tar.bz2 scummvm-rg350-e78bd81ac081789a743afbe8ca8e885c53476a99.zip |
return bounding boxes from the render(), slightly changed internal events arguments.
svn-id: r44107
Diffstat (limited to 'engines')
-rw-r--r-- | engines/teenagent/actor.cpp | 9 | ||||
-rw-r--r-- | engines/teenagent/actor.h | 2 | ||||
-rw-r--r-- | engines/teenagent/dialog.cpp | 27 | ||||
-rw-r--r-- | engines/teenagent/scene.cpp | 43 | ||||
-rw-r--r-- | engines/teenagent/scene.h | 3 | ||||
-rw-r--r-- | engines/teenagent/surface.cpp | 3 | ||||
-rw-r--r-- | engines/teenagent/surface.h | 2 | ||||
-rw-r--r-- | engines/teenagent/teenagent.cpp | 3 |
8 files changed, 38 insertions, 54 deletions
diff --git a/engines/teenagent/actor.cpp b/engines/teenagent/actor.cpp index 59df814f1c..c52cd1e6bc 100644 --- a/engines/teenagent/actor.cpp +++ b/engines/teenagent/actor.cpp @@ -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 @@ void Actor::render(Graphics::Surface *surface, const Common::Point &position, ui dy = 67; break; default: - return; + return Common::Rect(); } index += delta_frame; @@ -76,9 +76,8 @@ void Actor::render(Graphics::Surface *surface, const Common::Point &position, ui 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 diff --git a/engines/teenagent/actor.h b/engines/teenagent/actor.h index ec0fbe319c..693ca7a2ee 100644 --- a/engines/teenagent/actor.h +++ b/engines/teenagent/actor.h @@ -29,7 +29,7 @@ namespace TeenAgent { 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 diff --git a/engines/teenagent/dialog.cpp b/engines/teenagent/dialog.cpp index dc3fe987f6..302080fb48 100644 --- a/engines/teenagent/dialog.cpp +++ b/engines/teenagent/dialog.cpp @@ -40,14 +40,14 @@ void Dialog::show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation 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 @@ void Dialog::show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation //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 @@ void Dialog::show(Scene *scene, uint16 addr, uint16 animation1, uint16 animation 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); } diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index d4cad5a1fe..f2d7709336 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -160,7 +160,7 @@ void Scene::loadLans() { //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 @@ void Scene::loadLans() { 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 @@ void Scene::playAnimation(byte idx, uint id, bool loop, bool paused) { 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 @@ bool Scene::processEvent(const Common::Event &event) { 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 Scene::render(OSystem *system) { 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 @@ bool Scene::render(OSystem *system) { 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 @@ bool Scene::render(OSystem *system) { } 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 @@ bool Scene::processEventQueue() { 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 @@ bool Scene::processEventQueue() { 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; diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h index e02cf6242c..36934019c5 100644 --- a/engines/teenagent/scene.h +++ b/engines/teenagent/scene.h @@ -146,7 +146,8 @@ private: 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; diff --git a/engines/teenagent/surface.cpp b/engines/teenagent/surface.cpp index d253b40076..9bde604b8f 100644 --- a/engines/teenagent/surface.cpp +++ b/engines/teenagent/surface.cpp @@ -75,7 +75,7 @@ void Surface::load(Common::SeekableReadStream *stream, Type type) { 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 @@ void Surface::render(Graphics::Surface *surface, int dx, int dy, bool mirror) { dst += surface->pitch; src += pitch; } + return Common::Rect(x + dx, y + dy, x + w + dx, y + h + dy); } } // End of namespace TeenAgent diff --git a/engines/teenagent/surface.h b/engines/teenagent/surface.h index eb524a2198..e48cb3d2aa 100644 --- a/engines/teenagent/surface.h +++ b/engines/teenagent/surface.h @@ -40,7 +40,7 @@ public: 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; } }; diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index 6c65d6bee3..87c172d95a 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -413,7 +413,7 @@ void TeenAgentEngine::moveRel(int16 x, int16 y, byte o, bool warp) { 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::playAnimation(uint16 id, byte slot, bool async) { void TeenAgentEngine::playActorAnimation(uint16 id, bool async) { SceneEvent event(SceneEvent::PlayActorAnimation); event.animation = id; - event.color = 0; scene->push(event); if (!async) waitAnimation(); |