aboutsummaryrefslogtreecommitdiff
path: root/engines/dreamweb/vgafades.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/dreamweb/vgafades.cpp')
-rw-r--r--engines/dreamweb/vgafades.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp
index 79a7cce389..abb1a9b1a6 100644
--- a/engines/dreamweb/vgafades.cpp
+++ b/engines/dreamweb/vgafades.cpp
@@ -56,5 +56,28 @@ void DreamGenContext::paltoendpal() {
memcpy(endPalette(), mainPalette(), 256*3);
}
+void DreamGenContext::fadecalculation() {
+ if (data.byte(kFadecount) == 0) {
+ data.byte(kFadedirection) = 0;
+ return;
+ }
+
+ uint8 *startPal = startPalette();
+ const uint8 *endPal = endPalette();
+ for (size_t i = 0; i < 256 * 3; ++i, ++si, ++di) {
+ uint8 s = startPal[i];
+ uint8 e = endPal[i];
+ if (s == e)
+ continue;
+ else if (s > e)
+ --startPal[i];
+ else {
+ if (data.byte(kFadecount) <= e)
+ ++startPal[i];
+ }
+ }
+ --data.byte(kFadecount);
+}
+
} /*namespace dreamgen */