diff options
author | Paul Gilbert | 2010-06-14 03:15:58 +0000 |
---|---|---|
committer | Paul Gilbert | 2010-06-14 03:15:58 +0000 |
commit | ae0a7a667504b3356f2355aadfa6add722749ca6 (patch) | |
tree | 56a9d1daad9211f85257facba535705e394496c5 | |
parent | d36f6638c0fd6e5aeaf8d8ac8665d5d2d8a2575f (diff) | |
download | scummvm-rg350-ae0a7a667504b3356f2355aadfa6add722749ca6.tar.gz scummvm-rg350-ae0a7a667504b3356f2355aadfa6add722749ca6.tar.bz2 scummvm-rg350-ae0a7a667504b3356f2355aadfa6add722749ca6.zip |
Added logic for animation sequences specifying a starting animation frame number
svn-id: r49642
-rw-r--r-- | engines/m4/animation.cpp | 3 | ||||
-rw-r--r-- | engines/m4/mads_anim.cpp | 56 | ||||
-rw-r--r-- | engines/m4/mads_anim.h | 1 |
3 files changed, 49 insertions, 11 deletions
diff --git a/engines/m4/animation.cpp b/engines/m4/animation.cpp index 9b6d5d1a6f..1d9b1161c2 100644 --- a/engines/m4/animation.cpp +++ b/engines/m4/animation.cpp @@ -328,6 +328,7 @@ void MadsAnimation::update() { // 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 @@ void MadsAnimation::setCurrentFrame(int frameNumber) { _currentFrame = frameNumber; _oldFrameEntry = 0; _freeFlag = false; + + _nextScrollTimer = _nextFrameTimer = _madsVm->_currentTimer; } void MadsAnimation::load1(int frameNumber) { diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp index c618ae57cc..c2e9ea4eee 100644 --- a/engines/m4/mads_anim.cpp +++ b/engines/m4/mads_anim.cpp @@ -459,7 +459,8 @@ AnimviewView::AnimviewView(MadsM4Engine *vm): _transition = kTransitionNone; _activeAnimation = NULL; _bgLoadFlag = true; - + _startFrame = -1; + reset(); // Set up system palette colors @@ -536,6 +537,9 @@ void AnimviewView::updateState() { return; } + // Reset flags + _startFrame = -1; + readNextCommand(); } @@ -543,7 +547,15 @@ void AnimviewView::updateState() { } 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 @@ void AnimviewView::readNextCommand() { _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 @@ return; 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 @@ void AnimviewView::processCommand() { 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)) { - param = param + 2; - //printf("R:%s ", param); - } else if (!strncmp(commandStr, "O", 1)) { + break; + + case 'F': + // Start animation at a specific frame + ++param; + assert(*param == ':'); + _startFrame = atoi(++param); + break; + + case 'O': 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); } } diff --git a/engines/m4/mads_anim.h b/engines/m4/mads_anim.h index f18fe46f48..78cc8727f8 100644 --- a/engines/m4/mads_anim.h +++ b/engines/m4/mads_anim.h @@ -91,6 +91,7 @@ private: int _transition; MadsAnimation *_activeAnimation; bool _bgLoadFlag; + int _startFrame; void reset(); void readNextCommand(); |