diff options
-rw-r--r-- | engines/mads/animation.cpp | 2 | ||||
-rw-r--r-- | engines/mads/menu_views.cpp | 25 | ||||
-rw-r--r-- | engines/mads/menu_views.h | 3 |
3 files changed, 29 insertions, 1 deletions
diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 2b999fa305..469d42cc1b 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -41,7 +41,7 @@ void AAHeader::load(Common::SeekableReadStream *f) { _spritesIndex = f->readUint16LE(); _scrollPosition.x = f->readSint16LE(); _scrollPosition.y = f->readSint16LE(); - _scrollTicks = f->readUint32LE(); + _scrollTicks = f->readUint32LE() & 0xffff; f->skip(6); char buffer[FILENAME_SIZE]; diff --git a/engines/mads/menu_views.cpp b/engines/mads/menu_views.cpp index ee4268a650..b492d98125 100644 --- a/engines/mads/menu_views.cpp +++ b/engines/mads/menu_views.cpp @@ -484,6 +484,7 @@ AnimationView::AnimationView(MADSEngine *vm) : MenuView(vm) { _animFrameNumber = 0; _nextCyclingActive = false; _sceneInfo = SceneInfo::init(_vm); + _scrollFrameCtr = 0; load(); } @@ -549,6 +550,11 @@ void AnimationView::doFrame() { scene._cyclingActive = _nextCyclingActive; } + if (++_scrollFrameCtr >= _currentAnimation->_header._scrollTicks) { + _scrollFrameCtr = 0; + scroll(); + } + if (_currentAnimation) { ++scene._frameStartTime; _currentAnimation->update(); @@ -636,6 +642,21 @@ void AnimationView::loadNextResource() { scene.initPaletteAnimation(paletteCycles, _nextCyclingActive && !_vm->_game->_fx); } +void AnimationView::scroll() { + Scene &scene = _vm->_game->_scene; + Common::Point pt = _currentAnimation->_header._scrollPosition; + + if (pt.x != 0) { + scene._backgroundSurface.scrollX(pt.x); + scene._spriteSlots.fullRefresh(); + } + + if (pt.y != 0) { + scene._backgroundSurface.scrollY(pt.y); + scene._spriteSlots.fullRefresh(); + } +} + void AnimationView::scriptDone() { _breakFlag = true; _vm->_dialogs->_pendingDialog = DIALOG_MAIN_MENU; @@ -657,6 +678,10 @@ void AnimationView::processLines() { _currentLine += c; } + // Check for comment line + if (_currentLine.hasPrefix("#")) + continue; + // Process the line while (!_currentLine.empty()) { if (_currentLine.hasPrefix("-")) { diff --git a/engines/mads/menu_views.h b/engines/mads/menu_views.h index cc5a13006f..871c0d1d37 100644 --- a/engines/mads/menu_views.h +++ b/engines/mads/menu_views.h @@ -191,6 +191,7 @@ private: int _manualFrame2; int _animFrameNumber; bool _nextCyclingActive; + int _scrollFrameCtr; private: void load(); @@ -201,6 +202,8 @@ private: int getParameter(); void loadNextResource(); + + void scroll(); protected: virtual void display(); |