diff options
author | Johannes Schickel | 2009-08-19 16:19:55 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-08-19 16:19:55 +0000 |
commit | 34e30a29b5d4902514e696369f8714b171a778bb (patch) | |
tree | fb89a734de624e71b463b406fb8c587cf29281d0 /engines/kyra | |
parent | dd67cb7c9442071448432f107432249eb7ef1d95 (diff) | |
download | scummvm-rg350-34e30a29b5d4902514e696369f8714b171a778bb.tar.gz scummvm-rg350-34e30a29b5d4902514e696369f8714b171a778bb.tar.bz2 scummvm-rg350-34e30a29b5d4902514e696369f8714b171a778bb.zip |
Make KYRA only call OSystem::updateScreen from inside Screen::updateScreen, when the screen really changed OR the palette changed.
svn-id: r43537
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/animator_lok.cpp | 7 | ||||
-rw-r--r-- | engines/kyra/animator_lok.h | 1 | ||||
-rw-r--r-- | engines/kyra/gui_lok.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/kyra_v1.cpp | 5 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 11 | ||||
-rw-r--r-- | engines/kyra/screen.h | 2 | ||||
-rw-r--r-- | engines/kyra/script_lok.cpp | 12 | ||||
-rw-r--r-- | engines/kyra/sequences_lok.cpp | 1 | ||||
-rw-r--r-- | engines/kyra/text_lok.cpp | 1 |
9 files changed, 13 insertions, 28 deletions
diff --git a/engines/kyra/animator_lok.cpp b/engines/kyra/animator_lok.cpp index a05eabe3e1..04c31a1422 100644 --- a/engines/kyra/animator_lok.cpp +++ b/engines/kyra/animator_lok.cpp @@ -37,7 +37,6 @@ Animator_LoK::Animator_LoK(KyraEngine_LoK *vm, OSystem *system) { _vm = vm; _screen = vm->screen(); _initOk = false; - _updateScreen = false; _system = system; _screenObjects = _actors = _items = _sprites = _objectQueue = 0; _noDrawShapesFlag = 0; @@ -382,15 +381,11 @@ void Animator_LoK::copyChangedObjectsForward(int refreshFlag) { _screen->copyRegion(xpos << 3, ypos, xpos << 3, ypos, width << 3, height, 2, 0); curObject->refreshFlag = 0; - _updateScreen = true; } } } - if (_updateScreen) { - _screen->updateScreen(); - _updateScreen = false; - } + _screen->updateScreen(); } void Animator_LoK::updateAllObjectShapes() { diff --git a/engines/kyra/animator_lok.h b/engines/kyra/animator_lok.h index ba5882c710..618a210082 100644 --- a/engines/kyra/animator_lok.h +++ b/engines/kyra/animator_lok.h @@ -95,7 +95,6 @@ public: int16 fetchAnimHeight(const uint8 *shape, int16 mult); int _noDrawShapesFlag; - bool _updateScreen; uint16 _brandonDrawFrame; int _brandonScaleX; int _brandonScaleY; diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp index e9c71f511d..3c5fbe4f1c 100644 --- a/engines/kyra/gui_lok.cpp +++ b/engines/kyra/gui_lok.cpp @@ -522,7 +522,6 @@ int GUI_LoK::buttonMenuCallback(Button *caller) { if (_menuRestoreScreen) { restorePalette(); _screen->loadPageFromDisk("SEENPAGE.TMP", 0); - _vm->_animator->_updateScreen = true; } else { _screen->deletePageFromDisk(0); } diff --git a/engines/kyra/kyra_v1.cpp b/engines/kyra/kyra_v1.cpp index d79d9a8f32..d8e91b138d 100644 --- a/engines/kyra/kyra_v1.cpp +++ b/engines/kyra/kyra_v1.cpp @@ -434,11 +434,8 @@ void KyraEngine_v1::updateInput() { } } - // TODO: Check whether we should really call Screen::updateScreen here. - // We might simply want to call OSystem::updateScreen instead, since Screen::updateScreen - // copies changed screen parts to the screen buffer, which might not be desired. if (updateScreen) - screen()->updateScreen(); + _system->updateScreen(); } void KyraEngine_v1::removeInputTop() { diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index b50bc7a1e6..bf9a9f4246 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -51,6 +51,7 @@ Screen::Screen(KyraEngine_v1 *vm, OSystem *system) memset(_fonts, 0, sizeof(_fonts)); _currentFont = FID_8_FNT; + _paletteChanged = true; } Screen::~Screen() { @@ -206,6 +207,9 @@ void Screen::setResolution() { } void Screen::updateScreen() { + bool needRealUpdate = _forceFullUpdate || _dirtyRects.size() || _paletteChanged; + _paletteChanged = false; + if (_useOverlays) updateDirtyRectsOvl(); else if (_isAmiga && _interfacePaletteEnabled) @@ -214,13 +218,16 @@ void Screen::updateScreen() { updateDirtyRects(); if (_debugEnabled) { + needRealUpdate = true; + if (!_useOverlays) _system->copyRectToScreen(getPagePtr(2), SCREEN_W, 320, 0, SCREEN_W, SCREEN_H); else _system->copyRectToScreen(getPagePtr(2), SCREEN_W, 640, 0, SCREEN_W, SCREEN_H); } - _system->updateScreen(); + if (needRealUpdate) + _system->updateScreen(); } void Screen::updateDirtyRects() { @@ -709,6 +716,7 @@ void Screen::setScreenPalette(const Palette &pal) { screenPal[4 * i + 3] = 0; } + _paletteChanged = true; _system->setPalette(screenPal, 0, pal.getNumColors()); } @@ -744,6 +752,7 @@ void Screen::setInterfacePalette(const Palette &pal, uint8 r, uint8 g, uint8 b) screenPal[4 * i + 3] = 0; } + _paletteChanged = true; _system->setPalette(screenPal, 32, pal.getNumColors()); } diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 73a29ee2c7..7553a0132b 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -308,7 +308,6 @@ public: virtual bool init(); virtual void setResolution(); - void updateScreen(); // debug functions @@ -508,6 +507,7 @@ protected: }; bool _forceFullUpdate; + bool _paletteChanged; Common::List<Common::Rect> _dirtyRects; void addDirtyRect(int x, int y, int w, int h); diff --git a/engines/kyra/script_lok.cpp b/engines/kyra/script_lok.cpp index 5d323b7c17..0a96db8277 100644 --- a/engines/kyra/script_lok.cpp +++ b/engines/kyra/script_lok.cpp @@ -432,7 +432,6 @@ int KyraEngine_LoK::o1_runWSAFromBeginningToEnd(EMCState *script) { const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); _movieObjects[wsaIndex]->displayFrame(wsaFrame++, 0, xpos, ypos, 0, 0, 0); - _animator->_updateScreen = true; if (wsaFrame >= _movieObjects[wsaIndex]->frames()) running = false; @@ -454,7 +453,6 @@ int KyraEngine_LoK::o1_displayWSAFrame(EMCState *script) { _screen->hideMouse(); const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); _movieObjects[wsaIndex]->displayFrame(frame, 0, xpos, ypos, 0, 0, 0); - _animator->_updateScreen = true; delayUntil(continueTime, false, true); _screen->showMouse(); return 0; @@ -487,7 +485,6 @@ int KyraEngine_LoK::o1_runWSAFrames(EMCState *script) { for (; startFrame <= endFrame; ++startFrame) { const uint32 nextRun = _system->getMillis() + delayTime * _tickLength; _movieObjects[wsaIndex]->displayFrame(startFrame, 0, xpos, ypos, 0, 0, 0); - _animator->_updateScreen = true; delayUntil(nextRun, false, true); } _screen->showMouse(); @@ -576,7 +573,6 @@ int KyraEngine_LoK::o1_setCustomPaletteRange(EMCState *script) { int KyraEngine_LoK::o1_loadPageFromDisk(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_loadPageFromDisk(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); _screen->loadPageFromDisk(stackPosString(0), stackPos(1)); - _animator->_updateScreen = true; return 0; } @@ -644,7 +640,6 @@ int KyraEngine_LoK::o1_copyWSARegion(EMCState *script) { int srcPage = stackPos(4); int dstPage = stackPos(5); _screen->copyRegion(xpos, ypos, xpos, ypos, width, height, srcPage, dstPage); - _animator->_updateScreen = true; return 0; } @@ -674,7 +669,6 @@ int KyraEngine_LoK::o1_displayWSAFrameOnHidPage(EMCState *script) { _screen->hideMouse(); const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); _movieObjects[wsaIndex]->displayFrame(frame, 2, xpos, ypos, 0, 0, 0); - _animator->_updateScreen = true; delayUntil(continueTime, false, true); _screen->showMouse(); @@ -749,8 +743,6 @@ int KyraEngine_LoK::o1_displayWSASequentialFrames(EMCState *script) { while (endFrame >= frame) { const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); _movieObjects[wsaIndex]->displayFrame(frame, 0, xpos, ypos, 0, 0, 0); - if (waitTime) - _animator->_updateScreen = true; delayUntil(continueTime, false, true); ++frame; } @@ -759,8 +751,6 @@ int KyraEngine_LoK::o1_displayWSASequentialFrames(EMCState *script) { while (endFrame <= frame) { const uint32 continueTime = waitTime * _tickLength + _system->getMillis(); _movieObjects[wsaIndex]->displayFrame(frame, 0, xpos, ypos, 0, 0, 0); - if (waitTime) - _animator->_updateScreen = true; delayUntil(continueTime, false, true); --frame; } @@ -1278,8 +1268,6 @@ int KyraEngine_LoK::o1_makeAmuletAppear(EMCState *script) { snd_playSoundEffect(0x73); amulet->displayFrame(code, 0, 224, 152, 0, 0, 0); - _animator->_updateScreen = true; - delayUntil(nextTime, false, true); } _screen->showMouse(); diff --git a/engines/kyra/sequences_lok.cpp b/engines/kyra/sequences_lok.cpp index d2ef351767..d13dc2d291 100644 --- a/engines/kyra/sequences_lok.cpp +++ b/engines/kyra/sequences_lok.cpp @@ -1944,7 +1944,6 @@ void KyraEngine_LoK::updateKyragemFading() { } _screen->setScreenPalette(_screen->getPalette(0)); - _animator->_updateScreen = true; switch (_kyragemFadingState.nextOperation) { case 0: diff --git a/engines/kyra/text_lok.cpp b/engines/kyra/text_lok.cpp index d2128b7037..178966196c 100644 --- a/engines/kyra/text_lok.cpp +++ b/engines/kyra/text_lok.cpp @@ -97,7 +97,6 @@ void KyraEngine_LoK::waitForChatToFinish(int vocFile, int16 chatDuration, const currPage = _screen->_curPage; _screen->_curPage = 2; _text->printCharacterText(chatStr, charNum, _characterList[charNum].x1); - _animator->_updateScreen = true; _screen->_curPage = currPage; } |