diff options
Diffstat (limited to 'engines/composer/composer.cpp')
-rw-r--r-- | engines/composer/composer.cpp | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index 5db778dfda..f070338978 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -42,12 +42,23 @@ #include "composer/composer.h" #include "composer/graphics.h" #include "composer/resource.h" +#include "composer/console.h" namespace Composer { ComposerEngine::ComposerEngine(OSystem *syst, const ComposerGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { _rnd = new Common::RandomSource("composer"); _audioStream = NULL; + _currSoundPriority = 0; + _currentTime = 0; + _lastTime = 0; + _needsUpdate = true; + _directoriesToStrip = 1; + _mouseVisible = true; + _mouseEnabled = false; + _mouseSpriteId = 0; + _lastButton = NULL; + _console = NULL; } ComposerEngine::~ComposerEngine() { @@ -64,6 +75,7 @@ ComposerEngine::~ComposerEngine() { i->_surface.free(); delete _rnd; + delete _console; } Common::Error ComposerEngine::run() { @@ -79,12 +91,6 @@ Common::Error ComposerEngine::run() { _queuedScripts[i]._scriptId = 0; } - _mouseVisible = true; - _mouseEnabled = false; - _mouseSpriteId = 0; - _lastButton = NULL; - - _directoriesToStrip = 1; if (!_bookIni.loadFromFile("book.ini")) { _directoriesToStrip = 0; if (!_bookIni.loadFromFile("programs/book.ini")) { @@ -103,7 +109,6 @@ Common::Error ComposerEngine::run() { height = atoi(getStringFromConfig("Common", "Height").c_str()); initGraphics(width, height, true); _screen.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - _needsUpdate = true; Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor(); CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), @@ -111,13 +116,16 @@ Common::Error ComposerEngine::run() { CursorMan.replaceCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount()); delete cursor; - loadLibrary(0); + _console = new Console(this); - _currentTime = 0; - _lastTime = 0; + loadLibrary(0); uint fps = atoi(getStringFromConfig("Common", "FPS").c_str()); - uint frameTime = 1000 / fps; + uint frameTime = 125; // Default to 125ms (1000/8) + if (fps != 0) + frameTime = 1000 / fps; + else + warning("FPS in book.ini is zero. Defaulting to 8..."); uint32 lastDrawTime = 0; while (!shouldQuit()) { @@ -127,7 +135,7 @@ Common::Error ComposerEngine::run() { else loadLibrary(_pendingPageChanges[i]._pageId); - lastDrawTime = _system->getMillis(); + lastDrawTime = 0; } _pendingPageChanges.clear(); @@ -160,9 +168,10 @@ Common::Error ComposerEngine::run() { else lastDrawTime += frameTime; + tickOldScripts(); + redraw(); - tickOldScripts(); processAnimFrame(); } else if (_needsUpdate) { redraw(); @@ -187,11 +196,11 @@ Common::Error ComposerEngine::run() { case Common::EVENT_KEYDOWN: switch (event.kbd.keycode) { case Common::KEYCODE_d: - /*if (event.kbd.hasFlags(Common::KBD_CTRL)) { + if (event.kbd.hasFlags(Common::KBD_CTRL)) { // Start the debugger getDebugger()->attach(); getDebugger()->onFrame(); - }*/ + } break; case Common::KEYCODE_q: |