aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/phantom
diff options
context:
space:
mode:
authorFilippos Karapetis2014-07-23 02:46:58 +0300
committerFilippos Karapetis2014-07-23 02:47:29 +0300
commitbe9c3bf72bfc6d0abf650664df4be3595ad96933 (patch)
treeac8192e99bc08d7c300dd1f1f2fbdf8e68509755 /engines/mads/phantom
parent9118f38b299f6ec5bfc6971306f5b99cf0a1fd6c (diff)
downloadscummvm-rg350-be9c3bf72bfc6d0abf650664df4be3595ad96933.tar.gz
scummvm-rg350-be9c3bf72bfc6d0abf650664df4be3595ad96933.tar.bz2
scummvm-rg350-be9c3bf72bfc6d0abf650664df4be3595ad96933.zip
MADS: WIP handling of V2 walk nodes and walkable areas
Diffstat (limited to 'engines/mads/phantom')
-rw-r--r--engines/mads/phantom/phantom_scenes.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp
index dbce014525..7fd7ce642d 100644
--- a/engines/mads/phantom/phantom_scenes.cpp
+++ b/engines/mads/phantom/phantom_scenes.cpp
@@ -169,9 +169,10 @@ Common::String PhantomScene::formAnimName(char sepChar, int suffixNum) {
/*------------------------------------------------------------------------*/
void SceneInfoPhantom::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);
@@ -181,22 +182,20 @@ void SceneInfoPhantom::loadCodes(MSurface &depthSurface, int variant) {
void SceneInfoPhantom::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 Phantom