[Scummvm-cvs-logs] scummvm master -> 359d4cdb2442aab8d10c21b7724798a3c8c4ed2c

eriktorbjorn eriktorbjorn at telia.com
Sun Jun 7 22:03:05 CEST 2015


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

Summary:
247f6d43f8 SHERLOCK: Fix animation speed in EA logo
359d4cdb24 SHERLOCK: Clean up EA logo animation


Commit: 247f6d43f84e30f2b17ac75cc9c9b11d66cf016e
    https://github.com/scummvm/scummvm/commit/247f6d43f84e30f2b17ac75cc9c9b11d66cf016e
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2015-06-07T22:01:50+02:00

Commit Message:
SHERLOCK: Fix animation speed in EA logo

The slowness of the animation was caused by a misunderstanding of
_counter vs frame counter. The nextFrame() function is called every
two frames, so when the cases were set up five frames apart, they
were actually advancing the animation once every ten frames.

Changed paths:
    engines/sherlock/scalpel/tsage/logo.cpp
    engines/sherlock/scalpel/tsage/logo.h



diff --git a/engines/sherlock/scalpel/tsage/logo.cpp b/engines/sherlock/scalpel/tsage/logo.cpp
index ee1fe5f..078778f 100644
--- a/engines/sherlock/scalpel/tsage/logo.cpp
+++ b/engines/sherlock/scalpel/tsage/logo.cpp
@@ -418,8 +418,14 @@ Logo::Logo(ScalpelEngine *vm) : _vm(vm), _lib("sf3.rlb") {
 	Object::_vm = vm;
 	Visage::_tLib = &_lib;
 
+	_finished = false;
+
 	// Initialize counter
 	_counter = 0;
+
+	// Initialize wait frame counters
+	_waitFrames = 0;
+	_waitStartFrame = 0;
 	
 	// Save a copy of the original palette
 	_vm->_screen->getPalette(_originalPalette);
@@ -443,12 +449,21 @@ Logo::~Logo() {
 }
 
 bool Logo::finished() const {
-	return _counter >= 442;
+	return _finished;
 }
 
 void Logo::nextFrame() {
 	Screen &screen = *_vm->_screen;
 
+	if (_waitFrames) {
+		uint32 currFrame = _vm->_events->getFrameCounter();
+		if (currFrame - _waitStartFrame < _waitFrames) {
+			return;
+		}
+		_waitStartFrame = 0;
+		_waitFrames = 0;
+	}
+
 	switch (_counter++) {
 	case 0:
 		// Load the background and fade it in
@@ -487,9 +502,10 @@ void Logo::nextFrame() {
 			fade(_palette2);
 			screen._backBuffer1.clear();
 		}
+		waitFrames(10);
 		break;
 
-	case 14:
+	case 4:
 		// Load the new palette
 		byte palette[PALETTE_SIZE];
 		Common::copy(&_palette2[0], &_palette2[PALETTE_SIZE], &palette[0]);
@@ -506,135 +522,162 @@ void Logo::nextFrame() {
 		_objects[0].setDestination(Common::Point(158, 71));
 		break;
 
-	case 15:
+	case 5:
 		// Wait until the logo has expanded upwards to form EA logo
 		if (_objects[0].isMoving())
 			--_counter;
 		break;
 
-	case 16:
+	case 6:
 		fade(_palette3, 40);
 		break;
 
-	case 20:
+	case 7:
 		// Show the 'Electronic Arts' company name
 		_objects[1].setVisage(14, 1);
 		_objects[1]._frame = 1;
 		_objects[1]._position = Common::Point(152, 98);
+		waitFrames(120);
 		break;
 
-	case 140:
+	case 8:
 		// Start sequence of positioning and size hand cursor in an arc
 		_objects[2].setVisage(18, 1);
 		_objects[2]._frame = 1;
 		_objects[2]._position = Common::Point(33, 91);
+		waitFrames(5);
 		break;
 
-	case 145:
+	case 9:
 		_objects[2]._frame = 2;
 		_objects[2]._position = Common::Point(44, 124);
+		waitFrames(5);
 		break;
 
-	case 150:
+	case 10:
 		_objects[2]._frame = 3;
 		_objects[2]._position = Common::Point(64, 153);
+		waitFrames(5);
 		break;
 
-	case 155:
+	case 11:
 		_objects[2]._frame = 4;
 		_objects[2]._position = Common::Point(87, 174);
+		waitFrames(5);
 		break;
 
-	case 160:
+	case 12:
 		_objects[2]._frame = 5;
 		_objects[2]._position = Common::Point(114, 191);
+		waitFrames(5);
 		break;
 
-	case 165:
+	case 13:
 		_objects[2]._frame = 6;
 		_objects[2]._position = Common::Point(125, 184);
+		waitFrames(5);
 		break;
 
-	case 170:
+	case 14:
 		_objects[2]._frame = 7;
 		_objects[2]._position = Common::Point(154, 187);
+		waitFrames(5);
 		break;
 
-	case 175:
+	case 15:
 		_objects[2]._frame = 8;
 		_objects[2]._position = Common::Point(181, 182);
+		waitFrames(5);
 		break;
 
-	case 180:
+	case 16:
 		_objects[2]._frame = 9;
 		_objects[2]._position = Common::Point(191, 167);
+		waitFrames(5);
 		break;
 
-	case 185:
+	case 17:
 		_objects[2]._frame = 10;
 		_objects[2]._position = Common::Point(190, 150);
+		waitFrames(5);
 		break;
 
-	case 190:
+	case 18:
 		_objects[2]._frame = 11;
 		_objects[2]._position = Common::Point(182, 139);
+		waitFrames(5);
 		break;
 
-	case 195:
+	case 19:
 		_objects[2]._frame = 11;
 		_objects[2]._position = Common::Point(170, 130);
+		waitFrames(5);
 		break;
 
-	case 200:
+	case 20:
 		_objects[2]._frame = 11;
 		_objects[2]._position = Common::Point(158, 121);
+		waitFrames(5);
 		break;
 
-	case 205:
+	case 21:
 		// Show a highlighting of the company name
+		_objects[1].remove();
 		_objects[2].erase();
 		_objects[2].remove();
 		_objects[3].setVisage(19, 1);
 		_objects[3]._position = Common::Point(155, 94);
+		waitFrames(8);
 		break;
 
-	case 213:
+	case 22:
 		_objects[3]._frame = 2;
+		waitFrames(8);
 		break;
 
-	case 221:
-		_objects[1].remove();
-		break;
-
-	case 222:
+	case 23:
 		_objects[3]._frame = 3;
+		waitFrames(8);
 		break;
 
-	case 230:
+	case 24:
 		_objects[3]._frame = 4;
+		waitFrames(8);
 		break;
 
-	case 238:
+	case 25:
 		_objects[3]._frame = 5;
+		waitFrames(8);
 		break;
 
-	case 246:
+	case 26:
 		_objects[3]._frame = 6;
+		waitFrames(8);
 		break;
 
-	case 254:
+	case 27:
 		_objects[3]._frame = 7;
+		waitFrames(8);
 		break;
 
-	case 262:
+	case 28:
 		_objects[3]._frame = 8;
+		waitFrames(180);
 		break;
 
+	case 29:
+		_finished = true;
+
 	default:
 		break;
 	}
 }
 
+void Logo::waitFrames(uint frames) {
+	_waitFrames = frames;
+	_waitStartFrame = _vm->_events->getFrameCounter();
+}
+
 void Logo::loadBackground() {
 	Screen &screen = *_vm->_screen;
 	
diff --git a/engines/sherlock/scalpel/tsage/logo.h b/engines/sherlock/scalpel/tsage/logo.h
index 68b7353..94531e4 100644
--- a/engines/sherlock/scalpel/tsage/logo.h
+++ b/engines/sherlock/scalpel/tsage/logo.h
@@ -190,11 +190,14 @@ private:
 	ScalpelEngine *_vm;
 	TLib _lib;
 	int _counter;
+	bool _finished;
 	byte _originalPalette[PALETTE_SIZE];
 	byte _palette1[PALETTE_SIZE];
 	byte _palette2[PALETTE_SIZE];
 	byte _palette3[PALETTE_SIZE];
 	Object _objects[4];
+	uint _waitFrames;
+	uint32 _waitStartFrame;
 
 	Logo(ScalpelEngine *vm);
 	~Logo();
@@ -204,6 +207,12 @@ private:
 	bool finished() const;
 
 	/**
+	 * Wait for a number of frames. Note that the frame count in _events is
+	 * not the same as the number of calls to nextFrame().
+	 */
+	void waitFrames(uint frames);
+
+	/**
 	 * Load the background for the scene
 	 */
 	void loadBackground();


Commit: 359d4cdb2442aab8d10c21b7724798a3c8c4ed2c
    https://github.com/scummvm/scummvm/commit/359d4cdb2442aab8d10c21b7724798a3c8c4ed2c
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2015-06-07T22:01:50+02:00

Commit Message:
SHERLOCK: Clean up EA logo animation

Since I don't know the TsAGE engine, it's possible that this could
be done in some better way, but I think it's still an improvement
over the old code.

Changed paths:
    engines/sherlock/scalpel/tsage/logo.cpp
    engines/sherlock/scalpel/tsage/logo.h



diff --git a/engines/sherlock/scalpel/tsage/logo.cpp b/engines/sherlock/scalpel/tsage/logo.cpp
index 078778f..9026dd7 100644
--- a/engines/sherlock/scalpel/tsage/logo.cpp
+++ b/engines/sherlock/scalpel/tsage/logo.cpp
@@ -426,6 +426,13 @@ Logo::Logo(ScalpelEngine *vm) : _vm(vm), _lib("sf3.rlb") {
 	// Initialize wait frame counters
 	_waitFrames = 0;
 	_waitStartFrame = 0;
+
+	// Initialize animation counters
+	_animateObject = 0;
+	_animateStartFrame = 0;
+	_animateFrameDelay = 0;
+	_animateFrames = NULL;
+	_animateFrame = 0;
 	
 	// Save a copy of the original palette
 	_vm->_screen->getPalette(_originalPalette);
@@ -452,6 +459,19 @@ bool Logo::finished() const {
 	return _finished;
 }
 
+const AnimationFrame handFrames[] = {
+	{  1,  33,  91 }, {  2,  44, 124 }, {  3,  64, 153 }, {  4,  87, 174 },
+	{  5, 114, 191 }, {  6, 125, 184 }, {  7, 154, 187 }, {  8, 181, 182 },
+	{  9, 191, 167 }, { 10, 190, 150 }, { 11, 182, 139 }, { 11, 170, 130 },
+	{ 11, 158, 121 }, {  0,   0,   0 }
+};
+
+const AnimationFrame companyFrames[] = {
+	{  1, 155,  94 }, {  2, 155,  94 }, {  3, 155,  94 }, {  4, 155,  94 },
+	{  5, 155,  94 }, {  6, 155,  94 }, {  7, 155,  94 }, {  8, 155,  94 },
+	{  0,   0,   0 }
+};
+
 void Logo::nextFrame() {
 	Screen &screen = *_vm->_screen;
 
@@ -464,6 +484,27 @@ void Logo::nextFrame() {
 		_waitFrames = 0;
 	}
 
+	if (_animateFrames) {
+		uint32 currFrame = _vm->_events->getFrameCounter();
+		if (currFrame > _animateStartFrame + _animateFrameDelay) {
+			AnimationFrame animationFrame = _animateFrames[_animateFrame];
+			if (animationFrame.frame) {
+				_objects[_animateObject]._frame = animationFrame.frame;
+				_objects[_animateObject]._position = Common::Point(animationFrame.x, animationFrame.y);
+				_animateStartFrame += _animateFrameDelay;
+				_animateFrame++;
+			} else {
+				_animateObject = 0;
+				_animateFrameDelay = 0;
+				_animateFrames = NULL;
+				_animateStartFrame = 0;
+				_animateFrame = 0;
+			}
+		}
+		if (_animateFrames)
+			return;
+	}
+
 	switch (_counter++) {
 	case 0:
 		// Load the background and fade it in
@@ -543,130 +584,25 @@ void Logo::nextFrame() {
 	case 8:
 		// Start sequence of positioning and size hand cursor in an arc
 		_objects[2].setVisage(18, 1);
-		_objects[2]._frame = 1;
-		_objects[2]._position = Common::Point(33, 91);
-		waitFrames(5);
+		startAnimation(2, 5, &handFrames[0]);
 		break;
 
 	case 9:
-		_objects[2]._frame = 2;
-		_objects[2]._position = Common::Point(44, 124);
-		waitFrames(5);
-		break;
-
-	case 10:
-		_objects[2]._frame = 3;
-		_objects[2]._position = Common::Point(64, 153);
-		waitFrames(5);
-		break;
-
-	case 11:
-		_objects[2]._frame = 4;
-		_objects[2]._position = Common::Point(87, 174);
-		waitFrames(5);
-		break;
-
-	case 12:
-		_objects[2]._frame = 5;
-		_objects[2]._position = Common::Point(114, 191);
-		waitFrames(5);
-		break;
-
-	case 13:
-		_objects[2]._frame = 6;
-		_objects[2]._position = Common::Point(125, 184);
-		waitFrames(5);
-		break;
-
-	case 14:
-		_objects[2]._frame = 7;
-		_objects[2]._position = Common::Point(154, 187);
-		waitFrames(5);
-		break;
-
-	case 15:
-		_objects[2]._frame = 8;
-		_objects[2]._position = Common::Point(181, 182);
-		waitFrames(5);
-		break;
-
-	case 16:
-		_objects[2]._frame = 9;
-		_objects[2]._position = Common::Point(191, 167);
-		waitFrames(5);
-		break;
-
-	case 17:
-		_objects[2]._frame = 10;
-		_objects[2]._position = Common::Point(190, 150);
-		waitFrames(5);
-		break;
-
-	case 18:
-		_objects[2]._frame = 11;
-		_objects[2]._position = Common::Point(182, 139);
-		waitFrames(5);
-		break;
-
-	case 19:
-		_objects[2]._frame = 11;
-		_objects[2]._position = Common::Point(170, 130);
-		waitFrames(5);
-		break;
-
-	case 20:
-		_objects[2]._frame = 11;
-		_objects[2]._position = Common::Point(158, 121);
-		waitFrames(5);
-		break;
-
-	case 21:
 		// Show a highlighting of the company name
 		_objects[1].remove();
 		_objects[2].erase();
 		_objects[2].remove();
 		_objects[3].setVisage(19, 1);
-		_objects[3]._position = Common::Point(155, 94);
-		waitFrames(8);
-		break;
-
-	case 22:
-		_objects[3]._frame = 2;
-		waitFrames(8);
-		break;
-
-	case 23:
-		_objects[3]._frame = 3;
-		waitFrames(8);
-		break;
-
-	case 24:
-		_objects[3]._frame = 4;
-		waitFrames(8);
-		break;
-
-	case 25:
-		_objects[3]._frame = 5;
-		waitFrames(8);
-		break;
-
-	case 26:
-		_objects[3]._frame = 6;
-		waitFrames(8);
-		break;
-
-	case 27:
-		_objects[3]._frame = 7;
-		waitFrames(8);
+		startAnimation(3, 8, &companyFrames[0]);
 		break;
 
-	case 28:
-		_objects[3]._frame = 8;
+	case 10:
 		waitFrames(180);
 		break;
 
-	case 29:
+	case 11:
 		_finished = true;
+		break;
 
 	default:
 		break;
@@ -678,6 +614,17 @@ void Logo::waitFrames(uint frames) {
 	_waitStartFrame = _vm->_events->getFrameCounter();
 }
 
+void Logo::startAnimation(uint object, uint frameDelay, const AnimationFrame *frames) {
+	_animateObject = object;
+	_animateFrameDelay = frameDelay;
+	_animateFrames = frames;
+	_animateStartFrame = _vm->_events->getFrameCounter();
+	_animateFrame = 1;
+
+	_objects[object]._frame = frames[0].frame;
+	_objects[object]._position = Common::Point(frames[0].x, frames[0].y);
+}
+
 void Logo::loadBackground() {
 	Screen &screen = *_vm->_screen;
 	
diff --git a/engines/sherlock/scalpel/tsage/logo.h b/engines/sherlock/scalpel/tsage/logo.h
index 94531e4..c9fac00 100644
--- a/engines/sherlock/scalpel/tsage/logo.h
+++ b/engines/sherlock/scalpel/tsage/logo.h
@@ -185,6 +185,12 @@ public:
 	void remove() { _visage.clear(); }
 };
 
+struct AnimationFrame {
+	int	frame;
+	int	x;
+	int	y;
+};
+
 class Logo {
 private:
 	ScalpelEngine *_vm;
@@ -198,6 +204,11 @@ private:
 	Object _objects[4];
 	uint _waitFrames;
 	uint32 _waitStartFrame;
+	int _animateObject;
+	uint32 _animateStartFrame;
+	uint _animateFrameDelay;
+	const AnimationFrame *_animateFrames;
+	uint _animateFrame;
 
 	Logo(ScalpelEngine *vm);
 	~Logo();
@@ -213,6 +224,13 @@ private:
 	void waitFrames(uint frames);
 
 	/**
+	 * Start an animation sequence. Used for sequences that are described
+	 * one frame at a time because they do unusual things, or run at
+	 * unusual rates.
+	 */
+	void startAnimation(uint object, uint frameDelay, const AnimationFrame *frames);
+
+	/**
 	 * Load the background for the scene
 	 */
 	void loadBackground();






More information about the Scummvm-git-logs mailing list