aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/kyra_v2.cpp31
-rw-r--r--engines/kyra/kyra_v2.h3
-rw-r--r--engines/kyra/saveload_v2.cpp2
-rw-r--r--engines/kyra/timer_v2.cpp2
4 files changed, 31 insertions, 7 deletions
diff --git a/engines/kyra/kyra_v2.cpp b/engines/kyra/kyra_v2.cpp
index 392ffc7406..4d8a3a4e35 100644
--- a/engines/kyra/kyra_v2.cpp
+++ b/engines/kyra/kyra_v2.cpp
@@ -601,7 +601,7 @@ void KyraEngine_v2::update() {
_timer->update();
updateItemAnimations();
updateInvWsa();
- //sub_1574C();
+ fadeMessagePalette();
_screen->updateScreen();
}
@@ -609,7 +609,7 @@ void KyraEngine_v2::updateWithText() {
updateInput();
updateMouse();
- //sub_157C();
+ fadeMessagePalette();
updateSpecialSceneScripts();
_timer->update();
updateItemAnimations();
@@ -1041,7 +1041,7 @@ void KyraEngine_v2::showMessage(const char *string, int16 palIndex) {
_screen->fillRect(0, 190, 319, 199, 0xCF);
if (string) {
- if (palIndex != -1 || _msgUnk1) {
+ if (palIndex != -1 || _fadeMessagePalette) {
palIndex *= 3;
memcpy(_messagePal, _screen->_currentPalette + palIndex, 3);
memmove(_screen->_currentPalette + 765, _screen->_currentPalette + palIndex, 3);
@@ -1054,7 +1054,7 @@ void KyraEngine_v2::showMessage(const char *string, int16 palIndex) {
setTimer1DelaySecs(7);
}
- _msgUnk1 = 0;
+ _fadeMessagePalette = false;
_screen->showMouse();
}
@@ -1086,6 +1086,29 @@ void KyraEngine_v2::updateCommandLineEx(int str1, int str2, int16 palIndex) {
showMessage((char*)_unkBuf500Bytes, palIndex);
}
+void KyraEngine_v2::fadeMessagePalette() {
+ if (!_fadeMessagePalette)
+ return;
+
+ bool updatePalette = false;
+ for (int i = 0; i < 3; ++i) {
+ if (_messagePal[i] >= 4) {
+ _messagePal[i] -= 4;
+ updatePalette = true;
+ } else if (_messagePal[i] != 0) {
+ _messagePal[i] = 0;
+ updatePalette = true;
+ }
+ }
+
+ if (updatePalette) {
+ memcpy(_screen->getPalette(0) + 765, _messagePal, 3);
+ _screen->setScreenPalette(_screen->getPalette(0));
+ } else {
+ _fadeMessagePalette = false;
+ }
+}
+
#pragma mark -
void KyraEngine_v2::loadMouseShapes() {
diff --git a/engines/kyra/kyra_v2.h b/engines/kyra/kyra_v2.h
index 226d0ed330..4befc53f9a 100644
--- a/engines/kyra/kyra_v2.h
+++ b/engines/kyra/kyra_v2.h
@@ -774,7 +774,8 @@ protected:
const char *_shownMessage;
byte _messagePal[3];
- int _msgUnk1;
+ bool _fadeMessagePalette;
+ void fadeMessagePalette();
// chat
int _vocHigh;
diff --git a/engines/kyra/saveload_v2.cpp b/engines/kyra/saveload_v2.cpp
index 69f3183415..4f301fa68b 100644
--- a/engines/kyra/saveload_v2.cpp
+++ b/engines/kyra/saveload_v2.cpp
@@ -317,7 +317,7 @@ void KyraEngine_v2::loadGame(const char *fileName) {
setTimer1DelaySecs(7);
_shownMessage = " ";
- _msgUnk1 = 0;
+ _fadeMessagePalette = false;
if (setFlag1EE)
setGameFlag(0x1EE);
diff --git a/engines/kyra/timer_v2.cpp b/engines/kyra/timer_v2.cpp
index eb30d8feb4..bb0f59978f 100644
--- a/engines/kyra/timer_v2.cpp
+++ b/engines/kyra/timer_v2.cpp
@@ -44,7 +44,7 @@ void KyraEngine_v2::setupTimers() {
void KyraEngine_v2::timerFadeOutMessage(int arg) {
debugC(9, kDebugLevelMain | kDebugLevelTimer, "KyraEngine_v2::timerFadeOutMessage(%d)", arg);
if (_shownMessage)
- _msgUnk1 = 1;
+ _fadeMessagePalette = 1;
}
void KyraEngine_v2::timerCauldronAnimation(int arg) {