From b407420ebb4249a1cc0fc40f10f90c0bd1fd0b9b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 10 Feb 2008 18:34:48 +0000 Subject: Committed patch #1885629 "KYRA: HoF missing talkie credits and demo support". svn-id: r30845 --- engines/kyra/screen_v2.cpp | 61 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 9 deletions(-) (limited to 'engines/kyra/screen_v2.cpp') diff --git a/engines/kyra/screen_v2.cpp b/engines/kyra/screen_v2.cpp index a3a415c1d7..cb3967b73a 100644 --- a/engines/kyra/screen_v2.cpp +++ b/engines/kyra/screen_v2.cpp @@ -129,8 +129,8 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2, if (!calcBounds(cdm.w, cdm.h, x2, y2, w2, h2, na, nb, nc)) return; - uint8 * src = getPagePtr(srcPage) + y1 * 320; - uint8 * dst = getPagePtr(dstPage) + (y2 + cdm.sy) * 320; + const uint8 *src = getPagePtr(srcPage) + y1 * 320; + uint8 *dst = getPagePtr(dstPage) + (y2 + cdm.sy) * 320; int u = -1; @@ -138,8 +138,8 @@ void Screen_v2::wsaFrameAnimationStep(int x1, int y1, int x2, int y2, int t = (nb * h1) / h2; if (t != u) { u = t; - uint8 * s = src + (x1 + t) * 320; - uint8 * dt = (uint8*) _wsaFrameAnimBuffer; + const uint8 *s = src + (x1 + t) * 320; + uint8 *dt = (uint8*) _wsaFrameAnimBuffer; t = w2 - w1; if (!t) { @@ -208,13 +208,13 @@ void Screen_v2::cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int if (!calcBounds(dstW, dstH, X2, Y2, W2, H2, r4, r5, r6)) return; - uint8 * src = getPagePtr(srcPage) + srcW * (Y1 + r5); - uint8 * dst = getPagePtr(dstPage) + dstW * (Y2 + r2); - uint8 * cmp = getPagePtr(cmpPage); + const uint8 *src = getPagePtr(srcPage) + srcW * (Y1 + r5); + uint8 *dst = getPagePtr(dstPage) + dstW * (Y2 + r2); + const uint8 *cmp = getPagePtr(cmpPage); while (H2--) { - uint8 * s = src + r4 + X1; - uint8 * d = dst + r1 + X2; + const uint8 *s = src + r4 + X1; + uint8 *d = dst + r1 + X2; for (int i = 0; i < W2; i++) { int ix = (*s++ << 8) + *d; @@ -226,6 +226,49 @@ void Screen_v2::cmpFadeFrameStep(int srcPage, int srcW, int srcH, int srcX, int } } +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); +} + + +void Screen_v2::copyRegionEx(int srcPage, int srcW, int srcH, int dstPage, int dstX,int dstY, int dstW, int dstH, const ScreenDim *dim, bool flag) { + int x0 = dim->sx << 3; + int y0 = dim->sy; + int w0 = dim->w << 3; + int h0 = dim->h; + + int x1 = dstX; + int y1 = dstY; + int w1 = dstW; + int h1 = dstH; + + int x2, y2, w2; + + calcBounds(w0, h0, x1, y1, w1, h1, x2, y2, w2); + + const uint8 *src = getPagePtr(srcPage) + (320 * srcH) + srcW; + uint8 *dst = getPagePtr(dstPage) + 320 * (y0 + y1); + + for (int y = 0; y < h1; y++) { + const uint8 *s = src + x2; + uint8 *d = dst + x0 + x1; + + if (flag) + d += (h1 >> 1); + + for (int x = 0; x < w1; x++) { + if (*s) + *d = *s; + s++; + d++; + } + dst += 320; + src += 320; + } +} + 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; -- cgit v1.2.3