From 4af1fe25af35ccd484e3ff4650cad74cf903e30b Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Tue, 18 Oct 2011 09:37:56 -0400 Subject: PEGASUS: Add our TGWorldSaver replacement The scoring on the death/pause screens are now shown --- engines/pegasus/graphics.cpp | 1 + engines/pegasus/graphics.h | 4 +++- engines/pegasus/menu.cpp | 7 ++++++- engines/pegasus/neighborhood/neighborhood.cpp | 6 ++++-- engines/pegasus/surface.cpp | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/engines/pegasus/graphics.cpp b/engines/pegasus/graphics.cpp index 8b83ed7a32..74e2aed9c4 100644 --- a/engines/pegasus/graphics.cpp +++ b/engines/pegasus/graphics.cpp @@ -44,6 +44,7 @@ GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) { _firstDisplayElement = _lastDisplayElement = 0; _workArea.create(640, 480, _vm->_system->getScreenFormat()); _modifiedScreen = false; + _curSurface = &_workArea; } GraphicsManager::~GraphicsManager() { diff --git a/engines/pegasus/graphics.h b/engines/pegasus/graphics.h index c68c2dec76..18dfd3f262 100644 --- a/engines/pegasus/graphics.h +++ b/engines/pegasus/graphics.h @@ -54,6 +54,8 @@ public: tDisplayOrder getBackOfActiveLayer() const { return _backLayer; } tDisplayOrder getFrontOfActiveLayer() const { return _frontLayer; } void updateDisplay(); + Graphics::Surface *getCurSurface() { return _curSurface; } + void setCurSurface(Graphics::Surface *surface) { _curSurface = surface; } Graphics::Surface *getWorkArea() { return &_workArea; } void clearScreen(); DisplayElement *findDisplayElement(const tDisplayElementID id); @@ -73,7 +75,7 @@ private: Common::Rect _dirtyRect; tDisplayOrder _backLayer, _frontLayer; DisplayElement *_firstDisplayElement, *_lastDisplayElement; - Graphics::Surface _workArea; + Graphics::Surface _workArea, *_curSurface; // Shake Shake Shake! static const int kMaxShakeOffsets = 17; diff --git a/engines/pegasus/menu.cpp b/engines/pegasus/menu.cpp index dfef67c27b..ce95e6b440 100755 --- a/engines/pegasus/menu.cpp +++ b/engines/pegasus/menu.cpp @@ -676,8 +676,11 @@ DeathMenu::DeathMenu(const tDeathReason deathReason) : GameMenu(kDeathMenuID), _ _deathBackground.initFromPICTFile(imageName); _deathReason = deathReason; - if (!isDemo) + if (!isDemo) { + vm->_gfx->setCurSurface(_deathBackground.getSurface()); drawAllScores(); + vm->_gfx->setCurSurface(vm->_gfx->getWorkArea()); + } _deathBackground.setDisplayOrder(0); _deathBackground.startDisplaying(); @@ -993,8 +996,10 @@ PauseMenu::PauseMenu() : GameMenu(kPauseMenuID), _pauseBackground(0), _saveButto if (!vm->isDemo()) { Surface numbers; numbers.getImageFromPICTFile("Images/Pause Screen/Numbers.pict"); + vm->_gfx->setCurSurface(_pauseBackground.getSurface()); drawScore(GameState.getTotalScore(), kMaxTotalScore, Common::Rect(kPauseScoreLeft, kPauseScoreTop, kPauseScoreRight, kPauseScoreBottom), &numbers); + vm->_gfx->setCurSurface(vm->_gfx->getWorkArea()); } _pauseBackground.setDisplayOrder(kPauseMenuOrder); diff --git a/engines/pegasus/neighborhood/neighborhood.cpp b/engines/pegasus/neighborhood/neighborhood.cpp index 5d8f386d15..fb95b07aef 100644 --- a/engines/pegasus/neighborhood/neighborhood.cpp +++ b/engines/pegasus/neighborhood/neighborhood.cpp @@ -727,8 +727,10 @@ void Neighborhood::turnTo(const tDirectionConstant direction) { if (g_map) g_map->moveToMapLocation(GameState.getCurrentNeighborhood(), GameState.getCurrentRoom(), direction); - // FIXME: This isn't right. Crazy TGWorldSaver stuff - //_pushIn.copyToCurrentPort(); + // clone2727 says: Is this necessary? + _vm->_gfx->setCurSurface(_navMovie.getSurface()); + _pushIn.copyToCurrentPort(); + _vm->_gfx->setCurSurface(_vm->_gfx->getWorkArea()); // Added 2/10/97. Shouldn't this be here? Shouldn't we set the current activation to // always when turning to a new view? diff --git a/engines/pegasus/surface.cpp b/engines/pegasus/surface.cpp index 43cf90af28..69eeb31edf 100755 --- a/engines/pegasus/surface.cpp +++ b/engines/pegasus/surface.cpp @@ -164,7 +164,7 @@ void Surface::copyToCurrentPortTransparent(const Common::Rect &rect) const { } void Surface::copyToCurrentPort(const Common::Rect &srcRect, const Common::Rect &dstRect) const { - Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea(); + Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface(); byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top); byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top); @@ -182,7 +182,7 @@ void Surface::copyToCurrentPortTransparent(const Common::Rect &srcRect, const Co uint32 transColor1 = g_system->getScreenFormat().RGBToColor(0xff, 0xff, 0xff); uint32 transColor2 = g_system->getScreenFormat().RGBToColor(0xf8, 0xf8, 0xf8); - Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getWorkArea(); + Graphics::Surface *screen = ((PegasusEngine *)g_engine)->_gfx->getCurSurface(); byte *src = (byte *)_surface->getBasePtr(srcRect.left, srcRect.top); byte *dst = (byte *)screen->getBasePtr(dstRect.left, dstRect.top); -- cgit v1.2.3