aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/screen_v2.cpp
diff options
context:
space:
mode:
authorathrxx2012-08-09 18:13:15 +0200
committerathrxx2012-11-11 19:14:29 +0100
commit9840744acc6e43135ef5e28d041b1d55dd86804b (patch)
tree68cc574de7393fd8451f64db2e730ad5f4a5dcc4 /engines/kyra/screen_v2.cpp
parente016e7dfc2b1e3cdb39c01d81c5a34eee66a277b (diff)
downloadscummvm-rg350-9840744acc6e43135ef5e28d041b1d55dd86804b.tar.gz
scummvm-rg350-9840744acc6e43135ef5e28d041b1d55dd86804b.tar.bz2
scummvm-rg350-9840744acc6e43135ef5e28d041b1d55dd86804b.zip
KYRA: move HOF sequence player into its own class
(also cleaning up and fixing things while doing that)
Diffstat (limited to 'engines/kyra/screen_v2.cpp')
-rw-r--r--engines/kyra/screen_v2.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp
index 7d4b064e2a..11314604e7 100644
--- a/engines/kyra/screen_v2.cpp
+++ b/engines/kyra/screen_v2.cpp
@@ -162,6 +162,34 @@ void Screen_v2::getFadeParams(const Palette &pal, int delay, int &delayInc, int
}
}
+bool Screen_v2::timedPaletteFadeStep(uint8 *pal1, uint8 *pal2, uint32 elapsedTime, uint32 totalTime) {
+ Palette &p1 = getPalette(1);
+
+ bool res = false;
+ for (int i = 0; i < p1.getNumColors() * 3; i++) {
+ uint8 out = 0;
+
+ if (elapsedTime < totalTime) {
+ int32 d = ((pal2[i] & 0x3f) - (pal1[i] & 0x3f));
+ if (d)
+ res = true;
+
+ int32 val = ((((d << 8) / (int32)totalTime) * (int32)elapsedTime) >> 8);
+ out = ((pal1[i] & 0x3f) + (int8)val);
+ } else {
+ out = p1[i] = (pal2[i] & 0x3f);
+ res = false;
+ }
+
+ (*_internFadePalette)[i] = out;
+ }
+
+ setScreenPalette(*_internFadePalette);
+ updateScreen();
+
+ return res;
+}
+
const uint8 *Screen_v2::getPtrToShape(const uint8 *shpFile, int shape) {
uint16 shapes = READ_LE_UINT16(shpFile);
@@ -322,6 +350,12 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2,
addDirtyRect(x2, y2, w2, h2);
}
+void Screen_v2::copyPageMemory(int srcPage, int srcPos, int dstPage, int dstPos, int numBytes) {
+ const uint8 *src = getPagePtr(srcPage) + srcPos;
+ uint8 *dst = getPagePtr(dstPage) + dstPos;
+ memcpy(dst, src, numBytes);
+}
+
bool Screen_v2::calcBounds(int w0, int h0, int &x1, int &y1, int &w1, int &h1, int &x2, int &y2, int &w2) {
x2 = 0;
y2 = 0;