diff options
-rw-r--r-- | engines/scumm/imuse_digi/dimuse.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse.h | 5 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_script.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_track.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/insane/insane.h | 2 | ||||
-rw-r--r-- | engines/scumm/intern.h | 27 | ||||
-rw-r--r-- | engines/scumm/script_v6.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 73 | ||||
-rw-r--r-- | engines/scumm/scumm.h | 19 | ||||
-rw-r--r-- | engines/scumm/smush/chunk.cpp | 7 | ||||
-rw-r--r-- | engines/scumm/smush/smush_player.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/smush/smush_player.h | 6 |
12 files changed, 88 insertions, 63 deletions
diff --git a/engines/scumm/imuse_digi/dimuse.cpp b/engines/scumm/imuse_digi/dimuse.cpp index 761f5dff55..537faad92a 100644 --- a/engines/scumm/imuse_digi/dimuse.cpp +++ b/engines/scumm/imuse_digi/dimuse.cpp @@ -25,7 +25,7 @@ #include "scumm/actor.h" #include "scumm/saveload.h" -#include "scumm/scumm.h" +#include "scumm/intern.h" #include "scumm/sound.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" @@ -44,7 +44,7 @@ void IMuseDigital::timer_handler(void *refCon) { imuseDigital->callback(); } -IMuseDigital::IMuseDigital(ScummEngine *scumm, int fps) +IMuseDigital::IMuseDigital(ScummEngine_v7 *scumm, int fps) : _vm(scumm) { _pause = false; _sound = new ImuseDigiSndMgr(_vm); diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h index d94ad8d52d..0a3ed5b2f5 100644 --- a/engines/scumm/imuse_digi/dimuse.h +++ b/engines/scumm/imuse_digi/dimuse.h @@ -42,6 +42,7 @@ namespace Scumm { struct imuseDigTable; struct imuseComiTable; class Serializer; +class ScummEngine_v7; class IMuseDigital : public MusicEngine { private: @@ -88,7 +89,7 @@ private: Track *_track[MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS]; Common::Mutex _mutex; - ScummEngine *_vm; + ScummEngine_v7 *_vm; ImuseDigiSndMgr *_sound; char *_audioNames; @@ -130,7 +131,7 @@ private: void playDigMusic(const char *songName, const imuseDigTable *table, int atribPos, bool sequence); public: - IMuseDigital(ScummEngine *scumm, int fps); + IMuseDigital(ScummEngine_v7 *scumm, int fps); virtual ~IMuseDigital(); void setAudioNames(int32 num, char *names); diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp index 69bbac57c5..b55855262d 100644 --- a/engines/scumm/imuse_digi/dimuse_script.cpp +++ b/engines/scumm/imuse_digi/dimuse_script.cpp @@ -24,7 +24,7 @@ #include "common/timer.h" #include "scumm/actor.h" -#include "scumm/scumm.h" +#include "scumm/intern.h" #include "scumm/sound.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index d9baa00c6e..eb17887a0b 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -23,7 +23,7 @@ #include "common/timer.h" #include "scumm/actor.h" -#include "scumm/scumm.h" +#include "scumm/intern.h" #include "scumm/sound.h" #include "scumm/imuse_digi/dimuse.h" #include "scumm/imuse_digi/dimuse_bndmgr.h" diff --git a/engines/scumm/insane/insane.h b/engines/scumm/insane/insane.h index 13baab49fe..522636d519 100644 --- a/engines/scumm/insane/insane.h +++ b/engines/scumm/insane/insane.h @@ -70,7 +70,7 @@ class Insane { private: - ScummEngine_v6 *_vm; + ScummEngine_v7 *_vm; SmushPlayer *_player; int32 _speed; diff --git a/engines/scumm/intern.h b/engines/scumm/intern.h index 66312afe57..bf90f315b5 100644 --- a/engines/scumm/intern.h +++ b/engines/scumm/intern.h @@ -538,8 +538,6 @@ protected: const OpcodeEntryV6 *_opcodesV6; - int _smushFrameRate; - struct TextObject { int16 xpos, ypos; byte color; @@ -577,6 +575,25 @@ protected: int16 _akosQueuePos; + int _smushFrameRate; + + /** + * Flag which signals that the SMUSH video playback should end now + * (e.g. because it was aborted by the user or it's simply finished). + */ + bool _smushVideoShouldFinish; + + /** This flag is a hack to allow the pause dialog to pause SMUSH playback, too. */ + bool _smushPaused; + + Insane *_insane; + +public: + /** This flag tells IMuseDigital that INSANE is running. */ + bool _insaneRunning; // Used by IMuseDigital::flushTracks() + + SmushMixer *_smixer; + public: ScummEngine_v6(OSystem *syst, const DetectorResult &dr); @@ -817,6 +834,8 @@ protected: #ifndef DISABLE_SCUMM_7_8 class ScummEngine_v7 : public ScummEngine_v6 { + friend class SmushPlayer; + friend class Insane; public: ScummEngine_v7(OSystem *syst, const DetectorResult &dr); ~ScummEngine_v7(); @@ -855,10 +874,14 @@ public: void clearSubtitleQueue(); protected: + virtual int runDialog(Dialog &dialog); + virtual void scummLoop_handleSound(); virtual void scummLoop_handleDrawing(); virtual void processKeyboard(bool smushMode); + virtual void setupScumm(); + virtual void setupScummVars(); virtual void resetScummVars(); diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index df3f1fb76b..87660c6db3 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -2526,7 +2526,7 @@ void ScummEngine_v6::o6_kernelSetFunctions() { if (strcmp((char *)getStringAddressVar(VAR_VIDEONAME), "sq3.san") == 0) _smushFrameRate = 14; - SmushPlayer *sp = new SmushPlayer(this, _smushFrameRate); + SmushPlayer *sp = new SmushPlayer((ScummEngine_v7 *)this, _smushFrameRate); // Correct incorrect smush filename in Macintosh FT demo if ((_game.id == GID_FT) && (_game.features & GF_DEMO) && (_game.platform == Common::kPlatformMacintosh) && diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 755a4358ab..38720235d5 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -248,16 +248,12 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) // Init all vars _imuse = NULL; _imuseDigital = NULL; - _smixer = NULL; _musicEngine = NULL; _verbs = NULL; _objs = NULL; _debugFlags = 0; _sound = NULL; memset(&vm, 0, sizeof(vm)); - _smushVideoShouldFinish = false; - _smushPaused = false; - _insaneRunning = false; _quit = false; _pauseDialog = NULL; _mainMenuDialog = NULL; @@ -663,12 +659,6 @@ ScummEngine::~ScummEngine() { delete _musicEngine; } -#ifndef DISABLE_SCUMM_7_8 - if (_smixer) { - _smixer->stop(); - delete _smixer; - } -#endif _mixer->stopAll(); delete [] _actors; @@ -790,8 +780,6 @@ ScummEngine_v6::ScummEngine_v6(OSystem *syst, const DetectorResult &dr) _blastTextQueuePos = 0; memset(_blastTextQueue, 0, sizeof(_blastTextQueue)); - _smushFrameRate = 0; - memset(_akosQueue, 0, sizeof(_akosQueue)); _akosQueuePos = 0; @@ -926,6 +914,13 @@ ScummEngine_v7::ScummEngine_v7(OSystem *syst, const DetectorResult &dr) : ScummEngine_v6(syst, dr) { _verbCharset = 0; _verbLineSpacing = 10; + + _smushFrameRate = 0; + _smushVideoShouldFinish = false; + _smushPaused = false; + _insaneRunning = false; + _smixer = NULL; + _existLanguageFile = false; _languageBuffer = NULL; _languageIndex = NULL; @@ -933,6 +928,11 @@ ScummEngine_v7::ScummEngine_v7(OSystem *syst, const DetectorResult &dr) } ScummEngine_v7::~ScummEngine_v7() { + if (_smixer) { + _smixer->stop(); + delete _smixer; + } + free(_languageBuffer); free(_languageIndex); } @@ -992,7 +992,6 @@ int ScummEngine::init() { return 0; } - void ScummEngine::setupScumm() { // On some systems it's not safe to run CD audio games from the CD. if (_game.features & GF_AUDIOTRACKS) { @@ -1024,14 +1023,6 @@ void ScummEngine::setupScumm() { // Create the costume renderer setupCostumeRenderer(); -#ifndef DISABLE_SCUMM_7_8 - // Create FT INSANE object - if (_game.id == GID_FT) - _insane = new Insane((ScummEngine_v7 *)this); - else -#endif - _insane = 0; - // Load game from specified slot, if any if (ConfMan.hasKey("save_slot")) { requestLoad(ConfMan.getInt("save_slot")); @@ -1096,6 +1087,27 @@ void ScummEngine::setupScumm() { #endif } +#ifndef DISABLE_SCUMM_7_8 +void ScummEngine_v7::setupScumm() { + + if (_game.features & GF_DIGI_IMUSE) { +#ifndef DISABLE_SCUMM_7_8 + _musicEngine = _imuseDigital = new IMuseDigital(this, 10); +#endif + } + + ScummEngine::setupScumm(); + + // Create FT INSANE object + if (_game.id == GID_FT) + _insane = new Insane((ScummEngine_v7 *)this); + else + _insane = 0; + + _smixer = new SmushMixer(_mixer); +} +#endif + void ScummEngine::setupCharsetRenderer() { if (_game.platform == Common::kPlatformNES) _charset = new CharsetRendererNES(this); @@ -1433,10 +1445,7 @@ void ScummEngine::setupMusic(int midi) { // Init iMuse if (_game.features & GF_DIGI_IMUSE) { -#ifndef DISABLE_SCUMM_7_8 - _musicEngine = _imuseDigital = new IMuseDigital(this, 10); - _smixer = new SmushMixer(_mixer); -#endif + // Setup for digital iMuse is performed in another place } else if (_game.platform == Common::kPlatformC64) { // TODO _musicEngine = NULL; @@ -2058,8 +2067,6 @@ int ScummEngine::runDialog(Dialog &dialog) { // Pause sound & video bool old_soundsPaused = _sound->_soundsPaused; _sound->pauseSounds(true); - bool oldSmushPaused = _smushPaused; - _smushPaused = true; // Open & run the dialog int result = dialog.runModal(); @@ -2069,7 +2076,6 @@ int ScummEngine::runDialog(Dialog &dialog) { // Resume sound & video _sound->pauseSounds(old_soundsPaused); - _smushPaused = oldSmushPaused; _engineStartTime += (_system->getMillis() / 1000) - _dialogStartTime; _dialogStartTime = 0; @@ -2078,6 +2084,17 @@ int ScummEngine::runDialog(Dialog &dialog) { return result; } +int ScummEngine_v7::runDialog(Dialog &dialog) { + bool oldSmushPaused = _smushPaused; + _smushPaused = true; + + int result = ScummEngine::runDialog(dialog); + + _smushPaused = oldSmushPaused; + + return result; +} + void ScummEngine::pauseDialog() { if (!_pauseDialog) _pauseDialog = new PauseDialog(this, 4); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index c6088d7237..b03c217c0e 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -412,8 +412,6 @@ protected: */ class ScummEngine : public Engine { friend class ScummDebugger; - friend class SmushPlayer; - friend class Insane; friend class CharsetRenderer; friend class ResourceManager; @@ -428,7 +426,6 @@ public: IMuseDigital *_imuseDigital; MusicEngine *_musicEngine; Sound *_sound; - SmushMixer *_smixer; VerbSlot *_verbs; ObjectData *_objs; @@ -506,20 +503,6 @@ protected: virtual void animateCursor() {} virtual void updatePalette(); - /** - * Flag which signals that the SMUSH video playback should end now - * (e.g. because it was aborted by the user or it's simply finished). - */ - bool _smushVideoShouldFinish; - /** This flag is a hack to allow the pause dialog to pause SMUSH playback, too. */ - bool _smushPaused; -public: - /** This flag tells IMuseDigital that INSANE is running. */ - bool _insaneRunning; // Used by IMuseDigital::flushTracks() - -protected: - Insane *_insane; - public: void pauseGame(); void restart(); @@ -533,7 +516,7 @@ protected: Dialog *_versionDialog; Dialog *_mainMenuDialog; - int runDialog(Dialog &dialog); + virtual int runDialog(Dialog &dialog); void confirmExitDialog(); void confirmRestartDialog(); void pauseDialog(); diff --git a/engines/scumm/smush/chunk.cpp b/engines/scumm/smush/chunk.cpp index 2d457e0d85..d698baa844 100644 --- a/engines/scumm/smush/chunk.cpp +++ b/engines/scumm/smush/chunk.cpp @@ -84,9 +84,10 @@ bool BaseChunk::seek(int32 delta, seek_type dir) { } if (_curPos > _size) { - if (g_scumm->_insaneRunning) { - warning("Looks like you compressed file %s in wrong way. It has FLU index which was not updated", _name.c_str()); - } +// FIXME: This is an evil hack, can't we do better?! +// if (g_scumm->_insaneRunning) { +// warning("Looks like you compressed file %s in wrong way. It has FLU index which was not updated", _name.c_str()); +// } error("invalid seek request : %d > %d (delta == %d)", _curPos, _size, delta); } return true; diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index 94409d5d09..d4f9164f83 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -235,7 +235,7 @@ void SmushPlayer::timerCallback(void *refCon) { #endif } -SmushPlayer::SmushPlayer(ScummEngine_v6 *scumm, int speed) { +SmushPlayer::SmushPlayer(ScummEngine_v7 *scumm, int speed) { _vm = scumm; _version = -1; _nbframes = 0; diff --git a/engines/scumm/smush/smush_player.h b/engines/scumm/smush/smush_player.h index e5ea8be04e..3b22a41b4e 100644 --- a/engines/scumm/smush/smush_player.h +++ b/engines/scumm/smush/smush_player.h @@ -31,7 +31,7 @@ namespace Scumm { -class ScummEngine_v6; +class ScummEngine_v7; class SmushFont; class SmushMixer; class StringResource; @@ -39,7 +39,7 @@ class StringResource; class SmushPlayer { friend class Insane; private: - ScummEngine_v6 *_vm; + ScummEngine_v7 *_vm; int _version; int32 _nbframes; SmushMixer *_smixer; @@ -95,7 +95,7 @@ private: Common::Mutex _mutex; public: - SmushPlayer(ScummEngine_v6 *scumm, int speed); + SmushPlayer(ScummEngine_v7 *scumm, int speed); ~SmushPlayer(); void play(const char *filename, int32 offset = 0, int32 startFrame = 0); |