diff options
Diffstat (limited to 'engines/kyra/screen.cpp')
-rw-r--r-- | engines/kyra/screen.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 617e52b88e..6ef9ee9c21 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -2450,7 +2450,7 @@ void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 * if (palData && palSize) { debugC(9, kDebugLevelMain,"Loading a palette of size %i from %s", palSize, filename); - memcpy(palData, srcData + 10, palSize); + loadPalette(srcData + 10, palData, palSize); } uint8 *srcPtr = srcData + 10 + palSize; @@ -2476,6 +2476,23 @@ void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 * delete [] srcData; } +void Screen::loadPalette(const char *filename, uint8 *palData) { + debugC(9, kDebugLevelScreen, "Screen::loadPalette('%s' %p)", filename, (void *)palData); + uint32 fileSize = 0; + uint8 *srcData = _vm->resource()->fileData(filename, &fileSize); + + if (palData && fileSize) { + debugC(9, kDebugLevelScreen,"Loading a palette of size %i from '%s'", fileSize, filename); + memcpy(palData, srcData, fileSize); + } + delete [] srcData; +} + +void Screen::loadPalette(const byte *data, uint8 *palData, int bytes) { + debugC(9, kDebugLevelScreen, "Screen::loadPalette(%p, %p %d)", (void *)data, (void *)palData, bytes); + memcpy(palData, data, bytes); +} + // kyra3 specific const uint8 *Screen::getPtrToShape(const uint8 *shpFile, int shape) { |