From a506b0b3e4490f69d58b1d3646de6065d98822d4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 15 Sep 2013 01:10:10 +0200 Subject: [PATCH] AVALANCHE: Reduce some more verbosity --- engines/avalanche/acci2.cpp | 19 ++++++++----------- engines/avalanche/animation.cpp | 11 ++++++----- engines/avalanche/lucerna2.cpp | 10 ++++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index ad1e3725ee5..bbbc04af61b 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -1099,29 +1099,26 @@ void Acci::openDoor() { if ((!_vm->_gyro->_userMovesAvvy) && (_vm->_gyro->_room != r__lusties)) return; // No doors can open if you can't move Avvy. - for (byte fv = 8; fv < 15; fv++) { - if (_vm->_animation->inField(fv + 1)) { - fv -= 8; - - switch (_vm->_gyro->_portals[fv]._operation) { + for (byte i = 0; i < 7; i++) { + if (_vm->_animation->inField(i + 9)) { + MagicType *portal = &_vm->_gyro->_portals[i]; + switch (portal->_operation) { case Gyro::kMagicExclaim: _vm->_animation->_sprites[0].bounce(); - _vm->_visa->displayScrollChain('x', _vm->_gyro->_portals[fv]._data); + _vm->_visa->displayScrollChain('x', portal->_data); break; case Gyro::kMagicTransport: - _vm->_animation->flipRoom((_vm->_gyro->_portals[fv]._data) >> 8, // High byte - (_vm->_gyro->_portals[fv]._data) & 0x0F // Low byte - ); + _vm->_animation->flipRoom((portal->_data) >> 8, portal->_data & 0x0F); break; case Gyro::kMagicUnfinished: _vm->_animation->_sprites[0].bounce(); _vm->_scrolls->displayText("Sorry. This place is not available yet!"); break; case Gyro::kMagicSpecial: - _vm->_animation->callSpecial(_vm->_gyro->_portals[fv]._data); + _vm->_animation->callSpecial(portal->_data); break; case Gyro::kMagicOpenDoor: - _vm->_animation->openDoor((_vm->_gyro->_portals[fv]._data) >> 8, (_vm->_gyro->_portals[fv]._data) & 0x0F, fv + 9); + _vm->_animation->openDoor(portal->_data >> 8, portal->_data & 0x0F, i + 9); break; } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 5ce809c76d2..56f2ddf54c2 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -210,17 +210,18 @@ void AnimationType::walk() { // -1 is because the modified array indexes of magics[] compared to Pascal . if ((tc != 255) & (!_anim->_vm->_gyro->_doingSpriteRun)) { - switch (_anim->_vm->_gyro->_magics[tc]._operation) { + MagicType *magic = &_anim->_vm->_gyro->_magics[tc]; + switch (magic->_operation) { case Gyro::kMagicExclaim: bounce(); _anim->_mustExclaim = true; - _anim->_sayWhat = _anim->_vm->_gyro->_magics[tc]._data; + _anim->_sayWhat = magic->_data; break; case Gyro::kMagicBounce: bounce(); break; case Gyro::kMagicTransport: - _anim->flipRoom(_anim->_vm->_gyro->_magics[tc]._data >> 8, _anim->_vm->_gyro->_magics[tc]._data & 0xff); + _anim->flipRoom(magic->_data >> 8, magic->_data & 0xff); break; case Gyro::kMagicUnfinished: { bounce(); @@ -229,10 +230,10 @@ void AnimationType::walk() { } break; case Gyro::kMagicSpecial: - _anim->callSpecial(_anim->_vm->_gyro->_magics[tc]._data); + _anim->callSpecial(magic->_data); break; case Gyro::kMagicOpenDoor: - _anim->openDoor(_anim->_vm->_gyro->_magics[tc]._data >> 8, _anim->_vm->_gyro->_magics[tc]._data & 0xff, tc); + _anim->openDoor(magic->_data >> 8, magic->_data & 0xff, tc); break; } } diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index a4b1094789a..3b32d1f5a3b 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -262,13 +262,15 @@ void Lucerna::loadAlso(byte num) { } for (byte i = 0; i < 15; i++) { - _vm->_gyro->_magics[i]._operation = file.readByte(); - _vm->_gyro->_magics[i]._data = file.readUint16LE(); + MagicType *magic = &_vm->_gyro->_magics[i]; + magic->_operation = file.readByte(); + magic->_data = file.readUint16LE(); } for (byte i = 0; i < 7; i++) { - _vm->_gyro->_portals[i]._operation = file.readByte(); - _vm->_gyro->_portals[i]._data = file.readUint16LE(); + MagicType *portal = &_vm->_gyro->_portals[i]; + portal->_operation = file.readByte(); + portal->_data = file.readUint16LE(); } _vm->_gyro->_flags.clear();