diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/direct_draw_surface.cpp | 1 | ||||
-rw-r--r-- | engines/titanic/game_manager.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/game_view.cpp | 4 | ||||
-rw-r--r-- | engines/titanic/main_game_window.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/screen_manager.cpp | 11 | ||||
-rw-r--r-- | engines/titanic/screen_manager.h | 24 | ||||
-rw-r--r-- | engines/titanic/titanic.cpp | 2 |
8 files changed, 33 insertions, 19 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index acd34decfc..8f2b333990 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -172,7 +172,7 @@ void CGameObject::draw(CScreenManager *screenManager) { if (_bounds.intersects(getGameManager()->_bounds)) { if (_surface) { Point destPos(_bounds.left, _bounds.top); - screenManager->blitFrom(0, _surface, &destPos); + screenManager->blitFrom(SURFACE_BACKBUFFER, _surface, &destPos); } if (_field90) diff --git a/engines/titanic/direct_draw_surface.cpp b/engines/titanic/direct_draw_surface.cpp index 4e7311a6a7..b432245333 100644 --- a/engines/titanic/direct_draw_surface.cpp +++ b/engines/titanic/direct_draw_surface.cpp @@ -64,6 +64,7 @@ void DirectDrawSurface::unlock() { void DirectDrawSurface::fill(const Rect *bounds, uint32 color) { Rect tempBounds; + assert(_surface); if (bounds) { // Bounds are provided, clip them to the bounds of this surface tempBounds = *bounds; diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index a3c241c1dc..d0c1ad5f8a 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -179,7 +179,7 @@ void CGameManager::update() { _bounds.extend(textCursor->getBounds()); // Set the surface bounds - screenManager->setSurfaceBounds(0, _bounds); + screenManager->setSurfaceBounds(SURFACE_BACKBUFFER, _bounds); // Handle redrawing the view if (!_bounds.isEmpty()) { diff --git a/engines/titanic/game_view.cpp b/engines/titanic/game_view.cpp index d780b8b38e..e93e8f0768 100644 --- a/engines/titanic/game_view.cpp +++ b/engines/titanic/game_view.cpp @@ -67,8 +67,8 @@ void CGameView::drawView() { srcRect.translate(-20, -10); Common::Point destPos(srcRect.left, srcRect.top); - CScreenManager::_currentScreenManagerPtr->blitFrom(0, _surface, - &destPos, &srcRect); + CScreenManager::_currentScreenManagerPtr->blitFrom(SURFACE_BACKBUFFER, + _surface, &destPos, &srcRect); } /*------------------------------------------------------------------------*/ diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp index 6fa240dcec..e1efae84df 100644 --- a/engines/titanic/main_game_window.cpp +++ b/engines/titanic/main_game_window.cpp @@ -55,7 +55,7 @@ void CMainGameWindow::applicationStarting() { // Set the video mode CScreenManager *screenManager = CScreenManager::setCurrent(); - screenManager->setMode(640, 480, 16, 1, true); + screenManager->setMode(640, 480, 16, 0, true); // TODO: Remove initial background and palette @@ -120,7 +120,7 @@ void CMainGameWindow::draw() { } CScreenManager *scrManager = CScreenManager::setCurrent(); - scrManager->clearSurface(0, &_gameManager->_bounds); + scrManager->clearSurface(SURFACE_BACKBUFFER, &_gameManager->_bounds); switch (_gameManager->_gameState._mode) { case GSMODE_1: @@ -129,7 +129,7 @@ void CMainGameWindow::draw() { drawPet(scrManager); drawView(); - drawViewContents(scrManager); +// drawViewContents(scrManager); scrManager->drawCursors(); break; diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 4d37b4578b..f13ecdd8fc 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -21,6 +21,7 @@ */ #include "titanic/screen_manager.h" +#include "titanic/titanic.h" #include "titanic/video_surface.h" namespace Titanic { @@ -62,7 +63,7 @@ CScreenManager *CScreenManager::setCurrent() { return _currentScreenManagerPtr; } -void CScreenManager::setSurfaceBounds(int surfaceNum, const Rect &r) { +void CScreenManager::setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r) { if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) _backSurfaces[surfaceNum]._bounds = r; } @@ -84,9 +85,11 @@ OSScreenManager::~OSScreenManager() { } void OSScreenManager::setMode(int width, int height, int bpp, uint numBackSurfaces, bool flag2) { + assert(bpp == 16); destroyFrontAndBackBuffers(); _directDrawManager.initVideo(width, height, bpp, numBackSurfaces); + _vm->_screen->create(width, height, g_system->getScreenFormat()); _frontRenderSurface = new OSVideoSurface(this, nullptr); _frontRenderSurface->setSurface(this, _directDrawManager._mainSurface); @@ -113,7 +116,7 @@ void OSScreenManager::drawCursors() { void OSScreenManager::proc6() {} void OSScreenManager::proc7() {} -CVideoSurface *OSScreenManager::getSurface(int surfaceNum) const { +CVideoSurface *OSScreenManager::getSurface(SurfaceNum surfaceNum) const { if (surfaceNum == -1) return _frontRenderSurface; else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) @@ -125,7 +128,7 @@ CVideoSurface *OSScreenManager::getSurface(int surfaceNum) const { void OSScreenManager::proc9() {} void OSScreenManager::proc10() {} -void OSScreenManager::blitFrom(int surfaceNum, CVideoSurface *src, +void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos, const Rect *srcRect) { // Get the dest surface CVideoSurface *destSurface = _frontRenderSurface; @@ -172,7 +175,7 @@ void OSScreenManager::getFont() {} void OSScreenManager::proc18() {} void OSScreenManager::proc19() {} -void OSScreenManager::clearSurface(int surfaceNum, Rect *bounds) { +void OSScreenManager::clearSurface(SurfaceNum surfaceNum, Rect *bounds) { if (surfaceNum == -1) _directDrawManager._mainSurface->fill(bounds, 0); else if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) diff --git a/engines/titanic/screen_manager.h b/engines/titanic/screen_manager.h index dc5a04236f..1b926fc3c6 100644 --- a/engines/titanic/screen_manager.h +++ b/engines/titanic/screen_manager.h @@ -35,6 +35,16 @@ namespace Titanic { +/** + * The original used page flipping with one primary and one back buffer. + * Since we don't need that in ScummVM, the back buffer number below is + * remapped to the primary surface + */ +enum SurfaceNum { + SURFACE_PRIMARY = -1, + SURFACE_BACKBUFFER = -1 +}; + class TitanicEngine; class CScreenManager { @@ -81,14 +91,14 @@ public: virtual void proc6() = 0; virtual void proc7() = 0; - virtual CVideoSurface *getSurface(int surfaceNum) const = 0; + virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const = 0; virtual void proc9() = 0; virtual void proc10() = 0; /** * Blits a surface onto one of the screen surfaces */ - virtual void blitFrom(int surfaceNum, CVideoSurface *src, const Point *destPos = nullptr, + virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos = nullptr, const Rect *srcRect = nullptr) = 0; virtual void proc12() = 0; @@ -103,7 +113,7 @@ public: /** * Clear a portion of a specified surface */ - virtual void clearSurface(int surfaceNum, Rect *_bounds) = 0; + virtual void clearSurface(SurfaceNum surfaceNum, Rect *_bounds) = 0; /** * Resize the passed surface @@ -125,7 +135,7 @@ public: virtual void showCursor() = 0; virtual void hideCursor() = 0; - void setSurfaceBounds(int surfaceNum, const Rect &r); + void setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r); }; class OSScreenManager: CScreenManager { @@ -163,14 +173,14 @@ public: virtual void proc6(); virtual void proc7(); - virtual CVideoSurface *getSurface(int surfaceNum) const; + virtual CVideoSurface *getSurface(SurfaceNum surfaceNum) const; virtual void proc9(); virtual void proc10(); /** * Blits a surface onto one of the screen surfaces */ - virtual void blitFrom(int surfaceNum, CVideoSurface *src, const Point *destPos, + virtual void blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, const Point *destPos, const Rect *srcRect = nullptr); virtual void proc12(); @@ -185,7 +195,7 @@ public: /** * Clear a portion of the screen surface */ - virtual void clearSurface(int surfaceNum, Rect *bounds); + virtual void clearSurface(SurfaceNum surfaceNum, Rect *bounds); /** * Resize the passed surface diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp index 3c31731346..4d43199184 100644 --- a/engines/titanic/titanic.cpp +++ b/engines/titanic/titanic.cpp @@ -87,7 +87,7 @@ void TitanicEngine::initialize() { _debugger = new Debugger(this); _events = new Events(this); - _screen = new Graphics::Screen(); + _screen = new Graphics::Screen(0, 0); _screenManager = new OSScreenManager(this); _window = new CMainGameWindow(this); _window->applicationStarting(); |