aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche
diff options
context:
space:
mode:
authorStrangerke2013-10-16 07:18:06 +0200
committerWillem Jan Palenstijn2013-10-17 22:17:10 +0200
commit5f180a06baa3e9e63015b2efb698770e897875df (patch)
treebea731ccb78f70dea20a2afb9b4204b384138768 /engines/avalanche
parent06f94c10854162dd0fdfade2879880ea454bd11f (diff)
downloadscummvm-rg350-5f180a06baa3e9e63015b2efb698770e897875df.tar.gz
scummvm-rg350-5f180a06baa3e9e63015b2efb698770e897875df.tar.bz2
scummvm-rg350-5f180a06baa3e9e63015b2efb698770e897875df.zip
AVALANCHE: Rework animation init/remove some more
Diffstat (limited to 'engines/avalanche')
-rw-r--r--engines/avalanche/animation.cpp22
-rw-r--r--engines/avalanche/animation.h4
-rw-r--r--engines/avalanche/dialogs.cpp4
3 files changed, 13 insertions, 17 deletions
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;
}