aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/kyra.h7
-rw-r--r--engines/kyra/scene.cpp18
-rw-r--r--engines/kyra/screen.cpp5
-rw-r--r--engines/kyra/script_v1.cpp7
-rw-r--r--engines/kyra/sprites.cpp9
5 files changed, 31 insertions, 15 deletions
diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h
index 6c287a2e04..905b6fc212 100644
--- a/engines/kyra/kyra.h
+++ b/engines/kyra/kyra.h
@@ -317,6 +317,10 @@ public:
int mouseX() { return _mouseX; }
int mouseY() { return _mouseY; }
+ int setGameFlag(int flag);
+ int queryGameFlag(int flag);
+ int resetGameFlag(int flag);
+
virtual int runOpcode(ScriptState *script, uint8 opcode);
protected:
int o1_magicInMouseItem(ScriptState *script);
@@ -493,9 +497,6 @@ protected:
void characterSays(int vocFile, const char *chatStr, int8 charNum, int8 chatDuration);
void setCharactersPositions(int character);
- int setGameFlag(int flag);
- int queryGameFlag(int flag);
- int resetGameFlag(int flag);
void setupSceneResource(int sceneId);
diff --git a/engines/kyra/scene.cpp b/engines/kyra/scene.cpp
index e879e98186..3ab9b6b09b 100644
--- a/engines/kyra/scene.cpp
+++ b/engines/kyra/scene.cpp
@@ -822,18 +822,28 @@ void KyraEngine::initSceneObjectList(int brandonAlive) {
}
void KyraEngine::initSceneScreen(int brandonAlive) {
- // XXX Palette stuff
+ if (_unkScreenVar1 && !queryGameFlag(0xA0)) {
+ for (int i = 0; i < 60; ++i) {
+ uint16 col = _screen->getPalette(0)[684+i];
+ col += _screen->getPalette(1)[684+i] << 1;
+ col >>= 2;
+ _screen->getPalette(0)[684+i] = col;
+ }
+ _screen->setScreenPalette(_screen->getPalette(0));
+ }
+
if (_unkScreenVar2 == 1) {
_screen->shuffleScreen(8, 8, 304, 128, 2, 0, _unkScreenVar3, false);
} else {
_screen->copyRegion(8, 8, 8, 8, 304, 128, 2, 0);
}
+
if (_unkScreenVar1 && _paletteChanged) {
if (!queryGameFlag(0xA0)) {
- // XXX Palette stuff
- _screen->setScreenPalette(_screen->_currentPalette);
+ memcpy(_screen->getPalette(0) + 684, _screen->getPalette(1) + 684, 60);
+ _screen->setScreenPalette(_screen->getPalette(0));
} else {
- // XXX Palette stuff
+ memset(_screen->getPalette(0), 0, 768);
}
}
// really call this here?
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp
index a8bc689a05..759249dfb8 100644
--- a/engines/kyra/screen.cpp
+++ b/engines/kyra/screen.cpp
@@ -307,7 +307,8 @@ void Screen::setPaletteIndex(uint8 index, uint8 red, uint8 green, uint8 blue) {
void Screen::setScreenPalette(const uint8 *palData) {
debugC(9, kDebugLevelScreen, "Screen::setScreenPalette(%p)", (const void *)palData);
- memcpy(_screenPalette, palData, 768);
+ if (palData != _screenPalette)
+ memcpy(_screenPalette, palData, 768);
uint8 screenPal[256 * 4];
for (int i = 0; i < 256; ++i) {
screenPal[4 * i + 0] = (palData[0] << 2) | (palData[0] & 3);
@@ -2023,7 +2024,7 @@ uint8 *Screen::getPalette(int num) {
debugC(9, kDebugLevelScreen, "Screen::getPalette(%d)", num);
assert(num >= 0 && num < ARRAYSIZE(_palettes)+1);
if (num == 0) {
- return _screenPalette;
+ return _currentPalette;
}
return _palettes[num-1];
diff --git a/engines/kyra/script_v1.cpp b/engines/kyra/script_v1.cpp
index e08eb5b439..246119f539 100644
--- a/engines/kyra/script_v1.cpp
+++ b/engines/kyra/script_v1.cpp
@@ -1547,10 +1547,9 @@ int KyraEngine::o1_fadeEntirePalette(ScriptState *script) {
warning("unimplemented o1_fadeEntirePalette function");
return 0;
} else if (cmd == 2) {
- // HACK
- uint8 *clearPal = _screen->getPalette(0);
- fadePal = _screen->getPalette(1);
- memset(clearPal, 0, sizeof(uint8)*768);
+ memset(_screen->getPalette(2), 0, 768);
+ memcpy(_screen->getPalette(0), _screen->getPalette(1), 768);
+ fadePal = _screen->getPalette(0);
}
_screen->fadePalette(fadePal, stackPos(1));
diff --git a/engines/kyra/sprites.cpp b/engines/kyra/sprites.cpp
index da2f99df8a..85cb1ea372 100644
--- a/engines/kyra/sprites.cpp
+++ b/engines/kyra/sprites.cpp
@@ -415,10 +415,15 @@ void Sprites::loadDAT(const char *filename, SceneExits &exits) {
_engine->_northExitHeight = READ_LE_UINT16(_dat + 0x15);
if (_engine->_northExitHeight & 1)
_engine->_northExitHeight += 1;
+
+ if (_engine->queryGameFlag(0xA0)) {
+ memcpy(_screen->getPalette(1), _screen->getPalette(3), 768);
+ } else {
+ memcpy(_screen->getPalette(1), _screen->getPalette(0), 768);
+ }
// XXX
- memcpy(_screen->_currentPalette + 744 - 60, _dat + 0x17, 60);
_engine->_paletteChanged = 1;
- memcpy(_screen->getPalette(1), _screen->_currentPalette, sizeof(uint8)*768);
+ memcpy(_screen->getPalette(1) + 684, _dat + 0x17, 60);
uint8 *data = _dat + 0x6B;
uint16 length = READ_LE_UINT16(data);