aboutsummaryrefslogtreecommitdiff
path: root/engines/lab
diff options
context:
space:
mode:
authorStrangerke2015-12-12 21:51:31 +0100
committerWillem Jan Palenstijn2015-12-23 21:34:01 +0100
commita01f0689693363bf7a46ef36c9e3885670fb657b (patch)
tree34fc9a07a2971b26c3879bcaad87fc037c49d768 /engines/lab
parentf47d41930f84d61b5cb2de4685d798e3b8aaca6b (diff)
downloadscummvm-rg350-a01f0689693363bf7a46ef36c9e3885670fb657b.tar.gz
scummvm-rg350-a01f0689693363bf7a46ef36c9e3885670fb657b.tar.bz2
scummvm-rg350-a01f0689693363bf7a46ef36c9e3885670fb657b.zip
LAB: Merge transitions in dispman
Diffstat (limited to 'engines/lab')
-rw-r--r--engines/lab/dispman.cpp448
-rw-r--r--engines/lab/module.mk1
-rw-r--r--engines/lab/transitions.cpp489
3 files changed, 448 insertions, 490 deletions
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index df35f9f29d..d2f5f8d778 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -748,4 +748,452 @@ void DisplayMan::text(TextFont *tf, uint16 x, uint16 y, uint16 color, const char
text++;
}
}
+
+/**
+ * Scrolls the display to black.
+ */
+void DisplayMan::doScrollBlack() {
+ uint16 width = _vm->_utils->vgaScaleX(320);
+ uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2);
+ byte *mem = new byte[width * height];
+
+ _vm->_event->mouseHide();
+
+ Image img;
+ img._width = width;
+ img._height = height;
+ img._imageData = mem;
+ _vm->_music->updateMusic();
+ img.readScreenImage(0, 0);
+ _vm->_music->updateMusic();
+
+ byte *baseAddr = getCurrentDrawingBuffer();
+ uint16 by = _vm->_utils->vgaScaleX(4);
+ uint16 nheight = height;
+
+ while (nheight) {
+ _vm->_music->updateMusic();
+
+ if (!_vm->_isHiRes)
+ _vm->waitTOF();
+
+ baseAddr = getCurrentDrawingBuffer();
+
+ if (by > nheight)
+ by = nheight;
+
+ mem += by * width;
+ nheight -= by;
+ uint32 copysize;
+ uint32 size = (int32)nheight * (int32)width;
+ byte *tempmem = mem;
+
+ while (size) {
+ if (size > _screenBytesPerPage)
+ copysize = _screenBytesPerPage;
+ else
+ copysize = size;
+
+ size -= copysize;
+
+ memcpy(baseAddr, tempmem, copysize);
+ tempmem += copysize;
+ }
+
+ setAPen(0);
+ rectFill(0, nheight, width - 1, nheight + by - 1);
+
+ screenUpdate();
+
+ if (!_vm->_isHiRes) {
+ if (nheight <= (height / 8))
+ by = 1;
+ else if (nheight <= (height / 4))
+ by = 2;
+ else if (nheight <= (height / 2))
+ by = 3;
+ }
+ }
+
+ delete[] mem;
+ freePict();
+ _vm->_event->mouseShow();
+}
+
+void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startLine, byte *mem) {
+ byte *baseAddr = getCurrentDrawingBuffer();
+
+ uint32 size = (int32)(height - nheight) * (int32)width;
+ mem += startLine * width;
+ uint16 curPage = ((int32)nheight * (int32)width) / _screenBytesPerPage;
+ uint32 offSet = ((int32)nheight * (int32)width) - (curPage * _screenBytesPerPage);
+
+ while (size) {
+ uint32 copySize;
+ if (size > (_screenBytesPerPage - offSet))
+ copySize = _screenBytesPerPage - offSet;
+ else
+ copySize = size;
+
+ size -= copySize;
+
+ memcpy(baseAddr + (offSet >> 2), mem, copySize);
+ mem += copySize;
+ curPage++;
+ offSet = 0;
+ }
+}
+
+/**
+ * Scrolls the display to a new picture from a black screen.
+ */
+void DisplayMan::doScrollWipe(char *filename) {
+ uint16 startLine = 0, onRow = 0;
+
+ _vm->_event->mouseHide();
+ uint16 width = _vm->_utils->vgaScaleX(320);
+ uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2);
+
+ while (_vm->_music->isSoundEffectActive()) {
+ _vm->_music->updateMusic();
+ _vm->waitTOF();
+ }
+
+ readPict(filename, true, true);
+ setPalette(_vm->_anim->_diffPalette, 256);
+ byte *mem = _vm->_anim->_rawDiffBM._planes[0];
+
+ _vm->_music->updateMusic();
+ uint16 by = _vm->_utils->vgaScaleX(3);
+ uint16 nheight = height;
+
+ while (onRow < _vm->_anim->_headerdata._height) {
+ _vm->_music->updateMusic();
+
+ if ((by > nheight) && nheight)
+ by = nheight;
+
+ if ((startLine + by) > (_vm->_anim->_headerdata._height - height - 1))
+ break;
+
+ if (nheight)
+ nheight -= by;
+
+ copyPage(width, height, nheight, startLine, mem);
+
+ screenUpdate();
+
+ if (!nheight)
+ startLine += by;
+
+ onRow += by;
+
+ if (nheight <= (height / 4))
+ by = _vm->_utils->vgaScaleX(5);
+ else if (nheight <= (height / 3))
+ by = _vm->_utils->vgaScaleX(4);
+ else if (nheight <= (height / 2))
+ by = _vm->_utils->vgaScaleX(3);
+ }
+
+ _vm->_event->mouseShow();
+}
+
+/**
+ * Does the scroll bounce. Assumes bitmap already in memory.
+ */
+void DisplayMan::doScrollBounce() {
+ const uint16 *newby, *newby1;
+
+ const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1};
+ const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2};
+
+ if (_vm->getPlatform() != Common::kPlatformWindows) {
+ newby = newbyd;
+ newby1 = newby1d;
+ } else {
+ newby = newbyw;
+ newby1 = newby1w;
+ }
+
+ _vm->_event->mouseHide();
+ int width = _vm->_utils->vgaScaleX(320);
+ int height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2);
+ byte *mem = _vm->_anim->_rawDiffBM._planes[0];
+
+ _vm->_music->updateMusic();
+ int startLine = _vm->_anim->_headerdata._height - height - 1;
+
+ for (int i = 0; i < 5; i++) {
+ _vm->_music->updateMusic();
+ startLine -= newby[i];
+ copyPage(width, height, 0, startLine, mem);
+
+ screenUpdate();
+ _vm->waitTOF();
+ }
+
+ for (int i = 8; i > 0; i--) {
+ _vm->_music->updateMusic();
+ startLine += newby1[i - 1];
+ copyPage(width, height, 0, startLine, mem);
+
+ screenUpdate();
+ _vm->waitTOF();
+ }
+
+ _vm->_event->mouseShow();
+}
+
+/**
+ * Does the transporter wipe.
+ */
+void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) {
+ uint16 lastY, curY, linesDone = 0, linesLast;
+
+ if (_vm->_isHiRes) {
+ linesLast = 3;
+ lastY = 358;
+ } else {
+ linesLast = 1;
+ lastY = 148;
+ }
+
+ for (uint16 j = 0; j < 2; j++) {
+ for (uint16 i = 0; i < 2; i++) {
+ curY = i * 2;
+
+ while (curY < lastY) {
+ if (linesDone >= linesLast) {
+ _vm->_music->updateMusic();
+ _vm->waitTOF();
+ linesDone = 0;
+ }
+
+ if (j == 9)
+ overlayRect(0, 0, curY, _screenWidth - 1, curY + 1);
+ else
+ rectFill(0, curY, _screenWidth - 1, curY + 1);
+ curY += 4;
+ linesDone++;
+ } // while
+ } // for i
+
+ setAPen(0);
+ } // for j
+
+ if (filename == NULL)
+ _vm->_curFileName = _vm->getPictName(closePtrList);
+ else if (filename[0] > ' ')
+ _vm->_curFileName = filename;
+ else
+ _vm->_curFileName = _vm->getPictName(closePtrList);
+
+ byte *bitMapBuffer = new byte[_screenWidth * (lastY + 5)];
+ readPict(_vm->_curFileName, true, false, bitMapBuffer, lastY + 5);
+
+ setPalette(_vm->_anim->_diffPalette, 256);
+
+ Image imSource;
+ imSource._width = _screenWidth;
+ imSource._height = lastY;
+ imSource._imageData = bitMapBuffer;
+
+ Image imDest;
+ imDest._width = _screenWidth;
+ imDest._height = _screenHeight;
+ imDest._imageData = getCurrentDrawingBuffer();
+
+ for (uint16 j = 0; j < 2; j++) {
+ for (uint16 i = 0; i < 2; i++) {
+ curY = i * 2;
+
+ while (curY < lastY) {
+ if (linesDone >= linesLast) {
+ _vm->_music->updateMusic();
+ _vm->waitTOF();
+ linesDone = 0;
+ }
+
+ imDest._imageData = getCurrentDrawingBuffer();
+
+ if (j == 0) {
+ imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false);
+ overlayRect(0, 0, curY, _screenWidth - 1, curY + 1);
+ } else {
+ uint16 bitmapHeight = (curY == lastY) ? 1 : 2;
+ imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, bitmapHeight, false);
+ }
+ curY += 4;
+ linesDone++;
+ } // while
+ } // for i
+ } // for j
+
+ delete[] bitMapBuffer;
+}
+
+/**
+ * Does a certain number of pre-programmed wipes.
+ */
+void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, char *filename) {
+ switch (transitionType) {
+ case kTransitionWipe:
+ case kTransitionTransporter:
+ doTransWipe(closePtrList, filename);
+ break;
+ case kTransitionScrollWipe:
+ doScrollWipe(filename);
+ break;
+ case kTransitionScrollBlack:
+ doScrollBlack();
+ break;
+ case kTransitionScrollBounce:
+ doScrollBounce();
+ break;
+ case kTransitionReadFirstFrame:
+ readPict(filename, false);
+ break;
+ case kTransitionReadNextFrame:
+ _vm->_anim->diffNextFrame();
+ break;
+ case kTransitionNone:
+ default:
+ break;
+ }
+}
+
+/**
+ * Changes the front screen to black.
+ */
+void DisplayMan::blackScreen() {
+ byte pal[256 * 3];
+ memset(pal, 0, 248 * 3);
+ writeColorRegs(pal, 8, 248);
+
+ g_system->delayMillis(32);
+}
+
+/**
+ * Changes the front screen to white.
+ */
+void DisplayMan::whiteScreen() {
+ byte pal[256 * 3];
+ memset(pal, 255, 248 * 3);
+ writeColorRegs(pal, 8, 248);
+}
+
+/**
+ * Changes the entire screen to black.
+*/
+void DisplayMan::blackAllScreen() {
+ byte pal[256 * 3];
+ memset(pal, 0, 256 * 3);
+ writeColorRegs(pal, 0, 256);
+
+ g_system->delayMillis(32);
+}
+
+/**
+ * Scrolls the display in the x direction by blitting.
+ * The _tempScrollData variable must be initialized to some memory, or this
+ * function will fail.
+ */
+void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) {
+ Image im;
+ im._imageData = buffer;
+
+ if (x1 > x2)
+ SWAP<uint16>(x1, x2);
+
+ if (y1 > y2)
+ SWAP<uint16>(y1, y2);
+
+ if (dx > 0) {
+ im._width = x2 - x1 + 1 - dx;
+ im._height = y2 - y1 + 1;
+
+ im.readScreenImage(x1, y1);
+ im.drawImage(x1 + dx, y1);
+
+ setAPen(0);
+ rectFill(x1, y1, x1 + dx - 1, y2);
+ } else if (dx < 0) {
+ im._width = x2 - x1 + 1 + dx;
+ im._height = y2 - y1 + 1;
+
+ im.readScreenImage(x1 - dx, y1);
+ im.drawImage(x1, y1);
+
+ setAPen(0);
+ rectFill(x2 + dx + 1, y1, x2, y2);
+ }
+}
+
+/**
+ * Scrolls the display in the y direction by blitting.
+ */
+void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) {
+ Image im;
+ im._imageData = buffer;
+
+ if (x1 > x2)
+ SWAP<uint16>(x1, x2);
+
+ if (y1 > y2)
+ SWAP<uint16>(y1, y2);
+
+ if (dy > 0) {
+ im._width = x2 - x1 + 1;
+ im._height = y2 - y1 + 1 - dy;
+
+ im.readScreenImage(x1, y1);
+ im.drawImage(x1, y1 + dy);
+
+ setAPen(0);
+ rectFill(x1, y1, x2, y1 + dy - 1);
+ } else if (dy < 0) {
+ im._width = x2 - x1 + 1;
+ im._height = y2 - y1 + 1 + dy;
+
+ im.readScreenImage(x1, y1 - dy);
+ im.drawImage(x1, y1);
+
+ setAPen(0);
+ rectFill(x1, y2 + dy + 1, x2, y2);
+ }
+}
+
+/**
+ * Does the fading of the Palette on the screen.
+ */
+uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) {
+ return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15));
+}
+
+uint16 DisplayMan::fadeNumOut(uint16 num, uint16 res, uint16 counter) {
+ return (num - ((((int32) counter) * ((int32)(num - res))) / 15));
+}
+
+void DisplayMan::fade(bool fadeIn, uint16 res) {
+ uint16 newPal[16];
+
+ for (uint16 i = 0; i < 16; i++) {
+ for (uint16 palIdx = 0; palIdx < 16; palIdx++) {
+ if (fadeIn)
+ newPal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) +
+ (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) +
+ (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i));
+ else
+ newPal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) +
+ (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) +
+ (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i));
+ }
+
+ setAmigaPal(newPal, 16);
+ _vm->waitTOF();
+ _vm->_music->updateMusic();
+ }
+}
+
} // End of namespace Lab
diff --git a/engines/lab/module.mk b/engines/lab/module.mk
index a0dcfde512..6b7932a59e 100644
--- a/engines/lab/module.mk
+++ b/engines/lab/module.mk
@@ -18,7 +18,6 @@ MODULE_OBJS := \
savegame.o \
special.o \
tilepuzzle.o \
- transitions.o \
utils.o
# This module can be built as a plugin
diff --git a/engines/lab/transitions.cpp b/engines/lab/transitions.cpp
deleted file mode 100644
index d7adff33fb..0000000000
--- a/engines/lab/transitions.cpp
+++ /dev/null
@@ -1,489 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This code is based on Labyrinth of Time code with assistance of
- *
- * Copyright (c) 1993 Terra Nova Development
- * Copyright (c) 2004 The Wyrmkeep Entertainment Co.
- *
- */
-
-#include "lab/lab.h"
-
-#include "lab/anim.h"
-#include "lab/dispman.h"
-#include "lab/eventman.h"
-#include "lab/image.h"
-#include "lab/music.h"
-#include "lab/utils.h"
-
-namespace Lab {
-
-/**
- * Scrolls the display to black.
- */
-void DisplayMan::doScrollBlack() {
- uint16 width = _vm->_utils->vgaScaleX(320);
- uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2);
- byte *mem = new byte[width * height];
-
- _vm->_event->mouseHide();
-
- Image img;
- img._width = width;
- img._height = height;
- img._imageData = mem;
- _vm->_music->updateMusic();
- img.readScreenImage(0, 0);
- _vm->_music->updateMusic();
-
- byte *baseAddr = getCurrentDrawingBuffer();
- uint16 by = _vm->_utils->vgaScaleX(4);
- uint16 nheight = height;
-
- while (nheight) {
- _vm->_music->updateMusic();
-
- if (!_vm->_isHiRes)
- _vm->waitTOF();
-
- baseAddr = getCurrentDrawingBuffer();
-
- if (by > nheight)
- by = nheight;
-
- mem += by * width;
- nheight -= by;
- uint32 copysize;
- uint32 size = (int32)nheight * (int32)width;
- byte *tempmem = mem;
-
- while (size) {
- if (size > _screenBytesPerPage)
- copysize = _screenBytesPerPage;
- else
- copysize = size;
-
- size -= copysize;
-
- memcpy(baseAddr, tempmem, copysize);
- tempmem += copysize;
- }
-
- setAPen(0);
- rectFill(0, nheight, width - 1, nheight + by - 1);
-
- screenUpdate();
-
- if (!_vm->_isHiRes) {
- if (nheight <= (height / 8))
- by = 1;
- else if (nheight <= (height / 4))
- by = 2;
- else if (nheight <= (height / 2))
- by = 3;
- }
- }
-
- delete[] mem;
- freePict();
- _vm->_event->mouseShow();
-}
-
-void DisplayMan::copyPage(uint16 width, uint16 height, uint16 nheight, uint16 startLine, byte *mem) {
- byte *baseAddr = getCurrentDrawingBuffer();
-
- uint32 size = (int32)(height - nheight) * (int32)width;
- mem += startLine * width;
- uint16 curPage = ((int32)nheight * (int32)width) / _screenBytesPerPage;
- uint32 offSet = ((int32)nheight * (int32)width) - (curPage * _screenBytesPerPage);
-
- while (size) {
- uint32 copySize;
- if (size > (_screenBytesPerPage - offSet))
- copySize = _screenBytesPerPage - offSet;
- else
- copySize = size;
-
- size -= copySize;
-
- memcpy(baseAddr + (offSet >> 2), mem, copySize);
- mem += copySize;
- curPage++;
- offSet = 0;
- }
-}
-
-/**
- * Scrolls the display to a new picture from a black screen.
- */
-void DisplayMan::doScrollWipe(char *filename) {
- uint16 startLine = 0, onRow = 0;
-
- _vm->_event->mouseHide();
- uint16 width = _vm->_utils->vgaScaleX(320);
- uint16 height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2);
-
- while (_vm->_music->isSoundEffectActive()) {
- _vm->_music->updateMusic();
- _vm->waitTOF();
- }
-
- readPict(filename, true, true);
- setPalette(_vm->_anim->_diffPalette, 256);
- byte *mem = _vm->_anim->_rawDiffBM._planes[0];
-
- _vm->_music->updateMusic();
- uint16 by = _vm->_utils->vgaScaleX(3);
- uint16 nheight = height;
-
- while (onRow < _vm->_anim->_headerdata._height) {
- _vm->_music->updateMusic();
-
- if ((by > nheight) && nheight)
- by = nheight;
-
- if ((startLine + by) > (_vm->_anim->_headerdata._height - height - 1))
- break;
-
- if (nheight)
- nheight -= by;
-
- copyPage(width, height, nheight, startLine, mem);
-
- screenUpdate();
-
- if (!nheight)
- startLine += by;
-
- onRow += by;
-
- if (nheight <= (height / 4))
- by = _vm->_utils->vgaScaleX(5);
- else if (nheight <= (height / 3))
- by = _vm->_utils->vgaScaleX(4);
- else if (nheight <= (height / 2))
- by = _vm->_utils->vgaScaleX(3);
- }
-
- _vm->_event->mouseShow();
-}
-
-/**
- * Does the scroll bounce. Assumes bitmap already in memory.
- */
-void DisplayMan::doScrollBounce() {
- const uint16 *newby, *newby1;
-
- const uint16 newbyd[5] = {5, 4, 3, 2, 1}, newby1d[8] = {3, 3, 2, 2, 2, 1, 1, 1};
- const uint16 newbyw[5] = {10, 8, 6, 4, 2}, newby1w[8] = {6, 6, 4, 4, 4, 2, 2, 2};
-
- if (_vm->getPlatform() != Common::kPlatformWindows) {
- newby = newbyd;
- newby1 = newby1d;
- } else {
- newby = newbyw;
- newby1 = newby1w;
- }
-
- _vm->_event->mouseHide();
- int width = _vm->_utils->vgaScaleX(320);
- int height = _vm->_utils->vgaScaleY(149) + _vm->_utils->svgaCord(2);
- byte *mem = _vm->_anim->_rawDiffBM._planes[0];
-
- _vm->_music->updateMusic();
- int startLine = _vm->_anim->_headerdata._height - height - 1;
-
- for (int i = 0; i < 5; i++) {
- _vm->_music->updateMusic();
- startLine -= newby[i];
- copyPage(width, height, 0, startLine, mem);
-
- screenUpdate();
- _vm->waitTOF();
- }
-
- for (int i = 8; i > 0; i--) {
- _vm->_music->updateMusic();
- startLine += newby1[i - 1];
- copyPage(width, height, 0, startLine, mem);
-
- screenUpdate();
- _vm->waitTOF();
- }
-
- _vm->_event->mouseShow();
-}
-
-/**
- * Does the transporter wipe.
- */
-void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) {
- uint16 lastY, curY, linesDone = 0, linesLast;
-
- if (_vm->_isHiRes) {
- linesLast = 3;
- lastY = 358;
- } else {
- linesLast = 1;
- lastY = 148;
- }
-
- for (uint16 j = 0; j < 2; j++) {
- for (uint16 i = 0; i < 2; i++) {
- curY = i * 2;
-
- while (curY < lastY) {
- if (linesDone >= linesLast) {
- _vm->_music->updateMusic();
- _vm->waitTOF();
- linesDone = 0;
- }
-
- if (j == 9)
- overlayRect(0, 0, curY, _screenWidth - 1, curY + 1);
- else
- rectFill(0, curY, _screenWidth - 1, curY + 1);
- curY += 4;
- linesDone++;
- } // while
- } // for i
-
- setAPen(0);
- } // for j
-
- if (filename == NULL)
- _vm->_curFileName = _vm->getPictName(closePtrList);
- else if (filename[0] > ' ')
- _vm->_curFileName = filename;
- else
- _vm->_curFileName = _vm->getPictName(closePtrList);
-
- byte *bitMapBuffer = new byte[_screenWidth * (lastY + 5)];
- readPict(_vm->_curFileName, true, false, bitMapBuffer, lastY + 5);
-
- setPalette(_vm->_anim->_diffPalette, 256);
-
- Image imSource;
- imSource._width = _screenWidth;
- imSource._height = lastY;
- imSource._imageData = bitMapBuffer;
-
- Image imDest;
- imDest._width = _screenWidth;
- imDest._height = _screenHeight;
- imDest._imageData = getCurrentDrawingBuffer();
-
- for (uint16 j = 0; j < 2; j++) {
- for (uint16 i = 0; i < 2; i++) {
- curY = i * 2;
-
- while (curY < lastY) {
- if (linesDone >= linesLast) {
- _vm->_music->updateMusic();
- _vm->waitTOF();
- linesDone = 0;
- }
-
- imDest._imageData = getCurrentDrawingBuffer();
-
- if (j == 0) {
- imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, 2, false);
- overlayRect(0, 0, curY, _screenWidth - 1, curY + 1);
- } else {
- uint16 bitmapHeight = (curY == lastY) ? 1 : 2;
- imSource.blitBitmap(0, curY, &imDest, 0, curY, _screenWidth, bitmapHeight, false);
- }
- curY += 4;
- linesDone++;
- } // while
- } // for i
- } // for j
-
- delete[] bitMapBuffer;
-}
-
-/**
- * Does a certain number of pre-programmed wipes.
- */
-void DisplayMan::doTransition(TransitionType transitionType, CloseDataPtr *closePtrList, char *filename) {
- switch (transitionType) {
- case kTransitionWipe:
- case kTransitionTransporter:
- doTransWipe(closePtrList, filename);
- break;
- case kTransitionScrollWipe:
- doScrollWipe(filename);
- break;
- case kTransitionScrollBlack:
- doScrollBlack();
- break;
- case kTransitionScrollBounce:
- doScrollBounce();
- break;
- case kTransitionReadFirstFrame:
- readPict(filename, false);
- break;
- case kTransitionReadNextFrame:
- _vm->_anim->diffNextFrame();
- break;
- case kTransitionNone:
- default:
- break;
- }
-}
-
-/**
- * Changes the front screen to black.
- */
-void DisplayMan::blackScreen() {
- byte pal[256 * 3];
- memset(pal, 0, 248 * 3);
- writeColorRegs(pal, 8, 248);
-
- g_system->delayMillis(32);
-}
-
-/**
- * Changes the front screen to white.
- */
-void DisplayMan::whiteScreen() {
- byte pal[256 * 3];
- memset(pal, 255, 248 * 3);
- writeColorRegs(pal, 8, 248);
-}
-
-/**
- * Changes the entire screen to black.
-*/
-void DisplayMan::blackAllScreen() {
- byte pal[256 * 3];
- memset(pal, 0, 256 * 3);
- writeColorRegs(pal, 0, 256);
-
- g_system->delayMillis(32);
-}
-
-/**
- * Scrolls the display in the x direction by blitting.
- * The _tempScrollData variable must be initialized to some memory, or this
- * function will fail.
- */
-void DisplayMan::scrollDisplayX(int16 dx, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) {
- Image im;
- im._imageData = buffer;
-
- if (x1 > x2)
- SWAP<uint16>(x1, x2);
-
- if (y1 > y2)
- SWAP<uint16>(y1, y2);
-
- if (dx > 0) {
- im._width = x2 - x1 + 1 - dx;
- im._height = y2 - y1 + 1;
-
- im.readScreenImage(x1, y1);
- im.drawImage(x1 + dx, y1);
-
- setAPen(0);
- rectFill(x1, y1, x1 + dx - 1, y2);
- } else if (dx < 0) {
- im._width = x2 - x1 + 1 + dx;
- im._height = y2 - y1 + 1;
-
- im.readScreenImage(x1 - dx, y1);
- im.drawImage(x1, y1);
-
- setAPen(0);
- rectFill(x2 + dx + 1, y1, x2, y2);
- }
-}
-
-/**
- * Scrolls the display in the y direction by blitting.
- */
-void DisplayMan::scrollDisplayY(int16 dy, uint16 x1, uint16 y1, uint16 x2, uint16 y2, byte *buffer) {
- Image im;
- im._imageData = buffer;
-
- if (x1 > x2)
- SWAP<uint16>(x1, x2);
-
- if (y1 > y2)
- SWAP<uint16>(y1, y2);
-
- if (dy > 0) {
- im._width = x2 - x1 + 1;
- im._height = y2 - y1 + 1 - dy;
-
- im.readScreenImage(x1, y1);
- im.drawImage(x1, y1 + dy);
-
- setAPen(0);
- rectFill(x1, y1, x2, y1 + dy - 1);
- } else if (dy < 0) {
- im._width = x2 - x1 + 1;
- im._height = y2 - y1 + 1 + dy;
-
- im.readScreenImage(x1, y1 - dy);
- im.drawImage(x1, y1);
-
- setAPen(0);
- rectFill(x1, y2 + dy + 1, x2, y2);
- }
-}
-
-/**
- * Does the fading of the Palette on the screen.
- */
-uint16 DisplayMan::fadeNumIn(uint16 num, uint16 res, uint16 counter) {
- return (num - ((((int32)(15 - counter)) * ((int32)(num - res))) / 15));
-}
-
-uint16 DisplayMan::fadeNumOut(uint16 num, uint16 res, uint16 counter) {
- return (num - ((((int32) counter) * ((int32)(num - res))) / 15));
-}
-
-void DisplayMan::fade(bool fadeIn, uint16 res) {
- uint16 newPal[16];
-
- for (uint16 i = 0; i < 16; i++) {
- for (uint16 palIdx = 0; palIdx < 16; palIdx++) {
- if (fadeIn)
- newPal[palIdx] = (0x00F & fadeNumIn(0x00F & FadePalette[palIdx], 0x00F & res, i)) +
- (0x0F0 & fadeNumIn(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) +
- (0xF00 & fadeNumIn(0xF00 & FadePalette[palIdx], 0xF00 & res, i));
- else
- newPal[palIdx] = (0x00F & fadeNumOut(0x00F & FadePalette[palIdx], 0x00F & res, i)) +
- (0x0F0 & fadeNumOut(0x0F0 & FadePalette[palIdx], 0x0F0 & res, i)) +
- (0xF00 & fadeNumOut(0xF00 & FadePalette[palIdx], 0xF00 & res, i));
- }
-
- setAmigaPal(newPal, 16);
- _vm->waitTOF();
- _vm->_music->updateMusic();
- }
-}
-
-} // End of namespace Lab