diff options
author | Johannes Schickel | 2010-01-25 01:39:44 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-01-25 01:39:44 +0000 |
commit | aed02365ec81e77b3c8aa4f4ecd9a9d3893326f2 (patch) | |
tree | 95f119e687a666f65aad5041910c43bdfd4f2929 /engines/teenagent | |
parent | ec14cd6e6add76ce4f719edd7ce508d67ebd9f14 (diff) | |
download | scummvm-rg350-aed02365ec81e77b3c8aa4f4ecd9a9d3893326f2.tar.gz scummvm-rg350-aed02365ec81e77b3c8aa4f4ecd9a9d3893326f2.tar.bz2 scummvm-rg350-aed02365ec81e77b3c8aa4f4ecd9a9d3893326f2.zip |
Strip trailing spaces/tabs.
svn-id: r47541
Diffstat (limited to 'engines/teenagent')
-rw-r--r-- | engines/teenagent/actor.cpp | 40 | ||||
-rw-r--r-- | engines/teenagent/callbacks.cpp | 86 | ||||
-rw-r--r-- | engines/teenagent/console.cpp | 16 | ||||
-rw-r--r-- | engines/teenagent/detection.cpp | 4 | ||||
-rw-r--r-- | engines/teenagent/font.cpp | 2 | ||||
-rw-r--r-- | engines/teenagent/inventory.cpp | 6 | ||||
-rw-r--r-- | engines/teenagent/music.cpp | 2 | ||||
-rw-r--r-- | engines/teenagent/music.h | 8 | ||||
-rw-r--r-- | engines/teenagent/objects.cpp | 8 | ||||
-rw-r--r-- | engines/teenagent/objects.h | 26 | ||||
-rw-r--r-- | engines/teenagent/pack.cpp | 2 | ||||
-rw-r--r-- | engines/teenagent/pack.h | 2 | ||||
-rw-r--r-- | engines/teenagent/scene.cpp | 100 | ||||
-rw-r--r-- | engines/teenagent/scene.h | 16 | ||||
-rw-r--r-- | engines/teenagent/surface.cpp | 2 | ||||
-rw-r--r-- | engines/teenagent/surface_list.cpp | 10 | ||||
-rw-r--r-- | engines/teenagent/surface_list.h | 4 | ||||
-rw-r--r-- | engines/teenagent/teenagent.cpp | 54 | ||||
-rw-r--r-- | engines/teenagent/teenagent.h | 4 |
19 files changed, 196 insertions, 196 deletions
diff --git a/engines/teenagent/actor.cpp b/engines/teenagent/actor.cpp index 3d93c977a9..1fef2b79ab 100644 --- a/engines/teenagent/actor.cpp +++ b/engines/teenagent/actor.cpp @@ -63,29 +63,29 @@ Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &posi const uint8 frames_up[] = {18, 19, 20, 21, 22, 23, 24, 25, }; const uint8 frames_down[] = {10, 11, 12, 13, 14, 15, 16, 17, }; - const uint8 frames_head_left_right[] = { - 0x27, 0x1a, 0x1b, - 0x27, 0x1c, 0x1d, - 0x27, 0x1a, - 0x27, 0x1e, 0x1f, - 0x27, 0x1a, 0x1b, - 0x27, 0x1c, - 0x27, 0x1e, - 0x27, 0x1a, + const uint8 frames_head_left_right[] = { + 0x27, 0x1a, 0x1b, + 0x27, 0x1c, 0x1d, + 0x27, 0x1a, + 0x27, 0x1e, 0x1f, + 0x27, 0x1a, 0x1b, + 0x27, 0x1c, + 0x27, 0x1e, + 0x27, 0x1a, }; - + const uint8 frames_head_up[] = { - 0x29, 0x25, 0x29, 0x29, - 0x26, 0x29, 0x26, 0x29, - 0x29, 0x25, 0x29, 0x25, - 0x29, 0x29, 0x29, 0x25, + 0x29, 0x25, 0x29, 0x29, + 0x26, 0x29, 0x26, 0x29, + 0x29, 0x25, 0x29, 0x25, + 0x29, 0x29, 0x29, 0x25, 0x25, 0x29, 0x29, 0x26 }; const uint8 frames_head_down[] = { - 0x20, 0x21, 0x22, 0x23, - 0x28, 0x24, 0x28, 0x28, - 0x24, 0x28, 0x20, 0x21, - 0x20, 0x23, 0x28, 0x20, + 0x20, 0x21, 0x22, 0x23, + 0x28, 0x24, 0x28, 0x28, + 0x24, 0x28, 0x20, 0x21, + 0x20, 0x23, 0x28, 0x20, 0x28, 0x28, 0x20, 0x28 }; @@ -139,10 +139,10 @@ Common::Rect Actor::render(Graphics::Surface *surface, const Common::Point &posi warning("no surface, skipping"); return Common::Rect(); } - + Common::Rect dirty; Common::Rect clip(0, 0, s->w, s->h); - if (head != NULL) + if (head != NULL) clip.top = head->h; int xp = position.x - s->w * zoom / 512 - s->x, yp = position.y - s->h * zoom / 256 - s->y; diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index 931cab7544..67e05385bd 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -100,7 +100,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setLan(2, 1); Dialog::show(scene, 0x748e, 914, 915, 0xe7, 0xd7, 2, 1); displayCredits(0xe3c2); - + loadScene(42, 139, 156, 3); playSound(15, 20); playAnimation(916, 1); @@ -113,7 +113,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(917, 1, true); waitAnimation(); displayCredits(0xe3e6); - + loadScene(40, 139, 156, 3); playMusic(3); Dialog::show(scene, 0x750d, 920, 924, 0xe7, 0xeb, 1, 2); //as i told you, our organization... @@ -190,7 +190,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { } else { for (byte i = 11; i <= 27; i += 4) playSound(76, i); - + playSound(56, 35); playSound(19, 59); playActorAnimation(864); @@ -281,7 +281,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setLan(1, 0); playAnimation(812, 0, true); playActorAnimation(811); - + Dialog::show(scene, 0x6117, 0, 813, 0xd1, 0xec, 0, 1); loadScene(6, 230, 184); Dialog::show(scene, 0x626a, 0, 814, 0xd1, 0xec, 0, 1); @@ -766,7 +766,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setTimerCallback(0x516d, 40); playAnimation(544, 0, true, true); //ignore busy flag for this animation return true; - + case 0x516d: //too late to scare guard, resetting SET_FLAG(0, 0); return true; @@ -775,8 +775,8 @@ bool TeenAgentEngine::processCallback(uint16 addr) { SET_FLAG(0, 0); setTimerCallback(0, 0); scene->getAnimation(0)->free(); - SET_FLAG(0xDB9C, 1); - + SET_FLAG(0xDB9C, 1); + displayAsyncMessage(0x3563, 320 * 130 + 300, 1, 5); setOns(0, 16); enableObject(2); @@ -927,7 +927,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(541); } return true; - + case 0x603e: if (CHECK_FLAG(0xDBB3, 1)) { displayMessage(0x44a7); @@ -965,7 +965,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playMusic(6); loadScene(25, 151, 156, 2); return true; - + case 0x63dc: Dialog::showMono(scene, 0x3375, 0, 0xd1, 0); return true; @@ -974,7 +974,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x6475: Dialog::showMono(scene, 0x32C1, 0, 0xd1, 0); return true; - + case 0x6479: Dialog::showMono(scene, 0x325e, 0, 0xd1, 0); return true; @@ -1366,7 +1366,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { moveTo(94, 115, 4); //call 557e, but it's not needed I guess loadScene(19, 223, 199, 1); return true; - + case 0x55a1: processCallback(0x557e); rejectMessage(); @@ -1473,9 +1473,9 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x5a8b: if (!CHECK_FLAG(0xDBAD, 1)) { playSound(43, 4); //grrrrrr - playSound(42, 15); - playSound(42, 17); - playSound(42, 19); + playSound(42, 15); + playSound(42, 17); + playSound(42, 19); playAnimation(656, 0); displayMessage(0x3c16); } else if (!CHECK_FLAG(0xDBA3, 1)) {//Dog has bone @@ -2055,12 +2055,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { Dialog::showMono(scene, 0x5556, 775, 0xd0, 1); playAnimation(771, 1, true, true, true); playAnimation(776, 0); - + Dialog::show(scene, 0x55f7, 777, 778, 0xd0, 0xe5, 1, 2); //i have to kill you anyway - + playAnimation(779, 0, true, true, true); playAnimation(780, 1, true, true, true); - + for (byte i = 1; i <= 6; ++i) playSound(58, i); playSound(58, 10); @@ -2072,7 +2072,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); setOns(1, 75); setOns(2, 76); - + for (byte i = 1; i <= 6; ++i) playSound(58, i); playSound(58, 9); @@ -2094,7 +2094,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setOns(3, 79); setOns(0, 0); - + showActor(); playAnimation(0, 0); playAnimation(787, 2, true); @@ -2102,7 +2102,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { waitAnimation(); playAnimation(0, 1); - + playSound(32, 2); playSound(24, 7); @@ -2117,7 +2117,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(792, 3, true, true, true); moveTo(40, 171, 4); - + setOns(3, 81, 35); enableObject(12, 35); playAnimation(0, 3); @@ -2134,7 +2134,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x783d: Dialog::pop(scene, 0xdb36, 0, 797, 0xd1, 0xd0, 0, 1); return true; - + case 0x7966: if (CHECK_FLAG(0xDBA4, 1)) return false; @@ -2143,7 +2143,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x7ad0: case 0x7ad7: return !processCallback(0x70e0); - + case 0x7ab9: if (CHECK_FLAG(0xDBB6, 1)) return false; @@ -2328,7 +2328,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(622, true); playAnimation(624, 0, true); waitAnimation(); - + displayMessage(0x3afd); inventory->remove(43); @@ -2464,7 +2464,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(506, 0, true); playActorAnimation(504, true); waitAnimation(); - + setOns(0, 0); playSound(24, 2); playSound(22, 24); @@ -2478,7 +2478,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(505, true); playAnimation(507, 0, true); waitAnimation(); - + setOns(0, 4); { Object *obj = scene->getObject(3); @@ -2516,7 +2516,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(9, 8); setLan(1, 0); playAnimation(512, 0); - + warning("FIXME: fadeout not implemented"); displayMessage(0x3d3a); { @@ -2767,7 +2767,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { setLan(2, 4, 27); enableObject(4, 27); SET_FLAG(0xdba9, 0); - } + } SET_FLAG(0, 0); return true; @@ -3173,7 +3173,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 0x6cc4: //secret diary playActorAnimation(754); hideActor(); - + displayCutsceneMessage(0x517b, 30430); playMusic(3); @@ -3186,7 +3186,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(753, 1, true); waitAnimation(); Dialog::show(scene, 0x5168, 529, 751, 0xd9, 0xe5, 1, 2); - + loadScene(30, scene->getPosition()); Dialog::show(scene, 0x449e, 733, 734, 0xe5, 0xd0, 2, 3); @@ -3218,7 +3218,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(747, 2, true); waitAnimation(); - + Dialog::show(scene, 0x4da5, 734, 734, 0xd0, 0xd0, 3, 3); Dialog::show(scene, 0x4eb9, 748, 748, 0xd0, 0xd0, 3, 3); Dialog::show(scene, 0x4f15, 749, 749, 0xd0, 0xd0, 3, 3); @@ -3342,7 +3342,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playActorAnimation(976); displayMessage(0x5955); return true; - + case 0x77d5: if (CHECK_FLAG(0xdbd7, 1) && !CHECK_FLAG(0xdbd8, 1)) { //disallow exiting through the first door until switch turned on, not present in original game displayMessage(0x52cb); @@ -3416,12 +3416,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { return true; } else return false; - + case 0x7af7: if (CHECK_FLAG(0xDBD0, 1)) { displayMessage(0x5082); return true; - } else + } else return false; case 0x7b09: { @@ -3745,7 +3745,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { //moveTo(105, 157, 0, true); playMusic(3); loadScene(11, 105, 157, 4); - + Dialog::show(scene, 0x8409, 0, 938, 0xd1, 0xec, 0, 1); playAnimation(939, 0, true, true); @@ -3756,12 +3756,12 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playAnimation(935, 1, true, true); playActorAnimation(943, true); waitAnimation(); - + playAnimation(940, 0, true, true); playAnimation(936, 1, true, true); playActorAnimation(944, true); waitAnimation(); - + playAnimation(941, 0, true, true); playAnimation(937, 1, true, true); playActorAnimation(945, true); @@ -3834,7 +3834,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { } } return true; - + case 0x9a1d: //no anchor, timeout SET_FLAG(0, 0); processCallback(0x9a7a); @@ -3855,11 +3855,11 @@ bool TeenAgentEngine::processCallback(uint16 addr) { case 5: displayMessage(0x39ae); break; - default: + default: displayMessage(0x39b7); } return true; - + case 0x99e0: //success getting an anchor SET_FLAG(0, 0); setTimerCallback(0, 0); @@ -3874,7 +3874,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { inventory->add(42); displayMessage(0x3989); return true; - + case 0x9a7a: loadScene(15, 156, 180, 3); playSound(5, 5); @@ -3883,7 +3883,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { playSound(5, 25); playActorAnimation(616); return true; - + case 0x9aca: if (scene->getId() == 13) { moveTo(172, 181, 1); @@ -3963,7 +3963,7 @@ bool TeenAgentEngine::processCallback(uint16 addr) { obj->actor_rect.top = obj->actor_rect.bottom = 193; obj->actor_orientation = 1; obj->save(); - + SET_FLAG(0xDBD7, 1); } return true; diff --git a/engines/teenagent/console.cpp b/engines/teenagent/console.cpp index ef317097a6..b4b8770d44 100644 --- a/engines/teenagent/console.cpp +++ b/engines/teenagent/console.cpp @@ -38,13 +38,13 @@ bool Console::enableObject(int argc, const char **argv) { DebugPrintf("usage: %s object_id [scene_id]\n", argv[0]); return true; } - + int id = atoi(argv[1]); if (id < 0) { DebugPrintf("object id %d is invalid\n", id); return true; } - + int scene_id = 0; if (argc > 2) { scene_id = atoi(argv[2]); @@ -53,12 +53,12 @@ bool Console::enableObject(int argc, const char **argv) { return true; } } - + if (strcmp(argv[0], "disable_object") == 0) _engine->disableObject(id, scene_id); else _engine->enableObject(id, scene_id); - + return true; } @@ -67,13 +67,13 @@ bool Console::setOns(int argc, const char **argv) { DebugPrintf("usage: %s index(0-3) value [scene_id]\n", argv[0]); return true; } - + int index = atoi(argv[1]); if (index < 0 || index > 3) { DebugPrintf("index %d is invalid\n", index); return true; } - + int value = 0; value = atoi(argv[2]); if (value < 0) { @@ -89,9 +89,9 @@ bool Console::setOns(int argc, const char **argv) { return true; } } - + _engine->setOns(index, value, scene_id); - + return true; } diff --git a/engines/teenagent/detection.cpp b/engines/teenagent/detection.cpp index 24aa250c0e..fdff5fce6d 100644 --- a/engines/teenagent/detection.cpp +++ b/engines/teenagent/detection.cpp @@ -51,7 +51,7 @@ static const ADGameDescription teenAgentGameDescriptions[] = { {"mmm.res", 0, NULL, -1}, {"sam_mmm.res", 0, NULL, -1}, {"sam_sam.res", 0, NULL, -1}, - {"unlogic.res", 0, NULL, -1}, + {"unlogic.res", 0, NULL, -1}, {NULL, 0, NULL, 0} }, Common::EN_ANY, @@ -137,7 +137,7 @@ public: buf[24] = 0; Common::String description = buf; saveList.push_back(SaveStateDescriptor(slot, description)); - + delete in; } } diff --git a/engines/teenagent/font.cpp b/engines/teenagent/font.cpp index 51de84b50e..c5d22cd2eb 100644 --- a/engines/teenagent/font.cpp +++ b/engines/teenagent/font.cpp @@ -55,7 +55,7 @@ uint Font::render(Graphics::Surface *surface, int x, int y, char c, byte color) int h = glyph[0], w = glyph[1]; if (surface == NULL || surface->pixels == NULL || y + h <= 0 || y >= 200 || x + w <= 0 || x >= 320) return w - width_pack; - + int i0 = 0, j0 = 0; if (x < 0) { j0 = -x; diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp index 4468dcd593..9455a97500 100644 --- a/engines/teenagent/inventory.cpp +++ b/engines/teenagent/inventory.cpp @@ -54,7 +54,7 @@ void Inventory::init(TeenAgentEngine *engine) { for (byte i = 0; i <= 92; ++i) { InventoryObject io; uint16 obj_addr = res->dseg.get_word(0xc4a4 + i * 2); - if (obj_addr != 0) + if (obj_addr != 0) io.load(res->dseg.ptr(obj_addr)); objects.push_back(io); } @@ -155,10 +155,10 @@ bool Inventory::processEvent(const Common::Event &event) { //check combine if (!_active) return false; - + if (hovered_obj == NULL) return true; - + debug(0, "lclick on %u:%s", hovered_obj->id, hovered_obj->name.c_str()); if (selected_obj == NULL) { diff --git a/engines/teenagent/music.cpp b/engines/teenagent/music.cpp index abb4a18dd4..ba63a7043b 100644 --- a/engines/teenagent/music.cpp +++ b/engines/teenagent/music.cpp @@ -118,7 +118,7 @@ void MusicPlayer::stop() { void MusicPlayer::interrupt() { if (_rows.empty()) return; - + _currRow %= _rows.size(); Row *row = &_rows[_currRow]; diff --git a/engines/teenagent/music.h b/engines/teenagent/music.h index 3868edb514..9c518b58e0 100644 --- a/engines/teenagent/music.h +++ b/engines/teenagent/music.h @@ -67,10 +67,10 @@ protected: size = s; } } - void clear() { - delete[] data; - data = 0; - size = 0; + void clear() { + delete[] data; + data = 0; + size = 0; } } _samples[256]; byte sampleCount; diff --git a/engines/teenagent/objects.cpp b/engines/teenagent/objects.cpp index 87635ae44b..f8df4fee77 100644 --- a/engines/teenagent/objects.cpp +++ b/engines/teenagent/objects.cpp @@ -60,9 +60,9 @@ void Object::load(byte * src) { id = *src++; - rect.load(src); + rect.load(src); src += 8; - actor_rect.load(src); + actor_rect.load(src); src += 8; actor_orientation = *src++; @@ -141,8 +141,8 @@ void UseHotspot::load(byte *src) { } void UseHotspot::dump(int level) const { - debug(level, - "hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x", + debug(level, + "hotspot: inv_id: %02x, obj_id: %02x, orientation?: %02x, actor position: (%d,%d), callback: %04x", inventory_id, object_id, orientation, actor_x, actor_y, callback ); } diff --git a/engines/teenagent/objects.h b/engines/teenagent/objects.h index c4bca3331b..59e9d732fc 100644 --- a/engines/teenagent/objects.h +++ b/engines/teenagent/objects.h @@ -61,10 +61,10 @@ struct Rect { inline void clear() { left = top = right = bottom = 0; } - + void load(byte *src); //8 bytes void save() const; - + inline bool intersects_hline(int x1, int x2, int y) const { if (x1 > x2) SWAP(x1, x2); @@ -76,22 +76,22 @@ struct Rect { SWAP(y1, y2); return x >= left && x <= right && y1 <= bottom && y2 >= top; } - + inline bool contains(const Rect & rect) const { return rect.left >= left && rect.right <= right && rect.top >= top && rect.bottom <= bottom; } - + static inline bool inside(int x, int a, int b) { if (a > b) SWAP(a, b); return x >= a && x <= b; } - + int intersects_line(const Common::Point &a, const Common::Point &b) const { int dy = b.y - a.y, dx = b.x - a.x; int mask = 0; //orientation bitmask: 1 - top, 2 - right, 3 - bottom, 4 - left - + if (dx != 0) { int yl = (left - a.x) * dy / dx + a.y; if (yl > top && yl < bottom && inside(yl, a.y, b.y) && inside(left, a.x, b.x)) { @@ -103,8 +103,8 @@ struct Rect { //c[idx++] = Common::Point(right, yr); mask |= 2; } - } - + } + if (dy != 0) { int xt = (top - a.y) * dx / dy + a.x; if (xt > left && xt < right && inside(xt, a.x, b.x) && inside(top, a.y, b.y)) { @@ -121,7 +121,7 @@ struct Rect { } return mask; } - + void side(Common::Point &p1, Common::Point &p2, int o, const Common::Point &nearest) const { switch(o) { case kActorLeft: @@ -143,12 +143,12 @@ struct Rect { p1 = Common::Point(left, bottom); p2 = Common::Point(right, bottom); break; - + default: p1 = Common::Point(); p2 = Common::Point(); } - if (p1.sqrDist(nearest) >= p2.sqrDist(nearest)) + if (p1.sqrDist(nearest) >= p2.sqrDist(nearest)) SWAP(p1, p2); } @@ -171,7 +171,7 @@ struct Object { void setName(const Common::String &name); void load(byte *addr); void save() const; - + static Common::String parse_description(const char *name); protected: @@ -182,7 +182,7 @@ struct InventoryObject { byte id; byte animated; Common::String name, description; - + InventoryObject(): id(0), animated(0), _base(0) {} void load(byte *addr); diff --git a/engines/teenagent/pack.cpp b/engines/teenagent/pack.cpp index 25c6c8853d..1176bbc301 100644 --- a/engines/teenagent/pack.cpp +++ b/engines/teenagent/pack.cpp @@ -45,7 +45,7 @@ void Pack::close() { bool Pack::open(const Common::String &filename) { if (!file.open(filename)) return false; - + count = file.readUint32LE(); debug(0, "opened %s, found %u entries", filename.c_str(), count); offsets = new uint32[count + 1]; diff --git a/engines/teenagent/pack.h b/engines/teenagent/pack.h index 4013998152..0c9dccaceb 100644 --- a/engines/teenagent/pack.h +++ b/engines/teenagent/pack.h @@ -40,7 +40,7 @@ public: bool open(const Common::String &filename); void close(); - + inline uint32 files_count() const { return count; } uint32 get_size(uint32 id) const; uint32 read(uint32 id, byte *dst, uint32 size) const; diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp index 5393275a60..ef3dccca8b 100644 --- a/engines/teenagent/scene.cpp +++ b/engines/teenagent/scene.cpp @@ -38,9 +38,9 @@ namespace TeenAgent { Scene::Scene() : intro(false), _engine(NULL), _system(NULL), _id(0), ons(0), - orientation(kActorRight), actor_talking(false), - message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL), - current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0), + orientation(kActorRight), actor_talking(false), + message_timer(0), message_first_frame(0), message_last_frame(0), message_animation(NULL), + current_event(SceneEvent::kNone), hide_actor(false), callback(0), callback_timer(0), _fade_timer(0), _fade_type(0), _idle_timer(0) {} void Scene::warp(const Common::Point &_point, byte o) { @@ -55,7 +55,7 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi const Common::Array<Walkbox> &scene_walkboxes = walkboxes[_id - 1]; if (dst.x < 0 || dst.x > 319 || dst.y < 0 || dst.y > 199) return false; - + debug(1, "findPath %d,%d -> %d,%d", src.x, src.y, dst.x, dst.y); p.clear(); p.push_back(src); @@ -67,16 +67,16 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi if (!w.rect.in(src) && !w.rect.in(dst)) boxes.push_back(i); } - + for(Path::iterator i = p.begin(); i != p.end() && !boxes.empty(); ) { Path::iterator next = i; ++next; if (next == p.end()) break; - + const Common::Point &p1 = *i, &p2 = *next; debug(1, "%d,%d -> %d,%d", p1.x, p1.y, p2.x, p2.y); - + Common::List<uint>::iterator wi; for(wi = boxes.begin(); wi != boxes.end(); ++wi) { const Walkbox & w = scene_walkboxes[*wi]; @@ -84,7 +84,7 @@ bool Scene::findPath(Scene::Path &p, const Common::Point &src, const Common::Poi if (mask == 0) { continue; } - + w.dump(1); debug(1, "%u: intersection mask 0x%04x, searching hints", *wi, mask); int dx = p2.x - p1.x, dy = p2.y - p1.y; @@ -182,7 +182,7 @@ void Scene::moveTo(const Common::Point &_point, byte orient, bool validate) { path.push_back(point); return; } - + if (!findPath(path, position, point)) { _engine->cancel(); return; @@ -195,12 +195,12 @@ void Scene::moveTo(const Common::Point &_point, byte orient, bool validate) { void Scene::init(TeenAgentEngine *engine, OSystem *system) { _engine = engine; _system = system; - + _fade_timer = 0; _fade_type = 0; memset(palette, 0, sizeof(palette)); - + Resources *res = Resources::instance(); Common::SeekableReadStream *s = res->varia.getStream(1); if (s == NULL) @@ -217,7 +217,7 @@ void Scene::init(TeenAgentEngine *engine, OSystem *system) { teenagent_idle.load(s, Animation::kTypeVaria); if (teenagent_idle.empty()) error("invalid mark animation"); - + loadObjectData(); } @@ -228,11 +228,11 @@ void Scene::loadObjectData() { objects.resize(42); walkboxes.resize(42); fades.resize(42); - + for (byte i = 0; i < 42; ++i) { Common::Array<Object> &scene_objects = objects[i]; scene_objects.clear(); - + uint16 scene_table = res->dseg.get_word(0x7254 + i * 2); uint16 object_addr; while ((object_addr = res->dseg.get_word(scene_table)) != 0) { @@ -271,9 +271,9 @@ void Scene::loadObjectData() { Object *Scene::findObject(const Common::Point &point) { if (_id == 0) return NULL; - + Common::Array<Object> &scene_objects = objects[_id - 1]; - + for (uint i = 0; i < scene_objects.size(); ++i) { Object &obj = scene_objects[i]; if (obj.enabled != 0 && obj.rect.in(point)) @@ -358,7 +358,7 @@ void Scene::init(int id, const Common::Point &pos) { debug(0, "init(%d)", id); _id = id; sounds.clear(); - for (byte i = 0; i < 4; ++i) + for (byte i = 0; i < 4; ++i) custom_animation[i].free(); if (background.pixels == NULL) @@ -386,7 +386,7 @@ void Scene::init(int id, const Common::Point &pos) { int sub_hack = 0; if (id == 7) { //something patched in the captains room switch(res->dseg.get_byte(0xdbe6)) { - case 2: + case 2: break; case 1: sub_hack = 1; @@ -406,7 +406,7 @@ void Scene::init(int id, const Common::Point &pos) { if (now_playing != res->dseg.get_byte(0xDB90)) _engine->music->load(res->dseg.get_byte(0xDB90)); - + _system->copyRectToScreen((const byte *)background.pixels, background.pitch, 0, 0, background.w, background.h); setPalette(0); } @@ -468,13 +468,13 @@ bool Scene::processEvent(const Common::Event &event) { sounds.clear(); current_event.clear(); message_color = 0xd1; - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 4; ++i) custom_animation[i].free(); _engine->playMusic(4); _engine->loadScene(10, Common::Point(136, 153)); return true; } - + if (!message.empty() && message_first_frame == 0) { clearMessage(); nextEvent(); @@ -519,7 +519,7 @@ 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[0] != 0xff && zoom_table[1] != 0xff; zoom_table += 2 ) { //debug(0, "%d %d->%d", y, zoom_table[0], zoom_table[1]); @@ -542,7 +542,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { do { restart = false; busy = processEventQueue(); - + if (_fade_timer && game_delta != 0) { if (_fade_timer > 0) { _fade_timer -= game_delta; @@ -552,7 +552,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { setPalette(_fade_timer + 4); } } - + switch(current_event.type) { case SceneEvent::kCredits: { _system->fillScreen(0); @@ -586,7 +586,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { res->font8.render(surface, current_event.dst.x, current_event.dst.y, message, current_event.color); } else { res->font7.render(surface, current_event.dst.x, current_event.dst.y, message, 0xd1); - } + } _system->unlockScreen(); return true; } @@ -607,14 +607,14 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { s->render(surface); } } - + Common::List<Surface *> z_order; - + for (byte i = 0; i < 4; ++i) { Animation *a = custom_animation + i; Surface *s = a->currentFrame(game_delta); if (s != NULL) { - if (!a->ignore) + if (!a->ignore) busy = true; if (!a->paused && !a->loop) got_any_animation = true; @@ -627,7 +627,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { } s = a->currentFrame(game_delta); } - + if (current_event.type == SceneEvent::kWaitLanAnimationFrame && current_event.slot == i) { if (s == NULL) { restart |= nextEvent(); @@ -639,10 +639,10 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { restart |= nextEvent(); } } - + if (s == NULL) continue; - + if (debug_features.feature[DebugFeatures::kShowLan]) z_order.push_back(s); @@ -675,9 +675,9 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { if (mark != NULL) { actor_animation_position = mark->render(surface); - if (!actor_animation.ignore) + if (!actor_animation.ignore) busy = true; - else + else busy = false; got_any_animation = true; } else if (!hide_actor) { @@ -702,13 +702,13 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { speed_x = 1; if (speed_y == 0) speed_y = 1; - + position.y += (ABS(dp.y) < speed_y? dp.y: SIGN(dp.y) * speed_y); - position.x += (o == kActorDown || o == kActorUp)? + position.x += (o == kActorDown || o == kActorUp)? (ABS(dp.x) < speed_y? dp.x: SIGN(dp.x) * speed_y): (ABS(dp.x) < speed_x? dp.x: SIGN(dp.x) * speed_x); } - + _idle_timer = 0; teenagent_idle.resetIndex(); actor_animation_position = teenagent.render(surface, position, o, mark_delta, false, zoom); @@ -730,7 +730,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { _idle_timer += mark_delta; if (_idle_timer < 50) actor_animation_position = teenagent.render(surface, position, orientation, 0, actor_talking, zoom); - else + else actor_animation_position = teenagent_idle.renderIdle(surface, position, orientation, mark_delta, zoom); } } @@ -761,13 +761,13 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { visible = false; } } - + if (visible) { res->font7.render(surface, message_pos.x, message_pos.y, message, message_color); busy = true; } } - + if (!busy && !restart && callback_timer) { if (--callback_timer == 0) { if (_engine->inventory->active()) @@ -784,7 +784,7 @@ bool Scene::render(bool tick_game, bool tick_mark, uint32 message_delta) { for (uint i = 0; i < scene_walkboxes.size(); ++i) { scene_walkboxes[i].rect.render(surface, 0xd0 + i); } - + Common::Point last_p = position; for(Path::const_iterator p = path.begin(); p != path.end(); ++p) { const Common::Point dp(p->x - last_p.x, p->y - last_p.y); @@ -899,7 +899,7 @@ bool Scene::processEventQueue() { message_animation = custom_animation + (current_event.slot - 1); //else if (!animation[current_event.slot].empty()) // message_animation = animation + current_event.slot; - } else + } else message_animation = &actor_animation; debug(0, "async message %d-%d (slot %u)", message_first_frame, message_last_frame, current_event.slot); } else { @@ -908,7 +908,7 @@ bool Scene::processEventQueue() { } Common::Point p; if (current_event.dst.x == 0 && current_event.dst.y == 0) { - p = Common::Point((actor_animation_position.left + actor_animation_position.right) / 2, + p = Common::Point((actor_animation_position.left + actor_animation_position.right) / 2, actor_animation_position.top); } else { p = current_event.dst; @@ -924,12 +924,12 @@ bool Scene::processEventQueue() { if (s != NULL) { p.x = s->x + s->w / 2; p.y = s->y; - } else + } else warning("no animation in slot %u", message_slot); } message_pos = messagePosition(message, p); message_color = current_event.color; - + if (message_first_frame) current_event.clear(); //async message, clearing event } @@ -1018,7 +1018,7 @@ bool Scene::processEventQueue() { case SceneEvent::kWaitLanAnimationFrame: debug(0, "waiting for the frame %d in slot %d", current_event.animation, current_event.slot); break; - + case SceneEvent::kTimer: callback = current_event.callback; callback_timer = current_event.timer; @@ -1056,7 +1056,7 @@ bool Scene::processEventQueue() { debug(0, "quit!"); _engine->quitGame(); break; - + default: error("empty/unhandler event[%d]", (int)current_event.type); } @@ -1082,18 +1082,18 @@ void Scene::setPalette(unsigned mul) { Object *Scene::getObject(int id, int scene_id) { assert(id > 0); - + if (scene_id == 0) scene_id = _id; if (scene_id == 0) return NULL; - + Common::Array<Object> &scene_objects = objects[scene_id - 1]; --id; if (id >= (int)scene_objects.size()) return NULL; - + return &scene_objects[id]; } @@ -1131,7 +1131,7 @@ uint Scene::messageDuration(const Common::String &str) { if (speed < 0) speed = 60; uint delay_delta = 1 + (255 - speed) * 99 / 255; - + uint delay = 60 + (total_width * delay_delta) / 8; //debug(0, "delay = %u, delta: %u", delay, delay_delta); return delay * 10; diff --git a/engines/teenagent/scene.h b/engines/teenagent/scene.h index 9177511795..b7fe6753fe 100644 --- a/engines/teenagent/scene.h +++ b/engines/teenagent/scene.h @@ -198,7 +198,7 @@ private: bool actor_talking; bool findPath(Path &p, const Common::Point &src, const Common::Point &dst) const; - + Common::Array<Common::Array<Object> > objects; Common::Array<Common::Array<Walkbox> > walkboxes; Common::Array<Common::Array<FadeType> > fades; @@ -215,9 +215,9 @@ private: EventList events; SceneEvent current_event; bool hide_actor; - + uint16 callback, callback_timer; - + int _fade_timer; int _fade_type; uint _idle_timer; @@ -228,18 +228,18 @@ private: }; typedef Common::List<Sound> Sounds; Sounds sounds; - + struct DebugFeatures { - enum { + enum { kShowBack, kShowLan, kShowOns, - kShowOn, - kHidePath, + kShowOn, + kHidePath, kMax }; bool feature[kMax]; - + DebugFeatures() { for(uint i = 0; i < kMax; ++i) { feature[i] = true; diff --git a/engines/teenagent/surface.cpp b/engines/teenagent/surface.cpp index 890c02366b..735ce67785 100644 --- a/engines/teenagent/surface.cpp +++ b/engines/teenagent/surface.cpp @@ -85,7 +85,7 @@ Common::Rect Surface::render(Graphics::Surface *surface, int dx, int dy, bool mi } if (src_rect.isEmpty() || dst_rect.isEmpty()) return Common::Rect(); - + if (zoom == 256) { byte *src = (byte *)getBasePtr(0, src_rect.top); byte *dst_base = (byte *)surface->getBasePtr(dst_rect.left, dst_rect.top); diff --git a/engines/teenagent/surface_list.cpp b/engines/teenagent/surface_list.cpp index 5485b42fa4..481263444b 100644 --- a/engines/teenagent/surface_list.cpp +++ b/engines/teenagent/surface_list.cpp @@ -32,22 +32,22 @@ SurfaceList::SurfaceList() : surfaces(NULL), surfaces_n(0) {} void SurfaceList::load(Common::SeekableReadStream *stream, Type type, int sub_hack) { free(); - + byte fn = stream->readByte(); if (stream->eos()) return; - + surfaces_n = fn - sub_hack; debug(0, "loading %u surfaces from list (skip %d)", surfaces_n, sub_hack); if (surfaces_n == 0) return; - + surfaces = new Surface[surfaces_n]; for (byte i = 0; i < surfaces_n; ++i) { uint offset = stream->readUint16LE(); - uint pos = stream->pos(); + uint pos = stream->pos(); stream->seek(offset); surfaces[i].load(stream, Surface::kTypeOns); stream->seek(pos); @@ -66,7 +66,7 @@ void SurfaceList::render(Graphics::Surface *surface, const Common::Rect & clip) Common::Rect r(s.x, s.y, s.x + s.w, s.y + s.h); if (r.bottom < clip.bottom || !clip.intersects(r)) continue; - + r.clip(clip); r.translate(-s.x, -s.y); s.render(surface, r.left, r.top, false, r); diff --git a/engines/teenagent/surface_list.h b/engines/teenagent/surface_list.h index 1f6ca0c510..289148af6c 100644 --- a/engines/teenagent/surface_list.h +++ b/engines/teenagent/surface_list.h @@ -33,12 +33,12 @@ class Surface; class SurfaceList { public: enum Type { kTypeOn }; - + SurfaceList(); void load(Common::SeekableReadStream *stream, Type type, int sub_hack = 0); void free(); void render(Graphics::Surface *surface, const Common::Rect & clip) const; - + protected: Surface * surfaces; uint surfaces_n; diff --git a/engines/teenagent/teenagent.cpp b/engines/teenagent/teenagent.cpp index 825d12776a..19f4ef1613 100644 --- a/engines/teenagent/teenagent.cpp +++ b/engines/teenagent/teenagent.cpp @@ -52,7 +52,7 @@ bool TeenAgentEngine::trySelectedObject() { Resources *res = Resources::instance(); debug(0, "checking active object %u on %u", inv->id, dst_object->id); - + //mouse time challenge hack: if ( (res->dseg.get_byte(0) == 1 && inv->id == 49 && dst_object->id == 5) || @@ -98,14 +98,14 @@ void TeenAgentEngine::processObject() { dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2)); dcall += 2 * dst_object->id - 2; uint16 callback = READ_LE_UINT16(dcall); - if (callback == 0 || !processCallback(callback)) + if (callback == 0 || !processCallback(callback)) displayMessage(dst_object->description); } break; case kActionUse: { if (trySelectedObject()) break; - + byte *dcall = res->dseg.ptr(0xb89c); dcall = res->dseg.ptr(READ_LE_UINT16(dcall + scene->getId() * 2 - 2)); dcall += 2 * dst_object->id - 2; @@ -159,7 +159,7 @@ void TeenAgentEngine::examine(const Common::Point &point, Object *object) { void TeenAgentEngine::init() { _mark_delay = 80; _game_delay = 110; - + Resources * res = Resources::instance(); use_hotspots.resize(42); byte *scene_hotspots = res->dseg.ptr(0xbb87); @@ -275,14 +275,14 @@ bool TeenAgentEngine::showLogo() { byte bg[0xfa00]; byte palette[0x400]; - + Common::SeekableReadStream *frame = logo.getStream(1); if (frame == NULL) return true; frame->read(bg, sizeof(bg)); memset(palette, 0, sizeof(palette)); - + for(uint c = 0; c < 0x100; ++c) { uint idx = c * 4; frame->read(palette + idx, 3); @@ -293,7 +293,7 @@ bool TeenAgentEngine::showLogo() { _system->setPalette(palette, 0, 0x100); uint n = logo.files_count(); - for(uint f = 0; f < 4; ++f) + for(uint f = 0; f < 4; ++f) for(uint i = 2; i <= n; ++i) { { int r = skipEvents(); @@ -301,7 +301,7 @@ bool TeenAgentEngine::showLogo() { return r > 0? true: false; } _system->copyRectToScreen(bg, 320, 0, 0, 320, 200); - + frame = logo.getStream(i); if (frame == NULL) return true; @@ -323,9 +323,9 @@ bool TeenAgentEngine::showLogo() { bool TeenAgentEngine::showMetropolis() { _system->fillScreen(0); _system->updateScreen(); - + Resources *res = Resources::instance(); - + byte palette[0x400]; memset(palette, 0, sizeof(palette)); { @@ -338,13 +338,13 @@ bool TeenAgentEngine::showMetropolis() { palette[idx + 2] *= 4; } } - + _system->setPalette(palette, 0, 0x100); - + byte varia_6[21760], varia_9[18302]; res->varia.read(6, varia_6, sizeof(varia_6)); res->varia.read(9, varia_9, sizeof(varia_9)); - + byte colors[56 * 160 * 2]; memset(colors, 0, sizeof(colors)); @@ -360,7 +360,7 @@ bool TeenAgentEngine::showMetropolis() { if (logo_y > 0) { surface->fillRect(Common::Rect(0, 0, 320, logo_y), 0); } - + { //generate colors matrix memmove(colors + 320, colors + 480, 8480); @@ -373,9 +373,9 @@ bool TeenAgentEngine::showMetropolis() { for(uint y = 1; y < 56; ++y) { for(uint x = 1; x < 160; ++x) { uint offset = y * 160 + x; - uint v = - (uint)colors[offset - 161] + colors[offset - 160] + colors[offset - 159] + - (uint)colors[offset - 1] + colors[offset + 1] + + uint v = + (uint)colors[offset - 161] + colors[offset - 160] + colors[offset - 159] + + (uint)colors[offset - 1] + colors[offset + 1] + (uint)colors[offset + 161] + colors[offset + 160] + colors[offset + 159]; v >>= 3; colors[offset + 8960] = v; @@ -390,21 +390,21 @@ bool TeenAgentEngine::showMetropolis() { for(uint x = 0; x < 320; ++x) { if (*src++ == 1) { *dst++ = colors[19 * 160 + y / 2 * 160 + x / 2]; - } else + } else ++dst; } } _system->unlockScreen(); - + _system->copyRectToScreen( - varia_9 + (logo_y < 0? -logo_y * 320: 0), 320, - 0, logo_y >= 0? logo_y: 0, + varia_9 + (logo_y < 0? -logo_y * 320: 0), 320, + 0, logo_y >= 0? logo_y: 0, 320, logo_y >= 0? 57: 57 + logo_y); if (logo_y < 82 - 57) ++logo_y; - - + + _system->updateScreen(); _system->delayMillis(100); } @@ -426,7 +426,7 @@ Common::Error TeenAgentEngine::run() { scene->init(this, _system); inventory->init(this); - + init(); CursorMan.pushCursor(res->dseg.ptr(0x00da), 8, 12, 0, 0, 1); @@ -708,7 +708,7 @@ void TeenAgentEngine::displayCutsceneMessage(uint16 addr, uint16 position) { event.dst.x = position % 320; event.dst.y = position / 320; event.lan = 7; - + scene->push(event); } @@ -768,7 +768,7 @@ void TeenAgentEngine::loadScene(byte id, const Common::Point &pos, byte o) { void TeenAgentEngine::loadScene(byte id, uint16 x, uint16 y, byte o) { if (scene->last_event_type() != SceneEvent::kCreditsMessage) fadeOut(); - + SceneEvent event(SceneEvent::kLoadScene); event.scene = id; event.dst.x = x; @@ -855,7 +855,7 @@ void TeenAgentEngine::waitLanAnimationFrame(byte slot, uint16 frame) { SceneEvent event(SceneEvent::kWaitLanAnimationFrame); if (frame > 0) --frame; - + event.slot = slot - 1; event.animation = frame; scene->push(event); diff --git a/engines/teenagent/teenagent.h b/engines/teenagent/teenagent.h index 5750194ea8..9acc71adab 100644 --- a/engines/teenagent/teenagent.h +++ b/engines/teenagent/teenagent.h @@ -133,9 +133,9 @@ private: Audio::AudioStream *_musicStream; Audio::SoundHandle _musicHandle, _soundHandle; const ADGameDescription *_gameDescription; - + uint _mark_delay, _game_delay; - + Common::Array<Common::Array<UseHotspot> > use_hotspots; }; |