AVALANCHE: Renaming/refactoring in Animation.

This commit is contained in:
uruk 2013-09-08 12:06:08 +02:00
parent 8f152c0833
commit c0243036a2
12 changed files with 430 additions and 522 deletions

View File

@ -407,8 +407,8 @@ void Acci::storeInterrogation(byte interrogation) {
_vm->_gyro->_dna._spareEvening.clear();
_vm->_gyro->_dna._spareEvening = _vm->_parser->_inputText;
_vm->_visa->displayScrollChain('z', 5); // His closing statement...
_vm->_animation->tr[1].walkTo(4); // The end of the drawbridge
_vm->_animation->tr[1]._vanishIfStill = true; // Then go away!
_vm->_animation->_sprites[1].walkTo(4); // The end of the drawbridge
_vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away!
_vm->_gyro->_magics[1]._operation = _vm->_gyro->kMagicNothing;
_vm->_gyro->_dna._cardiffQuestionNum = 5;
break;
@ -896,7 +896,7 @@ void Acci::openDoor() {
// Special cases.
switch (_vm->_gyro->_dna._room) {
case r__yours:
if (_vm->_animation->infield(2)) {
if (_vm->_animation->inField(2)) {
// Opening the box.
_thing = 54; // The box.
_person = kPardon;
@ -916,25 +916,25 @@ void Acci::openDoor() {
return; // No doors can open if you can't move Avvy.
for (byte fv = 8; fv < 15; fv++) {
if (_vm->_animation->infield(fv + 1)) {
if (_vm->_animation->inField(fv + 1)) {
fv -= 8;
switch (_vm->_gyro->_portals[fv]._operation) {
case Gyro::kMagicExclaim:
_vm->_animation->tr[0].bounce();
_vm->_animation->_sprites[0].bounce();
_vm->_visa->displayScrollChain('x', _vm->_gyro->_portals[fv]._data);
break;
case Gyro::kMagicTransport:
_vm->_animation->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->_animation->tr[0].bounce();
_vm->_animation->_sprites[0].bounce();
_vm->_scrolls->displayText("Sorry. This place is not available yet!");
break;
case Gyro::kMagicSpecial:
_vm->_animation->call_special(_vm->_gyro->_portals[fv]._data);
_vm->_animation->callSpecial(_vm->_gyro->_portals[fv]._data);
break;
case Gyro::kMagicOpenDoor:
_vm->_animation->openDoor((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9);
@ -1040,9 +1040,9 @@ void Acci::notInOrder() {
}
void Acci::goToCauldron() {
_vm->_animation->tr[1]._callEachStepFl = false; // Stops Geida_Procs.
_vm->_animation->_sprites[1]._callEachStepFl = false; // Stops Geida_Procs.
_vm->_timer->addTimer(1, _vm->_timer->kProcSpludwickGoesToCauldron, _vm->_timer->kReasonSpludWalk);
_vm->_animation->tr[1].walkTo(2);
_vm->_animation->_sprites[1].walkTo(2);
}
/**
@ -1102,9 +1102,9 @@ void Acci::drink() {
_vm->_lucerna->refreshObjectList();
_vm->_lucerna->dusk();
_vm->_gyro->hangAroundForAWhile();
_vm->_animation->fliproom(1, 1);
_vm->_animation->flipRoom(1, 1);
_vm->_gyro->setBackgroundColor(14);
_vm->_animation->new_game_for_trippancy(); // Not really.
_vm->_animation->_sprites[0]._visible = false;
}
}
@ -1112,12 +1112,12 @@ void Acci::cardiffClimbing() {
if (_vm->_gyro->_dna._standingOnDais) { // Clamber up.
_vm->_scrolls->displayText("You climb down, back onto the floor.");
_vm->_gyro->_dna._standingOnDais = false;
_vm->_animation->apped(1, 3);
_vm->_animation->appearPed(1, 3);
} else { // Clamber down.
if (_vm->_animation->infield(1)) {
if (_vm->_animation->inField(1)) {
_vm->_scrolls->displayText("You clamber up onto the dais.");
_vm->_gyro->_dna._standingOnDais = true;
_vm->_animation->apped(1, 2);
_vm->_animation->appearPed(1, 2);
} else
_vm->_scrolls->displayText("Get a bit closer, Avvy.");
}
@ -1136,9 +1136,9 @@ void Acci::standUp() {
_vm->_gyro->setBackgroundColor(0);
_vm->_visa->displayScrollChain('d', 14);
}
_vm->_animation->tr[0]._visible = true;
_vm->_animation->_sprites[0]._visible = true;
_vm->_gyro->_dna._userMovesAvvy = true;
_vm->_animation->apped(1, 2);
_vm->_animation->appearPed(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->_animation->tr[0]._visible = true; // But standing up.
_vm->_animation->apped(1, 4); // And walking away.
_vm->_animation->_sprites[0]._visible = true; // But standing up.
_vm->_animation->appearPed(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->_animation->infield(2)) {
if (_vm->_animation->inField(2)) {
if (_vm->_gyro->_dna._boxContent == thing) {
_vm->_celer->drawBackgroundSprite(-1, -1, 5);
_vm->_scrolls->displayText("OK, I've got it.");
@ -1188,13 +1188,13 @@ void Acci::getProc(char thing) {
case r__insidecardiffcastle:
switch (thing) {
case Gyro::kObjectPen:
if (_vm->_animation->infield(2)) { // Standing on the dais.
if (_vm->_animation->inField(2)) { // Standing on the dais.
if (_vm->_gyro->_dna._takenPen)
_vm->_scrolls->displayText("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->_animation->call_special(3); // Zap!
_vm->_animation->callSpecial(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->_animation->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->displayText("Got it!");
_vm->_gyro->_dna._mushroomGrowing = false;
@ -1247,7 +1247,7 @@ void Acci::giveGeidaTheLute() {
}
void Acci::playHarp() {
if (_vm->_animation->infield(7))
if (_vm->_animation->inField(7))
_vm->_scrolls->musicalScroll();
else
_vm->_scrolls->displayText("Get a bit closer to it, Avvy!");
@ -1278,7 +1278,7 @@ void Acci::personSpeaks() {
bool found = false; // The _person we're looking for's code is in _person.
for (int16 i = 0; i < _vm->_animation->kSpriteNumbMax; i++) {
if (_vm->_animation->tr[i]._quick && ((_vm->_animation->tr[i]._stat._acciNum + 149) == _person)) {
if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) {
_vm->_scrolls->displayText(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->_animation->tr[0]._id != 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;
if (_vm->_animation->_sprites[0]._id != i) {
int16 x = _vm->_animation->_sprites[0]._x;
int16 y = _vm->_animation->_sprites[0]._y;
_vm->_animation->_sprites[0].done();
_vm->_animation->_sprites[0].init(i, true, _vm->_animation);
_vm->_animation->_sprites[0].appear(x, y, Animation::kDirLeft);
_vm->_animation->_sprites[0]._visible = false;
}
}
break;
@ -1695,16 +1695,16 @@ void Acci::doThat() {
if (_vm->_gyro->_dna._avariciusTalk > 0)
_vm->_visa->displayScrollChain('q', 19);
else {
if ((_vm->_gyro->_dna._room == 12) & (_vm->_animation->infield(2))) { // Avaricius appears!
if ((_vm->_gyro->_dna._room == 12) & (_vm->_animation->inField(2))) { // Avaricius appears!
_vm->_visa->displayScrollChain('q', 17);
if (_vm->_gyro->_whereIs[1] == 12)
_vm->_visa->displayScrollChain('q', 18);
else {
_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]._callEachStepFl = true;
_vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcBackAndForth;
_vm->_animation->_sprites[1].init(1, false, _vm->_animation); // Avaricius
_vm->_animation->appearPed(2, 4);
_vm->_animation->_sprites[1].walkTo(5);
_vm->_animation->_sprites[1]._callEachStepFl = true;
_vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcBackAndForth;
_vm->_gyro->_dna._avariciusTalk = 14;
_vm->_timer->addTimer(177, _vm->_timer->kProcAvariciusTalks, _vm->_timer->kReasonAvariciusTalks);
}
@ -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->_animation->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->_animation->infield(6)) {
if (_vm->_animation->inField(6)) {
if (_thing == _vm->_gyro->kObjectOnion) {
if (_vm->_gyro->_dna._objects[_vm->_gyro->kObjectOnion - 1])
_vm->_visa->displayScrollChain('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->_animation->tr[1].walkTo(2);
_vm->_animation->tr[1]._vanishIfStill = true;
_vm->_animation->tr[1]._callEachStepFl = false;
_vm->_animation->_sprites[1].walkTo(2);
_vm->_animation->_sprites[1]._vanishIfStill = true;
_vm->_animation->_sprites[1]._callEachStepFl = false;
_vm->_gyro->_whereIs[7] = 177;
break;
default:
@ -1984,7 +1984,7 @@ void Acci::doThat() {
if (_vm->_gyro->_dna._sittingInPub)
_vm->_scrolls->displayText("You're already sitting!");
else {
_vm->_animation->tr[0].walkTo(4); // Move Avvy to the place, and sit him down.
_vm->_animation->_sprites[0].walkTo(4); // Move Avvy to the place, and sit him down.
_vm->_timer->addTimer(1, _vm->_timer->kProcAvvySitDown, _vm->_timer->kReasonSittingDown);
}
} else { // Default doodah.

View File

@ -121,7 +121,7 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *tr) {
_speedX = 3;
_speedY = 1;
if (spritenum == 1)
_tr->newspeed(); // Just for the lights.
_tr->updateSpeed(); // Just for the lights.
_homing = false;
_moveX = 0;
@ -173,10 +173,10 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) {
*/
bool AnimationType::checkCollision() {
for (int16 i = 0; i < _tr->kSpriteNumbMax; i++) {
if (_tr->tr[i]._quick && (_tr->tr[i]._id != _id) &&
((_x + _info._xLength) > _tr->tr[i]._x) &&
(_x < (_tr->tr[i]._x + _tr->tr[i]._info._xLength)) &&
(_tr->tr[i]._y == _y))
if (_tr->_sprites[i]._quick && (_tr->_sprites[i]._id != _id) &&
((_x + _info._xLength) > _tr->_sprites[i]._x) &&
(_x < (_tr->_sprites[i]._x + _tr->_sprites[i]._info._xLength)) &&
(_tr->_sprites[i]._y == _y))
return true;
}
@ -209,22 +209,22 @@ void AnimationType::walk() {
return;
}
byte tc = _tr->checkfeet(_x, _x + _info._xLength, _oldY[_tr->_vm->_gyro->_cp], _y, _info._yLength) - 1;
byte 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;
_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);
_tr->flipRoom(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff);
break;
case Gyro::kMagicUnfinished: {
bounce();
@ -232,7 +232,7 @@ void AnimationType::walk() {
}
break;
case Gyro::kMagicSpecial:
_tr->call_special(_tr->_vm->_gyro->_magics[tc]._data);
_tr->callSpecial(_tr->_vm->_gyro->_magics[tc]._data);
break;
case Gyro::kMagicOpenDoor:
_tr->openDoor(_tr->_vm->_gyro->_magics[tc]._data >> 8, _tr->_vm->_gyro->_magics[tc]._data & 0xff, tc);
@ -366,25 +366,22 @@ void AnimationType::done() {
Animation::Animation(AvalancheEngine *vm) {
_vm = vm;
mustexclaim = false;
_mustExclaim = false;
}
Animation::~Animation() {
for (int16 i = 0; i < kSpriteNumbMax; i++) {
if (tr[i]._quick)
tr[i].done();
if (_sprites[i]._quick)
_sprites[i].done();
}
}
void Animation::loadtrip() {
void Animation::loadAnims() {
for (int16 i = 0; i < kSpriteNumbMax; i++)
tr[i].original();
for (uint16 i = 0; i < sizeof(aa); i++)
aa[i] = 0;
_sprites[i].original();
}
byte Animation::checkfeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) {
byte Animation::checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl) {
// if not alive then begin checkfeet:=0; exit; end;
byte a = 0;
@ -432,11 +429,7 @@ byte Animation::geida_ped(byte which) {
}
}
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.) */
void Animation::catacombMove(byte ped) {
int32 here;
uint16 xy_uint16;
byte fv;
@ -451,22 +444,22 @@ void Animation::catamove(byte ped) {
switch (xy_uint16) {
case 1801: // Exit catacombs
fliproom(r__lustiesroom, 4);
flipRoom(r__lustiesroom, 4);
_vm->_scrolls->displayText("Phew! Nice to be out of there!");
return;
case 1033: // Oubliette
fliproom(r__oubliette, 1);
flipRoom(r__oubliette, 1);
_vm->_scrolls->displayText(Common::String("Oh, NO!") + _vm->_scrolls->kControlRegister + '1' + _vm->_scrolls->kControlSpeechBubble);
return;
case 4:
fliproom(r__geidas, 1);
flipRoom(r__geidas, 1);
return;
case 2307:
fliproom(r__lusties, 5);
flipRoom(r__lusties, 5);
_vm->_scrolls->displayText("Oh no... here we go again...");
_vm->_gyro->_dna._userMovesAvvy = false;
tr[0]._moveY = 1;
tr[0]._moveX = 0;
_sprites[0]._moveY = 1;
_sprites[0]._moveX = 0;
return;
}
@ -735,11 +728,11 @@ void Animation::catamove(byte ped) {
}
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]._callEachStepFl = true;
tr[1]._eachStepProc = kProcGeida;
if (!_sprites[1]._quick) // If we don't already have her...
_sprites[1].init(5, true, this); // ...Load Geida.
appearPed(2, geida_ped(ped));
_sprites[1]._callEachStepFl = true;
_sprites[1]._eachStepProc = kProcGeida;
}
}
@ -750,7 +743,7 @@ void Animation::dawndelay() {
_vm->_timer->addTimer(2, _vm->_timer->kProcDawnDelay, _vm->_timer->kReasonDawndelay);
}
void Animation::call_special(uint16 which) {
void Animation::callSpecial(uint16 which) {
switch (which) {
case 1: // _vm->_gyro->special 1: Room 22: top of stairs.
_vm->_celer->drawBackgroundSprite(-1, -1, 1);
@ -771,25 +764,25 @@ void Animation::call_special(uint16 which) {
_vm->_gyro->_dna._userMovesAvvy = true;
break;
case 3: // _vm->_gyro->special 3: Room 71: triggers dart.
tr[0].bounce(); // Must include that.
_sprites[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]._facingDir = kDirUp; // Only face.
appearPed(2, 4); // The dart starts at ped 4, and...
_sprites[1].walkTo(5); // flies to ped 5.
_sprites[1]._facingDir = 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]._callEachStepFl = true;
tr[1]._eachStepProc = kProcArrow;
_sprites[1]._callEachStepFl = true;
_sprites[1]._eachStepProc = kProcArrow;
}
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
_sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap
_vm->_timer->addTimer(1, _vm->_timer->kProcGhostRoomPhew, _vm->_timer->kReasonGhostRoomPhew);
_vm->_enid->backToBootstrap(3);
break;
@ -798,28 +791,28 @@ void Animation::call_special(uint16 which) {
// _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->displayScrollChain('q', 35);
tr[0].done();
_sprites[0].done();
//tr[1].vanishifstill:=true;
_vm->_celer->drawBackgroundSprite(-1, -1, 2);
_vm->_visa->displayScrollChain('q', 36);
_vm->_gyro->_dna._tiedUp = true;
_vm->_gyro->_dna._friarWillTieYouUp = false;
tr[1].walkTo(3);
tr[1]._vanishIfStill = true;
tr[1]._doCheck = true; // One of them must have Check_Me switched on.
_sprites[1].walkTo(3);
_sprites[1]._vanishIfStill = true;
_sprites[1]._doCheck = true; // One of them must have Check_Me switched on.
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = 177; // Not here, then.
_vm->_timer->addTimer(364, _vm->_timer->kProcHangAround, _vm->_timer->kReasonHangingAround);
}
break;
case 6: // _vm->_gyro->special 6: fall down oubliette.
_vm->_gyro->_dna._userMovesAvvy = false;
tr[0]._moveX = 3;
tr[0]._moveY = 0;
tr[0]._facingDir = kDirRight;
_sprites[0]._moveX = 3;
_sprites[0]._moveY = 0;
_sprites[0]._facingDir = kDirRight;
_vm->_timer->addTimer(1, _vm->_timer->kProcFallDownOubliette, _vm->_timer->kReasonFallingDownOubliette);
break;
case 7: // _vm->_gyro->special 7: stop falling down oubliette.
tr[0]._visible = false;
_sprites[0]._visible = false;
_vm->_gyro->_magics[9]._operation = _vm->_gyro->kMagicNothing;
stopWalking();
_vm->_timer->loseTimer(_vm->_timer->kReasonFallingDownOubliette);
@ -831,18 +824,18 @@ void Animation::call_special(uint16 which) {
case 8: // _vm->_gyro->special 8: leave du Lustie's room.
if ((_vm->_gyro->_dna._geidaFollows) && (!_vm->_gyro->_dna._lustieIsAsleep)) {
_vm->_visa->displayScrollChain('q', 63);
tr[1].turn(kDirDown);
tr[1].stopWalk();
tr[1]._callEachStepFl = false; // Geida
_sprites[1].turn(kDirDown);
_sprites[1].stopWalk();
_sprites[1]._callEachStepFl = 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]._callEachStepFl = false; // She no longer follows Avvy around.
tr[1].walkTo(4); // She walks to somewhere...
tr[0].done(); // Lose Avvy.
_sprites[1]._callEachStepFl = false; // She no longer follows Avvy around.
_sprites[1].walkTo(4); // She walks to somewhere...
_sprites[0].done(); // Lose Avvy.
_vm->_gyro->_dna._userMovesAvvy = false;
_vm->_timer->addTimer(40, _vm->_timer->kProcRobinHoodAndGeida, _vm->_timer->kReasonRobinHoodAndGeida);
break;
@ -858,50 +851,46 @@ void Animation::call_special(uint16 which) {
}
_vm->_lucerna->dusk();
_vm->_gyro->_dna._catacombY--;
catamove(4);
catacombMove(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);
appearPed(1, 12);
break;
case 0x3:
apped(1, 11);
appearPed(1, 11);
break;
default:
apped(1, 4);
appearPed(1, 4);
}
getback();
dawndelay();
break;
case 11: // _vm->_gyro->special 11: transfer east in catacombs.
_vm->_lucerna->dusk();
_vm->_gyro->_dna._catacombX++;
catamove(1);
catacombMove(1);
if (_vm->_gyro->_dna._room != r__catacombs)
return;
apped(1, 1);
getback();
appearPed(1, 1);
dawndelay();
break;
case 12: // _vm->_gyro->special 12: transfer south in catacombs.
_vm->_lucerna->dusk();
_vm->_gyro->_dna._catacombY += 1;
catamove(2);
catacombMove(2);
if (_vm->_gyro->_dna._room != r__catacombs)
return;
apped(1, 2);
getback();
appearPed(1, 2);
dawndelay();
break;
case 13: // _vm->_gyro->special 13: transfer west in catacombs.
_vm->_lucerna->dusk();
_vm->_gyro->_dna._catacombX--;
catamove(3);
catacombMove(3);
if (_vm->_gyro->_dna._room != r__catacombs)
return;
apped(1, 3);
getback();
appearPed(1, 3);
dawndelay();
break;
}
@ -949,8 +938,8 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) {
_vm->_sequence->startToClose();
return;
} else {
apped(1, 6);
tr[0]._facingDir = kDirRight; // added by TT 12/3/1995
appearPed(1, 6);
_sprites[0]._facingDir = kDirRight; // added by TT 12/3/1995
_vm->_sequence->firstShow(8);
_vm->_sequence->thenShow(9);
}
@ -968,19 +957,19 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) {
_vm->_sequence->startToOpen();
}
void Animation::newspeed() {
void Animation::updateSpeed() {
// Given that you've just changed the speed in triptype._speedX, this adjusts _moveX.
tr[0]._moveX = (tr[0]._moveX / 3) * tr[0]._speedX;
_sprites[0]._moveX = (_sprites[0]._moveX / 3) * _sprites[0]._speedX;
//setactivepage(3);
if (tr[0]._speedX == _vm->_gyro->kRun)
if (_sprites[0]._speedX == _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]._speedX == _vm->_gyro->kRun)
if (_sprites[0]._speedX == _vm->_gyro->kRun)
_vm->_graphics->_surface.drawLine(336, 199, 338, 199, kColorLightblue);
else
_vm->_graphics->_surface.drawLine(371, 199, 373, 199, kColorLightblue);
@ -988,129 +977,97 @@ void Animation::newspeed() {
//setactivepage(1 - cp);
}
void Animation::rwsp(byte t, byte dir) {
void Animation::changeDirection(byte t, byte dir) {
switch (dir) {
case kDirUp:
tr[t].speed(0, -tr[t]._speedY);
_sprites[t].speed(0, -_sprites[t]._speedY);
break;
case kDirDown:
tr[t].speed(0, tr[t]._speedY);
_sprites[t].speed(0, _sprites[t]._speedY);
break;
case kDirLeft:
tr[t].speed(-tr[t]._speedX, 0);
_sprites[t].speed(-_sprites[t]._speedX, 0);
break;
case kDirRight:
tr[t].speed(tr[t]._speedX, 0);
_sprites[t].speed(_sprites[t]._speedX, 0);
break;
case kDirUpLeft:
tr[t].speed(-tr[t]._speedX, -tr[t]._speedY);
_sprites[t].speed(-_sprites[t]._speedX, -_sprites[t]._speedY);
break;
case kDirUpRight:
tr[t].speed(tr[t]._speedX, -tr[t]._speedY);
_sprites[t].speed(_sprites[t]._speedX, -_sprites[t]._speedY);
break;
case kDirDownLeft:
tr[t].speed(-tr[t]._speedX, tr[t]._speedY);
_sprites[t].speed(-_sprites[t]._speedX, _sprites[t]._speedY);
break;
case kDirDownRight:
tr[t].speed(tr[t]._speedX, tr[t]._speedY);
_sprites[t].speed(_sprites[t]._speedX, _sprites[t]._speedY);
break;
}
}
void Animation::apped(byte trn, byte np) {
void Animation::appearPed(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
_sprites[trn].appear(_vm->_gyro->_peds[np]._x - _sprites[trn]._info._xLength / 2, _vm->_gyro->_peds[np]._y - _sprites[trn]._info._yLength, _vm->_gyro->_peds[np]._direction);
changeDirection(trn, _vm->_gyro->_peds[np]._direction);
}
// Eachstep procedures:
void Animation::follow_avvy_y(byte tripnum) {
if (tr[0]._facingDir == kDirLeft)
if (_sprites[0]._facingDir == kDirLeft)
return;
if (tr[tripnum]._homing)
tr[tripnum]._homingY = tr[1]._y;
if (_sprites[tripnum]._homing)
_sprites[tripnum]._homingY = _sprites[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;
if (_sprites[tripnum]._y < _sprites[1]._y)
_sprites[tripnum]._y += 1;
else if (_sprites[tripnum]._y > _sprites[1]._y)
_sprites[tripnum]._y -= 1;
else
return;
if (tr[tripnum]._moveX == 0) {
tr[tripnum]._stepNum += 1;
if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq)
tr[tripnum]._stepNum = 0;
tr[tripnum]._count = 0;
if (_sprites[tripnum]._moveX == 0) {
_sprites[tripnum]._stepNum += 1;
if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq)
_sprites[tripnum]._stepNum = 0;
_sprites[tripnum]._count = 0;
}
}
}
void Animation::back_and_forth(byte tripnum) {
if (!tr[tripnum]._homing) {
if (tr[tripnum]._facingDir == kDirRight)
tr[tripnum].walkTo(4);
if (!_sprites[tripnum]._homing) {
if (_sprites[tripnum]._facingDir == kDirRight)
_sprites[tripnum].walkTo(4);
else
tr[tripnum].walkTo(5);
_sprites[tripnum].walkTo(5);
}
}
void Animation::face_avvy(byte tripnum) {
if (!tr[tripnum]._homing) {
if (tr[0]._x >= tr[tripnum]._x)
tr[tripnum]._facingDir = kDirRight;
if (!_sprites[tripnum]._homing) {
if (_sprites[0]._x >= _sprites[tripnum]._x)
_sprites[tripnum]._facingDir = kDirRight;
else
tr[tripnum]._facingDir = kDirLeft;
_sprites[tripnum]._facingDir = kDirLeft;
}
}
void Animation::arrow_procs(byte tripnum) {
if (tr[tripnum]._homing) {
if (_sprites[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
if (((_sprites[tripnum]._y + _sprites[tripnum]._info._yLength) >= _sprites[0]._y) // A
&& (_sprites[tripnum]._x <= (_sprites[0]._x + _sprites[0]._info._xLength)) // B
&& ((_sprites[tripnum]._x + _sprites[tripnum]._info._xLength) >= _sprites[0]._x)) { // C
// OK, it's hit him... what now?
tr[1]._callEachStepFl = false; // prevent recursion.
_sprites[1]._callEachStepFl = false; // prevent recursion.
_vm->_visa->displayScrollChain('Q', 47); // Complaint!
tr[tripnum].done(); // Deallocate the arrow.
_sprites[tripnum].done(); // Deallocate the arrow.
#if 0
tr[1].done; { Deallocate normal pic of Avvy. }
@ -1128,7 +1085,7 @@ void Animation::arrow_procs(byte tripnum) {
_vm->_timer->addTimer(55, _vm->_timer->kProcNaughtyDuke, _vm->_timer->kReasonNaughtyDuke);
}
} else { // Arrow has hit the wall!
tr[tripnum].done(); // Deallocate the arrow.
_sprites[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.
}
@ -1152,41 +1109,41 @@ 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]._callEachStepFl = false;
tr[tripnum]._facingDir = kDirLeft;
tr[tripnum].stopWalk();
int16 tox = _sprites[0]._x + 17;
int16 toy = _sprites[0]._y - 1;
if ((_sprites[tripnum]._x == tox) && (_sprites[tripnum]._y == toy)) {
_sprites[tripnum]._callEachStepFl = false;
_sprites[tripnum]._facingDir = kDirLeft;
_sprites[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 (_sprites[tripnum]._x < tox) {
_sprites[tripnum]._x += 5;
if (_sprites[tripnum]._x > tox)
_sprites[tripnum]._x = tox;
}
if (tr[tripnum]._y < toy)
tr[tripnum]._y++;
tr[tripnum]._stepNum++;
if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq)
tr[tripnum]._stepNum = 0;
if (_sprites[tripnum]._y < toy)
_sprites[tripnum]._y++;
_sprites[tripnum]._stepNum++;
if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq)
_sprites[tripnum]._stepNum = 0;
}
}
void Animation::take_a_step(byte &tripnum) {
if (tr[tripnum]._moveX == 0) {
tr[tripnum]._stepNum++;
if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq)
tr[tripnum]._stepNum = 0;
tr[tripnum]._count = 0;
void Animation::takeAStep(byte &tripnum) {
if (_sprites[tripnum]._moveX == 0) {
_sprites[tripnum]._stepNum++;
if (_sprites[tripnum]._stepNum == _sprites[tripnum]._stat._seq)
_sprites[tripnum]._stepNum = 0;
_sprites[tripnum]._count = 0;
}
}
void Animation::spin(byte whichway, byte &tripnum) {
if (tr[tripnum]._facingDir != whichway) {
tr[tripnum]._facingDir = whichway;
if (tr[tripnum]._id == 2)
if (_sprites[tripnum]._facingDir != whichway) {
_sprites[tripnum]._facingDir = whichway;
if (_sprites[tripnum]._id == 2)
return; // Not for Spludwick
_vm->_gyro->_dna._geidaSpin += 1;
@ -1206,35 +1163,35 @@ void Animation::geida_procs(byte tripnum) {
_vm->_gyro->_dna._geidaSpin = 0;
}
if (tr[tripnum]._y < (tr[0]._y - 2)) {
if (_sprites[tripnum]._y < (_sprites[0]._y - 2)) {
// Geida is further from the screen than Avvy.
spin(kDirDown, tripnum);
tr[tripnum]._moveY = 1;
tr[tripnum]._moveX = 0;
take_a_step(tripnum);
_sprites[tripnum]._moveY = 1;
_sprites[tripnum]._moveX = 0;
takeAStep(tripnum);
return;
} else if (tr[tripnum]._y > (tr[0]._y + 2)) {
} else if (_sprites[tripnum]._y > (_sprites[0]._y + 2)) {
// Avvy is further from the screen than Geida.
spin(kDirUp, tripnum);
tr[tripnum]._moveY = -1;
tr[tripnum]._moveX = 0;
take_a_step(tripnum);
_sprites[tripnum]._moveY = -1;
_sprites[tripnum]._moveX = 0;
takeAStep(tripnum);
return;
}
tr[tripnum]._moveY = 0;
_sprites[tripnum]._moveY = 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]._speedX * 8 - 12) {
tr[tripnum]._moveX = tr[0]._speedX;
if (_sprites[tripnum]._x < _sprites[0]._x - _sprites[0]._speedX * 8 - 12) {
_sprites[tripnum]._moveX = _sprites[0]._speedX;
spin(kDirRight, tripnum);
take_a_step(tripnum);
} else if (tr[tripnum]._x > tr[0]._x + tr[0]._speedX * 8 + 12) {
tr[tripnum]._moveX = -tr[0]._speedX;
takeAStep(tripnum);
} else if (_sprites[tripnum]._x > _sprites[0]._x + _sprites[0]._speedX * 8 + 12) {
_sprites[tripnum]._moveX = -_sprites[0]._speedX;
spin(kDirLeft, tripnum);
take_a_step(tripnum);
takeAStep(tripnum);
} else
tr[tripnum]._moveX = 0;
_sprites[tripnum]._moveX = 0;
}
// That's all...
@ -1248,7 +1205,7 @@ void Animation::call_andexors() {
order[i] = -1;
for (int16 i = 0; i < kSpriteNumbMax; i++) {
if (tr[i]._quick && tr[i]._visible)
if (_sprites[i]._quick && _sprites[i]._visible)
order[i] = i;
}
@ -1256,7 +1213,7 @@ void Animation::call_andexors() {
ok = true;
for (byte i = 0; i < 4; i++) {
if (((order[i] != -1) && (order[i + 1] != -1))
&& (tr[order[i]]._y > tr[order[i + 1]]._y)) {
&& (_sprites[order[i]]._y > _sprites[order[i + 1]]._y)) {
// Swap them!
temp = order[i];
order[i] = order[i + 1];
@ -1271,7 +1228,7 @@ void Animation::call_andexors() {
for (byte i = 0; i < 5; i++) {
if (order[i] > -1)
tr[order[i]].andexor();
_sprites[order[i]].andexor();
}
}
@ -1283,15 +1240,15 @@ void Animation::animLink() {
if (_vm->_gyro->_dropdownActive | _vm->_gyro->_onToolbar | _vm->_gyro->_seeScroll)
return;
for (int16 i = 0; i < kSpriteNumbMax; i++) {
if (tr[i]._quick && tr[i]._visible)
tr[i].walk();
if (_sprites[i]._quick && _sprites[i]._visible)
_sprites[i].walk();
}
call_andexors();
for (int16 i = 0; i < kSpriteNumbMax; i++) {
if (tr[i]._quick && tr[i]._callEachStepFl) {
switch (tr[i]._eachStepProc) {
if (_sprites[i]._quick && _sprites[i]._callEachStepFl) {
switch (_sprites[i]._eachStepProc) {
case kProcFollowAvvyY :
follow_avvy_y(i);
break;
@ -1315,35 +1272,17 @@ void Animation::animLink() {
}
}
if (mustexclaim) {
mustexclaim = false;
_vm->_visa->displayScrollChain('x', saywhat);
if (_mustExclaim) {
_mustExclaim = false;
_vm->_visa->displayScrollChain('x', _sayWhat);
}
}
void Animation::get_back_loretta() {
for (int16 i = 0; i < kSpriteNumbMax; i++) {
if (tr[i]._quick) {
getback();
return;
}
}
// for fv:=0 to 1 do begin cp:=1-cp; getback; end;
}
void Animation::stopWalking() {
tr[0].stopWalk();
_sprites[0].stopWalk();
_vm->_gyro->_dna._direction = kDirStopped;
if (_vm->_gyro->_alive)
tr[0]._stepNum = 1;
}
void Animation::tripkey(char dir) {
warning("Replaced by Trip::handleMoveKey!");
}
void Animation::readstick() {
warning("STUB: Trip::readstick()");
_sprites[0]._stepNum = 1;
}
/**
@ -1355,9 +1294,9 @@ void Animation::hideInCupboard() {
if (_vm->_gyro->_dna._wearing == Acci::kNothing)
_vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlItalic) + "AVVY!" + _vm->_scrolls->kControlRoman + "Get dressed first!");
else {
tr[0]._visible = true;
_sprites[0]._visible = true;
_vm->_gyro->_dna._userMovesAvvy = true;
apped(1, 3); // Walk out of the cupboard.
appearPed(1, 3); // Walk out of the cupboard.
_vm->_scrolls->displayText("You leave the cupboard. Nice to be out of there!");
_vm->_gyro->_dna._avvysInTheCupboard = false;
_vm->_sequence->firstShow(8);
@ -1366,7 +1305,7 @@ void Animation::hideInCupboard() {
}
} else {
// Not hiding in the cupboard
tr[0]._visible = false;
_sprites[0]._visible = false;
_vm->_gyro->_dna._userMovesAvvy = false;
_vm->_scrolls->displayText(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.");
@ -1375,11 +1314,11 @@ void Animation::hideInCupboard() {
}
}
void Animation::fliproom(byte room, byte ped) {
void Animation::flipRoom(byte room, byte ped) {
if (!_vm->_gyro->_alive) {
// You can't leave the room if you're dead.
tr[0]._moveX = 0;
tr[0]._moveY = 0; // Stop him from moving.
_sprites[0]._moveX = 0;
_sprites[0]._moveY = 0; // Stop him from moving.
return;
}
@ -1390,7 +1329,7 @@ void Animation::fliproom(byte room, byte ped) {
if ((_vm->_gyro->_dna._jumpStatus > 0) && (_vm->_gyro->_dna._room == r__insidecardiffcastle)) {
// You can't *jump* out of Cardiff Castle!
tr[0]._moveX = 0;
_sprites[0]._moveX = 0;
return;
}
@ -1398,48 +1337,44 @@ void Animation::fliproom(byte room, byte ped) {
_vm->_lucerna->dusk();
for (int16 i = 1; i < kSpriteNumbMax; i++) {
if (tr[i]._quick)
tr[i].done();
if (_sprites[i]._quick)
_sprites[i].done();
} // Deallocate sprite
if (_vm->_gyro->_dna._room == r__lustiesroom)
_vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true;
_vm->_lucerna->enterRoom(room, ped);
apped(1, ped);
appearPed(1, ped);
_vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false;
_vm->_gyro->_oldDirection = _vm->_gyro->_dna._direction;
_vm->_gyro->_dna._direction = tr[0]._facingDir;
_vm->_gyro->_dna._direction = _sprites[0]._facingDir;
_vm->_lucerna->drawDirection();
for (byte i = 0; i <= 1; i++) {
_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) {
bool Animation::inField(byte which) {
which--; // Pascal -> C: different array indexes.
int16 yy = tr[0]._y + tr[0]._info._yLength;
int16 yy = _sprites[0]._y + _sprites[0]._info._yLength;
return (tr[0]._x >= _vm->_gyro->_fields[which]._x1) && (tr[0]._x <= _vm->_gyro->_fields[which]._x2)
return (_sprites[0]._x >= _vm->_gyro->_fields[which]._x1) && (_sprites[0]._x <= _vm->_gyro->_fields[which]._x2)
&& (yy >= _vm->_gyro->_fields[which]._y1) && (yy <= _vm->_gyro->_fields[which]._y2);
}
bool Animation::neardoor() {
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;
int16 ux = _sprites[0]._x;
int16 uy = _sprites[0]._y + _sprites[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)
@ -1448,10 +1383,6 @@ bool Animation::neardoor() {
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;
@ -1463,56 +1394,56 @@ void Animation::handleMoveKey(const Common::Event &event) {
case Common::KEYCODE_UP:
if (_vm->_gyro->_dna._direction != kDirUp) {
_vm->_gyro->_dna._direction = kDirUp;
rwsp(0, _vm->_gyro->_dna._direction);
changeDirection(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);
changeDirection(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);
changeDirection(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);
changeDirection(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);
changeDirection(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);
changeDirection(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);
changeDirection(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);
changeDirection(0, _vm->_gyro->_dna._direction);
} else
stopWalking();
break;

View File

@ -118,39 +118,28 @@ public:
~Animation();
void animLink();
void get_back_loretta();
void loadtrip();
void call_special(uint16 which);
void loadAnims(); // Original: loadtrip().
void callSpecial(uint16 which);
void openDoor(byte whither, byte ped, byte magicnum); // Handles slidey-open doors.
void catamove(byte ped);
void catacombMove(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.
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 changeDirection(byte t, byte dir);
void appearPed(byte trn, byte np);
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 updateSpeed();
void handleMoveKey(const Common::Event &event); // To replace tripkey().
AnimationType tr[kSpriteNumbMax];
byte aa[1600];
AnimationType _sprites[kSpriteNumbMax];
bool mustexclaim;
uint16 saywhat;
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 checkFeet(int16 x1, int16 x2, int16 oy, int16 y, byte yl);
byte geida_ped(byte which);
void dawndelay();
void hideInCupboard();
@ -160,7 +149,10 @@ private:
void arrow_procs(byte tripnum);
void grab_avvy(byte tripnum);
void spin(byte whichway, byte &tripnum);
void takeAStep(byte &tripnum);
void geida_procs(byte tripnum);
void call_andexors();
};

View File

@ -283,7 +283,7 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
byte spriteNum = 0;
if (sz.isSaving()) {
for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) {
if (_animation->tr[i]._quick)
if (_animation->_sprites[i]._quick)
spriteNum++;
}
}
@ -291,43 +291,43 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) {
if (sz.isLoading()) {
for (int16 i = 0; i < _animation->kSpriteNumbMax; i++) { // Deallocate sprites.
if (_animation->tr[i]._quick)
_animation->tr[i].done();
if (_animation->_sprites[i]._quick)
_animation->_sprites[i].done();
}
}
for (byte i = 0; i < spriteNum; i++) {
sz.syncAsByte(_animation->tr[i]._id);
sz.syncAsByte(_animation->tr[i]._doCheck);
sz.syncAsByte(_animation->_sprites[i]._id);
sz.syncAsByte(_animation->_sprites[i]._doCheck);
if (sz.isLoading()) {
_animation->tr[i]._quick = true;
_animation->tr[i].init(_animation->tr[i]._id, _animation->tr[i]._doCheck, _animation);
_animation->_sprites[i]._quick = true;
_animation->_sprites[i].init(_animation->_sprites[i]._id, _animation->_sprites[i]._doCheck, _animation);
}
sz.syncAsByte(_animation->tr[i]._moveX);
sz.syncAsByte(_animation->tr[i]._moveY);
sz.syncAsByte(_animation->tr[i]._facingDir);
sz.syncAsByte(_animation->tr[i]._stepNum);
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]._speedX);
sz.syncAsByte(_animation->tr[i]._speedY);
sz.syncAsByte(_animation->tr[i]._animCount);
sz.syncAsSint16LE(_animation->tr[i]._homingX);
sz.syncAsSint16LE(_animation->tr[i]._homingY);
sz.syncAsByte(_animation->tr[i]._callEachStepFl);
sz.syncAsByte(_animation->tr[i]._eachStepProc);
sz.syncAsByte(_animation->tr[i]._vanishIfStill);
sz.syncAsByte(_animation->_sprites[i]._moveX);
sz.syncAsByte(_animation->_sprites[i]._moveY);
sz.syncAsByte(_animation->_sprites[i]._facingDir);
sz.syncAsByte(_animation->_sprites[i]._stepNum);
sz.syncAsByte(_animation->_sprites[i]._visible);
sz.syncAsByte(_animation->_sprites[i]._homing);
sz.syncAsByte(_animation->_sprites[i]._count);
sz.syncAsByte(_animation->_sprites[i]._info._xWidth);
sz.syncAsByte(_animation->_sprites[i]._speedX);
sz.syncAsByte(_animation->_sprites[i]._speedY);
sz.syncAsByte(_animation->_sprites[i]._animCount);
sz.syncAsSint16LE(_animation->_sprites[i]._homingX);
sz.syncAsSint16LE(_animation->_sprites[i]._homingY);
sz.syncAsByte(_animation->_sprites[i]._callEachStepFl);
sz.syncAsByte(_animation->_sprites[i]._eachStepProc);
sz.syncAsByte(_animation->_sprites[i]._vanishIfStill);
sz.syncAsSint16LE(_animation->tr[i]._x);
sz.syncAsSint16LE(_animation->tr[i]._y);
sz.syncAsSint16LE(_animation->_sprites[i]._x);
sz.syncAsSint16LE(_animation->_sprites[i]._y);
if (sz.isLoading() && _animation->tr[i]._visible)
_animation->tr[i].appear(_animation->tr[i]._x, _animation->tr[i]._y, _animation->tr[i]._facingDir);
if (sz.isLoading() && _animation->_sprites[i]._visible)
_animation->_sprites[i].appear(_animation->_sprites[i]._x, _animation->_sprites[i]._y, _animation->_sprites[i]._facingDir);
}
//groi = 177;
@ -470,7 +470,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {
_lucerna->refreshObjectList();
_animation->newspeed();
_animation->updateSpeed();
_lucerna->drawDirection();
@ -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 (_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.
if (_animation->_sprites[0]._quick && _animation->_sprites[0]._visible)
_animation->changeDirection(0, _gyro->_dna._direction); // We push Avvy in the right direction is he was moving.
return true;
}

View File

@ -156,15 +156,14 @@ void Avalot::setup() {
for (byte i = 0; i < 3; i++)
_vm->_gyro->_scoreToDisplay[i] = -1; // Impossible digits.
_vm->_animation->loadtrip();
_vm->_animation->loadAnims();
_vm->_animation->get_back_loretta();
_vm->_gyro->_holdTheDawn = false;
_vm->_lucerna->dawn();
_vm->_parser->_cursorState = false;
_vm->_parser->cursorOn();
_vm->_animation->tr[0]._speedX = _vm->_gyro->kWalk;
_vm->_animation->newspeed();
_vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk;
_vm->_animation->updateSpeed();
@ -201,7 +200,6 @@ void Avalot::run(Common::String arg) {
_vm->_lucerna->_clock.update();
_vm->_dropdown->updateMenu();
_vm->_gyro->forceNumlock();
_vm->_animation->get_back_loretta();
_vm->_celer->updateBackgroundSprites();
_vm->_animation->animLink();
_vm->_lucerna->checkClick();

View File

@ -449,12 +449,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->_animation->neardoor());
_activeMenuItem.setupOption("Journey thither", 'J', "f7", _vm->_animation->nearDoor());
else
_activeMenuItem.setupOption("Open the door", 'O', "f7", _vm->_animation->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->_animation->tr[0]._speedX == _vm->_gyro->kWalk)
if (_vm->_animation->_sprites[0]._speedX == _vm->_gyro->kWalk)
_activeMenuItem.setupOption("Run fast", 'R', "^R", true);
else
_activeMenuItem.setupOption("Walk slowly", 'W', "^W", true);
@ -624,11 +624,11 @@ void Dropdown::runMenuAction() {
_vm->_lucerna->callVerb(_vm->_acci->kVerbCodeInv);
break;
case 5: {
if (_vm->_animation->tr[0]._speedX == _vm->_gyro->kWalk)
_vm->_animation->tr[0]._speedX = _vm->_gyro->kRun;
if (_vm->_animation->_sprites[0]._speedX == _vm->_gyro->kWalk)
_vm->_animation->_sprites[0]._speedX = _vm->_gyro->kRun;
else
_vm->_animation->tr[0]._speedX = _vm->_gyro->kWalk;
_vm->_animation->newspeed();
_vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk;
_vm->_animation->updateSpeed();
}
break;
}

View File

@ -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->_animation->tr[i]._quick)
_vm->_animation->tr[i].done();
if (_vm->_animation->_sprites[i]._quick)
_vm->_animation->_sprites[i].done();
}
// Deallocate sprite. Sorry, beta testers!
_vm->_animation->tr[0].init(0, true, _vm->_animation);
_vm->_animation->_sprites[0].init(0, true, _vm->_animation);
_alive = true;
_score = 0;
@ -257,7 +257,7 @@ void Gyro::newGame() {
_onToolbar = false;
_seeScroll = false;
_vm->_animation->tr[0].appear(300,117,kDirectionRight); // Needed to initialize Avalot.
_vm->_animation->_sprites[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;
@ -270,13 +270,8 @@ void Gyro::newGame() {
_dna._avvyInBed = true;
_enidFilename = "";
for (byte i = 0; i <= 1; i++) {
_cp = 1 - _cp;
_vm->_animation->getback();
}
_vm->_lucerna->enterRoom(1, 1);
_vm->_animation->new_game_for_trippancy();
_vm->_animation->_sprites[0]._visible = false;
_vm->_lucerna->drawScore();
_vm->_dropdown->setupMenu();
_vm->_lucerna->_clock.update();
@ -454,7 +449,7 @@ Common::String Gyro::f5Does() {
return Common::String(_vm->_acci->kVerbCodeSit) + "SSit down";
break;
case r__musicroom:
if (_vm->_animation->infield(7))
if (_vm->_animation->inField(7))
return Common::String(_vm->_acci->kVerbCodePlay) + "PPlay the harp";
break;
}

View File

@ -400,10 +400,10 @@ void Lucerna::enterNewTown() {
void Lucerna::putGeidaAt(byte whichPed, byte &ped) {
if (ped == 0)
return;
_vm->_animation->tr[1].init(5, false, _vm->_animation); // load Geida
_vm->_animation->apped(2, whichPed);
_vm->_animation->tr[1]._callEachStepFl = true;
_vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGeida;
_vm->_animation->_sprites[1].init(5, false, _vm->_animation); // load Geida
_vm->_animation->appearPed(2, whichPed);
_vm->_animation->_sprites[1]._callEachStepFl = true;
_vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGeida;
}
void Lucerna::enterRoom(byte room, byte ped) {
@ -445,25 +445,25 @@ void Lucerna::enterRoom(byte room, byte ped) {
if (! _vm->_gyro->_dna._talkedToCrapulus) {
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__outsideyours;
_vm->_animation->tr[1].init(8, false, _vm->_animation); // load Crapulus
_vm->_animation->_sprites[1].init(8, false, _vm->_animation); // load Crapulus
if (_vm->_gyro->_dna._roomCount[r__outsideyours] == 1) {
_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.
_vm->_animation->appearPed(2, 4); // Start on the right-hand side of the screen.
_vm->_animation->_sprites[1].walkTo(5); // Walks up to greet you.
} else {
_vm->_animation->apped(2, 5); // Starts where he was before.
_vm->_animation->tr[1]._facingDir = Animation::kDirLeft;
_vm->_animation->appearPed(2, 5); // Starts where he was before.
_vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft;
}
_vm->_animation->tr[1]._callEachStepFl = true;
_vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // He always faces Avvy.
_vm->_animation->_sprites[1]._callEachStepFl = true;
_vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // He always faces Avvy.
} else _vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = r__nowhere;
if (_vm->_gyro->_dna._crapulusWillTell) {
_vm->_animation->tr[1].init(8, false, _vm->_animation);
_vm->_animation->apped(2, 2);
_vm->_animation->tr[1].walkTo(4);
_vm->_animation->_sprites[1].init(8, false, _vm->_animation);
_vm->_animation->appearPed(2, 2);
_vm->_animation->_sprites[1].walkTo(4);
_vm->_timer->addTimer(20, _vm->_timer->kProcCrapulusSpludOut, _vm->_timer->kReasonCrapulusSaysSpludwickOut);
_vm->_gyro->_dna._crapulusWillTell = false;
}
@ -480,15 +480,15 @@ void Lucerna::enterRoom(byte room, byte ped) {
case r__spludwicks:
if (_vm->_gyro->_dna._spludwickAtHome) {
if (ped > 0) {
_vm->_animation->tr[1].init(2, false, _vm->_animation); // load Spludwick
_vm->_animation->apped(2, 2);
_vm->_animation->_sprites[1].init(2, false, _vm->_animation); // load Spludwick
_vm->_animation->appearPed(2, 2);
_vm->_gyro->_whereIs[1] = r__spludwicks;
}
_vm->_gyro->_dna._dogFoodPos = 0; // _vm->_gyro->also Spludwick pos.
_vm->_animation->tr[1]._callEachStepFl = true;
_vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGeida;
_vm->_animation->_sprites[1]._callEachStepFl = true;
_vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGeida;
} else
_vm->_gyro->_whereIs[1] = r__nowhere;
break;
@ -501,18 +501,18 @@ void Lucerna::enterRoom(byte room, byte ped) {
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__nowhere;
} else {
if (ped > 0) {
_vm->_animation->tr[1].init(4, false, _vm->_animation); // 4 = Cwytalot
_vm->_animation->tr[1]._callEachStepFl = true;
_vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcFollowAvvyY;
_vm->_animation->_sprites[1].init(4, false, _vm->_animation); // 4 = Cwytalot
_vm->_animation->_sprites[1]._callEachStepFl = true;
_vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFollowAvvyY;
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleCwytalot - 150] = r__brummieroad;
if (_vm->_gyro->_dna._roomCount[r__brummieroad] == 1) { // First time here...
_vm->_animation->apped(2, 2); // He appears on the right of the screen...
_vm->_animation->tr[1].walkTo(4); // ...and he walks up...
_vm->_animation->appearPed(2, 2); // He appears on the right of the screen...
_vm->_animation->_sprites[1].walkTo(4); // ...and he walks up...
} else {
// You've been here before.
_vm->_animation->apped(2, 4); // He's standing in your way straight away...
_vm->_animation->tr[1]._facingDir = Animation::kDirLeft;
_vm->_animation->appearPed(2, 4); // He's standing in your way straight away...
_vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft;
}
}
}
@ -521,10 +521,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->_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->_animation->_sprites[1].init(4, false, _vm->_animation); // 4 = Cwytalot again
_vm->_animation->appearPed(2, 1);
_vm->_animation->_sprites[1].walkTo(2);
_vm->_animation->_sprites[1]._vanishIfStill = true;
_vm->_gyro->_dna._passedCwytalotInHerts = true;
// _vm->_gyro->whereis[#157] = r__Nowhere; // can we fit this in?
_vm->_timer->addTimer(20, _vm->_timer->kProcCwytalotInHerts, _vm->_timer->kReasonCwytalotInHerts);
@ -545,9 +545,9 @@ void Lucerna::enterRoom(byte room, byte ped) {
if (ped > 0) {
if (! _vm->_gyro->_dna._beenTiedUp) {
// A welcome party... or maybe not...
_vm->_animation->tr[1].init(6, false, _vm->_animation);
_vm->_animation->apped(2, 2);
_vm->_animation->tr[1].walkTo(3);
_vm->_animation->_sprites[1].init(6, false, _vm->_animation);
_vm->_animation->appearPed(2, 2);
_vm->_animation->_sprites[1].walkTo(3);
_vm->_timer->addTimer(36, _vm->_timer->kProcGetTiedUp, _vm->_timer->kReasonGettingTiedUp);
}
}
@ -569,9 +569,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->_animation->tr[1].init(9, false, _vm->_animation);
_vm->_animation->apped(2, 2);
_vm->_animation->tr[1].walkTo(3);
_vm->_animation->_sprites[1].init(9, false, _vm->_animation);
_vm->_animation->appearPed(2, 2);
_vm->_animation->_sprites[1].walkTo(3);
_vm->_timer->addTimer(47, _vm->_timer->kProcCardiffSurvey, _vm->_timer->kReasonCardiffsurvey);
}
break;
@ -579,9 +579,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->_animation->tr[1].init(9, false, _vm->_animation);
_vm->_animation->apped(2, 3);
_vm->_animation->tr[1]._facingDir = Animation::kDirRight;
_vm->_animation->_sprites[1].init(9, false, _vm->_animation);
_vm->_animation->appearPed(2, 3);
_vm->_animation->_sprites[1]._facingDir = Animation::kDirRight;
_vm->_timer->addTimer(3, _vm->_timer->kProcCardiffReturn, _vm->_timer->kReasonCardiffsurvey);
}
}
@ -631,7 +631,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
}
_vm->_gyro->_dna._enterCatacombsFromLustiesRoom = true;
_vm->_animation->catamove(ped);
_vm->_animation->catacombMove(ped);
_vm->_gyro->_dna._enterCatacombsFromLustiesRoom = false;
}
break;
@ -649,7 +649,7 @@ void Lucerna::enterRoom(byte room, byte ped) {
case r__lustiesroom:
_vm->_gyro->_dna._dogFoodPos = 1; // Actually, du Lustie pos.
if (_vm->_animation->tr[0]._id == 0) // Avvy in his normal clothes
if (_vm->_animation->_sprites[0]._id == 0) // Avvy in his normal clothes
_vm->_timer->addTimer(3, _vm->_timer->kProcCallsGuards, _vm->_timer->kReasonDuLustieTalks);
else if (! _vm->_gyro->_dna._enteredLustiesRoomAsMonk) // already
// Presumably, Avvy dressed as a monk.
@ -707,22 +707,22 @@ void Lucerna::enterRoom(byte room, byte ped) {
break;
case r__wisewomans:
_vm->_animation->tr[1].init(11, false, _vm->_animation);
_vm->_animation->_sprites[1].init(11, false, _vm->_animation);
if ((_vm->_gyro->_dna._roomCount[r__wisewomans] == 1) && (ped > 0)) {
_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.
_vm->_animation->appearPed(2, 2); // Start on the right-hand side of the screen.
_vm->_animation->_sprites[1].walkTo(4); // Walks up to greet you.
} else {
_vm->_animation->apped(2, 4); // Starts where she was before.
_vm->_animation->tr[1]._facingDir = Animation::kDirLeft;
_vm->_animation->appearPed(2, 4); // Starts where she was before.
_vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft;
}
_vm->_animation->tr[1]._callEachStepFl = true;
_vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // She always faces Avvy.
_vm->_animation->_sprites[1]._callEachStepFl = true;
_vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcFaceAvvy; // She always faces Avvy.
break;
case r__insidecardiffcastle:
if (ped > 0) {
_vm->_animation->tr[1].init(10, false, _vm->_animation); // Define the dart.
_vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart.
_vm->_celer->drawBackgroundSprite(-1, -1, 1);
_vm->_graphics->refreshBackground();
_vm->_sequence->firstShow(1);
@ -972,22 +972,22 @@ void Lucerna::useCompass(const Common::Point &cursorPos) {
switch (color) {
case kColorGreen:
_vm->_gyro->_dna._direction = Animation::kDirUp;
_vm->_animation->rwsp(0, Animation::kDirUp);
_vm->_animation->changeDirection(0, Animation::kDirUp);
drawDirection();
break;
case kColorBrown:
_vm->_gyro->_dna._direction = Animation::kDirDown;
_vm->_animation->rwsp(0, Animation::kDirDown);
_vm->_animation->changeDirection(0, Animation::kDirDown);
drawDirection();
break;
case kColorCyan:
_vm->_gyro->_dna._direction = Animation::kDirLeft;
_vm->_animation->rwsp(0, Animation::kDirLeft);
_vm->_animation->changeDirection(0, Animation::kDirLeft);
drawDirection();
break;
case kColorLightmagenta:
_vm->_gyro->_dna._direction = Animation::kDirRight;
_vm->_animation->rwsp(0, Animation::kDirRight);
_vm->_animation->changeDirection(0, Animation::kDirRight);
drawDirection();
break;
case kColorRed:
@ -1025,16 +1025,16 @@ void Lucerna::guideAvvy(Common::Point cursorPos) {
byte what;
// _vm->_animation->tr[0] is Avalot.)
if (cursorPos.x < _vm->_animation->tr[0]._x)
if (cursorPos.x < _vm->_animation->_sprites[0]._x)
what = 1;
else if (cursorPos.x > (_vm->_animation->tr[0]._x + _vm->_animation->tr[0]._info._xLength))
else if (cursorPos.x > (_vm->_animation->_sprites[0]._x + _vm->_animation->_sprites[0]._info._xLength))
what = 2;
else
what = 0; // On top
if (cursorPos.y < _vm->_animation->tr[0]._y)
if (cursorPos.y < _vm->_animation->_sprites[0]._y)
what += 3;
else if (cursorPos.y > (_vm->_animation->tr[0]._y + _vm->_animation->tr[0]._info._yLength))
else if (cursorPos.y > (_vm->_animation->_sprites[0]._y + _vm->_animation->_sprites[0]._info._yLength))
what += 6;
switch (what) {
@ -1042,28 +1042,28 @@ void Lucerna::guideAvvy(Common::Point cursorPos) {
_vm->_animation->stopWalking();
break; // Clicked on Avvy: no movement.
case 1:
_vm->_animation->rwsp(0, Animation::kDirLeft);
_vm->_animation->changeDirection(0, Animation::kDirLeft);
break;
case 2:
_vm->_animation->rwsp(0, Animation::kDirRight);
_vm->_animation->changeDirection(0, Animation::kDirRight);
break;
case 3:
_vm->_animation->rwsp(0, Animation::kDirUp);
_vm->_animation->changeDirection(0, Animation::kDirUp);
break;
case 4:
_vm->_animation->rwsp(0, Animation::kDirUpLeft);
_vm->_animation->changeDirection(0, Animation::kDirUpLeft);
break;
case 5:
_vm->_animation->rwsp(0, Animation::kDirUpRight);
_vm->_animation->changeDirection(0, Animation::kDirUpRight);
break;
case 6:
_vm->_animation->rwsp(0, Animation::kDirDown);
_vm->_animation->changeDirection(0, Animation::kDirDown);
break;
case 7:
_vm->_animation->rwsp(0, Animation::kDirDownLeft);
_vm->_animation->changeDirection(0, Animation::kDirDownLeft);
break;
case 8:
_vm->_animation->rwsp(0, Animation::kDirDownRight);
_vm->_animation->changeDirection(0, Animation::kDirDownRight);
break;
} // No other values are possible.
@ -1128,11 +1128,11 @@ void Lucerna::checkClick() {
callVerb(_vm->_acci->kVerbCodeScore);
} else if ((320 <= cursorPos.x) && (cursorPos.x <= 357)) { // Change speed.
_vm->_animation->tr[0]._speedX = _vm->_gyro->kWalk;
_vm->_animation->newspeed();
_vm->_animation->_sprites[0]._speedX = _vm->_gyro->kWalk;
_vm->_animation->updateSpeed();
} else if ((358 <= cursorPos.x) && (cursorPos.x <= 395)) { // Change speed.
_vm->_animation->tr[0]._speedX = _vm->_gyro->kRun;
_vm->_animation->newspeed();
_vm->_animation->_sprites[0]._speedX = _vm->_gyro->kRun;
_vm->_animation->updateSpeed();
} else if ((396 <= cursorPos.x) && (cursorPos.x <= 483))
fxToggle();
else if ((535 <= cursorPos.x) && (cursorPos.x <= 640))
@ -1182,13 +1182,13 @@ void Lucerna::drawDirection() { // It's data is loaded in load_digits().
void Lucerna::gameOver() {
_vm->_gyro->_dna._userMovesAvvy = false;
int16 sx = _vm->_animation->tr[0]._x;
int16 sy = _vm->_animation->tr[0]._y;
int16 sx = _vm->_animation->_sprites[0]._x;
int16 sy = _vm->_animation->_sprites[0]._y;
_vm->_animation->tr[0].done();
_vm->_animation->tr[0].init(12, true, _vm->_animation); // 12 = Avalot falls
_vm->_animation->tr[0]._stepNum = 0;
_vm->_animation->tr[0].appear(sx, sy, 0);
_vm->_animation->_sprites[0].done();
_vm->_animation->_sprites[0].init(12, true, _vm->_animation); // 12 = Avalot falls
_vm->_animation->_sprites[0]._stepNum = 0;
_vm->_animation->_sprites[0].appear(sx, sy, 0);
_vm->_timer->addTimer(3, _vm->_timer->kProcAvalotFalls, _vm->_timer->kReasonFallingOver);
_vm->_gyro->_alive = false;
@ -1199,11 +1199,6 @@ void Lucerna::minorRedraw() {
enterRoom(_vm->_gyro->_dna._room, 0); // Ped unknown or non-existant.
for (byte i = 0; i <= 1; i++) {
_vm->_gyro->_cp = 1 - _vm->_gyro->_cp;
_vm->_animation->getback();
}
for (byte i = 0; i < 3; i++)
_vm->_gyro->_scoreToDisplay[i] = -1; // impossible digits
drawScore();
@ -1220,23 +1215,20 @@ uint16 Lucerna::bearing(byte whichPed) {
const double rad2deg = 180 / 3.14; // Pi
if (_vm->_animation->tr[0]._x == _vm->_gyro->_peds[pedId]._x)
if (_vm->_animation->_sprites[0]._x == _vm->_gyro->_peds[pedId]._x)
return 0;
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 if (_vm->_animation->_sprites[0]._x < _vm->_gyro->_peds[pedId]._x) {
return (uint16)((atan(double((_vm->_animation->_sprites[0]._y - _vm->_gyro->_peds[pedId]._y))
/ (_vm->_animation->_sprites[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90);
} else {
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);
return (uint16)((atan(double((_vm->_animation->_sprites[0]._y - _vm->_gyro->_peds[pedId]._y))
/ (_vm->_animation->_sprites[0]._x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270);
}
}
void Lucerna::spriteRun() {
_vm->_gyro->_doingSpriteRun = true;
_vm->_animation->get_back_loretta();
_vm->_animation->animLink();
_vm->_gyro->_doingSpriteRun = false;
}

View File

@ -665,11 +665,11 @@ void Scrolls::callScrollDriver() {
if (_param == 0)
setBubbleStateNatural();
else if ((1 <= _param) && (_param <= 9)) {
if ((_param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->tr[_param - 1]._quick)) { // Not valid.
if ((_param > _vm->_animation->kSpriteNumbMax) || (!_vm->_animation->_sprites[_param - 1]._quick)) { // Not valid.
_vm->_lucerna->errorLed();
setBubbleStateNatural();
} else
_vm->_animation->tr[_param - 1].chatter(); // Normal sprite talking routine.
_vm->_animation->_sprites[_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

View File

@ -90,7 +90,7 @@ void Sequence::callSequencer() {
break;
case 177: // Flip room.
_vm->_gyro->_dna._userMovesAvvy = true;
_vm->_animation->fliproom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed);
_vm->_animation->flipRoom(_vm->_gyro->_dna._flipToWhere, _vm->_gyro->_dna._flipToPed);
if (_seq[0] == 177)
shoveLeft();
break;

View File

@ -253,7 +253,7 @@ void Timer::avariciusTalks() {
}
void Timer::urinate() {
_vm->_animation->tr[0].turn(Animation::kDirUp);
_vm->_animation->_sprites[0].turn(Animation::kDirUp);
_vm->_animation->stopWalking();
_vm->_lucerna->drawDirection();
addTimer(14, kProcToilet, kReasonGoToToilet);
@ -274,7 +274,7 @@ void Timer::bang2() {
void Timer::stairs() {
_vm->_gyro->blip();
_vm->_animation->tr[0].walkTo(4);
_vm->_animation->_sprites[0].walkTo(4);
_vm->_celer->drawBackgroundSprite(-1, -1, 2);
_vm->_gyro->_dna._brummieStairs = 2;
_vm->_gyro->_magics[10]._operation = _vm->_gyro->kMagicSpecial;
@ -307,38 +307,38 @@ void Timer::getTiedUp() {
_vm->_gyro->_dna._userMovesAvvy = false;
_vm->_gyro->_dna._beenTiedUp = true;
_vm->_animation->stopWalking();
_vm->_animation->tr[1].stopWalk();
_vm->_animation->tr[1].stophoming();
_vm->_animation->tr[1]._callEachStepFl = true;
_vm->_animation->tr[1]._eachStepProc = _vm->_animation->kProcGrabAvvy;
_vm->_animation->_sprites[1].stopWalk();
_vm->_animation->_sprites[1].stophoming();
_vm->_animation->_sprites[1]._callEachStepFl = true;
_vm->_animation->_sprites[1]._eachStepProc = _vm->_animation->kProcGrabAvvy;
addTimer(70, kProcGetTiedUp2, kReasonGettingTiedUp);
}
void Timer::getTiedUp2() {
_vm->_animation->tr[0].walkTo(4);
_vm->_animation->tr[1].walkTo(5);
_vm->_animation->_sprites[0].walkTo(4);
_vm->_animation->_sprites[1].walkTo(5);
_vm->_gyro->_magics[3]._operation = _vm->_gyro->kMagicNothing; // No effect when you touch the boundaries.
_vm->_gyro->_dna._friarWillTieYouUp = true;
}
void Timer::hangAround() {
_vm->_animation->tr[1]._doCheck = false;
_vm->_animation->tr[0].init(7, true, _vm->_animation); // Robin Hood
_vm->_animation->_sprites[1]._doCheck = false;
_vm->_animation->_sprites[0].init(7, true, _vm->_animation); // Robin Hood
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleRobinHood - 150] = r__robins;
_vm->_animation->apped(1, 2);
_vm->_animation->appearPed(1, 2);
_vm->_visa->displayScrollChain('q', 39);
_vm->_animation->tr[0].walkTo(7);
_vm->_animation->_sprites[0].walkTo(7);
addTimer(55, kProcHangAround2, kReasonHangingAround);
}
void Timer::hangAround2() {
_vm->_visa->displayScrollChain('q', 40);
_vm->_animation->tr[1]._vanishIfStill = false;
_vm->_animation->tr[1].walkTo(4);
_vm->_animation->_sprites[1]._vanishIfStill = false;
_vm->_animation->_sprites[1].walkTo(4);
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleFriarTuck - 150] = r__robins;
_vm->_visa->displayScrollChain('q', 41);
_vm->_animation->tr[0].done();
_vm->_animation->tr[1].done(); // Get rid of Robin Hood and Friar Tuck.
_vm->_animation->_sprites[0].done();
_vm->_animation->_sprites[1].done(); // Get rid of Robin Hood and Friar Tuck.
addTimer(1, kProcAfterTheShootemup, kReasonHangingAround);
// Immediately call the following proc (when you have a chance).
@ -350,11 +350,11 @@ void Timer::hangAround2() {
void Timer::afterTheShootemup() {
_vm->_animation->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->_animation->tr[0].init(0, true, _vm->_animation); // Avalot.
_vm->_animation->apped(1, 2);
_vm->_animation->_sprites[0].init(0, true, _vm->_animation); // Avalot.
_vm->_animation->appearPed(1, 2);
_vm->_gyro->_dna._userMovesAvvy = true;
_vm->_gyro->_dna._objects[_vm->_gyro->kObjectCrossbow - 1] = true;
_vm->_lucerna->refreshObjectList();
@ -423,9 +423,9 @@ void Timer::jacquesWakesUp() {
}
void Timer::naughtyDuke() { // This is when the Duke comes in and takes your money.
_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.
_vm->_animation->_sprites[1].init(9, false, _vm->_animation); // Here comes the Duke.
_vm->_animation->appearPed(2, 1); // He starts at the door...
_vm->_animation->_sprites[1].walkTo(3); // He walks over to you.
// Let's get the door opening.
_vm->_celer->drawBackgroundSprite(-1, -1, 1);
@ -437,8 +437,8 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon
void Timer::naughtyDuke2() {
_vm->_visa->displayScrollChain('q', 48); // "Ha ha, it worked again!"
_vm->_animation->tr[1].walkTo(1); // Walk to the door.
_vm->_animation->tr[1]._vanishIfStill = true; // Then go away!
_vm->_animation->_sprites[1].walkTo(1); // Walk to the door.
_vm->_animation->_sprites[1]._vanishIfStill = true; // Then go away!
addTimer(32, kProcNaughtyDuke3, kReasonNaughtyDuke);
}
@ -458,7 +458,7 @@ void Timer::jump() {
case 5:
case 7:
case 9:
_vm->_animation->tr[0]._y--;
_vm->_animation->_sprites[0]._y--;
break;
case 12:
case 13:
@ -466,7 +466,7 @@ void Timer::jump() {
case 16:
case 18:
case 19:
_vm->_animation->tr[0]._y++;
_vm->_animation->_sprites[0]._y++;
break;
}
@ -480,7 +480,7 @@ void Timer::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->_animation->infield(3))) { // Beside the wall
&& (_vm->_animation->inField(3))) { // Beside the wall
// Grab the arrow!
if (_vm->_gyro->_dna._carryNum >= kCarryLimit)
_vm->_scrolls->displayText("You fail to grab it, because your hands are full.");
@ -538,8 +538,8 @@ void Timer::greetsMonk() {
void Timer::fallDownOubliette() {
_vm->_gyro->_magics[8]._operation = _vm->_gyro->kMagicNothing;
_vm->_animation->tr[0]._moveY++; // Increments dx/dy!
_vm->_animation->tr[0]._y += _vm->_animation->tr[0]._moveY; // Dowwwn we go...
_vm->_animation->_sprites[0]._moveY++; // Increments dx/dy!
_vm->_animation->_sprites[0]._y += _vm->_animation->_sprites[0]._moveY; // Dowwwn we go...
addTimer(3, kProcFallDownOubliette, kReasonFallingDownOubliette);
}
@ -553,49 +553,49 @@ void Timer::meetAvaroid() {
_vm->_gyro->_dna._metAvaroid = true;
addTimer(1, kProcRiseUpOubliette, kReasonRisingUpOubliette);
_vm->_animation->tr[0]._facingDir = Animation::kDirLeft;
_vm->_animation->tr[0]._x = 151;
_vm->_animation->tr[0]._moveX = -3;
_vm->_animation->tr[0]._moveY = -5;
_vm->_animation->_sprites[0]._facingDir = Animation::kDirLeft;
_vm->_animation->_sprites[0]._x = 151;
_vm->_animation->_sprites[0]._moveX = -3;
_vm->_animation->_sprites[0]._moveY = -5;
_vm->_gyro->setBackgroundColor(2);
}
}
void Timer::riseUpOubliette() {
_vm->_animation->tr[0]._visible = true;
_vm->_animation->tr[0]._moveY++; // Decrements dx/dy!
_vm->_animation->tr[0]._y -= _vm->_animation->tr[0]._moveY; // Uuuupppp we go...
if (_vm->_animation->tr[0]._moveY > 0)
_vm->_animation->_sprites[0]._visible = true;
_vm->_animation->_sprites[0]._moveY++; // Decrements dx/dy!
_vm->_animation->_sprites[0]._y -= _vm->_animation->_sprites[0]._moveY; // Uuuupppp we go...
if (_vm->_animation->_sprites[0]._moveY > 0)
addTimer(3, kProcRiseUpOubliette, kReasonRisingUpOubliette);
else
_vm->_gyro->_dna._userMovesAvvy = true;
}
void Timer::robinHoodAndGeida() {
_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]._facingDir = Animation::kDirLeft;
_vm->_animation->_sprites[0].init(7, true, _vm->_animation);
_vm->_animation->appearPed(1, 7);
_vm->_animation->_sprites[0].walkTo(6);
_vm->_animation->_sprites[1].stopWalk();
_vm->_animation->_sprites[1]._facingDir = Animation::kDirLeft;
addTimer(20, kProcRobinHoodAndGeidaTalk, kReasonRobinHoodAndGeida);
_vm->_gyro->_dna._geidaFollows = false;
}
void Timer::robinHoodAndGeidaTalk() {
_vm->_visa->displayScrollChain('q', 66);
_vm->_animation->tr[0].walkTo(2);
_vm->_animation->tr[1].walkTo(2);
_vm->_animation->tr[0]._vanishIfStill = true;
_vm->_animation->tr[1]._vanishIfStill = true;
_vm->_animation->_sprites[0].walkTo(2);
_vm->_animation->_sprites[1].walkTo(2);
_vm->_animation->_sprites[0]._vanishIfStill = true;
_vm->_animation->_sprites[1]._vanishIfStill = true;
addTimer(162, kProcAvalotReturns, kReasonRobinHoodAndGeida);
}
void Timer::avalotReturns() {
_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->_animation->_sprites[0].done();
_vm->_animation->_sprites[1].done();
_vm->_animation->_sprites[0].init(0, true, _vm->_animation);
_vm->_animation->appearPed(1, 1);
_vm->_visa->displayScrollChain('q', 67);
_vm->_gyro->_dna._userMovesAvvy = true;
}
@ -606,13 +606,13 @@ void Timer::avalotReturns() {
* @remarks Originally called 'avvy_sit_down'
*/
void Timer::avvySitDown() {
if (_vm->_animation->tr[0]._homing) // Still walking.
if (_vm->_animation->_sprites[0]._homing) // Still walking.
addTimer(1, kProcAvvySitDown, kReasonSittingDown);
else {
_vm->_celer->drawBackgroundSprite(-1, -1, 3);
_vm->_gyro->_dna._sittingInPub = true;
_vm->_gyro->_dna._userMovesAvvy = false;
_vm->_animation->tr[0]._visible = false;
_vm->_animation->_sprites[0]._visible = false;
}
}
@ -647,8 +647,8 @@ void Timer::winning() {
}
void Timer::avalotFalls() {
if (_vm->_animation->tr[0]._stepNum < 5) {
_vm->_animation->tr[0]._stepNum++;
if (_vm->_animation->_sprites[0]._stepNum < 5) {
_vm->_animation->_sprites[0]._stepNum++;
addTimer(3, kProcAvalotFalls, kReasonFallingOver);
} else {
Common::String toDisplay;
@ -662,14 +662,14 @@ void Timer::avalotFalls() {
}
void Timer::spludwickGoesToCauldron() {
if (_vm->_animation->tr[1]._homing)
if (_vm->_animation->_sprites[1]._homing)
addTimer(1, kProcSpludwickGoesToCauldron, kReasonSpludWalk);
else
addTimer(17, kProcSpludwickLeavesCauldron, kReasonSpludWalk);
}
void Timer::spludwickLeavesCauldron() {
_vm->_animation->tr[1]._callEachStepFl = true; // So that normal procs will continue.
_vm->_animation->_sprites[1]._callEachStepFl = true; // So that normal procs will continue.
}
void Timer::giveLuteToGeida() { // Moved here from Acci.

View File

@ -245,7 +245,7 @@ void Visa::talkTo(byte whom) {
bool noMatches = true;
for (int16 i = 0; i <= _vm->_animation->kSpriteNumbMax; i++)
if (_vm->_animation->tr[i]._stat._acciNum == whom) {
if (_vm->_animation->_sprites[i]._stat._acciNum == whom) {
_vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (i + 49) + _vm->_scrolls->kControlToBuffer);
noMatches = false;
break;
@ -267,8 +267,8 @@ void Visa::talkTo(byte whom) {
_vm->_gyro->_whereIs[_vm->_gyro->kPeopleCrapulus - 150] = 177; // Crapulus walks off.
_vm->_animation->tr[1]._vanishIfStill = true;
_vm->_animation->tr[1].walkTo(3); // Walks away.
_vm->_animation->_sprites[1]._vanishIfStill = true;
_vm->_animation->_sprites[1].walkTo(3); // Walks away.
_vm->_lucerna->incScore(2);
}