aboutsummaryrefslogtreecommitdiff
path: root/engines/simon
diff options
context:
space:
mode:
authorTravis Howell2006-04-17 13:19:36 +0000
committerTravis Howell2006-04-17 13:19:36 +0000
commitd832f69f4ca73af8579c9c5aad63e2b2ec4bb218 (patch)
treee92986547cfff6421fb5d7d31cc685837a90cc18 /engines/simon
parent5bfe6fd6f4ac3289caa63050a4315749a6eee68a (diff)
downloadscummvm-rg350-d832f69f4ca73af8579c9c5aad63e2b2ec4bb218.tar.gz
scummvm-rg350-d832f69f4ca73af8579c9c5aad63e2b2ec4bb218.tar.bz2
scummvm-rg350-d832f69f4ca73af8579c9c5aad63e2b2ec4bb218.zip
Adjust video playback code, due to false calls in prison of FF
svn-id: r21977
Diffstat (limited to 'engines/simon')
-rw-r--r--engines/simon/animation.cpp42
-rw-r--r--engines/simon/animation.h4
-rw-r--r--engines/simon/items.cpp19
-rw-r--r--engines/simon/simon.cpp1
-rw-r--r--engines/simon/simon.h5
5 files changed, 39 insertions, 32 deletions
diff --git a/engines/simon/animation.cpp b/engines/simon/animation.cpp
index dd383ca596..5a54f1ccb3 100644
--- a/engines/simon/animation.cpp
+++ b/engines/simon/animation.cpp
@@ -45,7 +45,7 @@ MoviePlayer::MoviePlayer(SimonEngine *vm, Audio::Mixer *mixer)
MoviePlayer::~MoviePlayer() {
}
-bool MoviePlayer::open(const char *filename) {
+bool MoviePlayer::load(const char *filename) {
char filename2[100];
uint32 tag;
@@ -60,13 +60,6 @@ bool MoviePlayer::open(const char *filename) {
if (_fd.open(filename2) == false)
return false;
- _mixer->stopAll();
-
- _currentFrame = 0;
-
- _leftButtonDown = false;
- _rightButtonDown = false;
-
tag = _fd.readUint32BE();
assert(tag == MKID_BE('DEXA'));
@@ -86,6 +79,24 @@ bool MoviePlayer::open(const char *filename) {
error("error allocating frame tables, size %d\n", _frameSize);
}
+ return true;
+}
+
+void MoviePlayer::play() {
+ uint32 tag;
+
+ if (_fd.isOpen() == false) {
+ debug(0, "MoviePlayer::play: No file loaded");
+ return;
+ }
+
+ _mixer->stopAll();
+
+ _currentFrame = 0;
+
+ _leftButtonDown = false;
+ _rightButtonDown = false;
+
tag = _fd.readUint32BE();
assert(tag == MKID_BE('WAVE'));
@@ -102,7 +113,11 @@ bool MoviePlayer::open(const char *filename) {
if (_width != 640 && _height != 480)
g_system->clearScreen();
- play();
+ while (_currentFrame < _framesCount) {
+ handleNextFrame();
+ ++_currentFrame;
+ }
+
close();
_vm->o_killAnimate();
@@ -112,8 +127,6 @@ bool MoviePlayer::open(const char *filename) {
} else {
g_system->clearScreen();
}
-
- return true;
}
void MoviePlayer::close() {
@@ -122,13 +135,6 @@ void MoviePlayer::close() {
free(_frameBuffer2);
}
-void MoviePlayer::play() {
- while (_currentFrame < _framesCount) {
- handleNextFrame();
- ++_currentFrame;
- }
-}
-
void MoviePlayer::handleNextFrame() {
uint32 tag = _fd.readUint32BE();
if (tag == MKID_BE('CMAP')) {
diff --git a/engines/simon/animation.h b/engines/simon/animation.h
index 502fc4ee9e..29f4f5d213 100644
--- a/engines/simon/animation.h
+++ b/engines/simon/animation.h
@@ -54,9 +54,9 @@ public:
MoviePlayer(SimonEngine *vm, Audio::Mixer *mixer);
~MoviePlayer();
- bool open(const char *filename);
-private:
+ bool load(const char *filename);
void play();
+private:
void close();
void delay(uint amount);
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp
index 5f58523fd4..5c8193b3e7 100644
--- a/engines/simon/items.cpp
+++ b/engines/simon/items.cpp
@@ -332,8 +332,8 @@ void SimonEngine::setupOpcodes() {
opcode_table[172] = &SimonEngine::o3_hyperLinkOff;
opcode_table[173] = &SimonEngine::o3_checkPaths;
opcode_table[181] = &SimonEngine::o3_mouseOff;
- opcode_table[182] = &SimonEngine::o3_loadSmack;
- opcode_table[183] = &SimonEngine::o3_playSmack;
+ opcode_table[182] = &SimonEngine::o3_loadVideo;
+ opcode_table[183] = &SimonEngine::o3_playVideo;
opcode_table[187] = &SimonEngine::o3_centreScroll;
opcode_table[188] = &SimonEngine::o2_isShortText;
opcode_table[189] = &SimonEngine::o2_clearMarks;
@@ -1923,16 +1923,19 @@ void SimonEngine::o3_mouseOff() {
clearName();
}
-void SimonEngine::o3_loadSmack() {
+void SimonEngine::o3_loadVideo() {
// 182: load video file
- _videoName = getStringPtrByID(getNextStringID());
+ const byte *filename = getStringPtrByID(getNextStringID());
+ debug(0, "Load video %s", filename);
+
+ if (_moviePlay->load((const char *)filename) == false)
+ warning("Failed to load video file %s", filename);
}
-void SimonEngine::o3_playSmack() {
+void SimonEngine::o3_playVideo() {
// 183: play video
- debug(0, "Play video %s", _videoName);
-
- _moviePlay->open((const char *)_videoName);
+ debug(0, "Play video");
+ _moviePlay->play();
}
void SimonEngine::o3_centreScroll() {
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index 8d8d066f88..e9c8c194e2 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -194,7 +194,6 @@ SimonEngine::SimonEngine(OSystem *syst)
_tblList = 0;
_codePtr = 0;
- _videoName = 0;
_localStringtable = 0;
_stringIdLocalMin = 1;
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index 204af15c85..a6061777ed 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -208,7 +208,6 @@ protected:
byte *_tblList;
const byte *_codePtr;
- const byte *_videoName;
byte **_localStringtable;
uint _stringIdLocalMin, _stringIdLocalMax;
@@ -980,8 +979,8 @@ public:
void o3_hyperLinkOff();
void o3_checkPaths();
void o3_mouseOff();
- void o3_loadSmack();
- void o3_playSmack();
+ void o3_loadVideo();
+ void o3_playVideo();
void o3_centreScroll();
void o3_resetPVCount();
void o3_setPathValues();