mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-05 00:36:57 +00:00
Changed Screen::loadPalette to take a reference to a Palette object instead of an array.
svn-id: r41745
This commit is contained in:
parent
d2e5166dae
commit
d7432e18ea
@ -82,7 +82,7 @@ bool Debugger::cmd_loadPalette(int argc, const char **argv) {
|
|||||||
_vm->screen()->loadBitmap(argv[1], 5, 5, 0);
|
_vm->screen()->loadBitmap(argv[1], 5, 5, 0);
|
||||||
palette.copy(_vm->screen()->getCPagePtr(5), 0, 256);
|
palette.copy(_vm->screen()->getCPagePtr(5), 0, 256);
|
||||||
_vm->screen()->copyBlockToPage(5, 0, 0, 320, 200, buffer);
|
_vm->screen()->copyBlockToPage(5, 0, 0, 320, 200, buffer);
|
||||||
} else if (!_vm->screen()->loadPalette(argv[1], palette.getData())) {
|
} else if (!_vm->screen()->loadPalette(argv[1], palette)) {
|
||||||
DebugPrintf("ERROR: Palette '%s' not found!\n", argv[1]);
|
DebugPrintf("ERROR: Palette '%s' not found!\n", argv[1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ void KyraEngine_LoK::startup() {
|
|||||||
loadButtonShapes();
|
loadButtonShapes();
|
||||||
initMainButtonList();
|
initMainButtonList();
|
||||||
loadMainScreen();
|
loadMainScreen();
|
||||||
_screen->loadPalette("PALETTE.COL", _screen->getPalette(0).getData());
|
_screen->loadPalette("PALETTE.COL", _screen->getPalette(0));
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
_animator->initAnimStateList();
|
_animator->initAnimStateList();
|
||||||
|
@ -2785,7 +2785,7 @@ void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, Palette
|
|||||||
uint16 palSize = READ_LE_UINT16(srcData + 8);
|
uint16 palSize = READ_LE_UINT16(srcData + 8);
|
||||||
|
|
||||||
if (pal && palSize)
|
if (pal && palSize)
|
||||||
loadPalette(srcData + 10, pal->getData(), palSize);
|
loadPalette(srcData + 10, *pal, palSize);
|
||||||
|
|
||||||
uint8 *srcPtr = srcData + 10 + palSize;
|
uint8 *srcPtr = srcData + 10 + palSize;
|
||||||
uint8 *dstData = getPagePtr(dstPage);
|
uint8 *dstData = getPagePtr(dstPage);
|
||||||
@ -2819,38 +2819,30 @@ void Screen::loadBitmap(const char *filename, int tempPage, int dstPage, Palette
|
|||||||
delete[] srcData;
|
delete[] srcData;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Screen::loadPalette(const char *filename, uint8 *palData) {
|
bool Screen::loadPalette(const char *filename, Palette &pal) {
|
||||||
uint32 fileSize = 0;
|
Common::SeekableReadStream *stream = _vm->resource()->createReadStream(filename);
|
||||||
uint8 *srcData = _vm->resource()->fileData(filename, &fileSize);
|
|
||||||
if (!srcData)
|
if (!stream)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (palData && fileSize) {
|
debugC(3, kDebugLevelScreen, "Screen::loadPalette('%s', %p)", filename, (const void *)&pal);
|
||||||
loadPalette(srcData, palData, fileSize);
|
|
||||||
}
|
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
|
||||||
delete[] srcData;
|
pal.loadAmigaPalette(*stream, stream->size() / 2);
|
||||||
|
else
|
||||||
|
pal.loadVGAPalette(*stream, stream->size() / 3);
|
||||||
|
|
||||||
|
delete stream;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::loadPalette(const byte *data, uint8 *palData, int bytes) {
|
void Screen::loadPalette(const byte *data, Palette &pal, int bytes) {
|
||||||
if (_vm->gameFlags().platform == Common::kPlatformAmiga) {
|
Common::MemoryReadStream stream(data, bytes, false);
|
||||||
assert(bytes % 2 == 0);
|
|
||||||
assert(bytes / 2 <= 256);
|
if (_vm->gameFlags().platform == Common::kPlatformAmiga)
|
||||||
bytes >>= 1;
|
pal.loadAmigaPalette(stream, stream.size() / 2);
|
||||||
const uint16 *src = (const uint16 *)data;
|
else
|
||||||
for (int i = 0; i < bytes; ++i) {
|
pal.loadVGAPalette(stream, stream.size() / 3);
|
||||||
uint16 col = READ_BE_UINT16(src); ++src;
|
|
||||||
palData[2] = (col & 0xF) << 2; col >>= 4;
|
|
||||||
palData[1] = (col & 0xF) << 2; col >>= 4;
|
|
||||||
palData[0] = (col & 0xF) << 2; col >>= 4;
|
|
||||||
palData += 3;
|
|
||||||
}
|
|
||||||
} else if (_use16ColorMode) {
|
|
||||||
for (int i = 0; i < bytes; ++i)
|
|
||||||
palData[i] = ((data[i] & 0xF) << 4) | (data[i] & 0xF0);
|
|
||||||
} else {
|
|
||||||
memcpy(palData, data, bytes);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dirty rect handling
|
// dirty rect handling
|
||||||
|
@ -286,8 +286,8 @@ public:
|
|||||||
// misc
|
// misc
|
||||||
void loadBitmap(const char *filename, int tempPage, int dstPage, Palette *pal, bool skip=false);
|
void loadBitmap(const char *filename, int tempPage, int dstPage, Palette *pal, bool skip=false);
|
||||||
|
|
||||||
bool loadPalette(const char *filename, uint8 *palData);
|
bool loadPalette(const char *filename, Palette &pal);
|
||||||
void loadPalette(const byte *data, uint8 *palData, int bytes);
|
void loadPalette(const byte *data, Palette &pal, int bytes);
|
||||||
|
|
||||||
void setAnimBlockPtr(int size);
|
void setAnimBlockPtr(int size);
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ int KyraEngine_HoF::o2_meanWhileScene(EMCState *script) {
|
|||||||
|
|
||||||
_screen->loadBitmap(cpsfile, 3, 3, 0);
|
_screen->loadBitmap(cpsfile, 3, 3, 0);
|
||||||
_screen->copyPalette(2, 0);
|
_screen->copyPalette(2, 0);
|
||||||
_screen->loadPalette(palfile, _screen->getPalette(2).getData());
|
_screen->loadPalette(palfile, _screen->getPalette(2));
|
||||||
_screen->fillRect(0, 0, 319, 199, 207);
|
_screen->fillRect(0, 0, 319, 199, 207);
|
||||||
_screen->setScreenPalette(_screen->getPalette(2));
|
_screen->setScreenPalette(_screen->getPalette(2));
|
||||||
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
|
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
|
||||||
@ -1400,7 +1400,7 @@ int KyraEngine_HoF::o2_demoFinale(EMCState *script) {
|
|||||||
assert(strings);
|
assert(strings);
|
||||||
|
|
||||||
_screen->clearPage(0);
|
_screen->clearPage(0);
|
||||||
_screen->loadPalette("THANKS.COL", _screen->getPalette(0).getData());
|
_screen->loadPalette("THANKS.COL", _screen->getPalette(0));
|
||||||
_screen->loadBitmap("THANKS.CPS", 3, 3, 0);
|
_screen->loadBitmap("THANKS.CPS", 3, 3, 0);
|
||||||
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
|
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
|
||||||
|
|
||||||
|
@ -2148,12 +2148,12 @@ int LoLEngine::olol_restoreMagicShroud(EMCState *script) {
|
|||||||
uint8 *tpal2 = tpal1 + 768;
|
uint8 *tpal2 = tpal1 + 768;
|
||||||
uint8 *tpal3 = tpal2 + 768;
|
uint8 *tpal3 = tpal2 + 768;
|
||||||
uint8 *tpal4 = 0;
|
uint8 *tpal4 = 0;
|
||||||
_screen->loadPalette("LITEPAL1.COL", tpal1);
|
_res->loadFileToBuf("LITEPAL1.COL", tpal1, 768);
|
||||||
tpal2 = _screen->generateFadeTable(tpal3, 0, tpal1, 21);
|
tpal2 = _screen->generateFadeTable(tpal3, 0, tpal1, 21);
|
||||||
_screen->loadPalette("LITEPAL2.COL", tpal2);
|
_res->loadFileToBuf("LITEPAL2.COL", tpal2, 768);
|
||||||
tpal4 = tpal2;
|
tpal4 = tpal2;
|
||||||
tpal2 += 768;
|
tpal2 += 768;
|
||||||
_screen->loadPalette("LITEPAL3.COL", tpal1);
|
_res->loadFileToBuf("LITEPAL3.COL", tpal1, 768);
|
||||||
_screen->generateFadeTable(tpal2, tpal4, tpal1, 4);
|
_screen->generateFadeTable(tpal2, tpal4, tpal1, 4);
|
||||||
|
|
||||||
Palette pal(768);
|
Palette pal(768);
|
||||||
@ -2309,7 +2309,7 @@ int LoLEngine::tlol_setupPaletteFade(const TIM *tim, const uint16 *param) {
|
|||||||
int LoLEngine::tlol_loadPalette(const TIM *tim, const uint16 *param) {
|
int LoLEngine::tlol_loadPalette(const TIM *tim, const uint16 *param) {
|
||||||
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_loadPalette(%p, %p) (%d)", (const void *)tim, (const void *)param, param[0]);
|
debugC(3, kDebugLevelScriptFuncs, "LoLEngine::tlol_loadPalette(%p, %p) (%d)", (const void *)tim, (const void *)param, param[0]);
|
||||||
const char *palFile = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0]<<1)));
|
const char *palFile = (const char *)(tim->text + READ_LE_UINT16(tim->text + (param[0]<<1)));
|
||||||
_screen->loadPalette(palFile, _screen->getPalette(0).getData());
|
_screen->loadPalette(palFile, _screen->getPalette(0));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ void KyraEngine_HoF::seq_playSequences(int startSeq, int endSeq) {
|
|||||||
} else {
|
} else {
|
||||||
_screen->setCurPage(2);
|
_screen->setCurPage(2);
|
||||||
_screen->clearPage(2);
|
_screen->clearPage(2);
|
||||||
_screen->loadPalette("goldfont.col", _screen->getPalette(0).getData());
|
_screen->loadPalette("goldfont.col", _screen->getPalette(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cb && !(_flags.isDemo && !_flags.isTalkie))
|
if (cb && !(_flags.isDemo && !_flags.isTalkie))
|
||||||
|
@ -141,7 +141,7 @@ void KyraEngine_LoK::seq_introLogos() {
|
|||||||
_screen->clearPage(0);
|
_screen->clearPage(0);
|
||||||
|
|
||||||
if (_flags.platform == Common::kPlatformAmiga) {
|
if (_flags.platform == Common::kPlatformAmiga) {
|
||||||
_screen->loadPalette("INTRO.PAL", _screen->getPalette(0).getData());
|
_screen->loadPalette("INTRO.PAL", _screen->getPalette(0));
|
||||||
_screen->loadBitmap("BOTTOM.CPS", 3, 5, 0);
|
_screen->loadBitmap("BOTTOM.CPS", 3, 5, 0);
|
||||||
_screen->loadBitmap("TOP.CPS", 3, 3, 0);
|
_screen->loadBitmap("TOP.CPS", 3, 3, 0);
|
||||||
_screen->copyRegion(0, 0, 0, 111, 320, 64, 2, 0);
|
_screen->copyRegion(0, 0, 0, 111, 320, 64, 2, 0);
|
||||||
|
@ -304,7 +304,7 @@ int LoLEngine::chooseCharacter() {
|
|||||||
_screen->_curPage = 0;
|
_screen->_curPage = 0;
|
||||||
|
|
||||||
if (_flags.use16ColorMode)
|
if (_flags.use16ColorMode)
|
||||||
_screen->loadPalette("LOL.NOL", _screen->getPalette(0).getData());
|
_screen->loadPalette("LOL.NOL", _screen->getPalette(0));
|
||||||
|
|
||||||
_screen->fadePalette(_screen->getPalette(0), 30, 0);
|
_screen->fadePalette(_screen->getPalette(0), 30, 0);
|
||||||
|
|
||||||
@ -820,8 +820,7 @@ void LoLEngine::showOutro(int character, bool maxDifficulty) {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
_screen->clearPage(3);
|
_screen->clearPage(3);
|
||||||
memset(_screen->getPalette(0).getData(), 0, 768);
|
_screen->getPalette(0).clear();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
|
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0, Screen::CR_NO_P_CHECK);
|
||||||
|
@ -429,7 +429,7 @@ void Sprites::loadDat(const char *filename, SceneExits &exits) {
|
|||||||
else
|
else
|
||||||
_screen->copyPalette(1, 0);
|
_screen->copyPalette(1, 0);
|
||||||
|
|
||||||
_screen->loadPalette(_dat + 0x17, _screen->getPalette(1).getData() + 684, 60);
|
_screen->getPalette(1).copy(_dat + 0x17, 0, 20, 228);
|
||||||
}
|
}
|
||||||
uint8 *data = _dat + 0x6B;
|
uint8 *data = _dat + 0x6B;
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ int WSAMovie_v2::open(const char *filename, int unk1, Palette *palBuf) {
|
|||||||
offsPal = 0x300;
|
offsPal = 0x300;
|
||||||
_flags |= WF_HAS_PALETTE;
|
_flags |= WF_HAS_PALETTE;
|
||||||
if (palBuf)
|
if (palBuf)
|
||||||
_screen->loadPalette(wsaData + 8 + ((_numFrames << 2) & 0xFFFF), palBuf->getData(), 0x300);
|
_screen->loadPalette(wsaData + 8 + ((_numFrames << 2) & 0xFFFF), *palBuf, 0x300);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & 2) {
|
if (flags & 2) {
|
||||||
@ -400,7 +400,7 @@ int WSAMovie_v2::open(const char *filename, int unk1, Palette *palBuf) {
|
|||||||
offsPal = 0x30;
|
offsPal = 0x30;
|
||||||
_flags |= WF_HAS_PALETTE;
|
_flags |= WF_HAS_PALETTE;
|
||||||
if (palBuf)
|
if (palBuf)
|
||||||
_screen->loadPalette(wsaData + 8 + ((_numFrames << 2) & 0xFFFF), palBuf->getData(), 0x30);
|
_screen->loadPalette(wsaData + 8 + ((_numFrames << 2) & 0xFFFF), *palBuf, 0x30);
|
||||||
}
|
}
|
||||||
|
|
||||||
_flags |= WF_XOR;
|
_flags |= WF_XOR;
|
||||||
|
Loading…
Reference in New Issue
Block a user