diff options
Diffstat (limited to 'engines/mads/dragonsphere/dragonsphere_scenes.cpp')
-rw-r--r-- | engines/mads/dragonsphere/dragonsphere_scenes.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.cpp b/engines/mads/dragonsphere/dragonsphere_scenes.cpp index 59d7914378..f32d17d9c9 100644 --- a/engines/mads/dragonsphere/dragonsphere_scenes.cpp +++ b/engines/mads/dragonsphere/dragonsphere_scenes.cpp @@ -201,9 +201,10 @@ Common::String DragonsphereScene::formAnimName(char sepChar, int suffixNum) { /*------------------------------------------------------------------------*/ void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, int variant) { - File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); + Common::String ext = Common::String::format(".WW%d", variant); + File f(Resources::formatName(RESPREFIX_RM, _sceneId, ext)); MadsPack codesPack(&f); - Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1); + Common::SeekableReadStream *stream = codesPack.getItemStream(0); loadCodes(depthSurface, stream); @@ -213,22 +214,20 @@ void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, int variant) { void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) { byte *destP = depthSurface.getData(); - byte *endP = depthSurface.getBasePtr(0, depthSurface.h); - - byte runLength = stream->readByte(); - while (destP < endP && runLength > 0) { - byte runValue = stream->readByte(); - - // Write out the run length - Common::fill(destP, destP + runLength, runValue); - destP += runLength; - - // Get the next run length - runLength = stream->readByte(); + byte *walkMap = new byte[stream->size()]; + stream->read(walkMap, stream->size()); + + for (int y = 0; y < 156; ++y) { + for (int x = 0; x < 320; ++x) { + int offset = x + (y * 320); + if ((walkMap[offset / 8] << (offset % 8)) & 0x80) + *destP++ = 1; // walkable + else + *destP++ = 0; + } } - if (destP < endP) - Common::fill(destP, endP, 0); + delete[] walkMap; } } // End of namespace Dragonsphere |