aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/demos
diff options
context:
space:
mode:
authorSven Hesse2009-07-24 21:33:55 +0000
committerSven Hesse2009-07-24 21:33:55 +0000
commit90d8dcca5f7bcbaf309f72eca8c2a0d3863657d0 (patch)
treed3d987979e7169a3492d2e0a6afa1483d1510fb6 /engines/gob/demos
parent6e79ba66c9be70ed369a00ee6d59ade9df527e7d (diff)
downloadscummvm-rg350-90d8dcca5f7bcbaf309f72eca8c2a0d3863657d0.tar.gz
scummvm-rg350-90d8dcca5f7bcbaf309f72eca8c2a0d3863657d0.tar.bz2
scummvm-rg350-90d8dcca5f7bcbaf309f72eca8c2a0d3863657d0.zip
Adding ADL playback to the demoplayer
svn-id: r42709
Diffstat (limited to 'engines/gob/demos')
-rw-r--r--engines/gob/demos/demoplayer.cpp45
-rw-r--r--engines/gob/demos/demoplayer.h2
-rw-r--r--engines/gob/demos/scnplayer.cpp2
3 files changed, 49 insertions, 0 deletions
diff --git a/engines/gob/demos/demoplayer.cpp b/engines/gob/demos/demoplayer.cpp
index 7f65721ce5..13b7aa5327 100644
--- a/engines/gob/demos/demoplayer.cpp
+++ b/engines/gob/demos/demoplayer.cpp
@@ -34,6 +34,7 @@
#include "gob/draw.h"
#include "gob/inter.h"
#include "gob/videoplayer.h"
+#include "gob/sound/sound.h"
namespace Gob {
@@ -186,6 +187,30 @@ void DemoPlayer::playVideo(const char *fileName) {
free(filePtr);
}
+void DemoPlayer::playADL(const char *params) {
+ const char *end;
+
+ end = strchr(params, ' ');
+ if (!end)
+ end = params + strlen(params);
+
+ Common::String fileName(params, end);
+ bool waitEsc = true;
+ int32 repeat = -1;
+
+ if (*end != '\0') {
+ const char *start = end + 1;
+
+ waitEsc = (*start != '0');
+
+ end = strchr(start, ' ');
+ if (end)
+ repeat = atoi(end + 1);
+ }
+
+ playADL(fileName, waitEsc, repeat);
+}
+
void DemoPlayer::playVideoNormal() {
_vm->_vidPlayer->primaryPlay();
}
@@ -233,6 +258,26 @@ void DemoPlayer::playVideoDoubled() {
}
}
+void DemoPlayer::playADL(const Common::String &fileName, bool waitEsc, int32 repeat) {
+ debugC(1, kDebugDemo, "Playing ADL \"%s\" (%d, %d)", fileName.c_str(), waitEsc, repeat);
+
+ _vm->_sound->adlibUnload();
+ _vm->_sound->adlibLoadADL(fileName.c_str());
+ _vm->_sound->adlibSetRepeating(repeat);
+ _vm->_sound->adlibPlay();
+
+ if (!waitEsc)
+ return;
+
+ int16 key = 0;
+ while (!_vm->shouldQuit() && (key != kKeyEscape) && _vm->_sound->adlibIsPlaying()) {
+ _vm->_util->longDelay(1);
+ while (_vm->_util->checkKey(key))
+ if (key == kKeyEscape)
+ break;
+ }
+}
+
void DemoPlayer::evaluateVideoMode(const char *mode) {
debugC(2, kDebugDemo, "Video mode \"%s\"", mode);
diff --git a/engines/gob/demos/demoplayer.h b/engines/gob/demos/demoplayer.h
index 64c98b58c5..f0672b9645 100644
--- a/engines/gob/demos/demoplayer.h
+++ b/engines/gob/demos/demoplayer.h
@@ -57,9 +57,11 @@ protected:
void evaluateVideoMode(const char *mode);
void clearScreen();
void playVideo(const char *fileName);
+ void playADL(const char *params);
void playVideoNormal();
void playVideoDoubled();
+ void playADL(const Common::String &fileName, bool waitEsc = true, int32 repeat = -1);
private:
enum ScriptSource {
diff --git a/engines/gob/demos/scnplayer.cpp b/engines/gob/demos/scnplayer.cpp
index 616da3272a..bf81773a15 100644
--- a/engines/gob/demos/scnplayer.cpp
+++ b/engines/gob/demos/scnplayer.cpp
@@ -66,6 +66,8 @@ bool SCNPlayer::playStream(Common::SeekableReadStream &scn) {
_rebase0 = true;
} else if (lineStartsWith(line, "REBASE0:OFF")) {
_rebase0 = false;
+ } else if (lineStartsWith(line, "ADL ")) {
+ playADL(line.c_str() + 4);
}
// Mind user input