From fe5dddf901eb40ac3c04b7d01bd078d65dafc5ab Mon Sep 17 00:00:00 2001 From: Cameron Cawley Date: Fri, 9 Aug 2019 20:45:27 +0100 Subject: GRAPHICS: Add a version of CursorManager::replaceCursor that accepts a Graphics::Cursor --- engines/composer/composer.cpp | 4 +--- engines/cryomni3d/cryomni3d.cpp | 6 ++---- engines/gnap/gnap.cpp | 4 +--- engines/mohawk/cursors.cpp | 14 ++++---------- engines/sci/graphics/cursor.cpp | 4 +--- 5 files changed, 9 insertions(+), 23 deletions(-) (limited to 'engines') diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index bd486e8324..6aafec276c 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -105,9 +105,7 @@ Common::Error ComposerEngine::run() { _screen.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor(); - CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), - cursor->getHotspotY(), cursor->getKeyColor()); - CursorMan.replaceCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount()); + CursorMan.replaceCursor(cursor); delete cursor; _console = new Console(this); diff --git a/engines/cryomni3d/cryomni3d.cpp b/engines/cryomni3d/cryomni3d.cpp index 452d6b7794..95da49a7e2 100644 --- a/engines/cryomni3d/cryomni3d.cpp +++ b/engines/cryomni3d/cryomni3d.cpp @@ -252,14 +252,12 @@ bool CryOmni3DEngine::displayHLZ(const Common::String &filename, uint32 timeout) } void CryOmni3DEngine::setCursor(const Graphics::Cursor &cursor) const { - CursorMan.replaceCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), - cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor()); + CursorMan.replaceCursor(&cursor); } void CryOmni3DEngine::setCursor(uint cursorId) const { const Graphics::Cursor &cursor = _sprites.getCursor(cursorId); - CursorMan.replaceCursor(cursor.getSurface(), cursor.getWidth(), cursor.getHeight(), - cursor.getHotspotX(), cursor.getHotspotY(), cursor.getKeyColor()); + CursorMan.replaceCursor(&cursor); } bool CryOmni3DEngine::pollEvents() { diff --git a/engines/gnap/gnap.cpp b/engines/gnap/gnap.cpp index aece4da004..1d31e6549b 100644 --- a/engines/gnap/gnap.cpp +++ b/engines/gnap/gnap.cpp @@ -547,9 +547,7 @@ void GnapEngine::setCursor(int cursorIndex) { Graphics::WinCursorGroup *cursorGroup = Graphics::WinCursorGroup::createCursorGroup(*_exe, Common::WinResourceID(cursorName)); if (cursorGroup) { Graphics::Cursor *cursor = cursorGroup->cursors[0].cursor; - CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), - cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor()); - CursorMan.replaceCursorPalette(cursor->getPalette(), 0, 256); + CursorMan.replaceCursor(cursor); delete cursorGroup; } _cursorIndex = cursorIndex; diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp index 8adcbf62ed..2cb41be65e 100644 --- a/engines/mohawk/cursors.cpp +++ b/engines/mohawk/cursors.cpp @@ -51,9 +51,7 @@ void CursorManager::hideCursor() { void CursorManager::setDefaultCursor() { Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor(); - CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), - cursor->getHotspotY(), cursor->getKeyColor()); - CursorMan.replaceCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount()); + CursorMan.replaceCursor(cursor); delete cursor; } @@ -71,9 +69,7 @@ void CursorManager::setMacCursor(Common::SeekableReadStream *stream) { if (!macCursor->readFromStream(*stream)) error("Could not parse Mac cursor"); - CursorMan.replaceCursor(macCursor->getSurface(), macCursor->getWidth(), macCursor->getHeight(), - macCursor->getHotspotX(), macCursor->getHotspotY(), macCursor->getKeyColor()); - CursorMan.replaceCursorPalette(macCursor->getPalette(), 0, 256); + CursorMan.replaceCursor(macCursor); delete macCursor; delete stream; @@ -165,8 +161,7 @@ void NECursorManager::setCursor(uint16 id) { if (cursorGroup) { Graphics::Cursor *cursor = cursorGroup->cursors[0].cursor; - CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor()); - CursorMan.replaceCursorPalette(cursor->getPalette(), 0, 256); + CursorMan.replaceCursor(cursor); delete cursorGroup; return; } @@ -272,8 +267,7 @@ void PECursorManager::setCursor(uint16 id) { for (uint i = 0; i < _cursors.size(); i++) { if (_cursors[i].id == id) { Graphics::Cursor *cursor = _cursors[i].cursorGroup->cursors[0].cursor; - CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), cursor->getHotspotY(), cursor->getKeyColor()); - CursorMan.replaceCursorPalette(cursor->getPalette(), 0, 256); + CursorMan.replaceCursor(cursor); return; } } diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp index 56177db9f3..bcddd16083 100644 --- a/engines/sci/graphics/cursor.cpp +++ b/engines/sci/graphics/cursor.cpp @@ -514,9 +514,7 @@ void GfxCursor::kernelSetMacCursor(GuiResourceId viewNum, int loopNum, int celNu return; } - CursorMan.replaceCursor(macCursor->getSurface(), macCursor->getWidth(), macCursor->getHeight(), - macCursor->getHotspotX(), macCursor->getHotspotY(), macCursor->getKeyColor()); - CursorMan.replaceCursorPalette(macCursor->getPalette(), 0, 256); + CursorMan.replaceCursor(macCursor); delete macCursor; kernelShow(); -- cgit v1.2.3