diff options
author | Filippos Karapetis | 2016-09-20 12:10:59 +0300 |
---|---|---|
committer | Filippos Karapetis | 2016-10-03 00:33:29 +0300 |
commit | c6ccd8bbe8da08534a9f1e23258dc4011a60382c (patch) | |
tree | 9c8dc00b5be289afc52575c7c6a07f7888875a35 /engines/chewy/console.cpp | |
parent | 676fa15c193bbd2a7fc2962d0c2bc26e260efd6a (diff) | |
download | scummvm-rg350-c6ccd8bbe8da08534a9f1e23258dc4011a60382c.tar.gz scummvm-rg350-c6ccd8bbe8da08534a9f1e23258dc4011a60382c.tar.bz2 scummvm-rg350-c6ccd8bbe8da08534a9f1e23258dc4011a60382c.zip |
CHEWY: Use a specialized resource handler for each resource
Diffstat (limited to 'engines/chewy/console.cpp')
-rw-r--r-- | engines/chewy/console.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/engines/chewy/console.cpp b/engines/chewy/console.cpp index b610dddf65..298e10baf4 100644 --- a/engines/chewy/console.cpp +++ b/engines/chewy/console.cpp @@ -32,6 +32,7 @@ namespace Chewy { Console::Console(ChewyEngine *vm) : GUI::Debugger(), _vm(vm) { registerCmd("dump", WRAP_METHOD(Console, Cmd_Dump)); + registerCmd("dump_bg", WRAP_METHOD(Console, Cmd_DumpBg)); registerCmd("draw", WRAP_METHOD(Console, Cmd_Draw)); registerCmd("play_sound", WRAP_METHOD(Console, Cmd_PlaySound)); registerCmd("play_speech", WRAP_METHOD(Console, Cmd_PlaySpeech)); @@ -55,10 +56,6 @@ bool Console::Cmd_Dump(int argc, const char **argv) { Chunk *chunk = res->getChunk(resNum); byte *data = res->getChunkData(resNum); uint32 size = chunk->size; - if (chunk->type == kResourceTBF) { - TBFChunk *tbf = res->getTBFChunk(resNum); - size = tbf->unpackedSize; - } Common::DumpFile outFile; outFile.open(dumpFilename); @@ -72,6 +69,33 @@ bool Console::Cmd_Dump(int argc, const char **argv) { return true; } +bool Console::Cmd_DumpBg(int argc, const char **argv) { + if (argc < 4) { + debugPrintf("Usage: dump_bg <file> <resource number> <dump file name>\n"); + return true; + } + + Common::String filename = argv[1]; + int resNum = atoi(argv[2]); + Common::String dumpFilename = argv[3]; + + BackgroundResource *res = new BackgroundResource(filename); + TBFChunk *image = res->getImage(resNum); + + Common::DumpFile outFile; + outFile.open(dumpFilename); + outFile.write(image->data, image->size); + outFile.flush(); + outFile.close(); + + delete[] image->data; + delete image; + delete res; + + return true; +} + + bool Console::Cmd_Draw(int argc, const char **argv) { if (argc < 3) { debugPrintf("Usage: draw <file> <resource number>\n"); |