diff options
author | Paul Gilbert | 2010-06-13 08:53:06 +0000 |
---|---|---|
committer | Paul Gilbert | 2010-06-13 08:53:06 +0000 |
commit | 02ed880180a83a46ec72f69879df565f42c840db (patch) | |
tree | 893cece5aa1c4b854852308b2e736a83e6dd01d2 /engines/m4 | |
parent | d1993773880143d234f3355dd5a03f778e35b78c (diff) | |
download | scummvm-rg350-02ed880180a83a46ec72f69879df565f42c840db.tar.gz scummvm-rg350-02ed880180a83a46ec72f69879df565f42c840db.tar.bz2 scummvm-rg350-02ed880180a83a46ec72f69879df565f42c840db.zip |
Added logic for handling the rate of animation background scrolling, and miscellaneous extra fields
svn-id: r49627
Diffstat (limited to 'engines/m4')
-rw-r--r-- | engines/m4/animation.cpp | 36 | ||||
-rw-r--r-- | engines/m4/animation.h | 6 |
2 files changed, 29 insertions, 13 deletions
diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp index adb802ee0e..cf2d201b81 100644 --- a/engines/m4/animation.cpp +++ b/engines/m4/animation.cpp @@ -44,6 +44,7 @@ MadsAnimation::MadsAnimation(MadsM4Engine *vm, MadsView *view): Animation(vm), _ _currentFrame = 0; _oldFrameEntry = 0; _nextFrameTimer = _madsVm->_currentTimer; + _nextScrollTimer = 0; } MadsAnimation::~MadsAnimation() { @@ -89,7 +90,8 @@ void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4S _spriteListIndex = animStream->readUint16LE(); _scrollX = animStream->readSint16LE(); _scrollY = animStream->readSint16LE(); - animStream->skip(10); + _scrollTicks = animStream->readUint16LE(); + animStream->skip(8); animStream->read(buffer, 13); _interfaceFile = Common::String(buffer, 13); @@ -180,7 +182,7 @@ void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4S for (int i = 0; i < miscEntriesCount; ++i) { AnimMiscEntry rec; rec.soundNum = animStream->readByte(); - animStream->skip(1); + rec.msgIndex = animStream->readSByte(); rec.numTicks = animStream->readUint16LE(); rec.posAdjust.x = animStream->readUint16LE(); rec.posAdjust.y = animStream->readUint16LE(); @@ -232,6 +234,9 @@ void MadsAnimation::initialise(const Common::String &filename, uint16 flags, M4S int idx = _frameEntries[i].spriteSlot.spriteListIndex; _frameEntries[i].spriteSlot.spriteListIndex = _spriteListIndexes[idx]; } + + if (hasScroll()) + _nextScrollTimer = _madsVm->_currentTimer + _scrollTicks; } /** @@ -282,9 +287,24 @@ void MadsAnimation::update() { load1(newIndex); } + // Check for scroll change + bool screenChanged = false; + + // Handle any scrolling of the screen surface + if (hasScroll() && (_madsVm->_currentTimer >= _nextScrollTimer)) { + _view->_bgSurface->scrollX(_scrollX); + _view->_bgSurface->scrollY(_scrollY); + + _nextScrollTimer = _madsVm->_currentTimer + _scrollTicks; + screenChanged = true; + } + // If it's not time for the next frame, then exit - if (_madsVm->_currentTimer < _nextFrameTimer) + if (_madsVm->_currentTimer < _nextFrameTimer) { + if (screenChanged) + _view->_spriteSlots.fullRefresh(); return; + } // Loop checks for any prior animation sprite slots to be expired for (int slotIndex = 0; slotIndex < _view->_spriteSlots.startIndex; ++slotIndex) { @@ -311,16 +331,6 @@ void MadsAnimation::update() { if (misc.soundNum) _vm->_sound->playSound(misc.soundNum); - bool screenChanged = false; - - // Handle any scrolling of the screen surface - if ((_scrollX != 0) || (_scrollY != 0)) { - _view->_bgSurface->scrollX(_scrollX); - _view->_bgSurface->scrollY(_scrollY); - - screenChanged = true; - } - // Handle any offset adjustment for sprites as of this frame if (_view->_posAdjust.x != misc.posAdjust.x) { misc.posAdjust.x = _view->_posAdjust.x; diff --git a/engines/m4/animation.h b/engines/m4/animation.h index 029cf45738..cffcf9f689 100644 --- a/engines/m4/animation.h +++ b/engines/m4/animation.h @@ -57,6 +57,7 @@ public: class AnimMiscEntry { public: int soundNum; + int msgIndex; int numTicks; Common::Point posAdjust; }; @@ -82,6 +83,7 @@ private: int _spriteListIndex; int _scrollX; int _scrollY; + int _scrollTicks; Common::String _interfaceFile; Common::String _spriteSetNames[10]; Common::String _lbmFilename; @@ -96,14 +98,17 @@ private: int _unkIndex; Common::Point _unkList[2]; uint32 _nextFrameTimer; + uint32 _nextScrollTimer; int _messageCtr; int _abortTimers; AbortTimerMode _abortMode; uint16 _actionNouns[3]; + void load1(int frameNumber); bool proc1(SpriteAsset &spriteSet, const Common::Point &pt, int frameNumber); void loadInterface(M4Surface *&interfaceSurface, M4Surface *&depthSurface); + bool hasScroll() const { return (_scrollX != 0) || (_scrollY != 0); } public: MadsAnimation(MadsM4Engine *vm, MadsView *view); virtual ~MadsAnimation(); @@ -114,6 +119,7 @@ public: virtual void setCurrentFrame(int frameNumber); bool freeFlag() const { return _freeFlag; } + bool getAnimMode() const { return _animMode; } int roomNumber() const { return _roomNumber; } }; |