aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2015-12-01 15:00:26 +0100
committerWillem Jan Palenstijn2015-12-23 21:33:46 +0100
commit83d88cab8065613c71f91ce2b941b00192694ae1 (patch)
treec87847884dbb3e679047bf6ce91850ef871f813a
parent27c204976e15fa4759b540b972a81fa0762a8cc9 (diff)
downloadscummvm-rg350-83d88cab8065613c71f91ce2b941b00192694ae1.tar.gz
scummvm-rg350-83d88cab8065613c71f91ce2b941b00192694ae1.tar.bz2
scummvm-rg350-83d88cab8065613c71f91ce2b941b00192694ae1.zip
LAB: Some renaming, get rid of copytwo()
-rw-r--r--engines/lab/diff.h35
-rw-r--r--engines/lab/graphics.cpp32
-rw-r--r--engines/lab/readdiff.cpp62
-rw-r--r--engines/lab/undiff.cpp90
4 files changed, 95 insertions, 124 deletions
diff --git a/engines/lab/diff.h b/engines/lab/diff.h
index 5ed627834b..4ff2059095 100644
--- a/engines/lab/diff.h
+++ b/engines/lab/diff.h
@@ -37,33 +37,34 @@ namespace Lab {
struct DIFFHeader {
- uint16 Version; // unused
- uint16 x, y;
- char depth; // unused
- char fps;
- uint32 BufferSize; // unused
- uint16 Machine; // unused
- uint32 Flags;
+ uint16 _version; // unused
+ uint16 _width;
+ uint16 _height;
+ char _depth; // unused
+ char _fps;
+ uint32 _bufferSize; // unused
+ uint16 _machine; // unused
+ uint32 _flags;
};
struct BitMap {
- uint16 BytesPerRow, Rows;
- byte Flags;
- byte *Planes[16];
+ uint16 _bytesPerRow;
+ uint16 _rows; // unused
+ byte _flags;
+ byte *_planes[16];
};
+#define BITMAPF_NONE 0
#define BITMAPF_VIDEO (1<<7)
/* unDiff.c */
-void initOffsets(uint16 bytesperrow);
+void initOffsets(uint16 bytesPerRow);
-bool unDIFFMemory(byte *Dest, /* Where to Un-DIFF */
- byte *diff, /* The DIFFed code. */
- uint16 HeaderSize, /* Size of header (1, 2 or 4 bytes)
- (only supports 1 currently */
- uint16 CopySize); /* Size of minimum copy or skip.
- (1, 2 or 4 bytes) */
+bool unDIFFMemory(byte *dest, /* Where to Un-DIFF */
+ byte *diff, /* The DIFFed code. */
+ uint16 headerSize, /* Size of header (1, 2 or 4 bytes) (only supports 1 currently */
+ uint16 copySize); /* Size of minimum copy or skip. (1, 2 or 4 bytes) */
bool VUnDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize, uint16 bytesperrow);
void runLengthDecode(byte *Dest, byte *Source);
diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp
index fa750a66ed..1adcb2dfe8 100644
--- a/engines/lab/graphics.cpp
+++ b/engines/lab/graphics.cpp
@@ -70,9 +70,9 @@ bool readPict(const char *filename, bool playOnce) {
return false;
}
- DispBitMap->BytesPerRow = g_lab->_screenWidth;
- DispBitMap->Rows = g_lab->_screenHeight;
- DispBitMap->Flags = BITMAPF_VIDEO;
+ DispBitMap->_bytesPerRow = g_lab->_screenWidth;
+ DispBitMap->_rows = g_lab->_screenHeight;
+ DispBitMap->_flags = BITMAPF_VIDEO;
readDiff(playOnce);
@@ -112,14 +112,14 @@ byte *readPictToMem(const char *filename, uint16 x, uint16 y) {
if (file == NULL)
return NULL;
- DispBitMap->BytesPerRow = x;
- DispBitMap->Rows = y;
- DispBitMap->Flags = 0;
- DispBitMap->Planes[0] = curMem;
- DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000;
- DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000;
- DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000;
- DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000;
+ DispBitMap->_bytesPerRow = x;
+ DispBitMap->_rows = y;
+ DispBitMap->_flags = BITMAPF_NONE;
+ DispBitMap->_planes[0] = curMem;
+ DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000;
+ DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000;
+ DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000;
+ DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000;
readDiff(true);
@@ -486,19 +486,19 @@ void LabEngine::doScrollWipe(char *filename) {
readPict(filename, true);
setPalette(diffcmap, 256);
IsBM = false;
- byte *mem = RawDiffBM.Planes[0];
+ byte *mem = RawDiffBM._planes[0];
_music->updateMusic();
uint16 by = VGAScaleX(3);
uint16 nheight = height;
- while (onrow < headerdata.y) {
+ while (onrow < headerdata._height) {
_music->updateMusic();
if ((by > nheight) && nheight)
by = nheight;
- if ((startline + by) > (headerdata.y - height - 1))
+ if ((startline + by) > (headerdata._height - height - 1))
break;
if (nheight)
@@ -544,10 +544,10 @@ void LabEngine::doScrollBounce() {
_event->mouseHide();
int width = VGAScaleX(320);
int height = VGAScaleY(149) + SVGACord(2);
- byte *mem = RawDiffBM.Planes[0];
+ byte *mem = RawDiffBM._planes[0];
_music->updateMusic();
- int startline = headerdata.y - height - 1;
+ int startline = headerdata._height - height - 1;
for (int i = 0; i < 5; i++) {
_music->updateMusic();
diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp
index 042889cd38..abaa4f54fe 100644
--- a/engines/lab/readdiff.cpp
+++ b/engines/lab/readdiff.cpp
@@ -59,7 +59,7 @@ static bool continuous,
IsAnim = false,
IsPal = false;
-uint16 DataBytesPerRow;
+uint16 _dataBytesPerRow;
DIFFHeader headerdata;
char diffcmap[256 * 3];
BitMap RawDiffBM;
@@ -119,12 +119,12 @@ void LabEngine::diffNextFrame() {
if (header == 65535) /* Already done. */
return;
- if (DispBitMap->Flags & BITMAPF_VIDEO) {
- DispBitMap->Planes[0] = getCurrentDrawingBuffer();
- DispBitMap->Planes[1] = DispBitMap->Planes[0] + 0x10000;
- DispBitMap->Planes[2] = DispBitMap->Planes[1] + 0x10000;
- DispBitMap->Planes[3] = DispBitMap->Planes[2] + 0x10000;
- DispBitMap->Planes[4] = DispBitMap->Planes[3] + 0x10000;
+ if (DispBitMap->_flags & BITMAPF_VIDEO) {
+ DispBitMap->_planes[0] = getCurrentDrawingBuffer();
+ DispBitMap->_planes[1] = DispBitMap->_planes[0] + 0x10000;
+ DispBitMap->_planes[2] = DispBitMap->_planes[1] + 0x10000;
+ DispBitMap->_planes[3] = DispBitMap->_planes[2] + 0x10000;
+ DispBitMap->_planes[4] = DispBitMap->_planes[3] + 0x10000;
}
_event->mouseHide();
@@ -134,7 +134,7 @@ void LabEngine::diffNextFrame() {
_event->mouseShow();
if (!IsBM) {
- if (headerdata.fps) {
+ if (headerdata._fps) {
waitForTime(WaitSec, WaitMicros);
addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros);
}
@@ -162,7 +162,7 @@ void LabEngine::diffNextFrame() {
IsAnim = (framenumber >= 3) && (!PlayOnce);
CurBit = 0;
- if (DispBitMap->Flags & BITMAPF_VIDEO)
+ if (DispBitMap->_flags & BITMAPF_VIDEO)
screenUpdate();
return; /* done with the next frame. */
@@ -182,12 +182,12 @@ void LabEngine::diffNextFrame() {
break;
case 10L:
- RawDiffBM.Planes[CurBit] = *difffile;
+ RawDiffBM._planes[CurBit] = *difffile;
if (IsBM)
(*difffile) += size;
else {
- readBlock(DrawBitMap->Planes[CurBit], size, difffile);
+ readBlock(DrawBitMap->_planes[CurBit], size, difffile);
}
CurBit++;
@@ -195,26 +195,26 @@ void LabEngine::diffNextFrame() {
case 11L:
(*difffile) += 4;
- runLengthDecode(DrawBitMap->Planes[CurBit], *difffile);
+ runLengthDecode(DrawBitMap->_planes[CurBit], *difffile);
CurBit++;
(*difffile) += size - 4;
break;
case 12L:
(*difffile) += 4;
- VRunLengthDecode(DrawBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow);
+ VRunLengthDecode(DrawBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow);
CurBit++;
(*difffile) += size - 4;
break;
case 20L:
- unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, false);
+ unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, false);
CurBit++;
(*difffile) += size;
break;
case 21L:
- unDiff(DrawBitMap->Planes[CurBit], DispBitMap->Planes[CurBit], *difffile, DrawBitMap->BytesPerRow, true);
+ unDiff(DrawBitMap->_planes[CurBit], DispBitMap->_planes[CurBit], *difffile, DrawBitMap->_bytesPerRow, true);
CurBit++;
(*difffile) += size;
break;
@@ -259,7 +259,7 @@ void LabEngine::diffNextFrame() {
_music->updateMusic();
waitTOF();
- if (DispBitMap->Flags & BITMAPF_VIDEO)
+ if (DispBitMap->_flags & BITMAPF_VIDEO)
didTOF = 1;
}
}
@@ -334,29 +334,29 @@ void playDiff() {
if (header == 0) {
// sizeof(headerdata) != 18, but the padding might be at the end
- headerdata.Version = READ_LE_UINT16(*difffile);
+ headerdata._version = READ_LE_UINT16(*difffile);
(*difffile) += 2;
- headerdata.x = READ_LE_UINT16(*difffile);
+ headerdata._width = READ_LE_UINT16(*difffile);
(*difffile) += 2;
- headerdata.y = READ_LE_UINT16(*difffile);
+ headerdata._height = READ_LE_UINT16(*difffile);
(*difffile) += 2;
- headerdata.depth = *difffile[0];
+ headerdata._depth = *difffile[0];
(*difffile)++;
- headerdata.fps = *difffile[0];
+ headerdata._fps = *difffile[0];
(*difffile)++;
- headerdata.BufferSize = READ_LE_UINT32(*difffile);
+ headerdata._bufferSize = READ_LE_UINT32(*difffile);
(*difffile) += 4;
- headerdata.Machine = READ_LE_UINT16(*difffile);
+ headerdata._machine = READ_LE_UINT16(*difffile);
(*difffile) += 2;
- headerdata.Flags = READ_LE_UINT32(*difffile);
+ headerdata._flags = READ_LE_UINT32(*difffile);
(*difffile) += 4;
(*difffile) += size - 18;
- continuous = CONTINUOUS & headerdata.Flags;
- diffwidth = headerdata.x;
- diffheight = headerdata.y;
- DataBytesPerRow = diffwidth;
+ continuous = CONTINUOUS & headerdata._flags;
+ diffwidth = headerdata._width;
+ diffheight = headerdata._height;
+ _dataBytesPerRow = diffwidth;
numchunks = (((int32) diffwidth) * diffheight) / 0x10000;
@@ -367,10 +367,10 @@ void playDiff() {
}
for (header = 0; header < 8; header++)
- RawDiffBM.Planes[header] = NULL;
+ RawDiffBM._planes[header] = NULL;
- if (headerdata.fps)
- DelayMicros = ONESECOND / headerdata.fps;
+ if (headerdata._fps)
+ DelayMicros = ONESECOND / headerdata._fps;
if (PlayOnce) {
while (header != 65535)
diff --git a/engines/lab/undiff.cpp b/engines/lab/undiff.cpp
index f7d89898a4..e5f193c777 100644
--- a/engines/lab/undiff.cpp
+++ b/engines/lab/undiff.cpp
@@ -33,39 +33,15 @@
namespace Lab {
-extern uint16 DataBytesPerRow;
-
-
-
-/*****************************************************************************/
-/* Copies memory. */
-/*****************************************************************************/
-
-static void copytwo(byte *Dest, byte *Source) {
-#if defined(USE_SWAP)
- Dest[1] = Source[0];
- Dest[0] = Source[1];
-#else
- *Dest = *Source;
- Dest++;
- Source++;
- *Dest = *Source;
-#endif
-}
-
-
-
+extern uint16 _dataBytesPerRow;
/*------------------------ unDiff Horizontal Memory -------------------------*/
-
-
-
/*****************************************************************************/
/* Undiffs a piece of memory when header size is a byte, and copy/skip size */
/* is also a byte. */
/*****************************************************************************/
-static void unDIFFByteByte(byte *Dest, byte *diff) {
+static void unDIFFByteByte(byte *dest, byte *diff) {
uint16 skip, copy;
while (1) {
@@ -76,17 +52,17 @@ static void unDIFFByteByte(byte *Dest, byte *diff) {
if (skip == 255) {
if (copy == 0) {
- copytwo((byte *) &skip, diff);
+ skip = READ_LE_UINT16(diff);
diff += 2;
- copytwo((byte *) &copy, diff);
+ copy = READ_LE_UINT16(diff);
diff += 2;
} else if (copy == 255)
return;
}
- Dest += skip;
- memcpy(Dest, diff, copy);
- Dest += copy;
+ dest += skip;
+ memcpy(dest, diff, copy);
+ dest += copy;
diff += copy;
}
}
@@ -97,7 +73,7 @@ static void unDIFFByteByte(byte *Dest, byte *diff) {
/* Undiffs a piece of memory when header size is a byte, and copy/skip size */
/* is a word. */
/*****************************************************************************/
-static void unDIFFByteWord(uint16 *Dest, uint16 *diff) {
+static void unDIFFByteWord(uint16 *dest, uint16 *diff) {
uint16 skip, copy;
while (1) {
@@ -116,31 +92,31 @@ static void unDIFFByteWord(uint16 *Dest, uint16 *diff) {
return;
}
- Dest += skip;
+ dest += skip;
while (copy > 3) {
- *Dest = READ_LE_UINT16(diff);
- Dest++;
+ *dest = READ_LE_UINT16(diff);
+ dest++;
diff++;
- *Dest = READ_LE_UINT16(diff);
- Dest++;
+ *dest = READ_LE_UINT16(diff);
+ dest++;
diff++;
- *Dest = READ_LE_UINT16(diff);
- Dest++;
+ *dest = READ_LE_UINT16(diff);
+ dest++;
diff++;
- *Dest = READ_LE_UINT16(diff);
- Dest++;
+ *dest = READ_LE_UINT16(diff);
+ dest++;
diff++;
copy -= 4;
}
while (copy) {
- *Dest = READ_LE_UINT16(diff);
- Dest++;
+ *dest = READ_LE_UINT16(diff);
+ dest++;
diff++;
copy--;
}
@@ -152,30 +128,24 @@ static void unDIFFByteWord(uint16 *Dest, uint16 *diff) {
/*****************************************************************************/
/* UnDiffs a coded DIFF string onto an already initialized piece of memory. */
/*****************************************************************************/
-bool unDIFFMemory(byte *Dest, byte *diff, uint16 HeaderSize, uint16 CopySize) {
- if (HeaderSize == 1) {
- if (CopySize == 1)
- unDIFFByteByte(Dest, diff);
+bool unDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySize) {
+ if (headerSize == 1) {
+ if (copySize == 1)
+ unDIFFByteByte(dest, diff);
- else if (CopySize == 2)
- unDIFFByteWord((uint16 *)Dest, (uint16 *)diff);
+ else if (copySize == 2)
+ unDIFFByteWord((uint16 *)dest, (uint16 *)diff);
else
return false;
} else
- error("unDIFFMemory: HeaderSize is %d", HeaderSize);
+ error("unDIFFMemory: HeaderSize is %d", headerSize);
return true;
}
-
-
-
/*------------------------- unDiff Vertical Memory --------------------------*/
-
-
-
/*****************************************************************************/
/* Undiffs a piece of memory when header size is a byte, and copy/skip size */
/* is a byte. */
@@ -186,7 +156,7 @@ static void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) {
uint16 counter = 0;
- while (counter < DataBytesPerRow) {
+ while (counter < _dataBytesPerRow) {
CurPtr = Dest + counter;
for (;;) {
@@ -229,7 +199,7 @@ static void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) {
wordsperrow = bytesperrow / 2;
- while (counter < (DataBytesPerRow >> 1)) {
+ while (counter < (_dataBytesPerRow >> 1)) {
CurPtr = Dest + counter;
for (;;) {
@@ -274,7 +244,7 @@ static void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) {
longsperrow = bytesperrow / 4;
- while (counter < (DataBytesPerRow >> 2)) {
+ while (counter < (_dataBytesPerRow >> 2)) {
CurPtr = Dest + counter;
for (;;) {
@@ -373,7 +343,7 @@ void VRunLengthDecode(byte *Dest, byte *Source, uint16 bytesperrow) {
int16 count;
byte *Top = Dest;
- for (uint16 i = 0; i < DataBytesPerRow; i++) {
+ for (uint16 i = 0; i < _dataBytesPerRow; i++) {
Dest = Top;
Dest += i;