mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-28 12:46:56 +00:00
myst3 added a function to uncompress the faces' watermasks
This commit is contained in:
parent
e50eace777
commit
a82878aca7
@ -36,7 +36,7 @@ class DirectorySubEntry {
|
||||
byte _type;
|
||||
|
||||
public:
|
||||
enum ResourceType {kFaceTexture};
|
||||
enum ResourceType {kFaceTexture, kFaceMask};
|
||||
|
||||
void readFromStream(Common::SeekableReadStream &inStream);
|
||||
void dump();
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
#include "engines/myst3/room.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
namespace Myst3 {
|
||||
|
||||
void Room::setFaceTextureJPEG(int face, Graphics::JPEG *jpeg) {
|
||||
@ -61,6 +63,49 @@ void Room::setFaceTextureRGB(int face, Graphics::Surface *texture) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
|
||||
void Room::dumpFaceMask(Archive &archive, uint16 index, int face) {
|
||||
byte *mask = new byte[640 * 640];
|
||||
memset(mask, 0, sizeof(mask));
|
||||
uint32 headerOffset = 0;
|
||||
uint32 dataOffset = 0;
|
||||
|
||||
Common::MemoryReadStream *maskStream = archive.dumpToMemory(index, face, DirectorySubEntry::kFaceMask);
|
||||
|
||||
while (headerOffset < 400) {
|
||||
int blockX = (headerOffset / sizeof(dataOffset)) % 10;
|
||||
int blockY = (headerOffset / sizeof(dataOffset)) / 10;
|
||||
|
||||
maskStream->seek(headerOffset, SEEK_SET);
|
||||
dataOffset = maskStream->readUint32LE();
|
||||
headerOffset = maskStream->pos();
|
||||
|
||||
debug("%d %d %d %d", headerOffset, dataOffset, blockX, blockY);
|
||||
|
||||
if (dataOffset != 0) {
|
||||
maskStream->seek(dataOffset, SEEK_SET);
|
||||
|
||||
for(int i = 63; i >= 0; i--) {
|
||||
int x = 0;
|
||||
byte numValues = maskStream->readByte();
|
||||
for (int j = 0; j < numValues; j++) {
|
||||
byte repeat = maskStream->readByte();
|
||||
byte value = maskStream->readByte();
|
||||
for (int k = 0; k < repeat; k++) {
|
||||
mask[((blockY * 64) + i) * 640 + blockX * 64 + x] = value;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Common::DumpFile outFile;
|
||||
outFile.open("dump/1-1.masku");
|
||||
outFile.write(mask, sizeof(mask));
|
||||
outFile.close();
|
||||
delete[] mask;
|
||||
}
|
||||
|
||||
void Room::load(Archive &archive, uint16 index) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
Common::MemoryReadStream *jpegStream = archive.dumpToMemory(index, i + 1, DirectorySubEntry::kFaceTexture);
|
||||
|
@ -51,6 +51,7 @@ class Room {
|
||||
void setFaceTextureJPEG(int face, Graphics::JPEG *jpeg);
|
||||
void draw();
|
||||
void load(Archive &archive, uint16 index);
|
||||
void dumpFaceMask(Archive &archive, uint16 index, int face);
|
||||
};
|
||||
|
||||
} // end of namespace Myst3
|
||||
|
Loading…
Reference in New Issue
Block a user