diff options
-rw-r--r-- | engines/neverhood/blbarchive.cpp | 12 | ||||
-rw-r--r-- | engines/neverhood/gamemodule.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/graphics.cpp | 10 | ||||
-rw-r--r-- | engines/neverhood/graphics.h | 10 | ||||
-rw-r--r-- | engines/neverhood/module1000.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module2200.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/module2700.cpp | 14 | ||||
-rw-r--r-- | engines/neverhood/navigationscene.cpp | 1 | ||||
-rw-r--r-- | engines/neverhood/neverhood.cpp | 4 | ||||
-rw-r--r-- | engines/neverhood/resource.cpp | 240 | ||||
-rw-r--r-- | engines/neverhood/resource.h | 30 | ||||
-rw-r--r-- | engines/neverhood/resourceman.cpp | 114 | ||||
-rw-r--r-- | engines/neverhood/resourceman.h | 28 | ||||
-rw-r--r-- | engines/neverhood/smackerscene.cpp | 4 | ||||
-rw-r--r-- | engines/neverhood/sound.cpp | 31 | ||||
-rw-r--r-- | engines/neverhood/sound.h | 8 | ||||
-rw-r--r-- | engines/neverhood/sprite.cpp | 12 | ||||
-rw-r--r-- | engines/neverhood/staticdata.cpp | 2 | ||||
-rw-r--r-- | engines/neverhood/staticdata.h | 2 |
19 files changed, 194 insertions, 334 deletions
diff --git a/engines/neverhood/blbarchive.cpp b/engines/neverhood/blbarchive.cpp index 5551ff07f1..02fad55000 100644 --- a/engines/neverhood/blbarchive.cpp +++ b/engines/neverhood/blbarchive.cpp @@ -73,7 +73,7 @@ void BlbArchive::open(const Common::String &filename) { if (header.id1 != 0x2004940 || header.id2 != 7 || header.fileSize != _fd.size()) error("BlbArchive::open() %s seems to be corrupt", filename.c_str()); - debug(2, "%s: fileCount = %d", filename.c_str(), header.fileCount); + debug(4, "%s: fileCount = %d", filename.c_str(), header.fileCount); _entries.reserve(header.fileCount); @@ -98,7 +98,7 @@ void BlbArchive::open(const Common::String &filename) { entry.offset = _fd.readUint32LE(); entry.diskSize = _fd.readUint32LE(); entry.size = _fd.readUint32LE(); - debug(2, "%08X: %03d, %02X, %04X, %08X, %08X, %08X, %08X", + debug(4, "%08X: %03d, %02X, %04X, %08X, %08X, %08X, %08X", entry.fileHash, entry.type, entry.comprType, extDataOffsets[i], entry.timeStamp, entry.offset, entry.diskSize, entry.size); } @@ -131,11 +131,8 @@ void BlbArchive::load(BlbArchiveEntry *entry, byte *buffer, uint32 size) { _fd.read(buffer, size); break; case 3: // DCL-compressed - if (!Common::decompressDCL(&_fd, buffer, entry->diskSize, entry->size)) { - debug("decompressDCL(diskSize: %d; size: %d)", entry->diskSize, entry->size); - debug("-> fileHash: %08X; type: %d; offset: %08X; endOffset: %08X", entry->fileHash, entry->type, entry->offset, entry->offset + entry->diskSize); - debug("-> fd.pos() = %08X", _fd.pos()); - } + if (!Common::decompressDCL(&_fd, buffer, entry->diskSize, entry->size)) + error("BlbArchive::load() Error during decompression of %=8X", entry->fileHash); break; default: error("BlbArchive::load() Unknown compression type %d", entry->comprType); @@ -148,7 +145,6 @@ byte *BlbArchive::getEntryExtData(uint index) { } byte *BlbArchive::getEntryExtData(BlbArchiveEntry *entry) { - //return (_extData && entry->extDataOfs != 0) ? &_extData[entry->extDataOfs - 1] : NULL; return entry->extData; } diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 956d969a6c..e6f38f020c 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -375,7 +375,7 @@ void GameModule::startup() { #if 1 _vm->gameState().sceneNum = 4; _vm->gameState().which = 1; - createModule(1800, -1); + createModule(1000, -1); #endif #if 0 _vm->gameState().sceneNum = 0; diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp index 2a8f543587..3b456a574f 100644 --- a/engines/neverhood/graphics.cpp +++ b/engines/neverhood/graphics.cpp @@ -150,7 +150,7 @@ void ShadowSurface::draw() { // FontSurface -FontSurface::FontSurface(NeverhoodEngine *vm, NPointArray *tracking, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight) +FontSurface::FontSurface(NeverhoodEngine *vm, NPointArray &tracking, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight) : BaseSurface(vm, 0, charWidth * 16, charHeight * numRows), _tracking(tracking), _numRows(numRows), _firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight) { } @@ -168,7 +168,7 @@ void FontSurface::drawChar(BaseSurface *destSurface, int16 x, int16 y, byte chr) void FontSurface::drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string) { for (; *string != 0; string++) { drawChar(destSurface, x, y, *string); - x += (*_tracking)[*string - _firstChar].x; + x += _tracking[*string - _firstChar].x; } } @@ -216,7 +216,7 @@ enum BitmapFlags { BF_HAS_IMAGE = 16 }; -void parseBitmapResource(byte *sprite, bool *rle, NDimensions *dimensions, NPoint *position, byte **palette, byte **pixels) { +void parseBitmapResource(const byte *sprite, bool *rle, NDimensions *dimensions, NPoint *position, const byte **palette, const byte **pixels) { uint16 flags; @@ -263,7 +263,7 @@ void parseBitmapResource(byte *sprite, bool *rle, NDimensions *dimensions, NPoin } -void unpackSpriteRle(byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY, byte oldColor, byte newColor) { +void unpackSpriteRle(const byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY, byte oldColor, byte newColor) { const bool replaceColors = oldColor != newColor; @@ -313,7 +313,7 @@ void unpackSpriteRle(byte *source, int width, int height, byte *dest, int destPi } -void unpackSpriteNormal(byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY) { +void unpackSpriteNormal(const byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY) { // TODO: Flip Y diff --git a/engines/neverhood/graphics.h b/engines/neverhood/graphics.h index b5286906e9..65d25c04ce 100644 --- a/engines/neverhood/graphics.h +++ b/engines/neverhood/graphics.h @@ -131,11 +131,11 @@ protected: class FontSurface : public BaseSurface { public: - FontSurface(NeverhoodEngine *vm, NPointArray *tracking, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight); + FontSurface(NeverhoodEngine *vm, NPointArray &tracking, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight); void drawChar(BaseSurface *destSurface, int16 x, int16 y, byte chr); void drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string); protected: - NPointArray *_tracking; + NPointArray _tracking; uint16 _numRows; byte _firstChar; uint16 _charWidth; @@ -162,9 +162,9 @@ protected: // Misc -void parseBitmapResource(byte *sprite, bool *rle, NDimensions *dimensions, NPoint *position, byte **palette, byte **pixels); -void unpackSpriteRle(byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY, byte oldColor = 0, byte newColor = 0); -void unpackSpriteNormal(byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY); +void parseBitmapResource(const byte *sprite, bool *rle, NDimensions *dimensions, NPoint *position, const byte **palette, const byte **pixels); +void unpackSpriteRle(const byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY, byte oldColor = 0, byte newColor = 0); +void unpackSpriteNormal(const byte *source, int width, int height, byte *dest, int destPitch, bool flipX, bool flipY); int calcDistance(int16 x1, int16 y1, int16 x2, int16 y2); } // End of namespace Neverhood diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp index c7c3fb227e..caa446639b 100644 --- a/engines/neverhood/module1000.cpp +++ b/engines/neverhood/module1000.cpp @@ -1597,7 +1597,7 @@ FontSurface *Scene1005::createFontSurface() { uint16 charWidth = fontData.getPoint(calcHash("meCharWidth")).x; uint16 charHeight = fontData.getPoint(calcHash("meCharHeight")).x; NPointArray *tracking = fontData.getPointArray(calcHash("meTracking")); - fontSurface = new FontSurface(_vm, tracking, numRows, firstChar, charWidth, charHeight); + fontSurface = new FontSurface(_vm, *tracking, numRows, firstChar, charWidth, charHeight); if (getGlobalVar(V_ENTRANCE_OPEN)) { fontSprite.load2(0x283CE401); } else { diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index 8a7e3464a5..8061e977f1 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -2242,7 +2242,7 @@ void Scene2208::createFontSurface() { uint16 charHeight = fontData.getPoint(calcHash("meCharHeight")).x; NPointArray *tracking = fontData.getPointArray(calcHash("meTracking")); spriteResource.load2(0x0800090C); - _fontSurface = new FontSurface(_vm, tracking, numRows, firstChar, charWidth, charHeight); + _fontSurface = new FontSurface(_vm, *tracking, numRows, firstChar, charWidth, charHeight); _fontSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0); } diff --git a/engines/neverhood/module2700.cpp b/engines/neverhood/module2700.cpp index 9a8a2f973d..50b4b24e65 100644 --- a/engines/neverhood/module2700.cpp +++ b/engines/neverhood/module2700.cpp @@ -185,7 +185,7 @@ void Module2700::createScene(int sceneNum, int which) { case 10: _vm->gameState().sceneNum = 10; _vm->gameState().which = which; - // TODO _vm->gameModule()->initScene2808Vars2(); + _vm->gameModule()->initTestTubes2Puzzle(); _scene2711StaticSprites[0] = kScene2711FileHashes1[getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 2)]; _scene2711StaticSprites[1] = kScene2711FileHashes2[getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 1)]; _scene2711StaticSprites[2] = kScene2711FileHashes3[getSubVar(VA_GOOD_TEST_TUBES_LEVEL_2, 0)]; @@ -631,8 +631,8 @@ Scene2701::Scene2701(NeverhoodEngine *vm, Module *parentModule, int which) tempSprite = insertStaticSprite(0x1E086325, 1200); clipRect.set(0, 0, 640, tempSprite->getDrawRect().y2()); - if (sceneInfo->class437Filename) { - _ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(sceneInfo->class437Filename); + if (sceneInfo->bgShadowFilename) { + _ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(sceneInfo->bgShadowFilename); addEntity(_ssTrackShadowBackground); _asCar = insertSprite<AsCommonCar>(this, 320, 240); _asCarShadow = insertSprite<AsCommonCarShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4); @@ -898,8 +898,8 @@ Scene2703::Scene2703(NeverhoodEngine *vm, Module *parentModule, int which, uint3 _palStatus = 2; - if (sceneInfo->class437Filename) { - _ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(sceneInfo->class437Filename); + if (sceneInfo->bgShadowFilename) { + _ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(sceneInfo->bgShadowFilename); addEntity(_ssTrackShadowBackground); _asCar = insertSprite<AsCommonCar>(this, 320, 240); _asCarShadow = insertSprite<AsCommonCarShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4); @@ -1017,8 +1017,8 @@ Scene2704::Scene2704(NeverhoodEngine *vm, Module *parentModule, int which, uint3 insertMouse433(sceneInfo->mouseCursorFilename); - if (sceneInfo->class437Filename) { - _ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(sceneInfo->class437Filename); + if (sceneInfo->bgShadowFilename) { + _ssTrackShadowBackground = createSprite<SsCommonTrackShadowBackground>(sceneInfo->bgShadowFilename); addEntity(_ssTrackShadowBackground); _asCar = insertSprite<AsCommonCar>(this, 320, 240); _asCarShadow = insertSprite<AsCommonCarShadow>(_asCar, _ssTrackShadowBackground->getSurface(), 4); diff --git a/engines/neverhood/navigationscene.cpp b/engines/neverhood/navigationscene.cpp index 8e167dd4d6..ffaa802a21 100644 --- a/engines/neverhood/navigationscene.cpp +++ b/engines/neverhood/navigationscene.cpp @@ -157,7 +157,6 @@ void NavigationScene::handleNavigation(const NPoint &mousePos) { uint32 direction = sendPointMessage(_mouseCursor, 0x2064, mousePos); switch (direction) { - // TODO: Merge cases 0 and 1? case 0: if (navigationItem.leftSmackerFileHash != 0) { _smackerFileHash = navigationItem.leftSmackerFileHash; diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index 208a1572e2..c29cc7baf5 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -214,7 +214,7 @@ void writeTga(const char *filename, byte *pixels, byte *palette, int16 width, in } void NeverhoodEngine::dumpAllResources() { - +#if 0 PaletteResource paletteResource(this); byte *vgaPalette = new byte[768]; //paletteResource.load(0x4086520E); @@ -258,7 +258,7 @@ void NeverhoodEngine::dumpAllResources() { } delete[] vgaPalette; - +#endif } } // End of namespace Neverhood diff --git a/engines/neverhood/resource.cpp b/engines/neverhood/resource.cpp index 1246472926..64f106128b 100644 --- a/engines/neverhood/resource.cpp +++ b/engines/neverhood/resource.cpp @@ -20,6 +20,7 @@ * */ +#include "common/algorithm.h" #include "common/memstream.h" #include "neverhood/resource.h" #include "neverhood/resourceman.h" @@ -33,7 +34,7 @@ namespace Neverhood { // SpriteResource SpriteResource::SpriteResource(NeverhoodEngine *vm) - : _vm(vm), _resourceHandle(-1), _pixels(NULL) { + : _vm(vm), _pixels(NULL) { } SpriteResource::~SpriteResource() { @@ -53,43 +54,30 @@ bool SpriteResource::load(uint32 fileHash) { debug(2, "SpriteResource::load(%08X)", fileHash); // TODO: Later merge with load2 and make the mode a parameter unload(); - _resourceHandle = _vm->_res->useResource(fileHash); - debug(2, "SpriteResource::load(0x%08X) _resourceHandle = %d", fileHash, _resourceHandle); - if (_resourceHandle != -1) { - if (_vm->_res->getResourceType(_resourceHandle) == 2) { - byte *spriteData = _vm->_res->loadResource(_resourceHandle, true); - parseBitmapResource(spriteData, &_rle, &_dimensions, NULL, NULL, &_pixels); - } else { - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - } + _vm->_res->queryResource(fileHash, _resourceHandle); + if (_resourceHandle.isValid() && _resourceHandle.type() == 2) { + _vm->_res->loadResource(_resourceHandle); + const byte *spriteData = _resourceHandle.data(); + parseBitmapResource(spriteData, &_rle, &_dimensions, NULL, NULL, &_pixels); } return _pixels != NULL; } bool SpriteResource::load2(uint32 fileHash) { + debug(2, "SpriteResource::load2(%08X)", fileHash); unload(); - _resourceHandle = _vm->_res->useResource(fileHash); - if (_resourceHandle != -1) { - if (_vm->_res->getResourceType(_resourceHandle) == 2) { - byte *spriteData = _vm->_res->loadResource(_resourceHandle, true); - parseBitmapResource(spriteData, &_rle, &_dimensions, &_position, NULL, &_pixels); - } else { - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - } + _vm->_res->queryResource(fileHash, _resourceHandle); + if (_resourceHandle.isValid() && _resourceHandle.type() == 2) { + _vm->_res->loadResource(_resourceHandle); + const byte *spriteData = _resourceHandle.data(); + parseBitmapResource(spriteData, &_rle, &_dimensions, &_position, NULL, &_pixels); } return _pixels != NULL; } void SpriteResource::unload() { - if (_resourceHandle != -1) { - _vm->_res->unloadResource(_resourceHandle); - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - } else { - delete[] _pixels; - } + _vm->_res->unloadResource(_resourceHandle); + delete[] _pixels; _pixels = NULL; _rle = false; } @@ -97,7 +85,7 @@ void SpriteResource::unload() { // PaletteResource PaletteResource::PaletteResource(NeverhoodEngine *vm) - : _vm(vm), _resourceHandle(-1), _palette(NULL) { + : _vm(vm), _palette(NULL) { } PaletteResource::~PaletteResource() { @@ -107,33 +95,22 @@ PaletteResource::~PaletteResource() { bool PaletteResource::load(uint32 fileHash) { debug(2, "PaletteResource::load(%08X)", fileHash); unload(); - _resourceHandle = _vm->_res->useResource(fileHash); - if (_resourceHandle != -1) { - _palette = _vm->_res->loadResource(_resourceHandle, true); - switch (_vm->_res->getResourceType(_resourceHandle)) { - case 2: - // Palette is stored in a bitmap + _vm->_res->queryResource(fileHash, _resourceHandle); + if (_resourceHandle.isValid() && + (_resourceHandle.type() == 2 || _resourceHandle.type() == 3)) { + _vm->_res->loadResource(_resourceHandle); + _palette = _resourceHandle.data(); + // Check if the palette is stored in a bitmap + if (_resourceHandle.type() == 2) parseBitmapResource(_palette, NULL, NULL, NULL, &_palette, NULL); - break; - case 3: - // _palette already points to the correct data - break; - default: - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - break; - } - } + + } return _palette != NULL; } void PaletteResource::unload() { - if (_resourceHandle != -1) { - _vm->_res->unloadResource(_resourceHandle); - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - _palette = NULL; - } + _vm->_res->unloadResource(_resourceHandle); + _palette = NULL; } void PaletteResource::copyPalette(byte *destPalette) { @@ -147,14 +124,12 @@ void PaletteResource::copyPalette(byte *destPalette) { // AnimResource AnimResource::AnimResource(NeverhoodEngine *vm) - : _vm(vm), _width(0), _height(0), _currSpriteData(NULL) { - - clear(); - clear2(); + : _vm(vm), _width(0), _height(0), _currSpriteData(NULL), _fileHash(0), _paletteData(NULL), + _spriteData(NULL), _replEnabled(false), _replOldColor(0), _replNewColor(0) { } AnimResource::~AnimResource() { - unloadInternal(); + unload(); } void AnimResource::draw(uint frameIndex, byte *dest, int destPitch, bool flipX, bool flipY) { @@ -175,27 +150,18 @@ bool AnimResource::load(uint32 fileHash) { return true; unload(); - _resourceHandle = _vm->_res->useResource(fileHash); - if (_resourceHandle == -1) + + _vm->_res->queryResource(fileHash, _resourceHandle); + if (!_resourceHandle.isValid() || _resourceHandle.type() != 4) return false; - byte *resourceData, *animList, *frameList; + const byte *resourceData, *animList, *frameList; uint16 animInfoStartOfs, animListIndex, animListCount; uint16 frameListStartOfs, frameCount; uint32 spriteDataOfs, paletteDataOfs; - if (_vm->_res->getResourceType(_resourceHandle) != 4) { - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - return false; - } - - resourceData = _vm->_res->loadResource(_resourceHandle); - if (!resourceData) { - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - return false; - } + _vm->_res->loadResource(_resourceHandle); + resourceData = _resourceHandle.data(); animListCount = READ_LE_UINT16(resourceData); animInfoStartOfs = READ_LE_UINT16(resourceData + 2); @@ -212,8 +178,6 @@ bool AnimResource::load(uint32 fileHash) { if (animListIndex >= animListCount) { _vm->_res->unloadResource(_resourceHandle); - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; return false; } @@ -257,44 +221,22 @@ bool AnimResource::load(uint32 fileHash) { } _fileHash = fileHash; - + return true; } void AnimResource::unload() { - if (_resourceHandle != -1) { - _vm->_res->unloadResource(_resourceHandle); - _vm->_res->unuseResource(_resourceHandle); - clear(); - } -} - -void AnimResource::clear() { - _resourceHandle = -1; + _vm->_res->unloadResource(_resourceHandle); _currSpriteData = NULL; _fileHash = 0; _paletteData = NULL; _spriteData = NULL; -} - -void AnimResource::clear2() { - clear(); _replEnabled = true; _replOldColor = 0; _replNewColor = 0; } -bool AnimResource::loadInternal(uint32 fileHash) { - unloadInternal(); - return load(fileHash); -} - -void AnimResource::unloadInternal() { - unload(); - clear2(); -} - int16 AnimResource::getFrameIndex(uint32 frameHash) { int16 frameIndex = -1; for (uint i = 0; i < _frames.size(); i++) @@ -312,8 +254,10 @@ void AnimResource::setRepl(byte oldColor, byte newColor) { } NDimensions AnimResource::loadSpriteDimensions(uint32 fileHash) { + ResourceHandle resourceHandle; NDimensions dimensions; - byte *resDimensions = _vm->_res->getResourceExtDataByHash(fileHash); + _vm->_res->queryResource(fileHash, resourceHandle); + const byte *resDimensions = resourceHandle.extData(); if (resDimensions) { dimensions.width = READ_LE_UINT16(resDimensions + 0); dimensions.height = READ_LE_UINT16(resDimensions + 2); @@ -368,7 +312,7 @@ NDrawRect& MouseCursorResource::getRect() { void MouseCursorResource::draw(int frameNum, byte *dest, int destPitch) { if (_cursorSprite.getPixels()) { int sourcePitch = (_cursorSprite.getDimensions().width + 3) & 0xFFFC; // 4 byte alignment - byte *source = _cursorSprite.getPixels() + _cursorNum * (sourcePitch * 32) + frameNum * 32; + const byte *source = _cursorSprite.getPixels() + _cursorNum * (sourcePitch * 32) + frameNum * 32; for (int16 yc = 0; yc < 32; yc++) { memcpy(dest, source, 32); source += sourcePitch; @@ -380,7 +324,7 @@ void MouseCursorResource::draw(int frameNum, byte *dest, int destPitch) { // TextResource TextResource::TextResource(NeverhoodEngine *vm) - : _vm(vm), _resourceHandle(-1), _textData(NULL), _count(0) { + : _vm(vm), _textData(NULL), _count(0) { } @@ -389,38 +333,20 @@ TextResource::~TextResource() { } void TextResource::load(uint32 fileHash) { + debug(2, "TextResource::load(%08X)", fileHash); unload(); - _resourceHandle = _vm->_res->useResource(fileHash); - if (_resourceHandle != -1) { - if (_vm->_res->getResourceType(_resourceHandle) == 6) { - _textData = _vm->_res->loadResource(_resourceHandle, true); - _count = READ_LE_UINT32(_textData); - - debug("TEXT RESOURCE %08X, count = %d:", fileHash, _count); - for (uint i = 0; i < _count-1; i++) { - const char *textEnd, *text = getString(i, textEnd); - while (text < textEnd) { - debug("[%04d] [%s]", i, text); - text += strlen(text) + 1; - } - debug("------------------"); - } - - } else { - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - } + _vm->_res->queryResource(fileHash, _resourceHandle); + if (_resourceHandle.isValid() && _resourceHandle.type() == 6) { + _vm->_res->loadResource(_resourceHandle); + _textData = _resourceHandle.data(); + _count = READ_LE_UINT32(_textData); } } void TextResource::unload() { - if (_resourceHandle != -1) { - _vm->_res->unloadResource(_resourceHandle); - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - _textData = NULL; - _count = 0; - } + _vm->_res->unloadResource(_resourceHandle); + _textData = NULL; + _count = 0; } const char *TextResource::getString(uint index, const char *&textEnd) { @@ -432,7 +358,7 @@ const char *TextResource::getString(uint index, const char *&textEnd) { // DataResource DataResource::DataResource(NeverhoodEngine *vm) - : _vm(vm), _resourceHandle(-1) { + : _vm(vm) { } DataResource::~DataResource() { @@ -441,18 +367,14 @@ DataResource::~DataResource() { void DataResource::load(uint32 fileHash) { debug(2, "DataResource::load(%08X)", fileHash); - byte *data = NULL; + const byte *data = NULL; uint32 dataSize = 0; unload(); - _resourceHandle = _vm->_res->useResource(fileHash); - if (_resourceHandle != -1) { - if (_vm->_res->getResourceType(_resourceHandle) == 5) { - data = _vm->_res->loadResource(_resourceHandle, true); - dataSize = _vm->_res->getResourceSize(_resourceHandle); - } else { - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - } + _vm->_res->queryResource(fileHash, _resourceHandle); + if (_resourceHandle.isValid() && _resourceHandle.type() == 5) { + _vm->_res->loadResource(_resourceHandle); + data = _resourceHandle.data(); + dataSize = _resourceHandle.size(); } if (data && dataSize) { Common::MemoryReadStream dataS(data, dataSize); @@ -588,40 +510,45 @@ void DataResource::load(uint32 fileHash) { } void DataResource::unload() { - if (_resourceHandle != -1) { - _vm->_res->unloadResource(_resourceHandle); - _vm->_res->unuseResource(_resourceHandle); - _resourceHandle = -1; - // TODO: Clear arrays - } + _vm->_res->unloadResource(_resourceHandle); + _directory.clear(); + _points.clear(); + for (Common::Array<NPointArray*>::iterator it = _pointArrays.begin(); it != _pointArrays.end(); ++it) + delete (*it); + _pointArrays.clear(); + for (Common::Array<NRectArray*>::iterator it = _rectArrays.begin(); it != _rectArrays.end(); ++it) + delete (*it); + _rectArrays.clear(); + for (Common::Array<HitRectList*>::iterator it = _hitRectLists.begin(); it != _hitRectLists.end(); ++it) + delete (*it); + _hitRectLists.clear(); + for (Common::Array<MessageList*>::iterator it = _messageLists.begin(); it != _messageLists.end(); ++it) + delete (*it); + _messageLists.clear(); + _drRects.clear(); + for (Common::Array<DRSubRectList*>::iterator it = _drSubRectLists.begin(); it != _drSubRectLists.end(); ++it) + delete (*it); + _drSubRectLists.clear(); } NPoint DataResource::getPoint(uint32 nameHash) { DataResource::DRDirectoryItem *drDirectoryItem = findDRDirectoryItem(nameHash, 1); - if (drDirectoryItem) - return _points[drDirectoryItem->offset]; - return NPoint(); + return drDirectoryItem ? _points[drDirectoryItem->offset] : NPoint(); } NPointArray *DataResource::getPointArray(uint32 nameHash) { DataResource::DRDirectoryItem *drDirectoryItem = findDRDirectoryItem(nameHash, 2); - if (drDirectoryItem) - return _pointArrays[drDirectoryItem->offset]; - return NULL; + return drDirectoryItem ? _pointArrays[drDirectoryItem->offset] : NULL; } NRectArray *DataResource::getRectArray(uint32 nameHash) { DataResource::DRDirectoryItem *drDirectoryItem = findDRDirectoryItem(nameHash, 3); - if (drDirectoryItem) - return _rectArrays[drDirectoryItem->offset]; - return NULL; + return drDirectoryItem ? _rectArrays[drDirectoryItem->offset] : NULL; } HitRectList *DataResource::getHitRectList() { DataResource::DRDirectoryItem *drDirectoryItem = findDRDirectoryItem(calcHash("HitArray"), 3); - if (drDirectoryItem) - return _hitRectLists[drDirectoryItem->offset]; - return NULL; + return drDirectoryItem ? _hitRectLists[drDirectoryItem->offset] : NULL; } MessageList *DataResource::getMessageListAtPos(int16 klaymanX, int16 klaymanY, int16 mouseX, int16 mouseY) { @@ -642,10 +569,9 @@ MessageList *DataResource::getMessageListAtPos(int16 klaymanX, int16 klaymanY, i } DataResource::DRDirectoryItem *DataResource::findDRDirectoryItem(uint32 nameHash, uint16 type) { - for (Common::Array<DRDirectoryItem>::iterator it = _directory.begin(); it != _directory.end(); it++) { + for (Common::Array<DRDirectoryItem>::iterator it = _directory.begin(); it != _directory.end(); it++) if ((*it).nameHash == nameHash && (*it).type == type) return &(*it); - } return NULL; } diff --git a/engines/neverhood/resource.h b/engines/neverhood/resource.h index 50a49e3bdc..996579bc41 100644 --- a/engines/neverhood/resource.h +++ b/engines/neverhood/resource.h @@ -27,6 +27,7 @@ #include "neverhood/neverhood.h" #include "neverhood/graphics.h" #include "neverhood/staticdata.h" +#include "neverhood/resourceman.h" namespace Neverhood { @@ -41,13 +42,13 @@ public: const NDimensions& getDimensions() { return _dimensions; } NPoint& getPosition() { return _position; } bool isRle() const { return _rle; } - byte *getPixels() const { return _pixels; } + const byte *getPixels() const { return _pixels; } protected: NeverhoodEngine *_vm; - int _resourceHandle; + ResourceHandle _resourceHandle; NDimensions _dimensions; NPoint _position; - byte *_pixels; + const byte *_pixels; bool _rle; }; @@ -58,11 +59,11 @@ public: bool load(uint32 fileHash); void unload(); void copyPalette(byte *destPalette); - byte *palette() { return _palette; } + const byte *palette() { return _palette; } protected: NeverhoodEngine *_vm; - int _resourceHandle; - byte *_palette; + ResourceHandle _resourceHandle; + const byte *_palette; }; struct AnimFrameInfo { @@ -82,9 +83,6 @@ public: bool load(uint32 fileHash); void unload(); void clear(); - void clear2(); - bool loadInternal(uint32 fileHash); - void unloadInternal(); uint getFrameCount() const { return _frames.size(); } const AnimFrameInfo& getFrameInfo(int16 index) const { return _frames[index]; } int16 getFrameIndex(uint32 frameHash); @@ -93,12 +91,12 @@ public: NDimensions loadSpriteDimensions(uint32 fileHash); protected: NeverhoodEngine *_vm; - int _resourceHandle; + ResourceHandle _resourceHandle; int16 _width, _height; - byte *_currSpriteData; + const byte *_currSpriteData; uint32 _fileHash; - byte *_paletteData; - byte *_spriteData; + const byte *_paletteData; + const byte *_spriteData; bool _replEnabled; byte _replOldColor; byte _replNewColor; @@ -131,8 +129,8 @@ public: uint getCount() const { return _count;} protected: NeverhoodEngine *_vm; - int _resourceHandle; - byte *_textData; + ResourceHandle _resourceHandle; + const byte *_textData; uint _count; }; @@ -178,7 +176,7 @@ protected: typedef Common::Array<DRSubRect> DRSubRectList; NeverhoodEngine *_vm; - int _resourceHandle; + ResourceHandle _resourceHandle; Common::Array<DRDirectoryItem> _directory; Common::Array<NPoint> _points; Common::Array<NPointArray*> _pointArrays; diff --git a/engines/neverhood/resourceman.cpp b/engines/neverhood/resourceman.cpp index eb6aa01533..3b67b26a06 100644 --- a/engines/neverhood/resourceman.cpp +++ b/engines/neverhood/resourceman.cpp @@ -24,6 +24,13 @@ namespace Neverhood { +ResourceHandle::ResourceHandle() + : _resourceFileEntry(NULL), _data(NULL) { +} + +ResourceHandle::~ResourceHandle() { +} + ResourceMan::ResourceMan() { } @@ -66,92 +73,43 @@ ResourceFileEntry *ResourceMan::findEntry(uint32 fileHash) { return entry; } -int ResourceMan::useResource(uint32 fileHash) { - ResourceFileEntry *entry = findEntry(fileHash); - if (!entry) - return -1; - if (entry->resourceHandle != -1) { - _resources[entry->resourceHandle]->useRefCount++; - } else { - Resource *resource = new Resource(); - resource->entry = entry; - resource->useRefCount = 1; - entry->resourceHandle = (int)_resources.size(); - _resources.push_back(resource); - } - return entry->resourceHandle; -} - -void ResourceMan::unuseResource(int resourceHandle) { - if (resourceHandle < 0) - return; - Resource *resource = _resources[resourceHandle]; - if (resource->useRefCount > 0) - resource->useRefCount--; -} - -uint32 ResourceMan::getResourceSize(int resourceHandle) const { - if (resourceHandle < 0) - return 0; - Resource *resource = _resources[resourceHandle]; - return resource->entry->archiveEntry->size; -} - -byte ResourceMan::getResourceType(int resourceHandle) { - if (resourceHandle < 0) - return 0; - Resource *resource = _resources[resourceHandle]; - return resource->entry->archiveEntry->type; -} - -byte ResourceMan::getResourceTypeByHash(uint32 fileHash) { +Common::SeekableReadStream *ResourceMan::createStream(uint32 fileHash) { ResourceFileEntry *entry = findEntry(fileHash); - return entry->archiveEntry->type; -} - -byte *ResourceMan::getResourceExtData(int resourceHandle) { - if (resourceHandle < 0) - return NULL; - Resource *resource = _resources[resourceHandle]; - return resource->entry->archive->getEntryExtData(resource->entry->archiveEntry); + return entry->archive->createStream(entry->archiveEntry); } -byte *ResourceMan::getResourceExtDataByHash(uint32 fileHash) { - ResourceFileEntry *entry = findEntrySimple(fileHash); - return entry ? entry->archive->getEntryExtData(entry->archiveEntry) : NULL; +void ResourceMan::queryResource(uint32 fileHash, ResourceHandle &resourceHandle) { + resourceHandle._resourceFileEntry = findEntry(fileHash); } -byte *ResourceMan::loadResource(int resourceHandle, bool moveToFront) { - if (resourceHandle < 0) - return NULL; - Resource *resource = _resources[resourceHandle]; - ResourceData *resourceData = _data[resource->entry->archiveEntry->fileHash]; - if (!resourceData) { - resourceData = new ResourceData(); - _data[resource->entry->archiveEntry->fileHash] = resourceData; - } - if (resourceData->data != NULL) { - resourceData->dataRefCount++; - } else { - resourceData->data = new byte[resource->entry->archiveEntry->size]; - resource->entry->archive->load(resource->entry->archiveEntry, resourceData->data, 0); - resourceData->dataRefCount = 1; +void ResourceMan::loadResource(ResourceHandle &resourceHandle) { + resourceHandle._data = NULL; + if (resourceHandle.isValid()) { + const uint32 fileHash = resourceHandle.fileHash(); + ResourceData *resourceData = _data[fileHash]; + if (!resourceData) { + resourceData = new ResourceData(); + _data[fileHash] = resourceData; + } + if (resourceData->data != NULL) { + resourceData->dataRefCount++; + } else { + resourceData->data = new byte[resourceHandle._resourceFileEntry->archiveEntry->size]; + resourceHandle._resourceFileEntry->archive->load(resourceHandle._resourceFileEntry->archiveEntry, resourceData->data, 0); + resourceData->dataRefCount = 1; + } + resourceHandle._data = resourceData->data; } - return resourceData->data; -} - -void ResourceMan::unloadResource(int resourceHandle) { - if (resourceHandle < 0) - return; - Resource *resource = _resources[resourceHandle]; - ResourceData *resourceData = _data[resource->entry->archiveEntry->fileHash]; - if (resourceData && resourceData->dataRefCount > 0) - resourceData->dataRefCount--; } -Common::SeekableReadStream *ResourceMan::createStream(uint32 fileHash) { - ResourceFileEntry *entry = findEntry(fileHash); - return entry->archive->createStream(entry->archiveEntry); +void ResourceMan::unloadResource(ResourceHandle &resourceHandle) { + if (resourceHandle.isValid()) { + ResourceData *resourceData = _data[resourceHandle.fileHash()]; + if (resourceData && resourceData->dataRefCount > 0) + --resourceData->dataRefCount; + resourceHandle._resourceFileEntry = NULL; + resourceHandle._data = NULL; + } } } // End of namespace Neverhood diff --git a/engines/neverhood/resourceman.h b/engines/neverhood/resourceman.h index 5ca8fa2b04..515849efbf 100644 --- a/engines/neverhood/resourceman.h +++ b/engines/neverhood/resourceman.h @@ -48,20 +48,23 @@ struct ResourceData { ResourceData() : data(NULL), dataRefCount() {} }; -#if 0 class ResourceMan; struct ResourceHandle { +friend class ResourceMan; public: ResourceHandle(); ~ResourceHandle(); - const byte *data(); - uint32 size() const { return _archiveEntry ? _archiveEntry->size : 0 }; + bool isValid() const { return _resourceFileEntry != NULL && _resourceFileEntry->archiveEntry != NULL; } + byte type() const { return isValid() ? _resourceFileEntry->archiveEntry->type : 0; }; + const byte *data() const { return _data; } + uint32 size() const { return isValid() ? _resourceFileEntry->archiveEntry->size : 0; }; + const byte *extData() const { return isValid() ? _resourceFileEntry->archiveEntry->extData : NULL; }; + uint32 fileHash() const { return isValid() ? _resourceFileEntry->archiveEntry->fileHash : 0; }; protected: - ResourceMan *_res; ResourceFileEntry *_resourceFileEntry; + const byte *_data; }; -#endif class ResourceMan { public: @@ -70,21 +73,12 @@ public: void addArchive(const Common::String &filename); ResourceFileEntry *findEntrySimple(uint32 fileHash); ResourceFileEntry *findEntry(uint32 fileHash); - int useResource(uint32 fileHash); - void unuseResource(int resourceHandle); - uint32 getResourceSize(int resourceHandle) const; - byte getResourceType(int resourceHandle); - byte getResourceTypeByHash(uint32 fileHash); - byte *getResourceExtData(int resourceHandle); - byte *getResourceExtDataByHash(uint32 fileHash); - byte *loadResource(int resourceHandle, bool moveToFront = false); - void unloadResource(int resourceHandle); Common::SeekableReadStream *createStream(uint32 fileHash); const ResourceFileEntry& getEntry(uint index) { return _entries[index]; } uint getEntryCount() { return _entries.size(); } -#if 0 - ResourceHandle getResource(uint32 fileHash); -#endif + void queryResource(uint32 fileHash, ResourceHandle &resourceHandle); + void loadResource(ResourceHandle &resourceHandle); + void unloadResource(ResourceHandle &resourceHandle); protected: typedef Common::HashMap<uint32, ResourceFileEntry> EntriesMap; Common::Array<BlbArchive*> _archives; diff --git a/engines/neverhood/smackerscene.cpp b/engines/neverhood/smackerscene.cpp index 0ed689031a..a08aad4cee 100644 --- a/engines/neverhood/smackerscene.cpp +++ b/engines/neverhood/smackerscene.cpp @@ -70,7 +70,9 @@ void SmackerScene::nextVideo() { if (_fileHashList && _fileHashList[_fileHashListIndex] != 0) { uint32 smackerFileHash = _fileHashList[_fileHashListIndex]; - if (_vm->_res->getResourceTypeByHash(smackerFileHash) != 10) { + ResourceHandle resourceHandle; + _vm->_res->queryResource(smackerFileHash, resourceHandle); + if (resourceHandle.type() != 10) { // Not a Smacker file _vm->_screen->setSmackerDecoder(NULL); sendMessage(_parentModule, 0x1009, 0); diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp index 52783cc1d3..f0961f42e9 100644 --- a/engines/neverhood/sound.cpp +++ b/engines/neverhood/sound.cpp @@ -524,7 +524,7 @@ AudioResourceMan::~AudioResourceMan() { int16 AudioResourceMan::addSound(uint32 fileHash) { AudioResourceManSoundItem *soundItem = new AudioResourceManSoundItem(); - soundItem->_resourceHandle = _vm->_res->useResource(fileHash); + _vm->_res->queryResource(fileHash, soundItem->_resourceHandle); soundItem->_fileHash = fileHash; soundItem->_data = NULL; soundItem->_isLoaded = false; @@ -543,16 +543,7 @@ int16 AudioResourceMan::addSound(uint32 fileHash) { void AudioResourceMan::removeSound(int16 soundIndex) { AudioResourceManSoundItem *soundItem = _soundItems[soundIndex]; - if (_vm->_mixer->isSoundHandleActive(soundItem->_soundHandle)) - _vm->_mixer->stopHandle(soundItem->_soundHandle); - if (soundItem->_data) { - _vm->_res->unloadResource(soundItem->_resourceHandle); - soundItem->_data = NULL; - } - if (soundItem->_resourceHandle != 1) { - _vm->_res->unuseResource(soundItem->_resourceHandle); - soundItem->_resourceHandle = -1; - } + unloadSound(soundIndex); delete soundItem; _soundItems[soundIndex] = NULL; } @@ -561,7 +552,8 @@ void AudioResourceMan::loadSound(int16 soundIndex) { AudioResourceManSoundItem *soundItem = _soundItems[soundIndex]; if (!soundItem->_data) { // TODO Check if it's a sound resource - soundItem->_data = _vm->_res->loadResource(soundItem->_resourceHandle); + _vm->_res->loadResource(soundItem->_resourceHandle); + soundItem->_data = soundItem->_resourceHandle.data(); } } @@ -569,10 +561,8 @@ void AudioResourceMan::unloadSound(int16 soundIndex) { AudioResourceManSoundItem *soundItem = _soundItems[soundIndex]; if (_vm->_mixer->isSoundHandleActive(soundItem->_soundHandle)) _vm->_mixer->stopHandle(soundItem->_soundHandle); - if (soundItem->_data) { - _vm->_res->unloadResource(soundItem->_resourceHandle); - soundItem->_data = NULL; - } + _vm->_res->unloadResource(soundItem->_resourceHandle); + soundItem->_data = NULL; } void AudioResourceMan::setSoundVolume(int16 soundIndex, int16 volume) { @@ -597,9 +587,8 @@ void AudioResourceMan::playSound(int16 soundIndex, bool looping) { if (!soundItem->_data) return; - uint32 soundSize = _vm->_res->getResourceSize(soundItem->_resourceHandle); - Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundItem->_data, soundSize, DisposeAfterUse::NO); - byte *shiftValue = _vm->_res->getResourceExtData(soundItem->_resourceHandle); + Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundItem->_data, soundItem->_resourceHandle.size(), DisposeAfterUse::NO); + const byte *shiftValue = soundItem->_resourceHandle.extData(); NeverhoodAudioStream *audioStream = new NeverhoodAudioStream(22050, *shiftValue, false, DisposeAfterUse::YES, stream); _vm->_mixer->playStream(Audio::Mixer::kSFXSoundType, &soundItem->_soundHandle, @@ -719,8 +708,10 @@ void AudioResourceMan::updateMusicItem(int16 musicIndex) { AudioResourceManMusicItem *musicItem = _musicItems[musicIndex]; if (musicItem->_start && !_vm->_mixer->isSoundHandleActive(musicItem->_soundHandle)) { + ResourceHandle resourceHandle; + _vm->_res->queryResource(musicItem->_fileHash, resourceHandle); Common::SeekableReadStream *stream = _vm->_res->createStream(musicItem->_fileHash); - byte *shiftValue = _vm->_res->getResourceExtDataByHash(musicItem->_fileHash); + const byte *shiftValue = resourceHandle.extData(); NeverhoodAudioStream *audioStream = new NeverhoodAudioStream(22050, *shiftValue, true, DisposeAfterUse::YES, stream); _vm->_mixer->playStream(Audio::Mixer::kMusicSoundType, &musicItem->_soundHandle, audioStream, -1, VOLUME(musicItem->_isFadingIn ? musicItem->_fadeVolume : musicItem->_volume), diff --git a/engines/neverhood/sound.h b/engines/neverhood/sound.h index 1f0940c353..8bfd5af2aa 100644 --- a/engines/neverhood/sound.h +++ b/engines/neverhood/sound.h @@ -184,8 +184,8 @@ private: struct AudioResourceManSoundItem { uint32 _fileHash; - int _resourceHandle; - byte *_data; + ResourceHandle _resourceHandle; + const byte *_data; bool _isLoaded; bool _isPlaying; int16 _volume; @@ -195,8 +195,6 @@ struct AudioResourceManSoundItem { struct AudioResourceManMusicItem { uint32 _fileHash; - // streamIndex dw - // needCreate db bool _isPlaying; bool _remove; int16 _volume; @@ -207,8 +205,6 @@ struct AudioResourceManMusicItem { int16 _fadeVolume; int16 _fadeVolumeStep; Audio::SoundHandle _soundHandle; - // status dw - // updateCounter dd }; class AudioResourceMan { diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp index 1e73078a1b..c7676ce0b4 100644 --- a/engines/neverhood/sprite.cpp +++ b/engines/neverhood/sprite.cpp @@ -263,10 +263,10 @@ void AnimatedSprite::updateAnim() { if (_currFrameTicks != 0 && (--_currFrameTicks == 0) && _animResource.getFrameCount() != 0) { if (_nextAnimFileHash != 0) { - if (_animResource.loadInternal(_nextAnimFileHash)) { + if (_animResource.load(_nextAnimFileHash)) { _currAnimFileHash = _nextAnimFileHash; } else { - _animResource.loadInternal(calcHash("sqDefault")); + _animResource.load(calcHash("sqDefault")); _currAnimFileHash = 0; } if (_replOldColor != _replNewColor) { @@ -294,10 +294,10 @@ void AnimatedSprite::updateAnim() { _currStickFrameIndex = _currFrameIndex; } else { if (_animStatus == 1) { - if (_animResource.loadInternal(_newAnimFileHash)) { + if (_animResource.load(_newAnimFileHash)) { _currAnimFileHash = _newAnimFileHash; } else { - _animResource.loadInternal(calcHash("sqDefault")); + _animResource.load(calcHash("sqDefault")); _currAnimFileHash = 0; } if (_replOldColor != _replNewColor) { @@ -307,10 +307,10 @@ void AnimatedSprite::updateAnim() { _currFrameIndex = _plFirstFrameHash != 0 ? MAX<int16>(0, _animResource.getFrameIndex(_plFirstFrameHash)) : 0; _lastFrameIndex = _plLastFrameHash != 0 ? MAX<int16>(0, _animResource.getFrameIndex(_plLastFrameHash)) : _animResource.getFrameCount() - 1; } else { - if (_animResource.loadInternal(_newAnimFileHash)) { + if (_animResource.load(_newAnimFileHash)) { _currAnimFileHash = _newAnimFileHash; } else { - _animResource.loadInternal(calcHash("sqDefault")); + _animResource.load(calcHash("sqDefault")); _currAnimFileHash = 0; } if (_replOldColor != _replNewColor) { diff --git a/engines/neverhood/staticdata.cpp b/engines/neverhood/staticdata.cpp index 1a633e289a..31f9f5e014 100644 --- a/engines/neverhood/staticdata.cpp +++ b/engines/neverhood/staticdata.cpp @@ -147,7 +147,7 @@ void StaticData::load(const char *filename) { SceneInfo2700 *sceneInfo2700 = new SceneInfo2700(); uint32 id = fd.readUint32LE(); sceneInfo2700->bgFilename = fd.readUint32LE(); - sceneInfo2700->class437Filename = fd.readUint32LE(); + sceneInfo2700->bgShadowFilename = fd.readUint32LE(); sceneInfo2700->dataResourceFilename = fd.readUint32LE(); sceneInfo2700->pointListName = fd.readUint32LE(); sceneInfo2700->rectListName = fd.readUint32LE(); diff --git a/engines/neverhood/staticdata.h b/engines/neverhood/staticdata.h index 69a407bdcb..f9a8b71f80 100644 --- a/engines/neverhood/staticdata.h +++ b/engines/neverhood/staticdata.h @@ -80,7 +80,7 @@ struct HallOfRecordsInfo { struct SceneInfo2700 { uint32 id; uint32 bgFilename; - uint32 class437Filename; + uint32 bgShadowFilename; uint32 dataResourceFilename; uint32 pointListName; uint32 rectListName; |