TITANIC: Fix disappearing vision center on bar shelf

This commit is contained in:
Paul Gilbert 2017-07-08 16:27:05 -04:00
parent 1fb3624770
commit 558a409c00
3 changed files with 16 additions and 3 deletions

View File

@ -195,7 +195,7 @@ void CGameManager::update() {
_bounds.combine(textCursor->getCursorBounds());
// Set the screen's modified area bounds
screenManager->setSurfaceBounds(SURFACE_BACKBUFFER, _bounds);
screenManager->setSurfaceBounds(SURFACE_PRIMARY, _bounds);
// Handle redrawing the view if there is any changed area
if (!_bounds.isEmpty()) {

View File

@ -65,6 +65,8 @@ CScreenManager *CScreenManager::setCurrent() {
void CScreenManager::setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r) {
if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size())
_backSurfaces[surfaceNum]._bounds = r;
else if (surfaceNum == SURFACE_PRIMARY)
_frontSurfaceBounds = r;
}
int CScreenManager::setFontNumber(int fontNumber) {
@ -169,6 +171,13 @@ void OSScreenManager::fillRect(SurfaceNum surfaceNum, Rect *rect, byte r, byte g
tempRect = surfaceRect;
}
// Constrain the fill area to the set modification area of the surface
Rect surfaceBounds = (surfaceNum == SURFACE_PRIMARY) ? _frontSurfaceBounds :
_backSurfaces[surfaceNum]._bounds;
if (!surfaceBounds.isEmpty())
tempRect.constrain(surfaceBounds);
// If there is any area defined, clear it
if (tempRect.isValidRect())
surface->fillRect(&tempRect, r, g, b);
}
@ -189,12 +198,15 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src,
Rect *bounds = &srcBounds;
Rect rect2;
if (surfaceNum >= 0 && !_backSurfaces[surfaceNum]._bounds.isEmpty()) {
Rect surfaceBounds = (surfaceNum == SURFACE_PRIMARY) ? _frontSurfaceBounds :
_backSurfaces[surfaceNum]._bounds;
if (!surfaceBounds.isEmpty()) {
// Perform clipping to the bounds of the back surface
rect2 = srcBounds;
rect2.translate(-srcBounds.left, -srcBounds.top);
rect2.translate(destPoint.x, destPoint.y);
rect2.constrain(_backSurfaces[surfaceNum]._bounds);
rect2.constrain(surfaceBounds);
rect2.translate(-destPoint.x, -destPoint.y);
rect2.translate(srcBounds.left, srcBounds.top);

View File

@ -64,6 +64,7 @@ public:
static CScreenManager *setCurrent();
public:
Common::Array<VideoSurfaceEntry> _backSurfaces;
Rect _frontSurfaceBounds;
CVideoSurface *_frontRenderSurface;
CMouseCursor *_mouseCursor;
CTextCursor *_textCursor;