aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/m4/animation.cpp3
-rw-r--r--engines/m4/mads_anim.cpp56
-rw-r--r--engines/m4/mads_anim.h1
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();