void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) { byte *destP = depthSurface.getData(); 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; } } delete[] walkMap; }
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(); } if (destP < endP) Common::fill(destP, endP, 0); }