[Scummvm-cvs-logs] scummvm master -> ccd0c63a7b91031c8a172a60634506a3c810554b

dreammaster dreammaster at scummvm.org
Sat Jan 17 18:24:57 CET 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ccd0c63a7b MADS: Implement background scrolling in anim views


Commit: ccd0c63a7b91031c8a172a60634506a3c810554b
    https://github.com/scummvm/scummvm/commit/ccd0c63a7b91031c8a172a60634506a3c810554b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-01-17T12:23:41-05:00

Commit Message:
MADS: Implement background scrolling in anim views

Changed paths:
    engines/mads/animation.cpp
    engines/mads/menu_views.cpp
    engines/mads/menu_views.h



diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp
index 2b999fa..469d42c 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 ee4268a..b492d98 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 cc5a130..871c0d1 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();
 






More information about the Scummvm-git-logs mailing list