diff options
Diffstat (limited to 'engines/sci/sci.cpp')
-rw-r--r-- | engines/sci/sci.cpp | 79 |
1 files changed, 61 insertions, 18 deletions
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index e14d12b918..3ea2756f56 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -43,12 +43,12 @@ #include "sci/sound/audio.h" #include "sci/sound/music.h" +#include "sci/sound/sync.h" #include "sci/sound/soundcmd.h" #include "sci/graphics/animate.h" #include "sci/graphics/cache.h" #include "sci/graphics/compare.h" #include "sci/graphics/controls16.h" -#include "sci/graphics/controls32.h" #include "sci/graphics/coordadjuster.h" #include "sci/graphics/cursor.h" #include "sci/graphics/maciconbar.h" @@ -64,9 +64,14 @@ #include "sci/graphics/transitions.h" #ifdef ENABLE_SCI32 +#include "sci/graphics/controls32.h" +#include "sci/graphics/frameout.h" #include "sci/graphics/palette32.h" +#include "sci/graphics/remap32.h" #include "sci/graphics/text32.h" -#include "sci/graphics/frameout.h" +#include "sci/graphics/video32.h" +#include "sci/sound/audio32.h" +// TODO: Move this to video32 #include "sci/video/robot_decoder.h" #endif @@ -86,6 +91,11 @@ SciEngine::SciEngine(OSystem *syst, const ADGameDescription *desc, SciGameId gam _gfxMacIconBar = 0; _audio = 0; + _sync = nullptr; +#ifdef ENABLE_SCI32 + _audio32 = nullptr; + _video32 = nullptr; +#endif _features = 0; _resMan = 0; _gamestate = 0; @@ -157,20 +167,24 @@ SciEngine::~SciEngine() { DebugMan.clearAllDebugChannels(); #ifdef ENABLE_SCI32 - // _gfxPalette32 is the same as _gfxPalette16 - // and will be destroyed when _gfxPalette16 is - // destroyed delete _gfxControls32; + delete _gfxPaint32; delete _gfxText32; delete _robotDecoder; + // GfxFrameout and GfxPalette32 must be deleted after Video32 since + // destruction of screen items in the Video32 destructor relies on these + // components + delete _video32; + delete _gfxPalette32; delete _gfxFrameout; delete _gfxRemap32; + delete _audio32; #endif delete _gfxMenu; delete _gfxControls16; delete _gfxText16; delete _gfxAnimate; - delete _gfxPaint; + delete _gfxPaint16; delete _gfxTransitions; delete _gfxCompare; delete _gfxCoordAdjuster; @@ -182,6 +196,7 @@ SciEngine::~SciEngine() { delete _gfxScreen; delete _audio; + delete _sync; delete _soundCmd; delete _kernel; delete _vocabulary; @@ -266,9 +281,21 @@ Common::Error SciEngine::run() { // Also, XMAS1990 apparently had a parser too. Refer to http://forums.scummvm.org/viewtopic.php?t=9135 if (getGameId() == GID_CHRISTMAS1990) _vocabulary = new Vocabulary(_resMan, false); - _audio = new AudioPlayer(_resMan); + _gamestate = new EngineState(segMan); _eventMan = new EventManager(_resMan->detectFontExtended()); +#ifdef ENABLE_SCI32 + if (getSciVersion() >= SCI_VERSION_2_1_EARLY) { + _audio32 = new Audio32(_resMan); + } else +#endif + _audio = new AudioPlayer(_resMan); +#ifdef ENABLE_SCI32 + if (getSciVersion() >= SCI_VERSION_2) { + _video32 = new Video32(segMan, _eventMan); + } +#endif + _sync = new Sync(_resMan, segMan); // Create debugger console. It requires GFX and _gamestate to be initialized _console = new Console(this); @@ -341,6 +368,17 @@ Common::Error SciEngine::run() { } } + if (getGameId() == GID_KQ7 && ConfMan.getBool("subtitles")) { + showScummVMDialog("Subtitles are enabled, but subtitling in King's" + " Quest 7 was unfinished and disabled in the release" + " version of the game. ScummVM allows the subtitles" + " to be re-enabled, but because they were removed from" + " the original game, they do not always render" + " properly or reflect the actual game speech." + " This is not a ScummVM bug -- it is a problem with" + " the game's assets."); + } + // Show a warning if the user has selected a General MIDI device, no GM patch exists // (i.e. patch 4) and the game is one of the known 8 SCI1 games that Sierra has provided // after market patches for in their "General MIDI Utility". @@ -660,7 +698,6 @@ void SciEngine::initGraphics() { _gfxCursor = 0; _gfxMacIconBar = 0; _gfxMenu = 0; - _gfxPaint = 0; _gfxPaint16 = 0; _gfxPalette16 = 0; _gfxRemap16 = 0; @@ -682,9 +719,8 @@ void SciEngine::initGraphics() { #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2) { - _gfxPalette32 = new GfxPalette32(_resMan, _gfxScreen); - _gfxPalette16 = _gfxPalette32; - _gfxRemap32 = new GfxRemap32(_gfxPalette32); + _gfxPalette32 = new GfxPalette32(_resMan); + _gfxRemap32 = new GfxRemap32(); } else { #endif _gfxPalette16 = new GfxPalette(_resMan, _gfxScreen); @@ -703,10 +739,9 @@ void SciEngine::initGraphics() { _gfxCoordAdjuster = new GfxCoordAdjuster32(_gamestate->_segMan); _gfxCursor->init(_gfxCoordAdjuster, _eventMan); _gfxCompare = new GfxCompare(_gamestate->_segMan, _gfxCache, _gfxScreen, _gfxCoordAdjuster); - _gfxPaint32 = new GfxPaint32(_resMan, _gfxCoordAdjuster, _gfxScreen, _gfxPalette32); - _gfxPaint = _gfxPaint32; + _gfxPaint32 = new GfxPaint32(_gamestate->_segMan); _robotDecoder = new RobotDecoder(getPlatform() == Common::kPlatformMacintosh); - _gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxCoordAdjuster, _gfxCache, _gfxScreen, _gfxPalette32, _gfxPaint32); + _gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxCoordAdjuster, _gfxScreen, _gfxPalette32); _gfxText32 = new GfxText32(_gamestate->_segMan, _gfxCache); _gfxControls32 = new GfxControls32(_gamestate->_segMan, _gfxCache, _gfxText32); _gfxFrameout->run(); @@ -719,7 +754,6 @@ void SciEngine::initGraphics() { _gfxCompare = new GfxCompare(_gamestate->_segMan, _gfxCache, _gfxScreen, _gfxCoordAdjuster); _gfxTransitions = new GfxTransitions(_gfxScreen, _gfxPalette16); _gfxPaint16 = new GfxPaint16(_resMan, _gamestate->_segMan, _gfxCache, _gfxPorts, _gfxCoordAdjuster, _gfxScreen, _gfxPalette16, _gfxTransitions, _audio); - _gfxPaint = _gfxPaint16; _gfxAnimate = new GfxAnimate(_gamestate, _scriptPatcher, _gfxCache, _gfxPorts, _gfxPaint16, _gfxScreen, _gfxPalette16, _gfxCursor, _gfxTransitions); _gfxText16 = new GfxText16(_gfxCache, _gfxPorts, _gfxPaint16, _gfxScreen); _gfxControls16 = new GfxControls16(_gamestate->_segMan, _gfxPorts, _gfxPaint16, _gfxText16, _gfxScreen); @@ -734,8 +768,10 @@ void SciEngine::initGraphics() { } #endif - // Set default (EGA, amiga or resource 999) palette - _gfxPalette16->setDefault(); + if (getSciVersion() < SCI_VERSION_2) { + // Set default (EGA, amiga or resource 999) palette + _gfxPalette16->setDefault(); + } } void SciEngine::initStackBaseWithSelector(Selector selector) { @@ -801,7 +837,10 @@ void SciEngine::runGame() { void SciEngine::exitGame() { if (_gamestate->abortScriptProcessing != kAbortLoadGame) { _gamestate->_executionStack.clear(); - _audio->stopAllAudio(); + if (_audio) { + _audio->stopAllAudio(); + } + _sync->stop(); _soundCmd->clearPlayList(); } @@ -897,6 +936,10 @@ Common::String SciEngine::unwrapFilename(const Common::String &name) const { return name; } +const char *SciEngine::getGameObjectName() { + return _gamestate->_segMan->getObjectName(_gameObjectAddress); +} + int SciEngine::inQfGImportRoom() const { if (_gameId == GID_QFG2 && _gamestate->currentRoomNumber() == 805) { // QFG2 character import screen |