aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kyra/gui.cpp37
-rw-r--r--kyra/kyra.cpp2
-rw-r--r--kyra/kyra.h2
-rw-r--r--kyra/sprites.cpp10
4 files changed, 42 insertions, 9 deletions
diff --git a/kyra/gui.cpp b/kyra/gui.cpp
index 10d66a42f2..668e33459d 100644
--- a/kyra/gui.cpp
+++ b/kyra/gui.cpp
@@ -403,6 +403,7 @@ int KyraEngine::buttonMenuCallback(Button *caller) {
}
_screen->savePageToDisk("SEENPAGE.TMP", 0);
+ gui_fadePalette();
calcCoords(_menu[0]);
calcCoords(_menu[1]);
@@ -425,6 +426,7 @@ int KyraEngine::buttonMenuCallback(Button *caller) {
}
if (_menuRestoreScreen) {
+ gui_restorePalette();
_screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_animator->_updateScreen = true;
}
@@ -715,6 +717,7 @@ int KyraEngine::gui_loadGameMenu(Button *button) {
initMenu(_menu[0]);
processAllMenuButtons();
} else {
+ gui_restorePalette();
loadGame(getSavegameFilename(_gameToLoad));
_displayMenu = false;
_menuRestoreScreen = false;
@@ -724,7 +727,13 @@ int KyraEngine::gui_loadGameMenu(Button *button) {
void KyraEngine::gui_redrawTextfield() {
_screen->fillRect(38, 91, 287, 102, 250);
- _text->printText(_savegameName, 38, 91, 30, 0, 0);
+ _text->printText(_savegameName, 38, 92, 253, 0, 0);
+
+ _screen->_charWidth = -2;
+ int width = _screen->getTextWidth(_savegameName);
+ _screen->fillRect(39 + width, 93, 45 + width, 100, 254);
+ _screen->_charWidth = 0;
+
_screen->updateScreen();
}
@@ -830,8 +839,8 @@ int KyraEngine::gui_cancelSubMenu(Button *button) {
int KyraEngine::gui_quitPlaying(Button *button) {
debug(9, "KyraEngine::gui_quitPlaying()");
-
processMenuButton(button);
+
if (gui_quitConfirm("Are you sure you want to quit playing?"))
quitGame();
else {
@@ -973,5 +982,29 @@ void KyraEngine::gui_redrawHighlight(Menu menu) {
_text->printText(menu.item[i].itemString, textX, textY, menu.item[i].highlightColor, 0, 0);
}
+void KyraEngine::gui_fadePalette() {
+ static int16 menuPalIndexes[] = {248, 249, 250, 251, 252, 253, 254, -1};
+ int index = 0;
+
+ memcpy(_screen->getPalette(2), _screen->_currentPalette, 768);
+
+ for (int i = 0; i < 768; i++) {
+ _screen->_currentPalette[i] /= 2;
+ }
+
+ while( menuPalIndexes[index] != -1) {
+ memcpy(&_screen->_currentPalette[menuPalIndexes[index]*3], &_screen->getPalette(2)[menuPalIndexes[index]*3], 3);
+ index++;
+ }
+
+ _screen->fadePalette(_screen->_currentPalette, 2);
+}
+
+void KyraEngine::gui_restorePalette() {
+ memcpy(_screen->_currentPalette, _screen->getPalette(2), 768);
+ _screen->fadePalette(_screen->_currentPalette, 2);
+}
+
+
} // end of namespace Kyra
diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp
index 2ed9509d69..6133e52a22 100644
--- a/kyra/kyra.cpp
+++ b/kyra/kyra.cpp
@@ -730,8 +730,6 @@ void KyraEngine::mainLoop() {
processButtonList(_buttonList);
updateMousePointer();
updateGameTimers();
- _sprites->updateSceneAnims();
- _animator->updateAllObjectShapes();
updateTextFade();
_handleInput = true;
diff --git a/kyra/kyra.h b/kyra/kyra.h
index cd1867351a..f981ae8c75 100644
--- a/kyra/kyra.h
+++ b/kyra/kyra.h
@@ -687,6 +687,8 @@ protected:
void gui_processHighlights(Menu &menu);
void gui_updateSavegameString();
void gui_redrawTextfield();
+ void gui_fadePalette();
+ void gui_restorePalette();
uint8 _game;
bool _fastMode;
diff --git a/kyra/sprites.cpp b/kyra/sprites.cpp
index 63143404f6..9d91bb59e8 100644
--- a/kyra/sprites.cpp
+++ b/kyra/sprites.cpp
@@ -129,6 +129,9 @@ void Sprites::updateSceneAnims() {
uint32 currTime = _system->getMillis();
uint8 *data;
bool endLoop;
+ uint16 rndNr;
+ uint16 anim;
+ uint16 sound;
for (int i = 0; i < MAX_NUM_ANIMS; i++) {
if (_anims[i].script == 0 || !_anims[i].play || _anims[i].nextRun != 0 && _anims[i].nextRun > currTime)
@@ -145,9 +148,6 @@ void Sprites::updateSceneAnims() {
endLoop = false;
while (READ_LE_UINT16(data) != 0xFF87 && !endLoop) {
- uint16 rndNr;
- uint16 anim;
- uint16 sound;
assert((data - _anims[i].script) < _anims[i].length);
switch (READ_LE_UINT16(data)) {
case 0xFF88:
@@ -408,8 +408,8 @@ void Sprites::loadDAT(const char *filename, SceneExits &exits) {
_engine->_northExitHeight = READ_LE_UINT16(_dat + 0x15);
if (_engine->_northExitHeight & 1)
_engine->_northExitHeight += 1;
- // XXX
- memcpy(_screen->_currentPalette + 745 - 0x3D, _dat + 0x17, 0x3D);
+ // XXX
+ memcpy(_screen->_currentPalette + 744 - 60, _dat + 0x17, 60);
uint8 *data = _dat + 0x6B;
uint16 length = READ_LE_UINT16(data);