From d96555406ec215f390904d15c729ab6528f8b28f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 7 Sep 2013 19:09:06 +0200 Subject: AVALANCHE: Rename trip into animation, some more renaming --- engines/avalanche/acci2.cpp | 98 +-- engines/avalanche/animation.cpp | 1632 ++++++++++++++++++++++++++++++++++++++ engines/avalanche/animation.h | 217 ++++++ engines/avalanche/avalanche.cpp | 74 +- engines/avalanche/avalanche.h | 4 +- engines/avalanche/avalot.cpp | 16 +- engines/avalanche/celer2.cpp | 4 +- engines/avalanche/dropdown2.cpp | 18 +- engines/avalanche/enid2.cpp | 2 +- engines/avalanche/gyro2.cpp | 16 +- engines/avalanche/lucerna2.cpp | 207 +++-- engines/avalanche/module.mk | 2 +- engines/avalanche/parser.cpp | 2 +- engines/avalanche/pingo2.cpp | 2 +- engines/avalanche/scrolls2.cpp | 6 +- engines/avalanche/sequence2.cpp | 6 +- engines/avalanche/timeout2.cpp | 118 +-- engines/avalanche/trip6.cpp | 1634 --------------------------------------- engines/avalanche/trip6.h | 217 ------ engines/avalanche/visa2.cpp | 10 +- 20 files changed, 2139 insertions(+), 2146 deletions(-) create mode 100644 engines/avalanche/animation.cpp create mode 100644 engines/avalanche/animation.h delete mode 100644 engines/avalanche/trip6.cpp delete mode 100644 engines/avalanche/trip6.h (limited to 'engines/avalanche') diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 0712fd05cd..407bffbe25 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -35,7 +35,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/enid2.h" #include "avalanche/celer2.h" #include "avalanche/pingo2.h" @@ -407,8 +407,8 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_gyro->_dna._spareEvening.clear(); _vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText; _vm->_visa->dixi('z', 5); // His closing statement... - _vm->_trip->tr[1].walkto(4); // The end of the drawbridge - _vm->_trip->tr[1].vanishifstill = true; // Then go away! + _vm->_animation->tr[1].walkto(4); // The end of the drawbridge + _vm->_animation->tr[1].vanishifstill = true; // Then go away! _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; _vm->_gyro->_dna._cardiffQuestionNum = 5; break; @@ -708,7 +708,7 @@ void Acci::openBox(bool isOpening) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_celer->updateBackgroundSprites(); - _vm->_trip->trippancy_link(); + _vm->_animation->trippancy_link(); _vm->_graphics->refreshScreen(); _vm->_system->delayMillis(55); @@ -716,7 +716,7 @@ void Acci::openBox(bool isOpening) { if (!isOpening) { _vm->_celer->drawBackgroundSprite(-1, -1, 6); _vm->_celer->updateBackgroundSprites(); - _vm->_trip->trippancy_link(); + _vm->_animation->trippancy_link(); _vm->_graphics->refreshScreen(); } } @@ -896,7 +896,7 @@ void Acci::openDoor() { // Special cases. switch (_vm->_gyro->_dna._room) { case r__yours: - if (_vm->_trip->infield(2)) { + if (_vm->_animation->infield(2)) { // Opening the box. _thing = 54; // The box. _person = kPardon; @@ -916,28 +916,28 @@ void Acci::openDoor() { return; // No doors can open if you can't move Avvy. for (byte fv = 8; fv < 15; fv++) { - if (_vm->_trip->infield(fv + 1)) { + if (_vm->_animation->infield(fv + 1)) { fv -= 8; switch (_vm->_gyro->_portals[fv]._operation) { case Gyro::kMagicExclaim: - _vm->_trip->tr[0].bounce(); + _vm->_animation->tr[0].bounce(); _vm->_visa->dixi('x', _vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicTransport: - _vm->_trip->fliproom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte + _vm->_animation->fliproom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte (_vm->_gyro->_portals[fv]._data) & 0x0F // Low byte ); break; case Gyro::kMagicUnfinished: - _vm->_trip->tr[0].bounce(); + _vm->_animation->tr[0].bounce(); _vm->_scrolls->display("Sorry. This place is not available yet!"); break; case Gyro::kMagicSpecial: - _vm->_trip->call_special(_vm->_gyro->_portals[fv]._data); + _vm->_animation->call_special(_vm->_gyro->_portals[fv]._data); break; case Gyro::kMagicOpenDoor: - _vm->_trip->open_the_door((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); + _vm->_animation->open_the_door((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); break; } @@ -1040,9 +1040,9 @@ void Acci::notInOrder() { } void Acci::goToCauldron() { - _vm->_trip->tr[1].call_eachstep = false; // Stops Geida_Procs. + _vm->_animation->tr[1].call_eachstep = false; // Stops Geida_Procs. _vm->_timeout->set_up_timer(1, _vm->_timeout->procspludwick_goes_to_cauldron, _vm->_timeout->reason_spludwalk); - _vm->_trip->tr[1].walkto(2); + _vm->_animation->tr[1].walkto(2); } /** @@ -1102,9 +1102,9 @@ void Acci::drink() { _vm->_lucerna->refreshObjectList(); _vm->_lucerna->dusk(); _vm->_gyro->hangAroundForAWhile(); - _vm->_trip->fliproom(1, 1); + _vm->_animation->fliproom(1, 1); _vm->_gyro->setBackgroundColor(14); - _vm->_trip->new_game_for_trippancy(); // Not really. + _vm->_animation->new_game_for_trippancy(); // Not really. } } @@ -1112,12 +1112,12 @@ void Acci::cardiffClimbing() { if (_vm->_gyro->_dna._standingOnDais) { // Clamber up. _vm->_scrolls->display("You climb down, back onto the floor."); _vm->_gyro->_dna._standingOnDais = false; - _vm->_trip->apped(1, 3); + _vm->_animation->apped(1, 3); } else { // Clamber down. - if (_vm->_trip->infield(1)) { + if (_vm->_animation->infield(1)) { _vm->_scrolls->display("You clamber up onto the dais."); _vm->_gyro->_dna._standingOnDais = true; - _vm->_trip->apped(1, 2); + _vm->_animation->apped(1, 2); } else _vm->_scrolls->display("Get a bit closer, Avvy."); } @@ -1136,9 +1136,9 @@ void Acci::standUp() { _vm->_gyro->setBackgroundColor(0); _vm->_visa->dixi('d', 14); } - _vm->_trip->tr[0].visible = true; + _vm->_animation->tr[0]._visible = true; _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_trip->apped(1, 2); + _vm->_animation->apped(1, 2); _vm->_gyro->_dna._direction = _vm->_gyro->kDirectionLeft; _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Picture of empty pillow. _vm->_lucerna->incScore(1); @@ -1155,8 +1155,8 @@ void Acci::standUp() { case r__nottspub: if (_vm->_gyro->_dna._sittingInPub) { _vm->_celer->drawBackgroundSprite(-1, -1, 4); // Not sitting down. - _vm->_trip->tr[0].visible = true; // But standing up. - _vm->_trip->apped(1, 4); // And walking away. + _vm->_animation->tr[0]._visible = true; // But standing up. + _vm->_animation->apped(1, 4); // And walking away. _vm->_gyro->_dna._sittingInPub = false; // Really not sitting down. _vm->_gyro->_dna._userMovesAvvy = true; // And ambulant. } else @@ -1172,7 +1172,7 @@ void Acci::standUp() { void Acci::getProc(char thing) { switch (_vm->_gyro->_dna._room) { case r__yours: - if (_vm->_trip->infield(2)) { + if (_vm->_animation->infield(2)) { if (_vm->_gyro->_dna._boxContent == thing) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); _vm->_scrolls->display("OK, I've got it."); @@ -1188,13 +1188,13 @@ void Acci::getProc(char thing) { case r__insidecardiffcastle: switch (thing) { case Gyro::kObjectPen: - if (_vm->_trip->infield(2)) { // Standing on the dais. + if (_vm->_animation->infield(2)) { // Standing on the dais. if (_vm->_gyro->_dna._takenPen) _vm->_scrolls->display("It's not there, Avvy."); else { // OK: we're taking the pen, and it's there. _vm->_celer->drawBackgroundSprite(-1, -1, 4); // No pen there now. - _vm->_trip->call_special(3); // Zap! + _vm->_animation->call_special(3); // Zap! _vm->_gyro->_dna._takenPen = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectPen - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -1213,7 +1213,7 @@ void Acci::getProc(char thing) { } break; case r__robins: - if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_trip->infield(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { + if ((thing == _vm->_gyro->kObjectMushroom) & (_vm->_animation->infield(1)) & (_vm->_gyro->_dna._mushroomGrowing)) { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_scrolls->display("Got it!"); _vm->_gyro->_dna._mushroomGrowing = false; @@ -1247,7 +1247,7 @@ void Acci::giveGeidaTheLute() { } void Acci::playHarp() { - if (_vm->_trip->infield(7)) + if (_vm->_animation->infield(7)) _vm->_scrolls->musical_scroll(); else _vm->_scrolls->display("Get a bit closer to it, Avvy!"); @@ -1277,8 +1277,8 @@ void Acci::personSpeaks() { bool found = false; // The _person we're looking for's code is in _person. - for (byte i = 0; i < _vm->_trip->kSpriteNumbMax; i++) { - if (_vm->_trip->tr[i].quick && ((_vm->_trip->tr[i].a.accinum + 149) == _person)) { + for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { + if (_vm->_animation->tr[i].quick && ((_vm->_animation->tr[i]._stat.accinum + 149) == _person)) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; } @@ -1568,13 +1568,13 @@ void Acci::doThat() { i = 3; else i = 0; - if (_vm->_trip->tr[0].whichsprite != i) { - int16 x = _vm->_trip->tr[0].x; - int16 y = _vm->_trip->tr[0].y; - _vm->_trip->tr[0].done(); - _vm->_trip->tr[0].init(i, true, _vm->_trip); - _vm->_trip->tr[0].appear(x, y, _vm->_trip->kDirLeft); - _vm->_trip->tr[0].visible = false; + if (_vm->_animation->tr[0].whichsprite != i) { + int16 x = _vm->_animation->tr[0]._x; + int16 y = _vm->_animation->tr[0]._y; + _vm->_animation->tr[0].done(); + _vm->_animation->tr[0].init(i, true, _vm->_animation); + _vm->_animation->tr[0].appear(x, y, Animation::kDirLeft); + _vm->_animation->tr[0]._visible = false; } } break; @@ -1695,16 +1695,16 @@ void Acci::doThat() { if (_vm->_gyro->_dna._avariciusTalk > 0) _vm->_visa->dixi('q', 19); else { - if ((_vm->_gyro->_dna._room == 12) & (_vm->_trip->infield(2))) { // Avaricius appears! + if ((_vm->_gyro->_dna._room == 12) & (_vm->_animation->infield(2))) { // Avaricius appears! _vm->_visa->dixi('q', 17); if (_vm->_gyro->_whereIs[1] == 12) _vm->_visa->dixi('q', 18); else { - _vm->_trip->tr[1].init(1, false, _vm->_trip); // Avaricius - _vm->_trip->apped(2, 4); - _vm->_trip->tr[1].walkto(5); - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procback_and_forth; + _vm->_animation->tr[1].init(1, false, _vm->_animation); // Avaricius + _vm->_animation->apped(2, 4); + _vm->_animation->tr[1].walkto(5); + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procback_and_forth; _vm->_gyro->_dna._avariciusTalk = 14; _vm->_timeout->set_up_timer(177, _vm->_timeout->procavaricius_talks, _vm->_timeout->reason_avariciustalks); } @@ -1744,7 +1744,7 @@ void Acci::doThat() { case kVerbCodeBuy: // What are they trying to buy? switch (_vm->_gyro->_dna._room) { case r__argentpub: - if (_vm->_trip->infield(6)) { // We're in a pub, and near the bar. + if (_vm->_animation->infield(6)) { // We're in a pub, and near the bar. switch (_thing) { case 51: case 53: @@ -1804,7 +1804,7 @@ void Acci::doThat() { break; case r__outsideducks: - if (_vm->_trip->infield(6)) { + if (_vm->_animation->infield(6)) { if (_thing == _vm->_gyro->kObjectOnion) { if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1]) _vm->_visa->dixi('D', 10); // Not planning to juggle with the things! @@ -1861,9 +1861,9 @@ void Acci::doThat() { _vm->_lucerna->refreshObjectList(); _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicNothing; _vm->_lucerna->incScore(7); - _vm->_trip->tr[1].walkto(2); - _vm->_trip->tr[1].vanishifstill = true; - _vm->_trip->tr[1].call_eachstep = false; + _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[1].vanishifstill = true; + _vm->_animation->tr[1].call_eachstep = false; _vm->_gyro->_whereIs[7] = 177; break; default: @@ -1984,7 +1984,7 @@ void Acci::doThat() { if (_vm->_gyro->_dna._sittingInPub) _vm->_scrolls->display("You're already sitting!"); else { - _vm->_trip->tr[0].walkto(4); // Move Avvy to the place, and sit him down. + _vm->_animation->tr[0].walkto(4); // Move Avvy to the place, and sit him down. _vm->_timeout->set_up_timer(1, _vm->_timeout->procavvy_sit_down, _vm->_timeout->reason_sitting_down); } } else { // Default doodah. diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp new file mode 100644 index 0000000000..5679e1b715 --- /dev/null +++ b/engines/avalanche/animation.cpp @@ -0,0 +1,1632 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* TRIP5 Trippancy V - the sprite animation subsystem */ + +#include "avalanche/avalanche.h" + +#include "avalanche/animation.h" +#include "avalanche/scrolls2.h" +#include "avalanche/lucerna2.h" +#include "avalanche/visa2.h" +#include "avalanche/gyro2.h" +#include "avalanche/celer2.h" +#include "avalanche/sequence2.h" +#include "avalanche/timeout2.h" +#include "avalanche/enid2.h" + +#include "common/scummsys.h" +#include "common/textconsole.h" +#include "common/file.h" + +namespace Avalanche { + +void AnimationType::init(byte spritenum, bool do_check, Animation *tr) { + _tr = tr; + + const int32 idshould = -1317732048; + byte fv; + int32 id; + Common::File inf; + + if (spritenum == 177) + return; // Already running! + + Common::String filename; + filename = filename.format("sprite%d.avd", spritenum); + if (!inf.open(filename)) { + warning("AVALANCHE: Trip: File not found: %s", filename.c_str()); + return; + } + + inf.seek(177); + + id = inf.readSint32LE(); + if (id != idshould) { + //output << '\7'; + inf.close(); + return; + } + + inf.skip(2); // Replace variable named 'soa' in the original code. + + if (!_stat._name.empty()) + _stat._name.clear(); + byte nameSize = inf.readByte(); + for (byte i = 0; i < nameSize; i++) + _stat._name += inf.readByte(); + inf.skip(12 - nameSize); + + //inf.skip(1); // Same as above. + byte commentSize = inf.readByte(); + for (byte i = 0; i < commentSize; i++) + _stat._comment += inf.readByte(); + inf.skip(16 - commentSize); + + _stat._frameNum = inf.readByte(); + _info._xLength = inf.readByte(); + _info._yLength = inf.readByte(); + _stat.seq = inf.readByte(); + _info._size = inf.readUint16LE(); + _stat._fgBubbleCol = inf.readByte(); + _stat._bgBubbleCol = inf.readByte(); + _stat.accinum = inf.readByte(); + + totalnum = 0; // = 1; + _info._xWidth = _info._xLength / 8; + if ((_info._xLength % 8) > 0) + _info._xWidth++; + for (byte aa = 0; aa < _stat._frameNum; aa++) { + + _info._sil[totalnum] = new SilType[11 * (_info._yLength + 1)]; + //getmem(sil[totalnum-1], 11 * (a.yl + 1)); + _info._mani[totalnum] = new ManiType[_info._size - 6]; + //getmem(mani[totalnum-1], a.size - 6); + for (fv = 0; fv <= _info._yLength; fv++) + inf.read((*_info._sil[totalnum])[fv], _info._xWidth); + //blockread(inf, (*sil[totalnum-1])[fv], xw); + inf.read(*_info._mani[totalnum], _info._size - 6); + //blockread(inf, *mani[totalnum-1], a.size - 6); + + totalnum++; + } + totalnum++; + + // on; + _x = 0; + _y = 0; + quick = true; + _visible = false; + xs = 3; + ys = 1; + if (spritenum == 1) + _tr->newspeed(); // Just for the lights. + + homing = false; + ix = 0; + iy = 0; + step = 0; + check_me = do_check; + count = 0; + whichsprite = spritenum; + vanishifstill = false; + call_eachstep = false; + + inf.close(); +} + +void AnimationType::original() { + quick = false; + whichsprite = 177; +} + +void AnimationType::andexor() { + if ((vanishifstill) && (ix == 0) && (iy == 0)) + return; + byte picnum = face * _stat.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). + + _tr->_vm->_graphics->drawSprite(_info, picnum, _x, _y); +} + +void AnimationType::turn(byte whichway) { + if (whichway == 8) + face = Animation::kDirUp; + else + face = whichway; +} + +void AnimationType::appear(int16 wx, int16 wy, byte wf) { + _x = (wx / 8) * 8; + _y = wy; + _oldX[_tr->_vm->_gyro->_cp] = wx; + _oldY[_tr->_vm->_gyro->_cp] = wy; + turn(wf); + _visible = true; + ix = 0; + iy = 0; +} + +bool AnimationType::collision_check() { + for (byte fv = 0; fv < _tr->kSpriteNumbMax; fv++) + if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && + ((_x + _info._xLength) > _tr->tr[fv]._x) && + (_x < (_tr->tr[fv]._x + _tr->tr[fv]._info._xLength)) && + (_tr->tr[fv]._y == _y)) + return true; + + return false; +} + +void AnimationType::walk() { + byte tc; + ByteField r; + + + if (_visible) { + r._x1 = (_x / 8) - 1; + if (r._x1 == 255) + r._x1 = 0; + r._y1 = _y - 2; + r._x2 = ((_x + _info._xLength) / 8) + 1; + r._y2 = _y + _info._yLength + 2; + + _tr->getset[1 - _tr->_vm->_gyro->_cp].remember(r); + } + + if (!_tr->_vm->_gyro->_doingSpriteRun) { + _oldX[_tr->_vm->_gyro->_cp] = _x; + _oldY[_tr->_vm->_gyro->_cp] = _y; + if (homing) + homestep(); + _x = _x + ix; + _y = _y + iy; + } + + if (check_me) { + if (collision_check()) { + bounce(); + return; + } + + tc = _tr->checkfeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1; + // -1 is because the modified array indexes of magics[] compared to Pascal . + + if ((tc != 255) & (!_tr->_vm->_gyro->_doingSpriteRun)) { + switch (_tr->_vm->_gyro->_magics[tc]._operation) { + case Gyro::kMagicExclaim: { + bounce(); + _tr->mustexclaim = true; + _tr->saywhat = _tr->_vm->_gyro->_magics[tc]._data; + } + break; + case Gyro::kMagicBounce: + bounce(); + break; + case Gyro::kMagicTransport: + _tr->fliproom(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff); + break; + case Gyro::kMagicUnfinished: { + bounce(); + _tr->_vm->_scrolls->display("\7Sorry.\3\rThis place is not available yet!"); + } + break; + case Gyro::kMagicSpecial: + _tr->call_special(_tr->_vm->_gyro->_magics[tc]._data); + break; + case Gyro::kMagicOpenDoor: + _tr->open_the_door(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff, tc); + break; + } + } + } + + if (!_tr->_vm->_gyro->_doingSpriteRun) { + count++; + if (((ix != 0) || (iy != 0)) && (count > 1)) { + step++; + if (step == _stat.seq) + step = 0; + count = 0; + } + } +} + +void AnimationType::bounce() { + _x = _oldX[_tr->_vm->_gyro->_cp]; + _y = _oldY[_tr->_vm->_gyro->_cp]; + if (check_me) + _tr->stopwalking(); + else + stopwalk(); + _tr->_vm->_gyro->_onCanDoPageSwap = false; + _tr->_vm->_lucerna->drawDirection(); + _tr->_vm->_gyro->_onCanDoPageSwap = true; +} + +int8 AnimationType::sgn(int16 val) { + if (val > 0) + return 1; + else if (val < 0) + return -1; + else + return 0; +} + +void AnimationType::walkto(byte pednum) { + pednum--; // Pascal -> C conversion: different array indexes. + speed(sgn(_tr->_vm->_gyro->_peds[pednum]._x - _x) * 4, sgn(_tr->_vm->_gyro->_peds[pednum]._y - _y)); + hx = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; + hy = _tr->_vm->_gyro->_peds[pednum]._y - _info._yLength; + homing = true; +} + +void AnimationType::stophoming() { + homing = false; +} + +void AnimationType::homestep() { + int16 temp; + + if ((hx == _x) && (hy == _y)) { + // touching the target + stopwalk(); + return; + } + ix = 0; + iy = 0; + if (hy != _y) { + temp = hy - _y; + if (temp > 4) + iy = 4; + else if (temp < -4) + iy = -4; + else + iy = temp; + } + if (hx != _x) { + temp = hx - _x; + if (temp > 4) + ix = 4; + else if (temp < -4) + ix = -4; + else + ix = temp; + } +} + +void AnimationType::speed(int8 xx, int8 yy) { + ix = xx; + iy = yy; + if ((ix == 0) && (iy == 0)) + return; // no movement + if (ix == 0) { + // No horz movement + if (iy < 0) + turn(_tr->kDirUp); + else + turn(_tr->kDirDown); + } else { + if (ix < 0) + turn(_tr->kDirLeft); + else + turn(_tr->kDirRight); + } +} + +void AnimationType::stopwalk() { + ix = 0; + iy = 0; + homing = false; +} + +void AnimationType::chatter() { + _tr->_vm->_gyro->_talkX = _x + _info._xLength / 2; + _tr->_vm->_gyro->_talkY = _y; + _tr->_vm->_gyro->_talkFontColor = _stat._fgBubbleCol; + _tr->_vm->_gyro->_talkBackgroundColor = _stat._bgBubbleCol; +} + +void AnimationType::set_up_saver(trip_saver_type &v) { + v.whichsprite = whichsprite; + v.face = face; + v.step = step; + v.x = _x; + v.y = _y; + v.ix = ix; + v.iy = iy; + v.visible = _visible; + v.homing = homing; + v.check_me = check_me; + v.count = count; + v.xw = _info._xWidth; + v.xs = xs; + v.ys = ys; + v.totalnum = totalnum; + v.hx = hx; + v.hy = hy; + v.call_eachstep = call_eachstep; + v.eachstep = eachstep; + v.vanishifstill = vanishifstill; +} + +void AnimationType::unload_saver(trip_saver_type v) { + whichsprite = v.whichsprite; + face = v.face; + step = v.step; + _x = v.x; + _y = v.y; + ix = v.ix; + iy = v.iy; + _visible = v.visible; + homing = v.homing; + check_me = v.check_me; + count = v.count; + _info._xWidth = v.xw; + xs = v.xs; + ys = v.ys; + totalnum = v.totalnum; + hx = v.hx; + hy = v.hy; + call_eachstep = v.call_eachstep; + eachstep = v.eachstep; + vanishifstill = v.vanishifstill; +} + +void AnimationType::savedata(Common::File &f) { + warning("STUB: triptype::savedata()"); +} + +void AnimationType::loaddata(Common::File &f) { + warning("STUB: triptype::loaddata()"); +} + +void AnimationType::save_data_to_mem(uint16 &where) { + warning("STUB: triptype::save_data_to_mem()"); +} + +void AnimationType::load_data_from_mem(uint16 &where) { + warning("STUB: triptype::load_data_from_mem()"); +} + +AnimationType *AnimationType::done() { + Common::String xx; + + // nds:=num div seq; + totalnum--; + _info._xWidth = _info._xLength / 8; + if ((_info._xLength % 8) > 0) + _info._xWidth++; + for (byte aa = 0; aa < _stat._frameNum; aa++) { + totalnum--; + delete[] _info._mani[totalnum]; + delete[] _info._sil[totalnum]; + } + + quick = false; + whichsprite = 177; + return this; +} + +getsettype *getsettype::init() { + numleft = 0; // initialize array pointer + return this; +} + +void getsettype::remember(ByteField r) { + numleft++; + //if (numleft > maxgetset) + // error("Trip::remember() : runerr_Getset_Overflow"); + gs[numleft] = r; +} + +void getsettype::recall(ByteField &r) { + r = gs[numleft]; + numleft--; +} + + + + + + +Animation::Animation(AvalancheEngine *vm) { + _vm = vm; + + getsetclear(); + mustexclaim = false; +} + +Animation::~Animation() { + for (byte i = 0; i < kSpriteNumbMax; i++) { + if (tr[i].quick) + tr[i].done(); + } +} + +void Animation::loadtrip() { + for (int16 gm = 0; gm < kSpriteNumbMax; gm++) + tr[gm].original(); + + for (uint16 i = 0; i < sizeof(aa); i++) + aa[i] = 0; +} + +byte Animation::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { + byte a, c; + int16 fv, ff; + + // if not alive then begin checkfeet:=0; exit; end; + a = 0; + + //setactivepage(2); + if (x1 < 0) + x1 = 0; + if (x2 > 639) + x2 = 639; + if (oy < y) { + for (fv = x1; fv <= x2; fv++) { + for (ff = oy + yl; ff <= y + yl; ff++) { + c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); + if (c > a) + a = c; + } + } + } else { + for (fv = x1; fv <= x2; fv++) { + for (ff = y + yl; ff <= oy + yl; ff++) { + c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); + if (c > a) + a = c; + } + } + } + + //setactivepage(1 - cp); + return a; +} + +byte Animation::geida_ped(byte which) { + switch (which) { + case 1: + return 7; + case 2: + case 6: + return 8; + case 3: + case 5: + return 9; + case 4: + return 10; + default: + return 0; + } +} + +void Animation::catamove(byte ped) { +/* When you enter a new position in the catacombs, this procedure should + be called. It changes the Also codes so that they may match the picture + on the screen. (Coming soon: It draws up the screen, too.) */ + + int32 here; + uint16 xy_uint16; + byte fv; + + // XY_uint16 is cat_x+cat_y*256. Thus, every room in the + // catacombs has a different number for it. + + + + xy_uint16 = _vm->_gyro->_dna._catacombX + _vm->_gyro->_dna._catacombY * 256; + _vm->_gyro->_dna._geidaSpin = 0; + + switch (xy_uint16) { + case 1801: // Exit catacombs + fliproom(r__lustiesroom, 4); + _vm->_scrolls->display("Phew! Nice to be out of there!"); + return; + case 1033: // Oubliette + fliproom(r__oubliette, 1); + _vm->_scrolls->display(Common::String("Oh, NO!") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); + return; + case 4: + fliproom(r__geidas, 1); + return; + case 2307: + fliproom(r__lusties, 5); + _vm->_scrolls->display("Oh no... here we go again..."); + _vm->_gyro->_dna._userMovesAvvy = false; + tr[0].iy = 1; + tr[0].ix = 0; + return; + } + + if (!_vm->_gyro->_dna._enterCatacombsFromLustiesRoom) + _vm->_lucerna->loadRoom(29); + here = _vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1]; + + switch (here & 0xf) { // West. + case 0: // no connection (wall) + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); + break; + case 0x1: // no connection (wall + shield), + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. + break; + case 0x2: // wall with door + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door. + break; + case 0x3: // wall with door and shield + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. + break; + case 0x4: // no connection (wall + window), + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. + break; + case 0x5: // wall with door and window + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. + break; + case 0x6: // no connection (wall + torches), + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // No door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. + break; + case 0x7: // wall with door and torches + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. + break; + case 0xf: // straight-through corridor. + _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; // Sloping wall. + _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicSpecial; // Straight wall. + break; + } + + /* ---- */ + + switch ((here & 0xf0) >> 4) { // East + case 0: // no connection (wall) + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); + break; + case 0x1: // no connection (wall + window), + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...window. + break; + case 0x2: // wall with door + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door. + break; + case 0x3: // wall with door and window + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...window. + break; + case 0x6: // no connection (wall + torches), + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // No door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. + break; + case 0x7: // wall with door and torches + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... + _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door, and... + _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. + break; + case 0xf: // straight-through corridor. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicNothing; // Sloping wall. + _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicSpecial; // Straight wall. + _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. + break; + } + + /* ---- */ + + switch ((here & 0xf00) >> 8) { // South + case 0: // No connection. + _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; + break; + case 0x1: + _vm->_celer->drawBackgroundSprite(-1, -1, 22); + + if ((xy_uint16 == 2051) && (_vm->_gyro->_dna._geidaFollows)) + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicExclaim; + else + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicSpecial; // Right exit south. + + _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; + break; + case 0x2: + _vm->_celer->drawBackgroundSprite(-1, -1, 23); + _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicSpecial; // Middle exit south. + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; + break; + case 0x3: + _vm->_celer->drawBackgroundSprite(-1, -1, 24); + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicSpecial; // Left exit south. + _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; + break; + } + + switch ((here & 0xf000) >> 12) { // North + case 0: // No connection + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. + break; + // LEFT handles: +#if 0 + case 0x1: + _vm->_celer->show_one(-1, -1, 4); + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } + _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } + break; +#endif + case 0x2: + _vm->_celer->drawBackgroundSprite(-1, -1, 4); + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; // Middle exit north. + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. + break; +#if 0 + case 0x3: + _vm->_celer->show_one(-1, -1, 4); + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } { Change magic number! } + _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } + break; + // RIGHT handles: + case 0x4: + _vm->_celer->show_one(-1, -1, 3); + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } + _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } + break; +#endif + case 0x5: + _vm->_celer->drawBackgroundSprite(-1, -1, 3); + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; // Middle exit north. + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. + break; +#if 0 + case 0x6: + _vm->_celer->show_one(-1, -1, 3); + _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } + _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } + break; +#endif + // ARCHWAYS: + case 0x7: + case 0x8: + case 0x9: { + _vm->_celer->drawBackgroundSprite(-1, -1, 6); + + if (((here & 0xf000) >> 12) > 0x7) + _vm->_celer->drawBackgroundSprite(-1, -1, 31); + if (((here & 0xf000) >> 12) == 0x9) + _vm->_celer->drawBackgroundSprite(-1, -1, 32); + + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicSpecial; // Middle arch north. + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. + } + break; + // DECORATIONS: + case 0xd: // No connection + WINDOW + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 14); + break; + case 0xe: // No connection + TORCH + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. + _vm->_celer->drawBackgroundSprite(-1, -1, 8); + break; + // Recessed door: + case 0xf: + _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicNothing; // Door to Geida's room. + _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. + break; + } + + switch (xy_uint16) { + case 514: + _vm->_celer->drawBackgroundSprite(-1, -1, 17); + break; // [2,2] : "Art Gallery" sign over door. + case 264: + _vm->_celer->drawBackgroundSprite(-1, -1, 9); + break; // [8,1] : "The Wrong Way!" sign. + case 1797: + _vm->_celer->drawBackgroundSprite(-1, -1, 2); + break; // [5,7] : "Ite Mingite" sign. + case 258: + for (fv = 0; fv <= 2; fv++) { // [2,1] : Art gallery - pictures + _vm->_celer->drawBackgroundSprite(130 + fv * 120, 70, 15); + _vm->_celer->drawBackgroundSprite(184 + fv * 120, 78, 16); + } + break; + case 1287: + for (fv = 10; fv <= 13; fv++) + _vm->_celer->drawBackgroundSprite(-1, -1, fv); + break; // [7,5] : 4 candles. + case 776: + _vm->_celer->drawBackgroundSprite(-1, -1, 10); + break; // [8,3] : 1 candle. + case 2049: + _vm->_celer->drawBackgroundSprite(-1, -1, 11); + break; // [1,8] : another candle. + case 257: + _vm->_celer->drawBackgroundSprite(-1, -1, 12); + _vm->_celer->drawBackgroundSprite(-1, -1, 13); + break; // [1,1] : the other two. + } + + if ((_vm->_gyro->_dna._geidaFollows) && (ped > 0)) { + if (!tr[1].quick) // If we don't already have her... + tr[1].init(5, true, this); // ...Load Geida. + apped(2, geida_ped(ped)); + tr[1].call_eachstep = true; + tr[1].eachstep = procgeida_procs; + } +} + + + +// This proc gets called whenever you touch a line defined as _vm->_gyro->special. +void Animation::dawndelay() { + _vm->_timeout->set_up_timer(2, _vm->_timeout->procdawn_delay, _vm->_timeout->reason_dawndelay); +} + +void Animation::call_special(uint16 which) { + switch (which) { + case 1: // _vm->_gyro->special 1: Room 22: top of stairs. + _vm->_celer->drawBackgroundSprite(-1, -1, 1); + _vm->_gyro->_dna._brummieStairs = 1; + _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; + _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); + stopwalking(); + _vm->_gyro->_dna._userMovesAvvy = false; + break; + case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. + _vm->_gyro->_dna._brummieStairs = 3; + _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicNothing; + _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicExclaim; + _vm->_gyro->_magics[11]._data = 5; + _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicBounce; // Now works as planned! + stopwalking(); + _vm->_visa->dixi('q', 26); + _vm->_gyro->_dna._userMovesAvvy = true; + break; + case 3: // _vm->_gyro->special 3: Room 71: triggers dart. + tr[0].bounce(); // Must include that. + + if (!_vm->_gyro->_dna._arrowTriggered) { + _vm->_gyro->_dna._arrowTriggered = true; + apped(2, 4); // The dart starts at ped 4, and... + tr[1].walkto(5); // flies to ped 5. + tr[1].face = kDirUp; // Only face. + // Should call some kind of Eachstep procedure which will deallocate + // the sprite when it hits the wall, and replace it with the chunk + // graphic of the arrow buried in the plaster. */ + + // OK! + tr[1].call_eachstep = true; + tr[1].eachstep = procarrow_procs; + } + break; + case 4: // This is the ghost room link. + _vm->_lucerna->dusk(); + tr[0].turn(kDirRight); // you'll see this after we get back from bootstrap + _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); + _vm->_enid->backToBootstrap(3); + break; + case 5: + if (_vm->_gyro->_dna._friarWillTieYouUp) { + // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. + _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Boundary effect is now working again. + _vm->_visa->dixi('q', 35); + tr[0].done(); + //tr[1].vanishifstill:=true; + _vm->_celer->drawBackgroundSprite(-1, -1, 2); + _vm->_visa->dixi('q', 36); + _vm->_gyro->_dna._tiedUp = true; + _vm->_gyro->_dna._friarWillTieYouUp = false; + tr[1].walkto(3); + tr[1].vanishifstill = true; + tr[1].check_me = true; // One of them must have Check_Me switched on. + _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. + _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); + } + break; + case 6: // _vm->_gyro->special 6: fall down oubliette. + _vm->_gyro->_dna._userMovesAvvy = false; + tr[0].ix = 3; + tr[0].iy = 0; + tr[0].face = kDirRight; + _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); + break; + case 7: // _vm->_gyro->special 7: stop falling down oubliette. + tr[0]._visible = false; + _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; + stopwalking(); + _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); + //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); + //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); + _vm->_scrolls->display("Oh dear, you seem to be down the bottom of an oubliette."); + _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); + break; + case 8: // _vm->_gyro->special 8: leave du Lustie's room. + if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { + _vm->_visa->dixi('q', 63); + tr[1].turn(kDirDown); + tr[1].stopwalk(); + tr[1].call_eachstep = false; // Geida + _vm->_lucerna->gameOver(); + } + break; + case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... + if (!_vm->_gyro->_dna._geidaFollows) + return; // DOESN'T COUNT: no Geida. + tr[1].call_eachstep = false; // She no longer follows Avvy around. + tr[1].walkto(4); // She walks to somewhere... + tr[0].done(); // Lose Avvy. + _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->reason_robin_hood_and_geida); + break; + case 10: // _vm->_gyro->special 10: transfer north in catacombs. + if ((_vm->_gyro->_dna._catacombX == 4) && (_vm->_gyro->_dna._catacombY == 1)) { + // Into Geida's room. + if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectKey - 1]) + _vm->_visa->dixi('q', 62); + else { + _vm->_visa->dixi('q', 61); + return; + } + } + _vm->_lucerna->dusk(); + _vm->_gyro->_dna._catacombY--; + catamove(4); + if (_vm->_gyro->_dna._room != r__catacombs) + return; + switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1] & 0xf00) >> 8) { + case 0x1: + apped(1, 12); + break; + case 0x3: + apped(1, 11); + break; + default: + apped(1, 4); + } + getback(); + dawndelay(); + break; + case 11: // _vm->_gyro->special 11: transfer east in catacombs. + _vm->_lucerna->dusk(); + _vm->_gyro->_dna._catacombX++; + catamove(1); + if (_vm->_gyro->_dna._room != r__catacombs) + return; + apped(1, 1); + getback(); + dawndelay(); + break; + case 12: // _vm->_gyro->special 12: transfer south in catacombs. + _vm->_lucerna->dusk(); + _vm->_gyro->_dna._catacombY += 1; + catamove(2); + if (_vm->_gyro->_dna._room != r__catacombs) + return; + apped(1, 2); + getback(); + dawndelay(); + break; + case 13: // _vm->_gyro->special 13: transfer west in catacombs. + _vm->_lucerna->dusk(); + _vm->_gyro->_dna._catacombX--; + catamove(3); + if (_vm->_gyro->_dna._room != r__catacombs) + return; + apped(1, 3); + getback(); + dawndelay(); + break; + } +} + + + +void Animation::open_the_door(byte whither, byte ped, byte magicnum) { +// This slides the door open. (The data really ought to be saved in +// the Also file, and will be next time. However, for now, they're +// here.) + switch (_vm->_gyro->_dna._room) { + case r__outsideyours: + case r__outsidenottspub: + case r__outsideducks: + _vm->_sequence->first_show(1); + _vm->_sequence->then_show(2); + _vm->_sequence->then_show(3); + break; + case r__insidecardiffcastle: + _vm->_sequence->first_show(1); + _vm->_sequence->then_show(5); + break; + case r__avvysgarden: + case r__entrancehall: + case r__insideabbey: + case r__yourhall: + _vm->_sequence->first_show(1); + _vm->_sequence->then_show(2); + break; + case r__musicroom: + case r__outsideargentpub: + _vm->_sequence->first_show(5); + _vm->_sequence->then_show(6); + break; + case r__lusties: + switch (magicnum) { + case 14: + if (_vm->_gyro->_dna._avvysInTheCupboard) { + hide_in_the_cupboard(); + _vm->_sequence->first_show(8); + _vm->_sequence->then_show(7); + _vm->_sequence->start_to_close(); + return; + } else { + apped(1, 6); + tr[0].face = kDirRight; // added by TT 12/3/1995 + _vm->_sequence->first_show(8); + _vm->_sequence->then_show(9); + } + break; + case 12: + _vm->_sequence->first_show(4); + _vm->_sequence->then_show(5); + _vm->_sequence->then_show(6); + break; + } + break; + } + + _vm->_sequence->then_flip(whither, ped); + _vm->_sequence->start_to_open(); +} + +void Animation::newspeed() { + // Given that you've just changed the speed in triptype.xs, this adjusts ix. + const ByteField lightspace = {40, 199, 47, 199}; + byte page_; + + tr[0].ix = (tr[0].ix / 3) * tr[0].xs; + + //setactivepage(3); + + if (tr[0].xs == _vm->_gyro->kRun) + _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); + else + _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); + + if (tr[0].xs == _vm->_gyro->kRun) + _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); + else + _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); + + //setactivepage(1 - cp); + + for (page_ = 0; page_ <= 1; page_++) + getset[page_].remember(lightspace); + +} + +void Animation::rwsp(byte t, byte dir) { + switch (dir) { + case kDirUp: + tr[t].speed(0, -tr[t].ys); + break; + case kDirDown: + tr[t].speed(0, tr[t].ys); + break; + case kDirLeft: + tr[t].speed(-tr[t].xs, 0); + break; + case kDirRight: + tr[t].speed(tr[t].xs, 0); + break; + case kDirUpLeft: + tr[t].speed(-tr[t].xs, -tr[t].ys); + break; + case kDirUpRight: + tr[t].speed(tr[t].xs, -tr[t].ys); + break; + case kDirDownLeft: + tr[t].speed(-tr[t].xs, tr[t].ys); + break; + case kDirDownRight: + tr[t].speed(tr[t].xs, tr[t].ys); + break; + } +} + +void Animation::apped(byte trn, byte np) { + trn--; + np--; + tr[trn].appear(_vm->_gyro->_peds[np]._x - tr[trn]._info._xLength / 2, _vm->_gyro->_peds[np]._y - tr[trn]._info._yLength, _vm->_gyro->_peds[np]._direction); + rwsp(trn, _vm->_gyro->_peds[np]._direction); +} + +#if 0 + function overlap(x1,y1,x2,y2,x3,y3,x4,y4:uint16):bool; + begin // By De Morgan's law: + overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); + end; +#endif + //x1,x2 - as _vm->_gyro->bytefield, but *8. y1,y2 - as _vm->_gyro->bytefield. + //x3,y3 = mx,my. x4,y4 = mx+16,my+16. + +void Animation::getback() { + // Super_Off; +#if 0 + while (getset[1 - _vm->_gyro->cp].numleft > 0) { + getset[1 - _vm->_gyro->cp].recall(r); + + + bool endangered = false; + if overlaps_with_mouse and not endangered then + begin + endangered:=true; + blitfix; + Super_Off; + end; + + //_vm->_lucerna->mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); + } + + if endangered then + Super_On; +#endif +} + +// Eachstep procedures: +void Animation::follow_avvy_y(byte tripnum) { + if (tr[0].face == kDirLeft) + return; + if (tr[tripnum].homing) + tr[tripnum].hy = tr[1]._y; + else { + if (tr[tripnum]._y < tr[1]._y) + tr[tripnum]._y += 1; + else if (tr[tripnum]._y > tr[1]._y) + tr[tripnum]._y -= 1; + else + return; + if (tr[tripnum].ix == 0) { + tr[tripnum].step += 1; + if (tr[tripnum].step == tr[tripnum]._stat.seq) + tr[tripnum].step = 0; + tr[tripnum].count = 0; + } + } +} + +void Animation::back_and_forth(byte tripnum) { + if (!tr[tripnum].homing) { + if (tr[tripnum].face == kDirRight) + tr[tripnum].walkto(4); + else + tr[tripnum].walkto(5); + } +} + +void Animation::face_avvy(byte tripnum) { + if (!tr[tripnum].homing) { + if (tr[0]._x >= tr[tripnum]._x) + tr[tripnum].face = kDirRight; + else + tr[tripnum].face = kDirLeft; + } +} + +void Animation::arrow_procs(byte tripnum) { + if (tr[tripnum].homing) { + // Arrow is still in flight. + // We must check whether or not the arrow has collided tr[tripnum] Avvy's head. + // This is so if: a) the bottom of the arrow is below Avvy's head, + // b) the left of the arrow is left of the right of Avvy's head, and + // c) the right of the arrow is right of the left of Avvy's head. + if (((tr[tripnum]._y + tr[tripnum]._info._yLength) >= tr[0]._y) // A + && (tr[tripnum]._x <= (tr[0]._x + tr[0]._info._xLength)) // B + && ((tr[tripnum]._x + tr[tripnum]._info._xLength) >= tr[0]._x)) { // C + // OK, it's hit him... what now? + + tr[1].call_eachstep = false; // prevent recursion. + _vm->_visa->dixi('Q', 47); // Complaint! + tr[tripnum].done(); // Deallocate the arrow. +#if 0 + tr[1].done; { Deallocate normal pic of Avvy. } + + off; + for byte fv:=0 to 1 do + begin + cp:=1-cp; + getback; + end; + on; +#endif + _vm->_lucerna->gameOver(); + + _vm->_gyro->_dna._userMovesAvvy = false; // Stop the user from moving him. + _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->reason_naughty_duke); + } + } else { // Arrow has hit the wall! + tr[tripnum].done(); // Deallocate the arrow. + _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Show pic of arrow stuck into the door. + _vm->_gyro->_dna._arrowInTheDoor = true; // So that we can pick it up. + } + +} + +#if 0 +procedure Spludwick_procs(tripnum:byte); +var fv:byte; +begin + with tr[tripnum] do + if not homing then { We only need to do anything if Spludwick *stops* + walking. } + with _vm->_gyro->dna do + begin + inc(DogfoodPos); + if DogfoodPos=8 then DogfoodPos:=1; + walkto(DogfoodPos); + end; +end; +#endif + +void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. + int16 tox = tr[0]._x + 17; + int16 toy = tr[0]._y - 1; + if ((tr[tripnum]._x == tox) && (tr[tripnum]._y == toy)) { + tr[tripnum].call_eachstep = false; + tr[tripnum].face = kDirLeft; + tr[tripnum].stopwalk(); + // ... whatever ... + } else { + // Still some way to go. + if (tr[tripnum]._x < tox) { + tr[tripnum]._x += 5; + if (tr[tripnum]._x > tox) + tr[tripnum]._x = tox; + } + if (tr[tripnum]._y < toy) + tr[tripnum]._y++; + tr[tripnum].step++; + if (tr[tripnum].step == tr[tripnum]._stat.seq) + tr[tripnum].step = 0; + } +} + +void Animation::take_a_step(byte &tripnum) { + if (tr[tripnum].ix == 0) { + tr[tripnum].step++; + if (tr[tripnum].step == tr[tripnum]._stat.seq) + tr[tripnum].step = 0; + tr[tripnum].count = 0; + } +} + +void Animation::spin(byte whichway, byte &tripnum) { + if (tr[tripnum].face != whichway) { + tr[tripnum].face = whichway; + if (tr[tripnum].whichsprite == 2) + return; // Not for Spludwick + + _vm->_gyro->_dna._geidaSpin += 1; + _vm->_gyro->_dna._geidaTime = 20; + if (_vm->_gyro->_dna._geidaSpin == 5) { + _vm->_scrolls->display("Steady on, Avvy, you'll make the poor girl dizzy!"); + _vm->_gyro->_dna._geidaSpin = 0; + _vm->_gyro->_dna._geidaTime = 0; // knock out records + } + } +} + +void Animation::geida_procs(byte tripnum) { + if (_vm->_gyro->_dna._geidaTime > 0) { + _vm->_gyro->_dna._geidaTime--; + if (_vm->_gyro->_dna._geidaTime == 0) + _vm->_gyro->_dna._geidaSpin = 0; + } + + if (tr[tripnum]._y < (tr[0]._y - 2)) { + // Geida is further from the screen than Avvy. + spin(kDirDown, tripnum); + tr[tripnum].iy = 1; + tr[tripnum].ix = 0; + take_a_step(tripnum); + return; + } else if (tr[tripnum]._y > (tr[0]._y + 2)) { + // Avvy is further from the screen than Geida. + spin(kDirUp, tripnum); + tr[tripnum].iy = -1; + tr[tripnum].ix = 0; + take_a_step(tripnum); + return; + } + + tr[tripnum].iy = 0; + // These 12-s are not in the original, I added them to make the following method more "smooth". + // Now the NPC which is following Avvy won't block his way and will walk next to him properly. + if (tr[tripnum]._x < tr[0]._x - tr[0].xs * 8 - 12) { + tr[tripnum].ix = tr[0].xs; + spin(kDirRight, tripnum); + take_a_step(tripnum); + } else if (tr[tripnum]._x > tr[0]._x + tr[0].xs * 8 + 12) { + tr[tripnum].ix = -tr[0].xs; + spin(kDirLeft, tripnum); + take_a_step(tripnum); + } else + tr[tripnum].ix = 0; +} + +// That's all... + +void Animation::call_andexors() { + int8 order[5]; + byte fv, temp; + bool ok; + + for (int i = 0; i < 5; i++) + order[i] = -1; + + for (fv = 0; fv < kSpriteNumbMax; fv++) { + if (tr[fv].quick && tr[fv]._visible) + order[fv] = fv; + } + + do { + ok = true; + for (fv = 0; fv < 4; fv++) { + if (((order[fv] != -1) && (order[fv + 1] != -1)) + && (tr[order[fv]]._y > tr[order[fv + 1]]._y)) { + // Swap them! + temp = order[fv]; + order[fv] = order[fv + 1]; + order[fv + 1] = temp; + ok = false; + } + } + } while (!ok); + + + _vm->_graphics->refreshBackground(); + + for (fv = 0; fv < 5; fv++) { + if (order[fv] > -1) + tr[order[fv]].andexor(); + } +} + +void Animation::trippancy_link() { + byte fv; + + if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) + return; + for (fv = 0; fv < kSpriteNumbMax; fv++) { + if (tr[fv].quick && tr[fv]._visible) + tr[fv].walk(); + } + + call_andexors(); + + for (fv = 0; fv < kSpriteNumbMax; fv++) { + if (tr[fv].quick && tr[fv].call_eachstep) { + switch (tr[fv].eachstep) { + case procfollow_avvy_y : + follow_avvy_y(fv); + break; + case procback_and_forth : + back_and_forth(fv); + break; + case procface_avvy : + face_avvy(fv); + break; + case procarrow_procs : + arrow_procs(fv); + break; + // PROCSpludwick_procs : spludwick_procs(fv); + case procgrab_avvy : + grab_avvy(fv); + break; + case procgeida_procs : + geida_procs(fv); + break; + } + } + } + + if (mustexclaim) { + mustexclaim = false; + _vm->_visa->dixi('x', saywhat); + } +} + +void Animation::get_back_loretta() { + byte fv; + + for (fv = 0; fv < kSpriteNumbMax; fv++) { + if (tr[fv].quick) { + getback(); + return; + } + } + // for fv:=0 to 1 do begin cp:=1-cp; getback; end; +} + +void Animation::stopwalking() { + tr[0].stopwalk(); + _vm->_gyro->_dna._direction = kDirStopped; + if (_vm->_gyro->_alive) + tr[0].step = 1; +} + +void Animation::tripkey(char dir) { + warning("Replaced by Trip::handleMoveKey!"); +} + +void Animation::readstick() { + warning("STUB: Trip::readstick()"); +} + +void Animation::getsetclear() { + for (byte fv = 0; fv <= 1; fv++) + getset[fv].init(); +} + +void Animation::hide_in_the_cupboard() { + if (_vm->_gyro->_dna._avvysInTheCupboard) { + if (_vm->_gyro->_dna._wearing == Acci::kNothing) + _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); + else { + tr[0]._visible = true; + _vm->_gyro->_dna._userMovesAvvy = true; + apped(1, 3); // Walk out of the cupboard. + _vm->_scrolls->display("You leave the cupboard. Nice to be out of there!"); + _vm->_gyro->_dna._avvysInTheCupboard = false; + _vm->_sequence->first_show(8); + _vm->_sequence->then_show(7); + _vm->_sequence->start_to_close(); + } + } else { + // Not hiding in the cupboard + tr[0]._visible = false; + _vm->_gyro->_dna._userMovesAvvy = false; + _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph + + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); + _vm->_gyro->_dna._avvysInTheCupboard = true; + _vm->_celer->drawBackgroundSprite(-1, -1, 8); + } +} + +void Animation::fliproom(byte room, byte ped) { + byte fv; + + if (!_vm->_gyro->_alive) { + // You can't leave the room if you're dead. + tr[0].ix = 0; + tr[0].iy = 0; // Stop him from moving. + return; + } + + if ((room == 177) && (_vm->_gyro->_dna._room == r__lusties)) { + hide_in_the_cupboard(); + return; + } + + if ((_vm->_gyro->_dna._jumpStatus > 0) && (_vm->_gyro->_dna._room == r__insidecardiffcastle)) { + // You can't *jump* out of Cardiff Castle! + tr[0].ix = 0; + return; + } + + _vm->_lucerna->exitRoom(_vm->_gyro->_dna._room); + _vm->_lucerna->dusk(); + getsetclear(); + + + for (fv = 1; fv < kSpriteNumbMax; fv++) { + if (tr[fv].quick) + tr[fv].done(); + } // Deallocate sprite + + if (_vm->_gyro->_dna._room == r__lustiesroom) + _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; + + _vm->_lucerna->enterRoom(room, ped); + apped(1, ped); + _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; + _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; + _vm->_gyro->_dna._direction = tr[0].face; + _vm->_lucerna->drawDirection(); + + for (fv = 0; fv <= 1; fv++) { + _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; + getback(); + } + _vm->_lucerna->dawn(); + + // Tidy up after mouse. I know it's a kludge... + // tidy_after_mouse; +} + +bool Animation::infield(byte which) { + which--; // Pascal -> C: different array indexes. + + int16 yy = tr[0]._y + tr[0]._info._yLength; + + return (tr[0]._x >= _vm->_gyro->_fields[which]._x1) && (tr[0]._x <= _vm->_gyro->_fields[which]._x2) + && (yy >= _vm->_gyro->_fields[which]._y1) && (yy <= _vm->_gyro->_fields[which]._y2); + +} + +bool Animation::neardoor() { + if (_vm->_gyro->_fieldNum < 8) { + // there ARE no doors here! + return false; + } + + int16 ux = tr[0]._x; + int16 uy = tr[0]._y + tr[0]._info._yLength; + bool nd = false; + for (byte fv = 8; fv < _vm->_gyro->_fieldNum; fv++) + if ((ux >= _vm->_gyro->_fields[fv]._x1) && (ux <= _vm->_gyro->_fields[fv]._x2) + && (uy >= _vm->_gyro->_fields[fv]._y1) && (uy <= _vm->_gyro->_fields[fv]._y2)) + nd = true; + return nd; +} + +void Animation::new_game_for_trippancy() { // Called by gyro.newgame + tr[0]._visible = false; +} + +void Animation::handleMoveKey(const Common::Event &event) { + if (!_vm->_gyro->_dna._userMovesAvvy) + return; + + if (_vm->_dropdown->_activeMenuItem._activeNow) + _vm->_parser->tryDropdown(); + else { + switch (event.kbd.keycode) { + case Common::KEYCODE_UP: + if (_vm->_gyro->_dna._direction != kDirUp) { + _vm->_gyro->_dna._direction = kDirUp; + rwsp(0, _vm->_gyro->_dna._direction); + } else + stopwalking(); + break; + case Common::KEYCODE_DOWN: + if (_vm->_gyro->_dna._direction != kDirDown) { + _vm->_gyro->_dna._direction = kDirDown; + rwsp(0, _vm->_gyro->_dna._direction); + } else + stopwalking(); + break; + case Common::KEYCODE_LEFT: + if (_vm->_gyro->_dna._direction != kDirLeft) { + _vm->_gyro->_dna._direction = kDirLeft; + rwsp(0, _vm->_gyro->_dna._direction); + } else + stopwalking(); + break; + case Common::KEYCODE_RIGHT: + if (_vm->_gyro->_dna._direction != kDirRight) { + _vm->_gyro->_dna._direction = kDirRight; + rwsp(0, _vm->_gyro->_dna._direction); + } else + stopwalking(); + break; + case Common::KEYCODE_PAGEUP: + if (_vm->_gyro->_dna._direction != kDirUpRight) { + _vm->_gyro->_dna._direction = kDirUpRight; + rwsp(0, _vm->_gyro->_dna._direction); + } else + stopwalking(); + break; + case Common::KEYCODE_PAGEDOWN: + if (_vm->_gyro->_dna._direction != kDirDownRight) { + _vm->_gyro->_dna._direction = kDirDownRight; + rwsp(0, _vm->_gyro->_dna._direction); + } else + stopwalking(); + break; + case Common::KEYCODE_END: + if (_vm->_gyro->_dna._direction != kDirDownLeft) { + _vm->_gyro->_dna._direction = kDirDownLeft; + rwsp(0, _vm->_gyro->_dna._direction); + } else + stopwalking(); + break; + case Common::KEYCODE_HOME: + if (_vm->_gyro->_dna._direction != kDirUpLeft) { + _vm->_gyro->_dna._direction = kDirUpLeft; + rwsp(0, _vm->_gyro->_dna._direction); + } else + stopwalking(); + break; + case Common::KEYCODE_KP5: + stopwalking(); + break; + default: + break; + } + } +} + + +} // End of namespace Avalanche. diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h new file mode 100644 index 0000000000..b8ae547d8c --- /dev/null +++ b/engines/avalanche/animation.h @@ -0,0 +1,217 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on the original source code of Lord Avalot d'Argent version 1.3. + * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. + */ + +/* Original name TRIP5 / Trippancy V - the sprite animation subsystem */ + +#ifndef AVALANCHE_ANIMATION_H +#define AVALANCHE_ANIMATION_H + +#include "avalanche/graphics.h" + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Avalanche { +class AvalancheEngine; + +struct adxtype { // Second revision of ADX type + // CHECKME: Useless? + Common::String _name; // name of character + Common::String _comment; // comment + // + byte _frameNum; // number of pictures + byte seq; // how many in one stride + byte _fgBubbleCol, _bgBubbleCol; // foreground & background bubble colors + byte accinum; // the number according to Acci (1=Avvy, etc.) +}; + +struct trip_saver_type { + byte whichsprite; + byte face; + byte step; + int16 x; + int16 y; + int8 ix; + int8 iy; + bool visible; + bool homing; + bool check_me; + byte count; + byte xw, xs, ys; + byte totalnum; + int16 hx; + int16 hy; + bool call_eachstep; + byte eachstep; + bool vanishifstill; +}; + +class Animation; + +class AnimationType { +public: + SpriteInfo _info; + + adxtype _stat; // vital statistics + byte face, step; + int16 _x, _y; // current xy coords + int16 _oldX[2], _oldY[2]; // last xy coords + int8 ix, iy; // amount to move sprite by, each step + byte whichsprite; + bool quick, _visible, homing, check_me; + int16 hx, hy; // homing x & y coords + byte count; // counts before changing step + byte xs, ys; // x & y speed + byte totalnum; // total number of sprites + bool vanishifstill; // Do we show this sprite if it's still? + + bool call_eachstep; // Do we call the eachstep procedure? + byte eachstep; + + void init(byte spritenum, bool do_check, Animation *tr); + // loads & sets up the sprite + void original(); // just sets Quick to false + void andexor(); // drops sprite onto screen + void turn(byte whichway); // turns him round + void appear(int16 wx, int16 wy, byte wf); // switches him on + void bounce(); // bounces off walls. + void walk(); // prepares for andexor, etc. + void walkto(byte pednum); // home in on a point + void stophoming(); // self-explanatory + void homestep(); // calculates ix & iy for one homing step + void speed(int8 xx, int8 yy); // sets ix & iy, non-homing, etc + void stopwalk(); // Stops the sprite from moving + void chatter(); // Sets up talk vars + void set_up_saver(trip_saver_type &v); + void unload_saver(trip_saver_type v); + + void savedata(Common::File &f); // Self-explanatory, + void loaddata(Common::File &f); // really. + + void save_data_to_mem(uint16 &where); + void load_data_from_mem(uint16 &where); + AnimationType *done(); + +private: + Animation *_tr; + + bool collision_check(); + int8 sgn(int16 val); +}; + +const int16 maxgetset = 35; + +class getsettype { +public: + ByteField gs[maxgetset]; + byte numleft; + + getsettype *init(); + void remember(ByteField r); + void recall(ByteField &r); +}; + +class Animation { +public: + friend class AnimationType; + friend class getsettype; + + static const int16 kDirUp = 0; + static const int16 kDirRight = 1; + static const int16 kDirDown = 2; + static const int16 kDirLeft = 3; + static const int16 kDirUpRight = 4; + static const int16 kDirDownRight = 5; + static const int16 kDirDownLeft = 6; + static const int16 kDirUpLeft = 7; + static const int16 kDirStopped = 8; + + static const int16 kSpriteNumbMax = 5; // current max no. of sprites + + static const int16 procfollow_avvy_y = 1; + static const int16 procback_and_forth = 2; + static const int16 procface_avvy = 3; + static const int16 procarrow_procs = 4; + static const int16 procspludwick_procs = 5; + static const int16 procgrab_avvy = 6; + static const int16 procgeida_procs = 7; + + Animation(AvalancheEngine *vm); + ~Animation(); + + void trippancy_link(); + void get_back_loretta(); + void loadtrip(); + void call_special(uint16 which); + void open_the_door(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. + void catamove(byte ped); + void stopwalking(); + void tripkey(char dir); + void rwsp(byte t, byte dir); + void apped(byte trn, byte np); + void getback(); + void fliproom(byte room, byte ped); + bool infield(byte which); // Returns true if you're within field "which". + bool neardoor(); // Returns True if you're near a door. + void readstick(); + void newspeed(); + void new_game_for_trippancy(); + void take_a_step(byte &tripnum); + void handleMoveKey(const Common::Event &event); // To replace tripkey(). + + AnimationType tr[kSpriteNumbMax]; + getsettype getset[2]; + byte aa[1600]; + + bool mustexclaim; + uint16 saywhat; + +private: + AvalancheEngine *_vm; + + // CHECKME: Useless? + // ByteField r; + // int16 beforex, beforey; + + byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); + byte geida_ped(byte which); + void dawndelay(); + void hide_in_the_cupboard(); + void follow_avvy_y(byte tripnum); + void back_and_forth(byte tripnum); + void face_avvy(byte tripnum); + void arrow_procs(byte tripnum); + void grab_avvy(byte tripnum); + void spin(byte whichway, byte &tripnum); + void geida_procs(byte tripnum); + void call_andexors(); + void getsetclear(); +}; + +} // End of namespace Avalanche. + +#endif // AVALANCHE_ANIMATION_H diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 27cfdd1178..a7c8ea61db 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -70,7 +70,7 @@ AvalancheEngine::~AvalancheEngine() { delete _celer; delete _sequence; delete _timeout; - delete _trip; + delete _animation; delete _acci; delete _dropdown; delete _closing; @@ -91,7 +91,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _celer = new Celer(this); _sequence = new Sequence(this); _timeout = new Timeout(this); - _trip = new Trip(this); + _animation = new Animation(this); _acci = new Acci(this); _dropdown = new Dropdown(this); _closing = new Closing(this); @@ -282,52 +282,52 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { byte spriteNum = 0; if (sz.isSaving()) { - for (byte i = 0; i < _trip->kSpriteNumbMax; i++) { - if (_trip->tr[i].quick) + for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { + if (_animation->tr[i].quick) spriteNum++; } } sz.syncAsByte(spriteNum); if (sz.isLoading()) { - for (byte i = 0; i < _trip->kSpriteNumbMax; i++) { // Deallocate sprites. - if (_trip->tr[i].quick) - _trip->tr[i].done(); + for (byte i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites. + if (_animation->tr[i].quick) + _animation->tr[i].done(); } } for (byte i = 0; i < spriteNum; i++) { - sz.syncAsByte(_trip->tr[i].whichsprite); - sz.syncAsByte(_trip->tr[i].check_me); + sz.syncAsByte(_animation->tr[i].whichsprite); + sz.syncAsByte(_animation->tr[i].check_me); if (sz.isLoading()) { - _trip->tr[i].quick = true; - _trip->tr[i].init(_trip->tr[i].whichsprite, _trip->tr[i].check_me, _trip); + _animation->tr[i].quick = true; + _animation->tr[i].init(_animation->tr[i].whichsprite, _animation->tr[i].check_me, _animation); } - sz.syncAsByte(_trip->tr[i].ix); - sz.syncAsByte(_trip->tr[i].iy); - sz.syncAsByte(_trip->tr[i].face); - sz.syncAsByte(_trip->tr[i].step); - sz.syncAsByte(_trip->tr[i].visible); - sz.syncAsByte(_trip->tr[i].homing); - sz.syncAsByte(_trip->tr[i].count); - sz.syncAsByte(_trip->tr[i]._info._xWidth); - sz.syncAsByte(_trip->tr[i].xs); - sz.syncAsByte(_trip->tr[i].ys); - sz.syncAsByte(_trip->tr[i].totalnum); - sz.syncAsSint16LE(_trip->tr[i].hx); - sz.syncAsSint16LE(_trip->tr[i].hy); - sz.syncAsByte(_trip->tr[i].call_eachstep); - sz.syncAsByte(_trip->tr[i].eachstep); - sz.syncAsByte(_trip->tr[i].vanishifstill); - - sz.syncAsSint16LE(_trip->tr[i].x); - sz.syncAsSint16LE(_trip->tr[i].y); - - if (sz.isLoading() && _trip->tr[i].visible) - _trip->tr[i].appear(_trip->tr[i].x, _trip->tr[i].y, _trip->tr[i].face); + sz.syncAsByte(_animation->tr[i].ix); + sz.syncAsByte(_animation->tr[i].iy); + sz.syncAsByte(_animation->tr[i].face); + sz.syncAsByte(_animation->tr[i].step); + sz.syncAsByte(_animation->tr[i]._visible); + sz.syncAsByte(_animation->tr[i].homing); + sz.syncAsByte(_animation->tr[i].count); + sz.syncAsByte(_animation->tr[i]._info._xWidth); + sz.syncAsByte(_animation->tr[i].xs); + sz.syncAsByte(_animation->tr[i].ys); + sz.syncAsByte(_animation->tr[i].totalnum); + sz.syncAsSint16LE(_animation->tr[i].hx); + sz.syncAsSint16LE(_animation->tr[i].hy); + sz.syncAsByte(_animation->tr[i].call_eachstep); + sz.syncAsByte(_animation->tr[i].eachstep); + sz.syncAsByte(_animation->tr[i].vanishifstill); + + sz.syncAsSint16LE(_animation->tr[i]._x); + sz.syncAsSint16LE(_animation->tr[i]._y); + + if (sz.isLoading() && _animation->tr[i]._visible) + _animation->tr[i].appear(_animation->tr[i]._x, _animation->tr[i]._y, _animation->tr[i].face); } //groi = 177; @@ -470,12 +470,12 @@ bool AvalancheEngine::loadGame(const int16 slot) { _lucerna->refreshObjectList(); - _trip->newspeed(); + _animation->newspeed(); _lucerna->drawDirection(); _gyro->_onToolbar = false; - _trip->trippancy_link(); + _animation->trippancy_link(); _celer->updateBackgroundSprites(); @@ -484,8 +484,8 @@ bool AvalancheEngine::loadGame(const int16 slot) { + _gyro->_roomnName + _scrolls->kControlNewLine + _scrolls->kControlNewLine + "saved on " + expandDate(t.tm_mday, t.tm_mon, t.tm_year) + '.'); - if (_trip->tr[0].quick && _trip->tr[0].visible) - _trip->rwsp(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. + if (_animation->tr[0].quick && _animation->tr[0]._visible) + _animation->rwsp(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving. return true; } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 639f4cca3d..1973f9b6ff 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -43,7 +43,7 @@ #include "avalanche/celer2.h" #include "avalanche/sequence2.h" #include "avalanche/timeout2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/acci2.h" #include "avalanche/dropdown2.h" #include "avalanche/closing2.h" @@ -80,7 +80,7 @@ public: Celer *_celer; Sequence *_sequence; Timeout *_timeout; - Trip *_trip; + Animation *_animation; Acci *_acci; Dropdown *_dropdown; Closing *_closing; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 814de6368a..c7ebb21422 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -32,7 +32,7 @@ #include "avalanche/graphics.h" #include "avalanche/avalot.h" #include "avalanche/gyro2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" #include "avalanche/scrolls2.h" @@ -110,7 +110,7 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_END: case Common::KEYCODE_KP5: if (_vm->_gyro->_alive && _vm->_gyro->_dna._avvyIsAwake) { - _vm->_trip->handleMoveKey(event); // Fallthroughs are intended. + _vm->_animation->handleMoveKey(event); // Fallthroughs are intended. _vm->_lucerna->drawDirection(); return; } @@ -156,15 +156,15 @@ void Avalot::setup() { for (byte i = 0; i < 3; i++) _vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits. - _vm->_trip->loadtrip(); + _vm->_animation->loadtrip(); - _vm->_trip->get_back_loretta(); + _vm->_animation->get_back_loretta(); _vm->_gyro->_holdTheDawn = false; _vm->_lucerna->dawn(); _vm->_parser->_cursorState = false; _vm->_parser->cursorOn(); - _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; - _vm->_trip->newspeed(); + _vm->_animation->tr[0].xs = _vm->_gyro->kWalk; + _vm->_animation->newspeed(); @@ -201,9 +201,9 @@ void Avalot::run(Common::String arg) { _vm->_lucerna->_clock.update(); _vm->_dropdown->updateMenu(); _vm->_gyro->forceNumlock(); - _vm->_trip->get_back_loretta(); + _vm->_animation->get_back_loretta(); _vm->_celer->updateBackgroundSprites(); - _vm->_trip->trippancy_link(); + _vm->_animation->trippancy_link(); _vm->_lucerna->checkClick(); _vm->_timeout->one_tick(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index 8e1b13a22e..a261311f64 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -30,7 +30,7 @@ #include "avalanche/avalanche.h" #include "avalanche/celer2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/roomnums.h" @@ -367,7 +367,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { warning("STUB: Celer::show_one()"); for (byte i = 0; i < 2; i++) - _vm->_trip->getset[i].remember(_r); + _vm->_animation->getset[i].remember(_r); } diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index 9894769d41..3c26496ecd 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -33,7 +33,7 @@ #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/acci2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/enid2.h" #include "common/textconsole.h" @@ -245,7 +245,7 @@ void MenuBar::draw() { _menuItems[i].draw(); for (byte page = 0; page <= 1; page++) - _dr->_vm->_trip->getset[page].remember(menuspace); + _dr->_vm->_animation->getset[page].remember(menuspace); _dr->_vm->_gyro->_cp = savecp; } @@ -455,12 +455,12 @@ void Dropdown::setupMenuAction() { _activeMenuItem.setupOption(f5Does, f5Does[0], "f5", true); _activeMenuItem.setupOption("Pause game", 'P', "f6", true); if (_vm->_gyro->_dna._room == 99) - _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_trip->neardoor()); + _activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->neardoor()); else - _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_trip->neardoor()); + _activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->neardoor()); _activeMenuItem.setupOption("Look around", 'L', "f8", true); _activeMenuItem.setupOption("Inventory", 'I', "Tab", true); - if (_vm->_trip->tr[0].xs == _vm->_gyro->kWalk) + if (_vm->_animation->tr[0].xs == _vm->_gyro->kWalk) _activeMenuItem.setupOption("Run fast", 'R', "^R", true); else _activeMenuItem.setupOption("Walk slowly", 'W', "^W", true); @@ -630,11 +630,11 @@ void Dropdown::runMenuAction() { _vm->_lucerna->callVerb(_vm->_acci->kVerbCodeInv); break; case 5: { - if (_vm->_trip->tr[0].xs == _vm->_gyro->kWalk) - _vm->_trip->tr[0].xs = _vm->_gyro->kRun; + if (_vm->_animation->tr[0].xs == _vm->_gyro->kWalk) + _vm->_animation->tr[0].xs = _vm->_gyro->kRun; else - _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; - _vm->_trip->newspeed(); + _vm->_animation->tr[0].xs = _vm->_gyro->kWalk; + _vm->_animation->newspeed(); } break; } diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index d942177391..c3a195ecf4 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -32,7 +32,7 @@ #include "avalanche/enid2.h" #include "avalanche/scrolls2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/timeout2.h" #include "avalanche/celer2.h" #include "avalanche/sequence2.h" diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index fd36aded84..4ea4de776f 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -35,7 +35,7 @@ #include "avalanche/lucerna2.h" #include "avalanche/visa2.h" #include "avalanche/acci2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "common/file.h" #include "common/random.h" @@ -228,12 +228,12 @@ void Gyro::drawShadowBox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String void Gyro::newGame() { for (byte i = 0; i < kMaxSprites; i++) { - if (_vm->_trip->tr[i].quick) - _vm->_trip->tr[i].done(); + if (_vm->_animation->tr[i].quick) + _vm->_animation->tr[i].done(); } // Deallocate sprite. Sorry, beta testers! - _vm->_trip->tr[0].init(0, true, _vm->_trip); + _vm->_animation->tr[0].init(0, true, _vm->_animation); _alive = true; _score = 0; @@ -257,7 +257,7 @@ void Gyro::newGame() { _onToolbar = false; _seeScroll = false; - _vm->_trip->tr[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot. + _vm->_animation->tr[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot. //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; // fillchar(previous^,sizeof(previous^),#0); { blank out array } _him = 254; @@ -272,11 +272,11 @@ void Gyro::newGame() { for (byte i = 0; i <= 1; i++) { _cp = 1 - _cp; - _vm->_trip->getback(); + _vm->_animation->getback(); } _vm->_lucerna->enterRoom(1, 1); - _vm->_trip->new_game_for_trippancy(); + _vm->_animation->new_game_for_trippancy(); _vm->_lucerna->drawScore(); _vm->_dropdown->setupMenu(); _vm->_lucerna->_clock.update(); @@ -454,7 +454,7 @@ Common::String Gyro::f5Does() { return Common::String(_vm->_acci->kVerbCodeSit) + "SSit down"; break; case r__musicroom: - if (_vm->_trip->infield(7)) + if (_vm->_animation->infield(7)) return Common::String(_vm->_acci->kVerbCodePlay) + "PPlay the harp"; break; } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 0c2e01ae18..a034ace117 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -34,7 +34,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/enid2.h" #include "avalanche/celer2.h" #include "avalanche/pingo2.h" @@ -396,10 +396,10 @@ void Lucerna::enterNewTown() { void Lucerna::putGeidaAt(byte whichPed, byte &ped) { if (ped == 0) return; - _vm->_trip->tr[1].init(5, false, _vm->_trip); // load Geida - _vm->_trip->apped(2, whichPed); - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; + _vm->_animation->tr[1].init(5, false, _vm->_animation); // load Geida + _vm->_animation->apped(2, whichPed); + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procgeida_procs; } void Lucerna::enterRoom(byte room, byte ped) { @@ -441,25 +441,25 @@ void Lucerna::enterRoom(byte room, byte ped) { if (! _vm->_gyro->_dna._talkedToCrapulus) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__outsideyours; - _vm->_trip->tr[1].init(8, false, _vm->_trip); // load Crapulus + _vm->_animation->tr[1].init(8, false, _vm->_animation); // load Crapulus if (_vm->_gyro->_dna._roomCount[r__outsideyours] == 1) { - _vm->_trip->apped(2, 4); // Start on the right-hand side of the screen. - _vm->_trip->tr[1].walkto(5); // Walks up to greet you. + _vm->_animation->apped(2, 4); // Start on the right-hand side of the screen. + _vm->_animation->tr[1].walkto(5); // Walks up to greet you. } else { - _vm->_trip->apped(2, 5); // Starts where he was before. - _vm->_trip->tr[1].face = 3; + _vm->_animation->apped(2, 5); // Starts where he was before. + _vm->_animation->tr[1].face = Animation::kDirLeft; } - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; // He always faces Avvy. + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procface_avvy; // He always faces Avvy. } else _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__nowhere; if (_vm->_gyro->_dna._crapulusWillTell) { - _vm->_trip->tr[1].init(8, false, _vm->_trip); - _vm->_trip->apped(2, 2); - _vm->_trip->tr[1].walkto(4); + _vm->_animation->tr[1].init(8, false, _vm->_animation); + _vm->_animation->apped(2, 2); + _vm->_animation->tr[1].walkto(4); _vm->_timeout->set_up_timer(20, _vm->_timeout->proccrapulus_splud_out, _vm->_timeout->reason_crapulus_says_spludwick_out); _vm->_gyro->_dna._crapulusWillTell = false; } @@ -476,15 +476,15 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__spludwicks: if (_vm->_gyro->_dna._spludwickAtHome) { if (ped > 0) { - _vm->_trip->tr[1].init(2, false, _vm->_trip); // load Spludwick - _vm->_trip->apped(2, 2); + _vm->_animation->tr[1].init(2, false, _vm->_animation); // load Spludwick + _vm->_animation->apped(2, 2); _vm->_gyro->_whereIs[1] = r__spludwicks; } _vm->_gyro->_dna._dogFoodPos = 0; // _vm->_gyro->also Spludwick pos. - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procgeida_procs; + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procgeida_procs; } else _vm->_gyro->_whereIs[1] = r__nowhere; break; @@ -497,18 +497,18 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__nowhere; } else { if (ped > 0) { - _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procfollow_avvy_y; + _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procfollow_avvy_y; _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__brummieroad; if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here... - _vm->_trip->apped(2, 2); // He appears on the right of the screen... - _vm->_trip->tr[1].walkto(4); // ...and he walks up... + _vm->_animation->apped(2, 2); // He appears on the right of the screen... + _vm->_animation->tr[1].walkto(4); // ...and he walks up... } else { // You've been here before. - _vm->_trip->apped(2, 4); // He's standing in your way straight away... - _vm->_trip->tr[1].face = _vm->_trip->kDirLeft; + _vm->_animation->apped(2, 4); // He's standing in your way straight away... + _vm->_animation->tr[1].face = Animation::kDirLeft; } } } @@ -517,10 +517,10 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__argentroad: if ((_vm->_gyro->_dna._cwytalotGone) && (! _vm->_gyro->_dna._passedCwytalotInHerts) && (ped == 2) && (_vm->_gyro->_dna._roomCount[r__argentroad] > 3)) { - _vm->_trip->tr[1].init(4, false, _vm->_trip); // 4 = Cwytalot again - _vm->_trip->apped(2, 1); - _vm->_trip->tr[1].walkto(2); - _vm->_trip->tr[1].vanishifstill = true; + _vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot again + _vm->_animation->apped(2, 1); + _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[1].vanishifstill = true; _vm->_gyro->_dna._passedCwytalotInHerts = true; // _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in? _vm->_timeout->set_up_timer(20, _vm->_timeout->proc_cwytalot_in_herts, _vm->_timeout->reason_cwytalot_in_herts); @@ -541,9 +541,9 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) { if (! _vm->_gyro->_dna._beenTiedUp) { // A welcome party... or maybe not... - _vm->_trip->tr[1].init(6, false, _vm->_trip); - _vm->_trip->apped(2, 2); - _vm->_trip->tr[1].walkto(3); + _vm->_animation->tr[1].init(6, false, _vm->_animation); + _vm->_animation->apped(2, 2); + _vm->_animation->tr[1].walkto(3); _vm->_timeout->set_up_timer(36, _vm->_timeout->procget_tied_up, _vm->_timeout->reason_getting_tied_up); } } @@ -565,9 +565,9 @@ void Lucerna::enterRoom(byte room, byte ped) { if (ped > 0) switch (_vm->_gyro->_dna._cardiffQuestionNum) { case 0 : { // You've answered NONE of his questions. - _vm->_trip->tr[1].init(9, false, _vm->_trip); - _vm->_trip->apped(2, 2); - _vm->_trip->tr[1].walkto(3); + _vm->_animation->tr[1].init(9, false, _vm->_animation); + _vm->_animation->apped(2, 2); + _vm->_animation->tr[1].walkto(3); _vm->_timeout->set_up_timer(47, _vm->_timeout->proccardiffsurvey, _vm->_timeout->reason_cardiffsurvey); } break; @@ -575,9 +575,9 @@ void Lucerna::enterRoom(byte room, byte ped) { _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; break; // You've answered ALL his questions. => nothing happens. default: { // You've answered SOME of his questions. - _vm->_trip->tr[1].init(9, false, _vm->_trip); - _vm->_trip->apped(2, 3); - _vm->_trip->tr[1].face = _vm->_trip->kDirRight; + _vm->_animation->tr[1].init(9, false, _vm->_animation); + _vm->_animation->apped(2, 3); + _vm->_animation->tr[1].face = Animation::kDirRight; _vm->_timeout->set_up_timer(3, _vm->_timeout->proccardiff_return, _vm->_timeout->reason_cardiffsurvey); } } @@ -627,7 +627,7 @@ void Lucerna::enterRoom(byte room, byte ped) { } _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; - _vm->_trip->catamove(ped); + _vm->_animation->catamove(ped); _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; } break; @@ -645,7 +645,7 @@ void Lucerna::enterRoom(byte room, byte ped) { case r__lustiesroom: _vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos. - if (_vm->_trip->tr[0].whichsprite == 0) // Avvy in his normal clothes + if (_vm->_animation->tr[0].whichsprite == 0) // Avvy in his normal clothes _vm->_timeout->set_up_timer(3, _vm->_timeout->proccallsguards, _vm->_timeout->reason_du_lustie_talks); else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already // Presumably, Avvy dressed as a monk. @@ -703,22 +703,22 @@ void Lucerna::enterRoom(byte room, byte ped) { break; case r__wisewomans: - _vm->_trip->tr[1].init(11, false, _vm->_trip); + _vm->_animation->tr[1].init(11, false, _vm->_animation); if ((_vm->_gyro->_dna._roomCount[r__wisewomans] == 1) && (ped > 0)) { - _vm->_trip->apped(2, 2); // Start on the right-hand side of the screen. - _vm->_trip->tr[1].walkto(4); // Walks up to greet you. + _vm->_animation->apped(2, 2); // Start on the right-hand side of the screen. + _vm->_animation->tr[1].walkto(4); // Walks up to greet you. } else { - _vm->_trip->apped(2, 4); // Starts where she was before. - _vm->_trip->tr[1].face = 3; + _vm->_animation->apped(2, 4); // Starts where she was before. + _vm->_animation->tr[1].face = Animation::kDirLeft; } - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procface_avvy; // She always faces Avvy. + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procface_avvy; // She always faces Avvy. break; case r__insidecardiffcastle: if (ped > 0) { - _vm->_trip->tr[1].init(10, false, _vm->_trip); // Define the dart. + _vm->_animation->tr[1].init(10, false, _vm->_animation); // Define the dart. _vm->_celer->drawBackgroundSprite(-1, -1, 1); _vm->_graphics->refreshBackground(); _vm->_sequence->first_show(1); @@ -969,37 +969,32 @@ void Lucerna::useCompass(const Common::Point &cursorPos) { byte color = *(byte *)_vm->_graphics->_surface.getBasePtr(cursorPos.x, cursorPos.y / 2); switch (color) { - case kColorGreen: { - _vm->_gyro->_dna._direction = _vm->_trip->kDirUp; - _vm->_trip->rwsp(0, _vm->_trip->kDirUp); - drawDirection(); - } + case kColorGreen: + _vm->_gyro->_dna._direction = Animation::kDirUp; + _vm->_animation->rwsp(0, Animation::kDirUp); + drawDirection(); break; - case kColorBrown: { - _vm->_gyro->_dna._direction = _vm->_trip->kDirDown; - _vm->_trip->rwsp(0, _vm->_trip->kDirDown); - drawDirection(); - } + case kColorBrown: + _vm->_gyro->_dna._direction = Animation::kDirDown; + _vm->_animation->rwsp(0, Animation::kDirDown); + drawDirection(); break; - case kColorCyan: { - _vm->_gyro->_dna._direction = _vm->_trip->kDirLeft; - _vm->_trip->rwsp(0, _vm->_trip->kDirLeft); - drawDirection(); - } + case kColorCyan: + _vm->_gyro->_dna._direction = Animation::kDirLeft; + _vm->_animation->rwsp(0, Animation::kDirLeft); + drawDirection(); break; - case kColorLightmagenta: { - _vm->_gyro->_dna._direction = _vm->_trip->kDirRight; - _vm->_trip->rwsp(0, _vm->_trip->kDirRight); - drawDirection(); - } + case kColorLightmagenta: + _vm->_gyro->_dna._direction = Animation::kDirRight; + _vm->_animation->rwsp(0, Animation::kDirRight); + drawDirection(); break; case kColorRed: case kColorWhite: case kColorLightcyan: - case kColorYellow: { // Fall-throughs are intended. - _vm->_trip->stopwalking(); - drawDirection(); - } + case kColorYellow: // Fall-throughs are intended. + _vm->_animation->stopwalking(); + drawDirection(); break; } } @@ -1026,46 +1021,46 @@ void Lucerna::guideAvvy(Common::Point cursorPos) { cursorPos.y /= 2; byte what; - // _vm->_trip->tr[0] is Avalot.) - if (cursorPos.x < _vm->_trip->tr[0].x) + // _vm->_animation->tr[0] is Avalot.) + if (cursorPos.x < _vm->_animation->tr[0]._x) what = 1; - else if (cursorPos.x > (_vm->_trip->tr[0].x + _vm->_trip->tr[0]._info._xLength)) + else if (cursorPos.x > (_vm->_animation->tr[0]._x + _vm->_animation->tr[0]._info._xLength)) what = 2; else what = 0; // On top - if (cursorPos.y < _vm->_trip->tr[0].y) + if (cursorPos.y < _vm->_animation->tr[0]._y) what += 3; - else if (cursorPos.y > (_vm->_trip->tr[0].y + _vm->_trip->tr[0]._info._yLength)) + else if (cursorPos.y > (_vm->_animation->tr[0]._y + _vm->_animation->tr[0]._info._yLength)) what += 6; switch (what) { case 0: - _vm->_trip->stopwalking(); + _vm->_animation->stopwalking(); break; // Clicked on Avvy: no movement. case 1: - _vm->_trip->rwsp(0, _vm->_trip->kDirLeft); + _vm->_animation->rwsp(0, Animation::kDirLeft); break; case 2: - _vm->_trip->rwsp(0, _vm->_trip->kDirRight); + _vm->_animation->rwsp(0, Animation::kDirRight); break; case 3: - _vm->_trip->rwsp(0, _vm->_trip->kDirUp); + _vm->_animation->rwsp(0, Animation::kDirUp); break; case 4: - _vm->_trip->rwsp(0, _vm->_trip->kDirUpLeft); + _vm->_animation->rwsp(0, Animation::kDirUpLeft); break; case 5: - _vm->_trip->rwsp(0, _vm->_trip->kDirUpRight); + _vm->_animation->rwsp(0, Animation::kDirUpRight); break; case 6: - _vm->_trip->rwsp(0, _vm->_trip->kDirDown); + _vm->_animation->rwsp(0, Animation::kDirDown); break; case 7: - _vm->_trip->rwsp(0, _vm->_trip->kDirDownLeft); + _vm->_animation->rwsp(0, Animation::kDirDownLeft); break; case 8: - _vm->_trip->rwsp(0, _vm->_trip->kDirDownRight); + _vm->_animation->rwsp(0, Animation::kDirDownRight); break; } // No other values are possible. @@ -1130,11 +1125,11 @@ void Lucerna::checkClick() { callVerb(_vm->_acci->kVerbCodeScore); } else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed. - _vm->_trip->tr[0].xs = _vm->_gyro->kWalk; - _vm->_trip->newspeed(); + _vm->_animation->tr[0].xs = _vm->_gyro->kWalk; + _vm->_animation->newspeed(); } else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed. - _vm->_trip->tr[0].xs = _vm->_gyro->kRun; - _vm->_trip->newspeed(); + _vm->_animation->tr[0].xs = _vm->_gyro->kRun; + _vm->_animation->newspeed(); } else if ((396 <= cursorPos.x) && (cursorPos.x <= 483)) fxToggle(); else if ((535 <= cursorPos.x) && (cursorPos.x <= 640)) @@ -1186,13 +1181,13 @@ void Lucerna::drawDirection() { // It's data is loaded in load_digits(). void Lucerna::gameOver() { _vm->_gyro->_dna._userMovesAvvy = false; - int16 sx = _vm->_trip->tr[0].x; - int16 sy = _vm->_trip->tr[0].y; + int16 sx = _vm->_animation->tr[0]._x; + int16 sy = _vm->_animation->tr[0]._y; - _vm->_trip->tr[0].done(); - _vm->_trip->tr[0].init(12, true, _vm->_trip); // 12 = Avalot falls - _vm->_trip->tr[0].step = 0; - _vm->_trip->tr[0].appear(sx, sy, 0); + _vm->_animation->tr[0].done(); + _vm->_animation->tr[0].init(12, true, _vm->_animation); // 12 = Avalot falls + _vm->_animation->tr[0].step = 0; + _vm->_animation->tr[0].appear(sx, sy, 0); _vm->_timeout->set_up_timer(3, _vm->_timeout->procavalot_falls, _vm->_timeout->reason_falling_over); _vm->_gyro->_alive = false; @@ -1205,7 +1200,7 @@ void Lucerna::minorRedraw() { for (byte i = 0; i <= 1; i++) { _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; - _vm->_trip->getback(); + _vm->_animation->getback(); } for (byte i = 0; i < 3; i++) @@ -1224,22 +1219,22 @@ uint16 Lucerna::bearing(byte whichPed) { const double rad2deg = 180 / 3.14; // Pi - if (_vm->_trip->tr[0].x == _vm->_gyro->_peds[pedId]._x) + if (_vm->_animation->tr[0]._x == _vm->_gyro->_peds[pedId]._x) return 0; - else if (_vm->_trip->tr[0].x < _vm->_gyro->_peds[pedId]._x) { - return (uint16)((atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[pedId]._y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); + else if (_vm->_animation->tr[0]._x < _vm->_gyro->_peds[pedId]._x) { + return (uint16)((atan(double((_vm->_animation->tr[0]._y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_animation->tr[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); } else { - return (uint16)((atan(double((_vm->_trip->tr[0].y - _vm->_gyro->_peds[pedId]._y)) - / (_vm->_trip->tr[0].x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); + return (uint16)((atan(double((_vm->_animation->tr[0]._y - _vm->_gyro->_peds[pedId]._y)) + / (_vm->_animation->tr[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); } } void Lucerna::spriteRun() { _vm->_gyro->_doingSpriteRun = true; - _vm->_trip->get_back_loretta(); - _vm->_trip->trippancy_link(); + _vm->_animation->get_back_loretta(); + _vm->_animation->trippancy_link(); _vm->_gyro->_doingSpriteRun = false; } diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index 993e1cae2f..c46f8e21f1 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -16,7 +16,7 @@ MODULE_OBJS = \ celer2.o \ sequence2.o \ timeout2.o \ - trip6.o \ + animation.o \ acci2.o \ dropdown2.o \ closing2.o diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index fc505e4984..e20413b2f6 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -156,7 +156,7 @@ void Parser::drawCursor() { bf._y1 = 168; bf._y2 = 168; for (byte fv = 0; fv <= 1; fv++) - _vm->_trip->getset[fv].remember(bf); + _vm->_animation->getset[fv].remember(bf); } void Parser::wipeText() { diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index c61b6bbabd..e522254ab2 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -32,7 +32,7 @@ #include "avalanche/pingo2.h" #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/scrolls2.h" #include "common/textconsole.h" diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 56f605a9d4..c445a7e164 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -32,7 +32,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/gyro2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/acci2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" @@ -689,11 +689,11 @@ void Scrolls::calldrivers() { if (param == 0) natural(); else if ((1 <= param) && (param <= 9)) { - if ((param > _vm->_trip->kSpriteNumbMax) || (!_vm->_trip->tr[param - 1].quick)) { // Not valid. + if ((param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->tr[param - 1].quick)) { // Not valid. _vm->_lucerna->errorLed(); natural(); } else - _vm->_trip->tr[param - 1].chatter(); // Normal sprite talking routine. + _vm->_animation->tr[param - 1].chatter(); // Normal sprite talking routine. } else if ((10 <= param) && (param <= 36)) { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 4e51cf91a7..8e64dbc7bd 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -33,7 +33,7 @@ #include "avalanche/gyro2.h" #include "avalanche/timeout2.h" #include "avalanche/celer2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "common/scummsys.h" @@ -76,7 +76,7 @@ void Sequence::start_to_close() { void Sequence::start_to_open() { _vm->_gyro->_dna._userMovesAvvy = false; // They can't move. - _vm->_trip->stopwalking(); // And they're not moving now. + _vm->_animation->stopwalking(); // And they're not moving now. start_to_close(); // Apart from that, it's the same thing. } @@ -94,7 +94,7 @@ void Sequence::call_sequencer() { break; case 177: // Flip room. _vm->_gyro->_dna._userMovesAvvy = true; - _vm->_trip->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); + _vm->_animation->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed); if (seq[0] == 177) shove_left(); break; diff --git a/engines/avalanche/timeout2.cpp b/engines/avalanche/timeout2.cpp index bc5a534eb7..38f276b042 100644 --- a/engines/avalanche/timeout2.cpp +++ b/engines/avalanche/timeout2.cpp @@ -32,7 +32,7 @@ #include "avalanche/timeout2.h" #include "avalanche/visa2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "avalanche/scrolls2.h" #include "avalanche/acci2.h" #include "avalanche/sequence2.h" @@ -243,8 +243,8 @@ void Timeout::avaricius_talks() { } void Timeout::urinate() { - _vm->_trip->tr[0].turn(_vm->_trip->kDirUp); - _vm->_trip->stopwalking(); + _vm->_animation->tr[0].turn(Animation::kDirUp); + _vm->_animation->stopwalking(); _vm->_lucerna->drawDirection(); set_up_timer(14, proctoilet2, reason_gototoilet); } @@ -264,7 +264,7 @@ void Timeout::bang2() { void Timeout::stairs() { _vm->_gyro->blip(); - _vm->_trip->tr[0].walkto(4); + _vm->_animation->tr[0].walkto(4); _vm->_celer->drawBackgroundSprite(-1, -1, 2); _vm->_gyro->_dna._brummieStairs = 2; _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicSpecial; @@ -298,39 +298,39 @@ void Timeout::get_tied_up() { _vm->_visa->dixi('q', 34); // ...Trouble! _vm->_gyro->_dna._userMovesAvvy = false; _vm->_gyro->_dna._beenTiedUp = true; - _vm->_trip->stopwalking(); - _vm->_trip->tr[1].stopwalk(); - _vm->_trip->tr[1].stophoming(); - _vm->_trip->tr[1].call_eachstep = true; - _vm->_trip->tr[1].eachstep = _vm->_trip->procgrab_avvy; + _vm->_animation->stopwalking(); + _vm->_animation->tr[1].stopwalk(); + _vm->_animation->tr[1].stophoming(); + _vm->_animation->tr[1].call_eachstep = true; + _vm->_animation->tr[1].eachstep = _vm->_animation->procgrab_avvy; set_up_timer(70, procget_tied_up2, reason_getting_tied_up); } void Timeout::get_tied_up2() { - _vm->_trip->tr[0].walkto(4); - _vm->_trip->tr[1].walkto(5); + _vm->_animation->tr[0].walkto(4); + _vm->_animation->tr[1].walkto(5); _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries. _vm->_gyro->_dna._friarWillTieYouUp = true; } void Timeout::hang_around() { - _vm->_trip->tr[1].check_me = false; - _vm->_trip->tr[0].init(7, true, _vm->_trip); // Robin Hood + _vm->_animation->tr[1].check_me = false; + _vm->_animation->tr[0].init(7, true, _vm->_animation); // Robin Hood _vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins; - _vm->_trip->apped(1, 2); + _vm->_animation->apped(1, 2); _vm->_visa->dixi('q', 39); - _vm->_trip->tr[0].walkto(7); + _vm->_animation->tr[0].walkto(7); set_up_timer(55, prochang_around2, reason_hanging_around); } void Timeout::hang_around2() { _vm->_visa->dixi('q', 40); - _vm->_trip->tr[1].vanishifstill = false; - _vm->_trip->tr[1].walkto(4); + _vm->_animation->tr[1].vanishifstill = false; + _vm->_animation->tr[1].walkto(4); _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins; _vm->_visa->dixi('q', 41); - _vm->_trip->tr[0].done(); - _vm->_trip->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. + _vm->_animation->tr[0].done(); + _vm->_animation->tr[1].done(); // Get rid of Robin Hood and Friar Tuck. set_up_timer(1, procafter_the_shootemup, reason_hanging_around); // Immediately call the following proc (when you have a chance). @@ -342,11 +342,11 @@ void Timeout::hang_around2() { void Timeout::after_the_shootemup() { - _vm->_trip->fliproom(_vm->_gyro->_dna._room, 0); + _vm->_animation->fliproom(_vm->_gyro->_dna._room, 0); // Only placed this here to replace the minigame. TODO: Remove it when the shoot em' up is implemented! - _vm->_trip->tr[0].init(0, true, _vm->_trip); // Avalot. - _vm->_trip->apped(1, 2); + _vm->_animation->tr[0].init(0, true, _vm->_animation); // Avalot. + _vm->_animation->apped(1, 2); _vm->_gyro->_dna._userMovesAvvy = true; _vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = true; _vm->_lucerna->refreshObjectList(); @@ -415,9 +415,9 @@ void Timeout::jacques_wakes_up() { } void Timeout::naughty_duke() { // This is when the Duke comes in and takes your money. - _vm->_trip->tr[1].init(9, false, _vm->_trip); // Here comes the Duke. - _vm->_trip->apped(2, 1); // He starts at the door... - _vm->_trip->tr[1].walkto(3); // He walks over to you. + _vm->_animation->tr[1].init(9, false, _vm->_animation); // Here comes the Duke. + _vm->_animation->apped(2, 1); // He starts at the door... + _vm->_animation->tr[1].walkto(3); // He walks over to you. // Let's get the door opening. _vm->_celer->drawBackgroundSprite(-1, -1, 1); @@ -429,8 +429,8 @@ void Timeout::naughty_duke() { // This is when the Duke comes in and takes your void Timeout::naughty_duke2() { _vm->_visa->dixi('q', 48); // "Ha ha, it worked again!" - _vm->_trip->tr[1].walkto(1); // Walk to the door. - _vm->_trip->tr[1].vanishifstill = true; // Then go away! + _vm->_animation->tr[1].walkto(1); // Walk to the door. + _vm->_animation->tr[1].vanishifstill = true; // Then go away! set_up_timer(32, procnaughty_duke3, reason_naughty_duke); } @@ -450,7 +450,7 @@ void Timeout::jump() { case 5: case 7: case 9: - _vm->_trip->tr[0].y--; + _vm->_animation->tr[0]._y--; break; case 12: case 13: @@ -458,7 +458,7 @@ void Timeout::jump() { case 16: case 18: case 19: - _vm->_trip->tr[0].y++; + _vm->_animation->tr[0]._y++; break; } @@ -472,7 +472,7 @@ void Timeout::jump() { if ((_vm->_gyro->_dna._jumpStatus == 10) // You're at the highest point of your jump. && (_vm->_gyro->_dna._room == r__insidecardiffcastle) && (_vm->_gyro->_dna._arrowInTheDoor == true) - && (_vm->_trip->infield(3))) { // Beside the wall + && (_vm->_animation->infield(3))) { // Beside the wall // Grab the arrow! if (_vm->_gyro->_dna._carryNum >= kCarryLimit) _vm->_scrolls->display("You fail to grab it, because your hands are full."); @@ -530,8 +530,8 @@ void Timeout::greetsmonk() { void Timeout::fall_down_oubliette() { _vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing; - _vm->_trip->tr[0].iy++; // Increments dx/dy! - _vm->_trip->tr[0].y += _vm->_trip->tr[0].iy; // Dowwwn we go... + _vm->_animation->tr[0].iy++; // Increments dx/dy! + _vm->_animation->tr[0]._y += _vm->_animation->tr[0].iy; // Dowwwn we go... set_up_timer(3, procfall_down_oubliette, reason_falling_down_oubliette); } @@ -545,62 +545,62 @@ void Timeout::meet_avaroid() { _vm->_gyro->_dna._metAvaroid = true; set_up_timer(1, procrise_up_oubliette, reason_rising_up_oubliette); - _vm->_trip->tr[0].face = _vm->_trip->kDirLeft; - _vm->_trip->tr[0].x = 151; - _vm->_trip->tr[0].ix = -3; - _vm->_trip->tr[0].iy = -5; + _vm->_animation->tr[0].face = Animation::kDirLeft; + _vm->_animation->tr[0]._x = 151; + _vm->_animation->tr[0].ix = -3; + _vm->_animation->tr[0].iy = -5; _vm->_gyro->setBackgroundColor(2); } } void Timeout::rise_up_oubliette() { - _vm->_trip->tr[0].visible = true; - _vm->_trip->tr[0].iy++; // Decrements dx/dy! - _vm->_trip->tr[0].y -= _vm->_trip->tr[0].iy; // Uuuupppp we go... - if (_vm->_trip->tr[0].iy > 0) + _vm->_animation->tr[0]._visible = true; + _vm->_animation->tr[0].iy++; // Decrements dx/dy! + _vm->_animation->tr[0]._y -= _vm->_animation->tr[0].iy; // Uuuupppp we go... + if (_vm->_animation->tr[0].iy > 0) set_up_timer(3, procrise_up_oubliette, reason_rising_up_oubliette); else _vm->_gyro->_dna._userMovesAvvy = true; } void Timeout::robin_hood_and_geida() { - _vm->_trip->tr[0].init(7, true, _vm->_trip); - _vm->_trip->apped(1, 7); - _vm->_trip->tr[0].walkto(6); - _vm->_trip->tr[1].stopwalk(); - _vm->_trip->tr[1].face = _vm->_trip->kDirLeft; + _vm->_animation->tr[0].init(7, true, _vm->_animation); + _vm->_animation->apped(1, 7); + _vm->_animation->tr[0].walkto(6); + _vm->_animation->tr[1].stopwalk(); + _vm->_animation->tr[1].face = Animation::kDirLeft; set_up_timer(20, procrobin_hood_and_geida_talk, reason_robin_hood_and_geida); _vm->_gyro->_dna._geidaFollows = false; } void Timeout::robin_hood_and_geida_talk() { _vm->_visa->dixi('q', 66); - _vm->_trip->tr[0].walkto(2); - _vm->_trip->tr[1].walkto(2); - _vm->_trip->tr[0].vanishifstill = true; - _vm->_trip->tr[1].vanishifstill = true; + _vm->_animation->tr[0].walkto(2); + _vm->_animation->tr[1].walkto(2); + _vm->_animation->tr[0].vanishifstill = true; + _vm->_animation->tr[1].vanishifstill = true; set_up_timer(162, procavalot_returns, reason_robin_hood_and_geida); } void Timeout::avalot_returns() { - _vm->_trip->tr[0].done(); - _vm->_trip->tr[1].done(); - _vm->_trip->tr[0].init(0, true, _vm->_trip); - _vm->_trip->apped(1, 1); + _vm->_animation->tr[0].done(); + _vm->_animation->tr[1].done(); + _vm->_animation->tr[0].init(0, true, _vm->_animation); + _vm->_animation->apped(1, 1); _vm->_visa->dixi('q', 67); _vm->_gyro->_dna._userMovesAvvy = true; } void Timeout::avvy_sit_down() { // This is used when you sit down in the pub in Notts. It loops around so that it will happen when Avvy stops walking. - if (_vm->_trip->tr[0].homing) // Still walking. + if (_vm->_animation->tr[0].homing) // Still walking. set_up_timer(1, procavvy_sit_down, reason_sitting_down); else { _vm->_celer->drawBackgroundSprite(-1, -1, 3); _vm->_gyro->_dna._sittingInPub = true; _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_trip->tr[0].visible = false; + _vm->_animation->tr[0]._visible = false; } } @@ -636,8 +636,8 @@ void Timeout::winning() { } void Timeout::avalot_falls() { - if (_vm->_trip->tr[0].step < 5) { - _vm->_trip->tr[0].step++; + if (_vm->_animation->tr[0].step < 5) { + _vm->_animation->tr[0].step++; set_up_timer(3, procavalot_falls, reason_falling_over); } else { Common::String toDisplay; @@ -651,14 +651,14 @@ void Timeout::avalot_falls() { } void Timeout::spludwick_goes_to_cauldron() { - if (_vm->_trip->tr[1].homing) + if (_vm->_animation->tr[1].homing) set_up_timer(1, procspludwick_goes_to_cauldron, reason_spludwalk); else set_up_timer(17, procspludwick_leaves_cauldron, reason_spludwalk); } void Timeout::spludwick_leaves_cauldron() { - _vm->_trip->tr[1].call_eachstep = true; // So that normal procs will continue. + _vm->_animation->tr[1].call_eachstep = true; // So that normal procs will continue. } void Timeout::give_lute_to_geida() { // Moved here from Acci. diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp deleted file mode 100644 index b94697f385..0000000000 --- a/engines/avalanche/trip6.cpp +++ /dev/null @@ -1,1634 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* TRIP5 Trippancy V - the sprite animation subsystem */ - -#include "avalanche/avalanche.h" - -#include "avalanche/trip6.h" -#include "avalanche/scrolls2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/visa2.h" -#include "avalanche/gyro2.h" -#include "avalanche/celer2.h" -#include "avalanche/sequence2.h" -#include "avalanche/timeout2.h" -#include "avalanche/enid2.h" - -#include "common/scummsys.h" -#include "common/textconsole.h" -#include "common/file.h" - -namespace Avalanche { - -void triptype::init(byte spritenum, bool do_check, Trip *tr) { - _tr = tr; - - const int32 idshould = -1317732048; - byte fv; - int32 id; - Common::File inf; - - if (spritenum == 177) - return; // Already running! - - Common::String filename; - filename = filename.format("sprite%d.avd", spritenum); - if (!inf.open(filename)) { - warning("AVALANCHE: Trip: File not found: %s", filename.c_str()); - return; - } - - inf.seek(177); - - id = inf.readSint32LE(); - if (id != idshould) { - //output << '\7'; - inf.close(); - return; - } - - inf.skip(2); // Replace variable named 'soa' in the original code. - - if (!a.name.empty()) - a.name.clear(); - byte nameSize = inf.readByte(); - for (byte i = 0; i < nameSize; i++) - a.name += inf.readByte(); - inf.skip(12 - nameSize); - - //inf.skip(1); // Same as above. - byte commentSize = inf.readByte(); - for (byte i = 0; i < commentSize; i++) - a.comment += inf.readByte(); - inf.skip(16 - commentSize); - - a.num = inf.readByte(); - _info._xLength = inf.readByte(); - _info._yLength = inf.readByte(); - a.seq = inf.readByte(); - _info._size = inf.readUint16LE(); - a.fgc = inf.readByte(); - a.bgc = inf.readByte(); - a.accinum = inf.readByte(); - - totalnum = 0; // = 1; - _info._xWidth = _info._xLength / 8; - if ((_info._xLength % 8) > 0) - _info._xWidth++; - for (byte aa = 0; aa < /*nds*seq*/a.num; aa++) { - - _info._sil[totalnum] = new SilType[11 * (_info._yLength + 1)]; - //getmem(sil[totalnum-1], 11 * (a.yl + 1)); - _info._mani[totalnum] = new ManiType[_info._size - 6]; - //getmem(mani[totalnum-1], a.size - 6); - for (fv = 0; fv <= _info._yLength; fv++) - inf.read((*_info._sil[totalnum])[fv], _info._xWidth); - //blockread(inf, (*sil[totalnum-1])[fv], xw); - inf.read(*_info._mani[totalnum], _info._size - 6); - //blockread(inf, *mani[totalnum-1], a.size - 6); - - totalnum++; - } - totalnum++; - - // on; - x = 0; - y = 0; - quick = true; - visible = false; - xs = 3; - ys = 1; - if (spritenum == 1) - _tr->newspeed(); // Just for the lights. - - homing = false; - ix = 0; - iy = 0; - step = 0; - check_me = do_check; - count = 0; - whichsprite = spritenum; - vanishifstill = false; - call_eachstep = false; - - inf.close(); -} - -void triptype::original() { - quick = false; - whichsprite = 177; -} - -void triptype::andexor() { - if ((vanishifstill) && (ix == 0) && (iy == 0)) - return; - byte picnum = face * a.seq + step; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). - - _tr->_vm->_graphics->drawSprite(_info, picnum, x, y); -} - -void triptype::turn(byte whichway) { - if (whichway == 8) - face = 0; - else - face = whichway; -} - -void triptype::appear(int16 wx, int16 wy, byte wf) { - x = (wx / 8) * 8; - y = wy; - ox[_tr->_vm->_gyro->_cp] = wx; - oy[_tr->_vm->_gyro->_cp] = wy; - turn(wf); - visible = true; - ix = 0; - iy = 0; -} - -bool triptype::collision_check() { - for (byte fv = 0; fv < _tr->kSpriteNumbMax; fv++) - if (_tr->tr[fv].quick && (_tr->tr[fv].whichsprite != whichsprite) && - ((x + _info._xLength) > _tr->tr[fv].x) && - (x < (_tr->tr[fv].x + _tr->tr[fv]._info._xLength)) && - (_tr->tr[fv].y == y)) - return true; - - return false; -} - -void triptype::walk() { - byte tc; - ByteField r; - - - if (visible) { - r._x1 = (x / 8) - 1; - if (r._x1 == 255) - r._x1 = 0; - r._y1 = y - 2; - r._x2 = ((x + _info._xLength) / 8) + 1; - r._y2 = y + _info._yLength + 2; - - _tr->getset[1 - _tr->_vm->_gyro->_cp].remember(r); - } - - if (!_tr->_vm->_gyro->_doingSpriteRun) { - ox[_tr->_vm->_gyro->_cp] = x; - oy[_tr->_vm->_gyro->_cp] = y; - if (homing) - homestep(); - x = x + ix; - y = y + iy; - } - - if (check_me) { - if (collision_check()) { - bounce(); - return; - } - - tc = _tr->checkfeet(x, x + _info._xLength, oy[_tr->_vm->_gyro->_cp], y, _info._yLength) - 1; - // -1 is because the modified array indexes of magics[] compared to Pascal . - - if ((tc != 255) & (!_tr->_vm->_gyro->_doingSpriteRun)) { - switch (_tr->_vm->_gyro->_magics[tc]._operation) { - case Gyro::kMagicExclaim: { - bounce(); - _tr->mustexclaim = true; - _tr->saywhat = _tr->_vm->_gyro->_magics[tc]._data; - } - break; - case Gyro::kMagicBounce: - bounce(); - break; - case Gyro::kMagicTransport: - _tr->fliproom(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff); - break; - case Gyro::kMagicUnfinished: { - bounce(); - _tr->_vm->_scrolls->display("\7Sorry.\3\rThis place is not available yet!"); - } - break; - case Gyro::kMagicSpecial: - _tr->call_special(_tr->_vm->_gyro->_magics[tc]._data); - break; - case Gyro::kMagicOpenDoor: - _tr->open_the_door(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff, tc); - break; - } - } - } - - if (!_tr->_vm->_gyro->_doingSpriteRun) { - count++; - if (((ix != 0) || (iy != 0)) && (count > 1)) { - step++; - if (step == a.seq) - step = 0; - count = 0; - } - } -} - -void triptype::bounce() { - x = ox[_tr->_vm->_gyro->_cp]; - y = oy[_tr->_vm->_gyro->_cp]; - if (check_me) - _tr->stopwalking(); - else - stopwalk(); - _tr->_vm->_gyro->_onCanDoPageSwap = false; - _tr->_vm->_lucerna->drawDirection(); - _tr->_vm->_gyro->_onCanDoPageSwap = true; -} - -int8 triptype::sgn(int16 val) { - if (val > 0) - return 1; - else if (val < 0) - return -1; - else - return 0; -} - -void triptype::walkto(byte pednum) { - pednum--; // Pascal -> C conversion: different array indexes. - speed(sgn(_tr->_vm->_gyro->_peds[pednum]._x - x) * 4, sgn(_tr->_vm->_gyro->_peds[pednum]._y - y)); - hx = _tr->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; - hy = _tr->_vm->_gyro->_peds[pednum]._y - _info._yLength; - homing = true; -} - -void triptype::stophoming() { - homing = false; -} - -void triptype::homestep() { - int16 temp; - - if ((hx == x) && (hy == y)) { - // touching the target - stopwalk(); - return; - } - ix = 0; - iy = 0; - if (hy != y) { - temp = hy - y; - if (temp > 4) - iy = 4; - else if (temp < -4) - iy = -4; - else - iy = temp; - } - if (hx != x) { - temp = hx - x; - if (temp > 4) - ix = 4; - else if (temp < -4) - ix = -4; - else - ix = temp; - } -} - -void triptype::speed(int8 xx, int8 yy) { - ix = xx; - iy = yy; - if ((ix == 0) && (iy == 0)) - return; // no movement - if (ix == 0) { - // No horz movement - if (iy < 0) - turn(_tr->kDirUp); - else - turn(_tr->kDirDown); - } else { - if (ix < 0) - turn(_tr->kDirLeft); - else - turn(_tr->kDirRight); - } -} - -void triptype::stopwalk() { - ix = 0; - iy = 0; - homing = false; -} - -void triptype::chatter() { - _tr->_vm->_gyro->_talkX = x + _info._xLength / 2; - _tr->_vm->_gyro->_talkY = y; - _tr->_vm->_gyro->_talkFontColor = a.fgc; - _tr->_vm->_gyro->_talkBackgroundColor = a.bgc; -} - -void triptype::set_up_saver(trip_saver_type &v) { - v.whichsprite = whichsprite; - v.face = face; - v.step = step; - v.x = x; - v.y = y; - v.ix = ix; - v.iy = iy; - v.visible = visible; - v.homing = homing; - v.check_me = check_me; - v.count = count; - v.xw = _info._xWidth; - v.xs = xs; - v.ys = ys; - v.totalnum = totalnum; - v.hx = hx; - v.hy = hy; - v.call_eachstep = call_eachstep; - v.eachstep = eachstep; - v.vanishifstill = vanishifstill; -} - -void triptype::unload_saver(trip_saver_type v) { - whichsprite = v.whichsprite; - face = v.face; - step = v.step; - x = v.x; - y = v.y; - ix = v.ix; - iy = v.iy; - visible = v.visible; - homing = v.homing; - check_me = v.check_me; - count = v.count; - _info._xWidth = v.xw; - xs = v.xs; - ys = v.ys; - totalnum = v.totalnum; - hx = v.hx; - hy = v.hy; - call_eachstep = v.call_eachstep; - eachstep = v.eachstep; - vanishifstill = v.vanishifstill; -} - -void triptype::savedata(Common::File &f) { - warning("STUB: triptype::savedata()"); -} - -void triptype::loaddata(Common::File &f) { - warning("STUB: triptype::loaddata()"); -} - -void triptype::save_data_to_mem(uint16 &where) { - warning("STUB: triptype::save_data_to_mem()"); -} - -void triptype::load_data_from_mem(uint16 &where) { - warning("STUB: triptype::load_data_from_mem()"); -} - -triptype *triptype::done() { - Common::String xx; - - // nds:=num div seq; - totalnum--; - _info._xWidth = _info._xLength / 8; - if ((_info._xLength % 8) > 0) - _info._xWidth++; - for (byte aa = 0; aa < /*nds*seq*/ a.num; aa++) { - totalnum--; - delete[] _info._mani[totalnum]; - delete[] _info._sil[totalnum]; - } - - quick = false; - whichsprite = 177; - return this; -} - -getsettype *getsettype::init() { - numleft = 0; // initialize array pointer - return this; -} - -void getsettype::remember(ByteField r) { - numleft++; - //if (numleft > maxgetset) - // error("Trip::remember() : runerr_Getset_Overflow"); - gs[numleft] = r; -} - -void getsettype::recall(ByteField &r) { - r = gs[numleft]; - numleft--; -} - - - - - - -Trip::Trip(AvalancheEngine *vm) { - _vm = vm; - - getsetclear(); - mustexclaim = false; -} - -Trip::~Trip() { - for (byte i = 0; i < kSpriteNumbMax; i++) { - if (tr[i].quick) - tr[i].done(); - } -} - -void Trip::loadtrip() { - for (int16 gm = 0; gm < kSpriteNumbMax; gm++) - tr[gm].original(); - - for (uint16 i = 0; i < sizeof(aa); i++) - aa[i] = 0; -} - -byte Trip::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) { - byte a, c; - int16 fv, ff; - - // if not alive then begin checkfeet:=0; exit; end; - a = 0; - - //setactivepage(2); - if (x1 < 0) - x1 = 0; - if (x2 > 639) - x2 = 639; - if (oy < y) { - for (fv = x1; fv <= x2; fv++) { - for (ff = oy + yl; ff <= y + yl; ff++) { - c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); - if (c > a) - a = c; - } - } - } else { - for (fv = x1; fv <= x2; fv++) { - for (ff = y + yl; ff <= oy + yl; ff++) { - c = *(byte *)_vm->_graphics->_magics.getBasePtr(fv, ff); - if (c > a) - a = c; - } - } - } - - //setactivepage(1 - cp); - return a; -} - -byte Trip::geida_ped(byte which) { - switch (which) { - case 1: - return 7; - case 2: - case 6: - return 8; - case 3: - case 5: - return 9; - case 4: - return 10; - default: - return 0; - } -} - -void Trip::catamove(byte ped) { -/* When you enter a new position in the catacombs, this procedure should - be called. It changes the Also codes so that they may match the picture - on the screen. (Coming soon: It draws up the screen, too.) */ - - int32 here; - uint16 xy_uint16; - byte fv; - - // XY_uint16 is cat_x+cat_y*256. Thus, every room in the - // catacombs has a different number for it. - - - - xy_uint16 = _vm->_gyro->_dna._catacombX + _vm->_gyro->_dna._catacombY * 256; - _vm->_gyro->_dna._geidaSpin = 0; - - switch (xy_uint16) { - case 1801: // Exit catacombs - fliproom(r__lustiesroom, 4); - _vm->_scrolls->display("Phew! Nice to be out of there!"); - return; - case 1033: // Oubliette - fliproom(r__oubliette, 1); - _vm->_scrolls->display(Common::String("Oh, NO!") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble); - return; - case 4: - fliproom(r__geidas, 1); - return; - case 2307: - fliproom(r__lusties, 5); - _vm->_scrolls->display("Oh no... here we go again..."); - _vm->_gyro->_dna._userMovesAvvy = false; - tr[0].iy = 1; - tr[0].ix = 0; - return; - } - - if (!_vm->_gyro->_dna._enterCatacombsFromLustiesRoom) - _vm->_lucerna->loadRoom(29); - here = _vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1]; - - switch (here & 0xf) { // West. - case 0: // no connection (wall) - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); - break; - case 0x1: // no connection (wall + shield), - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. - break; - case 0x2: // wall with door - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door. - break; - case 0x3: // wall with door and shield - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 29); // ...shield. - break; - case 0x4: // no connection (wall + window), - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. - break; - case 0x5: // wall with door and window - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 5); // ...window. - break; - case 0x6: // no connection (wall + torches), - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicNothing; // No door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. - break; - case 0x7: // wall with door and torches - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[4]._operation = _vm->_gyro->kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 28); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 30); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 7); // ...torches. - break; - case 0xf: // straight-through corridor. - _vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing; // Sloping wall. - _vm->_gyro->_magics[2]._operation = _vm->_gyro->kMagicSpecial; // Straight wall. - break; - } - - /* ---- */ - - switch ((here & 0xf0) >> 4) { // East - case 0: // no connection (wall) - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); - break; - case 0x1: // no connection (wall + window), - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...window. - break; - case 0x2: // wall with door - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door. - break; - case 0x3: // wall with door and window - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 20); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...window. - break; - case 0x6: // no connection (wall + torches), - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // No door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. - break; - case 0x7: // wall with door and torches - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicNothing; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicSpecial; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 19); // Wall, plus... - _vm->_celer->drawBackgroundSprite(-1, -1, 21); // ...door, and... - _vm->_celer->drawBackgroundSprite(-1, -1, 18); // ...torches. - break; - case 0xf: // straight-through corridor. - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicNothing; // Sloping wall. - _vm->_gyro->_magics[5]._operation = _vm->_gyro->kMagicSpecial; // Straight wall. - _vm->_gyro->_portals[6]._operation = _vm->_gyro->kMagicNothing; // Door. - break; - } - - /* ---- */ - - switch ((here & 0xf00) >> 8) { // South - case 0: // No connection. - _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; - break; - case 0x1: - _vm->_celer->drawBackgroundSprite(-1, -1, 22); - - if ((xy_uint16 == 2051) && (_vm->_gyro->_dna._geidaFollows)) - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicExclaim; - else - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicSpecial; // Right exit south. - - _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; - break; - case 0x2: - _vm->_celer->drawBackgroundSprite(-1, -1, 23); - _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicSpecial; // Middle exit south. - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; - break; - case 0x3: - _vm->_celer->drawBackgroundSprite(-1, -1, 24); - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicSpecial; // Left exit south. - _vm->_gyro->_magics[6]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_magics[12]._operation = _vm->_gyro->kMagicBounce; - break; - } - - switch ((here & 0xf000) >> 12) { // North - case 0: // No connection - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. - break; - // LEFT handles: -#if 0 - case 0x1: - _vm->_celer->show_one(-1, -1, 4); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } - _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } - break; -#endif - case 0x2: - _vm->_celer->drawBackgroundSprite(-1, -1, 4); - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; // Middle exit north. - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. - break; -#if 0 - case 0x3: - _vm->_celer->show_one(-1, -1, 4); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } { Change magic number! } - _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } - break; - // RIGHT handles: - case 0x4: - _vm->_celer->show_one(-1, -1, 3); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Left exit north. } { Change magic number! } - _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } - break; -#endif - case 0x5: - _vm->_celer->drawBackgroundSprite(-1, -1, 3); - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; // Middle exit north. - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. - break; -#if 0 - case 0x6: - _vm->_celer->show_one(-1, -1, 3); - _vm->_gyro->magics[1].op = _vm->_gyro->bounces; // { Right exit north. } - _vm->_gyro->portals[12].op = _vm->_gyro->special; // { Door. } - break; -#endif - // ARCHWAYS: - case 0x7: - case 0x8: - case 0x9: { - _vm->_celer->drawBackgroundSprite(-1, -1, 6); - - if (((here & 0xf000) >> 12) > 0x7) - _vm->_celer->drawBackgroundSprite(-1, -1, 31); - if (((here & 0xf000) >> 12) == 0x9) - _vm->_celer->drawBackgroundSprite(-1, -1, 32); - - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicSpecial; // Middle arch north. - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. - } - break; - // DECORATIONS: - case 0xd: // No connection + WINDOW - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 14); - break; - case 0xe: // No connection + TORCH - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicBounce; - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicNothing; // Door. - _vm->_celer->drawBackgroundSprite(-1, -1, 8); - break; - // Recessed door: - case 0xf: - _vm->_gyro->_magics[0]._operation = _vm->_gyro->kMagicNothing; // Door to Geida's room. - _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->_portals[3]._operation = _vm->_gyro->kMagicSpecial; // Door. - break; - } - - switch (xy_uint16) { - case 514: - _vm->_celer->drawBackgroundSprite(-1, -1, 17); - break; // [2,2] : "Art Gallery" sign over door. - case 264: - _vm->_celer->drawBackgroundSprite(-1, -1, 9); - break; // [8,1] : "The Wrong Way!" sign. - case 1797: - _vm->_celer->drawBackgroundSprite(-1, -1, 2); - break; // [5,7] : "Ite Mingite" sign. - case 258: - for (fv = 0; fv <= 2; fv++) { // [2,1] : Art gallery - pictures - _vm->_celer->drawBackgroundSprite(130 + fv * 120, 70, 15); - _vm->_celer->drawBackgroundSprite(184 + fv * 120, 78, 16); - } - break; - case 1287: - for (fv = 10; fv <= 13; fv++) - _vm->_celer->drawBackgroundSprite(-1, -1, fv); - break; // [7,5] : 4 candles. - case 776: - _vm->_celer->drawBackgroundSprite(-1, -1, 10); - break; // [8,3] : 1 candle. - case 2049: - _vm->_celer->drawBackgroundSprite(-1, -1, 11); - break; // [1,8] : another candle. - case 257: - _vm->_celer->drawBackgroundSprite(-1, -1, 12); - _vm->_celer->drawBackgroundSprite(-1, -1, 13); - break; // [1,1] : the other two. - } - - if ((_vm->_gyro->_dna._geidaFollows) && (ped > 0)) { - if (!tr[1].quick) // If we don't already have her... - tr[1].init(5, true, this); // ...Load Geida. - apped(2, geida_ped(ped)); - tr[1].call_eachstep = true; - tr[1].eachstep = procgeida_procs; - } -} - - - -// This proc gets called whenever you touch a line defined as _vm->_gyro->special. -void Trip::dawndelay() { - _vm->_timeout->set_up_timer(2, _vm->_timeout->procdawn_delay, _vm->_timeout->reason_dawndelay); -} - -void Trip::call_special(uint16 which) { - switch (which) { - case 1: // _vm->_gyro->special 1: Room 22: top of stairs. - _vm->_celer->drawBackgroundSprite(-1, -1, 1); - _vm->_gyro->_dna._brummieStairs = 1; - _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; - _vm->_timeout->set_up_timer(10, _vm->_timeout->procstairs, _vm->_timeout->reason_brummiestairs); - stopwalking(); - _vm->_gyro->_dna._userMovesAvvy = false; - break; - case 2: // _vm->_gyro->special 2: Room 22: bottom of stairs. - _vm->_gyro->_dna._brummieStairs = 3; - _vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicNothing; - _vm->_gyro->_magics[11]._operation = _vm->_gyro->kMagicExclaim; - _vm->_gyro->_magics[11]._data = 5; - _vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicBounce; // Now works as planned! - stopwalking(); - _vm->_visa->dixi('q', 26); - _vm->_gyro->_dna._userMovesAvvy = true; - break; - case 3: // _vm->_gyro->special 3: Room 71: triggers dart. - tr[0].bounce(); // Must include that. - - if (!_vm->_gyro->_dna._arrowTriggered) { - _vm->_gyro->_dna._arrowTriggered = true; - apped(2, 4); // The dart starts at ped 4, and... - tr[1].walkto(5); // flies to ped 5. - tr[1].face = 0; // Only face. - // Should call some kind of Eachstep procedure which will deallocate - // the sprite when it hits the wall, and replace it with the chunk - // graphic of the arrow buried in the plaster. */ - - // OK! - tr[1].call_eachstep = true; - tr[1].eachstep = procarrow_procs; - } - break; - case 4: // This is the ghost room link. - _vm->_lucerna->dusk(); - tr[0].turn(kDirRight); // you'll see this after we get back from bootstrap - _vm->_timeout->set_up_timer(1, _vm->_timeout->procghost_room_phew, _vm->_timeout->reason_ghost_room_phew); - _vm->_enid->backToBootstrap(3); - break; - case 5: - if (_vm->_gyro->_dna._friarWillTieYouUp) { - // _vm->_gyro->special 5: Room 42: touched tree, and get tied up. - _vm->_gyro->_magics[4]._operation = _vm->_gyro->kMagicBounce; // Boundary effect is now working again. - _vm->_visa->dixi('q', 35); - tr[0].done(); - //tr[1].vanishifstill:=true; - _vm->_celer->drawBackgroundSprite(-1, -1, 2); - _vm->_visa->dixi('q', 36); - _vm->_gyro->_dna._tiedUp = true; - _vm->_gyro->_dna._friarWillTieYouUp = false; - tr[1].walkto(3); - tr[1].vanishifstill = true; - tr[1].check_me = true; // One of them must have Check_Me switched on. - _vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then. - _vm->_timeout->set_up_timer(364, _vm->_timeout->prochang_around, _vm->_timeout->reason_hanging_around); - } - break; - case 6: // _vm->_gyro->special 6: fall down oubliette. - _vm->_gyro->_dna._userMovesAvvy = false; - tr[0].ix = 3; - tr[0].iy = 0; - tr[0].face = kDirRight; - _vm->_timeout->set_up_timer(1, _vm->_timeout->procfall_down_oubliette, _vm->_timeout->reason_falling_down_oubliette); - break; - case 7: // _vm->_gyro->special 7: stop falling down oubliette. - tr[0].visible = false; - _vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing; - stopwalking(); - _vm->_timeout->lose_timer(_vm->_timeout->reason_falling_down_oubliette); - //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 0); - //_vm->_lucerna->mblit(12, 80, 38, 160, 3, 1); - _vm->_scrolls->display("Oh dear, you seem to be down the bottom of an oubliette."); - _vm->_timeout->set_up_timer(200, _vm->_timeout->procmeet_avaroid, _vm->_timeout->reason_meeting_avaroid); - break; - case 8: // _vm->_gyro->special 8: leave du Lustie's room. - if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) { - _vm->_visa->dixi('q', 63); - tr[1].turn(kDirDown); - tr[1].stopwalk(); - tr[1].call_eachstep = false; // Geida - _vm->_lucerna->gameOver(); - } - break; - case 9: // _vm->_gyro->special 9: lose Geida to Robin Hood... - if (!_vm->_gyro->_dna._geidaFollows) - return; // DOESN'T COUNT: no Geida. - tr[1].call_eachstep = false; // She no longer follows Avvy around. - tr[1].walkto(4); // She walks to somewhere... - tr[0].done(); // Lose Avvy. - _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_timeout->set_up_timer(40, _vm->_timeout->procrobin_hood_and_geida, _vm->_timeout->reason_robin_hood_and_geida); - break; - case 10: // _vm->_gyro->special 10: transfer north in catacombs. - if ((_vm->_gyro->_dna._catacombX == 4) && (_vm->_gyro->_dna._catacombY == 1)) { - // Into Geida's room. - if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectKey - 1]) - _vm->_visa->dixi('q', 62); - else { - _vm->_visa->dixi('q', 61); - return; - } - } - _vm->_lucerna->dusk(); - _vm->_gyro->_dna._catacombY--; - catamove(4); - if (_vm->_gyro->_dna._room != r__catacombs) - return; - switch ((_vm->_gyro->kCatacombMap[_vm->_gyro->_dna._catacombY - 1][_vm->_gyro->_dna._catacombX - 1] & 0xf00) >> 8) { - case 0x1: - apped(1, 12); - break; - case 0x3: - apped(1, 11); - break; - default: - apped(1, 4); - } - getback(); - dawndelay(); - break; - case 11: // _vm->_gyro->special 11: transfer east in catacombs. - _vm->_lucerna->dusk(); - _vm->_gyro->_dna._catacombX++; - catamove(1); - if (_vm->_gyro->_dna._room != r__catacombs) - return; - apped(1, 1); - getback(); - dawndelay(); - break; - case 12: // _vm->_gyro->special 12: transfer south in catacombs. - _vm->_lucerna->dusk(); - _vm->_gyro->_dna._catacombY += 1; - catamove(2); - if (_vm->_gyro->_dna._room != r__catacombs) - return; - apped(1, 2); - getback(); - dawndelay(); - break; - case 13: // _vm->_gyro->special 13: transfer west in catacombs. - _vm->_lucerna->dusk(); - _vm->_gyro->_dna._catacombX--; - catamove(3); - if (_vm->_gyro->_dna._room != r__catacombs) - return; - apped(1, 3); - getback(); - dawndelay(); - break; - } -} - - - -void Trip::open_the_door(byte whither, byte ped, byte magicnum) { -// This slides the door open. (The data really ought to be saved in -// the Also file, and will be next time. However, for now, they're -// here.) - switch (_vm->_gyro->_dna._room) { - case r__outsideyours: - case r__outsidenottspub: - case r__outsideducks: - _vm->_sequence->first_show(1); - _vm->_sequence->then_show(2); - _vm->_sequence->then_show(3); - break; - case r__insidecardiffcastle: - _vm->_sequence->first_show(1); - _vm->_sequence->then_show(5); - break; - case r__avvysgarden: - case r__entrancehall: - case r__insideabbey: - case r__yourhall: - _vm->_sequence->first_show(1); - _vm->_sequence->then_show(2); - break; - case r__musicroom: - case r__outsideargentpub: - _vm->_sequence->first_show(5); - _vm->_sequence->then_show(6); - break; - case r__lusties: - switch (magicnum) { - case 14: - if (_vm->_gyro->_dna._avvysInTheCupboard) { - hide_in_the_cupboard(); - _vm->_sequence->first_show(8); - _vm->_sequence->then_show(7); - _vm->_sequence->start_to_close(); - return; - } else { - apped(1, 6); - tr[0].face = kDirRight; // added by TT 12/3/1995 - _vm->_sequence->first_show(8); - _vm->_sequence->then_show(9); - } - break; - case 12: - _vm->_sequence->first_show(4); - _vm->_sequence->then_show(5); - _vm->_sequence->then_show(6); - break; - } - break; - } - - _vm->_sequence->then_flip(whither, ped); - _vm->_sequence->start_to_open(); -} - -void Trip::newspeed() { - // Given that you've just changed the speed in triptype.xs, this adjusts ix. - const ByteField lightspace = {40, 199, 47, 199}; - byte page_; - - tr[0].ix = (tr[0].ix / 3) * tr[0].xs; - - //setactivepage(3); - - if (tr[0].xs == _vm->_gyro->kRun) - _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorYellow); - else - _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorYellow); - - if (tr[0].xs == _vm->_gyro->kRun) - _vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue); - else - _vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue); - - //setactivepage(1 - cp); - - for (page_ = 0; page_ <= 1; page_++) - getset[page_].remember(lightspace); - -} - -void Trip::rwsp(byte t, byte dir) { - switch (dir) { - case kDirUp: - tr[t].speed(0, -tr[t].ys); - break; - case kDirDown: - tr[t].speed(0, tr[t].ys); - break; - case kDirLeft: - tr[t].speed(-tr[t].xs, 0); - break; - case kDirRight: - tr[t].speed(tr[t].xs, 0); - break; - case kDirUpLeft: - tr[t].speed(-tr[t].xs, -tr[t].ys); - break; - case kDirUpRight: - tr[t].speed(tr[t].xs, -tr[t].ys); - break; - case kDirDownLeft: - tr[t].speed(-tr[t].xs, tr[t].ys); - break; - case kDirDownRight: - tr[t].speed(tr[t].xs, tr[t].ys); - break; - } -} - -void Trip::apped(byte trn, byte np) { - trn--; - np--; - tr[trn].appear(_vm->_gyro->_peds[np]._x - tr[trn]._info._xLength / 2, _vm->_gyro->_peds[np]._y - tr[trn]._info._yLength, _vm->_gyro->_peds[np]._direction); - rwsp(trn, _vm->_gyro->_peds[np]._direction); -} - -#if 0 - function overlap(x1,y1,x2,y2,x3,y3,x4,y4:uint16):bool; - begin // By De Morgan's law: - overlap:=(x2>=x3) and (x4>=x1) and (y2>=y3) and (y4>=y1); - end; -#endif - //x1,x2 - as _vm->_gyro->bytefield, but *8. y1,y2 - as _vm->_gyro->bytefield. - //x3,y3 = mx,my. x4,y4 = mx+16,my+16. - -void Trip::getback() { - // Super_Off; -#if 0 - while (getset[1 - _vm->_gyro->cp].numleft > 0) { - getset[1 - _vm->_gyro->cp].recall(r); - - - bool endangered = false; - if overlaps_with_mouse and not endangered then - begin - endangered:=true; - blitfix; - Super_Off; - end; - - //_vm->_lucerna->mblit(r.x1, r.y1, r.x2, r.y2, 3, 1 - _vm->_gyro->cp); - } - - if endangered then - Super_On; -#endif -} - -// Eachstep procedures: -void Trip::follow_avvy_y(byte tripnum) { - if (tr[0].face == kDirLeft) - return; - if (tr[tripnum].homing) - tr[tripnum].hy = tr[1].y; - else { - if (tr[tripnum].y < tr[1].y) - tr[tripnum].y += 1; - else if (tr[tripnum].y > tr[1].y) - tr[tripnum].y -= 1; - else - return; - if (tr[tripnum].ix == 0) { - tr[tripnum].step += 1; - if (tr[tripnum].step == tr[tripnum].a.seq) - tr[tripnum].step = 0; - tr[tripnum].count = 0; - } - } -} - -void Trip::back_and_forth(byte tripnum) { - if (!tr[tripnum].homing) { - if (tr[tripnum].face == kDirRight) - tr[tripnum].walkto(4); - else - tr[tripnum].walkto(5); - } -} - -void Trip::face_avvy(byte tripnum) { - if (!tr[tripnum].homing) { - if (tr[0].x >= tr[tripnum].x) - tr[tripnum].face = kDirRight; - else - tr[tripnum].face = kDirLeft; - } -} - -void Trip::arrow_procs(byte tripnum) { - if (tr[tripnum].homing) { - // Arrow is still in flight. - // We must check whether or not the arrow has collided tr[tripnum] Avvy's head. - // This is so if: a) the bottom of the arrow is below Avvy's head, - // b) the left of the arrow is left of the right of Avvy's head, and - // c) the right of the arrow is right of the left of Avvy's head. - if (((tr[tripnum].y + tr[tripnum]._info._yLength) >= tr[0].y) // A - && (tr[tripnum].x <= (tr[0].x + tr[0]._info._xLength)) // B - && ((tr[tripnum].x + tr[tripnum]._info._xLength) >= tr[0].x)) { // C - // OK, it's hit him... what now? - - tr[1].call_eachstep = false; // prevent recursion. - _vm->_visa->dixi('Q', 47); // Complaint! - tr[tripnum].done(); // Deallocate the arrow. -#if 0 - tr[1].done; { Deallocate normal pic of Avvy. } - - off; - for byte fv:=0 to 1 do - begin - cp:=1-cp; - getback; - end; - on; -#endif - _vm->_lucerna->gameOver(); - - _vm->_gyro->_dna._userMovesAvvy = false; // Stop the user from moving him. - _vm->_timeout->set_up_timer(55, _vm->_timeout->procnaughty_duke, _vm->_timeout->reason_naughty_duke); - } - } else { // Arrow has hit the wall! - tr[tripnum].done(); // Deallocate the arrow. - _vm->_celer->drawBackgroundSprite(-1, -1, 3); // Show pic of arrow stuck into the door. - _vm->_gyro->_dna._arrowInTheDoor = true; // So that we can pick it up. - } - -} - -#if 0 -procedure Spludwick_procs(tripnum:byte); -var fv:byte; -begin - with tr[tripnum] do - if not homing then { We only need to do anything if Spludwick *stops* - walking. } - with _vm->_gyro->dna do - begin - inc(DogfoodPos); - if DogfoodPos=8 then DogfoodPos:=1; - walkto(DogfoodPos); - end; -end; -#endif - -void Trip::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. - int16 tox = tr[0].x + 17; - int16 toy = tr[0].y - 1; - if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { - tr[tripnum].call_eachstep = false; - tr[tripnum].face = kDirLeft; - tr[tripnum].stopwalk(); - // ... whatever ... - } else { - // Still some way to go. - if (tr[tripnum].x < tox) { - tr[tripnum].x += 5; - if (tr[tripnum].x > tox) - tr[tripnum].x = tox; - } - if (tr[tripnum].y < toy) - tr[tripnum].y++; - tr[tripnum].step++; - if (tr[tripnum].step == tr[tripnum].a.seq) - tr[tripnum].step = 0; - } -} - -void Trip::take_a_step(byte &tripnum) { - if (tr[tripnum].ix == 0) { - tr[tripnum].step++; - if (tr[tripnum].step == tr[tripnum].a.seq) - tr[tripnum].step = 0; - tr[tripnum].count = 0; - } -} - -void Trip::spin(byte whichway, byte &tripnum) { - if (tr[tripnum].face != whichway) { - tr[tripnum].face = whichway; - if (tr[tripnum].whichsprite == 2) - return; // Not for Spludwick - - _vm->_gyro->_dna._geidaSpin += 1; - _vm->_gyro->_dna._geidaTime = 20; - if (_vm->_gyro->_dna._geidaSpin == 5) { - _vm->_scrolls->display("Steady on, Avvy, you'll make the poor girl dizzy!"); - _vm->_gyro->_dna._geidaSpin = 0; - _vm->_gyro->_dna._geidaTime = 0; // knock out records - } - } -} - -void Trip::geida_procs(byte tripnum) { - if (_vm->_gyro->_dna._geidaTime > 0) { - _vm->_gyro->_dna._geidaTime--; - if (_vm->_gyro->_dna._geidaTime == 0) - _vm->_gyro->_dna._geidaSpin = 0; - } - - if (tr[tripnum].y < (tr[0].y - 2)) { - // Geida is further from the screen than Avvy. - spin(kDirDown, tripnum); - tr[tripnum].iy = 1; - tr[tripnum].ix = 0; - take_a_step(tripnum); - return; - } else if (tr[tripnum].y > (tr[0].y + 2)) { - // Avvy is further from the screen than Geida. - spin(kDirUp, tripnum); - tr[tripnum].iy = -1; - tr[tripnum].ix = 0; - take_a_step(tripnum); - return; - } - - tr[tripnum].iy = 0; - // These 12-s are not in the original, I added them to make the following method more "smooth". - // Now the NPC which is following Avvy won't block his way and will walk next to him properly. - if (tr[tripnum].x < tr[0].x - tr[0].xs * 8 - 12) { - tr[tripnum].ix = tr[0].xs; - spin(kDirRight, tripnum); - take_a_step(tripnum); - } else if (tr[tripnum].x > tr[0].x + tr[0].xs * 8 + 12) { - tr[tripnum].ix = -tr[0].xs; - spin(kDirLeft, tripnum); - take_a_step(tripnum); - } else - tr[tripnum].ix = 0; -} - -// That's all... - -void Trip::call_andexors() { - int8 order[5]; - byte fv, temp; - bool ok; - - for (int i = 0; i < 5; i++) - order[i] = -1; - - for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick && tr[fv].visible) - order[fv] = fv; - } - - do { - ok = true; - for (fv = 0; fv < 4; fv++) { - if (((order[fv] != -1) && (order[fv + 1] != -1)) - && (tr[order[fv]].y > tr[order[fv + 1]].y)) { - // Swap them! - temp = order[fv]; - order[fv] = order[fv + 1]; - order[fv + 1] = temp; - ok = false; - } - } - } while (!ok); - - - _vm->_graphics->refreshBackground(); - - for (fv = 0; fv < 5; fv++) { - if (order[fv] > -1) - tr[order[fv]].andexor(); - } -} - -void Trip::trippancy_link() { - byte fv; - - if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll) - return; - for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick && tr[fv].visible) - tr[fv].walk(); - } - - call_andexors(); - - for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick && tr[fv].call_eachstep) { - switch (tr[fv].eachstep) { - case procfollow_avvy_y : - follow_avvy_y(fv); - break; - case procback_and_forth : - back_and_forth(fv); - break; - case procface_avvy : - face_avvy(fv); - break; - case procarrow_procs : - arrow_procs(fv); - break; - // PROCSpludwick_procs : spludwick_procs(fv); - case procgrab_avvy : - grab_avvy(fv); - break; - case procgeida_procs : - geida_procs(fv); - break; - } - } - } - - if (mustexclaim) { - mustexclaim = false; - _vm->_visa->dixi('x', saywhat); - } -} - -void Trip::get_back_loretta() { - byte fv; - - for (fv = 0; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick) { - getback(); - return; - } - } - // for fv:=0 to 1 do begin cp:=1-cp; getback; end; -} - -void Trip::stopwalking() { - tr[0].stopwalk(); - _vm->_gyro->_dna._direction = kDirStopped; - if (_vm->_gyro->_alive) - tr[0].step = 1; -} - -void Trip::tripkey(char dir) { - warning("Replaced by Trip::handleMoveKey!"); -} - -void Trip::readstick() { - warning("STUB: Trip::readstick()"); -} - -void Trip::getsetclear() { - for (byte fv = 0; fv <= 1; fv++) - getset[fv].init(); -} - -void Trip::hide_in_the_cupboard() { - if (_vm->_gyro->_dna._avvysInTheCupboard) { - if (_vm->_gyro->_dna._wearing == Acci::kNothing) - _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!"); - else { - tr[0].visible = true; - _vm->_gyro->_dna._userMovesAvvy = true; - apped(1, 3); // Walk out of the cupboard. - _vm->_scrolls->display("You leave the cupboard. Nice to be out of there!"); - _vm->_gyro->_dna._avvysInTheCupboard = false; - _vm->_sequence->first_show(8); - _vm->_sequence->then_show(7); - _vm->_sequence->start_to_close(); - } - } else { - // Not hiding in the cupboard - tr[0].visible = false; - _vm->_gyro->_dna._userMovesAvvy = false; - _vm->_scrolls->display(Common::String("You walk into the room...") + _vm->_scrolls->kControlParagraph - + "It seems to be an empty, but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation."); - _vm->_gyro->_dna._avvysInTheCupboard = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 8); - } -} - -void Trip::fliproom(byte room, byte ped) { - byte fv; - - if (!_vm->_gyro->_alive) { - // You can't leave the room if you're dead. - tr[0].ix = 0; - tr[0].iy = 0; // Stop him from moving. - return; - } - - if ((room == 177) && (_vm->_gyro->_dna._room == r__lusties)) { - hide_in_the_cupboard(); - return; - } - - if ((_vm->_gyro->_dna._jumpStatus > 0) && (_vm->_gyro->_dna._room == r__insidecardiffcastle)) { - // You can't *jump* out of Cardiff Castle! - tr[0].ix = 0; - return; - } - - _vm->_lucerna->exitRoom(_vm->_gyro->_dna._room); - _vm->_lucerna->dusk(); - getsetclear(); - - - for (fv = 1; fv < kSpriteNumbMax; fv++) { - if (tr[fv].quick) - tr[fv].done(); - } // Deallocate sprite - - if (_vm->_gyro->_dna._room == r__lustiesroom) - _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true; - - _vm->_lucerna->enterRoom(room, ped); - apped(1, ped); - _vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false; - _vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction; - _vm->_gyro->_dna._direction = tr[0].face; - _vm->_lucerna->drawDirection(); - - for (fv = 0; fv <= 1; fv++) { - _vm->_gyro->_cp = 1 - _vm->_gyro->_cp; - getback(); - } - _vm->_lucerna->dawn(); - - // Tidy up after mouse. I know it's a kludge... - // tidy_after_mouse; -} - -bool Trip::infield(byte which) { - which--; // Pascal -> C: different array indexes. - - int16 yy = tr[0].y + tr[0]._info._yLength; - - return (tr[0].x >= _vm->_gyro->_fields[which]._x1) && (tr[0].x <= _vm->_gyro->_fields[which]._x2) - && (yy >= _vm->_gyro->_fields[which]._y1) && (yy <= _vm->_gyro->_fields[which]._y2); - -} - -bool Trip::neardoor() { - if (_vm->_gyro->_fieldNum < 8) { - // there ARE no doors here! - return false; - } - - int16 ux = tr[0].x; - int16 uy = tr[0].y + tr[0]._info._yLength; - bool nd = false; - for (byte fv = 8; fv < _vm->_gyro->_fieldNum; fv++) - if ((ux >= _vm->_gyro->_fields[fv]._x1) && (ux <= _vm->_gyro->_fields[fv]._x2) - && (uy >= _vm->_gyro->_fields[fv]._y1) && (uy <= _vm->_gyro->_fields[fv]._y2)) - nd = true; - return nd; -} - -void Trip::new_game_for_trippancy() { // Called by gyro.newgame - tr[0].visible = false; -} - - - -void Trip::handleMoveKey(const Common::Event &event) { - if (!_vm->_gyro->_dna._userMovesAvvy) - return; - - if (_vm->_dropdown->_activeMenuItem._activeNow) - _vm->_parser->tryDropdown(); - else { - switch (event.kbd.keycode) { - case Common::KEYCODE_UP: - if (_vm->_gyro->_dna._direction != kDirUp) { - _vm->_gyro->_dna._direction = kDirUp; - rwsp(0, _vm->_gyro->_dna._direction); - } else - stopwalking(); - break; - case Common::KEYCODE_DOWN: - if (_vm->_gyro->_dna._direction != kDirDown) { - _vm->_gyro->_dna._direction = kDirDown; - rwsp(0, _vm->_gyro->_dna._direction); - } else - stopwalking(); - break; - case Common::KEYCODE_LEFT: - if (_vm->_gyro->_dna._direction != kDirLeft) { - _vm->_gyro->_dna._direction = kDirLeft; - rwsp(0, _vm->_gyro->_dna._direction); - } else - stopwalking(); - break; - case Common::KEYCODE_RIGHT: - if (_vm->_gyro->_dna._direction != kDirRight) { - _vm->_gyro->_dna._direction = kDirRight; - rwsp(0, _vm->_gyro->_dna._direction); - } else - stopwalking(); - break; - case Common::KEYCODE_PAGEUP: - if (_vm->_gyro->_dna._direction != kDirUpRight) { - _vm->_gyro->_dna._direction = kDirUpRight; - rwsp(0, _vm->_gyro->_dna._direction); - } else - stopwalking(); - break; - case Common::KEYCODE_PAGEDOWN: - if (_vm->_gyro->_dna._direction != kDirDownRight) { - _vm->_gyro->_dna._direction = kDirDownRight; - rwsp(0, _vm->_gyro->_dna._direction); - } else - stopwalking(); - break; - case Common::KEYCODE_END: - if (_vm->_gyro->_dna._direction != kDirDownLeft) { - _vm->_gyro->_dna._direction = kDirDownLeft; - rwsp(0, _vm->_gyro->_dna._direction); - } else - stopwalking(); - break; - case Common::KEYCODE_HOME: - if (_vm->_gyro->_dna._direction != kDirUpLeft) { - _vm->_gyro->_dna._direction = kDirUpLeft; - rwsp(0, _vm->_gyro->_dna._direction); - } else - stopwalking(); - break; - case Common::KEYCODE_KP5: - stopwalking(); - break; - default: - break; - } - } -} - - -} // End of namespace Avalanche. diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h deleted file mode 100644 index 76b435b163..0000000000 --- a/engines/avalanche/trip6.h +++ /dev/null @@ -1,217 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* TRIP5 Trippancy V - the sprite animation subsystem */ - - -#ifndef AVALANCHE_TRIP6_H -#define AVALANCHE_TRIP6_H - -#include "avalanche/graphics.h" - -#include "common/scummsys.h" -#include "common/str.h" - -namespace Avalanche { -class AvalancheEngine; - -struct adxtype { // Second revision of ADX type - Common::String name; // [13] name of character // uruk: Note to self: TRAILING /0 !!! Real size: 12 - Common::String comment; // [17] comment // uruk: Same here, but 16. - byte num; // number of pictures - byte seq; // how many in one stride - byte fgc, bgc; // foreground & background bubble colors - byte accinum; // the number according to Acci (1=Avvy, etc.) -}; - -struct trip_saver_type { - byte whichsprite; - byte face; - byte step; - int16 x; - int16 y; - int8 ix; - int8 iy; - bool visible; - bool homing; - bool check_me; - byte count; - byte xw, xs, ys; - byte totalnum; - int16 hx; - int16 hy; - bool call_eachstep; - byte eachstep; - bool vanishifstill; -}; - - -class Trip; - -class triptype { -public: - SpriteInfo _info; - - adxtype a; // vital statistics - byte face, step; - int16 x, y; // current xy coords - int16 ox[2], oy[2]; // last xy coords - int8 ix, iy; // amount to move sprite by, each step - byte whichsprite; - bool quick, visible, homing, check_me; - int16 hx, hy; // homing x & y coords - byte count; // counts before changing step - byte xs, ys; // x & y speed - byte totalnum; // total number of sprites - bool vanishifstill; // Do we show this sprite if it's still? - - bool call_eachstep; // Do we call the eachstep procedure? - byte eachstep; - - void init(byte spritenum, bool do_check, Trip *tr); - // loads & sets up the sprite - void original(); // just sets Quick to false - void andexor(); // drops sprite onto screen - void turn(byte whichway); // turns him round - void appear(int16 wx, int16 wy, byte wf); // switches him on - void bounce(); // bounces off walls. - void walk(); // prepares for andexor, etc. - void walkto(byte pednum); // home in on a point - void stophoming(); // self-explanatory - void homestep(); // calculates ix & iy for one homing step - void speed(int8 xx, int8 yy); // sets ix & iy, non-homing, etc - void stopwalk(); // Stops the sprite from moving - void chatter(); // Sets up talk vars - void set_up_saver(trip_saver_type &v); - void unload_saver(trip_saver_type v); - - void savedata(Common::File &f); // Self-explanatory, - void loaddata(Common::File &f); // really. - - void save_data_to_mem(uint16 &where); - void load_data_from_mem(uint16 &where); - triptype *done(); - -private: - Trip *_tr; - - bool collision_check(); - int8 sgn(int16 val); -}; - -const int16 maxgetset = 35; - -class getsettype { -public: - ByteField gs[maxgetset]; - byte numleft; - - getsettype *init(); - void remember(ByteField r); - void recall(ByteField &r); -}; - -class Trip { -public: - friend class triptype; - friend class getsettype; - - static const int16 kDirUp = 0; - static const int16 kDirRight = 1; - static const int16 kDirDown = 2; - static const int16 kDirLeft = 3; - static const int16 kDirUpRight = 4; - static const int16 kDirDownRight = 5; - static const int16 kDirDownLeft = 6; - static const int16 kDirUpLeft = 7; - static const int16 kDirStopped = 8; - - static const int16 kSpriteNumbMax = 5; // current max no. of sprites - - static const int16 procfollow_avvy_y = 1; - static const int16 procback_and_forth = 2; - static const int16 procface_avvy = 3; - static const int16 procarrow_procs = 4; - static const int16 procspludwick_procs = 5; - static const int16 procgrab_avvy = 6; - static const int16 procgeida_procs = 7; - - Trip(AvalancheEngine *vm); - ~Trip(); - - void trippancy_link(); - void get_back_loretta(); - void loadtrip(); - void call_special(uint16 which); - void open_the_door(byte whither, byte ped, byte magicnum); // Handles slidey-open doors. - void catamove(byte ped); - void stopwalking(); - void tripkey(char dir); - void rwsp(byte t, byte dir); - void apped(byte trn, byte np); - void getback(); - void fliproom(byte room, byte ped); - bool infield(byte which); // Returns true if you're within field "which". - bool neardoor(); // Returns True if you're near a door. - void readstick(); - void newspeed(); - void new_game_for_trippancy(); - void take_a_step(byte &tripnum); - void handleMoveKey(const Common::Event &event); // To replace tripkey(). - - triptype tr[kSpriteNumbMax]; - getsettype getset[2]; - byte aa[1600]; - - bool mustexclaim; - uint16 saywhat; - -private: - AvalancheEngine *_vm; - - // CHECKME: Useless? - // ByteField r; - // int16 beforex, beforey; - - byte checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl); - byte geida_ped(byte which); - void dawndelay(); - void hide_in_the_cupboard(); - void follow_avvy_y(byte tripnum); - void back_and_forth(byte tripnum); - void face_avvy(byte tripnum); - void arrow_procs(byte tripnum); - void grab_avvy(byte tripnum); - void spin(byte whichway, byte &tripnum); - void geida_procs(byte tripnum); - void call_andexors(); - void getsetclear(); -}; - -} // End of namespace Avalanche. - -#endif // AVALANCHE_TRIP6_H diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 635e14db6e..f3288ddd76 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -34,7 +34,7 @@ #include "avalanche/scrolls2.h" #include "avalanche/acci2.h" #include "avalanche/lucerna2.h" -#include "avalanche/trip6.h" +#include "avalanche/animation.h" #include "common/textconsole.h" @@ -252,8 +252,8 @@ void Visa::talkto(byte whom) { whom -= 149; no_matches = true; - for (fv = 0; fv <= _vm->_trip->kSpriteNumbMax; fv++) - if (_vm->_trip->tr[fv].a.accinum == whom) { + for (fv = 0; fv <= _vm->_animation->kSpriteNumbMax; fv++) + if (_vm->_animation->tr[fv]._stat.accinum == whom) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + (fv + 49) + _vm->_scrolls->kControlToBuffer); no_matches = false; break; @@ -275,8 +275,8 @@ void Visa::talkto(byte whom) { _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off. - _vm->_trip->tr[1].vanishifstill = true; - _vm->_trip->tr[1].walkto(3); // Walks away. + _vm->_animation->tr[1].vanishifstill = true; + _vm->_animation->tr[1].walkto(3); // Walks away. _vm->_lucerna->incScore(2); } -- cgit v1.2.3