mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 17:33:05 +00:00
Initial support for correct colors in the interface of Kyra1 AMIGA.
svn-id: r43192
This commit is contained in:
parent
f16ca2ee19
commit
48e86a9e22
@ -113,6 +113,8 @@ bool Screen::init() {
|
||||
const int paletteCount = (_vm->gameFlags().platform == Common::kPlatformAmiga) ? 12 : 4;
|
||||
const int numColors = _use16ColorMode ? 16 : ((_vm->gameFlags().platform == Common::kPlatformAmiga) ? 32 : 256);
|
||||
|
||||
_interfacePaletteEnabled = false;
|
||||
|
||||
_screenPalette = new Palette(numColors);
|
||||
assert(_screenPalette);
|
||||
|
||||
@ -217,8 +219,23 @@ void Screen::updateScreen() {
|
||||
}
|
||||
|
||||
void Screen::updateDirtyRects() {
|
||||
if (_forceFullUpdate) {
|
||||
_system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
|
||||
// TODO: Enable dirty rect handling for the AMIGA version
|
||||
if (_forceFullUpdate || _vm->gameFlags().platform == Common::kPlatformAmiga) {
|
||||
if (_interfacePaletteEnabled) {
|
||||
_system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, 136);
|
||||
|
||||
// Page 8 is not used by Kyra 1 AMIGA, thus we can use it to adjust the colors
|
||||
copyRegion(0, 136, 0, 0, 320, 64, 0, 8, CR_NO_P_CHECK);
|
||||
|
||||
uint8 *dst = getPagePtr(8);
|
||||
for (int y = 0; y < 64; ++y)
|
||||
for (int x = 0; x < 320; ++x)
|
||||
*dst++ += 32;
|
||||
|
||||
_system->copyRectToScreen(getCPagePtr(8), SCREEN_W, 0, 136, SCREEN_W, 64);
|
||||
} else {
|
||||
_system->copyRectToScreen(getCPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
|
||||
}
|
||||
} else {
|
||||
const byte *page0 = getCPagePtr(0);
|
||||
Common::List<Common::Rect>::iterator it;
|
||||
@ -620,6 +637,31 @@ void Screen::setScreenPalette(const Palette &pal) {
|
||||
_system->setPalette(screenPal, 0, pal.getNumColors());
|
||||
}
|
||||
|
||||
void Screen::enableInterfacePalette(bool e) {
|
||||
_interfacePaletteEnabled = e;
|
||||
|
||||
_forceFullUpdate = true;
|
||||
_dirtyRects.clear();
|
||||
|
||||
updateScreen();
|
||||
}
|
||||
|
||||
void Screen::setInterfacePalette(const Palette &pal) {
|
||||
if (_vm->gameFlags().platform != Common::kPlatformAmiga)
|
||||
return;
|
||||
|
||||
uint8 screenPal[256 * 4];
|
||||
|
||||
for (int i = 0; i < pal.getNumColors(); ++i) {
|
||||
screenPal[4 * i + 0] = (pal[i * 3 + 0] * 0xFF) / 0x3F;
|
||||
screenPal[4 * i + 1] = (pal[i * 3 + 1] * 0xFF) / 0x3F;
|
||||
screenPal[4 * i + 2] = (pal[i * 3 + 2] * 0xFF) / 0x3F;
|
||||
screenPal[4 * i + 3] = 0;
|
||||
}
|
||||
|
||||
_system->setPalette(screenPal, 32, pal.getNumColors());
|
||||
}
|
||||
|
||||
void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
|
||||
assert(y + h <= SCREEN_H);
|
||||
const uint8 *src = getPagePtr(page) + y * SCREEN_W;
|
||||
|
@ -355,6 +355,10 @@ public:
|
||||
void setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue);
|
||||
virtual void setScreenPalette(const Palette &pal);
|
||||
|
||||
// AMIGA version only
|
||||
void enableInterfacePalette(bool e);
|
||||
void setInterfacePalette(const Palette &pal);
|
||||
|
||||
void getRealPalette(int num, uint8 *dst);
|
||||
Palette &getPalette(int num);
|
||||
void copyPalette(const int dst, const int src);
|
||||
@ -568,6 +572,9 @@ protected:
|
||||
int _drawShapeVar4;
|
||||
int _drawShapeVar5;
|
||||
|
||||
// AMIGA version
|
||||
bool _interfacePaletteEnabled;
|
||||
|
||||
// debug
|
||||
bool _debugEnabled;
|
||||
};
|
||||
|
@ -1598,10 +1598,15 @@ void KyraEngine_LoK::loadMainScreen(int page) {
|
||||
else
|
||||
warning("no main graphics file found");
|
||||
|
||||
if (_flags.platform == Common::kPlatformAmiga)
|
||||
_screen->copyPalette(1, 0);
|
||||
_screen->copyRegion(0, 0, 0, 0, 320, 200, page, 0, Screen::CR_NO_P_CHECK);
|
||||
|
||||
_screen->copyRegion(0, 0, 0, 0, 320, 200, page, 0);
|
||||
if (_flags.platform == Common::kPlatformAmiga) {
|
||||
_screen->copyPalette(1, 0);
|
||||
_screen->setInterfacePalette(_screen->getPalette(1));
|
||||
|
||||
// TODO: Move this to a better place
|
||||
_screen->enableInterfacePalette(true);
|
||||
}
|
||||
}
|
||||
|
||||
void KyraEngine_HoF::initStaticResource() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user