[Scummvm-cvs-logs] SF.net SVN: scummvm:[49627] scummvm/trunk/engines/m4

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sun Jun 13 10:53:07 CEST 2010


Revision: 49627
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49627&view=rev
Author:   dreammaster
Date:     2010-06-13 08:53:06 +0000 (Sun, 13 Jun 2010)

Log Message:
-----------
Added logic for handling the rate of animation background scrolling, and miscellaneous extra fields

Modified Paths:
--------------
    scummvm/trunk/engines/m4/animation.cpp
    scummvm/trunk/engines/m4/animation.h

Modified: scummvm/trunk/engines/m4/animation.cpp
===================================================================
--- scummvm/trunk/engines/m4/animation.cpp	2010-06-13 08:26:39 UTC (rev 49626)
+++ scummvm/trunk/engines/m4/animation.cpp	2010-06-13 08:53:06 UTC (rev 49627)
@@ -44,6 +44,7 @@
 	_currentFrame = 0;
 	_oldFrameEntry = 0;
 	_nextFrameTimer = _madsVm->_currentTimer;
+	_nextScrollTimer = 0;
 }
 
 MadsAnimation::~MadsAnimation() {
@@ -89,7 +90,8 @@
 	_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 @@
 		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 @@
 		int idx = _frameEntries[i].spriteSlot.spriteListIndex;
 		_frameEntries[i].spriteSlot.spriteListIndex = _spriteListIndexes[idx];
 	}
+
+	if (hasScroll())
+		_nextScrollTimer = _madsVm->_currentTimer + _scrollTicks;
 }
 
 /**
@@ -282,9 +287,24 @@
 			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 @@
 	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;

Modified: scummvm/trunk/engines/m4/animation.h
===================================================================
--- scummvm/trunk/engines/m4/animation.h	2010-06-13 08:26:39 UTC (rev 49626)
+++ scummvm/trunk/engines/m4/animation.h	2010-06-13 08:53:06 UTC (rev 49627)
@@ -57,6 +57,7 @@
 class AnimMiscEntry {
 public:
 	int soundNum;
+	int msgIndex;
 	int numTicks;
 	Common::Point posAdjust;
 };
@@ -82,6 +83,7 @@
 	int _spriteListIndex;
 	int _scrollX;
 	int _scrollY;
+	int _scrollTicks;
 	Common::String _interfaceFile;
 	Common::String _spriteSetNames[10];
 	Common::String _lbmFilename;
@@ -96,14 +98,17 @@
 	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 @@
 	virtual void setCurrentFrame(int frameNumber);
 
 	bool freeFlag() const { return _freeFlag; }
+	bool getAnimMode() const { return _animMode; }
 	int roomNumber() const { return _roomNumber; }
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list