diff options
-rw-r--r-- | engines/teenagent/callbacks.cpp | 62 | ||||
-rw-r--r-- | engines/teenagent/objects.cpp | 15 | ||||
-rw-r--r-- | engines/teenagent/objects.h | 12 | ||||
-rw-r--r-- | engines/teenagent/scene.cpp | 2 |
4 files changed, 65 insertions, 26 deletions
diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index 2ea097b791..7dc62ce173 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -1277,7 +1277,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { SET_FLAG(0xDB98, f); if (f >= 2) { //disable object boat for scene 15!! - scene->getObject(1, 15)->enabled = 0; + disableObject(1, 15); } } return true; @@ -1297,7 +1297,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { SET_FLAG(0xDB98, f); if (f >= 2) { //disable object boat for scene 15!! - scene->getObject(1, 15)->enabled = 0; + disableObject(1, 15); } } return true; @@ -2392,14 +2392,17 @@ bool TeenAgentEngine::processCallback(uint16 addr) { displayMessage(0x3cfb); playAnimation(507, 1); setOns(0, 4); - Object * obj = scene->getObject(3); - obj->rect.top += 20; - obj->rect.bottom += 20; + { + Object *obj = scene->getObject(3); + obj->rect.top += 20; + obj->rect.bottom += 20; + obj->rect.save(); + } playSound(10); playAnimation(503, 1); setLan(1, 0, 22); - scene->getObject(1, 22)->enabled = 0; - scene->getObject(13, 20)->enabled = 0; + disableObject(1, 22); + disableObject(13, 20); setLan(1, 0); disableObject(1); disableObject(2); @@ -2419,10 +2422,18 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(62); //patch lan, 1 displayMessage(0x3d3a); - scene->getObject(7)->actor_rect.left = 228; - scene->getObject(7)->actor_rect.top = 171; - scene->getObject(8)->actor_rect.left = 290; - scene->getObject(8)->actor_rect.top = 171; + { + Object *obj = scene->getObject(7); + obj->actor_rect.left = 228; + obj->actor_rect.top = 171; + obj->actor_rect.save(); + } + { + Object *obj = scene->getObject(8); + obj->actor_rect.left = 290; + obj->actor_rect.top = 171; + obj->actor_rect.save(); + } } return true; @@ -3347,12 +3358,24 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(714, 1); setLan(1, 0); disableObject(1); - scene->getObject(2)->actor_rect = Rect(81, 160, 81, 160); - scene->getObject(2)->actor_orientation = 4; - scene->getObject(3)->actor_rect = Rect(63, 168, 63, 168); - scene->getObject(3)->actor_orientation = 4; - scene->getObject(10)->actor_rect = Rect(105, 160, 105, 160); - scene->getObject(10)->actor_orientation = 1; + { + Object *obj = scene->getObject(2); + obj->actor_rect = Rect(81, 160, 81, 160); + obj->actor_orientation = 4; + obj->save(); + } + { + Object *obj = scene->getObject(3); + obj->actor_rect = Rect(63, 168, 63, 168); + obj->actor_orientation = 4; + obj->save(); + } + { + Object *obj = scene->getObject(10); + obj->actor_rect = Rect(105, 160, 105, 160); + obj->actor_orientation = 1; + obj->save(); + } SET_FLAG(0xDBCC, 1); return true; @@ -3661,13 +3684,16 @@ bool TeenAgentEngine::processCallback(uint16 addr) { Dialog::show(scene, 0x58a9); - Object * obj = scene->getObject(1); + Object *obj = scene->getObject(1); obj->actor_rect = Rect(270, 193, 270, 193); obj->actor_orientation = 2; + obj->save(); obj = scene->getObject(3); obj->actor_rect = Rect(254, 193, 254, 193); obj->actor_orientation = 1; + obj->save(); + SET_FLAG(0xDBD7, 1); } return true; diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp index 90abd38b1c..945d33b777 100644 --- a/engines/teenagent/objects.cpp +++ b/engines/teenagent/objects.cpp @@ -71,6 +71,15 @@ void Object::load(byte * src) { description = parse_description((const char *)src); } +void Object::save() { + assert(_base != NULL); + + rect.save(); + actor_rect.save(); + _base[17] = actor_orientation; + _base[18] = enabled; +} + void Object::setName(const Common::String &new_name) { assert(_base != 0); strcpy((char *)(_base + 19), new_name.c_str()); @@ -133,9 +142,9 @@ void UseHotspot::load(byte *src) { void Walkbox::dump() { debug(0, "walkbox %02x %02x [%d, %d, %d, %d] %02x %02x %02x %02x ", - unk00, orientation, - rect.left, rect.right, rect.top, rect.bottom, - unk0a, unk0b, unk0c, unk0d); + unk00, orientation, + rect.left, rect.right, rect.top, rect.bottom, + unk0a, unk0b, unk0c, unk0d); } void Walkbox::load(byte *src) { diff --git a/engines/teenagent/objects.h b/engines/teenagent/objects.h index e5400e7c81..60b5d5ad2c 100644 --- a/engines/teenagent/objects.h +++ b/engines/teenagent/objects.h @@ -71,17 +71,19 @@ protected: struct Object { enum {kActorUp = 1, kActorRight = 2, kActorDown = 3, kActorLeft = 4 }; - byte id; - Rect rect; - Rect actor_rect; - byte actor_orientation; - byte enabled; //19 bytes + byte id; //0 + Rect rect; //1 + Rect actor_rect; //9 + byte actor_orientation; //17 + byte enabled; //18 + //19 Common::String name, description; Object(): _base(NULL) {} void dump(); void setName(const Common::String &name); void load(byte *addr); + void save(); static Common::String parse_description(const char *name); diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index 296d8c7ac1..196283159d 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -392,6 +392,7 @@ bool Scene::render(OSystem *system) { obj->rect.top = s->y; obj->rect.right = s->w + s->x; obj->rect.bottom = s->h + s->y; + obj->rect.save(); //obj->dump(); } } @@ -585,6 +586,7 @@ bool Scene::processEventQueue() { debug(0, "%s object #%u", current_event.color ? "enabling" : "disabling", current_event.object - 1); Object *obj = getObject(current_event.object - 1, current_event.scene == 0 ? _id : current_event.scene); obj->enabled = current_event.color; + obj->save(); current_event.clear(); } break; |