Skip to content

Commit

Permalink
PEGASUS: Add our TGWorldSaver replacement
Browse files Browse the repository at this point in the history
The scoring on the death/pause screens are now shown
  • Loading branch information
Matthew Hoops committed Oct 18, 2011
1 parent 81ace6e commit 4af1fe2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions engines/pegasus/graphics.cpp
Expand Up @@ -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() {
Expand Down
4 changes: 3 additions & 1 deletion engines/pegasus/graphics.h
Expand Up @@ -54,6 +54,8 @@ friend class Cursor;
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);
Expand All @@ -73,7 +75,7 @@ friend class Cursor;
Common::Rect _dirtyRect;
tDisplayOrder _backLayer, _frontLayer;
DisplayElement *_firstDisplayElement, *_lastDisplayElement;
Graphics::Surface _workArea;
Graphics::Surface _workArea, *_curSurface;

// Shake Shake Shake!
static const int kMaxShakeOffsets = 17;
Expand Down
7 changes: 6 additions & 1 deletion engines/pegasus/menu.cpp
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions engines/pegasus/neighborhood/neighborhood.cpp
Expand Up @@ -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?
Expand Down
4 changes: 2 additions & 2 deletions engines/pegasus/surface.cpp
Expand Up @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit 4af1fe2

Please sign in to comment.