aboutsummaryrefslogtreecommitdiff
path: root/engines/pegasus
diff options
context:
space:
mode:
authorBastien Bouclet2017-08-26 08:33:51 +0200
committerBastien Bouclet2017-09-12 20:25:24 +0200
commit6506b95fceb603c79bdd67a30bf82739bd7e463e (patch)
tree8fa7b20ff8eb1f7fd4dc7d9ff5bb8da22ff1bfc0 /engines/pegasus
parent6a38fdf2b4eace7b34c3d8bd907e39a661edf2b6 (diff)
downloadscummvm-rg350-6506b95fceb603c79bdd67a30bf82739bd7e463e.tar.gz
scummvm-rg350-6506b95fceb603c79bdd67a30bf82739bd7e463e.tar.bz2
scummvm-rg350-6506b95fceb603c79bdd67a30bf82739bd7e463e.zip
PEGASUS: Call OSystem::updateScreen on each frame
Fixes the display of OSD information when toggling fullscreen.
Diffstat (limited to 'engines/pegasus')
-rw-r--r--engines/pegasus/cursor.cpp5
-rw-r--r--engines/pegasus/graphics.cpp22
-rw-r--r--engines/pegasus/graphics.h6
-rw-r--r--engines/pegasus/pegasus.cpp7
4 files changed, 8 insertions, 32 deletions
diff --git a/engines/pegasus/cursor.cpp b/engines/pegasus/cursor.cpp
index 6b7965d679..636b52051e 100644
--- a/engines/pegasus/cursor.cpp
+++ b/engines/pegasus/cursor.cpp
@@ -89,8 +89,6 @@ void Cursor::setCurrentFrameIndex(int32 index) {
} else {
CursorMan.replaceCursor(_info[index].surface->getPixels(), _info[index].surface->w, _info[index].surface->h, _info[index].hotspot.x, _info[index].hotspot.y, _info[index].surface->format.RGBToColor(0xFF, 0xFF, 0xFF), false, &_info[index].surface->format);
}
-
- ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
}
}
@@ -104,13 +102,11 @@ void Cursor::show() {
CursorMan.showMouse(true);
_cursorObscured = false;
- ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
void Cursor::hide() {
CursorMan.showMouse(false);
setCurrentFrameIndex(0);
- ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
void Cursor::hideUntilMoved() {
@@ -125,7 +121,6 @@ void Cursor::useIdleTime() {
_cursorLocation = g_system->getEventManager()->getMousePos();
if (_index != -1 && _cursorObscured)
show();
- ((PegasusEngine *)g_engine)->_gfx->markCursorAsDirty();
}
}
diff --git a/engines/pegasus/graphics.cpp b/engines/pegasus/graphics.cpp
index 634b0eb0cc..7748c266f5 100644
--- a/engines/pegasus/graphics.cpp
+++ b/engines/pegasus/graphics.cpp
@@ -44,7 +44,6 @@ GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) {
_frontLayer = kMaxAvailableOrder;
_firstDisplayElement = _lastDisplayElement = 0;
_workArea.create(640, 480, _vm->_system->getScreenFormat());
- _modifiedScreen = false;
_curSurface = &_workArea;
_erase = false;
_updatesEnabled = true;
@@ -152,8 +151,6 @@ void GraphicsManager::removeDisplayElement(DisplayElement *oldElement) {
}
void GraphicsManager::updateDisplay() {
- bool screenDirty = false;
-
if (!_dirtyRect.isEmpty()) {
// Fill the dirty area with black if erase mode is enabled
if (_erase)
@@ -167,29 +164,18 @@ void GraphicsManager::updateDisplay() {
// but it should work fine for now.
if (bounds.intersects(_dirtyRect) && runner->validToDraw(_backLayer, _frontLayer)) {
runner->draw(bounds);
- screenDirty = true;
}
}
// Copy only the dirty rect to the screen
- if (screenDirty)
- g_system->copyRectToScreen((byte *)_workArea.getBasePtr(_dirtyRect.left, _dirtyRect.top), _workArea.pitch, _dirtyRect.left, _dirtyRect.top, _dirtyRect.width(), _dirtyRect.height());
+ g_system->copyRectToScreen((byte *)_workArea.getBasePtr(_dirtyRect.left, _dirtyRect.top), _workArea.pitch, _dirtyRect.left, _dirtyRect.top, _dirtyRect.width(), _dirtyRect.height());
// Clear the dirty rect
_dirtyRect = Common::Rect();
}
- if (_updatesEnabled && (screenDirty || _modifiedScreen))
+ if (_updatesEnabled)
g_system->updateScreen();
-
- _modifiedScreen = false;
-}
-
-void GraphicsManager::clearScreen() {
- Graphics::Surface *screen = g_system->lockScreen();
- screen->fillRect(Common::Rect(0, 0, 640, 480), g_system->getScreenFormat().RGBToColor(0, 0, 0));
- g_system->unlockScreen();
- _modifiedScreen = true;
}
DisplayElement *GraphicsManager::findDisplayElement(const DisplayElementID id) {
@@ -214,10 +200,6 @@ void GraphicsManager::doFadeInSync(const TimeValue time, const TimeScale scale,
_updatesEnabled = true;
}
-void GraphicsManager::markCursorAsDirty() {
- _modifiedScreen = true;
-}
-
void GraphicsManager::newShakePoint(int32 index1, int32 index2, int32 maxRadius) {
int32 index3 = (index1 + index2) >> 1;
diff --git a/engines/pegasus/graphics.h b/engines/pegasus/graphics.h
index 7b48ea4598..9ae45c341d 100644
--- a/engines/pegasus/graphics.h
+++ b/engines/pegasus/graphics.h
@@ -57,7 +57,6 @@ public:
Graphics::Surface *getCurSurface() { return _curSurface; }
void setCurSurface(Graphics::Surface *surface) { _curSurface = surface; }
Graphics::Surface *getWorkArea() { return &_workArea; }
- void clearScreen();
DisplayElement *findDisplayElement(const DisplayElementID id);
void shakeTheWorld(TimeValue time, TimeScale scale);
void enableErase();
@@ -69,13 +68,10 @@ public:
void doFadeOutSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
void doFadeInSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
-protected:
- void markCursorAsDirty();
-
private:
PegasusEngine *_vm;
- bool _modifiedScreen, _erase;
+ bool _erase;
Common::Rect _dirtyRect;
DisplayOrder _backLayer, _frontLayer;
DisplayElement *_firstDisplayElement, *_lastDisplayElement;
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp
index 1f77caa751..7898d0b12a 100644
--- a/engines/pegasus/pegasus.cpp
+++ b/engines/pegasus/pegasus.cpp
@@ -939,8 +939,9 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) {
} else {
_gfx->doFadeOutSync();
useMenu(0);
- _gfx->clearScreen();
+ _gfx->enableErase();
_gfx->updateDisplay();
+ _gfx->disableErase();
Video::VideoDecoder *video = new Video::QuickTimeDecoder();
if (!video->loadFile(_introDirectory + "/Closing.movie"))
@@ -1655,10 +1656,12 @@ void PegasusEngine::startNewGame() {
GameState.resetGameState();
GameState.setWalkthroughMode(isWalkthrough);
- // TODO: Enable erase
_gfx->doFadeOutSync();
useMenu(0);
+
+ _gfx->enableErase();
_gfx->updateDisplay();
+ _gfx->disableErase();
_gfx->enableUpdates();
createInterface();