diff options
author | Johannes Schickel | 2006-07-30 07:51:11 +0000 |
---|---|---|
committer | Johannes Schickel | 2006-07-30 07:51:11 +0000 |
commit | 92649de672d2dd0a03114b81cb4d475ba499519b (patch) | |
tree | 3a7af8544aabddc1d6eb951e0a9a2dccfab8794c /engines | |
parent | 8d453f22670126c72e61c49e2187d3b01bd5baa4 (diff) | |
download | scummvm-rg350-92649de672d2dd0a03114b81cb4d475ba499519b.tar.gz scummvm-rg350-92649de672d2dd0a03114b81cb4d475ba499519b.tar.bz2 scummvm-rg350-92649de672d2dd0a03114b81cb4d475ba499519b.zip |
- fixes copyright of kyra3.h
- implements a bit more init functions for kyra3
- removes hacked mouse cursor
- changes Resource::fileData to accept a null pointer for size
svn-id: r23622
Diffstat (limited to 'engines')
-rw-r--r-- | engines/kyra/kyra3.cpp | 67 | ||||
-rw-r--r-- | engines/kyra/kyra3.h | 16 | ||||
-rw-r--r-- | engines/kyra/resource.cpp | 20 | ||||
-rw-r--r-- | engines/kyra/screen.cpp | 14 | ||||
-rw-r--r-- | engines/kyra/screen.h | 3 |
5 files changed, 85 insertions, 35 deletions
diff --git a/engines/kyra/kyra3.cpp b/engines/kyra/kyra3.cpp index 6feab6848a..837987fbdd 100644 --- a/engines/kyra/kyra3.cpp +++ b/engines/kyra/kyra3.cpp @@ -42,6 +42,11 @@ KyraEngine_v3::KyraEngine_v3(OSystem *system) : KyraEngine(system) { _curMusicTrack = -1; _unkPage1 = _unkPage2 = 0; _interfaceCPS1 = _interfaceCPS2 = 0; + memset(_gameShapes, 0, sizeof(_gameShapes)); + _shapePoolBuffer = 0; + _unkBuffer17 = 0; + _itemBuffer1 = _itemBuffer2 = 0; + _mouseSHPBuf = 0; } KyraEngine_v3::~KyraEngine_v3() { @@ -51,6 +56,15 @@ KyraEngine_v3::~KyraEngine_v3() { delete [] _unkPage2; delete [] _interfaceCPS1; delete [] _interfaceCPS2; + + delete [] _unkBuffer17; + + delete [] _itemBuffer1; + delete [] _itemBuffer2; + + delete [] _shapePoolBuffer; + + delete [] _mouseSHPBuf; } int KyraEngine_v3::setupGameFlags() { @@ -96,8 +110,33 @@ int KyraEngine_v3::init() { _screen->loadFont(Screen::FID_6_FNT, "6.FNT"); _screen->loadFont(Screen::FID_8_FNT, "8FAT.FNT"); + _screen->loadFont(Screen::FID_BOOKFONT_FNT, "BOOKFONT.FNT"); + _screen->setAnimBlockPtr(3500); _screen->setScreenDim(0); - + + _shapePoolBuffer = new uint8[300000]; + assert(_shapePoolBuffer); + + // XXX game_setUnkBuffer(_shapePoolBuffer) + + _unkBuffer17 = new uint8[1850]; + assert(_unkBuffer17); + + _itemBuffer1 = new uint8[72]; + _itemBuffer2 = new uint8[144]; + assert(_itemBuffer1 && _itemBuffer2); + + _mouseSHPBuf = _res->fileData("MOUSE.SHP", 0); + assert(_mouseSHPBuf); + + for (int i = 0; i <= 6; ++i) { + _gameShapes[i] = _screen->getPtrToShape(_mouseSHPBuf, i); + } + + // XXX + + _screen->setMouseCursor(0, 0, *_gameShapes); + return 0; } @@ -328,35 +367,9 @@ int KyraEngine_v3::handleMainMenu(Movie *logo) { drawMainMenu(strings, selected); -#define A 0x00 -#define B 0xFF -#define C 0x7F - - // TODO: This is just a mock-up of the real mouse cursor. - const byte cursorImage[] = { - A, A, C, C, C, C, C, C, C, C, - A, B, A, C, C, C, C, C, C, C, - A, B, B, A, C, C, C, C, C, C, - A, B, B, B, A, C, C, C, C, C, - A, B, B, B, B, A, C, C, C, C, - A, B, B, B, B, B, A, C, C, C, - A, B, B, B, B, B, B, A, C, C, - A, B, B, B, B, B, B, B, A, C, - A, B, B, B, B, B, B, B, B, A, - C, A, A, A, B, B, B, A, A, C, - C, C, C, C, A, B, B, B, A, C, - C, C, C, C, C, A, B, B, B, A, - C, C, C, C, C, C, A, A, A, C - }; - _system->warpMouse(300, 180); - CursorMan.replaceCursor(cursorImage, 10, 13, 1, 1, C); _screen->showMouse(); -#undef A -#undef B -#undef C - int fh = _screen->getFontHeight(); int textPos = ((_screen->_curDim->w >> 1) + _screen->_curDim->sx) << 3; diff --git a/engines/kyra/kyra3.h b/engines/kyra/kyra3.h index 8a77201dd5..de32a8cb77 100644 --- a/engines/kyra/kyra3.h +++ b/engines/kyra/kyra3.h @@ -1,5 +1,5 @@ /* ScummVM - Scumm Interpreter - * Copyright (C) 2004-2006 The ScummVM project + * Copyright (C) 2006 The ScummVM project * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -84,10 +84,22 @@ private: private: uint8 *_unkPage1; uint8 *_unkPage2; - + + uint8 *_unkBuffer17; + // interface? uint8 *_interfaceCPS1; uint8 *_interfaceCPS2; + + // shapes + uint8 *_gameShapes[50]; + uint8 *_shapePoolBuffer; + + uint8 *_mouseSHPBuf; + + // items + uint8 *_itemBuffer1; + uint8 *_itemBuffer2; }; } // end of namespace Kyra diff --git a/engines/kyra/resource.cpp b/engines/kyra/resource.cpp index e9b9e91508..fd08cee6e9 100644 --- a/engines/kyra/resource.cpp +++ b/engines/kyra/resource.cpp @@ -150,10 +150,14 @@ uint8 *Resource::fileData(const char *file, uint32 *size) { uint8 *buffer = 0; Common::File file_; + if (size) + *size = 0; + // test to open it in the main dir if (file_.open(file)) { - *size = file_.size(); + if (size) + *size = file_.size(); buffer = new uint8[*size]; assert(buffer); @@ -164,18 +168,22 @@ uint8 *Resource::fileData(const char *file, uint32 *size) { // opens the file in a PAK File Common::List<ResourceFile*>::iterator start = _pakfiles.begin(); + uint32 temp = 0; for (;start != _pakfiles.end(); ++start) { - *size = (*start)->getFileSize(file); - - if (!(*size)) + temp = (*start)->getFileSize(file); + + if (!temp) continue; - + + if (size) + *size = temp; + buffer = (*start)->getFile(file); break; } } - if (!buffer || !(*size)) { + if (!buffer) { return 0; } diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index ea164f2d1c..091c8f5fc9 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -2232,4 +2232,18 @@ void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 * delete [] srcData; } +// kyra3 specific + +uint8 *Screen::getPtrToShape(uint8 *shpFile, int shape) { + debugC(9, kDebugLevelScreen, "KyraEngine::getPtrToShape(%p, %d)", (void *)shpFile, shape); + uint16 shapes = READ_LE_UINT16(shpFile); + + if (shapes <= shape) + return 0; + + uint32 offset = READ_LE_UINT32(shpFile + (shape << 1) + 2); + + return shpFile + offset + 2; +} + } // End of namespace Kyra diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index d1928e89fb..73875c9da4 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -83,6 +83,7 @@ public: FID_8_FNT, FID_CRED6_FNT, FID_CRED8_FNT, + FID_BOOKFONT_FNT, FID_NUM }; @@ -187,6 +188,8 @@ public: // maybe subclass screen for kyra3 static const ScreenDim _screenDimTableK3[]; static const int _screenDimTableCountK3; + + uint8 *getPtrToShape(uint8 *shpFile, int shape); private: uint8 *getPagePtr(int pageNum); |