From 2b083c491d4dd3980fe85b3f5d34ec526fedc162 Mon Sep 17 00:00:00 2001 From: Vladimir Menshakov Date: Sat, 2 Jan 2010 20:44:47 +0000 Subject: [PATCH] added fadeout tables svn-id: r46898 --- engines/teenagent/objects.cpp | 5 +++++ engines/teenagent/objects.h | 7 +++++++ engines/teenagent/scene.cpp | 11 +++++++++++ engines/teenagent/scene.h | 1 + 4 files changed, 24 insertions(+) diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp index fc4bec245a4..87635ae44bf 100644 --- a/engines/teenagent/objects.cpp +++ b/engines/teenagent/objects.cpp @@ -172,5 +172,10 @@ void Walkbox::save() const { rect.save(); } +void FadeType::load(byte *src) { + rect.load(src); + src += 8; + value = *src; +} } // End of namespace TeenAgent diff --git a/engines/teenagent/objects.h b/engines/teenagent/objects.h index dedcd7cc02d..c4bca3331be 100644 --- a/engines/teenagent/objects.h +++ b/engines/teenagent/objects.h @@ -215,6 +215,13 @@ protected: byte * _base; }; +struct FadeType { + Rect rect; + byte value; + + void load(byte *src); +}; + //\todo move it to util.h? template inline T SIGN (T x) { return (x > 0)? 1: ((x < 0)? -1: 0); } diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index 7a640abd2b8..49c12e1ee52 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -221,6 +221,7 @@ void Scene::loadObjectData() { //loading objects & walkboxes objects.resize(42); walkboxes.resize(42); + fades.resize(42); for (byte i = 0; i < 42; ++i) { Common::Array &scene_objects = objects[i]; @@ -248,6 +249,16 @@ void Scene::loadObjectData() { //walkbox[i]->dump(); scene_walkboxes.push_back(w); } + + byte *fade_table = res->dseg.ptr(res->dseg.get_word(0x663e + i * 2)); + Common::Array &scene_fades = fades[i]; + while(READ_LE_UINT16(fade_table) != 0xffff) { + FadeType fade; + fade.load(fade_table); + fade_table += 9; + scene_fades.push_back(fade); + } + debug(0, "scene[%u] has %u fadeboxes", i + 1, scene_fades.size()); } } diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h index 51c1fc4ffdb..9e48ad6351a 100644 --- a/engines/teenagent/scene.h +++ b/engines/teenagent/scene.h @@ -201,6 +201,7 @@ private: Common::Array > objects; Common::Array > walkboxes; + Common::Array > fades; Common::String message; Common::Point message_pos;