diff options
author | Sven Hesse | 2011-02-02 16:51:31 +0000 |
---|---|---|
committer | Sven Hesse | 2011-02-02 16:51:31 +0000 |
commit | 3d0edd71c9f43c0888fa7ea1bbd4f33eba4eb953 (patch) | |
tree | 1a4362ef3fcdcfb86eeefbc8dae66e9b1f5155b5 /engines | |
parent | 63c6d4432c2e7a032875c9b82a798f45314350ee (diff) | |
download | scummvm-rg350-3d0edd71c9f43c0888fa7ea1bbd4f33eba4eb953.tar.gz scummvm-rg350-3d0edd71c9f43c0888fa7ea1bbd4f33eba4eb953.tar.bz2 scummvm-rg350-3d0edd71c9f43c0888fa7ea1bbd4f33eba4eb953.zip |
GOB: Implement o7_loadLBMPalette
svn-id: r55733
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gob/inter_v7.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/engines/gob/inter_v7.cpp b/engines/gob/inter_v7.cpp index 65afbd998b..f1a12b9b31 100644 --- a/engines/gob/inter_v7.cpp +++ b/engines/gob/inter_v7.cpp @@ -442,7 +442,38 @@ void Inter_v7::o7_loadLBMPalette() { if (startIndex > stopIndex) SWAP(startIndex, stopIndex); - warning("Addy Stub: Load LBM palette: \"%s\", %d-%d", file.c_str(), startIndex, stopIndex); + Common::SeekableReadStream *lbmFile = _vm->_dataIO->getFile(file); + if (!lbmFile) { + warning("o7_loadLBMPalette(): No such file \"%s\"", file.c_str()); + return; + } + + ImageType type = Surface::identifyImage(*lbmFile); + if (type != kImageTypeLBM) { + warning("o7_loadLBMPalette(): \"%s\" is no LBM", file.c_str()); + return; + } + + byte palette[768]; + + LBMLoader lbm(*lbmFile); + if (!lbm.loadPalette(palette)) { + warning("o7_loadLBMPalette(): Failed reading palette from LBM \"%s\"", file.c_str()); + return; + } + + memset(palette , 0x00, 3); + memset(palette + 765, 0xFF, 3); + for (int i = 0; i < 768; i++) + palette[i] >>= 2; + + int16 count = stopIndex - startIndex + 1; + + startIndex *= 3; + count *= 3; + + memcpy((char *)_vm->_draw->_vgaPalette + startIndex, palette + startIndex, count); + _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); } void Inter_v7::o7_opendBase() { |