[Scummvm-cvs-logs] SF.net SVN: scummvm:[43192] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Mon Aug 10 03:32:40 CEST 2009
Revision: 43192
http://scummvm.svn.sourceforge.net/scummvm/?rev=43192&view=rev
Author: lordhoto
Date: 2009-08-10 01:32:39 +0000 (Mon, 10 Aug 2009)
Log Message:
-----------
Initial support for correct colors in the interface of Kyra1 AMIGA.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/screen.cpp
scummvm/trunk/engines/kyra/screen.h
scummvm/trunk/engines/kyra/staticres.cpp
Modified: scummvm/trunk/engines/kyra/screen.cpp
===================================================================
--- scummvm/trunk/engines/kyra/screen.cpp 2009-08-10 01:32:22 UTC (rev 43191)
+++ scummvm/trunk/engines/kyra/screen.cpp 2009-08-10 01:32:39 UTC (rev 43192)
@@ -113,6 +113,8 @@
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::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 @@
_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;
Modified: scummvm/trunk/engines/kyra/screen.h
===================================================================
--- scummvm/trunk/engines/kyra/screen.h 2009-08-10 01:32:22 UTC (rev 43191)
+++ scummvm/trunk/engines/kyra/screen.h 2009-08-10 01:32:39 UTC (rev 43192)
@@ -355,6 +355,10 @@
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 @@
int _drawShapeVar4;
int _drawShapeVar5;
+ // AMIGA version
+ bool _interfacePaletteEnabled;
+
// debug
bool _debugEnabled;
};
Modified: scummvm/trunk/engines/kyra/staticres.cpp
===================================================================
--- scummvm/trunk/engines/kyra/staticres.cpp 2009-08-10 01:32:22 UTC (rev 43191)
+++ scummvm/trunk/engines/kyra/staticres.cpp 2009-08-10 01:32:39 UTC (rev 43192)
@@ -1598,10 +1598,15 @@
else
warning("no main graphics file found");
- if (_flags.platform == Common::kPlatformAmiga)
+ _screen->copyRegion(0, 0, 0, 0, 320, 200, page, 0, Screen::CR_NO_P_CHECK);
+
+ if (_flags.platform == Common::kPlatformAmiga) {
_screen->copyPalette(1, 0);
+ _screen->setInterfacePalette(_screen->getPalette(1));
- _screen->copyRegion(0, 0, 0, 0, 320, 200, page, 0);
+ // TODO: Move this to a better place
+ _screen->enableInterfacePalette(true);
+ }
}
void KyraEngine_HoF::initStaticResource() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list