Skip to content

Commit

Permalink
PEGASUS: Implement dirty rect erase code (as used by the space chase)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Hoops committed Oct 28, 2011
1 parent 0ec655f commit 59f7d43
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions engines/pegasus/graphics.cpp
Expand Up @@ -45,6 +45,7 @@ GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) {
_workArea.create(640, 480, _vm->_system->getScreenFormat());
_modifiedScreen = false;
_curSurface = &_workArea;
_erase = false;
}

GraphicsManager::~GraphicsManager() {
Expand Down Expand Up @@ -150,6 +151,10 @@ void GraphicsManager::updateDisplay() {
bool screenDirty = false;

if (!_dirtyRect.isEmpty()) {
// Fill the dirty area with black if erase mode is enabled
if (_erase)
_workArea.fillRect(_dirtyRect, _workArea.format.RGBToColor(0, 0, 0));

for (DisplayElement *runner = _firstDisplayElement; runner != 0; runner = runner->_nextElement) {
Common::Rect bounds;
runner->getBounds(bounds);
Expand Down Expand Up @@ -320,5 +325,13 @@ void GraphicsManager::shakeTheWorld(TimeValue duration, TimeScale scale) {

oldScreen.free();
}

void GraphicsManager::enableErase() {
_erase = true;
}

void GraphicsManager::disableErase() {
_erase = false;
}

} // End of namespace Pegasus
4 changes: 3 additions & 1 deletion engines/pegasus/graphics.h
Expand Up @@ -60,6 +60,8 @@ friend class Cursor;
void clearScreen();
DisplayElement *findDisplayElement(const tDisplayElementID id);
void shakeTheWorld(TimeValue time, TimeScale scale);
void enableErase();
void disableErase();

// These default to black
void doFadeOutSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, uint32 color = 0);
Expand All @@ -71,7 +73,7 @@ friend class Cursor;
private:
PegasusEngine *_vm;

bool _modifiedScreen;
bool _modifiedScreen, _erase;
Common::Rect _dirtyRect;
tDisplayOrder _backLayer, _frontLayer;
DisplayElement *_firstDisplayElement, *_lastDisplayElement;
Expand Down
2 changes: 2 additions & 0 deletions engines/pegasus/neighborhood/mars/mars.cpp
Expand Up @@ -2822,6 +2822,8 @@ void Mars::marsTimerExpired(MarsTimerEvent &event) {
_canyonChaseMovie.stopDisplaying();
_canyonChaseMovie.releaseMovie();

_vm->_gfx->enableErase();

loadLoopSound1("Sounds/Mars/Space Ambient.22K.8.AIFF");

playSpotSoundSync(kShuttleConfiguringIn, kShuttleConfiguringOut);
Expand Down

0 comments on commit 59f7d43

Please sign in to comment.