diff options
-rw-r--r-- | engines/kyra/kyra3.cpp | 25 | ||||
-rw-r--r-- | engines/kyra/kyra3.h | 2 | ||||
-rw-r--r-- | engines/kyra/resource.cpp | 10 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 6 |
4 files changed, 37 insertions, 6 deletions
diff --git a/engines/kyra/kyra3.cpp b/engines/kyra/kyra3.cpp index 837987fbdd..bd94d62eb4 100644 --- a/engines/kyra/kyra3.cpp +++ b/engines/kyra/kyra3.cpp @@ -133,6 +133,7 @@ int KyraEngine_v3::init() { _gameShapes[i] = _screen->getPtrToShape(_mouseSHPBuf, i); } + initItems(); // XXX _screen->setMouseCursor(0, 0, *_gameShapes); @@ -531,4 +532,28 @@ void KyraEngine_v3::realInit() { debugC(9, kDebugLevelMain, "KyraEngine::realInit()"); } +#pragma mark - items + +void KyraEngine_v3::initItems() { + debugC(9, kDebugLevelMain, "KyraEngine::initItems()"); + + _screen->loadBitmap("ITEMS.CSH", 3, 3, 0); + + // XXX + + _screen->loadBitmap("ITEMS2.CSH", 3, 3, 0); + + uint32 size = 0; + uint8 *itemsDat = _res->fileData("_ITEMS.DAT", &size); + + assert(size >= 72+144); + + memcpy(_itemBuffer1, itemsDat , 72); + memcpy(_itemBuffer2, itemsDat+72, 144); + + delete [] itemsDat; + + _screen->_curPage = 0; +} + } // end of namespace Kyra diff --git a/engines/kyra/kyra3.h b/engines/kyra/kyra3.h index de32a8cb77..9cf16ef34e 100644 --- a/engines/kyra/kyra3.h +++ b/engines/kyra/kyra3.h @@ -100,6 +100,8 @@ private: // items uint8 *_itemBuffer1; uint8 *_itemBuffer2; + + void initItems(); }; } // end of namespace Kyra diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index fd08cee6e9..2d9e22b9e8 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -156,12 +156,14 @@ uint8 *Resource::fileData(const char *file, uint32 *size) { // test to open it in the main dir if (file_.open(file)) { - if (size) - *size = file_.size(); - buffer = new uint8[*size]; + uint32 temp = file_.size(); + buffer = new uint8[temp]; assert(buffer); - file_.read(buffer, *size); + file_.read(buffer, temp); + + if (size) + *size = temp; file_.close(); } else { diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 091c8f5fc9..f45b9cea1a 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -1907,10 +1907,12 @@ void Screen::setMouseCursor(int x, int y, byte *shape) { fillRect(0, 0, mouseWidth, mouseHeight, 0, 8); drawShape(8, shape, 0, 0, 0, 0); - CursorMan.showMouse(false); + if (!_mouseLockCount) + CursorMan.showMouse(false); copyRegionToBuffer(8, 0, 0, mouseWidth, mouseHeight, cursor); CursorMan.replaceCursor(cursor, mouseWidth, mouseHeight, x, y, 0); - CursorMan.showMouse(true); + if (!_mouseLockCount) + CursorMan.showMouse(true); free(cursor); // makes sure that the cursor is drawn |