From 5f180a06baa3e9e63015b2efb698770e897875df Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Oct 2013 07:18:06 +0200 Subject: AVALANCHE: Rework animation init/remove some more --- engines/avalanche/animation.cpp | 22 +++++++++------------- engines/avalanche/animation.h | 4 ++-- engines/avalanche/dialogs.cpp | 4 ++-- 3 files changed, 13 insertions(+), 17 deletions(-) (limited to 'engines/avalanche') diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index d1d3fd14a3..d2c700a09f 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -79,7 +79,7 @@ void AnimationType::init(byte spritenum, bool doCheck) { // Skip real comment size (1 byte) then fixed sized zone containing comment (16 bytes) inf.skip(1 + 16); - byte frameNum = inf.readByte(); + _frameNum = inf.readByte(); _xLength = inf.readByte(); _yLength = inf.readByte(); _seq = inf.readByte(); @@ -87,22 +87,18 @@ void AnimationType::init(byte spritenum, bool doCheck) { assert (size > 6); _fgBubbleCol = (Color)inf.readByte(); _bgBubbleCol = (Color)inf.readByte(); - _acciNum = inf.readByte(); + _characterId = inf.readByte(); - _animCount = 0; // = 1; byte xWidth = _xLength / 8; if ((_xLength % 8) > 0) xWidth++; - for (int i = 0; i < frameNum; i++) { - _sil[_animCount] = new SilType[11 * (_yLength + 1)]; - _mani[_animCount] = new ManiType[size - 6]; + for (int i = 0; i < _frameNum; i++) { + _sil[i] = new SilType[11 * (_yLength + 1)]; + _mani[i] = new ManiType[size - 6]; for (int j = 0; j <= _yLength; j++) - inf.read((*_sil[_animCount])[j], xWidth); - inf.read(*_mani[_animCount], size - 6); - - _animCount++; + inf.read((*_sil[i])[j], xWidth); + inf.read(*_mani[i], size - 6); } - _animCount++; _x = 0; _y = 0; @@ -359,7 +355,7 @@ void AnimationType::chatter() { } void AnimationType::remove() { - for (int i = _animCount - 2; i > 0; i--) { + for (int i = 0; i < _frameNum; i++) { delete[] _mani[i]; delete[] _sil[i]; } @@ -1428,7 +1424,7 @@ void Animation::synchronize(Common::Serializer &sz) { sz.syncAsByte(spr->_count); sz.syncAsByte(spr->_speedX); sz.syncAsByte(spr->_speedY); - sz.syncAsByte(spr->_animCount); + sz.syncAsByte(spr->_frameNum); sz.syncAsSint16LE(spr->_homingX); sz.syncAsSint16LE(spr->_homingY); sz.syncAsByte(spr->_callEachStepFl); diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h index 787f60e814..703d35c832 100644 --- a/engines/avalanche/animation.h +++ b/engines/avalanche/animation.h @@ -48,9 +48,10 @@ public: SilType *_sil[24]; // Former Stat structure + byte _frameNum; // Number of pictures. byte _seq; // How many in one stride. Color _fgBubbleCol, _bgBubbleCol; // Foreground & background bubble colors. - byte _acciNum; // The number according to Acci. (1=Avvy, etc.) + byte _characterId; // The number according to Acci. (1=Avvy, etc.) // Direction _facingDir; @@ -62,7 +63,6 @@ public: int16 _homingX, _homingY; // Homing x & y coords. byte _count; // Counts before changing step. byte _speedX, _speedY; // x & y speed. - byte _animCount; // Total number of sprites. bool _vanishIfStill; // Do we show this sprite if it's still? bool _callEachStepFl; // Do we call the eachstep procedure? byte _eachStepProc; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index 364343bfd4..750dd80cc6 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -1074,7 +1074,7 @@ void Dialogs::talkTo(byte whom) { bool noMatches = true; for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { - if (_vm->_animation->_sprites[i]->_acciNum == whom) { + if (_vm->_animation->_sprites[i]->_characterId == whom) { Common::String tmpStr = Common::String::format("%c%c%c", kControlRegister, i + 49, kControlToBuffer); displayText(tmpStr); noMatches = false; @@ -1135,7 +1135,7 @@ Common::String Dialogs::personSpeaks() { for (int i = 0; i < _vm->_animation->kSpriteNumbMax; i++) { AnimationType *curSpr = _vm->_animation->_sprites[i]; - if (curSpr->_quick && (curSpr->_acciNum + 149 == _vm->_parser->_person)) { + if (curSpr->_quick && (curSpr->_characterId + 149 == _vm->_parser->_person)) { tmpStr += Common::String::format("%c%c", kControlRegister, '1' + i); found = true; } -- cgit v1.2.3