mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-26 11:46:54 +00:00
MYST3: Add a debug command to dump the faces' masks
This commit is contained in:
parent
bbf66ec232
commit
0da347f540
@ -39,6 +39,7 @@ Console::Console(Myst3Engine *vm) : GUI::Debugger(), _vm(vm) {
|
|||||||
DCmd_Register("extract", WRAP_METHOD(Console, Cmd_Extract));
|
DCmd_Register("extract", WRAP_METHOD(Console, Cmd_Extract));
|
||||||
DCmd_Register("fillInventory", WRAP_METHOD(Console, Cmd_FillInventory));
|
DCmd_Register("fillInventory", WRAP_METHOD(Console, Cmd_FillInventory));
|
||||||
DCmd_Register("dumpArchive", WRAP_METHOD(Console, Cmd_DumpArchive));
|
DCmd_Register("dumpArchive", WRAP_METHOD(Console, Cmd_DumpArchive));
|
||||||
|
DCmd_Register("dumpMasks", WRAP_METHOD(Console, Cmd_DumpMasks));
|
||||||
}
|
}
|
||||||
|
|
||||||
Console::~Console() {
|
Console::~Console() {
|
||||||
@ -321,4 +322,41 @@ bool Console::Cmd_DumpArchive(int argc, const char **argv) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Console::Cmd_DumpMasks(int argc, const char **argv) {
|
||||||
|
if (argc != 1 && argc != 2) {
|
||||||
|
DebugPrintf("Extract the masks of the faces of a cube node.\n");
|
||||||
|
DebugPrintf("The destination folder, named 'dump', must exist.\n");
|
||||||
|
DebugPrintf("Usage :\n");
|
||||||
|
DebugPrintf("dumpMasks [node]\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16 nodeId = _vm->_state->getLocationNode();
|
||||||
|
|
||||||
|
if (argc >= 2) {
|
||||||
|
nodeId = atoi(argv[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugPrintf("Extracting masks for node %d:\n", nodeId);
|
||||||
|
|
||||||
|
for (uint i = 0; i < 6; i++) {
|
||||||
|
bool water = _vm->_node->dumpFaceMask(nodeId, i, DirectorySubEntry::kWaterEffectMask);
|
||||||
|
if (water)
|
||||||
|
DebugPrintf("Face %d: water OK\n", i);
|
||||||
|
|
||||||
|
bool effect2 = _vm->_node->dumpFaceMask(nodeId, i, DirectorySubEntry::kEffect2Mask);
|
||||||
|
if (effect2)
|
||||||
|
DebugPrintf("Face %d: effect 2 OK\n", i);
|
||||||
|
|
||||||
|
bool magnet = _vm->_node->dumpFaceMask(nodeId, i, DirectorySubEntry::kMagneticEffectMask);
|
||||||
|
if (magnet)
|
||||||
|
DebugPrintf("Face %d: magnet OK\n", i);
|
||||||
|
|
||||||
|
if (!water && !effect2 && !magnet)
|
||||||
|
DebugPrintf("Face %d: No mask found\n", i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace Myst3 */
|
} /* namespace Myst3 */
|
||||||
|
@ -51,6 +51,7 @@ private:
|
|||||||
bool Cmd_Go(int argc, const char **argv);
|
bool Cmd_Go(int argc, const char **argv);
|
||||||
bool Cmd_Extract(int argc, const char **argv);
|
bool Cmd_Extract(int argc, const char **argv);
|
||||||
bool Cmd_DumpArchive(int argc, const char **argv);
|
bool Cmd_DumpArchive(int argc, const char **argv);
|
||||||
|
bool Cmd_DumpMasks(int argc, const char **argv);
|
||||||
bool Cmd_FillInventory(int argc, const char **argv);
|
bool Cmd_FillInventory(int argc, const char **argv);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void DirectorySubEntry::dumpToFile(Common::SeekableReadStream &inStream, const c
|
|||||||
case kFrame:
|
case kFrame:
|
||||||
sprintf(fileName, "dump/%s-%d-%d.jpg", room, index, _face);
|
sprintf(fileName, "dump/%s-%d-%d.jpg", room, index, _face);
|
||||||
break;
|
break;
|
||||||
case kFaceMask:
|
case kWaterEffectMask:
|
||||||
sprintf(fileName, "dump/%s-%d-%d.mask", room, index, _face);
|
sprintf(fileName, "dump/%s-%d-%d.mask", room, index, _face);
|
||||||
break;
|
break;
|
||||||
case kMovie:
|
case kMovie:
|
||||||
|
@ -50,7 +50,9 @@ class DirectorySubEntry {
|
|||||||
public:
|
public:
|
||||||
enum ResourceType {
|
enum ResourceType {
|
||||||
kCubeFace = 0,
|
kCubeFace = 0,
|
||||||
kFaceMask = 1,
|
kWaterEffectMask = 1,
|
||||||
|
kEffect2Mask = 2,
|
||||||
|
kMagneticEffectMask = 3,
|
||||||
kSpotItem = 5,
|
kSpotItem = 5,
|
||||||
kFrame = 6,
|
kFrame = 6,
|
||||||
kCursor = 7,
|
kCursor = 7,
|
||||||
|
@ -65,7 +65,7 @@ Node::Node(Myst3Engine *vm, uint16 id) :
|
|||||||
_faces[i] = 0;
|
_faces[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::dumpFaceMask(uint16 index, int face) {
|
bool Node::dumpFaceMask(uint16 index, int face, DirectorySubEntry::ResourceType type) {
|
||||||
static const int32 kMaskSize = 640 * 640;
|
static const int32 kMaskSize = 640 * 640;
|
||||||
|
|
||||||
byte *mask = new byte[kMaskSize];
|
byte *mask = new byte[kMaskSize];
|
||||||
@ -73,10 +73,10 @@ void Node::dumpFaceMask(uint16 index, int face) {
|
|||||||
uint32 headerOffset = 0;
|
uint32 headerOffset = 0;
|
||||||
uint32 dataOffset = 0;
|
uint32 dataOffset = 0;
|
||||||
|
|
||||||
const DirectorySubEntry *maskDesc = _vm->getFileDescription(0, index, face, DirectorySubEntry::kFaceMask);
|
const DirectorySubEntry *maskDesc = _vm->getFileDescription(0, index, face, type);
|
||||||
|
|
||||||
if (!maskDesc)
|
if (!maskDesc)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
Common::MemoryReadStream *maskStream = maskDesc->getData();
|
Common::MemoryReadStream *maskStream = maskDesc->getData();
|
||||||
|
|
||||||
@ -109,10 +109,12 @@ void Node::dumpFaceMask(uint16 index, int face) {
|
|||||||
delete maskStream;
|
delete maskStream;
|
||||||
|
|
||||||
Common::DumpFile outFile;
|
Common::DumpFile outFile;
|
||||||
outFile.open("dump/1-1.masku");
|
outFile.open(Common::String::format("dump/%d-%d.masku_%d", index, face, type));
|
||||||
outFile.write(mask, kMaskSize);
|
outFile.write(mask, kMaskSize);
|
||||||
outFile.close();
|
outFile.close();
|
||||||
delete[] mask;
|
delete[] mask;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node::~Node() {
|
Node::~Node() {
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#define MYST3_ROOM_H
|
#define MYST3_ROOM_H
|
||||||
|
|
||||||
#include "engines/myst3/gfx.h"
|
#include "engines/myst3/gfx.h"
|
||||||
|
#include "engines/myst3/directorysubentry.h"
|
||||||
|
|
||||||
#include "common/array.h"
|
#include "common/array.h"
|
||||||
#include "common/rect.h"
|
#include "common/rect.h"
|
||||||
@ -35,7 +36,6 @@ namespace Myst3 {
|
|||||||
class Texture;
|
class Texture;
|
||||||
class Myst3Engine;
|
class Myst3Engine;
|
||||||
class Subtitles;
|
class Subtitles;
|
||||||
class DirectorySubEntry;
|
|
||||||
|
|
||||||
class Face {
|
class Face {
|
||||||
public:
|
public:
|
||||||
@ -141,7 +141,7 @@ class Node : Drawable {
|
|||||||
void loadSubtitles(uint32 id);
|
void loadSubtitles(uint32 id);
|
||||||
bool hasSubtitlesToDraw();
|
bool hasSubtitlesToDraw();
|
||||||
|
|
||||||
void dumpFaceMask(uint16 index, int face);
|
bool dumpFaceMask(uint16 index, int face, DirectorySubEntry::ResourceType type);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace Myst3
|
} // end of namespace Myst3
|
||||||
|
Loading…
Reference in New Issue
Block a user