diff options
author | Paul Gilbert | 2012-01-01 16:31:56 +1100 |
---|---|---|
committer | Paul Gilbert | 2012-01-01 16:37:24 +1100 |
commit | 83acabfdbdf4a44ce94eb068574d9938df301b1f (patch) | |
tree | 7ff9d02636b7da4b3fa0a8bdb74d717fd007fd0e /engines | |
parent | a837bb409a0235e4b459bfbdfb66684c8b5d33e3 (diff) | |
download | scummvm-rg350-83acabfdbdf4a44ce94eb068574d9938df301b1f.tar.gz scummvm-rg350-83acabfdbdf4a44ce94eb068574d9938df301b1f.tar.bz2 scummvm-rg350-83acabfdbdf4a44ce94eb068574d9938df301b1f.zip |
TSAGE: Do all screen drawing in an intermediate temporary screen surface.
This will be the first half of properly handling on screen dirty rects.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/tsage/blue_force/blueforce_dialogs.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/converse.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/core.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/events.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/graphics.cpp | 34 | ||||
-rw-r--r-- | engines/tsage/graphics.h | 5 | ||||
-rw-r--r-- | engines/tsage/ringworld/ringworld_dialogs.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/ringworld/ringworld_logic.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/ringworld/ringworld_scenes3.cpp | 6 | ||||
-rw-r--r-- | engines/tsage/ringworld/ringworld_scenes5.cpp | 4 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_dialogs.cpp | 2 | ||||
-rw-r--r-- | engines/tsage/scenes.cpp | 2 |
12 files changed, 33 insertions, 40 deletions
diff --git a/engines/tsage/blue_force/blueforce_dialogs.cpp b/engines/tsage/blue_force/blueforce_dialogs.cpp index 0aaae2fc29..a1ac19ecee 100644 --- a/engines/tsage/blue_force/blueforce_dialogs.cpp +++ b/engines/tsage/blue_force/blueforce_dialogs.cpp @@ -163,7 +163,7 @@ void RightClickDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } // Deactivate the graphics manager used for the dialog @@ -244,7 +244,7 @@ void AmmoBeltDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } _gfxManager.deactivate(); diff --git a/engines/tsage/converse.cpp b/engines/tsage/converse.cpp index a660c4b580..c3b48a7693 100644 --- a/engines/tsage/converse.cpp +++ b/engines/tsage/converse.cpp @@ -451,7 +451,7 @@ int ConversationChoiceDialog::execute(const Common::StringArray &choiceList) { while (!g_globals->_events.getEvent(event, EVENT_KEYPRESS | EVENT_BUTTON_DOWN | EVENT_MOUSE_MOVE) && !g_vm->shouldQuit()) { g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } if (g_vm->shouldQuit()) break; diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 73e7901fde..7cbcb863c7 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1416,7 +1416,7 @@ void ScenePalette::fade(const byte *adjustData, bool fullAdjust, int percent) { // Set the altered pale4tte g_system->getPaletteManager()->setPalette((const byte *)&tempPalette[0], 0, 256); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } PaletteRotation *ScenePalette::addRotation(int start, int end, int rotationMode, int duration, Action *action) { @@ -1714,7 +1714,7 @@ void SceneItem::display(int resNum, int lineNum, ...) { // Keep event on-screen until a mouse or keypress while (!g_vm->shouldQuit() && !g_globals->_events.getEvent(event, EVENT_BUTTON_DOWN | EVENT_KEYPRESS)) { - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); g_system->delayMillis(10); } diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 152570b187..8f07a8243b 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -50,7 +50,7 @@ bool EventsClass::pollEvent() { ++_frameNumber; // Update screen - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } if (!g_system->getEventManager()->pollEvent(_event)) return false; @@ -395,7 +395,7 @@ void EventsClass::delay(int numFrames) { _priorFrameTime = g_system->getMillis(); } - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); _prevDelayFrame = _frameNumber; _priorFrameTime = g_system->getMillis(); } diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index 171167c2ea..a22e0a80d1 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -220,10 +220,8 @@ void Rect::synchronize(Serializer &s) { GfxSurface::GfxSurface() : _bounds(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT) { _disableUpdates = false; - _screenSurface = false; _lockSurfaceCtr = 0; _customSurface = NULL; - _screenSurfaceP = NULL; _transColor = -1; } @@ -244,9 +242,17 @@ GfxSurface::~GfxSurface() { * Specifies that the surface will encapsulate the ScummVM screen surface */ void GfxSurface::setScreenSurface() { - _screenSurface = true; - _customSurface = NULL; - _lockSurfaceCtr = 0; + _trackDirtyRects = true; + create(SCREEN_WIDTH, SCREEN_HEIGHT); +} + +/** + * Updates the physical screen with the screen surface buffer + */ +void GfxSurface::updateScreen() { + g_system->copyRectToScreen((const byte *)this->_customSurface->pixels, + SCREEN_WIDTH, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + g_system->updateScreen(); } /** @@ -254,7 +260,7 @@ void GfxSurface::setScreenSurface() { */ void GfxSurface::create(int width, int height) { assert((width >= 0) && (height >= 0)); - _screenSurface = false; + if (_customSurface) { _customSurface->free(); delete _customSurface; @@ -271,13 +277,7 @@ void GfxSurface::create(int width, int height) { Graphics::Surface GfxSurface::lockSurface() { ++_lockSurfaceCtr; - Graphics::Surface *src; - if (_screenSurface) { - if (_lockSurfaceCtr == 1) - _screenSurfaceP = g_system->lockScreen(); - src = _screenSurfaceP; - } else - src = _customSurface; + Graphics::Surface *src = _customSurface; assert(src); // Setup the returned surface either as one pointing to the same pixels as the source, or @@ -298,15 +298,10 @@ Graphics::Surface GfxSurface::lockSurface() { void GfxSurface::unlockSurface() { assert(_lockSurfaceCtr > 0); --_lockSurfaceCtr; - - if ((_lockSurfaceCtr == 0) && _screenSurface) { - g_system->unlockScreen(); - } } void GfxSurface::synchronize(Serializer &s) { assert(!_lockSurfaceCtr); - assert(!_screenSurface); s.syncAsByte(_disableUpdates); _bounds.synchronize(s); @@ -363,7 +358,6 @@ GfxSurface &GfxSurface::operator=(const GfxSurface &s) { } _customSurface = s._customSurface; - _screenSurface = s._screenSurface; _disableUpdates = s._disableUpdates; _bounds = s._bounds; _centroid = s._centroid; @@ -1090,7 +1084,7 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } _gfxManager.deactivate(); diff --git a/engines/tsage/graphics.h b/engines/tsage/graphics.h index dba3401700..afc9ba8c52 100644 --- a/engines/tsage/graphics.h +++ b/engines/tsage/graphics.h @@ -74,9 +74,8 @@ public: class GfxSurface { private: Graphics::Surface *_customSurface; - Graphics::Surface *_screenSurfaceP; int _lockSurfaceCtr; - bool _screenSurface; + bool _trackDirtyRects; bool _disableUpdates; Rect _bounds; @@ -89,6 +88,7 @@ public: ~GfxSurface(); void setScreenSurface(); + void updateScreen(); Graphics::Surface lockSurface(); void unlockSurface(); void synchronize(Serializer &s); @@ -301,7 +301,6 @@ public: void copyFrom(GfxSurface &src, int destX, int destY) { _surface.setBounds(_bounds); _surface.copyFrom(src, destX, destY); - g_system->updateScreen(); } GfxSurface &getSurface() { _surface.setBounds(_bounds); diff --git a/engines/tsage/ringworld/ringworld_dialogs.cpp b/engines/tsage/ringworld/ringworld_dialogs.cpp index 233cbe5c4c..0e451b8429 100644 --- a/engines/tsage/ringworld/ringworld_dialogs.cpp +++ b/engines/tsage/ringworld/ringworld_dialogs.cpp @@ -183,7 +183,7 @@ void RightClickDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } _gfxManager.deactivate(); @@ -394,7 +394,7 @@ void InventoryDialog::execute() { Event event; while (!g_globals->_events.getEvent(event) && !g_vm->shouldQuit()) { g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } if (g_vm->shouldQuit()) break; diff --git a/engines/tsage/ringworld/ringworld_logic.cpp b/engines/tsage/ringworld/ringworld_logic.cpp index e37eddf80c..00c219f2ee 100644 --- a/engines/tsage/ringworld/ringworld_logic.cpp +++ b/engines/tsage/ringworld/ringworld_logic.cpp @@ -315,7 +315,7 @@ void SceneArea::wait() { // Wait until a mouse or keypress Event event; while (!g_vm->shouldQuit() && !g_globals->_events.getEvent(event)) { - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); g_system->delayMillis(10); } diff --git a/engines/tsage/ringworld/ringworld_scenes3.cpp b/engines/tsage/ringworld/ringworld_scenes3.cpp index 81190aea7b..0e4ccd1269 100644 --- a/engines/tsage/ringworld/ringworld_scenes3.cpp +++ b/engines/tsage/ringworld/ringworld_scenes3.cpp @@ -532,7 +532,7 @@ void Scene2100::Action1::signal() { // Wait for an event Event event; if (!g_globals->_events.getEvent(event)) { - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); g_system->delayMillis(10); continue; } @@ -2263,7 +2263,7 @@ void Scene2150::Action1::signal() { // Wait for an event Event event; if (!g_globals->_events.getEvent(event)) { - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); g_system->delayMillis(10); continue; } @@ -5118,7 +5118,7 @@ void Scene2320::Action3::signal() { // Wait for an event Event event; if (!g_globals->_events.getEvent(event)) { - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); g_system->delayMillis(10); continue; } diff --git a/engines/tsage/ringworld/ringworld_scenes5.cpp b/engines/tsage/ringworld/ringworld_scenes5.cpp index 49726eba2e..3b415bdb6a 100644 --- a/engines/tsage/ringworld/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld/ringworld_scenes5.cpp @@ -2810,7 +2810,7 @@ void Scene4150::Action1::signal() { case 4: { for (int idx = 100; idx >= 0; idx -= 5) { g_globals->_scenePalette.fade(adjustData, false, idx); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); g_system->delayMillis(10); } @@ -2838,7 +2838,7 @@ void Scene4150::Action1::signal() { case 7: for (int idx = 100; idx >= 0; idx -= 5) { g_globals->_scenePalette.fade(adjustData, false, idx); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); g_system->delayMillis(10); } diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp index ddb4eae9c4..5178fe6418 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp +++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp @@ -153,7 +153,7 @@ void RightClickDialog::execute() { } g_system->delayMillis(10); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); } // Execute the specified action diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp index 6362c63bc3..9d75808dbf 100644 --- a/engines/tsage/scenes.cpp +++ b/engines/tsage/scenes.cpp @@ -133,7 +133,7 @@ void SceneManager::fadeInIfNecessary() { percent = 100; g_globals->_scenePalette.fade((const byte *)&adjustData, false, percent); - g_system->updateScreen(); + GLOBALS._screenSurface.updateScreen(); g_system->delayMillis(10); } |