diff options
author | Denis Kasak | 2009-06-25 11:02:10 +0000 |
---|---|---|
committer | Denis Kasak | 2009-06-25 11:02:10 +0000 |
commit | 02dadc70fce56be7bfb3704de13367c3142c6ff3 (patch) | |
tree | f337f5d637777eb32d57e564d7422004693a2543 | |
parent | c87f05b14cae5253ff5635e4d23638aff3a1b3b5 (diff) | |
download | scummvm-rg350-02dadc70fce56be7bfb3704de13367c3142c6ff3.tar.gz scummvm-rg350-02dadc70fce56be7bfb3704de13367c3142c6ff3.tar.bz2 scummvm-rg350-02dadc70fce56be7bfb3704de13367c3142c6ff3.zip |
Implemented some more methods in Mouse so all mouse-related events are handled through it.
svn-id: r41861
-rw-r--r-- | engines/draci/draci.cpp | 25 | ||||
-rw-r--r-- | engines/draci/mouse.cpp | 21 |
2 files changed, 27 insertions, 19 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp index 8c92f97340..36c65fdbb3 100644 --- a/engines/draci/draci.cpp +++ b/engines/draci/draci.cpp @@ -66,9 +66,9 @@ int DraciEngine::init() { // Initialize graphics using following: initGraphics(kScreenWidth, kScreenHeight, false); - _mouse = new Mouse(this); _screen = new Screen(this); _font = new Font(); + _mouse = new Mouse(this); // Load default font _font->setFont(kFontBig); @@ -131,7 +131,7 @@ int DraciEngine::go() { } _screen->setPalette(f->_data, 0, kNumColours); - + // Fill screen with light grey _screen->fillScreen(225); @@ -186,22 +186,10 @@ int DraciEngine::go() { _system->delayMillis(100); debugC(5, kDraciGeneralDebugLevel, "Finished frame %d", t); - } - - path = "HRA.DFW"; - ar.openArchive(path); - - if(ar.isOpen()) { - f = ar[0]; - } else { - debugC(2, kDraciGeneralDebugLevel, "ERROR - Archive not opened"); - return Common::kUnknownError; - } + } - Sprite sp(f->_data, f->_length, 0, 0, true); - CursorMan.pushCursorPalette(_screen->getPalette(), 0, kNumColours); - CursorMan.pushCursor(sp._data, sp._width, sp._height, sp._width / 2, sp._height / 2); - CursorMan.showMouse(true); + _mouse->setCursorNum(kNormalCursor); + _mouse->cursorOn(); Common::Event event; bool quit = false; @@ -210,9 +198,10 @@ int DraciEngine::go() { switch (event.type) { case Common::EVENT_QUIT: quit = true; + break; default: _mouse->handleEvent(event); - } + } } _screen->copyToScreen(); _system->delayMillis(20); diff --git a/engines/draci/mouse.cpp b/engines/draci/mouse.cpp index b954915b8d..83ae0bab1a 100644 --- a/engines/draci/mouse.cpp +++ b/engines/draci/mouse.cpp @@ -25,6 +25,7 @@ #include "draci/draci.h" #include "draci/mouse.h" +#include "draci/barchive.h" namespace Draci { @@ -78,8 +79,26 @@ void Mouse::setPosition(uint16 x, uint16 y) { _vm->_system->warpMouse(x, y); } -// FIXME: stub +// FIXME: Handle hotspots properly +// TODO: Implement a resource manager void Mouse::setCursorNum(CursorType cursorNum) { + _cursorNum = cursorNum; + + Common::String path("HRA.DFW"); + BAFile *f; + BArchive ar; + ar.openArchive(path); + + if(ar.isOpen()) { + f = ar[cursorNum]; + } else { + debugC(2, kDraciGeneralDebugLevel, "ERROR - Archive not opened - %s", path.c_str()); + return; + } + + Sprite sp(f->_data, f->_length, 0, 0, true); + CursorMan.replaceCursorPalette(_vm->_screen->getPalette(), 0, kNumColours); + CursorMan.replaceCursor(sp._data, sp._width, sp._height, sp._width / 2, sp._height / 2); } } |