From 295ab7e6ff022ea1f460740dd75d107b3f2fe64c Mon Sep 17 00:00:00 2001 From: Denis Kasak Date: Sun, 9 Aug 2009 03:58:03 +0000 Subject: [PATCH] Added Mouse::loadItemCursor(). Removed hotspot FIXME as all cursors seem to use the same hotspot (the center of the sprite). svn-id: r43158 --- engines/draci/mouse.cpp | 14 ++++++++++++-- engines/draci/mouse.h | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/engines/draci/mouse.cpp b/engines/draci/mouse.cpp index 9f34003840e..02510e15c55 100644 --- a/engines/draci/mouse.cpp +++ b/engines/draci/mouse.cpp @@ -88,12 +88,22 @@ void Mouse::setPosition(uint16 x, uint16 y) { _vm->_system->warpMouse(x, y); } -// FIXME: Handle hotspots properly void Mouse::setCursorType(CursorType cur) { _cursorType = cur; + + BAFile *f; + f = _vm->_iconsArchive->getFile(_cursorType); + + Sprite sp(f->_data, f->_length, 0, 0, true); + CursorMan.replaceCursorPalette(_vm->_screen->getPalette(), 0, kNumColours); + CursorMan.replaceCursor(sp.getBuffer(), sp.getWidth(), sp.getHeight(), + sp.getWidth() / 2, sp.getHeight() / 2); +} + +void Mouse::loadItemCursor(int itemID, bool highlighted) { BAFile *f; - f = _vm->_iconsArchive->getFile(_cursorType); + f = _vm->_itemImagesArchive->getFile(itemID + highlighted); Sprite sp(f->_data, f->_length, 0, 0, true); CursorMan.replaceCursorPalette(_vm->_screen->getPalette(), 0, kNumColours); diff --git a/engines/draci/mouse.h b/engines/draci/mouse.h index 07dc53311d9..f3e0123f595 100644 --- a/engines/draci/mouse.h +++ b/engines/draci/mouse.h @@ -50,8 +50,9 @@ public: void cursorOff(); bool isCursorOn(); void setPosition(uint16 x, uint16 y); - void setCursorType(CursorType cur); CursorType getCursorType() { return _cursorType; } + void setCursorType(CursorType cur); + void loadItemCursor(int itemID, bool highlighted = false); bool lButtonPressed() { return _lButton; } bool rButtonPressed() { return _rButton; } void lButtonSet(bool state) { _lButton = state; }