aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-17 12:23:41 -0500
committerPaul Gilbert2015-01-17 12:23:41 -0500
commitccd0c63a7b91031c8a172a60634506a3c810554b (patch)
treeb9afeeb6b71f2bad65731940044f1a179572eba2 /engines/mads
parent8e07aae50462b9d3fee007a4832f75ab68b631c9 (diff)
downloadscummvm-rg350-ccd0c63a7b91031c8a172a60634506a3c810554b.tar.gz
scummvm-rg350-ccd0c63a7b91031c8a172a60634506a3c810554b.tar.bz2
scummvm-rg350-ccd0c63a7b91031c8a172a60634506a3c810554b.zip
MADS: Implement background scrolling in anim views
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/animation.cpp2
-rw-r--r--engines/mads/menu_views.cpp25
-rw-r--r--engines/mads/menu_views.h3
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();