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

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Mon Jun 14 05:15:59 CEST 2010


Revision: 49642
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49642&view=rev
Author:   dreammaster
Date:     2010-06-14 03:15:58 +0000 (Mon, 14 Jun 2010)

Log Message:
-----------
Added logic for animation sequences specifying a starting animation frame number

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

Modified: scummvm/trunk/engines/m4/animation.cpp
===================================================================
--- scummvm/trunk/engines/m4/animation.cpp	2010-06-13 22:48:49 UTC (rev 49641)
+++ scummvm/trunk/engines/m4/animation.cpp	2010-06-14 03:15:58 UTC (rev 49642)
@@ -328,6 +328,7 @@
 
 	// Handle starting any sound for this frame
 	AnimMiscEntry &misc = _miscEntries[_currentFrame];
+printf("frame %d delay %d\n", _currentFrame, misc.numTicks);
 	if (misc.soundNum)
 		_vm->_sound->playSound(misc.soundNum);
 
@@ -449,6 +450,8 @@
 	_currentFrame = frameNumber;
 	_oldFrameEntry = 0;
 	_freeFlag = false;
+
+	_nextScrollTimer = _nextFrameTimer = _madsVm->_currentTimer;
 }
 
 void MadsAnimation::load1(int frameNumber) {

Modified: scummvm/trunk/engines/m4/mads_anim.cpp
===================================================================
--- scummvm/trunk/engines/m4/mads_anim.cpp	2010-06-13 22:48:49 UTC (rev 49641)
+++ scummvm/trunk/engines/m4/mads_anim.cpp	2010-06-14 03:15:58 UTC (rev 49642)
@@ -459,7 +459,8 @@
 	_transition = kTransitionNone;
 	_activeAnimation = NULL;
 	_bgLoadFlag = true;
-	
+	_startFrame = -1;
+
 	reset();
 
 	// Set up system palette colors
@@ -536,6 +537,9 @@
 			return;
 		}
 
+		// Reset flags
+		_startFrame = -1;
+
 		readNextCommand();
 	}
 
@@ -543,7 +547,15 @@
 }
 
 void AnimviewView::readNextCommand() {
+static bool tempFlag = true;//****DEBUG - Temporarily allow me to skip several intro scenes ****
+
 	while (!_script->eos() && !_script->err()) {
+		if (!tempFlag) {
+			tempFlag = true;
+			strncpy(_currentLine, _script->readLine().c_str(), 79);
+			strncpy(_currentLine, _script->readLine().c_str(), 79);
+		}
+
 		strncpy(_currentLine, _script->readLine().c_str(), 79);
 
 		// Process any switches on the line
@@ -581,6 +593,9 @@
 	_activeAnimation = new MadsAnimation(_vm, this);
 	_activeAnimation->initialise(_currentLine, flags, &_backgroundSurface, &_codeSurface);
 
+	if (_startFrame != -1)
+		_activeAnimation->setCurrentFrame(_startFrame);
+
 	_spriteSlots.fullRefresh();
 /*
 	// Handle scene transition
@@ -634,6 +649,7 @@
 Switches are: (taken from the help of the original executable)
   -b       Toggle background load status off/on.
   -c:char  Specify sound card id letter.
+  -f:num   Specify a specific starting frame number
   -g       Stay in graphics mode on exit.
   -h[:ex]  Disable EMS/XMS high memory support.
   -i       Switch sound interrupts mode off/on.
@@ -677,21 +693,39 @@
 	str_upper(commandStr);
 	char *param = commandStr;
 
-	if (!strncmp(commandStr, "B", 1)) {
+	switch (commandStr[0]) {
+	case 'B':
 		// Toggle background load flag
 		_bgLoadFlag = !_bgLoadFlag;
-	} else if (!strncmp(commandStr, "X", 1)) {
-		//printf("X ");
-	} else if (!strncmp(commandStr, "W", 1)) {
-		//printf("W ");
-	} else if (!strncmp(commandStr, "R", 1)) {
+		break;
+
+	case 'F':
+		// Start animation at a specific frame
+		++param;
+		assert(*param == ':');
+		_startFrame = atoi(++param);
+		break;
+
+	case 'O':
 		param = param + 2;
-		//printf("R:%s ", param);
-	} else if (!strncmp(commandStr, "O", 1)) {
-		param = param + 2;
 		//printf("O:%i ", atoi(param));
 		_transition = atoi(param);
-	} else {
+		break;
+
+	case 'R':
+		param = param + 2;
+		//printf("R:%s ", param);
+		break;
+
+	case 'W':
+		//printf("W ");
+		break;
+
+	case 'X':
+		//printf("X ");
+		break;
+
+	default:
 		error("Unknown response command: '%s'", commandStr);
 	}
 }

Modified: scummvm/trunk/engines/m4/mads_anim.h
===================================================================
--- scummvm/trunk/engines/m4/mads_anim.h	2010-06-13 22:48:49 UTC (rev 49641)
+++ scummvm/trunk/engines/m4/mads_anim.h	2010-06-14 03:15:58 UTC (rev 49642)
@@ -91,6 +91,7 @@
 	int _transition;
 	MadsAnimation *_activeAnimation;
 	bool _bgLoadFlag;
+	int _startFrame;
 
 	void reset();
 	void readNextCommand();


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