diff options
author | Colin Snover | 2016-03-03 20:31:10 -0600 |
---|---|---|
committer | Colin Snover | 2016-03-03 20:31:10 -0600 |
commit | 9a280d396532c9ac38cfd8589012dd47e659d002 (patch) | |
tree | 1f36c3f66ff10c84d06aa1c6e25fdfe2f6d90189 /engines/sci/graphics/celobj32.cpp | |
parent | b6a7d8c6a5bc286c68fea091e43e6a51df456655 (diff) | |
download | scummvm-rg350-9a280d396532c9ac38cfd8589012dd47e659d002.tar.gz scummvm-rg350-9a280d396532c9ac38cfd8589012dd47e659d002.tar.bz2 scummvm-rg350-9a280d396532c9ac38cfd8589012dd47e659d002.zip |
SCI32: Add all kBitmap signatures
Not all SCI2.1late/SCI3 function signatures are fully known yet,
but all subops are now represented in the kernel tables.
Diffstat (limited to 'engines/sci/graphics/celobj32.cpp')
-rw-r--r-- | engines/sci/graphics/celobj32.cpp | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp index 62db02b554..787d295d5e 100644 --- a/engines/sci/graphics/celobj32.cpp +++ b/engines/sci/graphics/celobj32.cpp @@ -968,6 +968,40 @@ byte *CelObjPic::getResPointer() const { #pragma mark - #pragma mark CelObjMem +void CelObjMem::buildBitmapHeader(byte *bitmap, const int16 width, const int16 height, const uint8 skipColor, const int16 displaceX, const int16 displaceY, const int16 scaledWidth, const int16 scaledHeight, const uint32 hunkPaletteOffset, const bool useRemap) { + const uint16 bitmapHeaderSize = getBitmapHeaderSize(); + + WRITE_SCI11ENDIAN_UINT16(bitmap + 0, width); + WRITE_SCI11ENDIAN_UINT16(bitmap + 2, height); + WRITE_SCI11ENDIAN_UINT16(bitmap + 4, (uint16)displaceX); + WRITE_SCI11ENDIAN_UINT16(bitmap + 6, (uint16)displaceY); + bitmap[8] = skipColor; + bitmap[9] = 0; + WRITE_SCI11ENDIAN_UINT16(bitmap + 10, 0); + + if (useRemap) { + bitmap[10] |= 2; + } + + WRITE_SCI11ENDIAN_UINT32(bitmap + 12, width * height); + WRITE_SCI11ENDIAN_UINT32(bitmap + 16, 0); + + if (hunkPaletteOffset) { + WRITE_SCI11ENDIAN_UINT32(bitmap + 20, hunkPaletteOffset + bitmapHeaderSize); + } else { + WRITE_SCI11ENDIAN_UINT32(bitmap + 20, 0); + } + + WRITE_SCI11ENDIAN_UINT32(bitmap + 24, bitmapHeaderSize); + WRITE_SCI11ENDIAN_UINT32(bitmap + 28, bitmapHeaderSize); + WRITE_SCI11ENDIAN_UINT32(bitmap + 32, 0); + + if (bitmapHeaderSize >= 40) { + WRITE_SCI11ENDIAN_UINT16(bitmap + 36, scaledWidth); + WRITE_SCI11ENDIAN_UINT16(bitmap + 38, scaledHeight); + } +} + CelObjMem::CelObjMem(const reg_t bitmap) { _info.type = kCelTypeMem; _info.bitmap = bitmap; @@ -976,8 +1010,9 @@ CelObjMem::CelObjMem(const reg_t bitmap) { _celHeaderOffset = 0; _transparent = true; + const uint32 bitmapHeaderSize = getBitmapHeaderSize(); byte *bitmapData = g_sci->getEngineState()->_segMan->getHunkPointer(bitmap); - if (bitmapData == nullptr || READ_SCI11ENDIAN_UINT32(bitmapData + 28) != 46) { + if (bitmapData == nullptr || READ_SCI11ENDIAN_UINT32(bitmapData + 28) != bitmapHeaderSize) { error("Invalid Text bitmap %04x:%04x", PRINT_REG(bitmap)); } @@ -986,8 +1021,12 @@ CelObjMem::CelObjMem(const reg_t bitmap) { _displace.x = READ_SCI11ENDIAN_UINT16(bitmapData + 4); _displace.y = READ_SCI11ENDIAN_UINT16(bitmapData + 6); _transparentColor = bitmapData[8]; - _scaledWidth = READ_SCI11ENDIAN_UINT16(bitmapData + 36); - _scaledHeight = READ_SCI11ENDIAN_UINT16(bitmapData + 38); + if (bitmapHeaderSize >= 40) { + _scaledWidth = READ_SCI11ENDIAN_UINT16(bitmapData + 36); + _scaledHeight = READ_SCI11ENDIAN_UINT16(bitmapData + 38); + } else { + error("TODO: SCI2 bitmaps not implemented yet!"); + } _hunkPaletteOffset = READ_SCI11ENDIAN_UINT16(bitmapData + 20); _remap = (READ_SCI11ENDIAN_UINT16(bitmapData + 10) & 2) ? true : false; } |