aboutsummaryrefslogtreecommitdiff
path: root/engines/m4/mads_anim.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2010-06-14 03:15:58 +0000
committerPaul Gilbert2010-06-14 03:15:58 +0000
commitae0a7a667504b3356f2355aadfa6add722749ca6 (patch)
tree56a9d1daad9211f85257facba535705e394496c5 /engines/m4/mads_anim.cpp
parentd36f6638c0fd6e5aeaf8d8ac8665d5d2d8a2575f (diff)
downloadscummvm-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
Diffstat (limited to 'engines/m4/mads_anim.cpp')
-rw-r--r--engines/m4/mads_anim.cpp56
1 files changed, 45 insertions, 11 deletions
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);
}
}