From 0cdcd59322be384c9f2638cda2df50aa32105b1b Mon Sep 17 00:00:00 2001 From: Vladimir Menshakov Date: Fri, 1 Jan 2010 13:54:05 +0000 Subject: found zoom tables, added original zoom support. svn-id: r46823 --- engines/teenagent/scene.cpp | 27 ++++++++++++++++++--------- engines/teenagent/scene.h | 1 + 2 files changed, 19 insertions(+), 9 deletions(-) (limited to 'engines/teenagent') diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index f3e1a66905..7a640abd2b 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -498,6 +498,22 @@ struct ZOrderCmp { } }; +int Scene::lookupZoom(uint y) const { + Resources *res = Resources::instance(); + for(byte *zoom_table = res->dseg.ptr(res->dseg.get_word(0x70f4 + (_id - 1) * 2)); + zoom_table[0] != 0xff && zoom_table[1] != 0xff; + zoom_table += 2 + ) { + //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); + if (y <= zoom_table[0]) { + //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); + return 256u * (100 - zoom_table[1]) / 100; + } + } + return 256; +} + + bool Scene::render(OSystem *system) { Resources *res = Resources::instance(); bool busy; @@ -643,17 +659,10 @@ bool Scene::render(OSystem *system) { got_any_animation = true; } else if (!hide_actor) { actor_animation.free(); - uint zoom = 256; - const int zoom_min = 115, zoom_max = 150; - if (_id == 18 && position.y < zoom_max) { //zoom hack - if (position.y >= zoom_min) - zoom = 128 + 128 * (position.y - zoom_min) / (zoom_max - zoom_min); - else - zoom = 128; - } + uint zoom = lookupZoom(position.y); if (!path.empty()) { - const int speed_x = 10, speed_y = 3; + const int speed_x = 10 * zoom / 256, speed_y = 3 * zoom / 256; const Common::Point &destination = path.front(); Common::Point dp(destination.x - position.x, destination.y - position.y); diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h index bdd38c6efb..51c1fc4ffd 100644 --- a/engines/teenagent/scene.h +++ b/engines/teenagent/scene.h @@ -158,6 +158,7 @@ public: inline Animation * getActorAnimation() { return &actor_animation; } inline const Common::String& getMessage() const { return message; } void setPalette(unsigned mul); + int lookupZoom(uint y) const; private: void loadOns(); -- cgit v1.2.3