aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sherlock/graphics.cpp')
-rw-r--r--engines/sherlock/graphics.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/engines/sherlock/graphics.cpp b/engines/sherlock/graphics.cpp
index 5c6c94606e..583389e060 100644
--- a/engines/sherlock/graphics.cpp
+++ b/engines/sherlock/graphics.cpp
@@ -23,6 +23,7 @@
#include "sherlock/graphics.h"
#include "sherlock/sherlock.h"
#include "common/system.h"
+#include "graphics/palette.h"
namespace Sherlock {
@@ -65,4 +66,35 @@ void Screen::update() {
g_system->updateScreen();
}
+void Screen::getPalette(byte palette[PALETTE_SIZE]) {
+ g_system->getPaletteManager()->grabPalette(palette, 0, PALETTE_COUNT);
+}
+
+void Screen::setPalette(const byte palette[PALETTE_SIZE]) {
+ g_system->getPaletteManager()->setPalette(palette, 0, PALETTE_COUNT);
+}
+
+void Screen::fadeToBlack() {
+ const int FADE_AMOUNT = 2;
+ bool repeatFlag;
+ byte *srcP;
+ int count;
+ byte tempPalette[PALETTE_SIZE];
+
+ getPalette(tempPalette);
+ do {
+ repeatFlag = false;
+ for (srcP = &tempPalette[0], count = 0; count < PALETTE_SIZE; ++count, ++srcP) {
+ int v = *srcP;
+ if (v) {
+ repeatFlag = true;
+ *srcP = MAX(*srcP - FADE_AMOUNT, 0);
+ }
+ }
+
+ setPalette(tempPalette);
+ _vm->_events->pollEventsAndWait();
+ } while (repeatFlag && !_vm->shouldQuit());
+}
+
} // End of namespace Sherlock