diff options
author | Strangerke | 2013-09-15 10:50:43 +0200 |
---|---|---|
committer | Strangerke | 2013-09-15 10:51:24 +0200 |
commit | f7ee139501403e4f55d1a6fcbe5c421d3317cfa1 (patch) | |
tree | 1c3212f878bf3d53951e65a6146ee65705c89f14 /engines/avalanche | |
parent | 010d9f854e46ffbcb9b138e3dacffe9df25a116c (diff) | |
download | scummvm-rg350-f7ee139501403e4f55d1a6fcbe5c421d3317cfa1.tar.gz scummvm-rg350-f7ee139501403e4f55d1a6fcbe5c421d3317cfa1.tar.bz2 scummvm-rg350-f7ee139501403e4f55d1a6fcbe5c421d3317cfa1.zip |
AVALANCHE: Reduce verbosity some more
Diffstat (limited to 'engines/avalanche')
-rw-r--r-- | engines/avalanche/animation.cpp | 50 | ||||
-rw-r--r-- | engines/avalanche/animation.h | 2 | ||||
-rw-r--r-- | engines/avalanche/avalot.cpp | 11 | ||||
-rw-r--r-- | engines/avalanche/lucerna2.cpp | 50 | ||||
-rw-r--r-- | engines/avalanche/scrolls2.cpp | 5 |
5 files changed, 59 insertions, 59 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 56f2ddf54c..c6fbe957b4 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -170,11 +170,9 @@ void AnimationType::appear(int16 wx, int16 wy, byte wf) { */ bool AnimationType::checkCollision() { for (byte i = 0; i < _anim->kSpriteNumbMax; i++) { - if (_anim->_sprites[i]._quick && (_anim->_sprites[i]._id != _id) && - ((_x + _info._xLength) > _anim->_sprites[i]._x) && - (_x < (_anim->_sprites[i]._x + _anim->_sprites[i]._info._xLength)) && - (_anim->_sprites[i]._y == _y)) - return true; + AnimationType *spr = &_anim->_sprites[i]; + if (spr->_quick && (spr->_id != _id) && (_x + _info._xLength > spr->_x) && (_x < spr->_x + spr->_info._xLength) && (spr->_y == _y)) + return true; } return false; @@ -271,11 +269,12 @@ int8 AnimationType::getSign(int16 val) { return 0; } -void AnimationType::walkTo(byte pednum) { - pednum--; // Pascal -> C conversion: different array indexes. - setSpeed(getSign(_anim->_vm->_gyro->_peds[pednum]._x - _x) * 4, getSign(_anim->_vm->_gyro->_peds[pednum]._y - _y)); - _homingX = _anim->_vm->_gyro->_peds[pednum]._x - _info._xLength / 2; - _homingY = _anim->_vm->_gyro->_peds[pednum]._y - _info._yLength; +void AnimationType::walkTo(byte pedNum) { + PedType *curPed = &_anim->_vm->_gyro->_peds[pedNum - 1]; // Pascal -> C conversion: different array indexes. + + setSpeed(getSign(curPed->_x - _x) * 4, getSign(curPed->_y - _y)); + _homingX = curPed->_x - _info._xLength / 2; + _homingY = curPed->_y - _info._yLength; _homing = true; } @@ -1006,11 +1005,11 @@ void Animation::changeDirection(byte t, byte dir) { } } -void Animation::appearPed(byte trn, byte np) { - trn--; - np--; - _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); +void Animation::appearPed(byte sprNum, byte pedNum) { + AnimationType *curSpr = &_sprites[sprNum - 1]; + PedType *curPed = &_vm->_gyro->_peds[pedNum - 1]; + curSpr->appear(curPed->_x - curSpr->_info._xLength / 2, curPed->_y - curSpr->_info._yLength, curPed->_direction); + changeDirection(sprNum - 1, curPed->_direction); } // Eachstep procedures: @@ -1360,13 +1359,10 @@ void Animation::flipRoom(byte room, byte ped) { } bool Animation::inField(byte which) { - which--; // Pascal -> C: different array indexes. - + FieldType *curField = &_vm->_gyro->_fields[which - 1]; // Pascal -> C: different array indexes. int16 yy = _sprites[0]._y + _sprites[0]._info._yLength; - 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); - + return (_sprites[0]._x >= curField->_x1) && (_sprites[0]._x <= curField->_x2) && (yy >= curField->_y1) && (yy <= curField->_y2); } bool Animation::nearDoor() { @@ -1377,12 +1373,14 @@ bool Animation::nearDoor() { 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) - && (uy >= _vm->_gyro->_fields[fv]._y1) && (uy <= _vm->_gyro->_fields[fv]._y2)) - nd = true; - return nd; + + for (byte i = 8; i < _vm->_gyro->_fieldNum; i++) { + FieldType *curField = &_vm->_gyro->_fields[i]; + if ((ux >= curField->_x1) && (ux <= curField->_x2) && (uy >= curField->_y1) && (uy <= curField->_y2)) + return true; + } + + return false; } void Animation::handleMoveKey(const Common::Event &event) { diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 185f2f8e98..2765a7cd0b 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -126,7 +126,7 @@ public: 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 changeDirection(byte t, byte dir); - void appearPed(byte trn, byte np); + void appearPed(byte sprNum, byte pedNum); 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. diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 796ab800f5..fe5d4d040d 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -201,12 +201,15 @@ void Avalot::run(Common::String arg) { #ifdef DEBUG // ONLY FOR TESTING!!! - for (byte i = 0; i < _vm->_gyro->_lineNum; i++) - _vm->_graphics->_surface.drawLine(_vm->_gyro->_lines[i]._x1, _vm->_gyro->_lines[i]._y1, _vm->_gyro->_lines[i]._x2, _vm->_gyro->_lines[i]._y2, _vm->_gyro->_lines[i].col); + for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { + LineType *curLine = &_vm->_gyro->_lines[i]; + _vm->_graphics->_surface.drawLine(curLine->_x1, curLine->_y1, curLine->_x2, curLine->_y2, curLine->col); + } for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { - if (_vm->_gyro->_fields[i]._x1 < 640) - _vm->_graphics->_surface.frameRect(Common::Rect(_vm->_gyro->_fields[i]._x1, _vm->_gyro->_fields[i]._y1, _vm->_gyro->_fields[i]._x2, _vm->_gyro->_fields[i]._y2), kColorLightmagenta); + FieldType *curField = &_vm->_gyro->_fields[i]; + if (curField->_x1 < 640) + _vm->_graphics->_surface.frameRect(Common::Rect(curField->_x1, curField->_y1, curField->_x2, curField->_y2), kColorLightmagenta); } // ONLY FOR TESTING!!! #endif diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 3b32d1f5a3..dc635aae66 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -238,27 +238,30 @@ void Lucerna::loadAlso(byte num) { _vm->_gyro->_lineNum = file.readByte(); for (byte i = 0; i < _vm->_gyro->_lineNum; i++) { - _vm->_gyro->_lines[i]._x1 = file.readSint16LE(); - _vm->_gyro->_lines[i]._y1 = file.readSint16LE(); - _vm->_gyro->_lines[i]._x2 = file.readSint16LE(); - _vm->_gyro->_lines[i]._y2 = file.readSint16LE(); - _vm->_gyro->_lines[i]._color = file.readByte(); + LineType *curLine = &_vm->_gyro->_lines[i]; + curLine->_x1 = file.readSint16LE(); + curLine->_y1 = file.readSint16LE(); + curLine->_x2 = file.readSint16LE(); + curLine->_y2 = file.readSint16LE(); + curLine->_color = file.readByte(); } memset(_vm->_gyro->_peds, 177, sizeof(_vm->_gyro->_peds)); byte pedNum = file.readByte(); for (byte i = 0; i < pedNum; i++) { - _vm->_gyro->_peds[i]._x = file.readSint16LE(); - _vm->_gyro->_peds[i]._y = file.readSint16LE(); - _vm->_gyro->_peds[i]._direction = file.readByte(); + PedType *curPed = &_vm->_gyro->_peds[i]; + curPed->_x = file.readSint16LE(); + curPed->_y = file.readSint16LE(); + curPed->_direction = file.readByte(); } _vm->_gyro->_fieldNum = file.readByte(); for (byte i = 0; i < _vm->_gyro->_fieldNum; i++) { - _vm->_gyro->_fields[i]._x1 = file.readSint16LE(); - _vm->_gyro->_fields[i]._y1 = file.readSint16LE(); - _vm->_gyro->_fields[i]._x2 = file.readSint16LE(); - _vm->_gyro->_fields[i]._y2 = file.readSint16LE(); + FieldType *curField = &_vm->_gyro->_fields[i]; + curField->_x1 = file.readSint16LE(); + curField->_y1 = file.readSint16LE(); + curField->_x2 = file.readSint16LE(); + curField->_y2 = file.readSint16LE(); } for (byte i = 0; i < 15; i++) { @@ -323,8 +326,6 @@ void Lucerna::loadRoom(byte num) { CursorMan.showMouse(true); } - - void Lucerna::zoomOut(int16 x, int16 y) { warning("STUB: Lucerna::zoomout()"); } @@ -619,12 +620,10 @@ void Lucerna::enterRoom(byte room, byte ped) { zoomOut(_vm->_gyro->_peds[ped - 1]._x, _vm->_gyro->_peds[ped - 1]._y); //setactivepage(1 - cp); - { - if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { - _vm->_visa->displayScrollChain('q', 9); // Don't want to waste the wine! - _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; - refreshObjectList(); - } + if ((_vm->_gyro->_objects[Gyro::kObjectWine - 1]) && (_vm->_gyro->_wineState != 3)) { + _vm->_visa->displayScrollChain('q', 9); // Don't want to waste the wine! + _vm->_gyro->_objects[Gyro::kObjectWine - 1] = false; + refreshObjectList(); } _vm->_visa->displayScrollChain('q', 69); @@ -1221,16 +1220,15 @@ void Lucerna::majorRedraw() { uint16 Lucerna::bearing(byte whichPed) { static const double rad2deg = 180 / 3.14; // Pi - - byte pedId = whichPed - 1; // Different array indexes in Pascal and C. AnimationType *avvy = &_vm->_animation->_sprites[0]; + PedType *curPed = &_vm->_gyro->_peds[whichPed - 1]; // Different array indexes in Pascal and C. - if (avvy->_x == _vm->_gyro->_peds[pedId]._x) + if (avvy->_x == curPed->_x) return 0; - else if (avvy->_x < _vm->_gyro->_peds[pedId]._x) { - return (uint16)((atan(double((avvy->_y - _vm->_gyro->_peds[pedId]._y)) / (avvy->_x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 90); + else if (avvy->_x < curPed->_x) { + return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 90); } else { - return (uint16)((atan(double((avvy->_y - _vm->_gyro->_peds[pedId]._y)) / (avvy->_x - _vm->_gyro->_peds[pedId]._x)) * rad2deg) + 270); + return (uint16)((atan(double((avvy->_y - curPed->_y)) / (avvy->_x - curPed->_x)) * rad2deg) + 270); } } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 333b21525c..f96d56edc1 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -678,8 +678,9 @@ void Scrolls::callScrollDriver() { // Quasi-peds. (This routine performs the same // thing with QPs as triptype.chatter does with the // sprites.) - _vm->_gyro->_talkX = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed - 1]._x; - _vm->_gyro->_talkY = _vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed - 1]._y; // Position. + PedType *quasiPed = &_vm->_gyro->_peds[_vm->_gyro->kQuasipeds[_param - 10]._whichPed - 1]; + _vm->_gyro->_talkX = quasiPed->_x; + _vm->_gyro->_talkY = quasiPed->_y; // Position. _vm->_gyro->_talkFontColor = _vm->_gyro->kQuasipeds[_param - 10]._foregroundColor; _vm->_gyro->_talkBackgroundColor = _vm->_gyro->kQuasipeds[_param - 10]._backgroundColor; // Colors. |