aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/scene_data.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2014-03-12 23:45:57 -0400
committerPaul Gilbert2014-03-12 23:45:57 -0400
commit0df4d0aed1678f81cb75bb56cb2a1fc19603312c (patch)
tree69bf2b7826de6a962a91ab5c719c926af12f7198 /engines/mads/scene_data.cpp
parent408f5e79df5e8a33367fdf2a9c17b424953edace (diff)
downloadscummvm-rg350-0df4d0aed1678f81cb75bb56cb2a1fc19603312c.tar.gz
scummvm-rg350-0df4d0aed1678f81cb75bb56cb2a1fc19603312c.tar.bz2
scummvm-rg350-0df4d0aed1678f81cb75bb56cb2a1fc19603312c.zip
MADS: Fixed loading of scene depth surface for Rex Nebular
Diffstat (limited to 'engines/mads/scene_data.cpp')
-rw-r--r--engines/mads/scene_data.cpp39
1 files changed, 6 insertions, 33 deletions
diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp
index d2071e3ba5..0cb273a0f4 100644
--- a/engines/mads/scene_data.cpp
+++ b/engines/mads/scene_data.cpp
@@ -383,7 +383,7 @@ SceneInfo *SceneInfo::init(MADSEngine *vm) {
if (vm->getGameID() == GType_RexNebular) {
return new Nebular::SceneInfoNebular(vm);
} else {
- return new SceneInfo(vm);
+ error("Unknown game");
}
}
@@ -453,9 +453,7 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName,
if (i < spriteInfoCount)
spriteInfo.push_back(info);
}
-
delete infoStream;
- infoFile.close();
int width = _width;
int height = _height;
@@ -471,7 +469,11 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName,
}
// Load the depth surface with the scene codes
- loadCodes(depthSurface);
+ Common::SeekableReadStream *depthStream = infoPack.getItemStream(1);
+ loadCodes(depthSurface, depthStream);
+ delete depthStream;
+
+ infoFile.close();
// Get the ART resource
if (sceneFlag) {
@@ -554,35 +556,6 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName,
}
}
-void SceneInfo::loadCodes(MSurface &depthSurface) {
- File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT"));
- MadsPack codesPack(&f);
- Common::SeekableReadStream *stream = codesPack.getItemStream(0);
-
- uint16 width = _width;
- uint16 height = _height;
- byte *walkMap = new byte[stream->size()];
-
- depthSurface.setSize(width, height);
- stream->read(walkMap, f.size());
- delete stream;
- f.close();
-
- byte *ptr = (byte *)depthSurface.getPixels();
-
- for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x++) {
- int ofs = x + (y * width);
- if ((walkMap[ofs / 8] << (ofs % 8)) & 0x80)
- *ptr++ = 1; // walkable
- else
- *ptr++ = 0;
- }
- }
-
- delete[] walkMap;
-}
-
/*------------------------------------------------------------------------*/
SceneLogic::SceneLogic(MADSEngine *vm) : _vm(vm) {