aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2008-12-14 03:08:02 +0000
committerSven Hesse2008-12-14 03:08:02 +0000
commitbbe6ff006e79473a0beeac5a4d88f901c68102fb (patch)
tree3a8dd3e71625e40567b9586c3571283b91d67a15
parent126c5a1dc8ec76b74a33f9b62d553d652a382df4 (diff)
downloadscummvm-rg350-bbe6ff006e79473a0beeac5a4d88f901c68102fb.tar.gz
scummvm-rg350-bbe6ff006e79473a0beeac5a4d88f901c68102fb.tar.bz2
scummvm-rg350-bbe6ff006e79473a0beeac5a4d88f901c68102fb.zip
Music/Video handling fixes/stubs
svn-id: r35351
-rw-r--r--engines/gob/game_v6.cpp3
-rw-r--r--engines/gob/inter.h2
-rw-r--r--engines/gob/inter_v6.cpp73
-rw-r--r--engines/gob/sound/sound.cpp21
-rw-r--r--engines/gob/sound/sound.h1
-rw-r--r--engines/gob/videoplayer.cpp4
-rw-r--r--engines/gob/videoplayer.h2
7 files changed, 102 insertions, 4 deletions
diff --git a/engines/gob/game_v6.cpp b/engines/gob/game_v6.cpp
index 2a9a1c254f..d8c921107f 100644
--- a/engines/gob/game_v6.cpp
+++ b/engines/gob/game_v6.cpp
@@ -93,6 +93,9 @@ void Game_v6::pushCollisions(char all) {
size++;
}
+ if (_collStackSize >= 5)
+ error("Game_v6::pushCollisions: _collStackSize == %d", _collStackSize);
+
destPtr = new Collision[size];
_collStack[_collStackSize] = destPtr;
diff --git a/engines/gob/inter.h b/engines/gob/inter.h
index 59a914b2fd..140f99c432 100644
--- a/engines/gob/inter.h
+++ b/engines/gob/inter.h
@@ -624,6 +624,8 @@ protected:
virtual const char *getOpcodeFuncDesc(byte i, byte j);
virtual const char *getOpcodeGoblinDesc(int i);
+ void o6_playVmdOrMusic();
+
bool o6_loadCursor(OpFuncParams &params);
bool o6_evaluateStore(OpFuncParams &params);
bool o6_palLoad(OpFuncParams &params);
diff --git a/engines/gob/inter_v6.cpp b/engines/gob/inter_v6.cpp
index 59c406f7bb..f4c10dfb2f 100644
--- a/engines/gob/inter_v6.cpp
+++ b/engines/gob/inter_v6.cpp
@@ -32,6 +32,8 @@
#include "gob/game.h"
#include "gob/parse.h"
#include "gob/draw.h"
+#include "gob/sound/sound.h"
+#include "gob/videoplayer.h"
#include "gob/indeo3.h"
namespace Gob {
@@ -214,7 +216,7 @@ void Inter_v6::setupOpcodes() {
OPCODE(o5_initScreen),
OPCODE(o2_scroll),
OPCODE(o2_setScrollOffset),
- OPCODE(o4_playVmdOrMusic),
+ OPCODE(o6_playVmdOrMusic),
/* 84 */
OPCODE(o2_getImdInfo),
OPCODE(o2_openItk),
@@ -651,6 +653,75 @@ const char *Inter_v6::getOpcodeGoblinDesc(int i) {
return "";
}
+void Inter_v6::o6_playVmdOrMusic() {
+ char fileName[128];
+ int16 x, y;
+ int16 startFrame;
+ int16 lastFrame;
+ int16 breakKey;
+ int16 flags;
+ int16 palStart;
+ int16 palEnd;
+ uint16 palCmd;
+ bool close;
+
+ evalExpr(0);
+ strncpy0(fileName, _vm->_global->_inter_resStr, 127);
+
+ x = _vm->_parse->parseValExpr();
+ y = _vm->_parse->parseValExpr();
+ startFrame = _vm->_parse->parseValExpr();
+ lastFrame = _vm->_parse->parseValExpr();
+ breakKey = _vm->_parse->parseValExpr();
+ flags = _vm->_parse->parseValExpr();
+ palStart = _vm->_parse->parseValExpr();
+ palEnd = _vm->_parse->parseValExpr();
+ palCmd = 1 << (flags & 0x3F);
+
+ debugC(1, kDebugVideo, "Playing video \"%s\" @ %d+%d, frames %d - %d, "
+ "paletteCmd %d (%d - %d), flags %X", fileName, x, y, startFrame, lastFrame,
+ palCmd, palStart, palEnd, flags);
+
+ close = false;
+ if (lastFrame == -1) {
+ close = true;
+ } else if (lastFrame == -5) {
+ warning("Urban Stub: Stopping background music \"%s\"", fileName);
+ return;
+ } else if (lastFrame == -9) {
+ warning("Urban Stub: Starting background music \"%s\"", fileName);
+ return;
+ } else if (lastFrame == -10) {
+ _vm->_vidPlayer->primaryClose();
+ warning("Urban Stub: Video/Music command -10 (close video?)");
+ return;
+ } else if (lastFrame < 0) {
+ warning("Unknown Video/Music command: %d, %s", lastFrame, fileName);
+ return;
+ }
+
+ if (startFrame == -2) {
+ startFrame = 0;
+ lastFrame = -1;
+ close = false;
+ }
+
+ if ((fileName[0] != 0) && !_vm->_vidPlayer->primaryOpen(fileName, x, y, flags)) {
+ WRITE_VAR(11, (uint32) -1);
+ return;
+ }
+
+ if (startFrame >= 0) {
+ _vm->_game->_preventScroll = true;
+ _vm->_vidPlayer->primaryPlay(startFrame, lastFrame, breakKey,
+ palCmd, palStart, palEnd, 0, -1, false, -1, true);
+ _vm->_game->_preventScroll = false;
+ }
+
+ if (close)
+ _vm->_vidPlayer->primaryClose();
+}
+
bool Inter_v6::o6_loadCursor(OpFuncParams &params) {
int16 width, height;
byte *dataBuf;
diff --git a/engines/gob/sound/sound.cpp b/engines/gob/sound/sound.cpp
index 78ef69c912..84f47990ec 100644
--- a/engines/gob/sound/sound.cpp
+++ b/engines/gob/sound/sound.cpp
@@ -520,6 +520,25 @@ void Sound::cdTest(int trySubst, const char *label) {
_cdrom->testCD(trySubst, label);
}
+void Sound::bgPlay(const char *file) {
+ if (!_bgatmos)
+ return;
+
+ debugC(1, kDebugSound, "BackgroundAtmosphere: Playing \"%s\"", file);
+
+ _bgatmos->stop();
+ _bgatmos->queueClear();
+
+ SoundDesc *sndDesc = new SoundDesc;
+ if (!sampleLoad(sndDesc, file)) {
+ delete sndDesc;
+ return;
+ }
+
+ _bgatmos->queueSample(*sndDesc);
+ _bgatmos->play();
+}
+
void Sound::bgPlay(const char *base, int count) {
if (!_bgatmos)
return;
@@ -539,6 +558,8 @@ void Sound::bgPlay(const char *base, int count) {
sndDesc = new SoundDesc;
if (sampleLoad(sndDesc, fileName))
_bgatmos->queueSample(*sndDesc);
+ else
+ delete sndDesc;
}
_bgatmos->play();
diff --git a/engines/gob/sound/sound.h b/engines/gob/sound/sound.h
index 07b5a737db..641df6eb51 100644
--- a/engines/gob/sound/sound.h
+++ b/engines/gob/sound/sound.h
@@ -121,6 +121,7 @@ public:
// Background Atmosphere
+ void bgPlay(const char *file);
void bgPlay(const char *base, int count);
void bgStop();
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp
index e719374b5c..403fa12408 100644
--- a/engines/gob/videoplayer.cpp
+++ b/engines/gob/videoplayer.cpp
@@ -271,7 +271,7 @@ bool VideoPlayer::primaryOpen(const char *videoFile, int16 x, int16 y,
void VideoPlayer::primaryPlay(int16 startFrame, int16 lastFrame, int16 breakKey,
uint16 palCmd, int16 palStart, int16 palEnd,
- int16 palFrame, int16 endFrame, bool fade, int16 reverseTo) {
+ int16 palFrame, int16 endFrame, bool fade, int16 reverseTo, bool forceSeek) {
if (!_primaryVideo->isOpen())
return;
@@ -290,7 +290,7 @@ void VideoPlayer::primaryPlay(int16 startFrame, int16 lastFrame, int16 breakKey,
palCmd &= 0x3F;
if (video.getCurrentFrame() != startFrame) {
- if (video.getFeatures() & CoktelVideo::kFeaturesSound)
+ if (!forceSeek && (video.getFeatures() & CoktelVideo::kFeaturesSound))
startFrame = video.getCurrentFrame();
else
video.seekFrame(startFrame);
diff --git a/engines/gob/videoplayer.h b/engines/gob/videoplayer.h
index 295bb62fd3..a0617ca52f 100644
--- a/engines/gob/videoplayer.h
+++ b/engines/gob/videoplayer.h
@@ -58,7 +58,7 @@ public:
void primaryPlay(int16 startFrame = -1, int16 lastFrame = -1, int16 breakKey = 27,
uint16 palCmd = 8, int16 palStart = 0, int16 palEnd = 255,
int16 palFrame = -1, int16 endFrame = -1, bool fade = false,
- int16 reverseTo = -1);
+ int16 reverseTo = -1, bool forceSeek = false);
void primaryClose();
int slotOpen(const char *videoFile, Type which = kVideoTypeTry);