diff options
Diffstat (limited to 'engines/fullpipe/fullpipe.cpp')
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 100 |
1 files changed, 87 insertions, 13 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 246510e227..0a176ca07d 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -34,9 +34,11 @@ #include "fullpipe/modal.h" #include "fullpipe/input.h" #include "fullpipe/motion.h" +#include "fullpipe/statics.h" #include "fullpipe/scenes.h" #include "fullpipe/floaters.h" #include "fullpipe/console.h" +#include "fullpipe/constants.h" namespace Fullpipe { @@ -104,6 +106,18 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _musicAllowed = -1; _musicGameVar = 0; + _musicMinDelay = 0; + _musicMaxDelay = 0; + _musicLocal = 0; + _trackStartDelay = 0; + + memset(_sceneTracks, 0, sizeof(_sceneTracks)); + memset(_trackName, 0, sizeof(_trackName)); + memset(_sceneTracksCurrentTrack, 0, sizeof(_sceneTracksCurrentTrack)); + + _numSceneTracks = 0; + _sceneTrackHasSequence = false; + _sceneTrackIsPlaying = false; _aniMan = 0; _aniMan2 = 0; @@ -193,16 +207,50 @@ void FullpipeEngine::initialize() { } void FullpipeEngine::restartGame() { - warning("STUB: FullpipeEngine::restartGame()"); + _floaters->stopAll(); + + clearGlobalMessageQueueList(); + clearMessages(); + + initObjectStates(); + + if (_scene2) { + _scene2->getAniMan(); + _scene2 = 0; + } + + if (_currentScene) { + _gameLoader->unloadScene(_currentScene->_sceneId); + + _currentScene = 0; + } + + _gameLoader->restoreDefPicAniInfos(); + + getGameLoaderInventory()->clear(); + getGameLoaderInventory()->addItem(ANI_INV_MAP, 1); + getGameLoaderInventory()->rebuildItemRects(); + + initMap(); + + if (_flgPlayIntro) { + _gameLoader->loadScene(SC_INTRO1); + _gameLoader->gotoScene(SC_INTRO1, TrubaUp); + } else { + _gameLoader->loadScene(SC_1); + _gameLoader->gotoScene(SC_1, TrubaLeft); + } } Common::Error FullpipeEngine::run() { - const Graphics::PixelFormat format(2, 5, 6, 5, 0, 11, 5, 0, 0); + const Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0); // Initialize backend initGraphics(800, 600, true, &format); _backgroundSurface.create(800, 600, format); + _origFormat = new Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); + _console = new Console(this); initialize(); @@ -335,7 +383,7 @@ void FullpipeEngine::updateEvents() { case Common::EVENT_QUIT: _gameContinue = false; break; - case Common::EVENT_RBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: if (!_inputArFlag && (_updateTicks - _lastInputTicks) >= 2) { ex = new ExCommand(0, 17, 107, event.mouse.x, event.mouse.y, 0, 1, 0, 0, 0); ex->_excFlags |= 3; @@ -368,21 +416,34 @@ void FullpipeEngine::updateEvents() { } } - -#if 0 - warning("STUB: FullpipeEngine::updateEvents() <mainWindowProc>"); - if (Msg == MSG_SC11_SHOWSWING && _modalObject) { - _modalObject->method14(); - } -#endif + // pollEvent() is implemented only for video player. So skip it. + //if (event.kbd.keycode == MSG_SC11_SHOWSWING && _modalObject) { + // _modalObject->pollEvent(); + //} } void FullpipeEngine::freeGameLoader() { - warning("STUB: FullpipeEngine::freeGameLoader()"); + setCursor(0); + delete _movTable; + _floaters->stopAll(); + delete _gameLoader; + _currentScene = 0; + _scene2 = 0; + _loaderScene = 0; } void FullpipeEngine::cleanup() { - warning("STUB: FullpipeEngine::cleanup()"); + //cleanRecorder(); + clearMessageHandlers(); + clearMessages(); + _globalMessageQueueList->compact(); + + for (uint i = 0; i < _globalMessageQueueList->size(); i++) + delete (*_globalMessageQueueList)[i]; + + stopAllSoundStreams(); + + delete _origFormat; } void FullpipeEngine::updateScreen() { @@ -465,7 +526,20 @@ void FullpipeEngine::setObjectState(const char *name, int state) { } void FullpipeEngine::disableSaves(ExCommand *ex) { - warning("STUB: FullpipeEngine::disableSaves()"); + if (_isSaveAllowed) { + _isSaveAllowed = false; + + if (_globalMessageQueueList->size() && (*_globalMessageQueueList)[0] != 0) { + for (uint i = 0; i < _globalMessageQueueList->size(); i++) { + if ((*_globalMessageQueueList)[i]->_flags & 1) + if ((*_globalMessageQueueList)[i]->_id != ex->_parId && !(*_globalMessageQueueList)[i]->_isFinished) + return; + } + } + + if (_currentScene) + _gameLoader->writeSavegame(_currentScene, "savetmp.sav"); + } } |