From f54f2fa96bfc476a15fcc3ebcd6124bc19164fcd Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Thu, 2 Jun 2022 13:20:36 -0400 Subject: Extract palette data from external file (#249) * WIP * Done * Fix * Fixes * More fixes * Fixes for backgrounds. * Roman's fixes and format. * Update docs and use tinyxml function for validation. * Update docs/zapd_extraction_xml_reference.md Co-authored-by: EllipticEllipsis * move tlut texture data to stack variable Co-authored-by: EllipticEllipsis --- ZAPD/ImageBackend.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ZAPD/ImageBackend.cpp') diff --git a/ZAPD/ImageBackend.cpp b/ZAPD/ImageBackend.cpp index 8accb6b..307945b 100644 --- a/ZAPD/ImageBackend.cpp +++ b/ZAPD/ImageBackend.cpp @@ -398,7 +398,7 @@ void ImageBackend::SetPaletteIndex(size_t index, uint8_t nR, uint8_t nG, uint8_t alphaPalette[index] = nA; } -void ImageBackend::SetPalette(const ImageBackend& pal) +void ImageBackend::SetPalette(const ImageBackend& pal, uint32_t offset) { assert(isColorIndexed); size_t bytePerPixel = pal.GetBytesPerPixel(); @@ -422,7 +422,7 @@ void ImageBackend::SetPalette(const ImageBackend& pal) uint8_t g = pal.pixelMatrix[y][x * bytePerPixel + 1]; uint8_t b = pal.pixelMatrix[y][x * bytePerPixel + 2]; uint8_t a = pal.pixelMatrix[y][x * bytePerPixel + 3]; - SetPaletteIndex(index, r, g, b, a); + SetPaletteIndex(index + offset, r, g, b, a); } } } -- cgit v1.2.3