From 8f152c083394a877db1d2576e6654cdbdee5999e Mon Sep 17 00:00:00 2001 From: uruk Date: Sun, 8 Sep 2013 11:40:35 +0200 Subject: AVALANCHE: Renaming/refactoring in Animation. --- engines/avalanche/acci2.cpp | 2 +- engines/avalanche/animation.cpp | 15 +++++++-------- engines/avalanche/animation.h | 42 +++++++++-------------------------------- engines/avalanche/dropdown2.cpp | 2 -- engines/avalanche/visa2.cpp | 2 +- 5 files changed, 18 insertions(+), 45 deletions(-) (limited to 'engines/avalanche') diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index aa99517cfd..d30b659c24 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -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->tr[i]._quick && ((_vm->_animation->tr[i]._stat._acciNum + 149) == _person)) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 49) + _vm->_scrolls->kControlToBuffer); found = true; } diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 9aee7db95c..bdf2bb4627 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -88,11 +88,11 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *tr) { _stat._frameNum = inf.readByte(); _info._xLength = inf.readByte(); _info._yLength = inf.readByte(); - _stat.seq = inf.readByte(); + _stat._seq = inf.readByte(); _info._size = inf.readUint16LE(); _stat._fgBubbleCol = inf.readByte(); _stat._bgBubbleCol = inf.readByte(); - _stat.accinum = inf.readByte(); + _stat._acciNum = inf.readByte(); _animCount = 0; // = 1; _info._xWidth = _info._xLength / 8; @@ -144,7 +144,7 @@ void AnimationType::original() { void AnimationType::andexor() { if ((_vanishIfStill) && (_moveX == 0) && (_moveY == 0)) return; - byte picnum = _facingDir * _stat.seq + _stepNum; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). + byte picnum = _facingDir * _stat._seq + _stepNum; // There'll maybe problem because of the different array indexes in Pascal (starting from 1). _tr->_vm->_graphics->drawSprite(_info, picnum, _x, _y); } @@ -245,7 +245,7 @@ void AnimationType::walk() { _count++; if (((_moveX != 0) || (_moveY != 0)) && (_count > 1)) { _stepNum++; - if (_stepNum == _stat.seq) + if (_stepNum == _stat._seq) _stepNum = 0; _count = 0; } @@ -970,7 +970,6 @@ void Animation::openDoor(byte whither, byte ped, byte magicnum) { void Animation::newspeed() { // Given that you've just changed the speed in triptype._speedX, this adjusts _moveX. - const ByteField lightspace = {40, 199, 47, 199}; tr[0]._moveX = (tr[0]._moveX / 3) * tr[0]._speedX; @@ -1072,7 +1071,7 @@ void Animation::follow_avvy_y(byte tripnum) { return; if (tr[tripnum]._moveX == 0) { tr[tripnum]._stepNum += 1; - if (tr[tripnum]._stepNum == tr[tripnum]._stat.seq) + if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq) tr[tripnum]._stepNum = 0; tr[tripnum]._count = 0; } @@ -1170,7 +1169,7 @@ void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. if (tr[tripnum]._y < toy) tr[tripnum]._y++; tr[tripnum]._stepNum++; - if (tr[tripnum]._stepNum == tr[tripnum]._stat.seq) + if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq) tr[tripnum]._stepNum = 0; } } @@ -1178,7 +1177,7 @@ void Animation::grab_avvy(byte tripnum) { // For Friar Tuck, in Nottingham. void Animation::take_a_step(byte &tripnum) { if (tr[tripnum]._moveX == 0) { tr[tripnum]._stepNum++; - if (tr[tripnum]._stepNum == tr[tripnum]._stat.seq) + if (tr[tripnum]._stepNum == tr[tripnum]._stat._seq) tr[tripnum]._stepNum = 0; tr[tripnum]._count = 0; } diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 00f11540f1..7cb8e12f0b 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -37,46 +37,23 @@ namespace Avalanche { class AvalancheEngine; +class Animation; -struct adxtype { // Second revision of ADX type - // CHECKME: Useless? - Common::String _name; // name of character - Common::String _comment; // comment +struct StatType { + 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 AnimationSaver { - byte _id; - byte _facingDir; - byte _stepNum; - int16 _x; - int16 _y; - int8 _moveX; - int8 _moveY; - bool _visible; - bool _homing; - bool _doCheck; - byte _count; - byte _xWidth, _speedX, _speedY; - byte _animCount; - int16 _homingX; - int16 _homingY; - bool _callEachStepFl; - byte _eachStepProc; - bool _vanishIfStill; + 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.) }; -class Animation; - class AnimationType { public: SpriteInfo _info; - adxtype _stat; // Vital statistics. + StatType _stat; // Vital statistics. byte _facingDir, _stepNum; int16 _x, _y; // Current xy coords. int16 _oldX[2], _oldY[2]; // Last xy coords. @@ -116,7 +93,6 @@ private: class Animation { public: friend class AnimationType; - friend class getsettype; static const byte kDirUp = 0; static const byte kDirRight = 1; diff --git a/engines/avalanche/dropdown2.cpp b/engines/avalanche/dropdown2.cpp index ef448152db..2d6d272208 100644 --- a/engines/avalanche/dropdown2.cpp +++ b/engines/avalanche/dropdown2.cpp @@ -231,8 +231,6 @@ void MenuBar::createMenuItem(char trig, Common::String title, char altTrig, Drop } void MenuBar::draw() { - const ByteField menuspace = {0, 0, 80, 9}; - //setactivepage(3); _dr->_vm->_graphics->_surface.fillRect(Common::Rect(0, 0, 640, 10), _dr->kMenuBackgroundColor); diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp index 98a1e227fd..b0be1886bd 100644 --- a/engines/avalanche/visa2.cpp +++ b/engines/avalanche/visa2.cpp @@ -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->tr[i]._stat._acciNum == whom) { _vm->_scrolls->displayText(Common::String(_vm->_scrolls->kControlRegister) + (i + 49) + _vm->_scrolls->kControlToBuffer); noMatches = false; break; -- cgit v1.2.3