diff options
author | Filippos Karapetis | 2019-05-27 21:14:08 +0300 |
---|---|---|
committer | Filippos Karapetis | 2019-05-27 21:14:08 +0300 |
commit | 4ade45cb11f5929bc951d02d8077c499880c76a6 (patch) | |
tree | 91305dff9811a8410098c653a0a8f086d0375209 /engines | |
parent | 430b87d5ff3d4b0824ba013b3c74cf682fc611d1 (diff) | |
download | scummvm-rg350-4ade45cb11f5929bc951d02d8077c499880c76a6.tar.gz scummvm-rg350-4ade45cb11f5929bc951d02d8077c499880c76a6.tar.bz2 scummvm-rg350-4ade45cb11f5929bc951d02d8077c499880c76a6.zip |
STARTREK: Improve game responsiveness
- Add a delay after screen updates
- Do not update the screen when drawing the background - this is unnecessary
- Fix memory leak when drawing the background
Diffstat (limited to 'engines')
-rw-r--r-- | engines/startrek/events.cpp | 1 | ||||
-rw-r--r-- | engines/startrek/graphics.cpp | 7 | ||||
-rw-r--r-- | engines/startrek/intro.cpp | 1 | ||||
-rw-r--r-- | engines/startrek/menu.cpp | 3 | ||||
-rw-r--r-- | engines/startrek/startrek.cpp | 3 |
5 files changed, 13 insertions, 2 deletions
diff --git a/engines/startrek/events.cpp b/engines/startrek/events.cpp index 8e7d2c1884..d8935bd432 100644 --- a/engines/startrek/events.cpp +++ b/engines/startrek/events.cpp @@ -43,6 +43,7 @@ void StarTrekEngine::pollEvents(bool queueEvents) { // WORKAROUND: this improves the responsiveness of the mouse. _system->updateScreen(); + _system->delayMillis(10); break; case Common::EVENT_LBUTTONDOWN: diff --git a/engines/startrek/graphics.cpp b/engines/startrek/graphics.cpp index f92ef77594..5c6a1441b6 100644 --- a/engines/startrek/graphics.cpp +++ b/engines/startrek/graphics.cpp @@ -131,6 +131,7 @@ void Graphics::clearScreenAndPriBuffer() { surface->fillRect(_screenRect, 0); _vm->_system->unlockScreen(); _vm->_system->updateScreen(); + _vm->_system->delayMillis(10); } void Graphics::loadPalette(const Common::String &paletteName) { @@ -200,6 +201,7 @@ void Graphics::setPaletteFadeLevel(byte *palData, int fadeLevel) { // FIXME: this isn't supposed to flush changes to graphics, only palettes. // Might not matter... _vm->_system->updateScreen(); + _vm->_system->delayMillis(10); } void Graphics::incPaletteFadeLevel() { @@ -636,6 +638,7 @@ void Graphics::updateScreen() { } _vm->_system->updateScreen(); + _vm->_system->delayMillis(10); } Sprite *Graphics::getSpriteAt(int16 x, int16 y) { @@ -759,8 +762,10 @@ void Graphics::drawBackgroundImage(const char *filename) { _vm->_system->getPaletteManager()->setPalette(palette, 0, 256); _vm->_system->copyRectToScreen(pixels, width, xoffset, yoffset, width, height); - _vm->_system->updateScreen(); + //_vm->_system->updateScreen(); + //_vm->_system->delayMillis(10); + delete[] pixels; delete[] palette; } diff --git a/engines/startrek/intro.cpp b/engines/startrek/intro.cpp index 745b8fefc3..84a8208c34 100644 --- a/engines/startrek/intro.cpp +++ b/engines/startrek/intro.cpp @@ -50,6 +50,7 @@ void StarTrekEngine::playIntro() { _sound->playVoc("logo"); _gfx->copyBackgroundScreen(); _system->updateScreen(); + _system->delayMillis(10); _gfx->fadeinScreen(); uint32 clockTicks = _clockTicks; diff --git a/engines/startrek/menu.cpp b/engines/startrek/menu.cpp index 72b72d94b5..fdbbf1911d 100644 --- a/engines/startrek/menu.cpp +++ b/engines/startrek/menu.cpp @@ -1027,6 +1027,7 @@ void StarTrekEngine::showRepublicMap(int16 arg0, int16 turbolift) { _gfx->setBackgroundImage(_gfx->loadBitmap("veng9b")); _gfx->copyBackgroundScreen(); _system->updateScreen(); + _system->delayMillis(10); _gfx->setPri(15); _gfx->fadeinScreen(); @@ -1077,6 +1078,7 @@ void StarTrekEngine::showRepublicMap(int16 arg0, int16 turbolift) { _gfx->setBackgroundImage(_gfx->loadBitmap("veng9")); _gfx->copyBackgroundScreen(); _system->updateScreen(); + _system->delayMillis(10); _gfx->setPri(15); Sprite someSprite; @@ -1162,6 +1164,7 @@ lclick: _gfx->setBackgroundImage(_gfx->loadBitmap(_screenName)); _gfx->copyBackgroundScreen(); _system->updateScreen(); + _system->delayMillis(10); _gfx->drawAllSprites(); diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp index d347055efb..85129117ae 100644 --- a/engines/startrek/startrek.cpp +++ b/engines/startrek/startrek.cpp @@ -262,6 +262,7 @@ void StarTrekEngine::runTransportSequence(const Common::String &name) { _gfx->loadPalette("palette"); _gfx->drawDirectToScreen(bgImage); _system->updateScreen(); + _system->delayMillis(10); for (int i = 0; i < (_awayMission.redshirtDead ? 3 : 4); i++) { Common::String filename = getCrewmanAnimFilename(i, name); @@ -604,7 +605,7 @@ void StarTrekEngine::playMovieMac(Common::String filename) { if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) continuePlaying = false; - g_system->delayMillis(10); + _system->delayMillis(10); } delete qtDecoder; |